diff options
author | dim <dim@FreeBSD.org> | 2012-05-03 16:53:59 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-05-03 16:53:59 +0000 |
commit | 822bde9df508e0b9afac5e581b0d6ab403417a28 (patch) | |
tree | 2e51705e103e92c7be1b21e8bd8ffd5b5d0e4d52 /tools | |
parent | 50b73317314e889cf39c7b1d6cbf419fa7502f22 (diff) | |
download | FreeBSD-src-822bde9df508e0b9afac5e581b0d6ab403417a28.zip FreeBSD-src-822bde9df508e0b9afac5e581b0d6ab403417a28.tar.gz |
Vendor import of clang release_31 branch r155985:
http://llvm.org/svn/llvm-project/cfe/branches/release_31@155985
Diffstat (limited to 'tools')
-rw-r--r-- | tools/arcmt-test/Makefile | 2 | ||||
-rw-r--r-- | tools/c-arcmt-test/Makefile | 2 | ||||
-rw-r--r-- | tools/c-index-test/Makefile | 2 | ||||
-rw-r--r-- | tools/c-index-test/c-index-test.c | 1 | ||||
-rw-r--r-- | tools/clang-check/ClangCheck.cpp | 16 | ||||
-rw-r--r-- | tools/driver/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tools/driver/Makefile | 2 | ||||
-rw-r--r-- | tools/libclang/CIndex.cpp | 34 | ||||
-rw-r--r-- | tools/libclang/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tools/libclang/CXCursor.cpp | 14 | ||||
-rw-r--r-- | tools/libclang/Makefile | 5 | ||||
-rwxr-xr-x | tools/scan-build/ccc-analyzer | 2 |
12 files changed, 64 insertions, 18 deletions
diff --git a/tools/arcmt-test/Makefile b/tools/arcmt-test/Makefile index f5ca81a..57cd574 100644 --- a/tools/arcmt-test/Makefile +++ b/tools/arcmt-test/Makefile @@ -17,7 +17,7 @@ TOOL_NO_EXPORTS = 1 NO_INSTALL = 1 LINK_COMPONENTS := support mc -USEDLIBS = clangIndex.a clangARCMigrate.a clangRewrite.a \ +USEDLIBS = clangARCMigrate.a clangRewrite.a \ clangFrontend.a clangDriver.a clangSerialization.a clangParse.a \ clangSema.a clangEdit.a clangAnalysis.a clangAST.a clangLex.a clangBasic.a diff --git a/tools/c-arcmt-test/Makefile b/tools/c-arcmt-test/Makefile index 878eb6f..818f648 100644 --- a/tools/c-arcmt-test/Makefile +++ b/tools/c-arcmt-test/Makefile @@ -17,7 +17,7 @@ TOOL_NO_EXPORTS = 1 NO_INSTALL = 1 LINK_COMPONENTS := support mc -USEDLIBS = clang.a clangIndex.a clangARCMigrate.a clangRewrite.a \ +USEDLIBS = clang.a clangARCMigrate.a clangRewrite.a \ clangFrontend.a clangDriver.a \ clangSerialization.a clangParse.a clangSema.a \ clangAnalysis.a clangEdit.a clangAST.a clangLex.a clangBasic.a diff --git a/tools/c-index-test/Makefile b/tools/c-index-test/Makefile index 95a961f..03519b3 100644 --- a/tools/c-index-test/Makefile +++ b/tools/c-index-test/Makefile @@ -18,7 +18,7 @@ INTERNAL_TOOL = 1 TOOL_NO_EXPORTS = 1 LINK_COMPONENTS := support mc -USEDLIBS = clang.a clangIndex.a clangFrontend.a clangDriver.a \ +USEDLIBS = clang.a clangFrontend.a clangDriver.a \ clangSerialization.a clangParse.a clangSema.a \ clangAnalysis.a clangEdit.a clangAST.a clangLex.a clangBasic.a diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 573e6dc..eb2a406 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -2243,6 +2243,7 @@ int perform_token_annotation(int argc, const char **argv) { clang_getSpellingLocation(clang_getRangeEnd(extent), 0, &end_line, &end_column, 0); printf("%s: \"%s\" ", kind, clang_getCString(spelling)); + clang_disposeString(spelling); PrintExtent(stdout, start_line, start_column, end_line, end_column); if (!clang_isInvalid(cursors[i].kind)) { printf(" "); diff --git a/tools/clang-check/ClangCheck.cpp b/tools/clang-check/ClangCheck.cpp index b5b6bd5..d68e282 100644 --- a/tools/clang-check/ClangCheck.cpp +++ b/tools/clang-check/ClangCheck.cpp @@ -50,13 +50,17 @@ cl::list<std::string> SourcePaths( cl::desc("<source0> [... <sourceN>]"), cl::OneOrMore); -int main(int argc, char **argv) { - cl::ParseCommandLineOptions(argc, argv); - std::string ErrorMessage; +int main(int argc, const char **argv) { llvm::OwningPtr<CompilationDatabase> Compilations( - CompilationDatabase::loadFromDirectory(BuildPath, ErrorMessage)); - if (!Compilations) - llvm::report_fatal_error(ErrorMessage); + FixedCompilationDatabase::loadFromCommandLine(argc, argv)); + cl::ParseCommandLineOptions(argc, argv); + if (!Compilations) { + std::string ErrorMessage; + Compilations.reset(CompilationDatabase::loadFromDirectory(BuildPath, + ErrorMessage)); + if (!Compilations) + llvm::report_fatal_error(ErrorMessage); + } ClangTool Tool(*Compilations, SourcePaths); return Tool.run(newFrontendActionFactory<clang::SyntaxOnlyAction>()); } diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt index c4c864b..ae49ac1 100644 --- a/tools/driver/CMakeLists.txt +++ b/tools/driver/CMakeLists.txt @@ -7,7 +7,6 @@ set( LLVM_USED_LIBS clangDriver clangEdit clangFrontend - clangIndex clangLex clangParse clangEdit diff --git a/tools/driver/Makefile b/tools/driver/Makefile index d828f67..270d4fd 100644 --- a/tools/driver/Makefile +++ b/tools/driver/Makefile @@ -35,7 +35,7 @@ USEDLIBS = clangFrontendTool.a clangFrontend.a clangDriver.a \ clangSerialization.a clangCodeGen.a clangParse.a clangSema.a \ clangStaticAnalyzerFrontend.a clangStaticAnalyzerCheckers.a \ clangStaticAnalyzerCore.a \ - clangAnalysis.a clangIndex.a clangARCMigrate.a clangRewrite.a \ + clangAnalysis.a clangARCMigrate.a clangRewrite.a \ clangEdit.a clangAST.a clangLex.a clangBasic.a include $(CLANG_LEVEL)/Makefile diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index ece91ce..605cc8b 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -3196,6 +3196,18 @@ CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor C, } } + if (C.kind == CXCursor_ObjCCategoryDecl || + C.kind == CXCursor_ObjCCategoryImplDecl) { + if (pieceIndex > 0) + return clang_getNullRange(); + if (ObjCCategoryDecl * + CD = dyn_cast_or_null<ObjCCategoryDecl>(getCursorDecl(C))) + return cxloc::translateSourceRange(Ctx, CD->getCategoryNameLoc()); + if (ObjCCategoryImplDecl * + CID = dyn_cast_or_null<ObjCCategoryImplDecl>(getCursorDecl(C))) + return cxloc::translateSourceRange(Ctx, CID->getCategoryNameLoc()); + } + // FIXME: A CXCursor_InclusionDirective should give the location of the // filename, but we don't keep track of this. @@ -3620,9 +3632,29 @@ static enum CXChildVisitResult GetCursorVisitor(CXCursor cursor, if (clang_isDeclaration(cursor.kind)) { // Avoid having the implicit methods override the property decls. - if (ObjCMethodDecl *MD = dyn_cast_or_null<ObjCMethodDecl>(getCursorDecl(cursor))) + if (ObjCMethodDecl *MD + = dyn_cast_or_null<ObjCMethodDecl>(getCursorDecl(cursor))) { if (MD->isImplicit()) return CXChildVisit_Break; + + } else if (ObjCInterfaceDecl *ID + = dyn_cast_or_null<ObjCInterfaceDecl>(getCursorDecl(cursor))) { + // Check that when we have multiple @class references in the same line, + // that later ones do not override the previous ones. + // If we have: + // @class Foo, Bar; + // source ranges for both start at '@', so 'Bar' will end up overriding + // 'Foo' even though the cursor location was at 'Foo'. + if (BestCursor->kind == CXCursor_ObjCInterfaceDecl || + BestCursor->kind == CXCursor_ObjCClassRef) + if (ObjCInterfaceDecl *PrevID + = dyn_cast_or_null<ObjCInterfaceDecl>(getCursorDecl(*BestCursor))){ + if (PrevID != ID && + !PrevID->isThisDeclarationADefinition() && + !ID->isThisDeclarationADefinition()) + return CXChildVisit_Break; + } + } } if (clang_isExpression(cursor.kind) && diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt index 66a1710..fb0b91f 100644 --- a/tools/libclang/CMakeLists.txt +++ b/tools/libclang/CMakeLists.txt @@ -4,7 +4,6 @@ set(LLVM_USED_LIBS clangFrontend clangDriver clangSerialization - clangIndex clangSema clangEdit clangAST diff --git a/tools/libclang/CXCursor.cpp b/tools/libclang/CXCursor.cpp index d84cf29..a298759 100644 --- a/tools/libclang/CXCursor.cpp +++ b/tools/libclang/CXCursor.cpp @@ -247,19 +247,23 @@ CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent, CXTranslationUnit TU, case Stmt::CompoundStmtClass: K = CXCursor_CompoundStmt; break; - + case Stmt::NullStmtClass: K = CXCursor_NullStmt; break; - + case Stmt::LabelStmtClass: K = CXCursor_LabelStmt; break; - + + case Stmt::AttributedStmtClass: + K = CXCursor_UnexposedStmt; + break; + case Stmt::DeclStmtClass: K = CXCursor_DeclStmt; break; - + case Stmt::IntegerLiteralClass: K = CXCursor_IntegerLiteral; break; @@ -287,7 +291,7 @@ CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent, CXTranslationUnit TU, case Stmt::UnaryOperatorClass: K = CXCursor_UnaryOperator; break; - + case Stmt::CXXNoexceptExprClass: K = CXCursor_UnaryExpr; break; diff --git a/tools/libclang/Makefile b/tools/libclang/Makefile index 1fff166..08bf3c6 100644 --- a/tools/libclang/Makefile +++ b/tools/libclang/Makefile @@ -23,6 +23,11 @@ USEDLIBS = clangARCMigrate.a clangRewrite.a clangFrontend.a clangDriver.a \ include $(CLANG_LEVEL)/Makefile +# Add soname to the library. +ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU)) + LDFLAGS += -Wl,-soname,lib$(LIBRARYNAME)$(SHLIBEXT) +endif + ##===----------------------------------------------------------------------===## # FIXME: This is copied from the 'lto' makefile. Should we share this? ##===----------------------------------------------------------------------===## diff --git a/tools/scan-build/ccc-analyzer b/tools/scan-build/ccc-analyzer index 32a7301..d01bd0f 100755 --- a/tools/scan-build/ccc-analyzer +++ b/tools/scan-build/ccc-analyzer @@ -387,6 +387,8 @@ my %LangMap = ( 'c' => 'c', 'cp' => 'c++', 'cpp' => 'c++', + 'cxx' => 'c++', + 'txx' => 'c++', 'cc' => 'c++', 'ii' => 'c++', 'i' => 'c-cpp-output', |