aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
commit56d91b49b13fe55c918afbda19f6165b5fbff87a (patch)
tree9abb1a658a297776086f4e0dfa6ca533de02104e
parent41e20f564abdb05101d6b2b29c59459a966c22cc (diff)
downloadsrc-56d91b49b13fe55c918afbda19f6165b5fbff87a.tar.gz
src-56d91b49b13fe55c918afbda19f6165b5fbff87a.zip
Vendor import of clang trunk r161861:vendor/clang/clang-trunk-r161861
Notes
Notes: svn path=/vendor/clang/dist/; revision=239313 svn path=/vendor/clang/clang-trunk-r161861/; revision=239314; tag=vendor/clang/clang-trunk-r161861
-rw-r--r--.gitignore6
-rw-r--r--CMakeLists.txt29
-rw-r--r--bindings/python/clang/cindex.py1759
-rw-r--r--bindings/python/clang/enumerations.py34
-rw-r--r--bindings/python/tests/cindex/INPUTS/compile_commands.json17
-rw-r--r--bindings/python/tests/cindex/test_cdb.py89
-rw-r--r--bindings/python/tests/cindex/test_cursor.py151
-rw-r--r--bindings/python/tests/cindex/test_location.py9
-rw-r--r--bindings/python/tests/cindex/test_token_kind.py43
-rw-r--r--bindings/python/tests/cindex/test_tokens.py52
-rw-r--r--bindings/python/tests/cindex/test_translation_unit.py187
-rw-r--r--bindings/python/tests/cindex/test_type.py26
-rw-r--r--bindings/python/tests/cindex/util.py42
-rw-r--r--bindings/xml/comment-xml-schema.rng434
-rw-r--r--docs/AddressSanitizer.html57
-rw-r--r--docs/AutomaticReferenceCounting.html4
-rw-r--r--docs/ClangPlugins.html170
-rw-r--r--docs/ClangTools.html118
-rw-r--r--docs/HowToSetupToolingForLLVM.html186
-rw-r--r--docs/InternalsManual.html32
-rw-r--r--docs/IntroductionToTheClangAST.html139
-rw-r--r--docs/JSONCompilationDatabase.html89
-rw-r--r--docs/LanguageExtensions.html120
-rw-r--r--docs/LibTooling.html229
-rw-r--r--docs/ObjectiveCLiterals.html199
-rw-r--r--docs/RAVFrontendAction.html224
-rw-r--r--docs/ReleaseNotes.html273
-rw-r--r--docs/ThreadSanitizer.html125
-rw-r--r--docs/Tooling.html120
-rw-r--r--docs/UsersManual.html202
-rw-r--r--docs/tools/clang.pod8
-rw-r--r--examples/CMakeLists.txt2
-rw-r--r--examples/PrintFunctionNames/CMakeLists.txt19
-rw-r--r--examples/analyzer-plugin/CMakeLists.txt17
-rw-r--r--examples/clang-interpreter/CMakeLists.txt59
-rw-r--r--include/clang-c/CXCompilationDatabase.h146
-rw-r--r--include/clang-c/CXString.h61
-rw-r--r--include/clang-c/Index.h932
-rw-r--r--include/clang-c/Platform.h45
-rw-r--r--include/clang/AST/ASTContext.h152
-rw-r--r--include/clang/AST/ASTImporter.h3
-rw-r--r--include/clang/AST/ASTVector.h4
-rw-r--r--include/clang/AST/Attr.h46
-rw-r--r--include/clang/AST/BaseSubobject.h6
-rw-r--r--include/clang/AST/CMakeLists.txt5
-rw-r--r--include/clang/AST/CXXInheritance.h3
-rw-r--r--include/clang/AST/Comment.h1059
-rw-r--r--include/clang/AST/CommentBriefParser.h56
-rw-r--r--include/clang/AST/CommentCommandTraits.h156
-rw-r--r--include/clang/AST/CommentDiagnostic.h29
-rw-r--r--include/clang/AST/CommentLexer.h353
-rw-r--r--include/clang/AST/CommentParser.h124
-rw-r--r--include/clang/AST/CommentSema.h230
-rw-r--r--include/clang/AST/CommentVisitor.h66
-rw-r--r--include/clang/AST/Decl.h114
-rw-r--r--include/clang/AST/DeclBase.h64
-rw-r--r--include/clang/AST/DeclCXX.h193
-rw-r--r--include/clang/AST/DeclContextInternals.h4
-rw-r--r--include/clang/AST/DeclFriend.h8
-rw-r--r--include/clang/AST/DeclObjC.h233
-rw-r--r--include/clang/AST/DeclTemplate.h160
-rw-r--r--include/clang/AST/DeclarationName.h39
-rw-r--r--include/clang/AST/EvaluatedExprVisitor.h2
-rw-r--r--include/clang/AST/Expr.h94
-rw-r--r--include/clang/AST/ExprCXX.h179
-rw-r--r--include/clang/AST/ExprObjC.h84
-rw-r--r--include/clang/AST/ExternalASTSource.h3
-rw-r--r--include/clang/AST/Makefile8
-rw-r--r--include/clang/AST/Mangle.h4
-rw-r--r--include/clang/AST/NSAPI.h74
-rw-r--r--include/clang/AST/NestedNameSpecifier.h15
-rw-r--r--include/clang/AST/OperationKinds.h2
-rw-r--r--include/clang/AST/RawCommentList.h220
-rw-r--r--include/clang/AST/RecordLayout.h88
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h180
-rw-r--r--include/clang/AST/Redeclarable.h29
-rw-r--r--include/clang/AST/Stmt.h122
-rw-r--r--include/clang/AST/StmtObjC.h56
-rw-r--r--include/clang/AST/TemplateBase.h101
-rw-r--r--include/clang/AST/Type.h137
-rw-r--r--include/clang/AST/TypeLoc.h13
-rw-r--r--include/clang/ASTMatchers/ASTMatchFinder.h141
-rw-r--r--include/clang/ASTMatchers/ASTMatchers.h1799
-rw-r--r--include/clang/ASTMatchers/ASTMatchersInternal.h901
-rw-r--r--include/clang/ASTMatchers/ASTMatchersMacros.h224
-rw-r--r--include/clang/Analysis/Analyses/FormatString.h65
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafety.h9
-rw-r--r--include/clang/Analysis/Analyses/UninitializedValues.h60
-rw-r--r--include/clang/Analysis/AnalysisContext.h50
-rw-r--r--include/clang/Analysis/CFG.h12
-rw-r--r--include/clang/Analysis/CallGraph.h10
-rw-r--r--include/clang/Analysis/ProgramPoint.h169
-rw-r--r--include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h2
-rw-r--r--include/clang/Basic/ABI.h43
-rw-r--r--include/clang/Basic/AddressSpaces.h18
-rw-r--r--include/clang/Basic/AllDiagnostics.h9
-rw-r--r--include/clang/Basic/Attr.td397
-rw-r--r--include/clang/Basic/AttrKinds.h9
-rw-r--r--include/clang/Basic/Builtins.def80
-rw-r--r--include/clang/Basic/Builtins.h35
-rw-r--r--include/clang/Basic/BuiltinsHexagon.def1531
-rw-r--r--include/clang/Basic/BuiltinsMips.def125
-rw-r--r--include/clang/Basic/BuiltinsNVPTX.def (renamed from include/clang/Basic/BuiltinsPTX.def)0
-rw-r--r--include/clang/Basic/BuiltinsX86.def125
-rw-r--r--include/clang/Basic/CMakeLists.txt1
-rw-r--r--include/clang/Basic/CommentNodes.td27
-rw-r--r--include/clang/Basic/ConvertUTF.h35
-rw-r--r--include/clang/Basic/Diagnostic.h490
-rw-r--r--include/clang/Basic/Diagnostic.td1
-rw-r--r--include/clang/Basic/DiagnosticCommentKinds.td125
-rw-r--r--include/clang/Basic/DiagnosticCommonKinds.td6
-rw-r--r--include/clang/Basic/DiagnosticDriverKinds.td21
-rw-r--r--include/clang/Basic/DiagnosticFrontendKinds.td16
-rw-r--r--include/clang/Basic/DiagnosticGroups.td44
-rw-r--r--include/clang/Basic/DiagnosticIDs.h96
-rw-r--r--include/clang/Basic/DiagnosticLexKinds.td30
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td65
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td1131
-rw-r--r--include/clang/Basic/DiagnosticSerializationKinds.td4
-rw-r--r--include/clang/Basic/ExceptionSpecificationType.h15
-rw-r--r--include/clang/Basic/ExpressionTraits.h7
-rw-r--r--include/clang/Basic/FileManager.h93
-rw-r--r--include/clang/Basic/FileSystemOptions.h7
-rw-r--r--include/clang/Basic/FileSystemStatCache.h18
-rw-r--r--include/clang/Basic/IdentifierTable.h103
-rw-r--r--include/clang/Basic/LLVM.h7
-rw-r--r--include/clang/Basic/Lambda.h15
-rw-r--r--include/clang/Basic/LangOptions.def10
-rw-r--r--include/clang/Basic/LangOptions.h29
-rw-r--r--include/clang/Basic/Linkage.h23
-rw-r--r--include/clang/Basic/MacroBuilder.h13
-rw-r--r--include/clang/Basic/Makefile1
-rw-r--r--include/clang/Basic/Module.h13
-rw-r--r--include/clang/Basic/ObjCRuntime.h264
-rw-r--r--include/clang/Basic/OnDiskHashTable.h8
-rw-r--r--include/clang/Basic/OpenCL.h9
-rw-r--r--include/clang/Basic/OperatorKinds.h13
-rw-r--r--include/clang/Basic/PartialDiagnostic.h61
-rw-r--r--include/clang/Basic/PrettyStackTrace.h15
-rw-r--r--include/clang/Basic/SourceLocation.h102
-rw-r--r--include/clang/Basic/SourceManager.h659
-rw-r--r--include/clang/Basic/SourceManagerInternals.h55
-rw-r--r--include/clang/Basic/Specifiers.h52
-rw-r--r--include/clang/Basic/StmtNodes.td5
-rw-r--r--include/clang/Basic/TargetBuiltins.h36
-rw-r--r--include/clang/Basic/TargetInfo.h273
-rw-r--r--include/clang/Basic/TargetOptions.h7
-rw-r--r--include/clang/Basic/TemplateKinds.h7
-rw-r--r--include/clang/Basic/TokenKinds.def64
-rw-r--r--include/clang/Basic/TokenKinds.h21
-rw-r--r--include/clang/Basic/TypeTraits.h15
-rw-r--r--include/clang/Basic/Version.h38
-rw-r--r--include/clang/Basic/VersionTuple.h45
-rw-r--r--include/clang/Basic/Visibility.h19
-rw-r--r--include/clang/Basic/arm_neon.td1
-rw-r--r--include/clang/Driver/Arg.h42
-rw-r--r--include/clang/Driver/ArgList.h8
-rw-r--r--include/clang/Driver/CC1Options.h32
-rw-r--r--include/clang/Driver/CC1Options.td366
-rw-r--r--include/clang/Driver/CMakeLists.txt4
-rw-r--r--include/clang/Driver/Compilation.h2
-rw-r--r--include/clang/Driver/Driver.h8
-rw-r--r--include/clang/Driver/Makefile8
-rw-r--r--include/clang/Driver/ObjCRuntime.h49
-rw-r--r--include/clang/Driver/OptParser.td5
-rw-r--r--include/clang/Driver/OptTable.h50
-rw-r--r--include/clang/Driver/Option.h6
-rw-r--r--include/clang/Driver/Options.td566
-rw-r--r--include/clang/Driver/ToolChain.h21
-rw-r--r--include/clang/Driver/Types.def12
-rw-r--r--include/clang/Driver/Types.h6
-rw-r--r--include/clang/Frontend/ASTConsumers.h8
-rw-r--r--include/clang/Frontend/ASTUnit.h42
-rw-r--r--include/clang/Frontend/Analyses.def4
-rw-r--r--include/clang/Frontend/AnalyzerOptions.h2
-rw-r--r--include/clang/Frontend/CodeGenOptions.h180
-rw-r--r--include/clang/Frontend/CompilerInstance.h3
-rw-r--r--include/clang/Frontend/CompilerInvocation.h42
-rw-r--r--include/clang/Frontend/DiagnosticOptions.h3
-rw-r--r--include/clang/Frontend/DiagnosticRenderer.h34
-rw-r--r--include/clang/Frontend/FrontendAction.h2
-rw-r--r--include/clang/Frontend/FrontendActions.h6
-rw-r--r--include/clang/Frontend/FrontendOptions.h20
-rw-r--r--include/clang/Frontend/HeaderSearchOptions.h28
-rw-r--r--include/clang/Frontend/LangStandards.def6
-rw-r--r--include/clang/Frontend/PreprocessorOutputOptions.h4
-rw-r--r--include/clang/Frontend/TextDiagnostic.h26
-rw-r--r--include/clang/Frontend/TextDiagnosticPrinter.h2
-rw-r--r--include/clang/Frontend/VerifyDiagnosticConsumer.h138
-rw-r--r--include/clang/Lex/CodeCompletionHandler.h6
-rw-r--r--include/clang/Lex/DirectoryLookup.h10
-rw-r--r--include/clang/Lex/HeaderMap.h2
-rw-r--r--include/clang/Lex/HeaderSearch.h138
-rw-r--r--include/clang/Lex/Lexer.h35
-rw-r--r--include/clang/Lex/LiteralSupport.h1
-rw-r--r--include/clang/Lex/MacroInfo.h15
-rw-r--r--include/clang/Lex/ModuleMap.h6
-rw-r--r--include/clang/Lex/MultipleIncludeOpt.h43
-rw-r--r--include/clang/Lex/PPCallbacks.h123
-rw-r--r--include/clang/Lex/Pragma.h10
-rw-r--r--include/clang/Lex/PreprocessingRecord.h18
-rw-r--r--include/clang/Lex/Preprocessor.h134
-rw-r--r--include/clang/Lex/PreprocessorLexer.h55
-rw-r--r--include/clang/Lex/Token.h53
-rw-r--r--include/clang/Parse/Parser.h281
-rw-r--r--include/clang/Rewrite/FrontendActions.h5
-rw-r--r--include/clang/Rewrite/Rewriter.h7
-rw-r--r--include/clang/Rewrite/Rewriters.h5
-rw-r--r--include/clang/Rewrite/TokenRewriter.h2
-rw-r--r--include/clang/Sema/AttributeList.h81
-rw-r--r--include/clang/Sema/CodeCompleteConsumer.h142
-rw-r--r--include/clang/Sema/CodeCompleteOptions.h37
-rw-r--r--include/clang/Sema/DeclSpec.h188
-rw-r--r--include/clang/Sema/DelayedDiagnostic.h66
-rw-r--r--include/clang/Sema/Designator.h8
-rw-r--r--include/clang/Sema/Initialization.h8
-rw-r--r--include/clang/Sema/Overload.h23
-rw-r--r--include/clang/Sema/ParsedTemplate.h10
-rw-r--r--include/clang/Sema/Scope.h4
-rw-r--r--include/clang/Sema/ScopeInfo.h19
-rw-r--r--include/clang/Sema/Sema.h1016
-rw-r--r--include/clang/Sema/Template.h11
-rw-r--r--include/clang/Sema/TemplateDeduction.h39
-rw-r--r--include/clang/Sema/Weak.h2
-rw-r--r--include/clang/Serialization/ASTBitCodes.h63
-rw-r--r--include/clang/Serialization/ASTReader.h36
-rw-r--r--include/clang/Serialization/ASTWriter.h13
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h20
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h6
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h36
-rw-r--r--include/clang/StaticAnalyzer/Core/Checker.h65
-rw-r--r--include/clang/StaticAnalyzer/Core/CheckerManager.h71
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h106
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h10
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h39
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h962
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h9
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h19
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h6
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h94
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h7
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h86
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h293
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h102
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h25
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h42
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/Store.h70
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h14
-rw-r--r--include/clang/Tooling/ArgumentsAdjusters.h59
-rw-r--r--include/clang/Tooling/CommandLineClangTool.h80
-rw-r--r--include/clang/Tooling/CompilationDatabase.h28
-rw-r--r--include/clang/Tooling/Refactoring.h151
-rw-r--r--include/clang/Tooling/RefactoringCallbacks.h90
-rw-r--r--include/clang/Tooling/Tooling.h85
-rw-r--r--lib/ARCMigrate/ARCMT.cpp67
-rw-r--r--lib/ARCMigrate/CMakeLists.txt18
-rw-r--r--lib/ARCMigrate/FileRemapper.cpp4
-rw-r--r--lib/ARCMigrate/Internals.h4
-rw-r--r--lib/ARCMigrate/ObjCMT.cpp2
-rw-r--r--lib/ARCMigrate/TransAPIUses.cpp1
-rw-r--r--lib/ARCMigrate/TransARCAssign.cpp1
-rw-r--r--lib/ARCMigrate/TransAutoreleasePool.cpp3
-rw-r--r--lib/ARCMigrate/TransBlockObjCVariable.cpp19
-rw-r--r--lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp7
-rw-r--r--lib/ARCMigrate/TransGCAttrs.cpp9
-rw-r--r--lib/ARCMigrate/TransGCCalls.cpp9
-rw-r--r--lib/ARCMigrate/TransProperties.cpp11
-rw-r--r--lib/ARCMigrate/TransRetainReleaseDealloc.cpp99
-rw-r--r--lib/ARCMigrate/TransUnbridgedCasts.cpp85
-rw-r--r--lib/ARCMigrate/TransUnusedInitDelegate.cpp3
-rw-r--r--lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp1
-rw-r--r--lib/ARCMigrate/TransformActions.cpp1
-rw-r--r--lib/ARCMigrate/Transforms.cpp59
-rw-r--r--lib/ARCMigrate/Transforms.h14
-rw-r--r--lib/AST/APValue.cpp6
-rw-r--r--lib/AST/ASTContext.cpp569
-rw-r--r--lib/AST/ASTDiagnostic.cpp934
-rw-r--r--lib/AST/ASTImporter.cpp117
-rw-r--r--lib/AST/CMakeLists.txt30
-rw-r--r--lib/AST/CXXABI.h2
-rw-r--r--lib/AST/CXXInheritance.cpp22
-rw-r--r--lib/AST/Comment.cpp264
-rw-r--r--lib/AST/CommentBriefParser.cpp122
-rw-r--r--lib/AST/CommentCommandTraits.cpp134
-rw-r--r--lib/AST/CommentDumper.cpp231
-rw-r--r--lib/AST/CommentLexer.cpp815
-rw-r--r--lib/AST/CommentParser.cpp722
-rw-r--r--lib/AST/CommentSema.cpp739
-rw-r--r--lib/AST/Decl.cpp346
-rw-r--r--lib/AST/DeclBase.cpp57
-rw-r--r--lib/AST/DeclCXX.cpp179
-rw-r--r--lib/AST/DeclFriend.cpp6
-rw-r--r--lib/AST/DeclObjC.cpp56
-rw-r--r--lib/AST/DeclPrinter.cpp54
-rw-r--r--lib/AST/DeclTemplate.cpp18
-rw-r--r--lib/AST/DeclarationName.cpp55
-rw-r--r--lib/AST/DumpXML.cpp15
-rw-r--r--lib/AST/Expr.cpp522
-rw-r--r--lib/AST/ExprCXX.cpp67
-rw-r--r--lib/AST/ExprClassification.cpp25
-rw-r--r--lib/AST/ExprConstant.cpp346
-rw-r--r--lib/AST/ItaniumCXXABI.cpp2
-rw-r--r--lib/AST/ItaniumMangle.cpp38
-rw-r--r--lib/AST/LambdaMangleContext.cpp2
-rw-r--r--lib/AST/Mangle.cpp29
-rw-r--r--lib/AST/MicrosoftCXXABI.cpp4
-rw-r--r--lib/AST/MicrosoftMangle.cpp822
-rw-r--r--lib/AST/NSAPI.cpp107
-rw-r--r--lib/AST/ParentMap.cpp13
-rw-r--r--lib/AST/RawCommentList.cpp271
-rw-r--r--lib/AST/RecordLayout.cpp12
-rw-r--r--lib/AST/RecordLayoutBuilder.cpp307
-rw-r--r--lib/AST/Stmt.cpp132
-rw-r--r--lib/AST/StmtDumper.cpp22
-rw-r--r--lib/AST/StmtPrinter.cpp116
-rw-r--r--lib/AST/StmtProfile.cpp9
-rw-r--r--lib/AST/TemplateBase.cpp33
-rw-r--r--lib/AST/Type.cpp51
-rw-r--r--lib/AST/TypeLoc.cpp1
-rw-r--r--lib/AST/TypePrinter.cpp1453
-rw-r--r--lib/AST/VTTBuilder.cpp1
-rw-r--r--lib/AST/VTableBuilder.cpp17
-rw-r--r--lib/ASTMatchers/ASTMatchFinder.cpp547
-rw-r--r--lib/ASTMatchers/ASTMatchersInternal.cpp102
-rw-r--r--lib/ASTMatchers/CMakeLists.txt17
-rw-r--r--lib/ASTMatchers/Makefile13
-rw-r--r--lib/Analysis/AnalysisDeclContext.cpp63
-rw-r--r--lib/Analysis/CFG.cpp500
-rw-r--r--lib/Analysis/CMakeLists.txt18
-rw-r--r--lib/Analysis/CallGraph.cpp7
-rw-r--r--lib/Analysis/CocoaConventions.cpp2
-rw-r--r--lib/Analysis/FormatString.cpp138
-rw-r--r--lib/Analysis/LiveVariables.cpp19
-rw-r--r--lib/Analysis/PrintfFormatString.cpp122
-rw-r--r--lib/Analysis/ProgramPoint.cpp6
-rw-r--r--lib/Analysis/PseudoConstantAnalysis.cpp1
-rw-r--r--lib/Analysis/ScanfFormatString.cpp193
-rw-r--r--lib/Analysis/ThreadSafety.cpp1641
-rw-r--r--lib/Analysis/UninitializedValues.cpp793
-rw-r--r--lib/Basic/CMakeLists.txt33
-rw-r--r--lib/Basic/ConvertUTF.c3
-rw-r--r--lib/Basic/ConvertUTFWrapper.cpp70
-rw-r--r--lib/Basic/Diagnostic.cpp129
-rw-r--r--lib/Basic/DiagnosticIDs.cpp32
-rw-r--r--lib/Basic/FileManager.cpp61
-rw-r--r--lib/Basic/IdentifierTable.cpp29
-rw-r--r--lib/Basic/ObjCRuntime.cpp86
-rw-r--r--lib/Basic/SourceManager.cpp96
-rw-r--r--lib/Basic/TargetInfo.cpp1
-rw-r--r--lib/Basic/Targets.cpp588
-rw-r--r--lib/Basic/Version.cpp5
-rw-r--r--lib/Basic/VersionTuple.cpp52
-rw-r--r--lib/CMakeLists.txt1
-rw-r--r--lib/CodeGen/ABIInfo.h32
-rw-r--r--lib/CodeGen/BackendUtil.cpp32
-rw-r--r--lib/CodeGen/CGBlocks.cpp41
-rw-r--r--lib/CodeGen/CGBuilder.h2
-rw-r--r--lib/CodeGen/CGBuiltin.cpp2040
-rw-r--r--lib/CodeGen/CGCXX.cpp4
-rw-r--r--lib/CodeGen/CGCXXABI.cpp71
-rw-r--r--lib/CodeGen/CGCXXABI.h51
-rw-r--r--lib/CodeGen/CGCall.cpp198
-rw-r--r--lib/CodeGen/CGClass.cpp202
-rw-r--r--lib/CodeGen/CGCleanup.cpp8
-rw-r--r--lib/CodeGen/CGCleanup.h2
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp228
-rw-r--r--lib/CodeGen/CGDebugInfo.h5
-rw-r--r--lib/CodeGen/CGDecl.cpp48
-rw-r--r--lib/CodeGen/CGDeclCXX.cpp80
-rw-r--r--lib/CodeGen/CGException.cpp80
-rw-r--r--lib/CodeGen/CGExpr.cpp239
-rw-r--r--lib/CodeGen/CGExprAgg.cpp253
-rw-r--r--lib/CodeGen/CGExprCXX.cpp136
-rw-r--r--lib/CodeGen/CGExprConstant.cpp18
-rw-r--r--lib/CodeGen/CGExprScalar.cpp30
-rw-r--r--lib/CodeGen/CGObjC.cpp192
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp97
-rw-r--r--lib/CodeGen/CGObjCMac.cpp75
-rw-r--r--lib/CodeGen/CGObjCRuntime.cpp17
-rw-r--r--lib/CodeGen/CGObjCRuntime.h20
-rw-r--r--lib/CodeGen/CGRTTI.cpp3
-rw-r--r--lib/CodeGen/CGRecordLayout.h7
-rw-r--r--lib/CodeGen/CGRecordLayoutBuilder.cpp16
-rw-r--r--lib/CodeGen/CGStmt.cpp94
-rw-r--r--lib/CodeGen/CGVTables.cpp23
-rw-r--r--lib/CodeGen/CGValue.h9
-rw-r--r--lib/CodeGen/CMakeLists.txt20
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp136
-rw-r--r--lib/CodeGen/CodeGenFunction.h47
-rw-r--r--lib/CodeGen/CodeGenModule.cpp146
-rw-r--r--lib/CodeGen/CodeGenModule.h15
-rw-r--r--lib/CodeGen/CodeGenTBAA.cpp8
-rw-r--r--lib/CodeGen/CodeGenTBAA.h6
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp4
-rw-r--r--lib/CodeGen/CodeGenTypes.h36
-rw-r--r--lib/CodeGen/ItaniumCXXABI.cpp257
-rw-r--r--lib/CodeGen/MicrosoftCXXABI.cpp98
-rw-r--r--lib/CodeGen/TargetInfo.cpp383
-rw-r--r--lib/Driver/ArgList.cpp62
-rw-r--r--lib/Driver/CC1Options.cpp38
-rw-r--r--lib/Driver/CMakeLists.txt22
-rw-r--r--lib/Driver/Compilation.cpp2
-rw-r--r--lib/Driver/Driver.cpp189
-rw-r--r--lib/Driver/OptTable.cpp2
-rw-r--r--lib/Driver/ToolChain.cpp27
-rw-r--r--lib/Driver/ToolChains.cpp338
-rw-r--r--lib/Driver/ToolChains.h109
-rw-r--r--lib/Driver/Tools.cpp989
-rw-r--r--lib/Driver/Tools.h38
-rw-r--r--lib/Driver/Types.cpp4
-rw-r--r--lib/Edit/CMakeLists.txt17
-rw-r--r--lib/Edit/Commit.cpp1
-rw-r--r--lib/Edit/EditedSource.cpp5
-rw-r--r--lib/Edit/RewriteObjCFoundationAPI.cpp506
-rw-r--r--lib/Frontend/ASTConsumers.cpp99
-rw-r--r--lib/Frontend/ASTUnit.cpp224
-rw-r--r--lib/Frontend/CMakeLists.txt45
-rw-r--r--lib/Frontend/CompilerInstance.cpp23
-rw-r--r--lib/Frontend/CompilerInvocation.cpp326
-rw-r--r--lib/Frontend/CreateInvocationFromCommandLine.cpp8
-rw-r--r--lib/Frontend/DiagnosticRenderer.cpp127
-rw-r--r--lib/Frontend/FrontendAction.cpp62
-rw-r--r--lib/Frontend/FrontendActions.cpp11
-rw-r--r--lib/Frontend/InitHeaderSearch.cpp15
-rw-r--r--lib/Frontend/InitPreprocessor.cpp72
-rw-r--r--lib/Frontend/LayoutOverrideSource.cpp1
-rw-r--r--lib/Frontend/PrintPreprocessedOutput.cpp66
-rw-r--r--lib/Frontend/SerializedDiagnosticPrinter.cpp40
-rw-r--r--lib/Frontend/TextDiagnostic.cpp217
-rw-r--r--lib/Frontend/TextDiagnosticPrinter.cpp30
-rw-r--r--lib/Frontend/VerifyDiagnosticConsumer.cpp471
-rw-r--r--lib/Frontend/Warnings.cpp14
-rw-r--r--lib/FrontendTool/CMakeLists.txt21
-rw-r--r--lib/FrontendTool/ExecuteCompilerInvocation.cpp12
-rw-r--r--lib/Headers/CMakeLists.txt3
-rw-r--r--lib/Headers/ammintrin.h68
-rw-r--r--lib/Headers/avx2intrin.h240
-rw-r--r--lib/Headers/bmiintrin.h6
-rw-r--r--lib/Headers/emmintrin.h5
-rw-r--r--lib/Headers/float.h2
-rw-r--r--lib/Headers/fmaintrin.h229
-rw-r--r--lib/Headers/immintrin.h26
-rw-r--r--lib/Headers/stddef.h16
-rw-r--r--lib/Headers/wmmintrin.h18
-rw-r--r--lib/Headers/x86intrin.h10
-rw-r--r--lib/Headers/xopintrin.h411
-rw-r--r--lib/Lex/CMakeLists.txt12
-rw-r--r--lib/Lex/HeaderSearch.cpp42
-rw-r--r--lib/Lex/Lexer.cpp91
-rw-r--r--lib/Lex/LiteralSupport.cpp154
-rw-r--r--lib/Lex/PPDirectives.cpp183
-rw-r--r--lib/Lex/PPLexerChange.cpp2
-rw-r--r--lib/Lex/PPMacroExpansion.cpp46
-rw-r--r--lib/Lex/Pragma.cpp78
-rw-r--r--lib/Lex/PreprocessingRecord.cpp4
-rw-r--r--lib/Lex/Preprocessor.cpp127
-rw-r--r--lib/Lex/PreprocessorLexer.cpp2
-rw-r--r--lib/Lex/TokenConcatenation.cpp1
-rw-r--r--lib/Lex/TokenLexer.cpp12
-rwxr-xr-xlib/Makefile2
-rw-r--r--lib/Parse/CMakeLists.txt21
-rw-r--r--lib/Parse/ParseAST.cpp45
-rw-r--r--lib/Parse/ParseCXXInlineMethods.cpp8
-rw-r--r--lib/Parse/ParseDecl.cpp838
-rw-r--r--lib/Parse/ParseDeclCXX.cpp327
-rw-r--r--lib/Parse/ParseExpr.cpp158
-rw-r--r--lib/Parse/ParseExprCXX.cpp77
-rw-r--r--lib/Parse/ParseObjc.cpp242
-rw-r--r--lib/Parse/ParsePragma.h21
-rw-r--r--lib/Parse/ParseStmt.cpp127
-rw-r--r--lib/Parse/ParseTemplate.cpp135
-rw-r--r--lib/Parse/ParseTentative.cpp93
-rw-r--r--lib/Parse/Parser.cpp182
-rw-r--r--lib/Parse/RAIIObjectsForParser.h298
-rw-r--r--lib/Rewrite/CMakeLists.txt17
-rw-r--r--lib/Rewrite/FrontendActions.cpp11
-rw-r--r--lib/Rewrite/HTMLRewrite.cpp11
-rw-r--r--lib/Rewrite/InclusionRewriter.cpp361
-rw-r--r--lib/Rewrite/RewriteModernObjC.cpp759
-rw-r--r--lib/Rewrite/RewriteObjC.cpp105
-rw-r--r--lib/Rewrite/Rewriter.cpp76
-rw-r--r--lib/Sema/AnalysisBasedWarnings.cpp502
-rw-r--r--lib/Sema/AttributeList.cpp39
-rw-r--r--lib/Sema/CMakeLists.txt39
-rw-r--r--lib/Sema/CodeCompleteConsumer.cpp27
-rw-r--r--lib/Sema/DeclSpec.cpp39
-rw-r--r--lib/Sema/Sema.cpp177
-rw-r--r--lib/Sema/SemaAccess.cpp83
-rw-r--r--lib/Sema/SemaCXXScopeSpec.cpp12
-rw-r--r--lib/Sema/SemaCast.cpp30
-rw-r--r--lib/Sema/SemaChecking.cpp931
-rw-r--r--lib/Sema/SemaCodeComplete.cpp210
-rw-r--r--lib/Sema/SemaDecl.cpp911
-rw-r--r--lib/Sema/SemaDeclAttr.cpp1637
-rw-r--r--lib/Sema/SemaDeclCXX.cpp1738
-rw-r--r--lib/Sema/SemaDeclObjC.cpp311
-rw-r--r--lib/Sema/SemaExceptionSpec.cpp41
-rw-r--r--lib/Sema/SemaExpr.cpp1155
-rw-r--r--lib/Sema/SemaExprCXX.cpp410
-rw-r--r--lib/Sema/SemaExprMember.cpp95
-rw-r--r--lib/Sema/SemaExprObjC.cpp925
-rw-r--r--lib/Sema/SemaFixItUtils.cpp71
-rw-r--r--lib/Sema/SemaInit.cpp372
-rw-r--r--lib/Sema/SemaLambda.cpp316
-rw-r--r--lib/Sema/SemaLookup.cpp198
-rw-r--r--lib/Sema/SemaObjCProperty.cpp375
-rw-r--r--lib/Sema/SemaOverload.cpp456
-rw-r--r--lib/Sema/SemaPseudoObject.cpp60
-rw-r--r--lib/Sema/SemaStmt.cpp735
-rw-r--r--lib/Sema/SemaStmtAttr.cpp36
-rw-r--r--lib/Sema/SemaTemplate.cpp238
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp124
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp266
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp162
-rw-r--r--lib/Sema/SemaTemplateVariadic.cpp113
-rw-r--r--lib/Sema/SemaType.cpp568
-rw-r--r--lib/Sema/TargetAttributesSema.cpp63
-rw-r--r--lib/Sema/TreeTransform.h1264
-rw-r--r--lib/Serialization/ASTCommon.h2
-rw-r--r--lib/Serialization/ASTReader.cpp150
-rw-r--r--lib/Serialization/ASTReaderDecl.cpp51
-rw-r--r--lib/Serialization/ASTReaderStmt.cpp32
-rw-r--r--lib/Serialization/ASTWriter.cpp82
-rw-r--r--lib/Serialization/ASTWriterDecl.cpp26
-rw-r--r--lib/Serialization/ASTWriterStmt.cpp19
-rw-r--r--lib/Serialization/CMakeLists.txt14
-rw-r--r--lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp46
-rw-r--r--lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp228
-rw-r--r--lib/StaticAnalyzer/Checkers/CMakeLists.txt14
-rw-r--r--lib/StaticAnalyzer/Checkers/CStringChecker.cpp28
-rw-r--r--lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp304
-rw-r--r--lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp8
-rw-r--r--lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp1
-rw-r--r--lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp63
-rw-r--r--lib/StaticAnalyzer/Checkers/Checkers.td40
-rw-r--r--lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp265
-rw-r--r--lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp8
-rw-r--r--lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp179
-rw-r--r--lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp122
-rw-r--r--lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp15
-rw-r--r--lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp5
-rw-r--r--lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp603
-rw-r--r--lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp20
-rw-r--r--lib/StaticAnalyzer/Checkers/MallocChecker.cpp626
-rw-r--r--lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp37
-rw-r--r--lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp23
-rw-r--r--lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp6
-rw-r--r--lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp6
-rw-r--r--lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp1
-rw-r--r--lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp102
-rw-r--r--lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp9
-rw-r--r--lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp739
-rw-r--r--lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp4
-rw-r--r--lib/StaticAnalyzer/Checkers/StreamChecker.cpp2
-rw-r--r--lib/StaticAnalyzer/Checkers/TraversalChecker.cpp84
-rw-r--r--lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp3
-rw-r--r--lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp1
-rw-r--r--lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp8
-rw-r--r--lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp4
-rw-r--r--lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp3
-rw-r--r--lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp13
-rw-r--r--lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp3
-rw-r--r--lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp2
-rw-r--r--lib/StaticAnalyzer/Core/APSIntType.cpp38
-rw-r--r--lib/StaticAnalyzer/Core/AnalysisManager.cpp7
-rw-r--r--lib/StaticAnalyzer/Core/BasicConstraintManager.cpp241
-rw-r--r--lib/StaticAnalyzer/Core/BasicValueFactory.cpp1
-rw-r--r--lib/StaticAnalyzer/Core/BugReporter.cpp179
-rw-r--r--lib/StaticAnalyzer/Core/BugReporterVisitors.cpp86
-rw-r--r--lib/StaticAnalyzer/Core/CMakeLists.txt23
-rw-r--r--lib/StaticAnalyzer/Core/CallEvent.cpp856
-rw-r--r--lib/StaticAnalyzer/Core/CheckerManager.cpp133
-rw-r--r--lib/StaticAnalyzer/Core/CoreEngine.cpp29
-rw-r--r--lib/StaticAnalyzer/Core/Environment.cpp17
-rw-r--r--lib/StaticAnalyzer/Core/ExplodedGraph.cpp18
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngine.cpp538
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngineC.cpp270
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngineCXX.cpp366
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp822
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngineObjC.cpp211
-rw-r--r--lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp84
-rw-r--r--lib/StaticAnalyzer/Core/MemRegion.cpp274
-rw-r--r--lib/StaticAnalyzer/Core/ObjCMessage.cpp90
-rw-r--r--lib/StaticAnalyzer/Core/PathDiagnostic.cpp204
-rw-r--r--lib/StaticAnalyzer/Core/PlistDiagnostics.cpp31
-rw-r--r--lib/StaticAnalyzer/Core/ProgramState.cpp99
-rw-r--r--lib/StaticAnalyzer/Core/RangeConstraintManager.cpp275
-rw-r--r--lib/StaticAnalyzer/Core/RegionStore.cpp949
-rw-r--r--lib/StaticAnalyzer/Core/SValBuilder.cpp76
-rw-r--r--lib/StaticAnalyzer/Core/SVals.cpp20
-rw-r--r--lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp103
-rw-r--r--lib/StaticAnalyzer/Core/SimpleConstraintManager.h6
-rw-r--r--lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp338
-rw-r--r--lib/StaticAnalyzer/Core/Store.cpp34
-rw-r--r--lib/StaticAnalyzer/Core/SymbolManager.cpp14
-rw-r--r--lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp5
-rw-r--r--lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp71
-rw-r--r--lib/StaticAnalyzer/Frontend/CMakeLists.txt15
-rw-r--r--lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp2
-rw-r--r--lib/Tooling/ArgumentsAdjusters.cpp34
-rw-r--r--lib/Tooling/CMakeLists.txt22
-rw-r--r--lib/Tooling/CommandLineClangTool.cpp80
-rw-r--r--lib/Tooling/CompilationDatabase.cpp106
-rw-r--r--lib/Tooling/CustomCompilationDatabase.h42
-rw-r--r--lib/Tooling/Refactoring.cpp186
-rw-r--r--lib/Tooling/RefactoringCallbacks.cpp81
-rw-r--r--lib/Tooling/Tooling.cpp136
-rw-r--r--runtime/compiler-rt/Makefile6
-rw-r--r--test/ARCMT/Common.h36
-rw-r--r--test/ARCMT/autoreleases.m47
-rw-r--r--test/ARCMT/autoreleases.m.result43
-rw-r--r--test/ARCMT/checking.m33
-rw-r--r--test/ARCMT/cxx-rewrite.mm.result2
-rw-r--r--test/ARCMT/dispatch.m11
-rw-r--r--test/ARCMT/dispatch.m.result11
-rw-r--r--test/ARCMT/nonobjc-to-objc-cast-2.m31
-rw-r--r--test/ARCMT/nonobjc-to-objc-cast.m27
-rw-r--r--test/ARCMT/nonobjc-to-objc-cast.m.result57
-rw-r--r--test/ARCMT/objcmt-boxing.m102
-rw-r--r--test/ARCMT/objcmt-boxing.m.result102
-rw-r--r--test/ARCMT/objcmt-numeric-literals.m1
-rw-r--r--test/ARCMT/objcmt-numeric-literals.m.result5
-rw-r--r--test/ARCMT/objcmt-subscripting-literals-in-arc.m106
-rw-r--r--test/ARCMT/objcmt-subscripting-literals-in-arc.m.result106
-rw-r--r--test/ARCMT/objcmt-subscripting-literals.m102
-rw-r--r--test/ARCMT/objcmt-subscripting-literals.m.result102
-rw-r--r--test/ARCMT/objcmt-subscripting-unavailable.m79
-rw-r--r--test/ARCMT/objcmt-subscripting-unavailable.m.result79
-rw-r--r--test/ARCMT/releases-driver.m3
-rw-r--r--test/ARCMT/releases-driver.m.result3
-rw-r--r--test/ARCMT/releases.m3
-rw-r--r--test/ARCMT/releases.m.result3
-rw-r--r--test/ARCMT/verify.m13
-rw-r--r--test/ASTMerge/function.c6
-rw-r--r--test/Analysis/MissingDealloc.m6
-rw-r--r--test/Analysis/NoReturn.m12
-rw-r--r--test/Analysis/PR12905.c8
-rw-r--r--test/Analysis/additive-folding-range-constraints.c191
-rw-r--r--test/Analysis/additive-folding.c203
-rw-r--r--test/Analysis/additive-folding.cpp196
-rw-r--r--test/Analysis/array-struct-region.c171
-rw-r--r--test/Analysis/auto-obj-dtors-cfg-output.cpp295
-rw-r--r--test/Analysis/base-init.cpp9
-rw-r--r--test/Analysis/blocks-no-inline.c13
-rw-r--r--test/Analysis/blocks.m4
-rw-r--r--test/Analysis/bstring.c89
-rw-r--r--test/Analysis/casts.c8
-rw-r--r--test/Analysis/comparison-implicit-casts.cpp98
-rw-r--r--test/Analysis/constant-folding.c90
-rw-r--r--test/Analysis/coverage.c8
-rw-r--r--test/Analysis/cstring-syntax.c2
-rw-r--r--test/Analysis/ctor-inlining.mm41
-rw-r--r--test/Analysis/cxx-crashes.cpp23
-rw-r--r--test/Analysis/cxx-for-range-cfg.cpp16
-rw-r--r--test/Analysis/cxx-method-names.cpp21
-rw-r--r--test/Analysis/cxx11-crashes.cpp66
-rw-r--r--test/Analysis/dead-stores.m20
-rw-r--r--test/Analysis/delegates.m25
-rw-r--r--test/Analysis/derived-to-base.cpp124
-rw-r--r--test/Analysis/diagnostics/undef-value-callee.h4
-rw-r--r--test/Analysis/diagnostics/undef-value-caller.c238
-rw-r--r--test/Analysis/domtest.c45
-rw-r--r--test/Analysis/dtor.cpp164
-rw-r--r--test/Analysis/dynamic-cast.cpp25
-rw-r--r--test/Analysis/engine/replay-without-inlining.c57
-rw-r--r--test/Analysis/global-region-invalidation.c13
-rw-r--r--test/Analysis/html-diags.c2
-rw-r--r--test/Analysis/initializer.cpp74
-rw-r--r--test/Analysis/initializers-cfg-output.cpp2
-rw-r--r--test/Analysis/inline-plist.c834
-rw-r--r--test/Analysis/inline-unique-reports.c26
-rw-r--r--test/Analysis/inline.c22
-rw-r--r--test/Analysis/inline.cpp168
-rw-r--r--test/Analysis/inlining/DynDispatchBifurcate.m181
-rw-r--r--test/Analysis/inlining/InlineObjCClassMethod.m181
-rw-r--r--test/Analysis/inlining/InlineObjCInstanceMethod.h46
-rw-r--r--test/Analysis/inlining/InlineObjCInstanceMethod.m86
-rw-r--r--test/Analysis/inlining/ObjCDynTypePopagation.m84
-rw-r--r--test/Analysis/inlining/ObjCImproperDynamictallyDetectableCast.m37
-rw-r--r--test/Analysis/inlining/RetainCountExamples.m33
-rw-r--r--test/Analysis/inlining/path-notes.c1291
-rw-r--r--test/Analysis/iterators.cpp105
-rw-r--r--test/Analysis/ivars.m132
-rw-r--r--test/Analysis/malloc-annotations.c8
-rw-r--r--test/Analysis/malloc-plist.c1876
-rw-r--r--test/Analysis/malloc-sizeof.c27
-rw-r--r--test/Analysis/malloc.c278
-rw-r--r--test/Analysis/malloc.cpp21
-rw-r--r--test/Analysis/malloc.m2
-rw-r--r--test/Analysis/malloc.mm80
-rw-r--r--test/Analysis/method-call-path-notes.cpp664
-rw-r--r--test/Analysis/method-call.cpp28
-rw-r--r--test/Analysis/misc-ps-arm.m18
-rw-r--r--test/Analysis/misc-ps-cxx0x.cpp14
-rw-r--r--test/Analysis/misc-ps-region-store.cpp50
-rw-r--r--test/Analysis/misc-ps-region-store.m22
-rw-r--r--test/Analysis/misc-ps.c7
-rw-r--r--test/Analysis/misc-ps.m36
-rw-r--r--test/Analysis/new.cpp99
-rw-r--r--test/Analysis/nonnull.m23
-rw-r--r--test/Analysis/nullptr.cpp2
-rw-r--r--test/Analysis/objc-boxing.m44
-rw-r--r--test/Analysis/objc-for.m58
-rw-r--r--test/Analysis/objc-subscript.m89
-rw-r--r--test/Analysis/operator-calls.cpp18
-rw-r--r--test/Analysis/out-of-bounds.c6
-rw-r--r--test/Analysis/outofbound-notwork.c2
-rw-r--r--test/Analysis/outofbound.c36
-rw-r--r--test/Analysis/plist-output-alternate.m49
-rw-r--r--test/Analysis/plist-output.m647
-rw-r--r--test/Analysis/ptr-arith.c217
-rw-r--r--test/Analysis/rdar-7168531.m2
-rw-r--r--test/Analysis/refcnt_naming.m2
-rw-r--r--test/Analysis/reference.cpp79
-rw-r--r--test/Analysis/region-store.c23
-rw-r--r--test/Analysis/retain-release-path-notes-gc.m1339
-rw-r--r--test/Analysis/retain-release-path-notes.m4489
-rw-r--r--test/Analysis/retain-release.m130
-rw-r--r--test/Analysis/self-init.m31
-rw-r--r--test/Analysis/stack-addr-ps.cpp6
-rw-r--r--test/Analysis/string-fail.c40
-rw-r--r--test/Analysis/string.c397
-rw-r--r--test/Analysis/svalbuilder-logic.c7
-rw-r--r--test/Analysis/system-header-simulator-objc.h16
-rw-r--r--test/Analysis/system-header-simulator.h24
-rw-r--r--test/Analysis/taint-generic.c29
-rw-r--r--test/Analysis/taint-tester.c2
-rw-r--r--test/Analysis/temp-obj-dtors-cfg-output.cpp205
-rw-r--r--test/Analysis/templates.cpp44
-rw-r--r--test/Analysis/test-variably-modified-types.c13
-rw-r--r--test/Analysis/traversal-algorithm.mm213
-rw-r--r--test/Analysis/uninit-sometimes.cpp387
-rw-r--r--test/Analysis/unused-ivars.m21
-rw-r--r--test/CMakeLists.txt172
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.classref/p1-cxx11.cpp69
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.classref/p4-cxx11.cpp21
-rw-r--r--test/CXX/basic/basic.types/p10.cpp6
-rw-r--r--test/CXX/class.access/class.friend/p1.cpp2
-rw-r--r--test/CXX/class.access/class.friend/p9-cxx0x.cpp117
-rw-r--r--test/CXX/class.derived/class.virtual/p3-0x.cpp49
-rw-r--r--test/CXX/class/class.mem/p14.cpp5
-rw-r--r--test/CXX/class/class.union/p1.cpp5
-rw-r--r--test/CXX/class/p6-0x.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp48
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp37
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp3
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p5-cxx0x.cpp12
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp4
-rw-r--r--test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp76
-rw-r--r--test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.delete/p4.cpp8
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.list/p3-0x.cpp113
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp14
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p1.cpp16
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp27
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p9-0x.cpp6
-rw-r--r--test/CXX/except/except.spec/p14.cpp24
-rw-r--r--test/CXX/except/except.spec/p5-pointers.cpp6
-rw-r--r--test/CXX/expr/expr.const/p2-0x.cpp6
-rw-r--r--test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp7
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/blocks-irgen.mm29
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/blocks.mm38
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p23.cpp4
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp8
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.op/p6.cpp2
-rw-r--r--test/CXX/expr/p10-0x.cpp46
-rw-r--r--test/CXX/special/class.conv/class.conv.ctor/p1.cpp21
-rw-r--r--test/CXX/special/class.copy/implicit-move.cpp7
-rw-r--r--test/CXX/special/class.copy/p11.0x.copy.cpp16
-rw-r--r--test/CXX/special/class.copy/p13-0x.cpp56
-rw-r--r--test/CXX/special/class.copy/p15-inclass.cpp2
-rw-r--r--test/CXX/special/class.copy/p23-cxx11.cpp148
-rw-r--r--test/CXX/special/class.copy/p8-cxx11.cpp2
-rw-r--r--test/CXX/special/class.ctor/p5-0x.cpp6
-rw-r--r--test/CXX/special/class.ctor/p6-0x.cpp39
-rw-r--r--test/CXX/special/class.dtor/p5-0x.cpp8
-rw-r--r--test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp9
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p1.cpp3
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp43
-rw-r--r--test/CXX/temp/temp.names/p3-0x.cpp12
-rw-r--r--test/CXX/temp/temp.spec/p5.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p14.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp8
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p12.cpp49
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp2
-rw-r--r--test/CodeCompletion/auto.cpp2
-rw-r--r--test/CodeCompletion/documentation.cpp33
-rw-r--r--test/CodeCompletion/objc-expr.m17
-rw-r--r--test/CodeGen/2005-07-20-SqrtNoErrno.c2
-rw-r--r--test/CodeGen/2007-02-25-C-DotDotDot.c2
-rw-r--r--test/CodeGen/2008-01-25-ByValReadNone.c2
-rw-r--r--test/CodeGen/2008-03-05-syncPtr.c2
-rw-r--r--test/CodeGen/2008-04-08-NoExceptions.c2
-rw-r--r--test/CodeGen/2009-02-13-zerosize-union-field-ppc.c1
-rw-r--r--test/CodeGen/2009-09-24-SqrtErrno.c2
-rw-r--r--test/CodeGen/2009-10-20-GlobalDebug.c4
-rw-r--r--test/CodeGen/2010-02-10-PointerName.c2
-rw-r--r--test/CodeGen/2010-05-26-AsmSideEffect.c1
-rw-r--r--test/CodeGen/Atomics.c2
-rw-r--r--test/CodeGen/address-safety-attr.cpp6
-rw-r--r--test/CodeGen/address-space.c6
-rw-r--r--test/CodeGen/alloca.c (renamed from test/CodeGen/2002-05-24-Alloca.c)0
-rw-r--r--test/CodeGen/altivec.c1
-rw-r--r--test/CodeGen/annotations-builtin.c14
-rw-r--r--test/CodeGen/arm-aapcs-vfp.c12
-rw-r--r--test/CodeGen/arm-aapcs-zerolength-bitfield.c1
-rw-r--r--test/CodeGen/arm-apcs-zerolength-bitfield.c1
-rw-r--r--test/CodeGen/arm-arguments.c13
-rw-r--r--test/CodeGen/arm-asm-variable.c1
-rw-r--r--test/CodeGen/arm-asm.c1
-rw-r--r--test/CodeGen/arm-cc.c1
-rw-r--r--test/CodeGen/arm-clear.c1
-rw-r--r--test/CodeGen/arm-homogenous.c3
-rw-r--r--test/CodeGen/arm-inline-asm.c1
-rw-r--r--test/CodeGen/arm-pcs.c1
-rw-r--r--test/CodeGen/arm-vaarg-align.c1
-rw-r--r--test/CodeGen/arm-vector-align.c1
-rw-r--r--test/CodeGen/arm-vector-arguments.c1
-rw-r--r--test/CodeGen/asm.c10
-rw-r--r--test/CodeGen/asm_arm.c1
-rw-r--r--test/CodeGen/atomic_ops.c15
-rw-r--r--test/CodeGen/attr-coldhot.c9
-rw-r--r--test/CodeGen/attributes.c8
-rw-r--r--test/CodeGen/avx-builtins.c70
-rw-r--r--test/CodeGen/avx2-builtins.c156
-rw-r--r--test/CodeGen/block-3.c12
-rw-r--r--test/CodeGen/block-byref-aggr.c71
-rw-r--r--test/CodeGen/blocks.c28
-rw-r--r--test/CodeGen/blocksignature.c2
-rw-r--r--test/CodeGen/blockwithlocalstatic.c6
-rw-r--r--test/CodeGen/bmi-builtins.c12
-rw-r--r--test/CodeGen/bool_test.c1
-rw-r--r--test/CodeGen/bounds-checking.c26
-rw-r--r--test/CodeGen/branch-target-layout.c40
-rw-r--r--test/CodeGen/builtin-attributes.c1
-rw-r--r--test/CodeGen/builtins-arm.c1
-rw-r--r--test/CodeGen/builtins-mips-args.c14
-rw-r--r--test/CodeGen/builtins-mips.c324
-rw-r--r--test/CodeGen/builtins-nvptx.c (renamed from test/CodeGen/builtins-ptx.c)5
-rw-r--r--test/CodeGen/builtins-ppc-altivec.c1
-rw-r--r--test/CodeGen/builtins-x86.c1
-rw-r--r--test/CodeGen/builtins.c6
-rw-r--r--test/CodeGen/capture-complex-expr-in-block.c2
-rw-r--r--test/CodeGen/catch-undef-behavior.c12
-rw-r--r--test/CodeGen/compound-literal.c2
-rw-r--r--test/CodeGen/debug-info-gline-tables-only.c33
-rw-r--r--test/CodeGen/debug-info-gline-tables-only2.c13
-rw-r--r--test/CodeGen/debug-info-line2.c5
-rw-r--r--test/CodeGen/debug-info-line3.c4
-rw-r--r--test/CodeGen/debug-info-vla.c12
-rw-r--r--test/CodeGen/debug-line-1.c2
-rw-r--r--test/CodeGen/fma-builtins.c166
-rw-r--r--test/CodeGen/fma4-builtins.c64
-rw-r--r--test/CodeGen/forceinline.c14
-rw-r--r--test/CodeGen/fp-contract.c9
-rw-r--r--test/CodeGen/fp16-ops.c1
-rw-r--r--test/CodeGen/func-aligned.c2
-rw-r--r--test/CodeGen/func-in-block.c4
-rw-r--r--test/CodeGen/func-return-member.c2
-rw-r--r--test/CodeGen/incomplete-function-type.c2
-rw-r--r--test/CodeGen/integer-overflow.c8
-rw-r--r--test/CodeGen/libcalls.c45
-rw-r--r--test/CodeGen/mips-byval-arg.c15
-rw-r--r--test/CodeGen/mips-vector-arg.c28
-rw-r--r--test/CodeGen/mips-vector-return.c31
-rw-r--r--test/CodeGen/mips64-class-return.cpp2
-rw-r--r--test/CodeGen/ms-declspecs.c8
-rw-r--r--test/CodeGen/ms-inline-asm.c40
-rw-r--r--test/CodeGen/no-common.c2
-rw-r--r--test/CodeGen/nobuiltin.c8
-rw-r--r--test/CodeGen/nvptx-cc.c (renamed from test/CodeGen/ptx-cc.c)6
-rw-r--r--test/CodeGen/nvptx-inlineasm.c15
-rw-r--r--test/CodeGen/object-size.c16
-rw-r--r--test/CodeGen/packed-nest-unpacked.c18
-rw-r--r--test/CodeGen/pclmul-builtins.c11
-rw-r--r--test/CodeGen/powerpc_types.c1
-rw-r--r--test/CodeGen/pr12251.c2
-rw-r--r--test/CodeGen/pr13168.c7
-rw-r--r--test/CodeGen/pr5406.c1
-rw-r--r--test/CodeGen/pragma-visibility.c2
-rw-r--r--test/CodeGen/rdrand-builtins.c27
-rw-r--r--test/CodeGen/regparm-flag.c3
-rw-r--r--test/CodeGen/regparm-struct.c177
-rw-r--r--test/CodeGen/sse-builtins.c6
-rw-r--r--test/CodeGen/sse4a-builtins.c39
-rw-r--r--test/CodeGen/struct-init.c1
-rw-r--r--test/CodeGen/struct-matching-constraint.c1
-rw-r--r--test/CodeGen/tbaa-for-vptr.cpp12
-rw-r--r--test/CodeGen/thread-specifier.c15
-rw-r--r--test/CodeGen/tls-model.c28
-rw-r--r--test/CodeGen/varargs.c8
-rw-r--r--test/CodeGen/vector-alignment.c38
-rw-r--r--test/CodeGen/vla.c49
-rw-r--r--test/CodeGen/vld_dup.c1
-rw-r--r--test/CodeGen/x86_32-arguments-darwin.c13
-rw-r--r--test/CodeGen/xop-builtins.c326
-rw-r--r--test/CodeGenCUDA/address-spaces.cu24
-rw-r--r--test/CodeGenCUDA/ptx-kernels.cu2
-rw-r--r--test/CodeGenCXX/anonymous-union-member-initializer.cpp10
-rw-r--r--test/CodeGenCXX/block-in-ctor-dtor.cpp10
-rw-r--r--test/CodeGenCXX/blocks.cpp6
-rw-r--r--test/CodeGenCXX/class-layout.cpp14
-rw-r--r--test/CodeGenCXX/const-init-cxx11.cpp32
-rw-r--r--test/CodeGenCXX/constructor-init.cpp20
-rw-r--r--test/CodeGenCXX/cxx0x-delegating-ctors.cpp11
-rw-r--r--test/CodeGenCXX/cxx0x-initializer-constructors.cpp37
-rw-r--r--test/CodeGenCXX/cxx0x-initializer-references.cpp4
-rw-r--r--test/CodeGenCXX/cxx11-initializer-aggregate.cpp25
-rw-r--r--test/CodeGenCXX/cxx11-vtable-key-function.cpp38
-rw-r--r--test/CodeGenCXX/debug-info-artificial-arg.cpp10
-rw-r--r--test/CodeGenCXX/debug-info-cxx0x.cpp10
-rw-r--r--test/CodeGenCXX/debug-info-determinism.cpp16
-rw-r--r--test/CodeGenCXX/debug-info-enum-class.cpp15
-rw-r--r--test/CodeGenCXX/debug-info-flex-member.cpp9
-rw-r--r--test/CodeGenCXX/debug-info-fwd-ref.cpp6
-rw-r--r--test/CodeGenCXX/debug-info-gline-tables-only.cpp21
-rw-r--r--test/CodeGenCXX/debug-info-globalinit.cpp30
-rw-r--r--test/CodeGenCXX/debug-info-nullptr.cpp2
-rw-r--r--test/CodeGenCXX/debug-info-rvalue-ref.cpp11
-rw-r--r--test/CodeGenCXX/debug-info-static-fns.cpp2
-rw-r--r--test/CodeGenCXX/debug-info-template-array.cpp14
-rw-r--r--test/CodeGenCXX/debug-info-template-limit.cpp5
-rw-r--r--test/CodeGenCXX/debug-info-template-member.cpp2
-rw-r--r--test/CodeGenCXX/debug-info-template-quals.cpp23
-rw-r--r--test/CodeGenCXX/debug-info-union.cpp16
-rw-r--r--test/CodeGenCXX/debug-info-user-def.cpp14
-rw-r--r--test/CodeGenCXX/debug-lambda-expressions.cpp50
-rw-r--r--test/CodeGenCXX/derived-to-base-conv.cpp111
-rw-r--r--test/CodeGenCXX/destructor-debug-info.cpp7
-rw-r--r--test/CodeGenCXX/destructor-exception-spec.cpp12
-rw-r--r--test/CodeGenCXX/destructors.cpp16
-rw-r--r--test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp139
-rw-r--r--test/CodeGenCXX/devirtualize-virtual-function-calls.cpp30
-rw-r--r--test/CodeGenCXX/dynamic-cast-always-null.cpp5
-rw-r--r--test/CodeGenCXX/exceptions.cpp36
-rw-r--r--test/CodeGenCXX/global-array-destruction.cpp33
-rw-r--r--test/CodeGenCXX/global-block-literal-helpers.cpp27
-rw-r--r--test/CodeGenCXX/global-init.cpp107
-rw-r--r--test/CodeGenCXX/inline-functions.cpp14
-rw-r--r--test/CodeGenCXX/lambda-expressions.cpp8
-rw-r--r--test/CodeGenCXX/mangle-lambdas.cpp35
-rw-r--r--test/CodeGenCXX/mangle-ms-abi-examples.cpp28
-rw-r--r--test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp165
-rw-r--r--test/CodeGenCXX/mangle-ms-back-references.cpp63
-rw-r--r--test/CodeGenCXX/mangle-ms-cxx11.cpp11
-rw-r--r--test/CodeGenCXX/mangle-ms-return-qualifiers.cpp173
-rw-r--r--test/CodeGenCXX/mangle-ms-templates.cpp68
-rw-r--r--test/CodeGenCXX/mangle-ms.cpp73
-rw-r--r--test/CodeGenCXX/mangle-ref-qualifiers.cpp8
-rw-r--r--test/CodeGenCXX/member-data-pointers.cpp13
-rw-r--r--test/CodeGenCXX/member-function-pointers.cpp119
-rw-r--r--test/CodeGenCXX/member-init-anon-union.cpp6
-rw-r--r--test/CodeGenCXX/member-init-ctor.cpp14
-rw-r--r--test/CodeGenCXX/member-pointer-type-convert.cpp11
-rw-r--r--test/CodeGenCXX/microsoft-abi-array-cookies.cpp59
-rw-r--r--test/CodeGenCXX/microsoft-abi-constructors.cpp21
-rw-r--r--test/CodeGenCXX/microsoft-abi-methods.cpp89
-rw-r--r--test/CodeGenCXX/microsoft-abi-static-initializers.cpp52
-rw-r--r--test/CodeGenCXX/ms_wide_predefined_expr.cpp20
-rw-r--r--test/CodeGenCXX/pointers-to-data-members.cpp14
-rw-r--r--test/CodeGenCXX/pr13396.cpp26
-rw-r--r--test/CodeGenCXX/pragma-visibility.cpp28
-rw-r--r--test/CodeGenCXX/rvalue-references.cpp2
-rw-r--r--test/CodeGenCXX/template-instantiation.cpp4
-rw-r--r--test/CodeGenCXX/throw-expression-cleanup.cpp22
-rw-r--r--test/CodeGenCXX/virt-call-offsets.cpp8
-rw-r--r--test/CodeGenCXX/virt-template-vtable.cpp10
-rw-r--r--test/CodeGenCXX/virtual-destructor-calls.cpp11
-rw-r--r--test/CodeGenCXX/visibility-inlines-hidden.cpp18
-rw-r--r--test/CodeGenCXX/visibility.cpp511
-rw-r--r--test/CodeGenObjC/2008-11-12-Metadata.m2
-rw-r--r--test/CodeGenObjC/2008-11-24-ConstCFStrings.m2
-rw-r--r--test/CodeGenObjC/2010-03-17-StructRef.m2
-rw-r--r--test/CodeGenObjC/arc-blocks.m17
-rw-r--r--test/CodeGenObjC/arc.m3
-rw-r--r--test/CodeGenObjC/assign.m2
-rw-r--r--test/CodeGenObjC/autorelease.m4
-rw-r--r--test/CodeGenObjC/bitfield-1.m6
-rw-r--r--test/CodeGenObjC/bitfield-access.m4
-rw-r--r--test/CodeGenObjC/bitfield-gnu.m2
-rw-r--r--test/CodeGenObjC/bitfield_encoding.m4
-rw-r--r--test/CodeGenObjC/block-6.m2
-rw-r--r--test/CodeGenObjC/block-var-layout.m2
-rw-r--r--test/CodeGenObjC/blocks-1.m4
-rw-r--r--test/CodeGenObjC/blocks-2.m6
-rw-r--r--test/CodeGenObjC/blocks-3.m2
-rw-r--r--test/CodeGenObjC/blocks-4.m2
-rw-r--r--test/CodeGenObjC/blocks-5.m2
-rw-r--r--test/CodeGenObjC/blocks.m6
-rw-r--r--test/CodeGenObjC/boxing.m95
-rw-r--r--test/CodeGenObjC/builtins.m2
-rw-r--r--test/CodeGenObjC/category-class.m2
-rw-r--r--test/CodeGenObjC/class-type.m6
-rw-r--r--test/CodeGenObjC/constant-string-class.m2
-rw-r--r--test/CodeGenObjC/constant-strings.m4
-rw-r--r--test/CodeGenObjC/deadcode_strip_used_var.m4
-rw-r--r--test/CodeGenObjC/debug-info-block-helper.m4
-rw-r--r--test/CodeGenObjC/debug-info-crash.m2
-rw-r--r--test/CodeGenObjC/debug-info-static-var.m2
-rw-r--r--test/CodeGenObjC/debug-info-synthesis.m2
-rw-r--r--test/CodeGenObjC/encode-cstyle-method.m2
-rw-r--r--test/CodeGenObjC/encode-test-6.m19
-rw-r--r--test/CodeGenObjC/encode-test.m2
-rw-r--r--test/CodeGenObjC/exceptions.m2
-rw-r--r--test/CodeGenObjC/fp2ret.m6
-rw-r--r--test/CodeGenObjC/fpret.m6
-rw-r--r--test/CodeGenObjC/getter-property-mismatch.m20
-rw-r--r--test/CodeGenObjC/getter-property-type-mismatch.m35
-rw-r--r--test/CodeGenObjC/gnu-exceptions.m2
-rw-r--r--test/CodeGenObjC/id-isa-codegen.m4
-rw-r--r--test/CodeGenObjC/image-info.m2
-rw-r--r--test/CodeGenObjC/implicit-objc_msgSend.m2
-rw-r--r--test/CodeGenObjC/interface-layout-64.m47
-rw-r--r--test/CodeGenObjC/interface.m2
-rw-r--r--test/CodeGenObjC/ivar-layout-64-bitfields.m4
-rw-r--r--test/CodeGenObjC/ivar-layout-array0-struct.m2
-rw-r--r--test/CodeGenObjC/ivar-layout-no-optimize.m4
-rw-r--r--test/CodeGenObjC/ivars.m4
-rw-r--r--test/CodeGenObjC/layout-bitfield-crash.m35
-rw-r--r--test/CodeGenObjC/link-errors.m4
-rw-r--r--test/CodeGenObjC/local-static-block.m2
-rw-r--r--test/CodeGenObjC/messages-2.m2
-rw-r--r--test/CodeGenObjC/messages.m6
-rw-r--r--test/CodeGenObjC/metadata-symbols-32.m2
-rw-r--r--test/CodeGenObjC/misc-atomic-property.m2
-rw-r--r--test/CodeGenObjC/mrr-autorelease.m2
-rw-r--r--test/CodeGenObjC/nested-rethrow.m2
-rw-r--r--test/CodeGenObjC/next-objc-dispatch.m2
-rw-r--r--test/CodeGenObjC/no-category-class.m2
-rw-r--r--test/CodeGenObjC/nonlazy-msgSend.m2
-rw-r--r--test/CodeGenObjC/ns-constant-strings.m2
-rw-r--r--test/CodeGenObjC/objc-align.m2
-rw-r--r--test/CodeGenObjC/objc-assign-ivar.m2
-rw-r--r--test/CodeGenObjC/objc-gc-aggr-assign.m4
-rw-r--r--test/CodeGenObjC/objc-literal-debugger-test.m39
-rw-r--r--test/CodeGenObjC/objc-read-weak-byref.m4
-rw-r--r--test/CodeGenObjC/objc2-assign-global.m2
-rw-r--r--test/CodeGenObjC/objc2-new-gc-api-strongcast.m4
-rw-r--r--test/CodeGenObjC/objc2-no-write-barrier.m4
-rw-r--r--test/CodeGenObjC/objc2-retain-codegen.m4
-rw-r--r--test/CodeGenObjC/objc2-strong-cast-1.m4
-rw-r--r--test/CodeGenObjC/objc2-weak-assign.m4
-rw-r--r--test/CodeGenObjC/objc2-weak-block-call.m4
-rw-r--r--test/CodeGenObjC/objc2-weak-compare.m4
-rw-r--r--test/CodeGenObjC/objc2-weak-ivar-debug.m8
-rw-r--r--test/CodeGenObjC/objc2-weak-ivar.m4
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-2.m4
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-4.m4
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-5.m4
-rw-r--r--test/CodeGenObjC/objc2-write-barrier.m4
-rw-r--r--test/CodeGenObjC/object-incr-decr-1.m2
-rw-r--r--test/CodeGenObjC/objfw.m15
-rw-r--r--test/CodeGenObjC/predefined-expr.m2
-rw-r--r--test/CodeGenObjC/property-complex.m4
-rw-r--r--test/CodeGenObjC/property-ref-cast-to-void.m4
-rw-r--r--test/CodeGenObjC/protocol-in-extended-class.m2
-rw-r--r--test/CodeGenObjC/protocols-lazy.m2
-rw-r--r--test/CodeGenObjC/rdr-6732143-dangling-block-reference.m2
-rw-r--r--test/CodeGenObjC/super-message-fragileabi.m2
-rw-r--r--test/CodeGenObjC/synchronized.m2
-rw-r--r--test/CodeGenObjC/terminate.m4
-rw-r--r--test/CodeGenObjC/undefined-protocol.m2
-rw-r--r--test/CodeGenObjC/variadic-sends.m4
-rw-r--r--test/CodeGenObjC/x86_64-struct-return-gc.m2
-rw-r--r--test/CodeGenObjCXX/arc.mm16
-rw-r--r--test/CodeGenObjCXX/block-in-template-inst.mm2
-rw-r--r--test/CodeGenObjCXX/block-var-layout.mm2
-rw-r--r--test/CodeGenObjCXX/blocks.mm21
-rw-r--r--test/CodeGenObjCXX/catch-id-type.mm2
-rw-r--r--test/CodeGenObjCXX/copy.mm2
-rw-r--r--test/CodeGenObjCXX/copyable-property-object.mm2
-rw-r--r--test/CodeGenObjCXX/encode.mm58
-rw-r--r--test/CodeGenObjCXX/gc.mm2
-rw-r--r--test/CodeGenObjCXX/implicit-copy-assign-operator.mm2
-rw-r--r--test/CodeGenObjCXX/implicit-copy-constructor.mm2
-rw-r--r--test/CodeGenObjCXX/lambda-expressions.mm10
-rw-r--r--test/CodeGenObjCXX/mangle-blocks.mm18
-rw-r--r--test/CodeGenObjCXX/message-reference.mm2
-rw-r--r--test/CodeGenObjCXX/nrvo.mm4
-rw-r--r--test/CodeGenObjCXX/property-derived-to-base-conv.mm2
-rw-r--r--test/CodeGenObjCXX/property-object-conditional-exp.mm2
-rw-r--r--test/CodeGenObjCXX/property-object-reference-2.mm2
-rw-r--r--test/CodeGenObjCXX/property-object-reference.mm2
-rw-r--r--test/CodeGenObjCXX/property-reference.mm2
-rw-r--r--test/CodeGenObjCXX/refence-assign-write-barrier.mm2
-rw-r--r--test/CodeGenObjCXX/selector-expr-lvalue.mm2
-rw-r--r--test/CodeGenObjCXX/write-barrier-global-assign.mm2
-rw-r--r--test/CodeGenOpenCL/kernel-arg-info.cl7
-rw-r--r--test/CodeGenOpenCL/kernel-attributes.cl12
-rw-r--r--test/CodeGenOpenCL/ptx-calls.cl2
-rw-r--r--test/CodeGenOpenCL/ptx-kernels.cl2
-rw-r--r--test/Coverage/codegen-gnu.m2
-rw-r--r--test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_dynamic.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_so.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_static.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/usr/lib/crtend_android.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/usr/lib/crtend_so.o0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/lib/mips-linux-gnu/.keep0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/lib/mipsel-linux-gnu/.keep0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mips-linux-gnu/.keep0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mipsel-linux-gnu/.keep0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/include/mips-linux-gnu/.keep0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/include/mipsel-linux-gnu/.keep0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/64/crtbegin.o0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/crtbegin.o0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/n32/crtbegin.o0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/64/crtbegin.o0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/crtbegin.o0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/n32/crtbegin.o0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/lib/mips-linux-gnu/.keep0
-rw-r--r--test/Driver/Inputs/debian_multiarch_tree/usr/lib/mipsel-linux-gnu/.keep0
-rw-r--r--test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/crtbegin.o1
-rw-r--r--test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/libgcc.a1
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/.keep0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/arm-linux-gnueabi/.keep0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/arm-linux-gnueabihf/.keep0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/.keep0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/arm-linux-gnueabi/.keep0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/arm-linux-gnueabihf/.keep0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/.keep0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crt1.o0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crti.o0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crtn.o0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crt1.o0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crti.o0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crtn.o0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtend.o0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtbegin.o0
-rw-r--r--test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtend.o0
-rw-r--r--test/Driver/altivec.cpp3
-rw-r--r--test/Driver/apple-kext-i386.cpp5
-rw-r--r--test/Driver/arc.c4
-rw-r--r--test/Driver/arclite-link.c11
-rw-r--r--test/Driver/asan-ld.c31
-rw-r--r--test/Driver/bounds-checking.c7
-rw-r--r--test/Driver/ccc-as-cpp.c6
-rw-r--r--test/Driver/clang-translation.c30
-rw-r--r--test/Driver/clang_f_opts.c9
-rw-r--r--test/Driver/clang_f_opts.h2
-rw-r--r--test/Driver/constructors.c14
-rw-r--r--test/Driver/crash-report.c27
-rw-r--r--test/Driver/darwin-ld.c5
-rw-r--r--test/Driver/darwin-objc-defaults.m18
-rw-r--r--test/Driver/darwin-objc-options.m15
-rw-r--r--test/Driver/debug-options-as.c6
-rw-r--r--test/Driver/debug-options.c49
-rw-r--r--test/Driver/debug-unsupported.c13
-rw-r--r--test/Driver/fast-math.c24
-rw-r--r--test/Driver/flags.c2
-rw-r--r--test/Driver/fpack-struct.c10
-rw-r--r--test/Driver/freebsd.c16
-rw-r--r--test/Driver/gnu-runtime.m5
-rw-r--r--test/Driver/ios-simulator-arcruntime.c8
-rw-r--r--test/Driver/linker-opts.c2
-rw-r--r--test/Driver/linux-as.c37
-rw-r--r--test/Driver/linux-ld.c130
-rw-r--r--test/Driver/mips-as.c19
-rw-r--r--test/Driver/mips-features.c39
-rw-r--r--test/Driver/mips-float.c1
-rw-r--r--test/Driver/montavista-gcc-toolchain.c9
-rw-r--r--test/Driver/msvc_forward.c5
-rw-r--r--test/Driver/nodefaultlib.c8
-rw-r--r--test/Driver/rewrite-legacy-objc.m2
-rw-r--r--test/Driver/rewrite-objc.m2
-rw-r--r--test/Driver/target-triple-deployment.c33
-rw-r--r--test/Driver/warning-options.cpp10
-rw-r--r--test/Driver/warning-options_pedantic.cpp7
-rw-r--r--test/FixIt/fixit-autoreleasepool.m9
-rw-r--r--test/FixIt/fixit-cxx0x.cpp14
-rw-r--r--test/FixIt/fixit-include.c13
-rw-r--r--test/FixIt/fixit-include.h1
-rw-r--r--test/FixIt/fixit-interface-as-param.m11
-rw-r--r--test/FixIt/fixit-objc-message-comma-separator.m17
-rw-r--r--test/FixIt/fixit-unicode.c33
-rw-r--r--test/FixIt/fixit-vexing-parse.cpp51
-rw-r--r--test/FixIt/fixit.c8
-rw-r--r--test/FixIt/fixit.cpp90
-rw-r--r--test/FixIt/format-no-fixit.m30
-rw-r--r--test/FixIt/format.m95
-rw-r--r--test/FixIt/messages.cpp13
-rw-r--r--test/FixIt/objc-literals.m16
-rw-r--r--test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/all.h1
-rw-r--r--test/Frontend/Inputs/SystemHeaderPrefix/libs/boost/warn.h2
-rw-r--r--test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/all.h1
-rw-r--r--test/Frontend/Inputs/SystemHeaderPrefix/libs/mylib/warn.h2
-rw-r--r--test/Frontend/Inputs/SystemHeaderPrefix/src/all.h6
-rw-r--r--test/Frontend/Inputs/SystemHeaderPrefix/src/warn.h2
-rw-r--r--test/Frontend/Inputs/rewrite-includes1.h3
-rw-r--r--test/Frontend/Inputs/rewrite-includes2.h1
-rw-r--r--test/Frontend/Inputs/rewrite-includes3.h1
-rw-r--r--test/Frontend/Inputs/rewrite-includes4.h1
-rw-r--r--test/Frontend/Inputs/rewrite-includes5.h1
-rw-r--r--test/Frontend/Inputs/rewrite-includes6.h2
-rw-r--r--test/Frontend/Inputs/rewrite-includes7.h4
-rw-r--r--test/Frontend/rewrite-includes-missing.c7
-rw-r--r--test/Frontend/rewrite-includes.c145
-rw-r--r--test/Frontend/system-header-prefix.c11
-rw-r--r--test/Frontend/verify-directive.h2
-rw-r--r--test/Frontend/verify-fatal.c12
-rw-r--r--test/Frontend/verify.c125
-rw-r--r--test/Frontend/verify2.c19
-rw-r--r--test/Frontend/verify2.h5
-rw-r--r--test/Headers/ms-null-ms-header-vs-stddef.cpp16
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-01.xml7
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-02.xml9
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-03.xml11
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-04.xml11
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-05.xml10
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-06.xml5
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-07.xml13
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-08.xml13
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-09.xml13
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-10.xml11
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-11.xml13
-rw-r--r--test/Index/Inputs/CommentXML/invalid-function-12.xml6
-rw-r--r--test/Index/Inputs/CommentXML/valid-class-01.xml5
-rw-r--r--test/Index/Inputs/CommentXML/valid-class-02.xml5
-rw-r--r--test/Index/Inputs/CommentXML/valid-class-03.xml5
-rw-r--r--test/Index/Inputs/CommentXML/valid-class-04.xml5
-rw-r--r--test/Index/Inputs/CommentXML/valid-enum-01.xml6
-rw-r--r--test/Index/Inputs/CommentXML/valid-function-01.xml5
-rw-r--r--test/Index/Inputs/CommentXML/valid-function-02.xml5
-rw-r--r--test/Index/Inputs/CommentXML/valid-function-03.xml12
-rw-r--r--test/Index/Inputs/CommentXML/valid-function-04.xml13
-rw-r--r--test/Index/Inputs/CommentXML/valid-function-05.xml8
-rw-r--r--test/Index/Inputs/CommentXML/valid-function-06.xml6
-rw-r--r--test/Index/Inputs/CommentXML/valid-function-07.xml30
-rw-r--r--test/Index/Inputs/CommentXML/valid-function-08.xml17
-rw-r--r--test/Index/Inputs/CommentXML/valid-function-09.xml6
-rw-r--r--test/Index/Inputs/CommentXML/valid-function-10.xml6
-rw-r--r--test/Index/Inputs/CommentXML/valid-namespace-01.xml6
-rw-r--r--test/Index/Inputs/CommentXML/valid-other-01.xml5
-rw-r--r--test/Index/Inputs/CommentXML/valid-typedef-01.xml6
-rw-r--r--test/Index/Inputs/CommentXML/valid-typedef-02.xml25
-rw-r--r--test/Index/Inputs/CommentXML/valid-variable-01.xml6
-rw-r--r--test/Index/Inputs/annotate-comments-preprocessor.h2
-rw-r--r--test/Index/annotate-comments-preprocessor.c45
-rw-r--r--test/Index/annotate-comments-unterminated.c13
-rw-r--r--test/Index/annotate-comments.cpp926
-rw-r--r--test/Index/availability.c10
-rw-r--r--test/Index/boxed-exprs.h10
-rw-r--r--test/Index/boxed-exprs.m19
-rw-r--r--test/Index/c-index-api-loadTU-test.m2
-rw-r--r--test/Index/comment-xml-schema.c43
-rw-r--r--test/Index/compile_commands.json27
-rw-r--r--test/Index/complete-documentation.cpp51
-rw-r--r--test/Index/complete-exprs.m10
-rw-r--r--test/Index/complete-lambdas.mm51
-rw-r--r--test/Index/complete-method-decls.m2
-rw-r--r--test/Index/complete-properties.m14
-rw-r--r--test/Index/create-tu-fail.c10
-rw-r--r--test/Index/cursor-dynamic-call.mm59
-rw-r--r--test/Index/get-cursor.c6
-rw-r--r--test/Index/get-cursor.cpp10
-rw-r--r--test/Index/get-cursor.m33
-rw-r--r--test/Index/index-decls.m17
-rw-r--r--test/Index/index-kernel-invocation.cpp4
-rw-r--r--test/Index/index-many-call-ops.cpp47
-rw-r--r--test/Index/index-refs.m18
-rw-r--r--test/Index/overrides.m58
-rw-r--r--test/Index/pch-with-errors.c4
-rw-r--r--test/Index/print-typekind.m6
-rw-r--r--test/Index/recursive-cxx-member-calls.cpp5
-rw-r--r--test/Lexer/bcpl-escaped-newline.c3
-rw-r--r--test/Lexer/c90.c7
-rw-r--r--test/Lexer/char-literal.cpp3
-rw-r--r--test/Lexer/hexfloat.cpp8
-rw-r--r--test/Lexer/newline-eof.c4
-rw-r--r--test/Lexer/pragma-operators.cpp1
-rw-r--r--test/Lexer/wchar-signedness.c8
-rw-r--r--test/Misc/ast-dump-wchar.cpp13
-rw-r--r--test/Misc/diag-aka-types.cpp23
-rw-r--r--test/Misc/diag-template-diffing-color.cpp19
-rw-r--r--test/Misc/diag-template-diffing.cpp433
-rw-r--r--test/Misc/diag-trailing-null-bytes.cpp10
-rw-r--r--test/Misc/emit-html.c8
-rw-r--r--test/Misc/integer-literal-printing.cpp4
-rw-r--r--test/Misc/serialized-diags-frontend.c8
-rw-r--r--test/Misc/show-diag-options.c2
-rw-r--r--test/Misc/tabstop.c9
-rw-r--r--test/Misc/warning-flags-enabled.c27
-rw-r--r--test/Misc/warning-flags-tree.c56
-rw-r--r--test/Misc/warning-flags.c103
-rw-r--r--test/Misc/wnull-character.cppbin143 -> 0 bytes
-rw-r--r--test/Modules/Inputs/Module.framework/Headers/Module.h6
-rw-r--r--test/Modules/Inputs/category_right.h2
-rw-r--r--test/Modules/Inputs/import-decl.h1
-rw-r--r--test/Modules/Inputs/module.map3
-rw-r--r--test/Modules/cstd.m2
-rw-r--r--test/Modules/import-decl.cpp10
-rw-r--r--test/Modules/lookup.cpp2
-rw-r--r--test/Modules/objc-categories.m1
-rw-r--r--test/Modules/on-demand-build.m5
-rw-r--r--test/PCH/Inputs/__va_list_tag.h5
-rw-r--r--test/PCH/__va_list_tag.c12
-rw-r--r--test/PCH/attrs.c3
-rw-r--r--test/PCH/badpch-dir.h.gch/.keep0
-rw-r--r--test/PCH/badpch-empty.h.gch0
-rw-r--r--test/PCH/badpch.c13
-rw-r--r--test/PCH/chain-staticvar-instantiation.cpp45
-rw-r--r--test/PCH/chain-trivial.c2
-rw-r--r--test/PCH/cxx-friends.cpp8
-rw-r--r--test/PCH/cxx-friends.h12
-rw-r--r--test/PCH/cxx-member-init.cpp4
-rw-r--r--test/PCH/cxx-static_assert.cpp3
-rw-r--r--test/PCH/cxx-trailing-return.cpp6
-rw-r--r--test/PCH/cxx0x-default-delete.cpp12
-rw-r--r--test/PCH/cxx0x-delegating-ctors.cpp12
-rw-r--r--test/PCH/cxx11-constexpr.cpp6
-rw-r--r--test/PCH/cxx11-enum-template.cpp4
-rw-r--r--test/PCH/cxx11-user-defined-literals.cpp3
-rw-r--r--test/PCH/empty-with-headers.c27
-rw-r--r--test/PCH/exprs.h2
-rw-r--r--test/PCH/format-strings.c18
-rw-r--r--test/PCH/ms-if-exists.cpp3
-rw-r--r--test/PCH/objc_methods.h30
-rw-r--r--test/PCH/objc_methods.m2
-rw-r--r--test/PCH/objc_stmts.m4
-rw-r--r--test/PCH/pch__VA_ARGS__.c6
-rw-r--r--test/PCH/pch__VA_ARGS__.h2
-rw-r--r--test/PCH/remap-file-from-pch.cpp10
-rw-r--r--test/PCH/remap-file-from-pch.cpp.h2
-rw-r--r--test/PCH/remap-file-from-pch.cpp.remap.h4
-rw-r--r--test/PCH/replaced-decl.m3
-rw-r--r--test/PCH/typo2.cpp3
-rw-r--r--test/PCH/variables.c12
-rw-r--r--test/Parser/DelayedTemplateParsing.cpp13
-rw-r--r--test/Parser/MicrosoftExtensions.c43
-rw-r--r--test/Parser/MicrosoftExtensions.cpp60
-rw-r--r--test/Parser/altivec.c10
-rw-r--r--test/Parser/c1x-alignas.c8
-rw-r--r--test/Parser/completely-empty-header-file.h0
-rw-r--r--test/Parser/cuda-kernel-call.cu7
-rw-r--r--test/Parser/cxx-class.cpp8
-rw-r--r--test/Parser/cxx-decl.cpp6
-rw-r--r--test/Parser/cxx-extra-semi.cpp41
-rw-r--r--test/Parser/cxx-template-argument.cpp15
-rw-r--r--test/Parser/cxx-throw.cpp2
-rw-r--r--test/Parser/cxx-undeclared-identifier.cpp12
-rw-r--r--test/Parser/cxx-using-declaration.cpp16
-rw-r--r--test/Parser/cxx-using-directive.cpp5
-rw-r--r--test/Parser/cxx0x-ambig.cpp6
-rw-r--r--test/Parser/cxx0x-attributes.cpp135
-rw-r--r--test/Parser/cxx0x-decl.cpp16
-rw-r--r--test/Parser/cxx0x-lambda-expressions.cpp7
-rw-r--r--test/Parser/cxx11-type-specifier.cpp4
-rw-r--r--test/Parser/declarators.c12
-rw-r--r--test/Parser/empty-translation-unit.c10
-rw-r--r--test/Parser/missing-selector-name.mm52
-rw-r--r--test/Parser/ms-inline-asm.c33
-rw-r--r--test/Parser/objc-boxing.m26
-rw-r--r--test/Parser/objc-diag-width.mm8
-rw-r--r--test/Parser/objc-forcollection-neg.m4
-rw-r--r--test/Parser/objc-init.m4
-rw-r--r--test/Parser/objc-recover.mm64
-rw-r--r--test/Parser/objcxx11-attributes.mm3
-rw-r--r--test/Parser/opencl-pragma.cl2
-rw-r--r--test/Parser/recovery.c5
-rw-r--r--test/Parser/recovery.cpp12
-rw-r--r--test/Preprocessor/_Pragma-location.c49
-rw-r--r--test/Preprocessor/comment_save.c14
-rw-r--r--test/Preprocessor/disabled-cond-diags2.c27
-rw-r--r--test/Preprocessor/has_attribute.c10
-rw-r--r--test/Preprocessor/has_include.c48
-rw-r--r--test/Preprocessor/init.c440
-rw-r--r--test/Preprocessor/line-directive.c14
-rw-r--r--test/Preprocessor/macro_fn.c18
-rw-r--r--test/Preprocessor/macro_paste_c_block_comment.c4
-rw-r--r--test/Preprocessor/macro_paste_identifier_error.c7
-rw-r--r--test/Preprocessor/mmx.c3
-rw-r--r--test/Preprocessor/non_fragile_feature1.m2
-rw-r--r--test/Preprocessor/pp-record.c11
-rw-r--r--test/Preprocessor/predefined-arch-macros.c205
-rw-r--r--test/Preprocessor/predefined-macros.c13
-rw-r--r--test/Preprocessor/undef-error.c2
-rw-r--r--test/Preprocessor/warning_tests.c8
-rw-r--r--test/Rewriter/blockcast3.mm2
-rw-r--r--test/Rewriter/blockstruct.m2
-rw-r--r--test/Rewriter/crash.m2
-rw-r--r--test/Rewriter/finally.m2
-rw-r--r--test/Rewriter/func-in-impl.m2
-rw-r--r--test/Rewriter/id-test-3.m2
-rw-r--r--test/Rewriter/inner-block-helper-funcs.mm2
-rw-r--r--test/Rewriter/instancetype-test.mm2
-rw-r--r--test/Rewriter/ivar-encoding-1.m2
-rw-r--r--test/Rewriter/ivar-encoding-2.m2
-rw-r--r--test/Rewriter/metadata-test-1.m2
-rw-r--r--test/Rewriter/metadata-test-2.m2
-rw-r--r--test/Rewriter/method-encoding-1.m2
-rw-r--r--test/Rewriter/objc-bool-literal-modern-1.mm3
-rw-r--r--test/Rewriter/objc-encoding-bug-1.m2
-rw-r--r--test/Rewriter/objc-ivar-receiver-1.m4
-rw-r--r--test/Rewriter/objc-modern-StretAPI.mm45
-rw-r--r--test/Rewriter/objc-modern-boxing.mm72
-rw-r--r--test/Rewriter/objc-modern-container-subscript.mm3
-rw-r--r--test/Rewriter/objc-modern-getclass-proto.mm10
-rw-r--r--test/Rewriter/objc-modern-property-attributes.mm10
-rw-r--r--test/Rewriter/objc-string-concat-1.m2
-rw-r--r--test/Rewriter/objc-super-test.m2
-rw-r--r--test/Rewriter/objc-synchronized-1.m2
-rw-r--r--test/Rewriter/properties.m2
-rw-r--r--test/Rewriter/property-dot-syntax.mm2
-rw-r--r--test/Rewriter/protocol-rewrite-1.m2
-rw-r--r--test/Rewriter/protocol-rewrite-2.m2
-rw-r--r--test/Rewriter/rewrite-anonymous-union.m2
-rw-r--r--test/Rewriter/rewrite-api-bug.m2
-rw-r--r--test/Rewriter/rewrite-block-argument.m2
-rw-r--r--test/Rewriter/rewrite-block-consts.mm2
-rw-r--r--test/Rewriter/rewrite-block-ivar-call.mm2
-rw-r--r--test/Rewriter/rewrite-block-literal-1.mm5
-rw-r--r--test/Rewriter/rewrite-block-literal.mm5
-rw-r--r--test/Rewriter/rewrite-block-pointer.mm5
-rw-r--r--test/Rewriter/rewrite-block-property.m2
-rw-r--r--test/Rewriter/rewrite-byref-in-nested-blocks.mm9
-rw-r--r--test/Rewriter/rewrite-byref-vars.mm4
-rw-r--r--test/Rewriter/rewrite-cast-ivar-access.mm2
-rw-r--r--test/Rewriter/rewrite-cast-to-bool.mm2
-rw-r--r--test/Rewriter/rewrite-category-property.mm2
-rw-r--r--test/Rewriter/rewrite-constructor-init.mm2
-rw-r--r--test/Rewriter/rewrite-eh.m2
-rw-r--r--test/Rewriter/rewrite-elaborated-type.mm2
-rw-r--r--test/Rewriter/rewrite-extern-c.mm2
-rw-r--r--test/Rewriter/rewrite-foreach-1.m2
-rw-r--r--test/Rewriter/rewrite-foreach-2.m2
-rw-r--r--test/Rewriter/rewrite-foreach-3.m2
-rw-r--r--test/Rewriter/rewrite-foreach-4.m2
-rw-r--r--test/Rewriter/rewrite-foreach-5.m2
-rw-r--r--test/Rewriter/rewrite-foreach-6.m2
-rw-r--r--test/Rewriter/rewrite-foreach-7.m2
-rw-r--r--test/Rewriter/rewrite-foreach-in-block.mm4
-rw-r--r--test/Rewriter/rewrite-foreach-protocol-id.m2
-rw-r--r--test/Rewriter/rewrite-forward-class.m2
-rw-r--r--test/Rewriter/rewrite-forward-class.mm2
-rw-r--r--test/Rewriter/rewrite-function-decl.mm2
-rw-r--r--test/Rewriter/rewrite-implementation.mm2
-rw-r--r--test/Rewriter/rewrite-ivar-use.m2
-rw-r--r--test/Rewriter/rewrite-local-externs-in-block.mm2
-rw-r--r--test/Rewriter/rewrite-local-static-id.mm2
-rw-r--r--test/Rewriter/rewrite-message-expr.mm2
-rw-r--r--test/Rewriter/rewrite-modern-atautoreleasepool.mm32
-rw-r--r--test/Rewriter/rewrite-modern-block-consts.mm22
-rw-r--r--test/Rewriter/rewrite-modern-block.mm44
-rw-r--r--test/Rewriter/rewrite-modern-captured-nested-bvar.mm35
-rw-r--r--test/Rewriter/rewrite-modern-default-property-synthesis.mm80
-rw-r--r--test/Rewriter/rewrite-modern-extern-c-func-decl.mm49
-rw-r--r--test/Rewriter/rewrite-modern-ivar-access.mm98
-rw-r--r--test/Rewriter/rewrite-modern-ivars-1.mm37
-rw-r--r--test/Rewriter/rewrite-modern-private-ivars.mm53
-rw-r--r--test/Rewriter/rewrite-modern-struct-ivar-1.mm48
-rw-r--r--test/Rewriter/rewrite-modern-struct-ivar.mm32
-rw-r--r--test/Rewriter/rewrite-modern-typeof.mm1
-rw-r--r--test/Rewriter/rewrite-nest.m2
-rw-r--r--test/Rewriter/rewrite-nested-blocks-1.mm3
-rw-r--r--test/Rewriter/rewrite-nested-blocks-2.mm3
-rw-r--r--test/Rewriter/rewrite-nested-blocks.mm3
-rw-r--r--test/Rewriter/rewrite-nested-ivar.mm2
-rwxr-xr-xtest/Rewriter/rewrite-nested-property-in-blocks.mm3
-rw-r--r--test/Rewriter/rewrite-no-nextline.mm2
-rw-r--r--test/Rewriter/rewrite-property-attributes.mm2
-rw-r--r--test/Rewriter/rewrite-property-set-cfstring.mm2
-rw-r--r--test/Rewriter/rewrite-protocol-property.mm2
-rw-r--r--test/Rewriter/rewrite-protocol-qualified.mm2
-rw-r--r--test/Rewriter/rewrite-protocol-type-1.m2
-rw-r--r--test/Rewriter/rewrite-qualified-id.mm2
-rw-r--r--test/Rewriter/rewrite-rewritten-initializer.mm7
-rw-r--r--test/Rewriter/rewrite-static-block.mm2
-rw-r--r--test/Rewriter/rewrite-super-message.mm2
-rw-r--r--test/Rewriter/rewrite-trivial-constructor.mm2
-rw-r--r--test/Rewriter/rewrite-try-catch.m2
-rw-r--r--test/Rewriter/rewrite-typeof.mm2
-rw-r--r--test/Rewriter/rewrite-unique-block-api.mm3
-rw-r--r--test/Rewriter/rewrite-user-defined-accessors.mm2
-rw-r--r--test/Rewriter/rewrite-vararg.m2
-rw-r--r--test/Rewriter/rewrite-weak-attr.m2
-rw-r--r--test/Rewriter/static-type-protocol-1.m2
-rw-r--r--test/Rewriter/undecl-objc-h.m2
-rw-r--r--test/Rewriter/undeclared-method-1.m2
-rw-r--r--test/Rewriter/undef-field-reference-1.m2
-rw-r--r--test/Rewriter/va-method.m2
-rw-r--r--test/Rewriter/weak_byref_objects.m2
-rw-r--r--test/Sema/128bitint.c9
-rw-r--r--test/Sema/Inputs/format-unused-system-args.h8
-rw-r--r--test/Sema/MicrosoftCompatibility.c7
-rw-r--r--test/Sema/MicrosoftExtensions.c8
-rw-r--r--test/Sema/alignas.c13
-rw-r--r--test/Sema/alloc_size.c26
-rw-r--r--test/Sema/annotate.c5
-rw-r--r--test/Sema/array-bounds-ptr-arith.c18
-rw-r--r--test/Sema/array-init.c2
-rw-r--r--test/Sema/attr-aligned.c2
-rw-r--r--test/Sema/attr-availability-ios.c8
-rw-r--r--test/Sema/attr-availability-macosx.c2
-rw-r--r--test/Sema/attr-availability.c21
-rw-r--r--test/Sema/attr-coldhot.c10
-rw-r--r--test/Sema/attr-decl-after-definition.c22
-rw-r--r--test/Sema/attr-deprecated-message.c8
-rw-r--r--test/Sema/attr-deprecated.c29
-rw-r--r--test/Sema/attr-nodebug.c7
-rw-r--r--test/Sema/attr-section.c4
-rw-r--r--test/Sema/attr-tls_model.c14
-rw-r--r--test/Sema/attr-unavailable-message.c4
-rw-r--r--test/Sema/attr-visibility.c15
-rw-r--r--test/Sema/c89-2.c2
-rw-r--r--test/Sema/compare.c7
-rw-r--r--test/Sema/conditional-expr.c2
-rw-r--r--test/Sema/const-eval.c3
-rw-r--r--test/Sema/dllimport-dllexport.c6
-rw-r--r--test/Sema/exprs.c15
-rw-r--r--test/Sema/format-strings-enum-fixed-type.cpp92
-rw-r--r--test/Sema/format-strings-enum.c36
-rw-r--r--test/Sema/format-strings-fixit.c34
-rw-r--r--test/Sema/format-strings-scanf.c55
-rw-r--r--test/Sema/format-strings-size_t.c13
-rw-r--r--test/Sema/format-strings.c117
-rw-r--r--test/Sema/fpack-struct.c4
-rw-r--r--test/Sema/implicit-builtin-decl.c2
-rw-r--r--test/Sema/inline.c72
-rw-r--r--test/Sema/invalid-decl.c9
-rw-r--r--test/Sema/knr-def-call.c4
-rw-r--r--test/Sema/ms_class_layout.cpp173
-rw-r--r--test/Sema/ms_wide_predefined_expr.cpp25
-rw-r--r--test/Sema/pragma-pack-6.c16
-rw-r--r--test/Sema/switch.c31
-rw-r--r--test/Sema/thread-specifier.c12
-rw-r--r--test/Sema/tls.c20
-rw-r--r--test/Sema/typeof-use-deprecated.c12
-rw-r--r--test/Sema/uninit-variables.c104
-rw-r--r--test/Sema/unused-expr.c3
-rw-r--r--test/Sema/vector-ops.c2
-rw-r--r--test/Sema/warn-documentation-almost-trailing.c14
-rw-r--r--test/Sema/warn-documentation-fixits.cpp27
-rw-r--r--test/Sema/warn-documentation.cpp670
-rw-r--r--test/Sema/warn-documentation.m93
-rw-r--r--test/Sema/warn-outof-range-assign-enum.c32
-rw-r--r--test/Sema/warn-self-assign-field.mm66
-rw-r--r--test/Sema/warn-strncat-size.c7
-rw-r--r--test/SemaCXX/MicrosoftCompatibility.cpp4
-rw-r--r--test/SemaCXX/MicrosoftCompatibilityNoExceptions.cpp8
-rw-r--r--test/SemaCXX/PR10243.cpp4
-rw-r--r--test/SemaCXX/abstract.cpp14
-rw-r--r--test/SemaCXX/address-of-temporary.cpp40
-rw-r--r--test/SemaCXX/alias-template.cpp27
-rw-r--r--test/SemaCXX/altivec.cpp7
-rw-r--r--test/SemaCXX/anonymous-union-cxx11.cpp13
-rw-r--r--test/SemaCXX/array-bound-merge.cpp2
-rw-r--r--test/SemaCXX/arrow-operator.cpp28
-rw-r--r--test/SemaCXX/attr-deprecated.cpp42
-rw-r--r--test/SemaCXX/attr-visibility.cpp20
-rw-r--r--test/SemaCXX/bool.cpp2
-rw-r--r--test/SemaCXX/condition.cpp2
-rw-r--r--test/SemaCXX/conditional-expr.cpp26
-rw-r--r--test/SemaCXX/constant-expression-cxx11.cpp130
-rw-r--r--test/SemaCXX/constant-expression.cpp9
-rw-r--r--test/SemaCXX/constexpr-many-arguments.cpp42
-rw-r--r--test/SemaCXX/constructor-initializer.cpp13
-rw-r--r--test/SemaCXX/conversion-function.cpp11
-rw-r--r--test/SemaCXX/conversion.cpp60
-rw-r--r--test/SemaCXX/crashes.cpp32
-rw-r--r--test/SemaCXX/cxx0x-cursory-default-delete.cpp21
-rw-r--r--test/SemaCXX/cxx0x-defaulted-functions.cpp110
-rw-r--r--test/SemaCXX/cxx0x-initializer-aggregates.cpp29
-rw-r--r--test/SemaCXX/cxx0x-initializer-constructor.cpp23
-rw-r--r--test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp12
-rw-r--r--test/SemaCXX/cxx98-compat-pedantic.cpp2
-rw-r--r--test/SemaCXX/cxx98-compat.cpp61
-rw-r--r--test/SemaCXX/dcl_ambig_res.cpp6
-rw-r--r--test/SemaCXX/dcl_init_aggr.cpp2
-rw-r--r--test/SemaCXX/decl-expr-ambiguity.cpp33
-rw-r--r--test/SemaCXX/default1.cpp9
-rw-r--r--test/SemaCXX/deleted-function.cpp10
-rw-r--r--test/SemaCXX/deleted-operator.cpp4
-rw-r--r--test/SemaCXX/elaborated-type-specifier.cpp7
-rw-r--r--test/SemaCXX/enum-scoped.cpp7
-rw-r--r--test/SemaCXX/expressions.cpp2
-rw-r--r--test/SemaCXX/format-strings-0x.cpp12
-rw-r--r--test/SemaCXX/function-extern-c.cpp2
-rw-r--r--test/SemaCXX/function-redecl.cpp28
-rw-r--r--test/SemaCXX/implicit-exception-spec.cpp17
-rw-r--r--test/SemaCXX/invalid-member-expr.cpp31
-rw-r--r--test/SemaCXX/lambda-expressions.cpp141
-rw-r--r--test/SemaCXX/literal-operators.cpp1
-rw-r--r--test/SemaCXX/long-virtual-inheritance-chain.cpp53
-rw-r--r--test/SemaCXX/member-expr.cpp10
-rw-r--r--test/SemaCXX/member-init.cpp4
-rw-r--r--test/SemaCXX/member-operator-expr.cpp5
-rw-r--r--test/SemaCXX/microsoft-cxx0x.cpp14
-rw-r--r--test/SemaCXX/neon-vector-types.cpp19
-rw-r--r--test/SemaCXX/nested-name-spec.cpp14
-rw-r--r--test/SemaCXX/no-rtti.cpp10
-rw-r--r--test/SemaCXX/nullptr.cpp4
-rw-r--r--test/SemaCXX/offsetof-0x.cpp20
-rw-r--r--test/SemaCXX/overload-call.cpp34
-rw-r--r--test/SemaCXX/overload-member-call.cpp13
-rw-r--r--test/SemaCXX/overloaded-builtin-operators.cpp33
-rw-r--r--test/SemaCXX/pr13353.cpp13
-rw-r--r--test/SemaCXX/pr13394-crash-on-invalid.cpp16
-rw-r--r--test/SemaCXX/printf-block.cpp18
-rw-r--r--test/SemaCXX/printf-cstr.cpp53
-rw-r--r--test/SemaCXX/qualified-id-lookup.cpp5
-rw-r--r--test/SemaCXX/reinterpret-cast.cpp2
-rw-r--r--test/SemaCXX/static-assert.cpp14
-rw-r--r--test/SemaCXX/switch-implicit-fallthrough-cxx98.cpp119
-rw-r--r--test/SemaCXX/switch-implicit-fallthrough-per-method.cpp51
-rw-r--r--test/SemaCXX/switch-implicit-fallthrough.cpp197
-rw-r--r--test/SemaCXX/type-traits.cpp35
-rw-r--r--test/SemaCXX/typo-correction.cpp44
-rw-r--r--test/SemaCXX/uninit-variables.cpp6
-rw-r--r--test/SemaCXX/uninitialized.cpp165
-rw-r--r--test/SemaCXX/unknown-type-name.cpp56
-rw-r--r--test/SemaCXX/unused.cpp48
-rw-r--r--test/SemaCXX/user-defined-conversions.cpp2
-rw-r--r--test/SemaCXX/virtuals.cpp2
-rw-r--r--test/SemaCXX/warn-deprecated-header.cpp3
-rw-r--r--test/SemaCXX/warn-literal-conversion.cpp28
-rw-r--r--test/SemaCXX/warn-loop-analysis.cpp154
-rw-r--r--test/SemaCXX/warn-memset-bad-sizeof.cpp24
-rw-r--r--test/SemaCXX/warn-static-function-inheader.cpp12
-rw-r--r--test/SemaCXX/warn-static-function-inheader.h3
-rw-r--r--test/SemaCXX/warn-thread-safety-analysis.cpp1008
-rw-r--r--test/SemaCXX/warn-thread-safety-parsing.cpp857
-rw-r--r--test/SemaCXX/warn-unique-enum.cpp27
-rw-r--r--test/SemaCXX/warn-unused-private-field.cpp246
-rw-r--r--test/SemaCXX/warn-unused-value.cpp2
-rw-r--r--test/SemaObjC/arc-bridged-cast.m26
-rw-r--r--test/SemaObjC/arc-cf.m10
-rw-r--r--test/SemaObjC/arc-dict-bridged-cast.m46
-rw-r--r--test/SemaObjC/arc-no-runtime.m2
-rw-r--r--test/SemaObjC/arc-property-lifetime.m5
-rw-r--r--test/SemaObjC/arc-property.m10
-rw-r--r--test/SemaObjC/arc-unbridged-cast.m8
-rw-r--r--test/SemaObjC/arc.m23
-rw-r--r--test/SemaObjC/assign-rvalue-message.m2
-rw-r--r--test/SemaObjC/at-defs.m2
-rw-r--r--test/SemaObjC/attr-availability.m16
-rw-r--r--test/SemaObjC/attr-deprecated.m27
-rw-r--r--test/SemaObjC/blocks.m121
-rw-r--r--test/SemaObjC/boxing-illegal-types.m58
-rw-r--r--test/SemaObjC/category-1.m9
-rw-r--r--test/SemaObjC/class-bitfield.m2
-rw-r--r--test/SemaObjC/cocoa-api-usage.m8
-rw-r--r--test/SemaObjC/cocoa-api-usage.m.fixed8
-rw-r--r--test/SemaObjC/conflicting-ivar-test-1.m2
-rw-r--r--test/SemaObjC/continuation-class-err.m10
-rw-r--r--test/SemaObjC/continuation-class-property.m4
-rw-r--r--test/SemaObjC/dealloc.m25
-rw-r--r--test/SemaObjC/default-synthesize-1.m30
-rw-r--r--test/SemaObjC/default-synthesize-2.m19
-rw-r--r--test/SemaObjC/delay-parsing-cfunctions.m43
-rw-r--r--test/SemaObjC/direct-synthesized-ivar-access.m2
-rw-r--r--test/SemaObjC/duplicate-property-class-extension.m2
-rw-r--r--test/SemaObjC/error-implicit-property.m2
-rw-r--r--test/SemaObjC/format-strings-objc.m57
-rw-r--r--test/SemaObjC/format-strings-system.h10
-rw-r--r--test/SemaObjC/getter-setter-defined-in-category-of-parent.m26
-rw-r--r--test/SemaObjC/iboutlet.m23
-rw-r--r--test/SemaObjC/id.m12
-rw-r--r--test/SemaObjC/interface-1.m2
-rw-r--r--test/SemaObjC/interface-layout.m2
-rw-r--r--test/SemaObjC/ivar-in-class-extension-error.m2
-rw-r--r--test/SemaObjC/method-bad-param.m2
-rw-r--r--test/SemaObjC/method-prototype-scope.m4
-rw-r--r--test/SemaObjC/mismatched-undefined-method.m13
-rw-r--r--test/SemaObjC/narrow-property-type-in-cont-class.m2
-rw-r--r--test/SemaObjC/no-ivar-in-interface-block.m32
-rw-r--r--test/SemaObjC/nowarn-superclass-method-mismatch.m20
-rw-r--r--test/SemaObjC/nsobject-attribute.m12
-rw-r--r--test/SemaObjC/objc-container-subscripting-2.m4
-rw-r--r--test/SemaObjC/objc-container-subscripting-3.m2
-rw-r--r--test/SemaObjC/objc-container-subscripting.m8
-rw-r--r--test/SemaObjC/objc-cstyle-args-in-methods.m2
-rw-r--r--test/SemaObjC/objc-dictionary-literal.m2
-rw-r--r--test/SemaObjC/objc-literal-comparison.m96
-rw-r--r--test/SemaObjC/objc-literal-nsnumber.m4
-rw-r--r--test/SemaObjC/objc-literal-sig.m17
-rw-r--r--test/SemaObjC/property-10.m2
-rw-r--r--test/SemaObjC/property-12.m37
-rw-r--r--test/SemaObjC/property-impl-misuse.m17
-rw-r--r--test/SemaObjC/property-ivar-mismatch.m12
-rw-r--r--test/SemaObjC/property-typecheck-1.m8
-rw-r--r--test/SemaObjC/property-user-setter.m52
-rw-r--r--test/SemaObjC/property.m4
-rw-r--r--test/SemaObjC/protocol-attribute.m2
-rw-r--r--test/SemaObjC/protocols.m2
-rw-r--r--test/SemaObjC/provisional-ivar-lookup.m2
-rw-r--r--test/SemaObjC/related-result-type-inference.m8
-rw-r--r--test/SemaObjC/sizeof-interface.m18
-rw-r--r--test/SemaObjC/special-dep-unavail-warning.m2
-rw-r--r--test/SemaObjC/tentative-property-decl.m47
-rw-r--r--test/SemaObjC/unused.m2
-rw-r--r--test/SemaObjC/warn-deprecated-implementations.m2
-rw-r--r--test/SemaObjC/warn-direct-ivar-access.m56
-rw-r--r--test/SemaObjC/warn-isa-ref.m (renamed from test/SemaObjC/id-isa-ref.m)48
-rw-r--r--test/SemaObjC/warn-protocol-method-deprecated.m32
-rw-r--r--test/SemaObjC/warn-retain-block-property.m (renamed from test/SemaObjC/arc-retain-block-property.m)2
-rw-r--r--test/SemaObjC/weak-receiver-warn.m65
-rw-r--r--test/SemaObjCXX/arc-0x.mm32
-rw-r--r--test/SemaObjCXX/arc-templates.mm17
-rw-r--r--test/SemaObjCXX/arc-type-traits.mm126
-rw-r--r--test/SemaObjCXX/arc-unbridged-cast.mm8
-rw-r--r--test/SemaObjCXX/boxing-illegal-types.mm58
-rw-r--r--test/SemaObjCXX/crash.mm23
-rw-r--r--test/SemaObjCXX/delay-parsing-cfunctions.mm48
-rw-r--r--test/SemaObjCXX/delay-parsing-cplusfuncs.mm52
-rw-r--r--test/SemaObjCXX/delay-parsing-func-tryblock.mm66
-rw-r--r--test/SemaObjCXX/exceptions-fragile.mm2
-rw-r--r--test/SemaObjCXX/foreach.mm61
-rw-r--r--test/SemaObjCXX/fragile-abi-object-assign.m2
-rw-r--r--test/SemaObjCXX/instantiate-stmt.mm8
-rw-r--r--test/SemaObjCXX/message.mm2
-rw-r--r--test/SemaObjCXX/objc-container-subscripting.mm4
-rw-r--r--test/SemaObjCXX/property-synthesis-error.mm13
-rw-r--r--test/SemaObjCXX/protocol-lookup.mm2
-rw-r--r--test/SemaObjCXX/warn-missing-super.mm19
-rw-r--r--test/SemaOpenCL/storageclass.cl12
-rw-r--r--test/SemaOpenCL/warn-missing-prototypes.cl6
-rw-r--r--test/SemaTemplate/alias-templates.cpp76
-rw-r--r--test/SemaTemplate/class-template-decl.cpp42
-rw-r--r--test/SemaTemplate/delegating-constructors.cpp18
-rw-r--r--test/SemaTemplate/dependent-base-classes.cpp3
-rw-r--r--test/SemaTemplate/explicit-instantiation.cpp4
-rw-r--r--test/SemaTemplate/friend-template.cpp59
-rw-r--r--test/SemaTemplate/instantiate-exception-spec-cxx11.cpp14
-rw-r--r--test/SemaTemplate/instantiate-expr-1.cpp2
-rw-r--r--test/SemaTemplate/instantiate-init.cpp15
-rw-r--r--test/SemaTemplate/instantiate-member-class.cpp7
-rw-r--r--test/SemaTemplate/instantiate-method.cpp7
-rw-r--r--test/SemaTemplate/instantiate-objc-1.mm21
-rw-r--r--test/SemaTemplate/instantiation-backtrace.cpp19
-rw-r--r--test/SemaTemplate/instantiation-depth-defarg.cpp36
-rw-r--r--test/SemaTemplate/instantiation-depth-subst-2.cpp9
-rw-r--r--test/SemaTemplate/instantiation-depth-subst.cpp9
-rw-r--r--test/SemaTemplate/instantiation-depth.cpp20
-rw-r--r--test/SemaTemplate/member-template-access-expr.cpp2
-rw-r--r--test/SemaTemplate/ms-function-specialization-class-scope.cpp21
-rw-r--r--test/SemaTemplate/ms-lookup-template-base-classes.cpp29
-rw-r--r--test/SemaTemplate/overload-candidates.cpp26
-rw-r--r--test/SemaTemplate/recovery-crash.cpp3
-rw-r--r--test/SemaTemplate/typename-specifier.cpp41
-rw-r--r--test/Tooling/Inputs/lit.local.cfg1
-rw-r--r--test/Tooling/Inputs/pch-fail.h0
-rw-r--r--test/Tooling/Inputs/pch.cpp0
-rw-r--r--test/Tooling/Inputs/pch.h0
-rw-r--r--test/Tooling/auto-detect-from-source-parent-of-cwd.cpp10
-rw-r--r--test/Tooling/auto-detect-from-source-parent.cpp10
-rw-r--r--test/Tooling/auto-detect-from-source.cpp10
-rw-r--r--test/Tooling/clang-check-args.cpp7
-rw-r--r--test/Tooling/clang-check-ast-dump.cpp35
-rw-r--r--test/Tooling/clang-check-autodetect-dir.cpp11
-rw-r--r--test/Tooling/clang-check-builtin-headers.cpp15
-rw-r--r--test/Tooling/clang-check-chdir.cpp17
-rw-r--r--test/Tooling/clang-check-pwd.cpp8
-rw-r--r--test/Tooling/clang-check.cpp9
-rw-r--r--test/Tooling/multi-jobs.cpp7
-rw-r--r--test/Tooling/pch.cpp17
-rw-r--r--test/lit.cfg8
-rw-r--r--tools/CMakeLists.txt9
-rw-r--r--tools/Makefile6
-rw-r--r--tools/arcmt-test/CMakeLists.txt16
-rw-r--r--tools/arcmt-test/Makefile6
-rw-r--r--tools/c-arcmt-test/CMakeLists.txt6
-rw-r--r--tools/c-arcmt-test/Makefile7
-rw-r--r--tools/c-index-test/CMakeLists.txt13
-rw-r--r--tools/c-index-test/Makefile17
-rw-r--r--tools/c-index-test/c-index-test.c606
-rw-r--r--tools/clang-check/CMakeLists.txt15
-rw-r--r--tools/clang-check/ClangCheck.cpp104
-rw-r--r--tools/clang-check/Makefile4
-rwxr-xr-xtools/diag-build/diag-build.sh115
-rw-r--r--tools/diagtool/CMakeLists.txt28
-rw-r--r--tools/diagtool/DiagnosticNames.cpp78
-rw-r--r--tools/diagtool/DiagnosticNames.h128
-rw-r--r--tools/diagtool/ListWarnings.cpp37
-rw-r--r--tools/diagtool/Makefile10
-rw-r--r--tools/diagtool/ShowEnabledWarnings.cpp148
-rw-r--r--tools/diagtool/TreeView.cpp135
-rw-r--r--tools/diagtool/diagtool_main.cpp2
-rw-r--r--tools/driver/CMakeLists.txt40
-rw-r--r--tools/driver/cc1_main.cpp4
-rw-r--r--tools/driver/cc1as_main.cpp4
-rw-r--r--tools/driver/driver.cpp16
-rw-r--r--tools/libclang/CIndex.cpp221
-rw-r--r--tools/libclang/CIndexCodeCompletion.cpp25
-rw-r--r--tools/libclang/CIndexDiagnostic.cpp30
-rw-r--r--tools/libclang/CIndexUSRs.cpp2
-rw-r--r--tools/libclang/CMakeLists.txt76
-rw-r--r--tools/libclang/CXComment.cpp1230
-rw-r--r--tools/libclang/CXComment.h47
-rw-r--r--tools/libclang/CXCompilationDatabase.cpp129
-rw-r--r--tools/libclang/CXCursor.cpp244
-rw-r--r--tools/libclang/CXCursor.h11
-rw-r--r--tools/libclang/CXStoredDiagnostic.cpp7
-rw-r--r--tools/libclang/CXTranslationUnit.h1
-rw-r--r--tools/libclang/CXType.cpp18
-rw-r--r--tools/libclang/IndexBody.cpp16
-rw-r--r--tools/libclang/IndexDecl.cpp15
-rw-r--r--tools/libclang/IndexTypeSourceInfo.cpp4
-rw-r--r--tools/libclang/Indexing.cpp10
-rw-r--r--tools/libclang/IndexingContext.h6
-rw-r--r--tools/libclang/Makefile7
-rw-r--r--tools/libclang/RecursiveASTVisitor.h2185
-rw-r--r--tools/libclang/libclang.exports50
-rwxr-xr-xtools/scan-build/ccc-analyzer21
-rwxr-xr-xtools/scan-build/scan-build213
-rw-r--r--tools/scan-build/scan-build.1348
-rwxr-xr-xtools/scan-build/set-xcode-analyzer6
-rw-r--r--unittests/AST/CMakeLists.txt8
-rw-r--r--unittests/AST/CommentLexer.cpp1636
-rw-r--r--unittests/AST/CommentParser.cpp1383
-rw-r--r--unittests/AST/Makefile15
-rw-r--r--unittests/ASTMatchers/ASTMatchersTest.cpp2312
-rw-r--r--unittests/ASTMatchers/ASTMatchersTest.h128
-rw-r--r--unittests/ASTMatchers/CMakeLists.txt12
-rw-r--r--unittests/ASTMatchers/Makefile19
-rw-r--r--unittests/Basic/CMakeLists.txt9
-rw-r--r--unittests/Basic/SourceManagerTest.cpp48
-rw-r--r--unittests/CMakeLists.txt80
-rw-r--r--unittests/Frontend/CMakeLists.txt13
-rw-r--r--unittests/Frontend/FrontendActionTest.cpp1
-rw-r--r--unittests/Frontend/Makefile3
-rw-r--r--unittests/Lex/CMakeLists.txt8
-rw-r--r--unittests/Makefile2
-rw-r--r--unittests/Tooling/CMakeLists.txt22
-rw-r--r--unittests/Tooling/CommentHandlerTest.cpp221
-rw-r--r--unittests/Tooling/CompilationDatabaseTest.cpp58
-rw-r--r--unittests/Tooling/Makefile7
-rw-r--r--unittests/Tooling/RecursiveASTVisitorTest.cpp388
-rw-r--r--unittests/Tooling/RefactoringCallbacksTest.cpp100
-rw-r--r--unittests/Tooling/RefactoringTest.cpp305
-rw-r--r--unittests/Tooling/RewriterTest.cpp37
-rw-r--r--unittests/Tooling/RewriterTestContext.h125
-rw-r--r--unittests/Tooling/TestVisitor.h144
-rw-r--r--unittests/Tooling/ToolingTest.cpp25
-rw-r--r--utils/TableGen/ClangASTNodesEmitter.cpp61
-rw-r--r--utils/TableGen/ClangASTNodesEmitter.h84
-rw-r--r--utils/TableGen/ClangAttrEmitter.cpp175
-rw-r--r--utils/TableGen/ClangAttrEmitter.h153
-rw-r--r--utils/TableGen/ClangDiagnosticsEmitter.cpp294
-rw-r--r--utils/TableGen/ClangDiagnosticsEmitter.h54
-rw-r--r--utils/TableGen/ClangSACheckersEmitter.cpp8
-rw-r--r--utils/TableGen/ClangSACheckersEmitter.h31
-rw-r--r--utils/TableGen/NeonEmitter.cpp233
-rw-r--r--utils/TableGen/NeonEmitter.h210
-rw-r--r--utils/TableGen/OptParserEmitter.cpp13
-rw-r--r--utils/TableGen/OptParserEmitter.h34
-rw-r--r--utils/TableGen/TableGen.cpp58
-rw-r--r--utils/TableGen/TableGenBackends.h56
-rwxr-xr-xutils/analyzer/CmpRuns.py135
-rw-r--r--utils/analyzer/SATestAdd.py2
-rw-r--r--utils/analyzer/SATestBuild.py33
-rw-r--r--utils/analyzer/SumTimerInfo.py75
-rwxr-xr-xutils/analyzer/reducer.pl65
-rw-r--r--utils/clang-completion-mode.el40
-rw-r--r--utils/clangVisualizers.txt313
-rw-r--r--www/analyzer/annotations.html3
-rw-r--r--www/analyzer/available_checks.html48
-rw-r--r--www/analyzer/content.css1
-rw-r--r--www/analyzer/faq.html120
-rw-r--r--www/analyzer/images/example_custom_assert.pngbin0 -> 23686 bytes
-rw-r--r--www/analyzer/images/example_null_pointer.pngbin0 -> 23580 bytes
-rw-r--r--www/analyzer/images/example_use_assert.pngbin0 -> 25513 bytes
-rw-r--r--www/analyzer/installation.html2
-rw-r--r--www/analyzer/latest_checker.html.incl2
-rw-r--r--www/analyzer/menu.html.incl5
-rw-r--r--www/analyzer/release_notes.html38
-rwxr-xr-xwww/builtins.py5
-rw-r--r--www/comparison.html2
-rw-r--r--www/content.css3
-rw-r--r--www/cxx_status.html28
-rw-r--r--www/diagnostics.html33
-rw-r--r--www/features.html16
-rw-r--r--www/get_started.html33
-rw-r--r--www/menu.html.incl1
1875 files changed, 112126 insertions, 30616 deletions
diff --git a/.gitignore b/.gitignore
index ddd66380adf8..b906ab919cbe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,9 @@
#==============================================================================#
cscope.files
cscope.out
+
+#==============================================================================#
+# Directories to ignore (do not add trailing '/'s, they skip symlinks).
+#==============================================================================#
+# Clang extra user tools, which is tracked independently (clang-tools-extra).
+tools/extra
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c828482ac702..2f4fa1cb5d7a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,14 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
set(LLVM_TABLEGEN_EXE "${PATH_TO_LLVM_BUILD}/bin/Debug/llvm-tblgen${CMAKE_EXECUTABLE_SUFFIX}")
endif()
+ # Define the default arguments to use with 'lit', and an option for the user
+ # to override.
+ set(LIT_ARGS_DEFAULT "-sv")
+ if (MSVC OR XCODE)
+ set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
+ endif()
+ set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
+
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
@@ -131,6 +139,10 @@ if (APPLE)
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
endif ()
+# libxml2 is an optional dependency, required only to run validation
+# tests on XML output.
+find_package(LibXml2)
+
configure_file(
${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake
${CLANG_BINARY_DIR}/include/clang/Config/config.h)
@@ -192,20 +204,10 @@ macro(add_clang_library name)
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
- target_link_libraries( ${name} ${LLVM_USED_LIBS} )
llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
target_link_libraries( ${name} ${LLVM_COMMON_LIBS} )
link_system_libs( ${name} )
- add_dependencies(${name} ClangDiagnosticCommon)
- if(MSVC)
- get_target_property(cflag ${name} COMPILE_FLAGS)
- if(NOT cflag)
- set(cflag "")
- endif(NOT cflag)
- set(cflag "${cflag} /Za")
- set_target_properties(${name} PROPERTIES COMPILE_FLAGS ${cflag})
- endif(MSVC)
install(TARGETS ${name}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
@@ -252,14 +254,14 @@ mark_as_advanced(CLANG_EXECUTABLE_VERSION LIBCLANG_LIBRARY_VERSION)
add_subdirectory(utils/TableGen)
-option(CLANG_BUILD_EXAMPLES "Build CLANG example programs by default." OFF)
-add_subdirectory(examples)
-
add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(tools)
add_subdirectory(runtime)
+option(CLANG_BUILD_EXAMPLES "Build CLANG example programs by default." OFF)
+add_subdirectory(examples)
+
# TODO: docs.
add_subdirectory(test)
@@ -280,3 +282,4 @@ endif()
set(BUG_REPORT_URL "http://llvm.org/bugs/" CACHE STRING
"Default URL where bug reports are to be submitted.")
+
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py
index 6f0d25f1a8f5..fc0a2a18bb40 100644
--- a/bindings/python/clang/cindex.py
+++ b/bindings/python/clang/cindex.py
@@ -65,6 +65,8 @@ call is efficient.
from ctypes import *
import collections
+import clang.enumerations
+
def get_cindex_library():
# FIXME: It's probably not the case that the library is actually found in
# this location. We need a better system of identifying and loading the
@@ -85,6 +87,49 @@ def get_cindex_library():
c_object_p = POINTER(c_void_p)
lib = get_cindex_library()
+callbacks = {}
+
+### Exception Classes ###
+
+class TranslationUnitLoadError(Exception):
+ """Represents an error that occurred when loading a TranslationUnit.
+
+ This is raised in the case where a TranslationUnit could not be
+ instantiated due to failure in the libclang library.
+
+ FIXME: Make libclang expose additional error information in this scenario.
+ """
+ pass
+
+class TranslationUnitSaveError(Exception):
+ """Represents an error that occurred when saving a TranslationUnit.
+
+ Each error has associated with it an enumerated value, accessible under
+ e.save_error. Consumers can compare the value with one of the ERROR_
+ constants in this class.
+ """
+
+ # Indicates that an unknown error occurred. This typically indicates that
+ # I/O failed during save.
+ ERROR_UNKNOWN = 1
+
+ # Indicates that errors during translation prevented saving. The errors
+ # should be available via the TranslationUnit's diagnostics.
+ ERROR_TRANSLATION_ERRORS = 2
+
+ # Indicates that the translation unit was somehow invalid.
+ ERROR_INVALID_TU = 3
+
+ def __init__(self, enumeration, message):
+ assert isinstance(enumeration, int)
+
+ if enumeration < 1 or enumeration > 3:
+ raise Exception("Encountered undefined TranslationUnit save error "
+ "constant: %d. Please file a bug to have this "
+ "value supported." % enumeration)
+
+ self.save_error = enumeration
+ Exception.__init__(self, 'Error %d: %s' % (enumeration, message))
### Structures and Utility Classes ###
@@ -94,12 +139,12 @@ class _CXString(Structure):
_fields_ = [("spelling", c_char_p), ("free", c_int)]
def __del__(self):
- _CXString_dispose(self)
+ lib.clang_disposeString(self)
@staticmethod
def from_result(res, fn, args):
assert isinstance(res, _CXString)
- return _CXString_getCString(res)
+ return lib.clang_getCString(res)
class SourceLocation(Structure):
"""
@@ -111,7 +156,8 @@ class SourceLocation(Structure):
def _get_instantiation(self):
if self._data is None:
f, l, c, o = c_object_p(), c_uint(), c_uint(), c_uint()
- SourceLocation_loc(self, byref(f), byref(l), byref(c), byref(o))
+ lib.clang_getInstantiationLocation(self, byref(f), byref(l),
+ byref(c), byref(o))
if f:
f = File(f)
else:
@@ -125,7 +171,17 @@ class SourceLocation(Structure):
Retrieve the source location associated with a given file/line/column in
a particular translation unit.
"""
- return SourceLocation_getLocation(tu, file, line, column)
+ return lib.clang_getLocation(tu, file, line, column)
+
+ @staticmethod
+ def from_offset(tu, file, offset):
+ """Retrieve a SourceLocation from a given character offset.
+
+ tu -- TranslationUnit file belongs to
+ file -- File instance to obtain offset from
+ offset -- Integer character offset within file
+ """
+ return lib.clang_getLocationForOffset(tu, file, offset)
@property
def file(self):
@@ -148,7 +204,7 @@ class SourceLocation(Structure):
return self._get_instantiation()[3]
def __eq__(self, other):
- return SourceLocation_equalLocations(self, other)
+ return lib.clang_equalLocations(self, other)
def __ne__(self, other):
return not self.__eq__(other)
@@ -175,7 +231,7 @@ class SourceRange(Structure):
# object.
@staticmethod
def from_locations(start, end):
- return SourceRange_getRange(start, end)
+ return lib.clang_getRange(start, end)
@property
def start(self):
@@ -183,7 +239,7 @@ class SourceRange(Structure):
Return a SourceLocation representing the first character within a
source range.
"""
- return SourceRange_start(self)
+ return lib.clang_getRangeStart(self)
@property
def end(self):
@@ -191,10 +247,10 @@ class SourceRange(Structure):
Return a SourceLocation representing the last character within a
source range.
"""
- return SourceRange_end(self)
+ return lib.clang_getRangeEnd(self)
def __eq__(self, other):
- return SourceRange_equalRanges(self, other)
+ return lib.clang_equalRanges(self, other)
def __ne__(self, other):
return not self.__eq__(other)
@@ -219,19 +275,19 @@ class Diagnostic(object):
self.ptr = ptr
def __del__(self):
- _clang_disposeDiagnostic(self)
+ lib.clang_disposeDiagnostic(self)
@property
def severity(self):
- return _clang_getDiagnosticSeverity(self)
+ return lib.clang_getDiagnosticSeverity(self)
@property
def location(self):
- return _clang_getDiagnosticLocation(self)
+ return lib.clang_getDiagnosticLocation(self)
@property
def spelling(self):
- return _clang_getDiagnosticSpelling(self)
+ return lib.clang_getDiagnosticSpelling(self)
@property
def ranges(self):
@@ -240,12 +296,12 @@ class Diagnostic(object):
self.diag = diag
def __len__(self):
- return int(_clang_getDiagnosticNumRanges(self.diag))
+ return int(lib.clang_getDiagnosticNumRanges(self.diag))
def __getitem__(self, key):
if (key >= len(self)):
raise IndexError
- return _clang_getDiagnosticRange(self.diag, key)
+ return lib.clang_getDiagnosticRange(self.diag, key)
return RangeIterator(self)
@@ -256,11 +312,12 @@ class Diagnostic(object):
self.diag = diag
def __len__(self):
- return int(_clang_getDiagnosticNumFixIts(self.diag))
+ return int(lib.clang_getDiagnosticNumFixIts(self.diag))
def __getitem__(self, key):
range = SourceRange()
- value = _clang_getDiagnosticFixIt(self.diag, key, byref(range))
+ value = lib.clang_getDiagnosticFixIt(self.diag, key,
+ byref(range))
if len(value) == 0:
raise IndexError
@@ -271,25 +328,25 @@ class Diagnostic(object):
@property
def category_number(self):
"""The category number for this diagnostic."""
- return _clang_getDiagnosticCategory(self)
+ return lib.clang_getDiagnosticCategory(self)
@property
def category_name(self):
"""The string name of the category for this diagnostic."""
- return _clang_getDiagnosticCategoryName(self.category_number)
+ return lib.clang_getDiagnosticCategoryName(self.category_number)
@property
def option(self):
"""The command-line option that enables this diagnostic."""
- return _clang_getDiagnosticOption(self, None)
+ return lib.clang_getDiagnosticOption(self, None)
@property
def disable_option(self):
"""The command-line option that disables this diagnostic."""
disable = _CXString()
- _clang_getDiagnosticOption(self, byref(disable))
+ lib.clang_getDiagnosticOption(self, byref(disable))
- return _CXString_getCString(disable)
+ return lib.clang_getCString(disable)
def __repr__(self):
return "<Diagnostic severity %r, location %r, spelling %r>" % (
@@ -312,6 +369,98 @@ class FixIt(object):
def __repr__(self):
return "<FixIt range %r, value %r>" % (self.range, self.value)
+class TokenGroup(object):
+ """Helper class to facilitate token management.
+
+ Tokens are allocated from libclang in chunks. They must be disposed of as a
+ collective group.
+
+ One purpose of this class is for instances to represent groups of allocated
+ tokens. Each token in a group contains a reference back to an instance of
+ this class. When all tokens from a group are garbage collected, it allows
+ this class to be garbage collected. When this class is garbage collected,
+ it calls the libclang destructor which invalidates all tokens in the group.
+
+ You should not instantiate this class outside of this module.
+ """
+ def __init__(self, tu, memory, count):
+ self._tu = tu
+ self._memory = memory
+ self._count = count
+
+ def __del__(self):
+ lib.clang_disposeTokens(self._tu, self._memory, self._count)
+
+ @staticmethod
+ def get_tokens(tu, extent):
+ """Helper method to return all tokens in an extent.
+
+ This functionality is needed multiple places in this module. We define
+ it here because it seems like a logical place.
+ """
+ tokens_memory = POINTER(Token)()
+ tokens_count = c_uint()
+
+ lib.clang_tokenize(tu, extent, byref(tokens_memory),
+ byref(tokens_count))
+
+ count = int(tokens_count.value)
+
+ # If we get no tokens, no memory was allocated. Be sure not to return
+ # anything and potentially call a destructor on nothing.
+ if count < 1:
+ return
+
+ tokens_array = cast(tokens_memory, POINTER(Token * count)).contents
+
+ token_group = TokenGroup(tu, tokens_memory, tokens_count)
+
+ for i in xrange(0, count):
+ token = Token()
+ token.int_data = tokens_array[i].int_data
+ token.ptr_data = tokens_array[i].ptr_data
+ token._tu = tu
+ token._group = token_group
+
+ yield token
+
+class TokenKind(object):
+ """Describes a specific type of a Token."""
+
+ _value_map = {} # int -> TokenKind
+
+ def __init__(self, value, name):
+ """Create a new TokenKind instance from a numeric value and a name."""
+ self.value = value
+ self.name = name
+
+ def __repr__(self):
+ return 'TokenKind.%s' % (self.name,)
+
+ @staticmethod
+ def from_value(value):
+ """Obtain a registered TokenKind instance from its value."""
+ result = TokenKind._value_map.get(value, None)
+
+ if result is None:
+ raise ValueError('Unknown TokenKind: %d' % value)
+
+ return result
+
+ @staticmethod
+ def register(value, name):
+ """Register a new TokenKind enumeration.
+
+ This should only be called at module load time by code within this
+ package.
+ """
+ if value in TokenKind._value_map:
+ raise ValueError('TokenKind already registered: %d' % value)
+
+ kind = TokenKind(value, name)
+ TokenKind._value_map[value] = kind
+ setattr(TokenKind, name, kind)
+
### Cursor Kinds ###
class CursorKind(object):
@@ -358,39 +507,39 @@ class CursorKind(object):
def is_declaration(self):
"""Test if this is a declaration kind."""
- return CursorKind_is_decl(self)
+ return lib.clang_isDeclaration(self)
def is_reference(self):
"""Test if this is a reference kind."""
- return CursorKind_is_ref(self)
+ return lib.clang_isReference(self)
def is_expression(self):
"""Test if this is an expression kind."""
- return CursorKind_is_expr(self)
+ return lib.clang_isExpression(self)
def is_statement(self):
"""Test if this is a statement kind."""
- return CursorKind_is_stmt(self)
+ return lib.clang_isStatement(self)
def is_attribute(self):
"""Test if this is an attribute kind."""
- return CursorKind_is_attribute(self)
+ return lib.clang_isAttribute(self)
def is_invalid(self):
"""Test if this is an invalid kind."""
- return CursorKind_is_inv(self)
+ return lib.clang_isInvalid(self)
def is_translation_unit(self):
"""Test if this is a translation unit kind."""
- return CursorKind_is_translation_unit(self)
+ return lib.clang_isTranslationUnit(self)
def is_preprocessing(self):
"""Test if this is a preprocessing kind."""
- return CursorKind_is_preprocessing(self)
+ return lib.clang_isPreprocessing(self)
def is_unexposed(self):
"""Test if this is an unexposed kind."""
- return CursorKind_is_unexposed(self)
+ return lib.clang_isUnexposed(self)
def __repr__(self):
return 'CursorKind.%s' % (self.name,)
@@ -635,7 +784,7 @@ CursorKind.BINARY_OPERATOR = CursorKind(114)
CursorKind.COMPOUND_ASSIGNMENT_OPERATOR = CursorKind(115)
# The ?: ternary operator.
-CursorKind.CONDITONAL_OPERATOR = CursorKind(116)
+CursorKind.CONDITIONAL_OPERATOR = CursorKind(116)
# An explicit cast in C (C99 6.5.4) or a C-style cast in C++
# (C++ [expr.cast]), which uses the syntax (Type)expr.
@@ -887,10 +1036,15 @@ class Cursor(Structure):
@staticmethod
def from_location(tu, location):
- return Cursor_get(tu, location)
+ # We store a reference to the TU in the instance so the TU won't get
+ # collected before the cursor.
+ cursor = lib.clang_getCursor(tu, location)
+ cursor._tu = tu
+
+ return cursor
def __eq__(self, other):
- return Cursor_eq(self, other)
+ return lib.clang_equalCursors(self, other)
def __ne__(self, other):
return not self.__eq__(other)
@@ -900,7 +1054,13 @@ class Cursor(Structure):
Returns true if the declaration pointed at by the cursor is also a
definition of that entity.
"""
- return Cursor_is_def(self)
+ return lib.clang_isCursorDefinition(self)
+
+ def is_static_method(self):
+ """Returns True if the cursor refers to a C++ member function or member
+ function template that is declared 'static'.
+ """
+ return lib.clang_CXXMethod_isStatic(self)
def get_definition(self):
"""
@@ -910,7 +1070,7 @@ class Cursor(Structure):
"""
# TODO: Should probably check that this is either a reference or
# declaration prior to issuing the lookup.
- return Cursor_def(self)
+ return lib.clang_getCursorDefinition(self)
def get_usr(self):
"""Return the Unified Symbol Resultion (USR) for the entity referenced
@@ -921,7 +1081,7 @@ class Cursor(Structure):
program. USRs can be compared across translation units to determine,
e.g., when references in one translation refer to an entity defined in
another translation unit."""
- return Cursor_usr(self)
+ return lib.clang_getCursorUSR(self)
@property
def kind(self):
@@ -936,7 +1096,8 @@ class Cursor(Structure):
# this, for consistency with clang_getCursorUSR.
return None
if not hasattr(self, '_spelling'):
- self._spelling = Cursor_spelling(self)
+ self._spelling = lib.clang_getCursorSpelling(self)
+
return self._spelling
@property
@@ -949,7 +1110,8 @@ class Cursor(Structure):
class template specialization.
"""
if not hasattr(self, '_displayname'):
- self._displayname = Cursor_displayname(self)
+ self._displayname = lib.clang_getCursorDisplayName(self)
+
return self._displayname
@property
@@ -959,7 +1121,8 @@ class Cursor(Structure):
pointed at by the cursor.
"""
if not hasattr(self, '_loc'):
- self._loc = Cursor_loc(self)
+ self._loc = lib.clang_getCursorLocation(self)
+
return self._loc
@property
@@ -969,7 +1132,8 @@ class Cursor(Structure):
pointed at by the cursor.
"""
if not hasattr(self, '_extent'):
- self._extent = Cursor_extent(self)
+ self._extent = lib.clang_getCursorExtent(self)
+
return self._extent
@property
@@ -978,10 +1142,33 @@ class Cursor(Structure):
Retrieve the Type (if any) of the entity pointed at by the cursor.
"""
if not hasattr(self, '_type'):
- self._type = Cursor_type(self)
+ self._type = lib.clang_getCursorType(self)
+
return self._type
@property
+ def canonical(self):
+ """Return the canonical Cursor corresponding to this Cursor.
+
+ The canonical cursor is the cursor which is representative for the
+ underlying entity. For example, if you have multiple forward
+ declarations for the same class, the canonical cursor for the forward
+ declarations will be identical.
+ """
+ if not hasattr(self, '_canonical'):
+ self._canonical = lib.clang_getCanonicalCursor(self)
+
+ return self._canonical
+
+ @property
+ def result_type(self):
+ """Retrieve the Type of the result for this Cursor."""
+ if not hasattr(self, '_result_type'):
+ self._result_type = lib.clang_getResultType(self.type)
+
+ return self._result_type
+
+ @property
def underlying_typedef_type(self):
"""Return the underlying type of a typedef declaration.
@@ -990,7 +1177,7 @@ class Cursor(Structure):
"""
if not hasattr(self, '_underlying_type'):
assert self.kind.is_declaration()
- self._underlying_type = Cursor_underlying_type(self)
+ self._underlying_type = lib.clang_getTypedefDeclUnderlyingType(self)
return self._underlying_type
@@ -1003,15 +1190,39 @@ class Cursor(Structure):
"""
if not hasattr(self, '_enum_type'):
assert self.kind == CursorKind.ENUM_DECL
- self._enum_type = Cursor_enum_type(self)
+ self._enum_type = lib.clang_getEnumDeclIntegerType(self)
return self._enum_type
@property
+ def enum_value(self):
+ """Return the value of an enum constant."""
+ if not hasattr(self, '_enum_value'):
+ assert self.kind == CursorKind.ENUM_CONSTANT_DECL
+ # Figure out the underlying type of the enum to know if it
+ # is a signed or unsigned quantity.
+ underlying_type = self.type
+ if underlying_type.kind == TypeKind.ENUM:
+ underlying_type = underlying_type.get_declaration().enum_type
+ if underlying_type.kind in (TypeKind.CHAR_U,
+ TypeKind.UCHAR,
+ TypeKind.CHAR16,
+ TypeKind.CHAR32,
+ TypeKind.USHORT,
+ TypeKind.UINT,
+ TypeKind.ULONG,
+ TypeKind.ULONGLONG,
+ TypeKind.UINT128):
+ self._enum_value = lib.clang_getEnumConstantDeclUnsignedValue(self)
+ else:
+ self._enum_value = lib.clang_getEnumConstantDeclValue(self)
+ return self._enum_value
+
+ @property
def objc_type_encoding(self):
"""Return the Objective-C type encoding as a str."""
if not hasattr(self, '_objc_type_encoding'):
- self._objc_type_encoding = Cursor_objc_type_encoding(self)
+ self._objc_type_encoding = lib.clang_getDeclObjCTypeEncoding(self)
return self._objc_type_encoding
@@ -1019,10 +1230,33 @@ class Cursor(Structure):
def hash(self):
"""Returns a hash of the cursor as an int."""
if not hasattr(self, '_hash'):
- self._hash = Cursor_hash(self)
+ self._hash = lib.clang_hashCursor(self)
return self._hash
+ @property
+ def semantic_parent(self):
+ """Return the semantic parent for this cursor."""
+ if not hasattr(self, '_semantic_parent'):
+ self._semantic_parent = lib.clang_getCursorSemanticParent(self)
+
+ return self._semantic_parent
+
+ @property
+ def lexical_parent(self):
+ """Return the lexical parent for this cursor."""
+ if not hasattr(self, '_lexical_parent'):
+ self._lexical_parent = lib.clang_getCursorLexicalParent(self)
+
+ return self._lexical_parent
+
+ @property
+ def translation_unit(self):
+ """Returns the TranslationUnit to which this Cursor belongs."""
+ # If this triggers an AttributeError, the instance was not properly
+ # created.
+ return self._tu
+
def get_children(self):
"""Return an iterator for accessing the children of this cursor."""
@@ -1030,21 +1264,57 @@ class Cursor(Structure):
def visitor(child, parent, children):
# FIXME: Document this assertion in API.
# FIXME: There should just be an isNull method.
- assert child != Cursor_null()
+ assert child != lib.clang_getNullCursor()
+
+ # Create reference to TU so it isn't GC'd before Cursor.
+ child._tu = self._tu
children.append(child)
return 1 # continue
children = []
- Cursor_visit(self, Cursor_visit_callback(visitor), children)
+ lib.clang_visitChildren(self, callbacks['cursor_visit'](visitor),
+ children)
return iter(children)
+ def get_tokens(self):
+ """Obtain Token instances formulating that compose this Cursor.
+
+ This is a generator for Token instances. It returns all tokens which
+ occupy the extent this cursor occupies.
+ """
+ return TokenGroup.get_tokens(self._tu, self.extent)
+
@staticmethod
def from_result(res, fn, args):
assert isinstance(res, Cursor)
# FIXME: There should just be an isNull method.
- if res == Cursor_null():
+ if res == lib.clang_getNullCursor():
return None
+
+ # Store a reference to the TU in the Python object so it won't get GC'd
+ # before the Cursor.
+ tu = None
+ for arg in args:
+ if isinstance(arg, TranslationUnit):
+ tu = arg
+ break
+
+ if hasattr(arg, 'translation_unit'):
+ tu = arg.translation_unit
+ break
+
+ assert tu is not None
+
+ res._tu = tu
return res
+ @staticmethod
+ def from_cursor_result(res, fn, args):
+ assert isinstance(res, Cursor)
+ if res == lib.clang_getNullCursor():
+ return None
+
+ res._tu = args[0]._tu
+ return res
### Type Kinds ###
@@ -1082,7 +1352,7 @@ class TypeKind(object):
@property
def spelling(self):
"""Retrieve the spelling of this TypeKind."""
- return TypeKind_spelling(self.value)
+ return lib.clang_getTypeKindSpelling(self.value)
@staticmethod
def from_id(id):
@@ -1093,12 +1363,6 @@ class TypeKind(object):
def __repr__(self):
return 'TypeKind.%s' % (self.name,)
-TypeKind_spelling = lib.clang_getTypeKindSpelling
-TypeKind_spelling.argtypes = [c_uint]
-TypeKind_spelling.restype = _CXString
-TypeKind_spelling.errcheck = _CXString.from_result
-
-
TypeKind.INVALID = TypeKind(0)
TypeKind.UNEXPOSED = TypeKind(1)
TypeKind.VOID = TypeKind(2)
@@ -1168,7 +1432,7 @@ class Type(Structure):
def __len__(self):
if self.length is None:
- self.length = Type_get_num_arg_types(self.parent)
+ self.length = lib.clang_getNumArgTypes(self.parent)
return self.length
@@ -1184,7 +1448,7 @@ class Type(Structure):
raise IndexError("Index greater than container length: "
"%d > %d" % ( key, len(self) ))
- result = Type_get_arg_type(self.parent, key)
+ result = lib.clang_getArgType(self.parent, key)
if result.kind == TypeKind.INVALID:
raise IndexError("Argument could not be retrieved.")
@@ -1200,7 +1464,7 @@ class Type(Structure):
If accessed on a type that is not an array, complex, or vector type, an
exception will be raised.
"""
- result = Type_get_element_type(self)
+ result = lib.clang_getElementType(self)
if result.kind == TypeKind.INVALID:
raise Exception('Element type not available on this type.')
@@ -1214,15 +1478,32 @@ class Type(Structure):
If the Type is not an array or vector, this raises.
"""
- result = Type_get_num_elements(self)
+ result = lib.clang_getNumElements(self)
if result < 0:
raise Exception('Type does not have elements.')
return result
+ @property
+ def translation_unit(self):
+ """The TranslationUnit to which this Type is associated."""
+ # If this triggers an AttributeError, the instance was not properly
+ # instantiated.
+ return self._tu
+
@staticmethod
def from_result(res, fn, args):
assert isinstance(res, Type)
+
+ tu = None
+ for arg in args:
+ if hasattr(arg, 'translation_unit'):
+ tu = arg.translation_unit
+ break
+
+ assert tu is not None
+ res._tu = tu
+
return res
def get_canonical(self):
@@ -1235,7 +1516,7 @@ class Type(Structure):
example, if 'T' is a typedef for 'int', the canonical type for
'T' would be 'int'.
"""
- return Type_get_canonical(self)
+ return lib.clang_getCanonicalType(self)
def is_const_qualified(self):
"""Determine whether a Type has the "const" qualifier set.
@@ -1243,7 +1524,7 @@ class Type(Structure):
This does not look through typedefs that may have added "const"
at a different level.
"""
- return Type_is_const_qualified(self)
+ return lib.clang_isConstQualifiedType(self)
def is_volatile_qualified(self):
"""Determine whether a Type has the "volatile" qualifier set.
@@ -1251,7 +1532,7 @@ class Type(Structure):
This does not look through typedefs that may have added "volatile"
at a different level.
"""
- return Type_is_volatile_qualified(self)
+ return lib.clang_isVolatileQualifiedType(self)
def is_restrict_qualified(self):
"""Determine whether a Type has the "restrict" qualifier set.
@@ -1259,53 +1540,53 @@ class Type(Structure):
This does not look through typedefs that may have added "restrict" at
a different level.
"""
- return Type_is_restrict_qualified(self)
+ return lib.clang_isRestrictQualifiedType(self)
def is_function_variadic(self):
"""Determine whether this function Type is a variadic function type."""
assert self.kind == TypeKind.FUNCTIONPROTO
- return Type_is_variadic(self)
+ return lib.clang_isFunctionTypeVariadic(self)
def is_pod(self):
"""Determine whether this Type represents plain old data (POD)."""
- return Type_is_pod(self)
+ return lib.clang_isPODType(self)
def get_pointee(self):
"""
For pointer types, returns the type of the pointee.
"""
- return Type_get_pointee(self)
+ return lib.clang_getPointeeType(self)
def get_declaration(self):
"""
Return the cursor for the declaration of the given type.
"""
- return Type_get_declaration(self)
+ return lib.clang_getTypeDeclaration(self)
def get_result(self):
"""
Retrieve the result type associated with a function type.
"""
- return Type_get_result(self)
+ return lib.clang_getResultType(self)
def get_array_element_type(self):
"""
Retrieve the type of the elements of the array type.
"""
- return Type_get_array_element(self)
+ return lib.clang_getArrayElementType(self)
def get_array_size(self):
"""
Retrieve the size of the constant array.
"""
- return Type_get_array_size(self)
+ return lib.clang_getArraySize(self)
def __eq__(self, other):
if type(other) != type(self):
return False
- return Type_equal(self, other)
+ return lib.clang_equalTypes(self, other)
def __ne__(self, other):
return not self.__eq__(other)
@@ -1333,65 +1614,6 @@ class _CXUnsavedFile(Structure):
"""Helper for passing unsaved file arguments."""
_fields_ = [("name", c_char_p), ("contents", c_char_p), ('length', c_ulong)]
-## Diagnostic Conversion ##
-
-_clang_getNumDiagnostics = lib.clang_getNumDiagnostics
-_clang_getNumDiagnostics.argtypes = [c_object_p]
-_clang_getNumDiagnostics.restype = c_uint
-
-_clang_getDiagnostic = lib.clang_getDiagnostic
-_clang_getDiagnostic.argtypes = [c_object_p, c_uint]
-_clang_getDiagnostic.restype = c_object_p
-
-_clang_disposeDiagnostic = lib.clang_disposeDiagnostic
-_clang_disposeDiagnostic.argtypes = [Diagnostic]
-
-_clang_getDiagnosticSeverity = lib.clang_getDiagnosticSeverity
-_clang_getDiagnosticSeverity.argtypes = [Diagnostic]
-_clang_getDiagnosticSeverity.restype = c_int
-
-_clang_getDiagnosticLocation = lib.clang_getDiagnosticLocation
-_clang_getDiagnosticLocation.argtypes = [Diagnostic]
-_clang_getDiagnosticLocation.restype = SourceLocation
-
-_clang_getDiagnosticSpelling = lib.clang_getDiagnosticSpelling
-_clang_getDiagnosticSpelling.argtypes = [Diagnostic]
-_clang_getDiagnosticSpelling.restype = _CXString
-_clang_getDiagnosticSpelling.errcheck = _CXString.from_result
-
-_clang_getDiagnosticNumRanges = lib.clang_getDiagnosticNumRanges
-_clang_getDiagnosticNumRanges.argtypes = [Diagnostic]
-_clang_getDiagnosticNumRanges.restype = c_uint
-
-_clang_getDiagnosticRange = lib.clang_getDiagnosticRange
-_clang_getDiagnosticRange.argtypes = [Diagnostic, c_uint]
-_clang_getDiagnosticRange.restype = SourceRange
-
-_clang_getDiagnosticNumFixIts = lib.clang_getDiagnosticNumFixIts
-_clang_getDiagnosticNumFixIts.argtypes = [Diagnostic]
-_clang_getDiagnosticNumFixIts.restype = c_uint
-
-_clang_getDiagnosticFixIt = lib.clang_getDiagnosticFixIt
-_clang_getDiagnosticFixIt.argtypes = [Diagnostic, c_uint, POINTER(SourceRange)]
-_clang_getDiagnosticFixIt.restype = _CXString
-_clang_getDiagnosticFixIt.errcheck = _CXString.from_result
-
-_clang_getDiagnosticCategory = lib.clang_getDiagnosticCategory
-_clang_getDiagnosticCategory.argtypes = [Diagnostic]
-_clang_getDiagnosticCategory.restype = c_uint
-
-_clang_getDiagnosticCategoryName = lib.clang_getDiagnosticCategoryName
-_clang_getDiagnosticCategoryName.argtypes = [c_uint]
-_clang_getDiagnosticCategoryName.restype = _CXString
-_clang_getDiagnosticCategoryName.errcheck = _CXString.from_result
-
-_clang_getDiagnosticOption = lib.clang_getDiagnosticOption
-_clang_getDiagnosticOption.argtypes = [Diagnostic, POINTER(_CXString)]
-_clang_getDiagnosticOption.restype = _CXString
-_clang_getDiagnosticOption.errcheck = _CXString.from_result
-
-###
-
class CompletionChunk:
class Kind:
def __init__(self, name):
@@ -1412,16 +1634,16 @@ class CompletionChunk:
@property
def spelling(self):
- return _clang_getCompletionChunkText(self.cs, self.key).spelling
+ return lib.clang_getCompletionChunkText(self.cs, self.key).spelling
@property
def kind(self):
- res = _clang_getCompletionChunkKind(self.cs, self.key)
+ res = lib.clang_getCompletionChunkKind(self.cs, self.key)
return completionChunkKindMap[res]
@property
def string(self):
- res = _clang_getCompletionChunkCompletionString(self.cs, self.key)
+ res = lib.clang_getCompletionChunkCompletionString(self.cs, self.key)
if (res):
return CompletionString(res)
@@ -1478,7 +1700,7 @@ class CompletionString(ClangObject):
return "<Availability: %s>" % self
def __len__(self):
- return _clang_getNumCompletionChunks(self.obj)
+ return lib.clang_getNumCompletionChunks(self.obj)
def __getitem__(self, key):
if len(self) <= key:
@@ -1487,11 +1709,11 @@ class CompletionString(ClangObject):
@property
def priority(self):
- return _clang_getCompletionPriority(self.obj)
+ return lib.clang_getCompletionPriority(self.obj)
@property
def availability(self):
- res = _clang_getCompletionAvailability(self.obj)
+ res = lib.clang_getCompletionAvailability(self.obj)
return availabilityKinds[res]
def __repr__(self):
@@ -1553,10 +1775,10 @@ class CodeCompletionResults(ClangObject):
self.ccr= ccr
def __len__(self):
- return int(_clang_codeCompleteGetNumDiagnostics(self.ccr))
+ return int(lib.clang_codeCompleteGetNumDiagnostics(self.ccr))
def __getitem__(self, key):
- return _clang_codeCompleteGetDiagnostic(self.ccr, key)
+ return lib.clang_codeCompleteGetDiagnostic(self.ccr, key)
return DiagnosticsItr(self)
@@ -1575,21 +1797,17 @@ class Index(ClangObject):
Parameters:
excludeDecls -- Exclude local declarations from translation units.
"""
- return Index(Index_create(excludeDecls, 0))
+ return Index(lib.clang_createIndex(excludeDecls, 0))
def __del__(self):
- Index_dispose(self)
+ lib.clang_disposeIndex(self)
def read(self, path):
- """Load the translation unit from the given AST file."""
- ptr = TranslationUnit_read(self, path)
- if ptr:
- return TranslationUnit(ptr)
- return None
+ """Load a TranslationUnit from the given AST file."""
+ return TranslationUnit.from_ast(path, self)
- def parse(self, path, args = [], unsaved_files = [], options = 0):
- """
- Load the translation unit from the given source code file by running
+ def parse(self, path, args=None, unsaved_files=None, options = 0):
+ """Load the translation unit from the given source code file by running
clang and generating the AST before loading. Additional command line
parameters can be passed to clang via the args parameter.
@@ -1597,53 +1815,167 @@ class Index(ClangObject):
to as unsaved_files, the first item should be the filenames to be mapped
and the second should be the contents to be substituted for the
file. The contents may be passed as strings or file objects.
- """
- arg_array = 0
- if len(args):
- arg_array = (c_char_p * len(args))(* args)
- unsaved_files_array = 0
- if len(unsaved_files):
- unsaved_files_array = (_CXUnsavedFile * len(unsaved_files))()
- for i,(name,value) in enumerate(unsaved_files):
- if not isinstance(value, str):
- # FIXME: It would be great to support an efficient version
- # of this, one day.
- value = value.read()
- print value
- if not isinstance(value, str):
- raise TypeError,'Unexpected unsaved file contents.'
- unsaved_files_array[i].name = name
- unsaved_files_array[i].contents = value
- unsaved_files_array[i].length = len(value)
- ptr = TranslationUnit_parse(self, path, arg_array, len(args),
- unsaved_files_array, len(unsaved_files),
- options)
- if ptr:
- return TranslationUnit(ptr)
- return None
+ If an error was encountered during parsing, a TranslationUnitLoadError
+ will be raised.
+ """
+ return TranslationUnit.from_source(path, args, unsaved_files, options,
+ self)
class TranslationUnit(ClangObject):
- """
- The TranslationUnit class represents a source code translation unit and
- provides read-only access to its top-level declarations.
+ """Represents a source code translation unit.
+
+ This is one of the main types in the API. Any time you wish to interact
+ with Clang's representation of a source file, you typically start with a
+ translation unit.
"""
- def __init__(self, ptr):
+ # Default parsing mode.
+ PARSE_NONE = 0
+
+ # Instruct the parser to create a detailed processing record containing
+ # metadata not normally retained.
+ PARSE_DETAILED_PROCESSING_RECORD = 1
+
+ # Indicates that the translation unit is incomplete. This is typically used
+ # when parsing headers.
+ PARSE_INCOMPLETE = 2
+
+ # Instruct the parser to create a pre-compiled preamble for the translation
+ # unit. This caches the preamble (included files at top of source file).
+ # This is useful if the translation unit will be reparsed and you don't
+ # want to incur the overhead of reparsing the preamble.
+ PARSE_PRECOMPILED_PREAMBLE = 4
+
+ # Cache code completion information on parse. This adds time to parsing but
+ # speeds up code completion.
+ PARSE_CACHE_COMPLETION_RESULTS = 8
+
+ # Flags with values 16 and 32 are deprecated and intentionally omitted.
+
+ # Do not parse function bodies. This is useful if you only care about
+ # searching for declarations/definitions.
+ PARSE_SKIP_FUNCTION_BODIES = 64
+
+ @classmethod
+ def from_source(cls, filename, args=None, unsaved_files=None, options=0,
+ index=None):
+ """Create a TranslationUnit by parsing source.
+
+ This is capable of processing source code both from files on the
+ filesystem as well as in-memory contents.
+
+ Command-line arguments that would be passed to clang are specified as
+ a list via args. These can be used to specify include paths, warnings,
+ etc. e.g. ["-Wall", "-I/path/to/include"].
+
+ In-memory file content can be provided via unsaved_files. This is an
+ iterable of 2-tuples. The first element is the str filename. The
+ second element defines the content. Content can be provided as str
+ source code or as file objects (anything with a read() method). If
+ a file object is being used, content will be read until EOF and the
+ read cursor will not be reset to its original position.
+
+ options is a bitwise or of TranslationUnit.PARSE_XXX flags which will
+ control parsing behavior.
+
+ index is an Index instance to utilize. If not provided, a new Index
+ will be created for this TranslationUnit.
+
+ To parse source from the filesystem, the filename of the file to parse
+ is specified by the filename argument. Or, filename could be None and
+ the args list would contain the filename(s) to parse.
+
+ To parse source from an in-memory buffer, set filename to the virtual
+ filename you wish to associate with this source (e.g. "test.c"). The
+ contents of that file are then provided in unsaved_files.
+
+ If an error occurs, a TranslationUnitLoadError is raised.
+
+ Please note that a TranslationUnit with parser errors may be returned.
+ It is the caller's responsibility to check tu.diagnostics for errors.
+
+ Also note that Clang infers the source language from the extension of
+ the input filename. If you pass in source code containing a C++ class
+ declaration with the filename "test.c" parsing will fail.
+ """
+ if args is None:
+ args = []
+
+ if unsaved_files is None:
+ unsaved_files = []
+
+ if index is None:
+ index = Index.create()
+
+ args_array = None
+ if len(args) > 0:
+ args_array = (c_char_p * len(args))(* args)
+
+ unsaved_array = None
+ if len(unsaved_files) > 0:
+ unsaved_array = (_CXUnsavedFile * len(unsaved_files))()
+ for i, (name, contents) in enumerate(unsaved_files):
+ if hasattr(contents, "read"):
+ contents = contents.read()
+
+ unsaved_array[i].name = name
+ unsaved_array[i].contents = contents
+ unsaved_array[i].length = len(contents)
+
+ ptr = lib.clang_parseTranslationUnit(index, filename, args_array,
+ len(args), unsaved_array,
+ len(unsaved_files), options)
+
+ if ptr is None:
+ raise TranslationUnitLoadError("Error parsing translation unit.")
+
+ return cls(ptr, index=index)
+
+ @classmethod
+ def from_ast_file(cls, filename, index=None):
+ """Create a TranslationUnit instance from a saved AST file.
+
+ A previously-saved AST file (provided with -emit-ast or
+ TranslationUnit.save()) is loaded from the filename specified.
+
+ If the file cannot be loaded, a TranslationUnitLoadError will be
+ raised.
+
+ index is optional and is the Index instance to use. If not provided,
+ a default Index will be created.
+ """
+ if index is None:
+ index = Index.create()
+
+ ptr = lib.clang_createTranslationUnit(index, filename)
+ if ptr is None:
+ raise TranslationUnitLoadError(filename)
+
+ return cls(ptr=ptr, index=index)
+
+ def __init__(self, ptr, index):
+ """Create a TranslationUnit instance.
+
+ TranslationUnits should be created using one of the from_* @classmethod
+ functions above. __init__ is only called internally.
+ """
+ assert isinstance(index, Index)
+
ClangObject.__init__(self, ptr)
def __del__(self):
- TranslationUnit_dispose(self)
+ lib.clang_disposeTranslationUnit(self)
@property
def cursor(self):
"""Retrieve the cursor that represents the given translation unit."""
- return TranslationUnit_cursor(self)
+ return lib.clang_getTranslationUnitCursor(self)
@property
def spelling(self):
"""Get the original translation unit source file name."""
- return TranslationUnit_spelling(self)
+ return lib.clang_getTranslationUnitSpelling(self)
def get_includes(self):
"""
@@ -1660,11 +1992,72 @@ class TranslationUnit(ClangObject):
# Automatically adapt CIndex/ctype pointers to python objects
includes = []
- TranslationUnit_includes(self,
- TranslationUnit_includes_callback(visitor),
- includes)
+ lib.clang_getInclusions(self,
+ callbacks['translation_unit_includes'](visitor), includes)
+
return iter(includes)
+ def get_file(self, filename):
+ """Obtain a File from this translation unit."""
+
+ return File.from_name(self, filename)
+
+ def get_location(self, filename, position):
+ """Obtain a SourceLocation for a file in this translation unit.
+
+ The position can be specified by passing:
+
+ - Integer file offset. Initial file offset is 0.
+ - 2-tuple of (line number, column number). Initial file position is
+ (0, 0)
+ """
+ f = self.get_file(filename)
+
+ if isinstance(position, int):
+ return SourceLocation.from_offset(self, f, position)
+
+ return SourceLocation.from_position(self, f, position[0], position[1])
+
+ def get_extent(self, filename, locations):
+ """Obtain a SourceRange from this translation unit.
+
+ The bounds of the SourceRange must ultimately be defined by a start and
+ end SourceLocation. For the locations argument, you can pass:
+
+ - 2 SourceLocation instances in a 2-tuple or list.
+ - 2 int file offsets via a 2-tuple or list.
+ - 2 2-tuple or lists of (line, column) pairs in a 2-tuple or list.
+
+ e.g.
+
+ get_extent('foo.c', (5, 10))
+ get_extent('foo.c', ((1, 1), (1, 15)))
+ """
+ f = self.get_file(filename)
+
+ if len(locations) < 2:
+ raise Exception('Must pass object with at least 2 elements')
+
+ start_location, end_location = locations
+
+ if hasattr(start_location, '__len__'):
+ start_location = SourceLocation.from_position(self, f,
+ start_location[0], start_location[1])
+ elif isinstance(start_location, int):
+ start_location = SourceLocation.from_offset(self, f,
+ start_location)
+
+ if hasattr(end_location, '__len__'):
+ end_location = SourceLocation.from_position(self, f,
+ end_location[0], end_location[1])
+ elif isinstance(end_location, int):
+ end_location = SourceLocation.from_offset(self, f, end_location)
+
+ assert isinstance(start_location, SourceLocation)
+ assert isinstance(end_location, SourceLocation)
+
+ return SourceRange.from_locations(start_location, end_location)
+
@property
def diagnostics(self):
"""
@@ -1675,17 +2068,17 @@ class TranslationUnit(ClangObject):
self.tu = tu
def __len__(self):
- return int(_clang_getNumDiagnostics(self.tu))
+ return int(lib.clang_getNumDiagnostics(self.tu))
def __getitem__(self, key):
- diag = _clang_getDiagnostic(self.tu, key)
+ diag = lib.clang_getDiagnostic(self.tu, key)
if not diag:
raise IndexError
return Diagnostic(diag)
return DiagIterator(self)
- def reparse(self, unsaved_files = [], options = 0):
+ def reparse(self, unsaved_files=None, options=0):
"""
Reparse an already parsed translation unit.
@@ -1694,6 +2087,9 @@ class TranslationUnit(ClangObject):
and the second should be the contents to be substituted for the
file. The contents may be passed as strings or file objects.
"""
+ if unsaved_files is None:
+ unsaved_files = []
+
unsaved_files_array = 0
if len(unsaved_files):
unsaved_files_array = (_CXUnsavedFile * len(unsaved_files))()
@@ -1708,10 +2104,31 @@ class TranslationUnit(ClangObject):
unsaved_files_array[i].name = name
unsaved_files_array[i].contents = value
unsaved_files_array[i].length = len(value)
- ptr = TranslationUnit_reparse(self, len(unsaved_files),
- unsaved_files_array,
- options)
- def codeComplete(self, path, line, column, unsaved_files = [], options = 0):
+ ptr = lib.clang_reparseTranslationUnit(self, len(unsaved_files),
+ unsaved_files_array, options)
+
+ def save(self, filename):
+ """Saves the TranslationUnit to a file.
+
+ This is equivalent to passing -emit-ast to the clang frontend. The
+ saved file can be loaded back into a TranslationUnit. Or, if it
+ corresponds to a header, it can be used as a pre-compiled header file.
+
+ If an error occurs while saving, a TranslationUnitSaveError is raised.
+ If the error was TranslationUnitSaveError.ERROR_INVALID_TU, this means
+ the constructed TranslationUnit was not valid at time of save. In this
+ case, the reason(s) why should be available via
+ TranslationUnit.diagnostics().
+
+ filename -- The path to save the translation unit to.
+ """
+ options = lib.clang_defaultSaveOptions(self)
+ result = int(lib.clang_saveTranslationUnit(self, filename, options))
+ if result != 0:
+ raise TranslationUnitSaveError(result,
+ 'Error saving TranslationUnit.')
+
+ def codeComplete(self, path, line, column, unsaved_files=None, options=0):
"""
Code complete in this translation unit.
@@ -1720,6 +2137,9 @@ class TranslationUnit(ClangObject):
and the second should be the contents to be substituted for the
file. The contents may be passed as strings or file objects.
"""
+ if unsaved_files is None:
+ unsaved_files = []
+
unsaved_files_array = 0
if len(unsaved_files):
unsaved_files_array = (_CXUnsavedFile * len(unsaved_files))()
@@ -1734,15 +2154,25 @@ class TranslationUnit(ClangObject):
unsaved_files_array[i].name = name
unsaved_files_array[i].contents = value
unsaved_files_array[i].length = len(value)
- ptr = TranslationUnit_codeComplete(self, path,
- line, column,
- unsaved_files_array,
- len(unsaved_files),
- options)
+ ptr = lib.clang_codeCompleteAt(self, path, line, column,
+ unsaved_files_array, len(unsaved_files), options)
if ptr:
return CodeCompletionResults(ptr)
return None
+ def get_tokens(self, locations=None, extent=None):
+ """Obtain tokens in this translation unit.
+
+ This is a generator for Token instances. The caller specifies a range
+ of source code to obtain tokens for. The range can be specified as a
+ 2-tuple of SourceLocation or as a SourceRange. If both are defined,
+ behavior is undefined.
+ """
+ if locations is not None:
+ extent = SourceRange(start=locations[0], end=locations[1])
+
+ return TokenGroup.get_tokens(self, extent)
+
class File(ClangObject):
"""
The File class represents a particular source file that is part of a
@@ -1752,17 +2182,17 @@ class File(ClangObject):
@staticmethod
def from_name(translation_unit, file_name):
"""Retrieve a file handle within the given translation unit."""
- return File(File_getFile(translation_unit, file_name))
+ return File(lib.clang_getFile(translation_unit, file_name))
@property
def name(self):
"""Return the complete file and path name of the file."""
- return _CXString_getCString(File_name(self))
+ return lib.clang_getCString(lib.clang_getFileName(self))
@property
def time(self):
"""Return the last modification time of the file."""
- return File_time(self)
+ return lib.clang_getFileTime(self)
def __str__(self):
return self.name
@@ -1770,6 +2200,14 @@ class File(ClangObject):
def __repr__(self):
return "<File: %s>" % (self.name)
+ @staticmethod
+ def from_cursor_result(res, fn, args):
+ assert isinstance(res, File)
+
+ # Copy a reference to the TranslationUnit to prevent premature GC.
+ res._tu = args[0]._tu
+ return res
+
class FileInclusion(object):
"""
The FileInclusion class represents the inclusion of one source file by
@@ -1790,337 +2228,616 @@ class FileInclusion(object):
"""True if the included file is the input file."""
return self.depth == 0
-# Additional Functions and Types
+class CompilationDatabaseError(Exception):
+ """Represents an error that occurred when working with a CompilationDatabase
-# String Functions
-_CXString_dispose = lib.clang_disposeString
-_CXString_dispose.argtypes = [_CXString]
+ Each error is associated to an enumerated value, accessible under
+ e.cdb_error. Consumers can compare the value with one of the ERROR_
+ constants in this class.
+ """
-_CXString_getCString = lib.clang_getCString
-_CXString_getCString.argtypes = [_CXString]
-_CXString_getCString.restype = c_char_p
+ # An unknown error occured
+ ERROR_UNKNOWN = 0
-# Source Location Functions
-SourceLocation_loc = lib.clang_getInstantiationLocation
-SourceLocation_loc.argtypes = [SourceLocation, POINTER(c_object_p),
- POINTER(c_uint), POINTER(c_uint),
- POINTER(c_uint)]
-
-SourceLocation_getLocation = lib.clang_getLocation
-SourceLocation_getLocation.argtypes = [TranslationUnit, File, c_uint, c_uint]
-SourceLocation_getLocation.restype = SourceLocation
-
-SourceLocation_equalLocations = lib.clang_equalLocations
-SourceLocation_equalLocations.argtypes = [SourceLocation, SourceLocation]
-SourceLocation_equalLocations.restype = bool
-
-# Source Range Functions
-SourceRange_getRange = lib.clang_getRange
-SourceRange_getRange.argtypes = [SourceLocation, SourceLocation]
-SourceRange_getRange.restype = SourceRange
-
-SourceRange_start = lib.clang_getRangeStart
-SourceRange_start.argtypes = [SourceRange]
-SourceRange_start.restype = SourceLocation
-
-SourceRange_end = lib.clang_getRangeEnd
-SourceRange_end.argtypes = [SourceRange]
-SourceRange_end.restype = SourceLocation
-
-SourceRange_equalRanges = lib.clang_equalRanges
-SourceRange_equalRanges.argtypes = [SourceRange, SourceRange]
-SourceRange_equalRanges.restype = bool
-
-# CursorKind Functions
-CursorKind_is_decl = lib.clang_isDeclaration
-CursorKind_is_decl.argtypes = [CursorKind]
-CursorKind_is_decl.restype = bool
-
-CursorKind_is_ref = lib.clang_isReference
-CursorKind_is_ref.argtypes = [CursorKind]
-CursorKind_is_ref.restype = bool
-
-CursorKind_is_expr = lib.clang_isExpression
-CursorKind_is_expr.argtypes = [CursorKind]
-CursorKind_is_expr.restype = bool
-
-CursorKind_is_stmt = lib.clang_isStatement
-CursorKind_is_stmt.argtypes = [CursorKind]
-CursorKind_is_stmt.restype = bool
-
-CursorKind_is_attribute = lib.clang_isAttribute
-CursorKind_is_attribute.argtypes = [CursorKind]
-CursorKind_is_attribute.restype = bool
-
-CursorKind_is_inv = lib.clang_isInvalid
-CursorKind_is_inv.argtypes = [CursorKind]
-CursorKind_is_inv.restype = bool
-
-CursorKind_is_translation_unit = lib.clang_isTranslationUnit
-CursorKind_is_translation_unit.argtypes = [CursorKind]
-CursorKind_is_translation_unit.restype = bool
-
-CursorKind_is_preprocessing = lib.clang_isPreprocessing
-CursorKind_is_preprocessing.argtypes = [CursorKind]
-CursorKind_is_preprocessing.restype = bool
-
-CursorKind_is_unexposed = lib.clang_isUnexposed
-CursorKind_is_unexposed.argtypes = [CursorKind]
-CursorKind_is_unexposed.restype = bool
-
-# Cursor Functions
-# TODO: Implement this function
-Cursor_get = lib.clang_getCursor
-Cursor_get.argtypes = [TranslationUnit, SourceLocation]
-Cursor_get.restype = Cursor
-
-Cursor_null = lib.clang_getNullCursor
-Cursor_null.restype = Cursor
-
-Cursor_usr = lib.clang_getCursorUSR
-Cursor_usr.argtypes = [Cursor]
-Cursor_usr.restype = _CXString
-Cursor_usr.errcheck = _CXString.from_result
-
-Cursor_is_def = lib.clang_isCursorDefinition
-Cursor_is_def.argtypes = [Cursor]
-Cursor_is_def.restype = bool
-
-Cursor_def = lib.clang_getCursorDefinition
-Cursor_def.argtypes = [Cursor]
-Cursor_def.restype = Cursor
-Cursor_def.errcheck = Cursor.from_result
-
-Cursor_eq = lib.clang_equalCursors
-Cursor_eq.argtypes = [Cursor, Cursor]
-Cursor_eq.restype = bool
-
-Cursor_hash = lib.clang_hashCursor
-Cursor_hash.argtypes = [Cursor]
-Cursor_hash.restype = c_uint
-
-Cursor_spelling = lib.clang_getCursorSpelling
-Cursor_spelling.argtypes = [Cursor]
-Cursor_spelling.restype = _CXString
-Cursor_spelling.errcheck = _CXString.from_result
-
-Cursor_displayname = lib.clang_getCursorDisplayName
-Cursor_displayname.argtypes = [Cursor]
-Cursor_displayname.restype = _CXString
-Cursor_displayname.errcheck = _CXString.from_result
-
-Cursor_loc = lib.clang_getCursorLocation
-Cursor_loc.argtypes = [Cursor]
-Cursor_loc.restype = SourceLocation
-
-Cursor_extent = lib.clang_getCursorExtent
-Cursor_extent.argtypes = [Cursor]
-Cursor_extent.restype = SourceRange
-
-Cursor_ref = lib.clang_getCursorReferenced
-Cursor_ref.argtypes = [Cursor]
-Cursor_ref.restype = Cursor
-Cursor_ref.errcheck = Cursor.from_result
-
-Cursor_type = lib.clang_getCursorType
-Cursor_type.argtypes = [Cursor]
-Cursor_type.restype = Type
-Cursor_type.errcheck = Type.from_result
-
-Cursor_underlying_type = lib.clang_getTypedefDeclUnderlyingType
-Cursor_underlying_type.argtypes = [Cursor]
-Cursor_underlying_type.restype = Type
-Cursor_underlying_type.errcheck = Type.from_result
-
-Cursor_enum_type = lib.clang_getEnumDeclIntegerType
-Cursor_enum_type.argtypes = [Cursor]
-Cursor_enum_type.restype = Type
-Cursor_enum_type.errcheck = Type.from_result
-
-Cursor_objc_type_encoding = lib.clang_getDeclObjCTypeEncoding
-Cursor_objc_type_encoding.argtypes = [Cursor]
-Cursor_objc_type_encoding.restype = _CXString
-Cursor_objc_type_encoding.errcheck = _CXString.from_result
-
-Cursor_visit_callback = CFUNCTYPE(c_int, Cursor, Cursor, py_object)
-Cursor_visit = lib.clang_visitChildren
-Cursor_visit.argtypes = [Cursor, Cursor_visit_callback, py_object]
-Cursor_visit.restype = c_uint
-
-# Type Functions
-Type_get_canonical = lib.clang_getCanonicalType
-Type_get_canonical.argtypes = [Type]
-Type_get_canonical.restype = Type
-Type_get_canonical.errcheck = Type.from_result
-
-Type_is_const_qualified = lib.clang_isConstQualifiedType
-Type_is_const_qualified.argtypes = [Type]
-Type_is_const_qualified.restype = bool
-
-Type_is_volatile_qualified = lib.clang_isVolatileQualifiedType
-Type_is_volatile_qualified.argtypes = [Type]
-Type_is_volatile_qualified.restype = bool
-
-Type_is_restrict_qualified = lib.clang_isRestrictQualifiedType
-Type_is_restrict_qualified.argtypes = [Type]
-Type_is_restrict_qualified.restype = bool
-
-Type_is_pod = lib.clang_isPODType
-Type_is_pod.argtypes = [Type]
-Type_is_pod.restype = bool
-
-Type_is_variadic = lib.clang_isFunctionTypeVariadic
-Type_is_variadic.argtypes = [Type]
-Type_is_variadic.restype = bool
-
-Type_get_pointee = lib.clang_getPointeeType
-Type_get_pointee.argtypes = [Type]
-Type_get_pointee.restype = Type
-Type_get_pointee.errcheck = Type.from_result
-
-Type_get_declaration = lib.clang_getTypeDeclaration
-Type_get_declaration.argtypes = [Type]
-Type_get_declaration.restype = Cursor
-Type_get_declaration.errcheck = Cursor.from_result
-
-Type_get_result = lib.clang_getResultType
-Type_get_result.argtypes = [Type]
-Type_get_result.restype = Type
-Type_get_result.errcheck = Type.from_result
-
-Type_get_num_arg_types = lib.clang_getNumArgTypes
-Type_get_num_arg_types.argtypes = [Type]
-Type_get_num_arg_types.restype = c_uint
-
-Type_get_arg_type = lib.clang_getArgType
-Type_get_arg_type.argtypes = [Type, c_uint]
-Type_get_arg_type.restype = Type
-Type_get_arg_type.errcheck = Type.from_result
-Type_get_element_type = lib.clang_getElementType
-
-Type_get_element_type.argtypes = [Type]
-Type_get_element_type.restype = Type
-Type_get_element_type.errcheck = Type.from_result
-
-Type_get_num_elements = lib.clang_getNumElements
-Type_get_num_elements.argtypes = [Type]
-Type_get_num_elements.restype = c_longlong
-
-Type_get_array_element = lib.clang_getArrayElementType
-Type_get_array_element.argtypes = [Type]
-Type_get_array_element.restype = Type
-Type_get_array_element.errcheck = Type.from_result
-
-Type_get_array_size = lib.clang_getArraySize
-Type_get_array_size.argtype = [Type]
-Type_get_array_size.restype = c_longlong
-
-Type_equal = lib.clang_equalTypes
-Type_equal.argtypes = [Type, Type]
-Type_equal.restype = bool
-
-# Index Functions
-Index_create = lib.clang_createIndex
-Index_create.argtypes = [c_int, c_int]
-Index_create.restype = c_object_p
-
-Index_dispose = lib.clang_disposeIndex
-Index_dispose.argtypes = [Index]
-
-# Translation Unit Functions
-TranslationUnit_read = lib.clang_createTranslationUnit
-TranslationUnit_read.argtypes = [Index, c_char_p]
-TranslationUnit_read.restype = c_object_p
-
-TranslationUnit_parse = lib.clang_parseTranslationUnit
-TranslationUnit_parse.argtypes = [Index, c_char_p, c_void_p,
- c_int, c_void_p, c_int, c_int]
-TranslationUnit_parse.restype = c_object_p
-
-TranslationUnit_reparse = lib.clang_reparseTranslationUnit
-TranslationUnit_reparse.argtypes = [TranslationUnit, c_int, c_void_p, c_int]
-TranslationUnit_reparse.restype = c_int
-
-TranslationUnit_codeComplete = lib.clang_codeCompleteAt
-TranslationUnit_codeComplete.argtypes = [TranslationUnit, c_char_p, c_int,
- c_int, c_void_p, c_int, c_int]
-TranslationUnit_codeComplete.restype = POINTER(CCRStructure)
-
-TranslationUnit_cursor = lib.clang_getTranslationUnitCursor
-TranslationUnit_cursor.argtypes = [TranslationUnit]
-TranslationUnit_cursor.restype = Cursor
-TranslationUnit_cursor.errcheck = Cursor.from_result
-
-TranslationUnit_spelling = lib.clang_getTranslationUnitSpelling
-TranslationUnit_spelling.argtypes = [TranslationUnit]
-TranslationUnit_spelling.restype = _CXString
-TranslationUnit_spelling.errcheck = _CXString.from_result
-
-TranslationUnit_dispose = lib.clang_disposeTranslationUnit
-TranslationUnit_dispose.argtypes = [TranslationUnit]
-
-TranslationUnit_includes_callback = CFUNCTYPE(None,
- c_object_p,
- POINTER(SourceLocation),
- c_uint, py_object)
-TranslationUnit_includes = lib.clang_getInclusions
-TranslationUnit_includes.argtypes = [TranslationUnit,
- TranslationUnit_includes_callback,
- py_object]
-
-# File Functions
-File_getFile = lib.clang_getFile
-File_getFile.argtypes = [TranslationUnit, c_char_p]
-File_getFile.restype = c_object_p
-
-File_name = lib.clang_getFileName
-File_name.argtypes = [File]
-File_name.restype = _CXString
-
-File_time = lib.clang_getFileTime
-File_time.argtypes = [File]
-File_time.restype = c_uint
-
-# Code completion
-
-CodeCompletionResults_dispose = lib.clang_disposeCodeCompleteResults
-CodeCompletionResults_dispose.argtypes = [CodeCompletionResults]
-
-_clang_codeCompleteGetNumDiagnostics = lib.clang_codeCompleteGetNumDiagnostics
-_clang_codeCompleteGetNumDiagnostics.argtypes = [CodeCompletionResults]
-_clang_codeCompleteGetNumDiagnostics.restype = c_int
-
-_clang_codeCompleteGetDiagnostic = lib.clang_codeCompleteGetDiagnostic
-_clang_codeCompleteGetDiagnostic.argtypes = [CodeCompletionResults, c_int]
-_clang_codeCompleteGetDiagnostic.restype = Diagnostic
-
-_clang_getCompletionChunkText = lib.clang_getCompletionChunkText
-_clang_getCompletionChunkText.argtypes = [c_void_p, c_int]
-_clang_getCompletionChunkText.restype = _CXString
+ # The database could not be loaded
+ ERROR_CANNOTLOADDATABASE = 1
-_clang_getCompletionChunkKind = lib.clang_getCompletionChunkKind
-_clang_getCompletionChunkKind.argtypes = [c_void_p, c_int]
-_clang_getCompletionChunkKind.restype = c_int
+ def __init__(self, enumeration, message):
+ assert isinstance(enumeration, int)
-_clang_getCompletionChunkCompletionString = lib.clang_getCompletionChunkCompletionString
-_clang_getCompletionChunkCompletionString.argtypes = [c_void_p, c_int]
-_clang_getCompletionChunkCompletionString.restype = c_object_p
+ if enumeration > 1:
+ raise Exception("Encountered undefined CompilationDatabase error "
+ "constant: %d. Please file a bug to have this "
+ "value supported." % enumeration)
-_clang_getNumCompletionChunks = lib.clang_getNumCompletionChunks
-_clang_getNumCompletionChunks.argtypes = [c_void_p]
-_clang_getNumCompletionChunks.restype = c_int
+ self.cdb_error = enumeration
+ Exception.__init__(self, 'Error %d: %s' % (enumeration, message))
-_clang_getCompletionAvailability = lib.clang_getCompletionAvailability
-_clang_getCompletionAvailability.argtypes = [c_void_p]
-_clang_getCompletionAvailability.restype = c_int
+class CompileCommand(object):
+ """Represents the compile command used to build a file"""
+ def __init__(self, cmd, ccmds):
+ self.cmd = cmd
+ # Keep a reference to the originating CompileCommands
+ # to prevent garbage collection
+ self.ccmds = ccmds
-_clang_getCompletionPriority = lib.clang_getCompletionPriority
-_clang_getCompletionPriority.argtypes = [c_void_p]
-_clang_getCompletionPriority.restype = c_int
+ @property
+ def directory(self):
+ """Get the working directory for this CompileCommand"""
+ return lib.clang_CompileCommand_getDirectory(self.cmd)
+ @property
+ def arguments(self):
+ """
+ Get an iterable object providing each argument in the
+ command line for the compiler invocation as a _CXString.
-###
+ Invariant : the first argument is the compiler executable
+ """
+ length = lib.clang_CompileCommand_getNumArgs(self.cmd)
+ for i in xrange(length):
+ yield lib.clang_CompileCommand_getArg(self.cmd, i)
+
+class CompileCommands(object):
+ """
+ CompileCommands is an iterable object containing all CompileCommand
+ that can be used for building a specific file.
+ """
+ def __init__(self, ccmds):
+ self.ccmds = ccmds
+
+ def __del__(self):
+ lib.clang_CompileCommands_dispose(self.ccmds)
+
+ def __len__(self):
+ return int(lib.clang_CompileCommands_getSize(self.ccmds))
+
+ def __getitem__(self, i):
+ cc = lib.clang_CompileCommands_getCommand(self.ccmds, i)
+ if not cc:
+ raise IndexError
+ return CompileCommand(cc, self)
+
+ @staticmethod
+ def from_result(res, fn, args):
+ if not res:
+ return None
+ return CompileCommands(res)
+
+class CompilationDatabase(ClangObject):
+ """
+ The CompilationDatabase is a wrapper class around
+ clang::tooling::CompilationDatabase
+
+ It enables querying how a specific source file can be built.
+ """
+
+ def __del__(self):
+ lib.clang_CompilationDatabase_dispose(self)
+
+ @staticmethod
+ def from_result(res, fn, args):
+ if not res:
+ raise CompilationDatabaseError(0,
+ "CompilationDatabase loading failed")
+ return CompilationDatabase(res)
+
+ @staticmethod
+ def fromDirectory(buildDir):
+ """Builds a CompilationDatabase from the database found in buildDir"""
+ errorCode = c_uint()
+ try:
+ cdb = lib.clang_CompilationDatabase_fromDirectory(buildDir,
+ byref(errorCode))
+ except CompilationDatabaseError as e:
+ raise CompilationDatabaseError(int(errorCode.value),
+ "CompilationDatabase loading failed")
+ return cdb
+
+ def getCompileCommands(self, filename):
+ """
+ Get an iterable object providing all the CompileCommands available to
+ build filename. Returns None if filename is not found in the database.
+ """
+ return lib.clang_CompilationDatabase_getCompileCommands(self, filename)
+
+class Token(Structure):
+ """Represents a single token from the preprocessor.
+
+ Tokens are effectively segments of source code. Source code is first parsed
+ into tokens before being converted into the AST and Cursors.
+
+ Tokens are obtained from parsed TranslationUnit instances. You currently
+ can't create tokens manually.
+ """
+ _fields_ = [
+ ('int_data', c_uint * 4),
+ ('ptr_data', c_void_p)
+ ]
+
+ @property
+ def spelling(self):
+ """The spelling of this token.
+
+ This is the textual representation of the token in source.
+ """
+ return lib.clang_getTokenSpelling(self._tu, self)
+
+ @property
+ def kind(self):
+ """Obtain the TokenKind of the current token."""
+ return TokenKind.from_value(lib.clang_getTokenKind(self))
+
+ @property
+ def location(self):
+ """The SourceLocation this Token occurs at."""
+ return lib.clang_getTokenLocation(self._tu, self)
+
+ @property
+ def extent(self):
+ """The SourceRange this Token occupies."""
+ return lib.clang_getTokenExtent(self._tu, self)
+
+ @property
+ def cursor(self):
+ """The Cursor this Token corresponds to."""
+ cursor = Cursor()
+
+ lib.clang_annotateTokens(self._tu, byref(self), 1, byref(cursor))
+
+ return cursor
+
+# Now comes the plumbing to hook up the C library.
+
+# Register callback types in common container.
+callbacks['translation_unit_includes'] = CFUNCTYPE(None, c_object_p,
+ POINTER(SourceLocation), c_uint, py_object)
+callbacks['cursor_visit'] = CFUNCTYPE(c_int, Cursor, Cursor, py_object)
+
+def register_functions(lib):
+ """Register function prototypes with a libclang library instance.
+
+ This must be called as part of library instantiation so Python knows how
+ to call out to the shared library.
+ """
+ # Functions are registered in strictly alphabetical order.
+ lib.clang_annotateTokens.argtype = [TranslationUnit, POINTER(Token),
+ c_uint, POINTER(Cursor)]
+
+ lib.clang_CompilationDatabase_dispose.argtypes = [c_object_p]
+
+ lib.clang_CompilationDatabase_fromDirectory.argtypes = [c_char_p,
+ POINTER(c_uint)]
+ lib.clang_CompilationDatabase_fromDirectory.restype = c_object_p
+ lib.clang_CompilationDatabase_fromDirectory.errcheck = CompilationDatabase.from_result
+
+ lib.clang_CompilationDatabase_getCompileCommands.argtypes = [c_object_p, c_char_p]
+ lib.clang_CompilationDatabase_getCompileCommands.restype = c_object_p
+ lib.clang_CompilationDatabase_getCompileCommands.errcheck = CompileCommands.from_result
+
+ lib.clang_CompileCommands_dispose.argtypes = [c_object_p]
+
+ lib.clang_CompileCommands_getCommand.argtypes = [c_object_p, c_uint]
+ lib.clang_CompileCommands_getCommand.restype = c_object_p
+
+ lib.clang_CompileCommands_getSize.argtypes = [c_object_p]
+ lib.clang_CompileCommands_getSize.restype = c_uint
+
+ lib.clang_CompileCommand_getArg.argtypes = [c_object_p, c_uint]
+ lib.clang_CompileCommand_getArg.restype = _CXString
+ lib.clang_CompileCommand_getArg.errcheck = _CXString.from_result
+
+ lib.clang_CompileCommand_getDirectory.argtypes = [c_object_p]
+ lib.clang_CompileCommand_getDirectory.restype = _CXString
+ lib.clang_CompileCommand_getDirectory.errcheck = _CXString.from_result
+
+ lib.clang_CompileCommand_getNumArgs.argtypes = [c_object_p]
+ lib.clang_CompileCommand_getNumArgs.restype = c_uint
+
+ lib.clang_codeCompleteAt.argtypes = [TranslationUnit, c_char_p, c_int,
+ c_int, c_void_p, c_int, c_int]
+ lib.clang_codeCompleteAt.restype = POINTER(CCRStructure)
+
+ lib.clang_codeCompleteGetDiagnostic.argtypes = [CodeCompletionResults,
+ c_int]
+ lib.clang_codeCompleteGetDiagnostic.restype = Diagnostic
+
+ lib.clang_codeCompleteGetNumDiagnostics.argtypes = [CodeCompletionResults]
+ lib.clang_codeCompleteGetNumDiagnostics.restype = c_int
+
+ lib.clang_createIndex.argtypes = [c_int, c_int]
+ lib.clang_createIndex.restype = c_object_p
+
+ lib.clang_createTranslationUnit.argtypes = [Index, c_char_p]
+ lib.clang_createTranslationUnit.restype = c_object_p
+
+ lib.clang_CXXMethod_isStatic.argtypes = [Cursor]
+ lib.clang_CXXMethod_isStatic.restype = bool
+
+ lib.clang_CXXMethod_isVirtual.argtypes = [Cursor]
+ lib.clang_CXXMethod_isVirtual.restype = bool
+
+ lib.clang_defaultSaveOptions.argtypes = [TranslationUnit]
+ lib.clang_defaultSaveOptions.restype = c_uint
+
+ lib.clang_disposeCodeCompleteResults.argtypes = [CodeCompletionResults]
+
+ #lib.clang_disposeCXTUResourceUsage.argtypes = [CXTUResourceUsage]
+
+ lib.clang_disposeDiagnostic.argtypes = [Diagnostic]
+
+ lib.clang_disposeIndex.argtypes = [Index]
+
+ lib.clang_disposeString.argtypes = [_CXString]
+
+ lib.clang_disposeTokens.argtype = [TranslationUnit, POINTER(Token), c_uint]
+
+ lib.clang_disposeTranslationUnit.argtypes = [TranslationUnit]
+
+ lib.clang_equalCursors.argtypes = [Cursor, Cursor]
+ lib.clang_equalCursors.restype = bool
+
+ lib.clang_equalLocations.argtypes = [SourceLocation, SourceLocation]
+ lib.clang_equalLocations.restype = bool
+
+ lib.clang_equalRanges.argtypes = [SourceRange, SourceRange]
+ lib.clang_equalRanges.restype = bool
+
+ lib.clang_equalTypes.argtypes = [Type, Type]
+ lib.clang_equalTypes.restype = bool
+
+ lib.clang_getArgType.argtypes = [Type, c_uint]
+ lib.clang_getArgType.restype = Type
+ lib.clang_getArgType.errcheck = Type.from_result
+
+ lib.clang_getArrayElementType.argtypes = [Type]
+ lib.clang_getArrayElementType.restype = Type
+ lib.clang_getArrayElementType.errcheck = Type.from_result
+
+ lib.clang_getArraySize.argtypes = [Type]
+ lib.clang_getArraySize.restype = c_longlong
+
+ lib.clang_getCanonicalCursor.argtypes = [Cursor]
+ lib.clang_getCanonicalCursor.restype = Cursor
+ lib.clang_getCanonicalCursor.errcheck = Cursor.from_cursor_result
+
+ lib.clang_getCanonicalType.argtypes = [Type]
+ lib.clang_getCanonicalType.restype = Type
+ lib.clang_getCanonicalType.errcheck = Type.from_result
+
+ lib.clang_getCompletionAvailability.argtypes = [c_void_p]
+ lib.clang_getCompletionAvailability.restype = c_int
+
+ lib.clang_getCompletionChunkCompletionString.argtypes = [c_void_p, c_int]
+ lib.clang_getCompletionChunkCompletionString.restype = c_object_p
+
+ lib.clang_getCompletionChunkKind.argtypes = [c_void_p, c_int]
+ lib.clang_getCompletionChunkKind.restype = c_int
+
+ lib.clang_getCompletionChunkText.argtypes = [c_void_p, c_int]
+ lib.clang_getCompletionChunkText.restype = _CXString
+
+ lib.clang_getCompletionPriority.argtypes = [c_void_p]
+ lib.clang_getCompletionPriority.restype = c_int
+
+ lib.clang_getCString.argtypes = [_CXString]
+ lib.clang_getCString.restype = c_char_p
+
+ lib.clang_getCursor.argtypes = [TranslationUnit, SourceLocation]
+ lib.clang_getCursor.restype = Cursor
+
+ lib.clang_getCursorDefinition.argtypes = [Cursor]
+ lib.clang_getCursorDefinition.restype = Cursor
+ lib.clang_getCursorDefinition.errcheck = Cursor.from_result
+
+ lib.clang_getCursorDisplayName.argtypes = [Cursor]
+ lib.clang_getCursorDisplayName.restype = _CXString
+ lib.clang_getCursorDisplayName.errcheck = _CXString.from_result
+
+ lib.clang_getCursorExtent.argtypes = [Cursor]
+ lib.clang_getCursorExtent.restype = SourceRange
+
+ lib.clang_getCursorLexicalParent.argtypes = [Cursor]
+ lib.clang_getCursorLexicalParent.restype = Cursor
+ lib.clang_getCursorLexicalParent.errcheck = Cursor.from_cursor_result
+
+ lib.clang_getCursorLocation.argtypes = [Cursor]
+ lib.clang_getCursorLocation.restype = SourceLocation
+
+ lib.clang_getCursorReferenced.argtypes = [Cursor]
+ lib.clang_getCursorReferenced.restype = Cursor
+ lib.clang_getCursorReferenced.errcheck = Cursor.from_result
+
+ lib.clang_getCursorReferenceNameRange.argtypes = [Cursor, c_uint, c_uint]
+ lib.clang_getCursorReferenceNameRange.restype = SourceRange
+
+ lib.clang_getCursorSemanticParent.argtypes = [Cursor]
+ lib.clang_getCursorSemanticParent.restype = Cursor
+ lib.clang_getCursorSemanticParent.errcheck = Cursor.from_cursor_result
+
+ lib.clang_getCursorSpelling.argtypes = [Cursor]
+ lib.clang_getCursorSpelling.restype = _CXString
+ lib.clang_getCursorSpelling.errcheck = _CXString.from_result
+
+ lib.clang_getCursorType.argtypes = [Cursor]
+ lib.clang_getCursorType.restype = Type
+ lib.clang_getCursorType.errcheck = Type.from_result
+
+ lib.clang_getCursorUSR.argtypes = [Cursor]
+ lib.clang_getCursorUSR.restype = _CXString
+ lib.clang_getCursorUSR.errcheck = _CXString.from_result
+
+ #lib.clang_getCXTUResourceUsage.argtypes = [TranslationUnit]
+ #lib.clang_getCXTUResourceUsage.restype = CXTUResourceUsage
+
+ lib.clang_getCXXAccessSpecifier.argtypes = [Cursor]
+ lib.clang_getCXXAccessSpecifier.restype = c_uint
+
+ lib.clang_getDeclObjCTypeEncoding.argtypes = [Cursor]
+ lib.clang_getDeclObjCTypeEncoding.restype = _CXString
+ lib.clang_getDeclObjCTypeEncoding.errcheck = _CXString.from_result
+
+ lib.clang_getDiagnostic.argtypes = [c_object_p, c_uint]
+ lib.clang_getDiagnostic.restype = c_object_p
+
+ lib.clang_getDiagnosticCategory.argtypes = [Diagnostic]
+ lib.clang_getDiagnosticCategory.restype = c_uint
+
+ lib.clang_getDiagnosticCategoryName.argtypes = [c_uint]
+ lib.clang_getDiagnosticCategoryName.restype = _CXString
+ lib.clang_getDiagnosticCategoryName.errcheck = _CXString.from_result
+
+ lib.clang_getDiagnosticFixIt.argtypes = [Diagnostic, c_uint,
+ POINTER(SourceRange)]
+ lib.clang_getDiagnosticFixIt.restype = _CXString
+ lib.clang_getDiagnosticFixIt.errcheck = _CXString.from_result
+
+ lib.clang_getDiagnosticLocation.argtypes = [Diagnostic]
+ lib.clang_getDiagnosticLocation.restype = SourceLocation
+
+ lib.clang_getDiagnosticNumFixIts.argtypes = [Diagnostic]
+ lib.clang_getDiagnosticNumFixIts.restype = c_uint
+
+ lib.clang_getDiagnosticNumRanges.argtypes = [Diagnostic]
+ lib.clang_getDiagnosticNumRanges.restype = c_uint
+
+ lib.clang_getDiagnosticOption.argtypes = [Diagnostic, POINTER(_CXString)]
+ lib.clang_getDiagnosticOption.restype = _CXString
+ lib.clang_getDiagnosticOption.errcheck = _CXString.from_result
+
+ lib.clang_getDiagnosticRange.argtypes = [Diagnostic, c_uint]
+ lib.clang_getDiagnosticRange.restype = SourceRange
+
+ lib.clang_getDiagnosticSeverity.argtypes = [Diagnostic]
+ lib.clang_getDiagnosticSeverity.restype = c_int
+
+ lib.clang_getDiagnosticSpelling.argtypes = [Diagnostic]
+ lib.clang_getDiagnosticSpelling.restype = _CXString
+ lib.clang_getDiagnosticSpelling.errcheck = _CXString.from_result
+
+ lib.clang_getElementType.argtypes = [Type]
+ lib.clang_getElementType.restype = Type
+ lib.clang_getElementType.errcheck = Type.from_result
+
+ lib.clang_getEnumConstantDeclUnsignedValue.argtypes = [Cursor]
+ lib.clang_getEnumConstantDeclUnsignedValue.restype = c_ulonglong
+
+ lib.clang_getEnumConstantDeclValue.argtypes = [Cursor]
+ lib.clang_getEnumConstantDeclValue.restype = c_longlong
+
+ lib.clang_getEnumDeclIntegerType.argtypes = [Cursor]
+ lib.clang_getEnumDeclIntegerType.restype = Type
+ lib.clang_getEnumDeclIntegerType.errcheck = Type.from_result
+
+ lib.clang_getFile.argtypes = [TranslationUnit, c_char_p]
+ lib.clang_getFile.restype = c_object_p
+
+ lib.clang_getFileName.argtypes = [File]
+ lib.clang_getFileName.restype = _CXString
+ # TODO go through _CXString.from_result?
+
+ lib.clang_getFileTime.argtypes = [File]
+ lib.clang_getFileTime.restype = c_uint
+
+ lib.clang_getIBOutletCollectionType.argtypes = [Cursor]
+ lib.clang_getIBOutletCollectionType.restype = Type
+ lib.clang_getIBOutletCollectionType.errcheck = Type.from_result
+
+ lib.clang_getIncludedFile.argtypes = [Cursor]
+ lib.clang_getIncludedFile.restype = File
+ lib.clang_getIncludedFile.errcheck = File.from_cursor_result
+
+ lib.clang_getInclusions.argtypes = [TranslationUnit,
+ callbacks['translation_unit_includes'], py_object]
+
+ lib.clang_getInstantiationLocation.argtypes = [SourceLocation,
+ POINTER(c_object_p), POINTER(c_uint), POINTER(c_uint), POINTER(c_uint)]
+
+ lib.clang_getLocation.argtypes = [TranslationUnit, File, c_uint, c_uint]
+ lib.clang_getLocation.restype = SourceLocation
+
+ lib.clang_getLocationForOffset.argtypes = [TranslationUnit, File, c_uint]
+ lib.clang_getLocationForOffset.restype = SourceLocation
+
+ lib.clang_getNullCursor.restype = Cursor
+
+ lib.clang_getNumArgTypes.argtypes = [Type]
+ lib.clang_getNumArgTypes.restype = c_uint
+
+ lib.clang_getNumCompletionChunks.argtypes = [c_void_p]
+ lib.clang_getNumCompletionChunks.restype = c_int
+
+ lib.clang_getNumDiagnostics.argtypes = [c_object_p]
+ lib.clang_getNumDiagnostics.restype = c_uint
+
+ lib.clang_getNumElements.argtypes = [Type]
+ lib.clang_getNumElements.restype = c_longlong
+
+ lib.clang_getNumOverloadedDecls.argtypes = [Cursor]
+ lib.clang_getNumOverloadedDecls.restyp = c_uint
+
+ lib.clang_getOverloadedDecl.argtypes = [Cursor, c_uint]
+ lib.clang_getOverloadedDecl.restype = Cursor
+ lib.clang_getOverloadedDecl.errcheck = Cursor.from_cursor_result
+
+ lib.clang_getPointeeType.argtypes = [Type]
+ lib.clang_getPointeeType.restype = Type
+ lib.clang_getPointeeType.errcheck = Type.from_result
+
+ lib.clang_getRange.argtypes = [SourceLocation, SourceLocation]
+ lib.clang_getRange.restype = SourceRange
+
+ lib.clang_getRangeEnd.argtypes = [SourceRange]
+ lib.clang_getRangeEnd.restype = SourceLocation
+
+ lib.clang_getRangeStart.argtypes = [SourceRange]
+ lib.clang_getRangeStart.restype = SourceLocation
+
+ lib.clang_getResultType.argtypes = [Type]
+ lib.clang_getResultType.restype = Type
+ lib.clang_getResultType.errcheck = Type.from_result
+
+ lib.clang_getSpecializedCursorTemplate.argtypes = [Cursor]
+ lib.clang_getSpecializedCursorTemplate.restype = Cursor
+ lib.clang_getSpecializedCursorTemplate.errcheck = Cursor.from_cursor_result
+
+ lib.clang_getTemplateCursorKind.argtypes = [Cursor]
+ lib.clang_getTemplateCursorKind.restype = c_uint
+
+ lib.clang_getTokenExtent.argtypes = [TranslationUnit, Token]
+ lib.clang_getTokenExtent.restype = SourceRange
+
+ lib.clang_getTokenKind.argtypes = [Token]
+ lib.clang_getTokenKind.restype = c_uint
+
+ lib.clang_getTokenLocation.argtype = [TranslationUnit, Token]
+ lib.clang_getTokenLocation.restype = SourceLocation
+
+ lib.clang_getTokenSpelling.argtype = [TranslationUnit, Token]
+ lib.clang_getTokenSpelling.restype = _CXString
+ lib.clang_getTokenSpelling.errcheck = _CXString.from_result
+
+ lib.clang_getTranslationUnitCursor.argtypes = [TranslationUnit]
+ lib.clang_getTranslationUnitCursor.restype = Cursor
+ lib.clang_getTranslationUnitCursor.errcheck = Cursor.from_result
+
+ lib.clang_getTranslationUnitSpelling.argtypes = [TranslationUnit]
+ lib.clang_getTranslationUnitSpelling.restype = _CXString
+ lib.clang_getTranslationUnitSpelling.errcheck = _CXString.from_result
+
+ lib.clang_getTUResourceUsageName.argtypes = [c_uint]
+ lib.clang_getTUResourceUsageName.restype = c_char_p
+
+ lib.clang_getTypeDeclaration.argtypes = [Type]
+ lib.clang_getTypeDeclaration.restype = Cursor
+ lib.clang_getTypeDeclaration.errcheck = Cursor.from_result
+
+ lib.clang_getTypedefDeclUnderlyingType.argtypes = [Cursor]
+ lib.clang_getTypedefDeclUnderlyingType.restype = Type
+ lib.clang_getTypedefDeclUnderlyingType.errcheck = Type.from_result
+
+ lib.clang_getTypeKindSpelling.argtypes = [c_uint]
+ lib.clang_getTypeKindSpelling.restype = _CXString
+ lib.clang_getTypeKindSpelling.errcheck = _CXString.from_result
+
+ lib.clang_hashCursor.argtypes = [Cursor]
+ lib.clang_hashCursor.restype = c_uint
+
+ lib.clang_isAttribute.argtypes = [CursorKind]
+ lib.clang_isAttribute.restype = bool
+
+ lib.clang_isConstQualifiedType.argtypes = [Type]
+ lib.clang_isConstQualifiedType.restype = bool
+
+ lib.clang_isCursorDefinition.argtypes = [Cursor]
+ lib.clang_isCursorDefinition.restype = bool
+
+ lib.clang_isDeclaration.argtypes = [CursorKind]
+ lib.clang_isDeclaration.restype = bool
+
+ lib.clang_isExpression.argtypes = [CursorKind]
+ lib.clang_isExpression.restype = bool
+
+ lib.clang_isFileMultipleIncludeGuarded.argtypes = [TranslationUnit, File]
+ lib.clang_isFileMultipleIncludeGuarded.restype = bool
+
+ lib.clang_isFunctionTypeVariadic.argtypes = [Type]
+ lib.clang_isFunctionTypeVariadic.restype = bool
+
+ lib.clang_isInvalid.argtypes = [CursorKind]
+ lib.clang_isInvalid.restype = bool
+
+ lib.clang_isPODType.argtypes = [Type]
+ lib.clang_isPODType.restype = bool
+
+ lib.clang_isPreprocessing.argtypes = [CursorKind]
+ lib.clang_isPreprocessing.restype = bool
+
+ lib.clang_isReference.argtypes = [CursorKind]
+ lib.clang_isReference.restype = bool
+
+ lib.clang_isRestrictQualifiedType.argtypes = [Type]
+ lib.clang_isRestrictQualifiedType.restype = bool
+
+ lib.clang_isStatement.argtypes = [CursorKind]
+ lib.clang_isStatement.restype = bool
+
+ lib.clang_isTranslationUnit.argtypes = [CursorKind]
+ lib.clang_isTranslationUnit.restype = bool
+
+ lib.clang_isUnexposed.argtypes = [CursorKind]
+ lib.clang_isUnexposed.restype = bool
+
+ lib.clang_isVirtualBase.argtypes = [Cursor]
+ lib.clang_isVirtualBase.restype = bool
+
+ lib.clang_isVolatileQualifiedType.argtypes = [Type]
+ lib.clang_isVolatileQualifiedType.restype = bool
+
+ lib.clang_parseTranslationUnit.argypes = [Index, c_char_p, c_void_p, c_int,
+ c_void_p, c_int, c_int]
+ lib.clang_parseTranslationUnit.restype = c_object_p
+
+ lib.clang_reparseTranslationUnit.argtypes = [TranslationUnit, c_int,
+ c_void_p, c_int]
+ lib.clang_reparseTranslationUnit.restype = c_int
+
+ lib.clang_saveTranslationUnit.argtypes = [TranslationUnit, c_char_p,
+ c_uint]
+ lib.clang_saveTranslationUnit.restype = c_int
+
+ lib.clang_tokenize.argtypes = [TranslationUnit, SourceRange,
+ POINTER(POINTER(Token)), POINTER(c_uint)]
+
+ lib.clang_visitChildren.argtypes = [Cursor, callbacks['cursor_visit'],
+ py_object]
+ lib.clang_visitChildren.restype = c_uint
+
+register_functions(lib)
+
+def register_enumerations():
+ for name, value in clang.enumerations.TokenKinds:
+ TokenKind.register(value, name)
+
+register_enumerations()
-__all__ = ['Index', 'TranslationUnit', 'Cursor', 'CursorKind', 'Type', 'TypeKind',
- 'Diagnostic', 'FixIt', 'CodeCompletionResults', 'SourceRange',
- 'SourceLocation', 'File']
+__all__ = [
+ 'CodeCompletionResults',
+ 'CompilationDatabase',
+ 'CompileCommands',
+ 'CompileCommand',
+ 'CursorKind',
+ 'Cursor',
+ 'Diagnostic',
+ 'File',
+ 'FixIt',
+ 'Index',
+ 'SourceLocation',
+ 'SourceRange',
+ 'TokenKind',
+ 'Token',
+ 'TranslationUnitLoadError',
+ 'TranslationUnit',
+ 'TypeKind',
+ 'Type',
+]
diff --git a/bindings/python/clang/enumerations.py b/bindings/python/clang/enumerations.py
new file mode 100644
index 000000000000..a86a48ade3bd
--- /dev/null
+++ b/bindings/python/clang/enumerations.py
@@ -0,0 +1,34 @@
+#===- enumerations.py - Python Enumerations ------------------*- python -*--===#
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+"""
+Clang Enumerations
+==================
+
+This module provides static definitions of enumerations that exist in libclang.
+
+Enumerations are typically defined as a list of tuples. The exported values are
+typically munged into other types or classes at module load time.
+
+All enumerations are centrally defined in this file so they are all grouped
+together and easier to audit. And, maybe even one day this file will be
+automatically generated by scanning the libclang headers!
+"""
+
+# Maps to CXTokenKind. Note that libclang maintains a separate set of token
+# enumerations from the C++ API.
+TokenKinds = [
+ ('PUNCTUATION', 0),
+ ('KEYWORD', 1),
+ ('IDENTIFIER', 2),
+ ('LITERAL', 3),
+ ('COMMENT', 4),
+]
+
+__all__ = ['TokenKinds']
diff --git a/bindings/python/tests/cindex/INPUTS/compile_commands.json b/bindings/python/tests/cindex/INPUTS/compile_commands.json
new file mode 100644
index 000000000000..944150bf7ba6
--- /dev/null
+++ b/bindings/python/tests/cindex/INPUTS/compile_commands.json
@@ -0,0 +1,17 @@
+[
+{
+ "directory": "/home/john.doe/MyProject",
+ "command": "clang++ -o project.o -c /home/john.doe/MyProject/project.cpp",
+ "file": "/home/john.doe/MyProject/project.cpp"
+},
+{
+ "directory": "/home/john.doe/MyProjectA",
+ "command": "clang++ -o project2.o -c /home/john.doe/MyProject/project2.cpp",
+ "file": "/home/john.doe/MyProject/project2.cpp"
+},
+{
+ "directory": "/home/john.doe/MyProjectB",
+ "command": "clang++ -DFEATURE=1 -o project2-feature.o -c /home/john.doe/MyProject/project2.cpp",
+ "file": "/home/john.doe/MyProject/project2.cpp"
+}
+]
diff --git a/bindings/python/tests/cindex/test_cdb.py b/bindings/python/tests/cindex/test_cdb.py
new file mode 100644
index 000000000000..d0f580ea9f47
--- /dev/null
+++ b/bindings/python/tests/cindex/test_cdb.py
@@ -0,0 +1,89 @@
+from clang.cindex import CompilationDatabase
+from clang.cindex import CompilationDatabaseError
+from clang.cindex import CompileCommands
+from clang.cindex import CompileCommand
+import os
+import gc
+
+kInputsDir = os.path.join(os.path.dirname(__file__), 'INPUTS')
+
+def test_create_fail():
+ """Check we fail loading a database with an assertion"""
+ path = os.path.dirname(__file__)
+ try:
+ cdb = CompilationDatabase.fromDirectory(path)
+ except CompilationDatabaseError as e:
+ assert e.cdb_error == CompilationDatabaseError.ERROR_CANNOTLOADDATABASE
+ else:
+ assert False
+
+def test_create():
+ """Check we can load a compilation database"""
+ cdb = CompilationDatabase.fromDirectory(kInputsDir)
+
+def test_lookup_fail():
+ """Check file lookup failure"""
+ cdb = CompilationDatabase.fromDirectory(kInputsDir)
+ assert cdb.getCompileCommands('file_do_not_exist.cpp') == None
+
+def test_lookup_succeed():
+ """Check we get some results if the file exists in the db"""
+ cdb = CompilationDatabase.fromDirectory(kInputsDir)
+ cmds = cdb.getCompileCommands('/home/john.doe/MyProject/project.cpp')
+ assert len(cmds) != 0
+
+def test_1_compilecommand():
+ """Check file with single compile command"""
+ cdb = CompilationDatabase.fromDirectory(kInputsDir)
+ cmds = cdb.getCompileCommands('/home/john.doe/MyProject/project.cpp')
+ assert len(cmds) == 1
+ assert cmds[0].directory == '/home/john.doe/MyProject'
+ expected = [ 'clang++', '-o', 'project.o', '-c',
+ '/home/john.doe/MyProject/project.cpp']
+ for arg, exp in zip(cmds[0].arguments, expected):
+ assert arg == exp
+
+def test_2_compilecommand():
+ """Check file with 2 compile commands"""
+ cdb = CompilationDatabase.fromDirectory(kInputsDir)
+ cmds = cdb.getCompileCommands('/home/john.doe/MyProject/project2.cpp')
+ assert len(cmds) == 2
+ expected = [
+ { 'wd': '/home/john.doe/MyProjectA',
+ 'line': ['clang++', '-o', 'project2.o', '-c',
+ '/home/john.doe/MyProject/project2.cpp']},
+ { 'wd': '/home/john.doe/MyProjectB',
+ 'line': ['clang++', '-DFEATURE=1', '-o', 'project2-feature.o', '-c',
+ '/home/john.doe/MyProject/project2.cpp']}
+ ]
+ for i in range(len(cmds)):
+ assert cmds[i].directory == expected[i]['wd']
+ for arg, exp in zip(cmds[i].arguments, expected[i]['line']):
+ assert arg == exp
+
+def test_compilecommand_iterator_stops():
+ """Check that iterator stops after the correct number of elements"""
+ cdb = CompilationDatabase.fromDirectory(kInputsDir)
+ count = 0
+ for cmd in cdb.getCompileCommands('/home/john.doe/MyProject/project2.cpp'):
+ count += 1
+ assert count <= 2
+