From ecb7e5c8afe929ee38155db94de6b084ec32a645 Mon Sep 17 00:00:00 2001
From: Roman Divacky
Date: Tue, 16 Feb 2010 09:31:36 +0000
Subject: Update clang to r96341.
---
bindings/python/README.txt | 18 +
bindings/python/clang/__init__.py | 24 +
bindings/python/clang/cindex.py | 933 +++++
bindings/python/examples/cindex/cindex-dump.py | 87 +
bindings/python/examples/cindex/cindex-includes.py | 58 +
bindings/python/tests/__init__.py | 0
bindings/python/tests/cindex/INPUTS/header1.h | 6 +
bindings/python/tests/cindex/INPUTS/header2.h | 6 +
bindings/python/tests/cindex/INPUTS/header3.h | 3 +
bindings/python/tests/cindex/INPUTS/hello.cpp | 6 +
bindings/python/tests/cindex/INPUTS/include.cpp | 5 +
.../python/tests/cindex/INPUTS/parse_arguments.c | 2 +
bindings/python/tests/cindex/__init__.py | 0
bindings/python/tests/cindex/test_cursor.py | 59 +
bindings/python/tests/cindex/test_cursor_kind.py | 27 +
bindings/python/tests/cindex/test_diagnostics.py | 48 +
bindings/python/tests/cindex/test_index.py | 15 +
.../python/tests/cindex/test_translation_unit.py | 73 +
clang.xcodeproj/project.pbxproj | 42 +-
docs/LanguageExtensions.html | 22 +-
docs/UsersManual.html | 6 +-
examples/PrintFunctionNames/Makefile | 1 -
examples/wpa/Makefile | 1 -
include/clang-c/Index.h | 827 +++--
include/clang/AST/ASTContext.h | 46 +-
include/clang/AST/ASTDiagnostic.h | 22 +-
include/clang/AST/ASTImporter.h | 234 ++
include/clang/AST/Attr.h | 78 +-
include/clang/AST/CXXInheritance.h | 11 +-
include/clang/AST/Decl.h | 377 +-
include/clang/AST/DeclBase.h | 86 +-
include/clang/AST/DeclCXX.h | 512 +--
include/clang/AST/DeclObjC.h | 70 +-
include/clang/AST/DeclTemplate.h | 53 +-
include/clang/AST/DeclarationName.h | 12 +-
include/clang/AST/Expr.h | 19 +-
include/clang/AST/ExprCXX.h | 418 ++-
include/clang/AST/ExprObjC.h | 10 +-
include/clang/AST/Stmt.h | 93 +-
include/clang/AST/StmtCXX.h | 27 +-
include/clang/AST/StmtNodes.def | 9 +-
include/clang/AST/StmtVisitor.h | 1 +
include/clang/AST/Type.h | 170 +-
include/clang/AST/TypeNodes.def | 5 +
include/clang/AST/UnresolvedSet.h | 116 +-
.../clang/Analysis/Analyses/PrintfFormatString.h | 279 ++
.../clang/Analysis/Analyses/UninitializedValues.h | 3 +
include/clang/Analysis/AnalysisContext.h | 260 ++
include/clang/Analysis/LocalCheckers.h | 63 -
include/clang/Analysis/ManagerRegistry.h | 53 -
include/clang/Analysis/PathDiagnostic.h | 494 ---
.../clang/Analysis/PathSensitive/AnalysisContext.h | 277 --
.../clang/Analysis/PathSensitive/AnalysisManager.h | 149 -
.../Analysis/PathSensitive/BasicValueFactory.h | 198 -
include/clang/Analysis/PathSensitive/BugReporter.h | 473 ---
include/clang/Analysis/PathSensitive/BugType.h | 76 -
include/clang/Analysis/PathSensitive/Checker.h | 281 --
.../Analysis/PathSensitive/CheckerVisitor.def | 38 -
.../clang/Analysis/PathSensitive/CheckerVisitor.h | 101 -
.../PathSensitive/Checkers/DereferenceChecker.h | 31 -
.../Analysis/PathSensitive/ConstraintManager.h | 75 -
include/clang/Analysis/PathSensitive/Environment.h | 103 -
.../clang/Analysis/PathSensitive/ExplodedGraph.h | 432 ---
include/clang/Analysis/PathSensitive/GRAuditor.h | 35 -
.../clang/Analysis/PathSensitive/GRBlockCounter.h | 50 -
.../clang/Analysis/PathSensitive/GRCoreEngine.h | 443 ---
.../clang/Analysis/PathSensitive/GRExprEngine.h | 433 ---
.../Analysis/PathSensitive/GRExprEngineBuilders.h | 76 -
.../Analysis/PathSensitive/GRSimpleAPICheck.h | 40 -
include/clang/Analysis/PathSensitive/GRState.h | 751 ----
.../clang/Analysis/PathSensitive/GRStateTrait.h | 148 -
include/clang/Analysis/PathSensitive/GRSubEngine.h | 75 -
.../clang/Analysis/PathSensitive/GRTransferFuncs.h | 85 -
include/clang/Analysis/PathSensitive/GRWorkList.h | 79 -
include/clang/Analysis/PathSensitive/MemRegion.h | 971 -----
include/clang/Analysis/PathSensitive/SVals.h | 499 ---
include/clang/Analysis/PathSensitive/SValuator.h | 91 -
include/clang/Analysis/PathSensitive/Store.h | 220 --
.../clang/Analysis/PathSensitive/SymbolManager.h | 385 --
.../clang/Analysis/PathSensitive/ValueManager.h | 208 --
include/clang/Analysis/Support/Optional.h | 12 +-
include/clang/Basic/Builtins.def | 39 +-
include/clang/Basic/Diagnostic.h | 27 +-
include/clang/Basic/DiagnosticASTKinds.td | 29 +
include/clang/Basic/DiagnosticCommonKinds.td | 3 +
include/clang/Basic/DiagnosticDriverKinds.td | 4 +
include/clang/Basic/DiagnosticFrontendKinds.td | 11 +
include/clang/Basic/DiagnosticGroups.td | 6 +-
include/clang/Basic/DiagnosticParseKinds.td | 15 +-
include/clang/Basic/DiagnosticSemaKinds.td | 152 +-
include/clang/Basic/LangOptions.h | 14 +-
include/clang/Basic/Linkage.h | 57 +
include/clang/Basic/PartialDiagnostic.h | 2 +-
include/clang/Basic/SourceManager.h | 8 +
include/clang/Basic/Specifiers.h | 3 +-
include/clang/Basic/TargetInfo.h | 19 +-
include/clang/Basic/TokenKinds.def | 10 +-
include/clang/Basic/Version.h | 6 +-
include/clang/Checker/BugReporter/BugReporter.h | 477 +++
include/clang/Checker/BugReporter/BugType.h | 75 +
include/clang/Checker/BugReporter/PathDiagnostic.h | 494 +++
.../clang/Checker/Checkers/DereferenceChecker.h | 31 +
include/clang/Checker/Checkers/LocalCheckers.h | 61 +
.../Checker/DomainSpecific/CocoaConventions.h | 40 +
include/clang/Checker/ManagerRegistry.h | 53 +
.../clang/Checker/PathSensitive/AnalysisManager.h | 149 +
.../Checker/PathSensitive/BasicValueFactory.h | 198 +
include/clang/Checker/PathSensitive/Checker.h | 281 ++
.../clang/Checker/PathSensitive/CheckerVisitor.def | 37 +
.../clang/Checker/PathSensitive/CheckerVisitor.h | 102 +
.../Checker/PathSensitive/ConstraintManager.h | 75 +
include/clang/Checker/PathSensitive/Environment.h | 103 +
.../clang/Checker/PathSensitive/ExplodedGraph.h | 432 +++
include/clang/Checker/PathSensitive/GRAuditor.h | 35 +
.../clang/Checker/PathSensitive/GRBlockCounter.h | 50 +
include/clang/Checker/PathSensitive/GRCoreEngine.h | 443 +++
include/clang/Checker/PathSensitive/GRExprEngine.h | 422 +++
.../Checker/PathSensitive/GRExprEngineBuilders.h | 76 +
.../clang/Checker/PathSensitive/GRSimpleAPICheck.h | 40 +
include/clang/Checker/PathSensitive/GRState.h | 756 ++++
include/clang/Checker/PathSensitive/GRStateTrait.h | 148 +
include/clang/Checker/PathSensitive/GRSubEngine.h | 75 +
.../clang/Checker/PathSensitive/GRTransferFuncs.h | 85 +
include/clang/Checker/PathSensitive/GRWorkList.h | 79 +
include/clang/Checker/PathSensitive/MemRegion.h | 974 +++++
include/clang/Checker/PathSensitive/SVals.h | 499 +++
include/clang/Checker/PathSensitive/SValuator.h | 66 +
include/clang/Checker/PathSensitive/Store.h | 230 ++
.../clang/Checker/PathSensitive/SummaryManager.h | 57 +
.../clang/Checker/PathSensitive/SymbolManager.h | 385 ++
include/clang/Checker/PathSensitive/ValueManager.h | 208 ++
include/clang/CodeGen/CodeGenOptions.h | 5 +-
include/clang/Driver/CC1Options.td | 32 +-
include/clang/Driver/Driver.h | 28 +-
include/clang/Driver/Options.td | 17 +-
include/clang/Driver/Tool.h | 1 +
include/clang/Driver/ToolChain.h | 18 +-
include/clang/Driver/Types.def | 1 +
include/clang/Frontend/ASTConsumers.h | 7 +-
include/clang/Frontend/ASTUnit.h | 10 +-
include/clang/Frontend/Analyses.def | 17 +-
include/clang/Frontend/CompilerInstance.h | 74 +-
include/clang/Frontend/DiagnosticOptions.h | 6 +-
include/clang/Frontend/FrontendAction.h | 8 +-
include/clang/Frontend/FrontendActions.h | 44 +
include/clang/Frontend/FrontendOptions.h | 4 +
include/clang/Frontend/PCHBitCodes.h | 12 +-
include/clang/Frontend/PCHReader.h | 4 +
include/clang/Lex/Lexer.h | 3 +
include/clang/Lex/Token.h | 4 +
include/clang/Parse/Action.h | 17 +-
include/clang/Parse/DeclSpec.h | 13 +-
include/clang/Parse/Parser.h | 92 +-
lib/AST/ASTContext.cpp | 247 +-
lib/AST/ASTDiagnostic.cpp | 266 ++
lib/AST/ASTImporter.cpp | 2394 +++++++++++++
lib/AST/AttrImpl.cpp | 65 +-
lib/AST/CMakeLists.txt | 2 +
lib/AST/CXXInheritance.cpp | 14 +-
lib/AST/Decl.cpp | 734 ++--
lib/AST/DeclBase.cpp | 35 +-
lib/AST/DeclCXX.cpp | 123 +-
lib/AST/DeclObjC.cpp | 14 +-
lib/AST/DeclPrinter.cpp | 62 +-
lib/AST/DeclTemplate.cpp | 3 +-
lib/AST/DeclarationName.cpp | 47 +-
lib/AST/Expr.cpp | 134 +-
lib/AST/ExprCXX.cpp | 100 +-
lib/AST/ExprConstant.cpp | 39 +-
lib/AST/Makefile | 1 -
lib/AST/RecordLayoutBuilder.cpp | 9 +-
lib/AST/Stmt.cpp | 148 +-
lib/AST/StmtDumper.cpp | 2 +
lib/AST/StmtPrinter.cpp | 4 +
lib/AST/StmtProfile.cpp | 4 +
lib/AST/Type.cpp | 154 +-
lib/AST/TypePrinter.cpp | 40 +-
lib/Analysis/AnalysisContext.cpp | 48 +-
lib/Analysis/ArrayBoundChecker.cpp | 91 -
lib/Analysis/AttrNonNullChecker.cpp | 112 -
lib/Analysis/BasicConstraintManager.cpp | 317 --
lib/Analysis/BasicObjCFoundationChecks.cpp | 598 ---
lib/Analysis/BasicObjCFoundationChecks.h | 41 -
lib/Analysis/BasicStore.cpp | 625 ----
lib/Analysis/BasicValueFactory.cpp | 290 --
lib/Analysis/BugReporter.cpp | 1879 ----------
lib/Analysis/BugReporterVisitors.cpp | 349 --
lib/Analysis/BuiltinFunctionChecker.cpp | 76 -
lib/Analysis/CFRefCount.cpp | 3790 --------------------
lib/Analysis/CMakeLists.txt | 59 +-
lib/Analysis/CallAndMessageChecker.cpp | 252 --
lib/Analysis/CallInliner.cpp | 113 -
lib/Analysis/CastToStructChecker.cpp | 77 -
lib/Analysis/CheckDeadStores.cpp | 279 --
lib/Analysis/CheckObjCDealloc.cpp | 258 --
lib/Analysis/CheckObjCInstMethSignature.cpp | 119 -
lib/Analysis/CheckObjCUnusedIVars.cpp | 162 -
lib/Analysis/CheckSecuritySyntaxOnly.cpp | 502 ---
lib/Analysis/CheckSizeofPointer.cpp | 71 -
lib/Analysis/Checker.cpp | 35 -
lib/Analysis/DereferenceChecker.cpp | 135 -
lib/Analysis/DivZeroChecker.cpp | 84 -
lib/Analysis/Environment.cpp | 164 -
lib/Analysis/ExplodedGraph.cpp | 281 --
lib/Analysis/FixedAddressChecker.cpp | 70 -
lib/Analysis/GRBlockCounter.cpp | 54 -
lib/Analysis/GRCoreEngine.cpp | 599 ----
lib/Analysis/GRExprEngine.cpp | 3325 -----------------
lib/Analysis/GRExprEngineExperimentalChecks.cpp | 40 -
lib/Analysis/GRExprEngineExperimentalChecks.h | 26 -
lib/Analysis/GRExprEngineInternalChecks.h | 44 -
lib/Analysis/GRState.cpp | 358 --
lib/Analysis/LiveVariables.cpp | 2 +-
lib/Analysis/Makefile | 1 -
lib/Analysis/MallocChecker.cpp | 336 --
lib/Analysis/ManagerRegistry.cpp | 20 -
lib/Analysis/MemRegion.cpp | 800 -----
lib/Analysis/NSAutoreleasePoolChecker.cpp | 86 -
lib/Analysis/NSErrorChecker.cpp | 237 --
lib/Analysis/NoReturnFunctionChecker.cpp | 79 -
lib/Analysis/OSAtomicChecker.cpp | 198 -
lib/Analysis/PathDiagnostic.cpp | 281 --
lib/Analysis/PointerArithChecker.cpp | 71 -
lib/Analysis/PointerSubChecker.cpp | 77 -
lib/Analysis/PrintfFormatString.cpp | 436 +++
lib/Analysis/PthreadLockChecker.cpp | 141 -
lib/Analysis/RangeConstraintManager.cpp | 359 --
lib/Analysis/RegionStore.cpp | 2015 -----------
lib/Analysis/ReturnPointerRangeChecker.cpp | 97 -
lib/Analysis/ReturnStackAddressChecker.cpp | 114 -
lib/Analysis/ReturnUndefChecker.cpp | 68 -
lib/Analysis/SVals.cpp | 327 --
lib/Analysis/SValuator.cpp | 164 -
lib/Analysis/SimpleConstraintManager.cpp | 249 --
lib/Analysis/SimpleConstraintManager.h | 83 -
lib/Analysis/SimpleSValuator.cpp | 428 ---
lib/Analysis/Store.cpp | 250 --
lib/Analysis/SymbolManager.cpp | 228 --
lib/Analysis/UndefBranchChecker.cpp | 117 -
lib/Analysis/UndefResultChecker.cpp | 86 -
lib/Analysis/UndefinedArraySubscriptChecker.cpp | 56 -
lib/Analysis/UndefinedAssignmentChecker.cpp | 79 -
lib/Analysis/UninitializedValues.cpp | 1 -
lib/Analysis/VLASizeChecker.cpp | 96 -
lib/Analysis/ValueManager.cpp | 153 -
lib/Basic/Diagnostic.cpp | 219 +-
lib/Basic/IdentifierTable.cpp | 4 +-
lib/Basic/Makefile | 1 -
lib/Basic/SourceManager.cpp | 10 +-
lib/Basic/TargetInfo.cpp | 39 +-
lib/Basic/Targets.cpp | 157 +-
lib/Basic/Version.cpp | 78 +-
lib/CMakeLists.txt | 1 +
lib/Checker/AdjustedReturnValueChecker.cpp | 98 +
lib/Checker/ArrayBoundChecker.cpp | 91 +
lib/Checker/AttrNonNullChecker.cpp | 112 +
lib/Checker/BasicConstraintManager.cpp | 317 ++
lib/Checker/BasicObjCFoundationChecks.cpp | 559 +++
lib/Checker/BasicObjCFoundationChecks.h | 41 +
lib/Checker/BasicStore.cpp | 494 +++
lib/Checker/BasicValueFactory.cpp | 289 ++
lib/Checker/BugReporter.cpp | 1879 ++++++++++
lib/Checker/BugReporterVisitors.cpp | 367 ++
lib/Checker/BuiltinFunctionChecker.cpp | 76 +
lib/Checker/CFRefCount.cpp | 3521 ++++++++++++++++++
lib/Checker/CMakeLists.txt | 67 +
lib/Checker/CallAndMessageChecker.cpp | 252 ++
lib/Checker/CallInliner.cpp | 113 +
lib/Checker/CastToStructChecker.cpp | 77 +
lib/Checker/CheckDeadStores.cpp | 279 ++
lib/Checker/CheckObjCDealloc.cpp | 258 ++
lib/Checker/CheckObjCInstMethSignature.cpp | 119 +
lib/Checker/CheckObjCUnusedIVars.cpp | 162 +
lib/Checker/CheckSecuritySyntaxOnly.cpp | 502 +++
lib/Checker/CheckSizeofPointer.cpp | 71 +
lib/Checker/Checker.cpp | 35 +
lib/Checker/CocoaConventions.cpp | 195 +
lib/Checker/DereferenceChecker.cpp | 135 +
lib/Checker/DivZeroChecker.cpp | 84 +
lib/Checker/Environment.cpp | 164 +
lib/Checker/ExplodedGraph.cpp | 281 ++
lib/Checker/FixedAddressChecker.cpp | 70 +
lib/Checker/FlatStore.cpp | 166 +
lib/Checker/GRBlockCounter.cpp | 54 +
lib/Checker/GRCoreEngine.cpp | 599 ++++
lib/Checker/GRExprEngine.cpp | 3332 +++++++++++++++++
lib/Checker/GRExprEngineExperimentalChecks.cpp | 40 +
lib/Checker/GRExprEngineExperimentalChecks.h | 26 +
lib/Checker/GRExprEngineInternalChecks.h | 45 +
lib/Checker/GRState.cpp | 360 ++
lib/Checker/LLVMConventionsChecker.cpp | 335 ++
lib/Checker/Makefile | 21 +
lib/Checker/MallocChecker.cpp | 341 ++
lib/Checker/ManagerRegistry.cpp | 20 +
lib/Checker/MemRegion.cpp | 799 +++++
lib/Checker/NSAutoreleasePoolChecker.cpp | 86 +
lib/Checker/NSErrorChecker.cpp | 237 ++
lib/Checker/NoReturnFunctionChecker.cpp | 79 +
lib/Checker/OSAtomicChecker.cpp | 197 +
lib/Checker/PathDiagnostic.cpp | 281 ++
lib/Checker/PointerArithChecker.cpp | 71 +
lib/Checker/PointerSubChecker.cpp | 77 +
lib/Checker/PthreadLockChecker.cpp | 141 +
lib/Checker/RangeConstraintManager.cpp | 359 ++
lib/Checker/RegionStore.cpp | 1905 ++++++++++
lib/Checker/ReturnPointerRangeChecker.cpp | 97 +
lib/Checker/ReturnStackAddressChecker.cpp | 125 +
lib/Checker/ReturnUndefChecker.cpp | 68 +
lib/Checker/SVals.cpp | 327 ++
lib/Checker/SValuator.cpp | 157 +
lib/Checker/SimpleConstraintManager.cpp | 249 ++
lib/Checker/SimpleConstraintManager.h | 83 +
lib/Checker/SimpleSValuator.cpp | 428 +++
lib/Checker/Store.cpp | 327 ++
lib/Checker/SymbolManager.cpp | 228 ++
lib/Checker/UndefBranchChecker.cpp | 117 +
lib/Checker/UndefCapturedBlockVarChecker.cpp | 101 +
lib/Checker/UndefResultChecker.cpp | 86 +
lib/Checker/UndefinedArraySubscriptChecker.cpp | 56 +
lib/Checker/UndefinedAssignmentChecker.cpp | 79 +
lib/Checker/VLASizeChecker.cpp | 96 +
lib/Checker/ValueManager.cpp | 153 +
lib/CodeGen/CGBlocks.cpp | 74 +-
lib/CodeGen/CGBlocks.h | 5 +-
lib/CodeGen/CGBuiltin.cpp | 3 +-
lib/CodeGen/CGCXX.cpp | 8 +-
lib/CodeGen/CGCall.cpp | 116 +-
lib/CodeGen/CGCall.h | 9 +
lib/CodeGen/CGClass.cpp | 445 ++-
lib/CodeGen/CGDebugInfo.cpp | 918 ++---
lib/CodeGen/CGDebugInfo.h | 45 +-
lib/CodeGen/CGDecl.cpp | 91 +-
lib/CodeGen/CGDeclCXX.cpp | 118 +-
lib/CodeGen/CGException.cpp | 26 +-
lib/CodeGen/CGExpr.cpp | 149 +-
lib/CodeGen/CGExprAgg.cpp | 86 +-
lib/CodeGen/CGExprCXX.cpp | 125 +-
lib/CodeGen/CGExprComplex.cpp | 12 +-
lib/CodeGen/CGExprConstant.cpp | 175 +-
lib/CodeGen/CGExprScalar.cpp | 57 +-
lib/CodeGen/CGObjC.cpp | 26 +-
lib/CodeGen/CGObjCGNU.cpp | 135 +-
lib/CodeGen/CGObjCMac.cpp | 29 +-
lib/CodeGen/CGRTTI.cpp | 7 +-
lib/CodeGen/CGRecordLayoutBuilder.cpp | 41 +-
lib/CodeGen/CGRecordLayoutBuilder.h | 15 +-
lib/CodeGen/CGStmt.cpp | 22 +-
lib/CodeGen/CGVtable.cpp | 1683 ++++++++-
lib/CodeGen/CodeGenFunction.cpp | 24 +-
lib/CodeGen/CodeGenFunction.h | 61 +-
lib/CodeGen/CodeGenModule.cpp | 149 +-
lib/CodeGen/CodeGenModule.h | 18 +-
lib/CodeGen/CodeGenTypes.cpp | 32 +-
lib/CodeGen/CodeGenTypes.h | 36 +-
lib/CodeGen/GlobalDecl.h | 4 +
lib/CodeGen/Makefile | 1 -
lib/CodeGen/Mangle.cpp | 320 +-
lib/CodeGen/TargetInfo.cpp | 126 +-
lib/Driver/Driver.cpp | 81 +-
lib/Driver/HostInfo.cpp | 11 +-
lib/Driver/Makefile | 1 -
lib/Driver/ToolChains.cpp | 158 +-
lib/Driver/ToolChains.h | 115 +-
lib/Driver/Tools.cpp | 228 +-
lib/Driver/Tools.h | 19 +-
lib/Frontend/ASTConsumers.cpp | 2 +-
lib/Frontend/ASTMerge.cpp | 103 +
lib/Frontend/ASTUnit.cpp | 30 +-
lib/Frontend/AnalysisConsumer.cpp | 161 +-
lib/Frontend/Backend.cpp | 38 +-
lib/Frontend/CMakeLists.txt | 1 +
lib/Frontend/CompilerInstance.cpp | 54 +-
lib/Frontend/CompilerInvocation.cpp | 41 +-
lib/Frontend/FrontendActions.cpp | 5 +
lib/Frontend/HTMLDiagnostics.cpp | 2 +-
lib/Frontend/InitHeaderSearch.cpp | 10 +-
lib/Frontend/InitPreprocessor.cpp | 2 +
lib/Frontend/Makefile | 1 -
lib/Frontend/PCHReader.cpp | 44 +-
lib/Frontend/PCHReaderDecl.cpp | 13 +-
lib/Frontend/PCHReaderStmt.cpp | 33 +-
lib/Frontend/PCHWriter.cpp | 35 +-
lib/Frontend/PCHWriterDecl.cpp | 1 +
lib/Frontend/PCHWriterStmt.cpp | 21 +-
lib/Frontend/PlistDiagnostics.cpp | 2 +-
lib/Frontend/PrintParserCallbacks.cpp | 5 +-
lib/Frontend/RewriteObjC.cpp | 448 ++-
lib/Frontend/TextDiagnosticPrinter.cpp | 26 +-
lib/Headers/xmmintrin.h | 16 +-
lib/Index/Makefile | 1 -
lib/Lex/Lexer.cpp | 16 +-
lib/Lex/Makefile | 1 -
lib/Lex/PPCaching.cpp | 2 +-
lib/Lex/PPDirectives.cpp | 17 +-
lib/Lex/PPMacroExpansion.cpp | 38 +-
lib/Lex/Preprocessor.cpp | 2 +-
lib/Makefile | 2 +-
lib/Parse/DeclSpec.cpp | 37 +
lib/Parse/Makefile | 1 -
lib/Parse/ParseDecl.cpp | 94 +-
lib/Parse/ParseDeclCXX.cpp | 122 +-
lib/Parse/ParseExpr.cpp | 41 +-
lib/Parse/ParseExprCXX.cpp | 7 +-
lib/Parse/ParseObjc.cpp | 24 +-
lib/Parse/ParseStmt.cpp | 90 +-
lib/Parse/ParseTemplate.cpp | 2 +-
lib/Parse/ParseTentative.cpp | 9 +
lib/Parse/Parser.cpp | 23 +-
lib/Rewrite/Makefile | 1 -
lib/Sema/IdentifierResolver.cpp | 38 +-
lib/Sema/Lookup.h | 44 +-
lib/Sema/Makefile | 1 -
lib/Sema/Sema.cpp | 280 +-
lib/Sema/Sema.h | 327 +-
lib/Sema/SemaAccess.cpp | 592 ++-
lib/Sema/SemaCXXCast.cpp | 59 +-
lib/Sema/SemaCXXScopeSpec.cpp | 4 +
lib/Sema/SemaChecking.cpp | 554 +--
lib/Sema/SemaCodeComplete.cpp | 16 +-
lib/Sema/SemaDecl.cpp | 682 ++--
lib/Sema/SemaDeclAttr.cpp | 211 +-
lib/Sema/SemaDeclCXX.cpp | 730 ++--
lib/Sema/SemaDeclObjC.cpp | 219 +-
lib/Sema/SemaExceptionSpec.cpp | 83 +-
lib/Sema/SemaExpr.cpp | 148 +-
lib/Sema/SemaExprCXX.cpp | 127 +-
lib/Sema/SemaExprObjC.cpp | 31 +-
lib/Sema/SemaInit.cpp | 692 +++-
lib/Sema/SemaInit.h | 35 +-
lib/Sema/SemaLookup.cpp | 318 +-
lib/Sema/SemaOverload.cpp | 646 ++--
lib/Sema/SemaOverload.h | 62 +-
lib/Sema/SemaStmt.cpp | 178 +-
lib/Sema/SemaTemplate.cpp | 199 +-
lib/Sema/SemaTemplateDeduction.cpp | 361 +-
lib/Sema/SemaTemplateInstantiate.cpp | 242 +-
lib/Sema/SemaTemplateInstantiateDecl.cpp | 182 +-
lib/Sema/SemaType.cpp | 188 +-
lib/Sema/TargetAttributesSema.cpp | 44 +
lib/Sema/TreeTransform.h | 160 +-
test/ASTMerge/Inputs/enum1.c | 42 +
test/ASTMerge/Inputs/enum2.c | 42 +
test/ASTMerge/Inputs/function1.c | 6 +
test/ASTMerge/Inputs/function2.c | 7 +
test/ASTMerge/Inputs/interface1.m | 7 +
test/ASTMerge/Inputs/interface2.m | 7 +
test/ASTMerge/Inputs/lit.local.cfg | 1 +
test/ASTMerge/Inputs/struct1.c | 63 +
test/ASTMerge/Inputs/struct2.c | 60 +
test/ASTMerge/Inputs/typedef1.c | 4 +
test/ASTMerge/Inputs/typedef2.c | 4 +
test/ASTMerge/Inputs/var1.c | 7 +
test/ASTMerge/Inputs/var1.h | 1 +
test/ASTMerge/Inputs/var2.c | 7 +
test/ASTMerge/enum.c | 25 +
test/ASTMerge/function.c | 9 +
test/ASTMerge/interface.m | 6 +
test/ASTMerge/struct.c | 42 +
test/ASTMerge/typedef.c | 7 +
test/ASTMerge/var.c | 12 +
test/Analysis/CFDateGC.m | 10 +-
test/Analysis/CFNumber.c | 8 +-
test/Analysis/CFRetainRelease_NSAssertionHandler.m | 8 +-
test/Analysis/CGColorSpace.c | 8 +-
test/Analysis/CheckNSError.m | 8 +-
test/Analysis/MissingDealloc.m | 2 +-
test/Analysis/NSPanel.m | 8 +-
test/Analysis/NSString.m | 16 +-
test/Analysis/NSWindow.m | 8 +-
test/Analysis/NoReturn.m | 8 +-
test/Analysis/ObjCProperties.m | 8 +-
test/Analysis/ObjCRetSigs.m | 2 +-
test/Analysis/PR2599.m | 8 +-
test/Analysis/PR2978.m | 2 +-
test/Analysis/PR3991.m | 8 +-
test/Analysis/array-struct.c | 8 +-
test/Analysis/blocks.m | 18 +-
test/Analysis/casts.c | 4 +-
test/Analysis/casts.m | 4 +-
test/Analysis/cfref_PR2519.c | 8 +-
test/Analysis/cfref_rdar6080742.c | 8 +-
test/Analysis/complex.c | 8 +-
test/Analysis/concrete-address.c | 4 +-
test/Analysis/conditional-op-missing-lhs.c | 2 +-
test/Analysis/dead-stores.c | 10 +-
test/Analysis/dead-stores.cpp | 10 +-
test/Analysis/dead-stores.m | 2 +-
test/Analysis/delegates.m | 4 +-
test/Analysis/elementtype.c | 2 +-
test/Analysis/exercise-ps.c | 4 +-
test/Analysis/fields.c | 4 +-
test/Analysis/func.c | 4 +-
test/Analysis/malloc.c | 6 +-
test/Analysis/misc-ps-64.m | 8 +-
test/Analysis/misc-ps-basic-store.m | 2 +-
test/Analysis/misc-ps-eager-assume.m | 2 +-
test/Analysis/misc-ps-flat-store.c | 10 +
test/Analysis/misc-ps-ranges.m | 4 +-
test/Analysis/misc-ps-region-store-i386.m | 2 +-
test/Analysis/misc-ps-region-store-x86_64.m | 2 +-
test/Analysis/misc-ps-region-store.cpp | 4 +-
test/Analysis/misc-ps-region-store.m | 141 +-
test/Analysis/misc-ps-region-store.mm | 4 +-
test/Analysis/misc-ps.m | 112 +-
...il-receiver-undefined-larger-than-voidptr-ret.m | 8 +-
test/Analysis/no-exit-cfg.c | 4 +-
test/Analysis/no-outofbounds.c | 4 +-
test/Analysis/null-deref-ps-region.c | 2 +-
test/Analysis/null-deref-ps.c | 8 +-
test/Analysis/outofbound.c | 2 +-
test/Analysis/override-werror.c | 4 +-
test/Analysis/plist-output.m | 2 +-
test/Analysis/pr4209.m | 4 +-
test/Analysis/pr_2542_rdar_6793404.m | 4 +-
test/Analysis/pr_4164.c | 4 +-
test/Analysis/ptr-arith.c | 4 +-
test/Analysis/rdar-6442306-1.m | 4 +-
test/Analysis/rdar-6540084.m | 2 +-
test/Analysis/rdar-6541136-region.c | 2 +-
test/Analysis/rdar-6541136.c | 2 +-
test/Analysis/rdar-6562655.m | 4 +-
test/Analysis/rdar-6582778-basic-store.c | 2 +-
...dar-6600344-nil-receiver-undefined-struct-ret.m | 4 +-
test/Analysis/rdar-7168531.m | 4 +-
test/Analysis/refcnt_naming.m | 4 +-
test/Analysis/reference.cpp | 2 +-
test/Analysis/region-1.m | 4 +-
test/Analysis/retain-release-basic-store.m | 2 +-
test/Analysis/retain-release-gc-only.m | 4 +-
test/Analysis/retain-release-region-store.m | 2 +-
test/Analysis/retain-release.m | 4 +-
test/Analysis/security-syntax-checks-no-emit.c | 2 +-
test/Analysis/security-syntax-checks.m | 2 +-
test/Analysis/stack-addr-ps.c | 4 +-
test/Analysis/uninit-msg-expr.m | 4 +-
test/Analysis/uninit-ps-rdar6145427.m | 4 +-
test/Analysis/uninit-vals-ps-region.c | 2 +-
test/Analysis/uninit-vals-ps.c | 4 +-
test/Analysis/uninit-vals.m | 4 +-
test/Analysis/unions-region.m | 2 +-
test/Analysis/unused-ivars.m | 2 +-
test/CMakeLists.txt | 6 +-
test/CXX/basic/basic.def.odr/p1-var.cpp | 21 +
.../basic.lookup/basic.lookup.elab/templateid.cpp | 2 +-
test/CXX/class.access/class.access.base/p1.cpp | 45 +-
test/CXX/class.access/p4.cpp | 114 +
test/CXX/class.access/p6.cpp | 54 +
test/CXX/class/class.local/p2.cpp | 4 +-
test/CXX/conv/conv.mem/p4.cpp | 65 +
test/CXX/conv/conv.qual/pr6089.cpp | 18 +
test/CXX/dcl.dcl/dcl.enum/p5.cpp | 56 +
test/CXX/dcl.dcl/dcl.link/p7.cpp | 30 +
test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp | 9 +-
test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp | 6 +
test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp | 12 +
test/CXX/dcl.decl/dcl.init/p6.cpp | 15 +
test/CXX/dcl.decl/dcl.name/p1.cpp | 16 +
test/CXX/expr/p8.cpp | 2 +-
test/CXX/lex/lex.literal/lex.ccon/p1.cpp | 9 +
test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp | 57 +
test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp | 129 +
test/CXX/temp/temp.decls/temp.mem/p5.cpp | 2 +-
.../temp/temp.fct.spec/temp.arg.explicit/p3.cpp | 2 +-
.../temp.deduct/temp.deduct.call/basic.cpp | 3 +-
.../temp.deduct/temp.deduct.call/p6.cpp | 95 +
test/CXX/temp/temp.names/p4.cpp | 15 +
test/CXX/temp/temp.res/temp.local/p1.cpp | 33 +
test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp | 15 +-
test/CodeGen/2010-02-09-DbgSelf.m | 14 +
test/CodeGen/2010-02-15-Dbg-MethodStart.m | 15 +
test/CodeGen/address-space-field1.c | 4 +-
test/CodeGen/arm-arguments.c | 61 +
test/CodeGen/attributes.c | 7 +
test/CodeGen/darwin-string-literals.c | 4 +-
test/CodeGen/debug-info-crash.c | 21 +
test/CodeGen/enum.c | 1 +
test/CodeGen/function-attributes.c | 8 +
test/CodeGen/stdcall-fastcall.c | 20 +-
test/CodeGen/union.c | 3 +
test/CodeGenCXX/PR4890-debug-info-dtor.cpp | 6 -
test/CodeGenCXX/alloca-align.cpp | 12 +
test/CodeGenCXX/anonymous-namespaces.cpp | 16 +
test/CodeGenCXX/attr.cpp | 29 +-
test/CodeGenCXX/condition.cpp | 22 +-
test/CodeGenCXX/conditional-temporaries.cpp | 65 +-
test/CodeGenCXX/const-global-linkage.cpp | 4 +-
test/CodeGenCXX/const-init.cpp | 4 +-
test/CodeGenCXX/conversion-function.cpp | 2 +-
test/CodeGenCXX/debug-info.cpp | 28 +-
test/CodeGenCXX/default-destructor-synthesis.cpp | 72 +-
test/CodeGenCXX/deferred-global-init.cpp | 2 +-
test/CodeGenCXX/derived-to-base.cpp | 22 +-
test/CodeGenCXX/dyncast.cpp | 29 +-
test/CodeGenCXX/extern-c.cpp | 3 +
test/CodeGenCXX/global-init.cpp | 15 +
test/CodeGenCXX/global-llvm-constant.cpp | 2 +-
test/CodeGenCXX/internal-linkage.cpp | 19 +
test/CodeGenCXX/mangle-exprs.cpp | 44 +
test/CodeGenCXX/mangle.cpp | 72 +-
test/CodeGenCXX/member-function-pointer-calls.cpp | 26 +
test/CodeGenCXX/member-function-pointers.cpp | 37 +-
test/CodeGenCXX/member-initializers.cpp | 34 +
test/CodeGenCXX/member-pointer-cast.cpp | 21 -
test/CodeGenCXX/member-pointers-zero-init.cpp | 34 -
test/CodeGenCXX/no-exceptions.cpp | 12 +
test/CodeGenCXX/pointers-to-data-members.cpp | 87 +
test/CodeGenCXX/reference-init.cpp | 8 +
test/CodeGenCXX/references.cpp | 8 +
test/CodeGenCXX/static-data-member.cpp | 10 +
test/CodeGenCXX/static-init.cpp | 19 +
test/CodeGenCXX/temp-order.cpp | 32 +-
test/CodeGenCXX/temporaries.cpp | 39 +
test/CodeGenCXX/threadsafe-statics.cpp | 17 +
test/CodeGenCXX/throw-expressions.cpp | 2 +-
test/CodeGenCXX/virt.cpp | 58 +-
test/CodeGenCXX/virtual-bases.cpp | 8 +
test/CodeGenCXX/virtual-function-calls.cpp | 21 +-
test/CodeGenCXX/visibility.cpp | 66 +
test/CodeGenCXX/vtable-layout.cpp | 367 ++
test/CodeGenCXX/vtable-pointer-initialization.cpp | 54 +
test/CodeGenCXX/x86_32-arguments.cpp | 24 +
test/CodeGenObjC/PR4541.m | 19 -
test/CodeGenObjC/PR4894-recursive-debug-crash.m | 40 -
test/CodeGenObjC/blocks-4.m | 21 +
test/CodeGenObjC/debug-info-crash.m | 40 +
test/CodeGenObjC/id-isa-codegen.m | 14 +
test/CodeGenObjC/image-info.m | 2 +-
test/CodeGenObjC/objc2-legacy-dispatch.m | 26 +
test/CodeGenObjC/objc2-weak-block-call.m | 29 +
test/CodeGenObjC/unwind-fn.m | 14 +
test/Coverage/html-diagnostics.c | 2 +-
test/Driver/darwin-iphone-defaults.m | 30 +
test/Driver/darwin-ld.c | 33 +
test/Driver/darwin-version.c | 21 +-
test/Driver/rewrite-objc.m | 11 +
test/FixIt/fixit.cpp | 17 +-
test/FixIt/typo-crash.m | 6 +
test/FixIt/typo.m | 2 +-
test/Index/TestClassDecl.m | 28 +-
test/Index/TestClassForwardDecl.m | 18 +-
test/Index/annotate-tokens.c | 64 +
test/Index/c-index-api-loadTU-test.m | 122 +-
test/Index/c-index-getCursor-test.m | 198 +-
test/Index/cindex-from-source.m | 2 +-
test/Index/cindex-test-inclusions.c | 13 +
test/Index/code-complete-errors.c | 16 +
test/Index/include_test.h | 1 +
test/Index/include_test_2.h | 0
test/Index/load-exprs.c | 11 +-
test/Index/load-stmts.cpp | 51 +
test/Index/remap-cursor-at.c | 2 +-
test/Index/remap-load.c | 23 +-
test/Misc/caret-diags-macros.c | 9 +
test/PCH/cxx_exprs.cpp | 15 +-
test/PCH/cxx_exprs.h | 18 +-
test/Parser/altivec.c | 91 +
test/Parser/cxx-altivec.cpp | 108 +
test/Parser/cxx-decl.cpp | 6 +
test/Parser/cxx-template-decl.cpp | 10 +
test/Parser/declarators.c | 23 +-
test/Parser/objc-property-syntax.m | 2 +
test/Parser/statements.c | 2 +-
test/Preprocessor/init.c | 11 +-
test/Preprocessor/mi_opt2.c | 15 +
test/Preprocessor/mi_opt2.h | 5 +
test/Rewriter/blockcast3.mm | 23 +
test/Rewriter/rewrite-block-pointer.mm | 16 +
test/Rewriter/rewrite-byref-vars.mm | 10 +
test/Rewriter/rewrite-cast-ivar-access.mm | 53 +
test/Rewriter/rewrite-category-property.mm | 15 +
test/Rewriter/rewrite-implementation.mm | 13 +
test/Rewriter/rewrite-message-expr.mm | 25 +
test/Rewriter/rewrite-nested-ivar.mm | 33 +
test/Rewriter/rewrite-protocol-qualified.mm | 41 +
test/Rewriter/rewrite-typeof.mm | 21 +-
test/Rewriter/rewrite-unique-block-api.mm | 31 +
test/Sema/Inputs/conversion.h | 3 +
test/Sema/arm-layout.c | 20 +
test/Sema/asm.c | 3 +
test/Sema/attr-mode.c | 39 +-
test/Sema/attr-noreturn.c | 2 +-
test/Sema/block-args.c | 6 +
test/Sema/block-printf-attribute-1.c | 5 +-
test/Sema/block-return.c | 7 +-
test/Sema/builtin-unary-fp.c | 4 +
test/Sema/callingconv.c | 19 +-
test/Sema/compare.c | 2 +-
test/Sema/const-eval.c | 1 +
test/Sema/conversion.c | 10 +-
test/Sema/declspec.c | 19 +-
test/Sema/enum.c | 4 +
test/Sema/format-string-percentm.c | 1 +
test/Sema/format-strings.c | 81 +-
test/Sema/function-redecl.c | 4 +
test/Sema/incomplete-decl.c | 2 +-
test/Sema/indirect-goto.c | 3 +
test/Sema/return-noreturn.c | 2 +-
test/Sema/return.c | 2 +-
test/Sema/scope-check.c | 2 +-
test/Sema/statements.c | 8 +
test/Sema/stdcall-fastcall.c | 8 +-
test/Sema/switch.c | 138 +
test/Sema/ucn-cstring.c | 4 +-
test/Sema/unused-expr.c | 2 +-
test/Sema/vla.c | 6 +
test/Sema/warn-unused-function.c | 16 +
test/Sema/x86-attr-force-align-arg-pointer.c | 18 +
test/SemaCXX/Inputs/lit.local.cfg | 1 +
test/SemaCXX/Inputs/malloc.h | 3 +
test/SemaCXX/access-base-class.cpp | 23 +-
test/SemaCXX/access-control-check.cpp | 2 +-
test/SemaCXX/aggregate-initialization.cpp | 39 +-
test/SemaCXX/builtin-exception-spec.cpp | 6 +
test/SemaCXX/builtins.cpp | 2 +
test/SemaCXX/cast-conversion.cpp | 2 +-
test/SemaCXX/comma.cpp | 8 +
test/SemaCXX/conditional-expr.cpp | 10 +-
test/SemaCXX/constructor-initializer.cpp | 8 +-
test/SemaCXX/copy-assignment.cpp | 8 +-
test/SemaCXX/dcl_ambig_res.cpp | 4 +-
test/SemaCXX/dcl_init_aggr.cpp | 2 +-
test/SemaCXX/decl-init-ref.cpp | 3 +
test/SemaCXX/enum.cpp | 4 +
test/SemaCXX/explicit.cpp | 39 +
test/SemaCXX/i-c-e-cxx.cpp | 16 +
test/SemaCXX/illegal-member-initialization.cpp | 7 +-
test/SemaCXX/namespace-alias.cpp | 21 +
test/SemaCXX/nested-name-spec.cpp | 11 +-
test/SemaCXX/new-delete-predefined-decl.cpp | 19 +
test/SemaCXX/new-delete.cpp | 15 +
test/SemaCXX/overload-call-copycon.cpp | 3 +-
test/SemaCXX/overload-call.cpp | 12 +
test/SemaCXX/overload-member-call.cpp | 2 +-
test/SemaCXX/overloaded-operator-decl.cpp | 6 +
test/SemaCXX/overloaded-operator.cpp | 2 +-
test/SemaCXX/references.cpp | 13 +
test/SemaCXX/reinterpret-cast.cpp | 2 +-
test/SemaCXX/static-cast.cpp | 11 +-
test/SemaCXX/templated-friend-decl.cpp | 15 +
test/SemaCXX/using-decl-1.cpp | 35 +
test/SemaCXX/virtual-override.cpp | 27 +-
test/SemaCXX/warn-missing-noreturn.cpp | 24 +
test/SemaCXX/warn-unused-variables.cpp | 18 +-
test/SemaCXX/warn-weak-vtables.cpp | 21 +
test/SemaObjC/cocoa.m | 2 +-
test/SemaObjC/default-synthesize.m | 81 +
test/SemaObjC/duplicate-property-class-extension.m | 13 +
test/SemaObjC/exprs.m | 2 +-
test/SemaObjC/format-strings-objc.m | 11 +-
test/SemaObjC/method-arg-decay.m | 2 +-
test/SemaObjC/property-13.m | 2 +-
test/SemaObjC/property-not-lvalue.m | 14 +
test/SemaObjC/protocol-warn.m | 55 +
.../reinterpret-cast-objc-pointertype.mm | 23 +
test/SemaTemplate/deduction.cpp | 12 +
test/SemaTemplate/default-expr-arguments.cpp | 7 +
test/SemaTemplate/explicit-instantiation.cpp | 7 +
test/SemaTemplate/instantiate-decl-init.cpp | 24 +
test/SemaTemplate/instantiate-declref-ice.cpp | 2 -
test/SemaTemplate/instantiate-declref.cpp | 8 +
test/SemaTemplate/instantiate-expr-1.cpp | 25 +
test/SemaTemplate/instantiate-expr-4.cpp | 6 +-
test/SemaTemplate/instantiate-local-class.cpp | 18 +
.../instantiate-member-initializers.cpp | 2 +-
test/SemaTemplate/instantiate-member-template.cpp | 25 +
test/SemaTemplate/member-function-template.cpp | 12 +
test/SemaTemplate/qualified-id.cpp | 15 +
.../recursive-template-instantiation.cpp | 2 +-
test/SemaTemplate/temp_arg_nontype.cpp | 21 +-
test/SemaTemplate/temp_class_spec.cpp | 13 +
test/SemaTemplate/template-id-expr.cpp | 17 +
test/SemaTemplate/typename-specifier-4.cpp | 31 +
tools/CIndex/CIndex.cpp | 704 ++--
tools/CIndex/CIndex.exports | 19 +
tools/CIndex/CIndexCodeCompletion.cpp | 49 +-
tools/CIndex/CIndexDiagnostic.cpp | 260 ++
tools/CIndex/CIndexDiagnostic.h | 66 +
tools/CIndex/CIndexInclusionStack.cpp | 65 +
tools/CIndex/CIndexUSRs.cpp | 2 +-
tools/CIndex/CIndexer.cpp | 34 +-
tools/CIndex/CIndexer.h | 31 +-
tools/CIndex/CMakeLists.txt | 2 +
tools/CIndex/CXCursor.cpp | 11 +-
tools/CIndex/CXCursor.h | 2 +-
tools/CIndex/CXSourceLocation.h | 76 +
tools/CIndex/Makefile | 1 -
tools/c-index-test/Makefile | 1 -
tools/c-index-test/c-index-test.c | 548 ++-
tools/driver/CMakeLists.txt | 5 +-
tools/driver/Makefile | 7 +-
tools/driver/cc1_main.cpp | 22 +-
tools/scan-build/ccc-analyzer | 7 +-
tools/scan-build/scan-build | 57 +-
tools/scan-build/set-xcode-analyzer | 77 +
utils/ABITest/ABITestGen.py | 17 +-
utils/ABITest/TypeGen.py | 83 +-
www/analyzer/annotations.html | 34 +-
www/analyzer/available_checks.html | 3 +
www/analyzer/content.css | 30 +
www/analyzer/dev_cxx.html | 52 +
www/analyzer/filing_bugs.html | 8 +-
www/analyzer/images/analyzer_html.png | Bin 0 -> 63091 bytes
www/analyzer/images/analyzer_xcode.png | Bin 0 -> 87697 bytes
www/analyzer/images/tree/bullet.gif | Bin 0 -> 64 bytes
www/analyzer/images/tree/minus.gif | Bin 0 -> 79 bytes
www/analyzer/images/tree/plus.gif | Bin 0 -> 83 bytes
www/analyzer/index.html | 25 +-
www/analyzer/installation.html | 5 +-
www/analyzer/latest_checker.html.incl | 2 +-
www/analyzer/menu.css | 80 +-
www/analyzer/menu.html.incl | 74 +-
www/analyzer/menu.js | 17 +
www/analyzer/scan-build.html | 42 +-
www/analyzer/scripts/dbtree.js | 1 +
www/analyzer/scripts/menu.js | 17 +
www/comparison.html | 3 +-
www/cxx_status.html | 92 +-
www/diagnostics.html | 29 +-
www/index.html | 16 +-
819 files changed, 57334 insertions(+), 38422 deletions(-)
create mode 100644 bindings/python/README.txt
create mode 100644 bindings/python/clang/__init__.py
create mode 100644 bindings/python/clang/cindex.py
create mode 100644 bindings/python/examples/cindex/cindex-dump.py
create mode 100644 bindings/python/examples/cindex/cindex-includes.py
create mode 100644 bindings/python/tests/__init__.py
create mode 100644 bindings/python/tests/cindex/INPUTS/header1.h
create mode 100644 bindings/python/tests/cindex/INPUTS/header2.h
create mode 100644 bindings/python/tests/cindex/INPUTS/header3.h
create mode 100644 bindings/python/tests/cindex/INPUTS/hello.cpp
create mode 100644 bindings/python/tests/cindex/INPUTS/include.cpp
create mode 100644 bindings/python/tests/cindex/INPUTS/parse_arguments.c
create mode 100644 bindings/python/tests/cindex/__init__.py
create mode 100644 bindings/python/tests/cindex/test_cursor.py
create mode 100644 bindings/python/tests/cindex/test_cursor_kind.py
create mode 100644 bindings/python/tests/cindex/test_diagnostics.py
create mode 100644 bindings/python/tests/cindex/test_index.py
create mode 100644 bindings/python/tests/cindex/test_translation_unit.py
create mode 100644 include/clang/AST/ASTImporter.h
create mode 100644 include/clang/Analysis/Analyses/PrintfFormatString.h
create mode 100644 include/clang/Analysis/AnalysisContext.h
delete mode 100644 include/clang/Analysis/LocalCheckers.h
delete mode 100644 include/clang/Analysis/ManagerRegistry.h
delete mode 100644 include/clang/Analysis/PathDiagnostic.h
delete mode 100644 include/clang/Analysis/PathSensitive/AnalysisContext.h
delete mode 100644 include/clang/Analysis/PathSensitive/AnalysisManager.h
delete mode 100644 include/clang/Analysis/PathSensitive/BasicValueFactory.h
delete mode 100644 include/clang/Analysis/PathSensitive/BugReporter.h
delete mode 100644 include/clang/Analysis/PathSensitive/BugType.h
delete mode 100644 include/clang/Analysis/PathSensitive/Checker.h
delete mode 100644 include/clang/Analysis/PathSensitive/CheckerVisitor.def
delete mode 100644 include/clang/Analysis/PathSensitive/CheckerVisitor.h
delete mode 100644 include/clang/Analysis/PathSensitive/Checkers/DereferenceChecker.h
delete mode 100644 include/clang/Analysis/PathSensitive/ConstraintManager.h
delete mode 100644 include/clang/Analysis/PathSensitive/Environment.h
delete mode 100644 include/clang/Analysis/PathSensitive/ExplodedGraph.h
delete mode 100644 include/clang/Analysis/PathSensitive/GRAuditor.h
delete mode 100644 include/clang/Analysis/PathSensitive/GRBlockCounter.h
delete mode 100644 include/clang/Analysis/PathSensitive/GRCoreEngine.h
delete mode 100644 include/clang/Analysis/PathSensitive/GRExprEngine.h
delete mode 100644 include/clang/Analysis/PathSensitive/GRExprEngineBuilders.h
delete mode 100644 include/clang/Analysis/PathSensitive/GRSimpleAPICheck.h
delete mode 100644 include/clang/Analysis/PathSensitive/GRState.h
delete mode 100644 include/clang/Analysis/PathSensitive/GRStateTrait.h
delete mode 100644 include/clang/Analysis/PathSensitive/GRSubEngine.h
delete mode 100644 include/clang/Analysis/PathSensitive/GRTransferFuncs.h
delete mode 100644 include/clang/Analysis/PathSensitive/GRWorkList.h
delete mode 100644 include/clang/Analysis/PathSensitive/MemRegion.h
delete mode 100644 include/clang/Analysis/PathSensitive/SVals.h
delete mode 100644 include/clang/Analysis/PathSensitive/SValuator.h
delete mode 100644 include/clang/Analysis/PathSensitive/Store.h
delete mode 100644 include/clang/Analysis/PathSensitive/SymbolManager.h
delete mode 100644 include/clang/Analysis/PathSensitive/ValueManager.h
create mode 100644 include/clang/Basic/Linkage.h
create mode 100644 include/clang/Checker/BugReporter/BugReporter.h
create mode 100644 include/clang/Checker/BugReporter/BugType.h
create mode 100644 include/clang/Checker/BugReporter/PathDiagnostic.h
create mode 100644 include/clang/Checker/Checkers/DereferenceChecker.h
create mode 100644 include/clang/Checker/Checkers/LocalCheckers.h
create mode 100644 include/clang/Checker/DomainSpecific/CocoaConventions.h
create mode 100644 include/clang/Checker/ManagerRegistry.h
create mode 100644 include/clang/Checker/PathSensitive/AnalysisManager.h
create mode 100644 include/clang/Checker/PathSensitive/BasicValueFactory.h
create mode 100644 include/clang/Checker/PathSensitive/Checker.h
create mode 100644 include/clang/Checker/PathSensitive/CheckerVisitor.def
create mode 100644 include/clang/Checker/PathSensitive/CheckerVisitor.h
create mode 100644 include/clang/Checker/PathSensitive/ConstraintManager.h
create mode 100644 include/clang/Checker/PathSensitive/Environment.h
create mode 100644 include/clang/Checker/PathSensitive/ExplodedGraph.h
create mode 100644 include/clang/Checker/PathSensitive/GRAuditor.h
create mode 100644 include/clang/Checker/PathSensitive/GRBlockCounter.h
create mode 100644 include/clang/Checker/PathSensitive/GRCoreEngine.h
create mode 100644 include/clang/Checker/PathSensitive/GRExprEngine.h
create mode 100644 include/clang/Checker/PathSensitive/GRExprEngineBuilders.h
create mode 100644 include/clang/Checker/PathSensitive/GRSimpleAPICheck.h
create mode 100644 include/clang/Checker/PathSensitive/GRState.h
create mode 100644 include/clang/Checker/PathSensitive/GRStateTrait.h
create mode 100644 include/clang/Checker/PathSensitive/GRSubEngine.h
create mode 100644 include/clang/Checker/PathSensitive/GRTransferFuncs.h
create mode 100644 include/clang/Checker/PathSensitive/GRWorkList.h
create mode 100644 include/clang/Checker/PathSensitive/MemRegion.h
create mode 100644 include/clang/Checker/PathSensitive/SVals.h
create mode 100644 include/clang/Checker/PathSensitive/SValuator.h
create mode 100644 include/clang/Checker/PathSensitive/Store.h
create mode 100644 include/clang/Checker/PathSensitive/SummaryManager.h
create mode 100644 include/clang/Checker/PathSensitive/SymbolManager.h
create mode 100644 include/clang/Checker/PathSensitive/ValueManager.h
create mode 100644 lib/AST/ASTDiagnostic.cpp
create mode 100644 lib/AST/ASTImporter.cpp
delete mode 100644 lib/Analysis/ArrayBoundChecker.cpp
delete mode 100644 lib/Analysis/AttrNonNullChecker.cpp
delete mode 100644 lib/Analysis/BasicConstraintManager.cpp
delete mode 100644 lib/Analysis/BasicObjCFoundationChecks.cpp
delete mode 100644 lib/Analysis/BasicObjCFoundationChecks.h
delete mode 100644 lib/Analysis/BasicStore.cpp
delete mode 100644 lib/Analysis/BasicValueFactory.cpp
delete mode 100644 lib/Analysis/BugReporter.cpp
delete mode 100644 lib/Analysis/BugReporterVisitors.cpp
delete mode 100644 lib/Analysis/BuiltinFunctionChecker.cpp
delete mode 100644 lib/Analysis/CFRefCount.cpp
delete mode 100644 lib/Analysis/CallAndMessageChecker.cpp
delete mode 100644 lib/Analysis/CallInliner.cpp
delete mode 100644 lib/Analysis/CastToStructChecker.cpp
delete mode 100644 lib/Analysis/CheckDeadStores.cpp
delete mode 100644 lib/Analysis/CheckObjCDealloc.cpp
delete mode 100644 lib/Analysis/CheckObjCInstMethSignature.cpp
delete mode 100644 lib/Analysis/CheckObjCUnusedIVars.cpp
delete mode 100644 lib/Analysis/CheckSecuritySyntaxOnly.cpp
delete mode 100644 lib/Analysis/CheckSizeofPointer.cpp
delete mode 100644 lib/Analysis/Checker.cpp
delete mode 100644 lib/Analysis/DereferenceChecker.cpp
delete mode 100644 lib/Analysis/DivZeroChecker.cpp
delete mode 100644 lib/Analysis/Environment.cpp
delete mode 100644 lib/Analysis/ExplodedGraph.cpp
delete mode 100644 lib/Analysis/FixedAddressChecker.cpp
delete mode 100644 lib/Analysis/GRBlockCounter.cpp
delete mode 100644 lib/Analysis/GRCoreEngine.cpp
delete mode 100644 lib/Analysis/GRExprEngine.cpp
delete mode 100644 lib/Analysis/GRExprEngineExperimentalChecks.cpp
delete mode 100644 lib/Analysis/GRExprEngineExperimentalChecks.h
delete mode 100644 lib/Analysis/GRExprEngineInternalChecks.h
delete mode 100644 lib/Analysis/GRState.cpp
delete mode 100644 lib/Analysis/MallocChecker.cpp
delete mode 100644 lib/Analysis/ManagerRegistry.cpp
delete mode 100644 lib/Analysis/MemRegion.cpp
delete mode 100644 lib/Analysis/NSAutoreleasePoolChecker.cpp
delete mode 100644 lib/Analysis/NSErrorChecker.cpp
delete mode 100644 lib/Analysis/NoReturnFunctionChecker.cpp
delete mode 100644 lib/Analysis/OSAtomicChecker.cpp
delete mode 100644 lib/Analysis/PathDiagnostic.cpp
delete mode 100644 lib/Analysis/PointerArithChecker.cpp
delete mode 100644 lib/Analysis/PointerSubChecker.cpp
create mode 100644 lib/Analysis/PrintfFormatString.cpp
delete mode 100644 lib/Analysis/PthreadLockChecker.cpp
delete mode 100644 lib/Analysis/RangeConstraintManager.cpp
delete mode 100644 lib/Analysis/RegionStore.cpp
delete mode 100644 lib/Analysis/ReturnPointerRangeChecker.cpp
delete mode 100644 lib/Analysis/ReturnStackAddressChecker.cpp
delete mode 100644 lib/Analysis/ReturnUndefChecker.cpp
delete mode 100644 lib/Analysis/SVals.cpp
delete mode 100644 lib/Analysis/SValuator.cpp
delete mode 100644 lib/Analysis/SimpleConstraintManager.cpp
delete mode 100644 lib/Analysis/SimpleConstraintManager.h
delete mode 100644 lib/Analysis/SimpleSValuator.cpp
delete mode 100644 lib/Analysis/Store.cpp
delete mode 100644 lib/Analysis/SymbolManager.cpp
delete mode 100644 lib/Analysis/UndefBranchChecker.cpp
delete mode 100644 lib/Analysis/UndefResultChecker.cpp
delete mode 100644 lib/Analysis/UndefinedArraySubscriptChecker.cpp
delete mode 100644 lib/Analysis/UndefinedAssignmentChecker.cpp
delete mode 100644 lib/Analysis/VLASizeChecker.cpp
delete mode 100644 lib/Analysis/ValueManager.cpp
create mode 100644 lib/Checker/AdjustedReturnValueChecker.cpp
create mode 100644 lib/Checker/ArrayBoundChecker.cpp
create mode 100644 lib/Checker/AttrNonNullChecker.cpp
create mode 100644 lib/Checker/BasicConstraintManager.cpp
create mode 100644 lib/Checker/BasicObjCFoundationChecks.cpp
create mode 100644 lib/Checker/BasicObjCFoundationChecks.h
create mode 100644 lib/Checker/BasicStore.cpp
create mode 100644 lib/Checker/BasicValueFactory.cpp
create mode 100644 lib/Checker/BugReporter.cpp
create mode 100644 lib/Checker/BugReporterVisitors.cpp
create mode 100644 lib/Checker/BuiltinFunctionChecker.cpp
create mode 100644 lib/Checker/CFRefCount.cpp
create mode 100644 lib/Checker/CMakeLists.txt
create mode 100644 lib/Checker/CallAndMessageChecker.cpp
create mode 100644 lib/Checker/CallInliner.cpp
create mode 100644 lib/Checker/CastToStructChecker.cpp
create mode 100644 lib/Checker/CheckDeadStores.cpp
create mode 100644 lib/Checker/CheckObjCDealloc.cpp
create mode 100644 lib/Checker/CheckObjCInstMethSignature.cpp
create mode 100644 lib/Checker/CheckObjCUnusedIVars.cpp
create mode 100644 lib/Checker/CheckSecuritySyntaxOnly.cpp
create mode 100644 lib/Checker/CheckSizeofPointer.cpp
create mode 100644 lib/Checker/Checker.cpp
create mode 100644 lib/Checker/CocoaConventions.cpp
create mode 100644 lib/Checker/DereferenceChecker.cpp
create mode 100644 lib/Checker/DivZeroChecker.cpp
create mode 100644 lib/Checker/Environment.cpp
create mode 100644 lib/Checker/ExplodedGraph.cpp
create mode 100644 lib/Checker/FixedAddressChecker.cpp
create mode 100644 lib/Checker/FlatStore.cpp
create mode 100644 lib/Checker/GRBlockCounter.cpp
create mode 100644 lib/Checker/GRCoreEngine.cpp
create mode 100644 lib/Checker/GRExprEngine.cpp
create mode 100644 lib/Checker/GRExprEngineExperimentalChecks.cpp
create mode 100644 lib/Checker/GRExprEngineExperimentalChecks.h
create mode 100644 lib/Checker/GRExprEngineInternalChecks.h
create mode 100644 lib/Checker/GRState.cpp
create mode 100644 lib/Checker/LLVMConventionsChecker.cpp
create mode 100644 lib/Checker/Makefile
create mode 100644 lib/Checker/MallocChecker.cpp
create mode 100644 lib/Checker/ManagerRegistry.cpp
create mode 100644 lib/Checker/MemRegion.cpp
create mode 100644 lib/Checker/NSAutoreleasePoolChecker.cpp
create mode 100644 lib/Checker/NSErrorChecker.cpp
create mode 100644 lib/Checker/NoReturnFunctionChecker.cpp
create mode 100644 lib/Checker/OSAtomicChecker.cpp
create mode 100644 lib/Checker/PathDiagnostic.cpp
create mode 100644 lib/Checker/PointerArithChecker.cpp
create mode 100644 lib/Checker/PointerSubChecker.cpp
create mode 100644 lib/Checker/PthreadLockChecker.cpp
create mode 100644 lib/Checker/RangeConstraintManager.cpp
create mode 100644 lib/Checker/RegionStore.cpp
create mode 100644 lib/Checker/ReturnPointerRangeChecker.cpp
create mode 100644 lib/Checker/ReturnStackAddressChecker.cpp
create mode 100644 lib/Checker/ReturnUndefChecker.cpp
create mode 100644 lib/Checker/SVals.cpp
create mode 100644 lib/Checker/SValuator.cpp
create mode 100644 lib/Checker/SimpleConstraintManager.cpp
create mode 100644 lib/Checker/SimpleConstraintManager.h
create mode 100644 lib/Checker/SimpleSValuator.cpp
create mode 100644 lib/Checker/Store.cpp
create mode 100644 lib/Checker/SymbolManager.cpp
create mode 100644 lib/Checker/UndefBranchChecker.cpp
create mode 100644 lib/Checker/UndefCapturedBlockVarChecker.cpp
create mode 100644 lib/Checker/UndefResultChecker.cpp
create mode 100644 lib/Checker/UndefinedArraySubscriptChecker.cpp
create mode 100644 lib/Checker/UndefinedAssignmentChecker.cpp
create mode 100644 lib/Checker/VLASizeChecker.cpp
create mode 100644 lib/Checker/ValueManager.cpp
create mode 100644 lib/Frontend/ASTMerge.cpp
create mode 100644 test/ASTMerge/Inputs/enum1.c
create mode 100644 test/ASTMerge/Inputs/enum2.c
create mode 100644 test/ASTMerge/Inputs/function1.c
create mode 100644 test/ASTMerge/Inputs/function2.c
create mode 100644 test/ASTMerge/Inputs/interface1.m
create mode 100644 test/ASTMerge/Inputs/interface2.m
create mode 100644 test/ASTMerge/Inputs/lit.local.cfg
create mode 100644 test/ASTMerge/Inputs/struct1.c
create mode 100644 test/ASTMerge/Inputs/struct2.c
create mode 100644 test/ASTMerge/Inputs/typedef1.c
create mode 100644 test/ASTMerge/Inputs/typedef2.c
create mode 100644 test/ASTMerge/Inputs/var1.c
create mode 100644 test/ASTMerge/Inputs/var1.h
create mode 100644 test/ASTMerge/Inputs/var2.c
create mode 100644 test/ASTMerge/enum.c
create mode 100644 test/ASTMerge/function.c
create mode 100644 test/ASTMerge/interface.m
create mode 100644 test/ASTMerge/struct.c
create mode 100644 test/ASTMerge/typedef.c
create mode 100644 test/ASTMerge/var.c
create mode 100644 test/Analysis/misc-ps-flat-store.c
create mode 100644 test/CXX/basic/basic.def.odr/p1-var.cpp
create mode 100644 test/CXX/class.access/p4.cpp
create mode 100644 test/CXX/class.access/p6.cpp
create mode 100644 test/CXX/conv/conv.mem/p4.cpp
create mode 100644 test/CXX/conv/conv.qual/pr6089.cpp
create mode 100644 test/CXX/dcl.dcl/dcl.enum/p5.cpp
create mode 100644 test/CXX/dcl.dcl/dcl.link/p7.cpp
create mode 100644 test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp
create mode 100644 test/CXX/dcl.decl/dcl.init/p6.cpp
create mode 100644 test/CXX/dcl.decl/dcl.name/p1.cpp
create mode 100644 test/CXX/lex/lex.literal/lex.ccon/p1.cpp
create mode 100644 test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
create mode 100644 test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
create mode 100644 test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp
create mode 100644 test/CXX/temp/temp.names/p4.cpp
create mode 100644 test/CXX/temp/temp.res/temp.local/p1.cpp
create mode 100644 test/CodeGen/2010-02-09-DbgSelf.m
create mode 100644 test/CodeGen/2010-02-15-Dbg-MethodStart.m
create mode 100644 test/CodeGen/debug-info-crash.c
delete mode 100644 test/CodeGenCXX/PR4890-debug-info-dtor.cpp
create mode 100644 test/CodeGenCXX/alloca-align.cpp
create mode 100644 test/CodeGenCXX/internal-linkage.cpp
create mode 100644 test/CodeGenCXX/mangle-exprs.cpp
create mode 100644 test/CodeGenCXX/member-function-pointer-calls.cpp
create mode 100644 test/CodeGenCXX/member-initializers.cpp
delete mode 100644 test/CodeGenCXX/member-pointer-cast.cpp
delete mode 100644 test/CodeGenCXX/member-pointers-zero-init.cpp
create mode 100644 test/CodeGenCXX/no-exceptions.cpp
create mode 100644 test/CodeGenCXX/pointers-to-data-members.cpp
create mode 100644 test/CodeGenCXX/threadsafe-statics.cpp
create mode 100644 test/CodeGenCXX/visibility.cpp
create mode 100644 test/CodeGenCXX/vtable-layout.cpp
create mode 100644 test/CodeGenCXX/vtable-pointer-initialization.cpp
create mode 100644 test/CodeGenCXX/x86_32-arguments.cpp
delete mode 100644 test/CodeGenObjC/PR4541.m
delete mode 100644 test/CodeGenObjC/PR4894-recursive-debug-crash.m
create mode 100644 test/CodeGenObjC/blocks-4.m
create mode 100644 test/CodeGenObjC/debug-info-crash.m
create mode 100644 test/CodeGenObjC/objc2-legacy-dispatch.m
create mode 100644 test/CodeGenObjC/objc2-weak-block-call.m
create mode 100644 test/CodeGenObjC/unwind-fn.m
create mode 100644 test/Driver/darwin-iphone-defaults.m
create mode 100644 test/Driver/rewrite-objc.m
create mode 100644 test/FixIt/typo-crash.m
create mode 100644 test/Index/annotate-tokens.c
create mode 100644 test/Index/cindex-test-inclusions.c
create mode 100644 test/Index/code-complete-errors.c
create mode 100644 test/Index/include_test.h
create mode 100644 test/Index/include_test_2.h
create mode 100644 test/Index/load-stmts.cpp
create mode 100644 test/Parser/altivec.c
create mode 100644 test/Parser/cxx-altivec.cpp
create mode 100644 test/Preprocessor/mi_opt2.c
create mode 100644 test/Preprocessor/mi_opt2.h
create mode 100644 test/Rewriter/blockcast3.mm
create mode 100644 test/Rewriter/rewrite-block-pointer.mm
create mode 100644 test/Rewriter/rewrite-cast-ivar-access.mm
create mode 100644 test/Rewriter/rewrite-category-property.mm
create mode 100644 test/Rewriter/rewrite-implementation.mm
create mode 100644 test/Rewriter/rewrite-message-expr.mm
create mode 100644 test/Rewriter/rewrite-nested-ivar.mm
create mode 100644 test/Rewriter/rewrite-protocol-qualified.mm
create mode 100644 test/Rewriter/rewrite-unique-block-api.mm
create mode 100644 test/Sema/Inputs/conversion.h
create mode 100644 test/Sema/arm-layout.c
create mode 100644 test/Sema/warn-unused-function.c
create mode 100644 test/Sema/x86-attr-force-align-arg-pointer.c
create mode 100644 test/SemaCXX/Inputs/lit.local.cfg
create mode 100644 test/SemaCXX/Inputs/malloc.h
create mode 100644 test/SemaCXX/builtin-exception-spec.cpp
create mode 100644 test/SemaCXX/comma.cpp
create mode 100644 test/SemaCXX/explicit.cpp
create mode 100644 test/SemaCXX/new-delete-predefined-decl.cpp
create mode 100644 test/SemaCXX/templated-friend-decl.cpp
create mode 100644 test/SemaCXX/warn-missing-noreturn.cpp
create mode 100644 test/SemaCXX/warn-weak-vtables.cpp
create mode 100644 test/SemaObjC/default-synthesize.m
create mode 100644 test/SemaObjC/duplicate-property-class-extension.m
create mode 100644 test/SemaObjC/protocol-warn.m
create mode 100644 test/SemaObjCXX/reinterpret-cast-objc-pointertype.mm
create mode 100644 tools/CIndex/CIndexDiagnostic.cpp
create mode 100644 tools/CIndex/CIndexDiagnostic.h
create mode 100644 tools/CIndex/CIndexInclusionStack.cpp
create mode 100644 tools/CIndex/CXSourceLocation.h
create mode 100755 tools/scan-build/set-xcode-analyzer
create mode 100644 www/analyzer/dev_cxx.html
create mode 100644 www/analyzer/images/analyzer_html.png
create mode 100644 www/analyzer/images/analyzer_xcode.png
create mode 100644 www/analyzer/images/tree/bullet.gif
create mode 100644 www/analyzer/images/tree/minus.gif
create mode 100644 www/analyzer/images/tree/plus.gif
create mode 100644 www/analyzer/menu.js
create mode 100644 www/analyzer/scripts/dbtree.js
create mode 100644 www/analyzer/scripts/menu.js
diff --git a/bindings/python/README.txt b/bindings/python/README.txt
new file mode 100644
index 000000000000..ccc2619ccf5b
--- /dev/null
+++ b/bindings/python/README.txt
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+// Clang Python Bindings
+//===----------------------------------------------------------------------===//
+
+This directory implements Python bindings for Clang. Currently, only bindings
+for the CIndex C API exist.
+
+You may need to alter LD_LIBRARY_PATH so that the CIndex library can be
+found. The unit tests are designed to be run with 'nosetests'. For example:
+--
+$ env PYTHONPATH=$(echo ~/llvm/tools/clang/bindings/python/) \
+ LD_LIBRARY_PATH=$(llvm-config --libdir) \
+ nosetests -v
+tests.cindex.test_index.test_create ... ok
+...
+
+OK
+--
diff --git a/bindings/python/clang/__init__.py b/bindings/python/clang/__init__.py
new file mode 100644
index 000000000000..88f30812383f
--- /dev/null
+++ b/bindings/python/clang/__init__.py
@@ -0,0 +1,24 @@
+#===- __init__.py - Clang Python Bindings --------------------*- python -*--===#
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+r"""
+Clang Library Bindings
+======================
+
+This package provides access to the Clang compiler and libraries.
+
+The available modules are:
+
+ cindex
+
+ Bindings for the Clang indexing library.
+"""
+
+__all__ = ['cindex']
+
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py
new file mode 100644
index 000000000000..c37c69b79b38
--- /dev/null
+++ b/bindings/python/clang/cindex.py
@@ -0,0 +1,933 @@
+#===- cindex.py - Python Indexing Library Bindings -----------*- python -*--===#
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+r"""
+Clang Indexing Library Bindings
+===============================
+
+This module provides an interface to the Clang indexing library. It is a
+low-level interface to the indexing library which attempts to match the Clang
+API directly while also being "pythonic". Notable differences from the C API
+are:
+
+ * string results are returned as Python strings, not CXString objects.
+
+ * null cursors are translated to None.
+
+ * access to child cursors is done via iteration, not visitation.
+
+The major indexing objects are:
+
+ Index
+
+ The top-level object which manages some global library state.
+
+ TranslationUnit
+
+ High-level object encapsulating the AST for a single translation unit. These
+ can be loaded from .ast files or parsed on the fly.
+
+ Cursor
+
+ Generic object for representing a node in the AST.
+
+ SourceRange, SourceLocation, and File
+
+ Objects representing information about the input source.
+
+Most object information is exposed using properties, when the underlying API
+call is efficient.
+"""
+
+# TODO
+# ====
+#
+# o API support for invalid translation units. Currently we can't even get the
+# diagnostics on failure because they refer to locations in an object that
+# will have been invalidated.
+#
+# o fix memory management issues (currently client must hold on to index and
+# translation unit, or risk crashes).
+#
+# o expose code completion APIs.
+#
+# o cleanup ctypes wrapping, would be nice to separate the ctypes details more
+# clearly, and hide from the external interface (i.e., help(cindex)).
+#
+# o implement additional SourceLocation, SourceRange, and File methods.
+
+from ctypes import *
+
+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
+ # CIndex library. It could be on path or elsewhere, or versioned, etc.
+ import platform
+ name = platform.system()
+ if name == 'Darwin':
+ return cdll.LoadLibrary('libCIndex.dylib')
+ elif name == 'Windows':
+ return cdll.LoadLibrary('libCIndex.dll')
+ else:
+ return cdll.LoadLibrary('libCIndex.so')
+
+# ctypes doesn't implicitly convert c_void_p to the appropriate wrapper
+# object. This is a problem, because it means that from_parameter will see an
+# integer and pass the wrong value on platforms where int != void*. Work around
+# this by marshalling object arguments as void**.
+c_object_p = POINTER(c_void_p)
+
+lib = get_cindex_library()
+
+### Structures and Utility Classes ###
+
+class _CXString(Structure):
+ """Helper for transforming CXString results."""
+
+ _fields_ = [("spelling", c_char_p), ("free", c_int)]
+
+ def __del__(self):
+ _CXString_dispose(self)
+
+ @staticmethod
+ def from_result(res, fn, args):
+ assert isinstance(res, _CXString)
+ return _CXString_getCString(res)
+
+class SourceLocation(Structure):
+ """
+ A SourceLocation represents a particular location within a source file.
+ """
+ _fields_ = [("ptr_data", c_void_p * 2), ("int_data", c_uint)]
+ _data = None
+
+ 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))
+ f = File(f) if f else None
+ self._data = (f, int(l.value), int(c.value), int(c.value))
+ return self._data
+
+ @property
+ def file(self):
+ """Get the file represented by this source location."""
+ return self._get_instantiation()[0]
+
+ @property
+ def line(self):
+ """Get the line represented by this source location."""
+ return self._get_instantiation()[1]
+
+ @property
+ def column(self):
+ """Get the column represented by this source location."""
+ return self._get_instantiation()[2]
+
+ @property
+ def offset(self):
+ """Get the file offset represented by this source location."""
+ return self._get_instantiation()[3]
+
+ def __repr__(self):
+ return "" % (
+ self.file.name if self.file else None, self.line, self.column)
+
+class SourceRange(Structure):
+ """
+ A SourceRange describes a range of source locations within the source
+ code.
+ """
+ _fields_ = [
+ ("ptr_data", c_void_p * 2),
+ ("begin_int_data", c_uint),
+ ("end_int_data", c_uint)]
+
+ # FIXME: Eliminate this and make normal constructor? Requires hiding ctypes
+ # object.
+ @staticmethod
+ def from_locations(start, end):
+ return SourceRange_getRange(start, end)
+
+ @property
+ def start(self):
+ """
+ Return a SourceLocation representing the first character within a
+ source range.
+ """
+ return SourceRange_start(self)
+
+ @property
+ def end(self):
+ """
+ Return a SourceLocation representing the last character within a
+ source range.
+ """
+ return SourceRange_end(self)
+
+ def __repr__(self):
+ return "" % (self.start, self.end)
+
+class Diagnostic(object):
+ """
+ A Diagnostic is a single instance of a Clang diagnostic. It includes the
+ diagnostic severity, the message, the location the diagnostic occurred, as
+ well as additional source ranges and associated fix-it hints.
+ """
+
+ Ignored = 0
+ Note = 1
+ Warning = 2
+ Error = 3
+ Fatal = 4
+
+ def __init__(self, severity, location, spelling, ranges, fixits):
+ self.severity = severity
+ self.location = location
+ self.spelling = spelling
+ self.ranges = ranges
+ self.fixits = fixits
+
+ def __repr__(self):
+ return "" % (
+ self.severity, self.location, self.spelling)
+
+class FixIt(object):
+ """
+ A FixIt represents a transformation to be applied to the source to
+ "fix-it". The fix-it shouldbe applied by replacing the given source range
+ with the given value.
+ """
+
+ def __init__(self, range, value):
+ self.range = range
+ self.value = value
+
+ def __repr__(self):
+ return "" % (self.range, self.value)
+
+### Cursor Kinds ###
+
+class CursorKind(object):
+ """
+ A CursorKind describes the kind of entity that a cursor points to.
+ """
+
+ # The unique kind objects, indexed by id.
+ _kinds = []
+ _name_map = None
+
+ def __init__(self, value):
+ if value >= len(CursorKind._kinds):
+ CursorKind._kinds += [None] * (value - len(CursorKind._kinds) + 1)
+ if CursorKind._kinds[value] is not None:
+ raise ValueError,'CursorKind already loaded'
+ self.value = value
+ CursorKind._kinds[value] = self
+ CursorKind._name_map = None
+
+ def from_param(self):
+ return self.value
+
+ @property
+ def name(self):
+ """Get the enumeration name of this cursor kind."""
+ if self._name_map is None:
+ self._name_map = {}
+ for key,value in CursorKind.__dict__.items():
+ if isinstance(value,CursorKind):
+ self._name_map[value] = key
+ return self._name_map[self]
+
+ @staticmethod
+ def from_id(id):
+ if id >= len(CursorKind._kinds) or CursorKind._kinds[id] is None:
+ raise ValueError,'Unknown cursor kind'
+ return CursorKind._kinds[id]
+
+ @staticmethod
+ def get_all_kinds():
+ """Return all CursorKind enumeration instances."""
+ return filter(None, CursorKind._kinds)
+
+ def is_declaration(self):
+ """Test if this is a declaration kind."""
+ return CursorKind_is_decl(self)
+
+ def is_reference(self):
+ """Test if this is a reference kind."""
+ return CursorKind_is_ref(self)
+
+ def is_expression(self):
+ """Test if this is an expression kind."""
+ return CursorKind_is_expr(self)
+
+ def is_statement(self):
+ """Test if this is a statement kind."""
+ return CursorKind_is_stmt(self)
+
+ def is_invalid(self):
+ """Test if this is an invalid kind."""
+ return CursorKind_is_inv(self)
+
+ def __repr__(self):
+ return 'CursorKind.%s' % (self.name,)
+
+# FIXME: Is there a nicer way to expose this enumeration? We could potentially
+# represent the nested structure, or even build a class hierarchy. The main
+# things we want for sure are (a) simple external access to kinds, (b) a place
+# to hang a description and name, (c) easy to keep in sync with Index.h.
+
+###
+# Declaration Kinds
+
+# A declaration whose specific kind is not exposed via this interface.
+#
+# Unexposed declarations have the same operations as any other kind of
+# declaration; one can extract their location information, spelling, find their
+# definitions, etc. However, the specific kind of the declaration is not
+# reported.
+CursorKind.UNEXPOSED_DECL = CursorKind(1)
+
+# A C or C++ struct.
+CursorKind.STRUCT_DECL = CursorKind(2)
+
+# A C or C++ union.
+CursorKind.UNION_DECL = CursorKind(3)
+
+# A C++ class.
+CursorKind.CLASS_DECL = CursorKind(4)
+
+# An enumeration.
+CursorKind.ENUM_DECL = CursorKind(5)
+
+# A field (in C) or non-static data member (in C++) in a struct, union, or C++
+# class.
+CursorKind.FIELD_DECL = CursorKind(6)
+
+# An enumerator constant.
+CursorKind.ENUM_CONSTANT_DECL = CursorKind(7)
+
+# A function.
+CursorKind.FUNCTION_DECL = CursorKind(8)
+
+# A variable.
+CursorKind.VAR_DECL = CursorKind(9)
+
+# A function or method parameter.
+CursorKind.PARM_DECL = CursorKind(10)
+
+# An Objective-C @interface.
+CursorKind.OBJC_INTERFACE_DECL = CursorKind(11)
+
+# An Objective-C @interface for a category.
+CursorKind.OBJC_CATEGORY_DECL = CursorKind(12)
+
+# An Objective-C @protocol declaration.
+CursorKind.OBJC_PROTOCOL_DECL = CursorKind(13)
+
+# An Objective-C @property declaration.
+CursorKind.OBJC_PROPERTY_DECL = CursorKind(14)
+
+# An Objective-C instance variable.
+CursorKind.OBJC_IVAR_DECL = CursorKind(15)
+
+# An Objective-C instance method.
+CursorKind.OBJC_INSTANCE_METHOD_DECL = CursorKind(16)
+
+# An Objective-C class method.
+CursorKind.OBJC_CLASS_METHOD_DECL = CursorKind(17)
+
+# An Objective-C @implementation.
+CursorKind.OBJC_IMPLEMENTATION_DECL = CursorKind(18)
+
+# An Objective-C @implementation for a category.
+CursorKind.OBJC_CATEGORY_IMPL_DECL = CursorKind(19)
+
+# A typedef.
+CursorKind.TYPEDEF_DECL = CursorKind(20)
+
+###
+# Reference Kinds
+
+CursorKind.OBJC_SUPER_CLASS_REF = CursorKind(40)
+CursorKind.OBJC_PROTOCOL_REF = CursorKind(41)
+CursorKind.OBJC_CLASS_REF = CursorKind(42)
+
+# A reference to a type declaration.
+#
+# A type reference occurs anywhere where a type is named but not
+# declared. For example, given:
+# typedef unsigned size_type;
+# size_type size;
+#
+# The typedef is a declaration of size_type (CXCursor_TypedefDecl),
+# while the type of the variable "size" is referenced. The cursor
+# referenced by the type of size is the typedef for size_type.
+CursorKind.TYPE_REF = CursorKind(43)
+
+###
+# Invalid/Error Kinds
+
+CursorKind.INVALID_FILE = CursorKind(70)
+CursorKind.NO_DECL_FOUND = CursorKind(71)
+CursorKind.NOT_IMPLEMENTED = CursorKind(72)
+
+###
+# Expression Kinds
+
+# An expression whose specific kind is not exposed via this interface.
+#
+# Unexposed expressions have the same operations as any other kind of
+# expression; one can extract their location information, spelling, children,
+# etc. However, the specific kind of the expression is not reported.
+CursorKind.UNEXPOSED_EXPR = CursorKind(100)
+
+# An expression that refers to some value declaration, such as a function,
+# varible, or enumerator.
+CursorKind.DECL_REF_EXPR = CursorKind(101)
+
+# An expression that refers to a member of a struct, union, class, Objective-C
+# class, etc.
+CursorKind.MEMBER_REF_EXPR = CursorKind(102)
+
+# An expression that calls a function.
+CursorKind.CALL_EXPR = CursorKind(103)
+
+# An expression that sends a message to an Objective-C object or class.
+CursorKind.OBJC_MESSAGE_EXPR = CursorKind(104)
+
+# A statement whose specific kind is not exposed via this interface.
+#
+# Unexposed statements have the same operations as any other kind of statement;
+# one can extract their location information, spelling, children, etc. However,
+# the specific kind of the statement is not reported.
+CursorKind.UNEXPOSED_STMT = CursorKind(200)
+
+###
+# Other Kinds
+
+# Cursor that represents the translation unit itself.
+#
+# The translation unit cursor exists primarily to act as the root cursor for
+# traversing the contents of a translation unit.
+CursorKind.TRANSLATION_UNIT = CursorKind(300)
+
+### Cursors ###
+
+class Cursor(Structure):
+ """
+ The Cursor class represents a reference to an element within the AST. It
+ acts as a kind of iterator.
+ """
+ _fields_ = [("_kind_id", c_int), ("data", c_void_p * 3)]
+
+ def __eq__(self, other):
+ return Cursor_eq(self, other)
+
+ def __ne__(self, other):
+ return not Cursor_eq(self, other)
+
+ def is_definition(self):
+ """
+ Returns true if the declaration pointed at by the cursor is also a
+ definition of that entity.
+ """
+ return Cursor_is_def(self)
+
+ def get_definition(self):
+ """
+ If the cursor is a reference to a declaration or a declaration of
+ some entity, return a cursor that points to the definition of that
+ entity.
+ """
+ # TODO: Should probably check that this is either a reference or
+ # declaration prior to issuing the lookup.
+ return Cursor_def(self)
+
+ def get_usr(self):
+ """Return the Unified Symbol Resultion (USR) for the entity referenced
+ by the given cursor (or None).
+
+ A Unified Symbol Resolution (USR) is a string that identifies a
+ particular entity (function, class, variable, etc.) within a
+ 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)
+
+ @property
+ def kind(self):
+ """Return the kind of this cursor."""
+ return CursorKind.from_id(self._kind_id)
+
+ @property
+ def spelling(self):
+ """Return the spelling of the entity pointed at by the cursor."""
+ if not self.kind.is_declaration():
+ # FIXME: clang_getCursorSpelling should be fixed to not assert on
+ # this, for consistency with clang_getCursorUSR.
+ return None
+ return Cursor_spelling(self)
+
+ @property
+ def location(self):
+ """
+ Return the source location (the starting character) of the entity
+ pointed at by the cursor.
+ """
+ return Cursor_loc(self)
+
+ @property
+ def extent(self):
+ """
+ Return the source range (the range of text) occupied by the entity
+ pointed at by the cursor.
+ """
+ return Cursor_extent(self)
+
+ def get_children(self):
+ """Return an iterator for accessing the children of this cursor."""
+
+ # FIXME: Expose iteration from CIndex, PR6125.
+ def visitor(child, parent, children):
+ # FIXME: Document this assertion in API.
+ # FIXME: There should just be an isNull method.
+ assert child != Cursor_null()
+ children.append(child)
+ return 1 # continue
+ children = []
+ Cursor_visit(self, Cursor_visit_callback(visitor), children)
+ return iter(children)
+
+ @staticmethod
+ def from_result(res, fn, args):
+ assert isinstance(res, Cursor)
+ # FIXME: There should just be an isNull method.
+ if res == Cursor_null():
+ return None
+ return res
+
+## CIndex Objects ##
+
+# CIndex objects (derived from ClangObject) are essentially lightweight
+# wrappers attached to some underlying object, which is exposed via CIndex as
+# a void*.
+
+class ClangObject(object):
+ """
+ A helper for Clang objects. This class helps act as an intermediary for
+ the ctypes library and the Clang CIndex library.
+ """
+ def __init__(self, obj):
+ assert isinstance(obj, c_object_p) and obj
+ self.obj = self._as_parameter_ = obj
+
+ def from_param(self):
+ return self._as_parameter_
+
+
+class _CXUnsavedFile(Structure):
+ """Helper for passing unsaved file arguments."""
+ _fields_ = [("name", c_char_p), ("contents", c_char_p), ('length', c_ulong)]
+
+## Diagnostic Conversion ##
+
+# Diagnostic objects are temporary, we must extract all the information from the
+# diagnostic object when it is passed to the callback.
+
+_clang_getDiagnosticSeverity = lib.clang_getDiagnosticSeverity
+_clang_getDiagnosticSeverity.argtypes = [c_object_p]
+_clang_getDiagnosticSeverity.restype = c_int
+
+_clang_getDiagnosticLocation = lib.clang_getDiagnosticLocation
+_clang_getDiagnosticLocation.argtypes = [c_object_p]
+_clang_getDiagnosticLocation.restype = SourceLocation
+
+_clang_getDiagnosticSpelling = lib.clang_getDiagnosticSpelling
+_clang_getDiagnosticSpelling.argtypes = [c_object_p]
+_clang_getDiagnosticSpelling.restype = _CXString
+_clang_getDiagnosticSpelling.errcheck = _CXString.from_result
+
+_clang_getDiagnosticNumRanges = lib.clang_getDiagnosticNumRanges
+_clang_getDiagnosticNumRanges.argtypes = [c_object_p]
+_clang_getDiagnosticNumRanges.restype = c_uint
+
+_clang_getDiagnosticRange = lib.clang_getDiagnosticRange
+_clang_getDiagnosticRange.argtypes = [c_object_p, c_uint]
+_clang_getDiagnosticRange.restype = SourceRange
+
+_clang_getDiagnosticNumFixIts = lib.clang_getDiagnosticNumFixIts
+_clang_getDiagnosticNumFixIts.argtypes = [c_object_p]
+_clang_getDiagnosticNumFixIts.restype = c_uint
+
+_clang_getDiagnosticFixItKind = lib.clang_getDiagnosticFixItKind
+_clang_getDiagnosticFixItKind.argtypes = [c_object_p, c_uint]
+_clang_getDiagnosticFixItKind.restype = c_int
+
+_clang_getDiagnosticFixItInsertion = lib.clang_getDiagnosticFixItInsertion
+_clang_getDiagnosticFixItInsertion.argtypes = [c_object_p, c_uint,
+ POINTER(SourceLocation)]
+_clang_getDiagnosticFixItInsertion.restype = _CXString
+_clang_getDiagnosticFixItInsertion.errcheck = _CXString.from_result
+
+_clang_getDiagnosticFixItRemoval = lib.clang_getDiagnosticFixItRemoval
+_clang_getDiagnosticFixItRemoval.argtypes = [c_object_p, c_uint,
+ POINTER(SourceLocation)]
+_clang_getDiagnosticFixItRemoval.restype = _CXString
+_clang_getDiagnosticFixItRemoval.errcheck = _CXString.from_result
+
+_clang_getDiagnosticFixItReplacement = lib.clang_getDiagnosticFixItReplacement
+_clang_getDiagnosticFixItReplacement.argtypes = [c_object_p, c_uint,
+ POINTER(SourceRange)]
+_clang_getDiagnosticFixItReplacement.restype = _CXString
+_clang_getDiagnosticFixItReplacement.errcheck = _CXString.from_result
+
+def _convert_fixit(diag_ptr, index):
+ # We normalize all the fix-its to a single representation, this is more
+ # convenient.
+ #
+ # FIXME: Push this back into API? It isn't exactly clear what the
+ # SourceRange semantics are, we should make sure we can represent an empty
+ # range.
+ kind = _clang_getDiagnosticFixItKind(diag_ptr, index)
+ range = None
+ value = None
+ if kind == 0: # insertion
+ location = SourceLocation()
+ value = _clang_getDiagnosticFixItInsertion(diag_ptr, index,
+ byref(location))
+ range = SourceRange.from_locations(location, location)
+ elif kind == 1: # removal
+ range = _clang_getDiagnosticFixItRemoval(diag_ptr, index)
+ value = ''
+ else: # replacement
+ assert kind == 2
+ range = SourceRange()
+ value = _clang_getDiagnosticFixItReplacement(diag_ptr, index,
+ byref(range))
+ return FixIt(range, value)
+
+def _convert_diag(diag_ptr, diag_list):
+ severity = _clang_getDiagnosticSeverity(diag_ptr)
+ loc = _clang_getDiagnosticLocation(diag_ptr)
+ spelling = _clang_getDiagnosticSpelling(diag_ptr)
+
+ # Diagnostic ranges.
+ num_ranges = _clang_getDiagnosticNumRanges(diag_ptr)
+ ranges = [_clang_getDiagnosticRange(diag_ptr, i)
+ for i in range(num_ranges)]
+
+ fixits = [_convert_fixit(diag_ptr, i)
+ for i in range(_clang_getDiagnosticNumFixIts(diag_ptr))]
+
+ diag_list.append(Diagnostic(severity, loc, spelling, ranges, fixits))
+
+###
+
+class Index(ClangObject):
+ """
+ The Index type provides the primary interface to the Clang CIndex library,
+ primarily by providing an interface for reading and parsing translation
+ units.
+ """
+
+ @staticmethod
+ def create(excludeDecls=False):
+ """
+ Create a new Index.
+ Parameters:
+ excludeDecls -- Exclude local declarations from translation units.
+ """
+ return Index(Index_create(excludeDecls))
+
+ def __del__(self):
+ Index_dispose(self)
+
+ def read(self, path):
+ """Load the translation unit from the given AST file."""
+ # FIXME: In theory, we could support streaming diagnostics. It's hard to
+ # integrate this into the API cleanly, however. Resolve.
+ diags = []
+ ptr = TranslationUnit_read(self, path,
+ Diagnostic_callback(_convert_diag), diags)
+ return TranslationUnit(ptr) if ptr else None
+
+ def parse(self, path, args = [], unsaved_files = []):
+ """
+ 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.
+
+ In-memory contents for files can be provided by passing a list of pairs
+ 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)
+ # FIXME: In theory, we could support streaming diagnostics. It's hard to
+ # integrate this into the API cleanly, however. Resolve.
+ diags = []
+ ptr = TranslationUnit_parse(self, path, len(args), arg_array,
+ len(unsaved_files), unsaved_files_array,
+ Diagnostic_callback(_convert_diag), diags)
+ return TranslationUnit(ptr, diags) if ptr else None
+
+
+class TranslationUnit(ClangObject):
+ """
+ The TranslationUnit class represents a source code translation unit and
+ provides read-only access to its top-level declarations.
+ """
+
+ def __init__(self, ptr, diagnostics):
+ ClangObject.__init__(self, ptr)
+ self.diagnostics = diagnostics
+
+ def __del__(self):
+ TranslationUnit_dispose(self)
+
+ @property
+ def cursor(self):
+ """Retrieve the cursor that represents the given translation unit."""
+ return TranslationUnit_cursor(self)
+
+ @property
+ def spelling(self):
+ """Get the original translation unit source file name."""
+ return TranslationUnit_spelling(self)
+
+ def get_includes(self):
+ """
+ Return an iterable sequence of FileInclusion objects that describe the
+ sequence of inclusions in a translation unit. The first object in
+ this sequence is always the input file. Note that this method will not
+ recursively iterate over header files included through precompiled
+ headers.
+ """
+ def visitor(fobj, lptr, depth, includes):
+ loc = lptr.contents
+ includes.append(FileInclusion(loc.file, File(fobj), loc, depth))
+
+ # Automatically adapt CIndex/ctype pointers to python objects
+ includes = []
+ TranslationUnit_includes(self,
+ TranslationUnit_includes_callback(visitor),
+ includes)
+ return iter(includes)
+
+class File(ClangObject):
+ """
+ The File class represents a particular source file that is part of a
+ translation unit.
+ """
+
+ @property
+ def name(self):
+ """Return the complete file and path name of the file."""
+ return File_name(self)
+
+ @property
+ def time(self):
+ """Return the last modification time of the file."""
+ return File_time(self)
+
+class FileInclusion(object):
+ """
+ The FileInclusion class represents the inclusion of one source file by
+ another via a '#include' directive or as the input file for the translation
+ unit. This class provides information about the included file, the including
+ file, the location of the '#include' directive and the depth of the included
+ file in the stack. Note that the input file has depth 0.
+ """
+
+ def __init__(self, src, tgt, loc, depth):
+ self.source = src
+ self.include = tgt
+ self.location = loc
+ self.depth = depth
+
+ @property
+ def is_input_file(self):
+ """True if the included file is the input file."""
+ return self.depth == 0
+
+# Additional Functions and Types
+
+# String Functions
+_CXString_dispose = lib.clang_disposeString
+_CXString_dispose.argtypes = [_CXString]
+
+_CXString_getCString = lib.clang_getCString
+_CXString_getCString.argtypes = [_CXString]
+_CXString_getCString.restype = c_char_p
+
+# 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)]
+
+# 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
+
+# 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_inv = lib.clang_isInvalid
+CursorKind_is_inv.argtypes = [CursorKind]
+CursorKind_is_inv.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 = c_uint
+
+Cursor_spelling = lib.clang_getCursorSpelling
+Cursor_spelling.argtypes = [Cursor]
+Cursor_spelling.restype = _CXString
+Cursor_spelling.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_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
+
+# Index Functions
+Index_create = lib.clang_createIndex
+Index_create.argtypes = [c_int]
+Index_create.restype = c_object_p
+
+Index_dispose = lib.clang_disposeIndex
+Index_dispose.argtypes = [Index]
+
+# Translation Unit Functions
+Diagnostic_callback = CFUNCTYPE(None, c_object_p, py_object)
+
+TranslationUnit_read = lib.clang_createTranslationUnit
+TranslationUnit_read.argtypes = [Index, c_char_p,
+ Diagnostic_callback, py_object]
+TranslationUnit_read.restype = c_object_p
+
+TranslationUnit_parse = lib.clang_createTranslationUnitFromSourceFile
+TranslationUnit_parse.argtypes = [Index, c_char_p, c_int, c_void_p,
+ c_int, c_void_p,
+ Diagnostic_callback, py_object]
+TranslationUnit_parse.restype = c_object_p
+
+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_name = lib.clang_getFileName
+File_name.argtypes = [File]
+File_name.restype = c_char_p
+
+File_time = lib.clang_getFileTime
+File_time.argtypes = [File]
+File_time.restype = c_uint
+
+###
+
+__all__ = ['Index', 'TranslationUnit', 'Cursor', 'CursorKind',
+ 'Diagnostic', 'FixIt', 'SourceRange', 'SourceLocation', 'File']
diff --git a/bindings/python/examples/cindex/cindex-dump.py b/bindings/python/examples/cindex/cindex-dump.py
new file mode 100644
index 000000000000..af7ddab6ea53
--- /dev/null
+++ b/bindings/python/examples/cindex/cindex-dump.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+
+#===- cindex-dump.py - cindex/Python Source Dump -------------*- python -*--===#
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+"""
+A simple command line tool for dumping a source file using the Clang Index
+Library.
+"""
+
+def get_diag_info(diag):
+ return { 'severity' : diag.severity,
+ 'location' : diag.location,
+ 'spelling' : diag.spelling,
+ 'ranges' : diag.ranges,
+ 'fixits' : diag.fixits }
+
+def get_cursor_id(cursor, cursor_list = []):
+ if not opts.showIDs:
+ return None
+
+ if cursor is None:
+ return None
+
+ # FIXME: This is really slow. It would be nice if the index API exposed
+ # something that let us hash cursors.
+ for i,c in enumerate(cursor_list):
+ if cursor == c:
+ return i
+ cursor_list.append(cursor)
+ return len(cursor_list) - 1
+
+def get_info(node, depth=0):
+ if opts.maxDepth is not None and depth >= opts.maxDepth:
+ children = None
+ else:
+ children = [get_info(c, depth+1)
+ for c in node.get_children()]
+ return { 'id' : get_cursor_id(node),
+ 'kind' : node.kind,
+ 'usr' : node.get_usr(),
+ 'spelling' : node.spelling,
+ 'location' : node.location,
+ 'extent.start' : node.extent.start,
+ 'extent.end' : node.extent.end,
+ 'is_definition' : node.is_definition(),
+ 'definition id' : get_cursor_id(node.get_definition()),
+ 'children' : children }
+
+def main():
+ from clang.cindex import Index
+ from pprint import pprint
+
+ from optparse import OptionParser, OptionGroup
+
+ global opts
+
+ parser = OptionParser("usage: %prog [options] {filename} [clang-args*]")
+ parser.add_option("", "--show-ids", dest="showIDs",
+ help="Don't compute cursor IDs (very slow)",
+ default=False)
+ parser.add_option("", "--max-depth", dest="maxDepth",
+ help="Limit cursor expansion to depth N",
+ metavar="N", type=int, default=None)
+ parser.disable_interspersed_args()
+ (opts, args) = parser.parse_args()
+
+ if len(args) == 0:
+ parser.error('invalid number arguments')
+
+ index = Index.create()
+ tu = index.parse(None, args)
+ if not tu:
+ parser.error("unable to load input")
+
+ pprint(('diags', map(get_diag_info, tu.diagnostics)))
+ pprint(('nodes', get_info(tu.cursor)))
+
+if __name__ == '__main__':
+ main()
+
diff --git a/bindings/python/examples/cindex/cindex-includes.py b/bindings/python/examples/cindex/cindex-includes.py
new file mode 100644
index 000000000000..17500227a349
--- /dev/null
+++ b/bindings/python/examples/cindex/cindex-includes.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+#===- cindex-includes.py - cindex/Python Inclusion Graph -----*- python -*--===#
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+"""
+A simple command line tool for dumping a Graphviz description (dot) that
+describes include dependencies.
+"""
+
+def main():
+ import sys
+ from clang.cindex import Index
+
+ from optparse import OptionParser, OptionGroup
+
+ parser = OptionParser("usage: %prog [options] {filename} [clang-args*]")
+ parser.disable_interspersed_args()
+ (opts, args) = parser.parse_args()
+ if len(args) == 0:
+ parser.error('invalid number arguments')
+
+ # FIXME: Add an output file option
+ out = sys.stdout
+
+ index = Index.create()
+ tu = index.parse(None, args)
+ if not tu:
+ parser.error("unable to load input")
+
+ # A helper function for generating the node name.
+ def name(f):
+ if f:
+ return "\"" + f.name + "\""
+
+ # Generate the include graph
+ out.write("digraph G {\n")
+ for i in tu.get_includes():
+ line = " ";
+ if i.is_input_file:
+ # Always write the input file as a node just in case it doesn't
+ # actually include anything. This would generate a 1 node graph.
+ line += name(i.include)
+ else:
+ line += '%s->%s' % (name(i.source), name(i.include))
+ line += "\n";
+ out.write(line)
+ out.write("}\n")
+
+if __name__ == '__main__':
+ main()
+
diff --git a/bindings/python/tests/__init__.py b/bindings/python/tests/__init__.py
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/bindings/python/tests/cindex/INPUTS/header1.h b/bindings/python/tests/cindex/INPUTS/header1.h
new file mode 100644
index 000000000000..b4eacbee3754
--- /dev/null
+++ b/bindings/python/tests/cindex/INPUTS/header1.h
@@ -0,0 +1,6 @@
+#ifndef HEADER1
+#define HEADER1
+
+#include "header3.h"
+
+#endif
diff --git a/bindings/python/tests/cindex/INPUTS/header2.h b/bindings/python/tests/cindex/INPUTS/header2.h
new file mode 100644
index 000000000000..c4eddc0c5620
--- /dev/null
+++ b/bindings/python/tests/cindex/INPUTS/header2.h
@@ -0,0 +1,6 @@
+#ifndef HEADER2
+#define HEADER2
+
+#include "header3.h"
+
+#endif
diff --git a/bindings/python/tests/cindex/INPUTS/header3.h b/bindings/python/tests/cindex/INPUTS/header3.h
new file mode 100644
index 000000000000..6dca764860e1
--- /dev/null
+++ b/bindings/python/tests/cindex/INPUTS/header3.h
@@ -0,0 +1,3 @@
+// Not a guarded header!
+
+void f();
diff --git a/bindings/python/tests/cindex/INPUTS/hello.cpp b/bindings/python/tests/cindex/INPUTS/hello.cpp
new file mode 100644
index 000000000000..7ef086e56b2c
--- /dev/null
+++ b/bindings/python/tests/cindex/INPUTS/hello.cpp
@@ -0,0 +1,6 @@
+#include "stdio.h"
+
+int main(int argc, char* argv[]) {
+ printf("hello world\n");
+ return 0;
+}
diff --git a/bindings/python/tests/cindex/INPUTS/include.cpp b/bindings/python/tests/cindex/INPUTS/include.cpp
new file mode 100644
index 000000000000..60cfdaae4d09
--- /dev/null
+++ b/bindings/python/tests/cindex/INPUTS/include.cpp
@@ -0,0 +1,5 @@
+#include "header1.h"
+#include "header2.h"
+#include "header1.h"
+
+int main() { }
diff --git a/bindings/python/tests/cindex/INPUTS/parse_arguments.c b/bindings/python/tests/cindex/INPUTS/parse_arguments.c
new file mode 100644
index 000000000000..7196486c78a1
--- /dev/null
+++ b/bindings/python/tests/cindex/INPUTS/parse_arguments.c
@@ -0,0 +1,2 @@
+int DECL_ONE = 1;
+int DECL_TWO = 2;
diff --git a/bindings/python/tests/cindex/__init__.py b/bindings/python/tests/cindex/__init__.py
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/bindings/python/tests/cindex/test_cursor.py b/bindings/python/tests/cindex/test_cursor.py
new file mode 100644
index 000000000000..a653ba7bf28e
--- /dev/null
+++ b/bindings/python/tests/cindex/test_cursor.py
@@ -0,0 +1,59 @@
+from clang.cindex import Index, CursorKind
+
+kInput = """\
+// FIXME: Find nicer way to drop builtins and other cruft.
+int start_decl;
+
+struct s0 {
+ int a;
+ int b;
+};
+
+struct s1;
+
+void f0(int a0, int a1) {
+ int l0, l1;
+
+ if (a0)
+ return;
+
+ for (;;) {
+ break;
+ }
+}
+"""
+
+def test_get_children():
+ index = Index.create()
+ tu = index.parse('t.c', unsaved_files = [('t.c',kInput)])
+
+ # Skip until past start_decl.
+ it = tu.cursor.get_children()
+ while it.next().spelling != 'start_decl':
+ pass
+
+ tu_nodes = list(it)
+
+ assert len(tu_nodes) == 3
+
+ assert tu_nodes[0].kind == CursorKind.STRUCT_DECL
+ assert tu_nodes[0].spelling == 's0'
+ assert tu_nodes[0].is_definition() == True
+ assert tu_nodes[0].location.file.name == 't.c'
+ assert tu_nodes[0].location.line == 4
+ assert tu_nodes[0].location.column == 8
+
+ s0_nodes = list(tu_nodes[0].get_children())
+ assert len(s0_nodes) == 2
+ assert s0_nodes[0].kind == CursorKind.FIELD_DECL
+ assert s0_nodes[0].spelling == 'a'
+ assert s0_nodes[1].kind == CursorKind.FIELD_DECL
+ assert s0_nodes[1].spelling == 'b'
+
+ assert tu_nodes[1].kind == CursorKind.STRUCT_DECL
+ assert tu_nodes[1].spelling == 's1'
+ assert tu_nodes[1].is_definition() == False
+
+ assert tu_nodes[2].kind == CursorKind.FUNCTION_DECL
+ assert tu_nodes[2].spelling == 'f0'
+ assert tu_nodes[2].is_definition() == True
diff --git a/bindings/python/tests/cindex/test_cursor_kind.py b/bindings/python/tests/cindex/test_cursor_kind.py
new file mode 100644
index 000000000000..bdfa31855835
--- /dev/null
+++ b/bindings/python/tests/cindex/test_cursor_kind.py
@@ -0,0 +1,27 @@
+from clang.cindex import CursorKind
+
+def test_name():
+ assert CursorKind.UNEXPOSED_DECL.name is 'UNEXPOSED_DECL'
+
+def test_get_all_kinds():
+ assert CursorKind.UNEXPOSED_DECL in CursorKind.get_all_kinds()
+ assert CursorKind.TRANSLATION_UNIT in CursorKind.get_all_kinds()
+
+def test_kind_groups():
+ """Check that every kind classifies to exactly one group."""
+
+ assert CursorKind.UNEXPOSED_DECL.is_declaration()
+ assert CursorKind.TYPE_REF.is_reference()
+ assert CursorKind.DECL_REF_EXPR.is_expression()
+ assert CursorKind.UNEXPOSED_STMT.is_statement()
+ assert CursorKind.INVALID_FILE.is_invalid()
+
+ for k in CursorKind.get_all_kinds():
+ group = [n for n in ('is_declaration', 'is_reference', 'is_expression',
+ 'is_statement', 'is_invalid')
+ if getattr(k, n)()]
+
+ if k == CursorKind.TRANSLATION_UNIT:
+ assert len(group) == 0
+ else:
+ assert len(group) == 1
diff --git a/bindings/python/tests/cindex/test_diagnostics.py b/bindings/python/tests/cindex/test_diagnostics.py
new file mode 100644
index 000000000000..85187652917b
--- /dev/null
+++ b/bindings/python/tests/cindex/test_diagnostics.py
@@ -0,0 +1,48 @@
+from clang.cindex import *
+
+def tu_from_source(source):
+ index = Index.create()
+ tu = index.parse('INPUT.c', unsaved_files = [('INPUT.c', source)])
+ # FIXME: Remove the need for this.
+ tu.index = index
+ return tu
+
+# FIXME: We need support for invalid translation units to test better.
+
+def test_diagnostic_warning():
+ tu = tu_from_source("""int f0() {}\n""")
+ assert len(tu.diagnostics) == 1
+ assert tu.diagnostics[0].severity == Diagnostic.Warning
+ assert tu.diagnostics[0].location.line == 1
+ assert tu.diagnostics[0].location.column == 11
+ assert (tu.diagnostics[0].spelling ==
+ 'control reaches end of non-void function')
+
+def test_diagnostic_note():
+ # FIXME: We aren't getting notes here for some reason.
+ index = Index.create()
+ tu = tu_from_source("""#define A x\nvoid *A = 1;\n""")
+ assert len(tu.diagnostics) == 1
+ assert tu.diagnostics[0].severity == Diagnostic.Warning
+ assert tu.diagnostics[0].location.line == 2
+ assert tu.diagnostics[0].location.column == 7
+ assert 'incompatible' in tu.diagnostics[0].spelling
+# assert tu.diagnostics[1].severity == Diagnostic.Note
+# assert tu.diagnostics[1].location.line == 1
+# assert tu.diagnostics[1].location.column == 11
+# assert tu.diagnostics[1].spelling == 'instantiated from'
+
+def test_diagnostic_fixit():
+ index = Index.create()
+ tu = tu_from_source("""struct { int f0; } x = { f0 : 1 };""")
+ assert len(tu.diagnostics) == 1
+ assert tu.diagnostics[0].severity == Diagnostic.Warning
+ assert tu.diagnostics[0].location.line == 1
+ assert tu.diagnostics[0].location.column == 31
+ assert tu.diagnostics[0].spelling.startswith('use of GNU old-style')
+ assert len(tu.diagnostics[0].fixits) == 1
+ assert tu.diagnostics[0].fixits[0].range.start.line == 1
+ assert tu.diagnostics[0].fixits[0].range.start.column == 26
+ assert tu.diagnostics[0].fixits[0].range.end.line == 1
+ assert tu.diagnostics[0].fixits[0].range.end.column == 30
+ assert tu.diagnostics[0].fixits[0].value == '.f0 = '
diff --git a/bindings/python/tests/cindex/test_index.py b/bindings/python/tests/cindex/test_index.py
new file mode 100644
index 000000000000..dc173f04d218
--- /dev/null
+++ b/bindings/python/tests/cindex/test_index.py
@@ -0,0 +1,15 @@
+from clang.cindex import *
+import os
+
+kInputsDir = os.path.join(os.path.dirname(__file__), 'INPUTS')
+
+def test_create():
+ index = Index.create()
+
+# FIXME: test Index.read
+
+def test_parse():
+ index = Index.create()
+ assert isinstance(index, Index)
+ tu = index.parse(os.path.join(kInputsDir, 'hello.cpp'))
+ assert isinstance(tu, TranslationUnit)
diff --git a/bindings/python/tests/cindex/test_translation_unit.py b/bindings/python/tests/cindex/test_translation_unit.py
new file mode 100644
index 000000000000..3c05c3f06af4
--- /dev/null
+++ b/bindings/python/tests/cindex/test_translation_unit.py
@@ -0,0 +1,73 @@
+from clang.cindex import *
+import os
+
+kInputsDir = os.path.join(os.path.dirname(__file__), 'INPUTS')
+
+def test_spelling():
+ path = os.path.join(kInputsDir, 'hello.cpp')
+ index = Index.create()
+ tu = index.parse(path)
+ assert tu.spelling == path
+
+def test_cursor():
+ path = os.path.join(kInputsDir, 'hello.cpp')
+ index = Index.create()
+ tu = index.parse(path)
+ c = tu.cursor
+ assert isinstance(c, Cursor)
+ assert c.kind is CursorKind.TRANSLATION_UNIT
+
+def test_parse_arguments():
+ path = os.path.join(kInputsDir, 'parse_arguments.c')
+ index = Index.create()
+ tu = index.parse(path, ['-DDECL_ONE=hello', '-DDECL_TWO=hi'])
+ spellings = [c.spelling for c in tu.cursor.get_children()]
+ assert spellings[-2] == 'hello'
+ assert spellings[-1] == 'hi'
+
+def test_unsaved_files():
+ index = Index.create()
+ # FIXME: Why can't we just use "fake.h" here (instead of /tmp/fake.h)?
+ tu = index.parse('fake.c', unsaved_files = [
+ ('fake.c', """
+#include "/tmp/fake.h"
+int x;
+int SOME_DEFINE;
+"""),
+ ('/tmp/fake.h', """
+#define SOME_DEFINE y
+""")
+ ])
+ spellings = [c.spelling for c in tu.cursor.get_children()]
+ assert spellings[-2] == 'x'
+ assert spellings[-1] == 'y'
+
+def test_unsaved_files_2():
+ import StringIO
+ index = Index.create()
+ tu = index.parse('fake.c', unsaved_files = [
+ ('fake.c', StringIO.StringIO('int x;'))])
+ spellings = [c.spelling for c in tu.cursor.get_children()]
+ assert spellings[-1] == 'x'
+
+
+def test_includes():
+ def eq(expected, actual):
+ if not actual.is_input_file:
+ return expected[0] == actual.source.name and \
+ expected[1] == actual.include.name
+ else:
+ return expected[1] == actual.include.name
+
+ src = os.path.join(kInputsDir, 'include.cpp')
+ h1 = os.path.join(kInputsDir, "header1.h")
+ h2 = os.path.join(kInputsDir, "header2.h")
+ h3 = os.path.join(kInputsDir, "header3.h")
+ inc = [(None, src), (src, h1), (h1, h3), (src, h2), (h2, h3)]
+
+ index = Index.create()
+ tu = index.parse(src)
+ for i in zip(inc, tu.get_includes()):
+ assert eq(i[0], i[1])
+
+
diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj
index d1cd032ec033..e24b54d3e892 100644
--- a/clang.xcodeproj/project.pbxproj
+++ b/clang.xcodeproj/project.pbxproj
@@ -33,6 +33,12 @@
1A4C41BF105B4C0B0047B5E7 /* CGClass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4C41BE105B4C0B0047B5E7 /* CGClass.cpp */; };
1A535ED9107BC45E000C3AE7 /* CXXInheritance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A535ED8107BC45E000C3AE7 /* CXXInheritance.cpp */; };
1A5D5E580E5E81010023C059 /* CGCXX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A5D5E570E5E81010023C059 /* CGCXX.cpp */; };
+ 1A621BB7110FE6AA009E6834 /* TargetInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A621BB5110FE6AA009E6834 /* TargetInfo.cpp */; };
+ 1A621C4211111D61009E6834 /* CIndexCodeCompletion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A621C3A11111D61009E6834 /* CIndexCodeCompletion.cpp */; };
+ 1A621C4311111D61009E6834 /* CIndexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A621C3B11111D61009E6834 /* CIndexer.cpp */; };
+ 1A621C4411111D61009E6834 /* CIndexInclusionStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A621C3D11111D61009E6834 /* CIndexInclusionStack.cpp */; };
+ 1A621C4511111D61009E6834 /* CIndexUSRs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A621C3E11111D61009E6834 /* CIndexUSRs.cpp */; };
+ 1A621C4611111D61009E6834 /* CXCursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A621C3F11111D61009E6834 /* CXCursor.cpp */; };
1A6B6CD410693FC900BB4A8F /* CodeCompleteConsumer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6B6CD110693FC900BB4A8F /* CodeCompleteConsumer.cpp */; };
1A6B6CD510693FC900BB4A8F /* SemaCodeComplete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6B6CD210693FC900BB4A8F /* SemaCodeComplete.cpp */; };
1A6B6E9A1069833600BB4A8F /* CGExprCXX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6B6E991069833600BB4A8F /* CGExprCXX.cpp */; };
@@ -62,7 +68,6 @@
1ADD795610A90C6100741BBA /* TemplateBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ADD795310A90C6100741BBA /* TemplateBase.cpp */; };
1ADF47AF0F782C3200E48A8A /* SemaTemplateInstantiateDecl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ADF47AE0F782C3200E48A8A /* SemaTemplateInstantiateDecl.cpp */; };
1AE4EE3E103B89ED00888A23 /* StmtProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4EE3D103B89ED00888A23 /* StmtProfile.cpp */; };
- 1AE4EE40103B8A0A00888A23 /* TargetABIInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4EE3F103B8A0A00888A23 /* TargetABIInfo.cpp */; };
1AF1B50F109A4FB800AFAFAC /* CGException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF1B50E109A4FB800AFAFAC /* CGException.cpp */; };
1AFF8AE31012BFC900D248DA /* CGRecordLayoutBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFF8AE11012BFC900D248DA /* CGRecordLayoutBuilder.cpp */; };
3507E4C20E27FE2D00FB7B57 /* CheckObjCInstMethSignature.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3507E4C10E27FE2D00FB7B57 /* CheckObjCInstMethSignature.cpp */; };
@@ -382,6 +387,16 @@
1A535ED8107BC45E000C3AE7 /* CXXInheritance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CXXInheritance.cpp; path = lib/AST/CXXInheritance.cpp; sourceTree = ""; };
1A535EDB107BC47B000C3AE7 /* CanonicalType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CanonicalType.h; path = clang/AST/CanonicalType.h; sourceTree = ""; };
1A5D5E570E5E81010023C059 /* CGCXX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGCXX.cpp; path = lib/CodeGen/CGCXX.cpp; sourceTree = ""; tabWidth = 2; };
+ 1A621BB5110FE6AA009E6834 /* TargetInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = TargetInfo.cpp; path = lib/CodeGen/TargetInfo.cpp; sourceTree = ""; tabWidth = 2; };
+ 1A621BB6110FE6AA009E6834 /* TargetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = TargetInfo.h; path = lib/CodeGen/TargetInfo.h; sourceTree = ""; tabWidth = 2; };
+ 1A621C3A11111D61009E6834 /* CIndexCodeCompletion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CIndexCodeCompletion.cpp; path = tools/CIndex/CIndexCodeCompletion.cpp; sourceTree = ""; };
+ 1A621C3B11111D61009E6834 /* CIndexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CIndexer.cpp; path = tools/CIndex/CIndexer.cpp; sourceTree = ""; };
+ 1A621C3C11111D61009E6834 /* CIndexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CIndexer.h; path = tools/CIndex/CIndexer.h; sourceTree = ""; };
+ 1A621C3D11111D61009E6834 /* CIndexInclusionStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CIndexInclusionStack.cpp; path = tools/CIndex/CIndexInclusionStack.cpp; sourceTree = ""; };
+ 1A621C3E11111D61009E6834 /* CIndexUSRs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CIndexUSRs.cpp; path = tools/CIndex/CIndexUSRs.cpp; sourceTree = ""; };
+ 1A621C3F11111D61009E6834 /* CXCursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CXCursor.cpp; path = tools/CIndex/CXCursor.cpp; sourceTree = ""; };
+ 1A621C4011111D61009E6834 /* CXCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CXCursor.h; path = tools/CIndex/CXCursor.h; sourceTree = ""; };
+ 1A621C4111111D61009E6834 /* CXSourceLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CXSourceLocation.h; path = tools/CIndex/CXSourceLocation.h; sourceTree = ""; };
1A649E1D0F9599D9005B965E /* CGBlocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CGBlocks.h; path = lib/CodeGen/CGBlocks.h; sourceTree = ""; };
1A649E1E0F9599DA005B965E /* CGCXX.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = CGCXX.h; path = lib/CodeGen/CGCXX.h; sourceTree = ""; tabWidth = 2; };
1A6B6CD110693FC900BB4A8F /* CodeCompleteConsumer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CodeCompleteConsumer.cpp; path = lib/Sema/CodeCompleteConsumer.cpp; sourceTree = ""; tabWidth = 2; };
@@ -428,7 +443,6 @@
1ADF47AE0F782C3200E48A8A /* SemaTemplateInstantiateDecl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = SemaTemplateInstantiateDecl.cpp; path = lib/Sema/SemaTemplateInstantiateDecl.cpp; sourceTree = ""; tabWidth = 2; };
1AE4EE3B103B89CA00888A23 /* TreeTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = TreeTransform.h; path = lib/Sema/TreeTransform.h; sourceTree = ""; tabWidth = 2; };
1AE4EE3D103B89ED00888A23 /* StmtProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = StmtProfile.cpp; path = lib/AST/StmtProfile.cpp; sourceTree = ""; tabWidth = 2; };
- 1AE4EE3F103B8A0A00888A23 /* TargetABIInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = TargetABIInfo.cpp; path = lib/CodeGen/TargetABIInfo.cpp; sourceTree = ""; tabWidth = 2; };
1AF1B50E109A4FB800AFAFAC /* CGException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGException.cpp; path = lib/CodeGen/CGException.cpp; sourceTree = ""; tabWidth = 2; };
1AFF8AE11012BFC900D248DA /* CGRecordLayoutBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGRecordLayoutBuilder.cpp; path = lib/CodeGen/CGRecordLayoutBuilder.cpp; sourceTree = ""; tabWidth = 2; };
1AFF8AE21012BFC900D248DA /* CGRecordLayoutBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = CGRecordLayoutBuilder.h; path = lib/CodeGen/CGRecordLayoutBuilder.h; sourceTree = ""; tabWidth = 2; };
@@ -543,7 +557,6 @@
9012911510470FCE0083456D /* Index.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Index.h; path = "clang-c/Index.h"; sourceTree = ""; };
9012911C1048068D0083456D /* ASTUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ASTUnit.cpp; path = lib/Frontend/ASTUnit.cpp; sourceTree = ""; };
9012911F104812F90083456D /* CIndex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CIndex.cpp; path = tools/CIndex/CIndex.cpp; sourceTree = ""; };
- 90129120104812F90083456D /* CIndex.exports */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CIndex.exports; path = tools/CIndex/CIndex.exports; sourceTree = ""; };
904753791096376F00CBDDDD /* CXXInheritance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CXXInheritance.h; path = clang/AST/CXXInheritance.h; sourceTree = ""; };
9047537A1096376F00CBDDDD /* Redeclarable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Redeclarable.h; path = clang/AST/Redeclarable.h; sourceTree = ""; };
9047537B1096376F00CBDDDD /* TypeLoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TypeLoc.h; path = clang/AST/TypeLoc.h; sourceTree = ""; };
@@ -727,7 +740,7 @@
DECB6F060F9D93A800F5FBC7 /* InitPreprocessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InitPreprocessor.cpp; path = lib/Frontend/InitPreprocessor.cpp; sourceTree = ""; };
DECB734E0FA3ED8400F5FBC7 /* StmtObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StmtObjC.h; path = clang/AST/StmtObjC.h; sourceTree = ""; };
DECB73550FA3EE5A00F5FBC7 /* StmtCXX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StmtCXX.h; path = clang/AST/StmtCXX.h; sourceTree = ""; };
- DECB77120FA5752300F5FBC7 /* PCHReaderStmt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PCHReaderStmt.cpp; path = lib/Frontend/PCHReaderStmt.cpp; sourceTree = ""; };
+ DECB77120FA5752300F5FBC7 /* PCHReaderStmt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = PCHReaderStmt.cpp; path = lib/Frontend/PCHReaderStmt.cpp; sourceTree = ""; tabWidth = 2; };
DECB77780FA579B000F5FBC7 /* PCHReaderDecl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PCHReaderDecl.cpp; path = lib/Frontend/PCHReaderDecl.cpp; sourceTree = ""; };
DECB77F60FA5850200F5FBC7 /* PCHWriterDecl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PCHWriterDecl.cpp; path = lib/Frontend/PCHWriterDecl.cpp; sourceTree = ""; };
DECB78160FA5882F00F5FBC7 /* PCHWriterStmt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PCHWriterStmt.cpp; path = lib/Frontend/PCHWriterStmt.cpp; sourceTree = ""; };
@@ -1037,6 +1050,7 @@
356EF9B30C8F7DCA006650F5 /* Analysis */ = {
isa = PBXGroup;
children = (
+ DE67E70A0C020EC500F66BC5 /* SemaType.cpp */,
35544B840F5C7F9D00D92AA9 /* Path-Sensitive */,
3507E4CC0E27FEB900FB7B57 /* Flow-Sensitive Analyses */,
3507E4C30E27FE3800FB7B57 /* Checks */,
@@ -1093,7 +1107,14 @@
isa = PBXGroup;
children = (
9012911F104812F90083456D /* CIndex.cpp */,
- 90129120104812F90083456D /* CIndex.exports */,
+ 1A621C3B11111D61009E6834 /* CIndexer.cpp */,
+ 1A621C3A11111D61009E6834 /* CIndexCodeCompletion.cpp */,
+ 1A621C3C11111D61009E6834 /* CIndexer.h */,
+ 1A621C3D11111D61009E6834 /* CIndexInclusionStack.cpp */,
+ 1A621C3E11111D61009E6834 /* CIndexUSRs.cpp */,
+ 1A621C3F11111D61009E6834 /* CXCursor.cpp */,
+ 1A621C4011111D61009E6834 /* CXCursor.h */,
+ 1A621C4111111D61009E6834 /* CXSourceLocation.h */,
);
name = CIndex;
sourceTree = "";
@@ -1265,7 +1286,6 @@
BDF87CF60FD746F300BBF872 /* SemaTemplateDeduction.cpp */,
35544B8B0F5C803200D92AA9 /* SemaTemplateInstantiate.cpp */,
1ADF47AE0F782C3200E48A8A /* SemaTemplateInstantiateDecl.cpp */,
- DE67E70A0C020EC500F66BC5 /* SemaType.cpp */,
1AE4EE3B103B89CA00888A23 /* TreeTransform.h */,
);
name = Sema;
@@ -1330,7 +1350,8 @@
1A2193CC0F45EEB700C0713D /* Mangle.cpp */,
1A2193CD0F45EEB700C0713D /* Mangle.h */,
DE928B120C05659200231DA4 /* ModuleBuilder.cpp */,
- 1AE4EE3F103B8A0A00888A23 /* TargetABIInfo.cpp */,
+ 1A621BB5110FE6AA009E6834 /* TargetInfo.cpp */,
+ 1A621BB6110FE6AA009E6834 /* TargetInfo.h */,
);
name = CodeGen;
sourceTree = "";
@@ -1927,7 +1948,6 @@
1AA1D91810125DE30078DEBC /* RecordLayoutBuilder.cpp in Sources */,
1AFF8AE31012BFC900D248DA /* CGRecordLayoutBuilder.cpp in Sources */,
1AE4EE3E103B89ED00888A23 /* StmtProfile.cpp in Sources */,
- 1AE4EE40103B8A0A00888A23 /* TargetABIInfo.cpp in Sources */,
90FD6D7B103C3D49005F5B73 /* Analyzer.cpp in Sources */,
90FD6D7C103C3D49005F5B73 /* ASTLocation.cpp in Sources */,
90FD6D7D103C3D49005F5B73 /* DeclReferenceMap.cpp in Sources */,
@@ -1967,6 +1987,12 @@
1ACB57EB1105820D0047B991 /* TypeXML.cpp in Sources */,
1ACB57EC1105820D0047B991 /* VerifyDiagnosticsClient.cpp in Sources */,
1A97825B1108BA18002B98FC /* CGVTT.cpp in Sources */,
+ 1A621BB7110FE6AA009E6834 /* TargetInfo.cpp in Sources */,
+ 1A621C4211111D61009E6834 /* CIndexCodeCompletion.cpp in Sources */,
+ 1A621C4311111D61009E6834 /* CIndexer.cpp in Sources */,
+ 1A621C4411111D61009E6834 /* CIndexInclusionStack.cpp in Sources */,
+ 1A621C4511111D61009E6834 /* CIndexUSRs.cpp in Sources */,
+ 1A621C4611111D61009E6834 /* CXCursor.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html
index e2a44eaed0b9..d32842b5d23d 100644
--- a/docs/LanguageExtensions.html
+++ b/docs/LanguageExtensions.html
@@ -205,12 +205,28 @@ is used in the file argument.
Vectors and Extended Vectors
-Supports the GCC vector extensions, plus some stuff like V[1]. ext_vector
-with V.xyzw syntax and other tidbits. See also __builtin_shufflevector.
+Supports the GCC vector extensions, plus some stuff like V[1].
+
+Also supports ext_vector, which additionally support for V.xyzw
+syntax and other tidbits as seen in OpenCL. An example is:
+
+
+
+typedef float float4 __attribute__((ext_vector_type(4)));
+typedef float float2 __attribute__((ext_vector_type(2)));
+
+float4 foo(float2 a, float2 b) {
+ float4 c;
+ c.xz = a;
+ c.yw = b;
+ return c;
+}
+
Query for this feature with __has_feature(attribute_ext_vector_type).
+See also __builtin_shufflevector.
+
Checks for Standard Language Features
diff --git a/docs/UsersManual.html b/docs/UsersManual.html
index 13e020941472..41715bb2ac65 100644
--- a/docs/UsersManual.html
+++ b/docs/UsersManual.html
@@ -789,14 +789,12 @@ definition.
C++ Language Features
-At this point, Clang C++ is not generally useful. However, Clang C++ support
+
At this point, Clang C++ is not production-quality and is not recommended for use beyond experimentation. However, Clang C++ support
is under active development and is progressing rapidly. Please see the C++ Status page for details or
ask on the mailing list about how you can help.
-Note that the clang driver will refuse to even try to use clang to compile
-C++ code unless you pass the -ccc-clang-cxx option to the driver. If
-you really want to play with Clang's C++ support, please pass that flag.
+Note that released Clang compilers will refuse to even try to use clang to compile C++ code unless you pass the -ccc-clang-cxx option to the driver. To turn on Clang's C++ support, please pass that flag. Clang compilers built from the Subversion trunk enable C++ support by default, and do not require the -ccc-clang-cxx flag.
Objective C++ Language Features
diff --git a/examples/PrintFunctionNames/Makefile b/examples/PrintFunctionNames/Makefile
index 3c0c1f82ad8a..57d3ba9b0cd9 100644
--- a/examples/PrintFunctionNames/Makefile
+++ b/examples/PrintFunctionNames/Makefile
@@ -11,7 +11,6 @@ LEVEL = ../../../..
LIBRARYNAME = PrintFunctionNames
CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
-CXXFLAGS = -fno-rtti
# Include this here so we can get the configuration of the targets that have
# been configured for construction. We have to do this early so we can set up
diff --git a/examples/wpa/Makefile b/examples/wpa/Makefile
index 54b61d08571a..2be7ff10d899 100644
--- a/examples/wpa/Makefile
+++ b/examples/wpa/Makefile
@@ -2,7 +2,6 @@ LEVEL = ../../../..
TOOLNAME = clang-wpa
CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
-CXXFLAGS = -fno-rtti
NO_INSTALL = 1
# No plugins, optimize startup time.
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index ef17ed1ca8be..84ec4724e0db 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -36,23 +36,23 @@ extern "C" {
/** \defgroup CINDEX C Interface to Clang
*
- * The C Interface to Clang provides a relatively small API that exposes
+ * The C Interface to Clang provides a relatively small API that exposes
* facilities for parsing source code into an abstract syntax tree (AST),
* loading already-parsed ASTs, traversing the AST, associating
* physical source locations with elements within the AST, and other
* facilities that support Clang-based development tools.
*
- * This C interface to Clang will never provide all of the information
+ * This C interface to Clang will never provide all of the information
* representation stored in Clang's C++ AST, nor should it: the intent is to
* maintain an API that is relatively stable from one release to the next,
* providing only the basic functionality needed to support development tools.
- *
- * To avoid namespace pollution, data types are prefixed with "CX" and
+ *
+ * To avoid namespace pollution, data types are prefixed with "CX" and
* functions are prefixed with "clang_".
*
* @{
*/
-
+
/**
* \brief An "index" that consists of a set of translation units that would
* typically be linked together into an executable or library.
@@ -69,7 +69,7 @@ typedef void *CXTranslationUnit; /* A translation unit instance. */
* to various callbacks and visitors.
*/
typedef void *CXClientData;
-
+
/**
* \brief Provides the contents of a file that has not yet been saved to disk.
*
@@ -78,14 +78,14 @@ typedef void *CXClientData;
* yet been saved to disk.
*/
struct CXUnsavedFile {
- /**
- * \brief The file whose contents have not yet been saved.
+ /**
+ * \brief The file whose contents have not yet been saved.
*
* This file must already exist in the file system.
*/
const char *Filename;
- /**
+ /**
* \brief A null-terminated buffer containing the unsaved contents
* of this file.
*/
@@ -103,7 +103,7 @@ struct CXUnsavedFile {
*
* @{
*/
-
+
/**
* \brief A character string.
*
@@ -132,38 +132,36 @@ CINDEX_LINKAGE void clang_disposeString(CXString string);
/**
* @}
*/
-
-/**
+
+/**
* \brief clang_createIndex() provides a shared context for creating
* translation units. It provides two options:
*
* - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
* declarations (when loading any new translation units). A "local" declaration
- * is one that belongs in the translation unit itself and not in a precompiled
+ * is one that belongs in the translation unit itself and not in a precompiled
* header that was used by the translation unit. If zero, all declarations
* will be enumerated.
*
- * - displayDiagnostics: when non-zero, diagnostics will be output. If zero,
- * diagnostics will be ignored.
- *
* Here is an example:
*
- * // excludeDeclsFromPCH = 1, displayDiagnostics = 1
- * Idx = clang_createIndex(1, 1);
+ * // excludeDeclsFromPCH = 1
+ * Idx = clang_createIndex(1);
*
* // IndexTest.pch was produced with the following command:
* // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
* TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
*
* // This will load all the symbols from 'IndexTest.pch'
- * clang_visitChildren(clang_getTranslationUnitCursor(TU),
+ * clang_visitChildren(clang_getTranslationUnitCursor(TU),
* TranslationUnitVisitor, 0);
* clang_disposeTranslationUnit(TU);
*
* // This will load all the symbols from 'IndexTest.c', excluding symbols
* // from 'IndexTest.pch'.
- * char *args[] = { "-Xclang", "-include-pch=IndexTest.pch", 0 };
- * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args);
+ * char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
+ * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
+ * 0, 0);
* clang_visitChildren(clang_getTranslationUnitCursor(TU),
* TranslationUnitVisitor, 0);
* clang_disposeTranslationUnit(TU);
@@ -172,14 +170,18 @@ CINDEX_LINKAGE void clang_disposeString(CXString string);
* -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
* (which gives the indexer the same performance benefit as the compiler).
*/
-CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
- int displayDiagnostics);
+CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH);
+
+/**
+ * \brief Destroy the given index.
+ *
+ * The index must not be destroyed until all of the translation units created
+ * within that index have been destroyed.
+ */
CINDEX_LINKAGE void clang_disposeIndex(CXIndex index);
-CINDEX_LINKAGE CXString
-clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
/**
- * \brief Request that AST's be generated external for API calls which parse
+ * \brief Request that AST's be generated externally for API calls which parse
* source code on the fly, e.g. \see createTranslationUnitFromSourceFile.
*
* Note: This is for debugging purposes only, and may be removed at a later
@@ -190,71 +192,23 @@ clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
*/
CINDEX_LINKAGE void clang_setUseExternalASTGeneration(CXIndex index,
int value);
-
-/**
- * \brief Create a translation unit from an AST file (-emit-ast).
- */
-CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(
- CXIndex, const char *ast_filename
-);
-
-/**
- * \brief Destroy the specified CXTranslationUnit object.
- */
-CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);
-
-/**
- * \brief Return the CXTranslationUnit for a given source file and the provided
- * command line arguments one would pass to the compiler.
- *
- * Note: The 'source_filename' argument is optional. If the caller provides a
- * NULL pointer, the name of the source file is expected to reside in the
- * specified command line arguments.
- *
- * Note: When encountered in 'clang_command_line_args', the following options
- * are ignored:
- *
- * '-c'
- * '-emit-ast'
- * '-fsyntax-only'
- * '-o