aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt35
-rw-r--r--Makefile57
-rw-r--r--NOTES.txt3
-rw-r--r--README.txt2
-rw-r--r--clang.xcodeproj/project.pbxproj265
-rw-r--r--docs/InternalsManual.html8
-rw-r--r--docs/Makefile4
-rw-r--r--docs/PCHInternals.html30
-rw-r--r--docs/UsersManual.html135
-rw-r--r--docs/tools/Makefile7
-rw-r--r--examples/Makefile4
-rw-r--r--examples/PrintFunctionNames/CMakeLists.txt22
-rw-r--r--examples/PrintFunctionNames/Makefile12
-rw-r--r--examples/PrintFunctionNames/PrintFunctionNames.cpp15
-rw-r--r--examples/clang-interpreter/CMakeLists.txt2
-rw-r--r--examples/clang-interpreter/Makefile12
-rw-r--r--examples/clang-interpreter/main.cpp2
-rw-r--r--examples/wpa/CMakeLists.txt2
-rw-r--r--examples/wpa/Makefile17
-rw-r--r--examples/wpa/clang-wpa.cpp101
-rw-r--r--include/Makefile4
-rw-r--r--include/clang-c/Index.h21
-rw-r--r--include/clang-c/Makefile4
-rw-r--r--include/clang/AST/ASTContext.h121
-rw-r--r--include/clang/AST/Attr.h229
-rw-r--r--include/clang/AST/CMakeLists.txt15
-rw-r--r--include/clang/AST/CanonicalType.h3
-rw-r--r--include/clang/AST/Decl.h243
-rw-r--r--include/clang/AST/DeclBase.h50
-rw-r--r--include/clang/AST/DeclCXX.h206
-rw-r--r--include/clang/AST/DeclFriend.h7
-rw-r--r--include/clang/AST/DeclObjC.h42
-rw-r--r--include/clang/AST/DeclTemplate.h310
-rw-r--r--include/clang/AST/DeclVisitor.h17
-rw-r--r--include/clang/AST/Expr.h143
-rw-r--r--include/clang/AST/ExprCXX.h220
-rw-r--r--include/clang/AST/ExternalASTSource.h103
-rw-r--r--include/clang/AST/Makefile20
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h1913
-rw-r--r--include/clang/AST/Redeclarable.h5
-rw-r--r--include/clang/AST/Stmt.h75
-rw-r--r--include/clang/AST/StmtIterator.h1
-rw-r--r--include/clang/AST/TemplateBase.h26
-rw-r--r--include/clang/AST/TemplateName.h11
-rw-r--r--include/clang/AST/Type.h212
-rw-r--r--include/clang/AST/TypeLoc.h126
-rw-r--r--include/clang/AST/TypeLocBuilder.h9
-rw-r--r--include/clang/AST/TypeNodes.def1
-rw-r--r--include/clang/AST/UsuallyTinyPtrVector.h11
-rw-r--r--include/clang/Analysis/Analyses/PrintfFormatString.h214
-rw-r--r--include/clang/Analysis/Support/BumpVector.h1
-rw-r--r--include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h62
-rw-r--r--include/clang/Basic/Attr.td382
-rw-r--r--include/clang/Basic/AttrKinds.h31
-rw-r--r--include/clang/Basic/Builtins.def1
-rw-r--r--include/clang/Basic/BuiltinsARM.def8
-rw-r--r--include/clang/Basic/BuiltinsPPC.def111
-rw-r--r--include/clang/Basic/CMakeLists.txt12
-rw-r--r--include/clang/Basic/DeclNodes.td70
-rw-r--r--include/clang/Basic/Diagnostic.h56
-rw-r--r--include/clang/Basic/DiagnosticCommonKinds.td1
-rw-r--r--include/clang/Basic/DiagnosticFrontendKinds.td8
-rw-r--r--include/clang/Basic/DiagnosticGroups.td13
-rw-r--r--include/clang/Basic/DiagnosticLexKinds.td5
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td19
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td183
-rw-r--r--include/clang/Basic/IdentifierTable.h6
-rw-r--r--include/clang/Basic/LangOptions.h47
-rw-r--r--include/clang/Basic/Makefile41
-rw-r--r--include/clang/Basic/PartialDiagnostic.h12
-rw-r--r--include/clang/Basic/SourceLocation.h50
-rw-r--r--include/clang/Basic/StmtNodes.td (renamed from include/clang/AST/StmtNodes.td)11
-rw-r--r--include/clang/Basic/TargetInfo.h29
-rw-r--r--include/clang/Basic/TargetOptions.h8
-rw-r--r--include/clang/Basic/Version.h10
-rw-r--r--include/clang/Basic/Version.inc.in6
-rw-r--r--include/clang/Basic/arm_neon.td341
-rw-r--r--include/clang/Checker/AnalysisConsumer.h35
-rw-r--r--include/clang/Checker/BugReporter/BugReporter.h1
-rw-r--r--include/clang/Checker/FrontendActions.h29
-rw-r--r--include/clang/Checker/PathDiagnosticClients.h (renamed from include/clang/Frontend/PathDiagnosticClients.h)4
-rw-r--r--include/clang/Checker/PathSensitive/Checker.h30
-rw-r--r--include/clang/Checker/PathSensitive/CheckerVisitor.h9
-rw-r--r--include/clang/Checker/PathSensitive/Environment.h2
-rw-r--r--include/clang/Checker/PathSensitive/ExplodedGraph.h10
-rw-r--r--include/clang/Checker/PathSensitive/GRCoreEngine.h18
-rw-r--r--include/clang/Checker/PathSensitive/GRExprEngine.h31
-rw-r--r--include/clang/Checker/PathSensitive/GRState.h27
-rw-r--r--include/clang/Checker/PathSensitive/GRSubEngine.h28
-rw-r--r--include/clang/Checker/PathSensitive/GRTransferFuncs.h2
-rw-r--r--include/clang/Checker/PathSensitive/MemRegion.h77
-rw-r--r--include/clang/Checker/PathSensitive/SVals.h4
-rw-r--r--include/clang/Checker/PathSensitive/SValuator.h8
-rw-r--r--include/clang/Checker/PathSensitive/Store.h31
-rw-r--r--include/clang/Checker/PathSensitive/SymbolManager.h43
-rw-r--r--include/clang/CodeGen/BackendUtil.h37
-rw-r--r--include/clang/CodeGen/CodeGenAction.h (renamed from include/clang/Frontend/CodeGenAction.h)9
-rw-r--r--include/clang/CodeGen/ModuleBuilder.h3
-rw-r--r--include/clang/Driver/Action.h13
-rw-r--r--include/clang/Driver/Arg.h181
-rw-r--r--include/clang/Driver/ArgList.h97
-rw-r--r--include/clang/Driver/CC1Options.td24
-rw-r--r--include/clang/Driver/Compilation.h13
-rw-r--r--include/clang/Driver/Driver.h6
-rw-r--r--include/clang/Driver/HostInfo.h2
-rw-r--r--include/clang/Driver/Makefile4
-rw-r--r--include/clang/Driver/OptTable.h3
-rw-r--r--include/clang/Driver/Option.h49
-rw-r--r--include/clang/Driver/Options.td104
-rw-r--r--include/clang/Driver/ToolChain.h9
-rw-r--r--include/clang/Driver/Types.def10
-rw-r--r--include/clang/Driver/Types.h4
-rw-r--r--include/clang/Frontend/ASTConsumers.h16
-rw-r--r--include/clang/Frontend/AnalyzerOptions.h (renamed from include/clang/Frontend/AnalysisConsumer.h)18
-rw-r--r--include/clang/Frontend/CodeGenOptions.h (renamed from include/clang/CodeGen/CodeGenOptions.h)16
-rw-r--r--include/clang/Frontend/CompilerInstance.h7
-rw-r--r--include/clang/Frontend/CompilerInvocation.h4
-rw-r--r--include/clang/Frontend/DiagnosticOptions.h5
-rw-r--r--include/clang/Frontend/FrontendAction.h67
-rw-r--r--include/clang/Frontend/FrontendActions.h54
-rw-r--r--include/clang/Frontend/FrontendOptions.h23
-rw-r--r--include/clang/Frontend/FrontendPluginRegistry.h2
-rw-r--r--include/clang/Frontend/PCHBitCodes.h59
-rw-r--r--include/clang/Frontend/PCHReader.h144
-rw-r--r--include/clang/Frontend/PCHWriter.h54
-rw-r--r--include/clang/Frontend/TextDiagnosticPrinter.h9
-rw-r--r--include/clang/Frontend/TypeXML.def5
-rw-r--r--include/clang/Frontend/Utils.h6
-rw-r--r--include/clang/Index/CallGraph.h4
-rw-r--r--include/clang/Index/Entity.h4
-rw-r--r--include/clang/Index/Indexer.h7
-rw-r--r--include/clang/Index/TranslationUnit.h2
-rw-r--r--include/clang/Lex/PPCallbacks.h12
-rw-r--r--include/clang/Lex/Pragma.h33
-rw-r--r--include/clang/Lex/Preprocessor.h17
-rw-r--r--include/clang/Lex/Token.h8
-rw-r--r--include/clang/Makefile4
-rw-r--r--include/clang/Parse/Action.h305
-rw-r--r--include/clang/Parse/AttributeList.h1
-rw-r--r--include/clang/Parse/DeclSpec.h10
-rw-r--r--include/clang/Parse/Parser.h14
-rw-r--r--include/clang/Parse/Template.h2
-rw-r--r--include/clang/Rewrite/ASTConsumers.h45
-rw-r--r--include/clang/Rewrite/FixItRewriter.h (renamed from include/clang/Frontend/FixItRewriter.h)6
-rw-r--r--include/clang/Rewrite/FrontendActions.h69
-rw-r--r--include/clang/Rewrite/RewriteRope.h1
-rw-r--r--include/clang/Rewrite/Rewriter.h1
-rw-r--r--include/clang/Rewrite/Rewriters.h31
-rw-r--r--include/clang/Sema/CodeCompleteConsumer.h24
-rw-r--r--include/clang/Sema/ExternalSemaSource.h2
-rw-r--r--lib/AST/ASTContext.cpp569
-rw-r--r--lib/AST/ASTImporter.cpp93
-rw-r--r--lib/AST/AttrImpl.cpp9
-rw-r--r--lib/AST/CMakeLists.txt4
-rw-r--r--lib/AST/CXXInheritance.cpp38
-rw-r--r--lib/AST/Decl.cpp161
-rw-r--r--lib/AST/DeclBase.cpp282
-rw-r--r--lib/AST/DeclCXX.cpp124
-rw-r--r--lib/AST/DeclFriend.cpp4
-rw-r--r--lib/AST/DeclObjC.cpp23
-rw-r--r--lib/AST/DeclPrinter.cpp47
-rw-r--r--lib/AST/DeclTemplate.cpp117
-rw-r--r--lib/AST/Expr.cpp427
-rw-r--r--lib/AST/ExprCXX.cpp101
-rw-r--r--lib/AST/ExprClassification.cpp471
-rw-r--r--lib/AST/ExprConstant.cpp88
-rw-r--r--lib/AST/Makefile6
-rw-r--r--lib/AST/RecordLayoutBuilder.cpp972
-rw-r--r--lib/AST/Stmt.cpp132
-rw-r--r--lib/AST/StmtPrinter.cpp34
-rw-r--r--lib/AST/StmtProfile.cpp13
-rw-r--r--lib/AST/TemplateBase.cpp27
-rw-r--r--lib/AST/TemplateName.cpp11
-rw-r--r--lib/AST/Type.cpp133
-rw-r--r--lib/AST/TypePrinter.cpp51
-rw-r--r--lib/Analysis/CFG.cpp29
-rw-r--r--lib/Analysis/CMakeLists.txt3
-rw-r--r--lib/Analysis/LiveVariables.cpp22
-rw-r--r--lib/Analysis/Makefile6
-rw-r--r--lib/Analysis/PrintfFormatString.cpp672
-rw-r--r--lib/Basic/CMakeLists.txt3
-rw-r--r--lib/Basic/Diagnostic.cpp19
-rw-r--r--lib/Basic/Makefile9
-rw-r--r--lib/Basic/TargetInfo.cpp6
-rw-r--r--lib/Basic/Targets.cpp166
-rw-r--r--lib/Checker/AnalysisConsumer.cpp (renamed from lib/Frontend/AnalysisConsumer.cpp)37
-rw-r--r--lib/Checker/AttrNonNullChecker.cpp5
-rw-r--r--lib/Checker/BasicConstraintManager.cpp124
-rw-r--r--lib/Checker/BasicObjCFoundationChecks.cpp93
-rw-r--r--lib/Checker/BasicObjCFoundationChecks.h3
-rw-r--r--lib/Checker/BasicStore.cpp99
-rw-r--r--lib/Checker/BugReporter.cpp4
-rw-r--r--lib/Checker/BuiltinFunctionChecker.cpp15
-rw-r--r--lib/Checker/CFRefCount.cpp201
-rw-r--r--lib/Checker/CMakeLists.txt30
-rw-r--r--lib/Checker/CStringChecker.cpp525
-rw-r--r--lib/Checker/CallInliner.cpp2
-rw-r--r--lib/Checker/CastSizeChecker.cpp21
-rw-r--r--lib/Checker/CheckSecuritySyntaxOnly.cpp4
-rw-r--r--lib/Checker/Environment.cpp4
-rw-r--r--lib/Checker/FlatStore.cpp18
-rw-r--r--lib/Checker/FrontendActions.cpp21
-rw-r--r--lib/Checker/GRCoreEngine.cpp6
-rw-r--r--lib/Checker/GRExprEngine.cpp176
-rw-r--r--lib/Checker/GRExprEngineExperimentalChecks.cpp3
-rw-r--r--lib/Checker/GRExprEngineExperimentalChecks.h3
-rw-r--r--lib/Checker/GRExprEngineInternalChecks.h2
-rw-r--r--lib/Checker/GRState.cpp31
-rw-r--r--lib/Checker/HTMLDiagnostics.cpp (renamed from lib/Frontend/HTMLDiagnostics.cpp)6
-rw-r--r--lib/Checker/IdempotentOperationChecker.cpp454
-rw-r--r--lib/Checker/LLVMConventionsChecker.cpp50
-rw-r--r--lib/Checker/Makefile6
-rw-r--r--lib/Checker/MallocChecker.cpp256
-rw-r--r--lib/Checker/MemRegion.cpp179
-rw-r--r--lib/Checker/OSAtomicChecker.cpp8
-rw-r--r--lib/Checker/PathDiagnostic.cpp13
-rw-r--r--lib/Checker/PlistDiagnostics.cpp (renamed from lib/Frontend/PlistDiagnostics.cpp)2
-rw-r--r--lib/Checker/RangeConstraintManager.cpp301
-rw-r--r--lib/Checker/RegionStore.cpp339
-rw-r--r--lib/Checker/ReturnStackAddressChecker.cpp125
-rw-r--r--lib/Checker/SVals.cpp10
-rw-r--r--lib/Checker/SValuator.cpp8
-rw-r--r--lib/Checker/SimpleConstraintManager.cpp166
-rw-r--r--lib/Checker/SimpleConstraintManager.h26
-rw-r--r--lib/Checker/SimpleSValuator.cpp619
-rw-r--r--lib/Checker/StackAddrLeakChecker.cpp204
-rw-r--r--lib/Checker/Store.cpp14
-rw-r--r--lib/Checker/StreamChecker.cpp287
-rw-r--r--lib/Checker/SymbolManager.cpp38
-rw-r--r--lib/Checker/VLASizeChecker.cpp49
-rw-r--r--lib/CodeGen/ABIInfo.h12
-rw-r--r--lib/CodeGen/BackendUtil.cpp339
-rw-r--r--lib/CodeGen/CGBlocks.cpp72
-rw-r--r--lib/CodeGen/CGBlocks.h7
-rw-r--r--lib/CodeGen/CGBuilder.h8
-rw-r--r--lib/CodeGen/CGBuiltin.cpp924
-rw-r--r--lib/CodeGen/CGCXX.cpp77
-rw-r--r--lib/CodeGen/CGCXXABI.h1
-rw-r--r--lib/CodeGen/CGCall.cpp458
-rw-r--r--lib/CodeGen/CGCall.h8
-rw-r--r--lib/CodeGen/CGClass.cpp156
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp43
-rw-r--r--lib/CodeGen/CGDecl.cpp148
-rw-r--r--lib/CodeGen/CGDeclCXX.cpp195
-rw-r--r--lib/CodeGen/CGException.cpp1525
-rw-r--r--lib/CodeGen/CGException.h342
-rw-r--r--lib/CodeGen/CGExpr.cpp447
-rw-r--r--lib/CodeGen/CGExprAgg.cpp114
-rw-r--r--lib/CodeGen/CGExprCXX.cpp111
-rw-r--r--lib/CodeGen/CGExprComplex.cpp76
-rw-r--r--lib/CodeGen/CGExprConstant.cpp102
-rw-r--r--lib/CodeGen/CGExprScalar.cpp496
-rw-r--r--lib/CodeGen/CGObjC.cpp29
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp378
-rw-r--r--lib/CodeGen/CGObjCMac.cpp791
-rw-r--r--lib/CodeGen/CGObjCRuntime.h10
-rw-r--r--lib/CodeGen/CGRTTI.cpp22
-rw-r--r--lib/CodeGen/CGStmt.cpp275
-rw-r--r--lib/CodeGen/CGTemporaries.cpp144
-rw-r--r--lib/CodeGen/CGVTables.cpp427
-rw-r--r--lib/CodeGen/CGVTables.h17
-rw-r--r--lib/CodeGen/CMakeLists.txt6
-rw-r--r--lib/CodeGen/CodeGenAction.cpp348
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp640
-rw-r--r--lib/CodeGen/CodeGenFunction.h632
-rw-r--r--lib/CodeGen/CodeGenModule.cpp370
-rw-r--r--lib/CodeGen/CodeGenModule.h52
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp82
-rw-r--r--lib/CodeGen/CodeGenTypes.h34
-rw-r--r--lib/CodeGen/GlobalDecl.h10
-rw-r--r--lib/CodeGen/Makefile9
-rw-r--r--lib/CodeGen/Mangle.cpp197
-rw-r--r--lib/CodeGen/Mangle.h12
-rw-r--r--lib/CodeGen/MicrosoftCXXABI.cpp1191
-rw-r--r--lib/CodeGen/ModuleBuilder.cpp2
-rw-r--r--lib/CodeGen/TargetInfo.cpp393
-rw-r--r--lib/Driver/Action.cpp5
-rw-r--r--lib/Driver/Arg.cpp189
-rw-r--r--lib/Driver/ArgList.cpp92
-rw-r--r--lib/Driver/CMakeLists.txt4
-rw-r--r--lib/Driver/Compilation.cpp19
-rw-r--r--lib/Driver/Driver.cpp130
-rw-r--r--lib/Driver/HostInfo.cpp58
-rw-r--r--lib/Driver/Makefile6
-rw-r--r--lib/Driver/OptTable.cpp13
-rw-r--r--lib/Driver/Option.cpp106
-rw-r--r--lib/Driver/ToolChains.cpp186
-rw-r--r--lib/Driver/ToolChains.h18
-rw-r--r--lib/Driver/Tools.cpp486
-rw-r--r--lib/Driver/Tools.h52
-rw-r--r--lib/Driver/Types.cpp18
-rw-r--r--lib/Frontend/ASTConsumers.cpp21
-rw-r--r--lib/Frontend/ASTMerge.cpp7
-rw-r--r--lib/Frontend/ASTUnit.cpp10
-rw-r--r--lib/Frontend/BoostConAction.cpp10
-rw-r--r--lib/Frontend/CMakeLists.txt12
-rw-r--r--lib/Frontend/CodeGenAction.cpp593
-rw-r--r--lib/Frontend/CompilerInstance.cpp32
-rw-r--r--lib/Frontend/CompilerInvocation.cpp235
-rw-r--r--lib/Frontend/FrontendAction.cpp54
-rw-r--r--lib/Frontend/FrontendActions.cpp96
-rw-r--r--lib/Frontend/FrontendOptions.cpp4
-rw-r--r--lib/Frontend/GeneratePCH.cpp11
-rw-r--r--lib/Frontend/InitHeaderSearch.cpp45
-rw-r--r--lib/Frontend/InitPreprocessor.cpp37
-rw-r--r--lib/Frontend/Makefile6
-rw-r--r--lib/Frontend/PCHReader.cpp443
-rw-r--r--lib/Frontend/PCHReaderDecl.cpp609
-rw-r--r--lib/Frontend/PCHReaderStmt.cpp1064
-rw-r--r--lib/Frontend/PCHWriter.cpp510
-rw-r--r--lib/Frontend/PCHWriterDecl.cpp423
-rw-r--r--lib/Frontend/PCHWriterStmt.cpp488
-rw-r--r--lib/Frontend/PrintParserCallbacks.cpp3
-rw-r--r--lib/Frontend/PrintPreprocessedOutput.cpp63
-rw-r--r--lib/Frontend/TextDiagnosticPrinter.cpp63
-rw-r--r--lib/Frontend/Warnings.cpp2
-rw-r--r--lib/Headers/CMakeLists.txt13
-rw-r--r--lib/Headers/Makefile21
-rw-r--r--lib/Headers/altivec.h5317
-rw-r--r--lib/Headers/arm_neon.td341
-rw-r--r--lib/Headers/emmintrin.h7
-rw-r--r--lib/Headers/smmintrin.h16
-rw-r--r--lib/Headers/stddef.h7
-rw-r--r--lib/Headers/stdint.h4
-rw-r--r--lib/Headers/xmmintrin.h6
-rw-r--r--lib/Index/CallGraph.cpp2
-rw-r--r--lib/Index/Entity.cpp77
-rw-r--r--lib/Index/EntityImpl.h1
-rw-r--r--lib/Index/Indexer.cpp21
-rw-r--r--lib/Index/Makefile12
-rw-r--r--lib/Lex/Lexer.cpp56
-rw-r--r--lib/Lex/LiteralSupport.cpp17
-rw-r--r--lib/Lex/Makefile8
-rw-r--r--lib/Lex/PPCaching.cpp12
-rw-r--r--lib/Lex/PPMacroExpansion.cpp2
-rw-r--r--lib/Lex/Pragma.cpp209
-rw-r--r--lib/Lex/Preprocessor.cpp10
-rwxr-xr-xlib/Makefile6
-rw-r--r--lib/Parse/AttributeList.cpp1
-rw-r--r--lib/Parse/CMakeLists.txt2
-rw-r--r--lib/Parse/DeclSpec.cpp55
-rw-r--r--lib/Parse/Makefile6
-rw-r--r--lib/Parse/ParseCXXInlineMethods.cpp52
-rw-r--r--lib/Parse/ParseDecl.cpp123
-rw-r--r--lib/Parse/ParseDeclCXX.cpp186
-rw-r--r--lib/Parse/ParseExpr.cpp89
-rw-r--r--lib/Parse/ParseExprCXX.cpp144
-rw-r--r--lib/Parse/ParseInit.cpp4
-rw-r--r--lib/Parse/ParseObjc.cpp144
-rw-r--r--lib/Parse/ParsePragma.cpp12
-rw-r--r--lib/Parse/ParsePragma.h16
-rw-r--r--lib/Parse/ParseStmt.cpp35
-rw-r--r--lib/Parse/ParseTemplate.cpp134
-rw-r--r--lib/Parse/Parser.cpp114
-rw-r--r--lib/Parse/RAIIObjectsForParser.h17
-rw-r--r--lib/Rewrite/CMakeLists.txt6
-rw-r--r--lib/Rewrite/FixItRewriter.cpp (renamed from lib/Frontend/FixItRewriter.cpp)2
-rw-r--r--lib/Rewrite/FrontendActions.cpp106
-rw-r--r--lib/Rewrite/HTMLPrint.cpp (renamed from lib/Frontend/HTMLPrint.cpp)2
-rw-r--r--lib/Rewrite/Makefile6
-rw-r--r--lib/Rewrite/RewriteMacros.cpp (renamed from lib/Frontend/RewriteMacros.cpp)2
-rw-r--r--lib/Rewrite/RewriteObjC.cpp (renamed from lib/Frontend/RewriteObjC.cpp)47
-rw-r--r--lib/Rewrite/RewriteRope.cpp2
-rw-r--r--lib/Rewrite/RewriteTest.cpp (renamed from lib/Frontend/RewriteTest.cpp)2
-rw-r--r--lib/Rewrite/Rewriter.cpp12
-rw-r--r--lib/Runtime/Makefile101
-rw-r--r--lib/Sema/CMakeLists.txt3
-rw-r--r--lib/Sema/JumpDiagnostics.cpp70
-rw-r--r--lib/Sema/Lookup.h5
-rw-r--r--lib/Sema/Makefile6
-rw-r--r--lib/Sema/Sema.cpp45
-rw-r--r--lib/Sema/Sema.h239
-rw-r--r--lib/Sema/SemaAccess.cpp30
-rw-r--r--lib/Sema/SemaAttr.cpp13
-rw-r--r--lib/Sema/SemaCXXCast.cpp62
-rw-r--r--lib/Sema/SemaCXXScopeSpec.cpp6
-rw-r--r--lib/Sema/SemaChecking.cpp458
-rw-r--r--lib/Sema/SemaCodeComplete.cpp1026
-rw-r--r--lib/Sema/SemaDecl.cpp298
-rw-r--r--lib/Sema/SemaDeclAttr.cpp114
-rw-r--r--lib/Sema/SemaDeclCXX.cpp1385
-rw-r--r--lib/Sema/SemaDeclObjC.cpp52
-rw-r--r--lib/Sema/SemaExceptionSpec.cpp9
-rw-r--r--lib/Sema/SemaExpr.cpp689
-rw-r--r--lib/Sema/SemaExprCXX.cpp255
-rw-r--r--lib/Sema/SemaExprObjC.cpp14
-rw-r--r--lib/Sema/SemaInit.cpp187
-rw-r--r--lib/Sema/SemaInit.h10
-rw-r--r--lib/Sema/SemaLookup.cpp446
-rw-r--r--lib/Sema/SemaObjCProperty.cpp79
-rw-r--r--lib/Sema/SemaOverload.cpp662
-rw-r--r--lib/Sema/SemaStmt.cpp170
-rw-r--r--lib/Sema/SemaTemplate.cpp644
-rw-r--r--lib/Sema/SemaTemplate.h31
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp12
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp26
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp87
-rw-r--r--lib/Sema/SemaType.cpp372
-rw-r--r--lib/Sema/TreeTransform.h301
-rw-r--r--test/ASTMerge/Inputs/class1.cpp8
-rw-r--r--test/ASTMerge/Inputs/class2.cpp8
-rw-r--r--test/ASTMerge/class.cpp9
-rw-r--r--test/Analysis/PR7218.c6
-rw-r--r--test/Analysis/additive-folding-range-constraints.c99
-rw-r--r--test/Analysis/additive-folding.c203
-rw-r--r--test/Analysis/analyze_display_progress.c9
-rw-r--r--test/Analysis/bstring.c277
-rw-r--r--test/Analysis/constant-folding.c72
-rw-r--r--test/Analysis/dead-stores.c4
-rw-r--r--test/Analysis/dead-stores.cpp8
-rw-r--r--test/Analysis/free.c71
-rw-r--r--test/Analysis/idempotent-operations.c52
-rw-r--r--test/Analysis/malloc.c44
-rw-r--r--test/Analysis/misc-ps-region-store.m8
-rw-r--r--test/Analysis/misc-ps.m51
-rw-r--r--test/Analysis/no-outofbounds.c17
-rw-r--r--test/Analysis/null-deref-ps.c13
-rw-r--r--test/Analysis/outofbound.c35
-rw-r--r--test/Analysis/ptr-arith.c226
-rw-r--r--test/Analysis/rdar-6442306-1.m2
-rw-r--r--test/Analysis/rdar-7168531.m4
-rw-r--r--test/Analysis/reference.cpp45
-rw-r--r--test/Analysis/retain-release.m14
-rw-r--r--test/Analysis/stack-addr-ps.c6
-rw-r--r--test/Analysis/stackaddrleak.c34
-rw-r--r--test/Analysis/stream.c41
-rw-r--r--test/Analysis/undef-buffers.c32
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp22
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp46
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.qual/p6-0x.cpp3
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.qual/p6.cpp2
-rw-r--r--test/CXX/basic/basic.scope/basic.scope.pdecl/p9.cpp18
-rw-r--r--test/CXX/class.access/class.access.base/p1.cpp18
-rw-r--r--test/CXX/class.access/class.access.base/p5.cpp4
-rw-r--r--test/CXX/class.access/class.access.dcl/p1.cpp2
-rw-r--r--test/CXX/class.access/class.friend/p1.cpp27
-rw-r--r--test/CXX/class.access/class.protected/p1.cpp21
-rw-r--r--test/CXX/class.access/p4.cpp11
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp35
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp13
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp78
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp32
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp (renamed from test/CXX/dcl.decl/dcl.init/dcl.init.ref/p16-cxx0x-no-extra-copy.cpp)14
-rw-r--r--test/CXX/except/except.spec/p14-ir.cpp78
-rw-r--r--test/CXX/except/except.spec/p14.cpp29
-rw-r--r--test/CXX/special/class.copy/p20.cpp46
-rw-r--r--test/CXX/special/class.copy/p9.cpp44
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp21
-rw-r--r--test/CXX/temp/temp.param/p2.cpp5
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p11.cpp18
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p2.cpp6
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp2
-rw-r--r--test/CodeCompletion/call.cpp2
-rw-r--r--test/CodeCompletion/ordinary-name.cpp62
-rw-r--r--test/CodeGen/2008-07-29-override-alias-decl.c10
-rw-r--r--test/CodeGen/2008-12-02-logical-or-fold.c4
-rw-r--r--test/CodeGen/address-space-field2.c4
-rw-r--r--test/CodeGen/address-space-field3.c4
-rw-r--r--test/CodeGen/address-space-field4.c6
-rw-r--r--test/CodeGen/address-space.c34
-rw-r--r--test/CodeGen/altivec.c4
-rw-r--r--test/CodeGen/arm-arguments.c64
-rw-r--r--test/CodeGen/arm-cc.c18
-rw-r--r--test/CodeGen/assign.c32
-rw-r--r--test/CodeGen/available-externally-suppress.c12
-rw-r--r--test/CodeGen/blocks-aligned-byref-variable.c4
-rw-r--r--test/CodeGen/blocks.c6
-rw-r--r--test/CodeGen/builtin-attributes.c6
-rw-r--r--test/CodeGen/builtins-arm.c8
-rw-r--r--test/CodeGen/builtins-ppc-altivec.c1174
-rw-r--r--test/CodeGen/builtins.c12
-rw-r--r--test/CodeGen/const-arithmetic.c4
-rw-r--r--test/CodeGen/const-unordered-compare.c2
-rw-r--r--test/CodeGen/decl.c28
-rw-r--r--test/CodeGen/exprs.c28
-rw-r--r--test/CodeGen/extern-inline.c2
-rw-r--r--test/CodeGen/frame-pointer-elim.c29
-rw-r--r--test/CodeGen/func-in-block.c18
-rw-r--r--test/CodeGen/init.c6
-rw-r--r--test/CodeGen/inline.c6
-rw-r--r--test/CodeGen/inline2.c4
-rw-r--r--test/CodeGen/instrument-functions.c18
-rw-r--r--test/CodeGen/integer-overflow.c45
-rw-r--r--test/CodeGen/object-size.c18
-rw-r--r--test/CodeGen/pascal-wchar-string.c31
-rw-r--r--test/CodeGen/pragma-pack-1.c2
-rw-r--r--test/CodeGen/regparm.c5
-rw-r--r--test/CodeGen/statements.c2
-rw-r--r--test/CodeGen/struct-init.c8
-rw-r--r--test/CodeGen/typedef-func.c2
-rw-r--r--test/CodeGen/volatile.c6
-rw-r--r--test/CodeGen/x86_64-arguments.c34
-rw-r--r--test/CodeGenCXX/DynArrayInit.cpp15
-rw-r--r--test/CodeGenCXX/alloca-align.cpp2
-rw-r--r--test/CodeGenCXX/arm-cc.cpp20
-rw-r--r--test/CodeGenCXX/arm.cpp3
-rw-r--r--test/CodeGenCXX/block-in-ctor-dtor.cpp48
-rw-r--r--test/CodeGenCXX/condition.cpp124
-rw-r--r--test/CodeGenCXX/constructor-convert.cpp2
-rw-r--r--test/CodeGenCXX/copy-in-cplus-object.cpp28
-rw-r--r--test/CodeGenCXX/cxx-apple-kext.cpp4
-rw-r--r--test/CodeGenCXX/default-arg-temps.cpp1
-rw-r--r--test/CodeGenCXX/destructors.cpp109
-rw-r--r--test/CodeGenCXX/eh.cpp116
-rw-r--r--test/CodeGenCXX/global-dtor-no-atexit.cpp3
-rw-r--r--test/CodeGenCXX/global-init-darwin.cpp23
-rw-r--r--test/CodeGenCXX/global-init.cpp8
-rw-r--r--test/CodeGenCXX/incomplete-member-function-pointer.cpp10
-rw-r--r--test/CodeGenCXX/instantiate-blocks.cpp33
-rw-r--r--test/CodeGenCXX/internal-linkage.cpp37
-rw-r--r--test/CodeGenCXX/mangle-address-space.cpp6
-rw-r--r--test/CodeGenCXX/mangle-exprs.cpp2
-rw-r--r--test/CodeGenCXX/mangle-ms.cpp96
-rw-r--r--test/CodeGenCXX/mangle-subst-std.cpp10
-rw-r--r--test/CodeGenCXX/mangle-subst.cpp13
-rw-r--r--test/CodeGenCXX/mangle-unnamed.cpp34
-rw-r--r--test/CodeGenCXX/mangle.cpp19
-rw-r--r--test/CodeGenCXX/member-functions.cpp2
-rw-r--r--test/CodeGenCXX/member-init-assignment.cpp17
-rw-r--r--test/CodeGenCXX/nrvo.cpp87
-rw-r--r--test/CodeGenCXX/pointers-to-data-members.cpp36
-rw-r--r--test/CodeGenCXX/reference-in-block-args.cpp29
-rw-r--r--test/CodeGenCXX/references.cpp43
-rw-r--r--test/CodeGenCXX/rtti-layout.cpp14
-rw-r--r--test/CodeGenCXX/rtti-linkage.cpp11
-rw-r--r--test/CodeGenCXX/sel-address.mm14
-rw-r--r--test/CodeGenCXX/static-init.cpp2
-rw-r--r--test/CodeGenCXX/template-instantiation.cpp2
-rw-r--r--test/CodeGenCXX/template-static-var-defer.cpp12
-rw-r--r--test/CodeGenCXX/temporaries.cpp18
-rw-r--r--test/CodeGenCXX/threadsafe-statics-exceptions.cpp11
-rw-r--r--test/CodeGenCXX/throw-expression-dtor.cpp13
-rw-r--r--test/CodeGenCXX/thunks.cpp12
-rw-r--r--test/CodeGenCXX/virtual-base-destructor-call.cpp11
-rw-r--r--test/CodeGenCXX/virtual-functions-incomplete-types.cpp2
-rw-r--r--test/CodeGenCXX/visibility-hidden-extern-templates.cpp26
-rw-r--r--test/CodeGenCXX/visibility-inlines-hidden.cpp57
-rw-r--r--test/CodeGenCXX/visibility.cpp20
-rw-r--r--test/CodeGenCXX/x86_64-arguments.cpp28
-rw-r--r--test/CodeGenObjC/assign.m36
-rw-r--r--test/CodeGenObjC/bitfield_encoding.m12
-rw-r--r--test/CodeGenObjC/blocks-5.m37
-rw-r--r--test/CodeGenObjC/category-class.m17
-rw-r--r--test/CodeGenObjC/dot-syntax-2.m27
-rw-r--r--test/CodeGenObjC/exceptions.m29
-rw-r--r--test/CodeGenObjC/metadata_symbols.m4
-rw-r--r--test/CodeGenObjC/property-category-impl.m20
-rw-r--r--test/CodeGenObjCXX/copyable-property-object.mm28
-rw-r--r--test/CodeGenObjCXX/foreach-statement.mm10
-rw-r--r--test/CodeGenObjCXX/implicit-copy-assign-operator.mm57
-rw-r--r--test/CodeGenObjCXX/implicit-copy-constructor.mm73
-rw-r--r--test/CodeGenObjCXX/method-local-extern-mangle.mm14
-rw-r--r--test/CodeGenObjCXX/property-derived-to-base-conv.mm19
-rw-r--r--test/CodeGenObjCXX/references.mm25
-rw-r--r--test/CodeGenObjCXX/selector-expr-lvalue.mm16
-rw-r--r--test/Driver/Wp-args.c13
-rw-r--r--test/Driver/Xlinker-args.c9
-rw-r--r--test/Driver/arch.c3
-rw-r--r--test/Driver/cxx-pth.cpp4
-rw-r--r--test/Driver/darwin-cc.c2
-rw-r--r--test/Driver/darwin-debug-flags.c6
-rw-r--r--test/Driver/darwin-dsymutil.c38
-rw-r--r--test/Driver/darwin-ld.c6
-rw-r--r--test/Driver/lto.c9
-rw-r--r--test/Driver/option-aliases.c11
-rw-r--r--test/FixIt/no-typo.c6
-rw-r--r--test/FixIt/typo.cpp10
-rw-r--r--test/FixIt/typo.m10
-rw-r--r--test/Frontend/ir-support-codegen.ll8
-rw-r--r--test/Frontend/ir-support-errors.ll8
-rw-r--r--test/Frontend/lit.local.cfg1
-rw-r--r--test/Frontend/preprocessed-output-macro-first-token.c5
-rw-r--r--test/Frontend/unknown-pragmas.c4
-rw-r--r--test/Headers/int64-type.c4
-rw-r--r--test/Headers/x86-intrinsics-headers.c2
-rw-r--r--test/Index/blocks.c29
-rw-r--r--test/Index/code-complete-errors.c2
-rw-r--r--test/Index/code-completion.cpp13
-rw-r--r--test/Index/complete-at-directives.m9
-rw-r--r--test/Index/complete-exprs.c36
-rw-r--r--test/Index/complete-macros.c15
-rw-r--r--test/Index/complete-method-decls.m31
-rw-r--r--test/Index/complete-objc-message.m14
-rw-r--r--test/Index/complete-recovery.m8
-rw-r--r--test/Index/complete-type-factors.m107
-rw-r--r--test/Index/print-typekind.c2
-rw-r--r--test/Index/print-typekind.m10
-rw-r--r--test/Index/usrs.m14
-rw-r--r--test/Lexer/block_cmt_end.c2
-rw-r--r--test/Lexer/constants.c7
-rw-r--r--test/Lexer/has_feature_cxx0x.cpp4
-rw-r--r--test/Lexer/has_feature_exceptions.cpp4
-rw-r--r--test/Lexer/has_feature_rtti.cpp4
-rw-r--r--test/Lexer/hexfloat.cpp5
-rw-r--r--test/Makefile4
-rw-r--r--test/Misc/macro-backtrace-limit.c2
-rw-r--r--test/PCH/attrs.h2
-rw-r--r--test/PCH/cxx-friends.cpp13
-rw-r--r--test/PCH/cxx-friends.h6
-rw-r--r--test/PCH/cxx-namespaces.cpp10
-rw-r--r--test/PCH/cxx-namespaces.h7
-rw-r--r--test/PCH/cxx-templates.cpp25
-rw-r--r--test/PCH/cxx-templates.h102
-rw-r--r--test/PCH/cxx-using.cpp15
-rw-r--r--test/PCH/cxx-using.h16
-rw-r--r--test/PCH/cxx_exprs.cpp8
-rw-r--r--test/PCH/cxx_exprs.h4
-rw-r--r--test/PCH/exprs.c2
-rw-r--r--test/PCH/exprs.h2
-rw-r--r--test/PCH/types.c2
-rw-r--r--test/PCH/types.h5
-rw-r--r--test/Parser/altivec.c34
-rw-r--r--test/Parser/backtrack-crash.cpp4
-rw-r--r--test/Parser/bracket-crash.cpp6
-rw-r--r--test/Parser/cxx-altivec.cpp25
-rw-r--r--test/Parser/cxx-class.cpp2
-rw-r--r--test/Parser/cxx-decl.cpp4
-rw-r--r--test/Parser/cxx-undeclared-identifier.cpp3
-rw-r--r--test/Parser/declarators.c11
-rw-r--r--test/Parser/objc-try-catch-1.m6
-rw-r--r--test/Parser/pragma-options.c2
-rw-r--r--test/Preprocessor/init.c168
-rw-r--r--test/Preprocessor/print_line_track.c4
-rw-r--r--test/Preprocessor/stdint.c66
-rw-r--r--test/Rewriter/dllimport-typedef.c8
-rw-r--r--test/Rewriter/missing-dllimport.c8
-rw-r--r--test/Rewriter/rewrite-elaborated-type.mm36
-rw-r--r--test/Sema/address_spaces.c2
-rw-r--r--test/Sema/align-x86-64.c11
-rw-r--r--test/Sema/attr-deprecated.c4
-rw-r--r--test/Sema/attr-regparm.c14
-rw-r--r--test/Sema/attr-unknown.c4
-rw-r--r--test/Sema/bitfield-layout.c10
-rw-r--r--test/Sema/block-call.c6
-rw-r--r--test/Sema/block-return.c7
-rw-r--r--test/Sema/builtins.c5
-rw-r--r--test/Sema/compare.c5
-rw-r--r--test/Sema/const-eval.c2
-rw-r--r--test/Sema/conversion-64-32.c2
-rw-r--r--test/Sema/conversion.c130
-rw-r--r--test/Sema/enum-packed.c16
-rw-r--r--test/Sema/enum.c2
-rw-r--r--test/Sema/expr-comma-c89.c6
-rw-r--r--test/Sema/expr-comma.c8
-rw-r--r--test/Sema/exprs.c8
-rw-r--r--test/Sema/ext_vector_casts.c7
-rw-r--r--test/Sema/ext_vector_comparisons.c30
-rw-r--r--test/Sema/extern-redecl.c9
-rw-r--r--test/Sema/format-strings-fixit.c44
-rw-r--r--test/Sema/format-strings.c44
-rw-r--r--test/Sema/function-redecl.c2
-rw-r--r--test/Sema/function.c4
-rw-r--r--test/Sema/i-c-e.c7
-rw-r--r--test/Sema/implicit-decl.c1
-rw-r--r--test/Sema/init.c2
-rw-r--r--test/Sema/missing-field-initializers.c2
-rw-r--r--test/Sema/opencl-init.c15
-rw-r--r--test/Sema/pragma-align-mac68k-unsupported.c4
-rw-r--r--test/Sema/pragma-align-mac68k.c2
-rw-r--r--test/Sema/pragma-align-packed.c23
-rw-r--r--test/Sema/pragma-pack-and-options-align.c8
-rw-r--r--test/Sema/return.c2
-rw-r--r--test/Sema/self-comparison.c55
-rw-r--r--test/Sema/struct-cast.c3
-rw-r--r--test/Sema/struct-decl.c5
-rw-r--r--test/Sema/switch.c11
-rw-r--r--test/Sema/transparent-union.c7
-rw-r--r--test/Sema/types.c2
-rw-r--r--test/Sema/var-redecl.c4
-rw-r--r--test/Sema/warn-unused-value.c16
-rw-r--r--test/SemaCXX/abstract.cpp18
-rw-r--r--test/SemaCXX/access-base-class.cpp2
-rw-r--r--test/SemaCXX/ambig-user-defined-conversions.cpp3
-rw-r--r--test/SemaCXX/attr-regparm.cpp14
-rw-r--r--test/SemaCXX/blocks-1.cpp10
-rw-r--r--test/SemaCXX/class-layout.cpp31
-rw-r--r--test/SemaCXX/class.cpp6
-rw-r--r--test/SemaCXX/compare.cpp8
-rw-r--r--test/SemaCXX/conditional-expr.cpp31
-rw-r--r--test/SemaCXX/constructor-initializer.cpp17
-rw-r--r--test/SemaCXX/conversion.cpp45
-rw-r--r--test/SemaCXX/crash-8124080.cpp21
-rw-r--r--test/SemaCXX/destructor.cpp24
-rw-r--r--test/SemaCXX/empty-class-layout.cpp60
-rw-r--r--test/SemaCXX/enum.cpp8
-rw-r--r--test/SemaCXX/exception-spec-no-exceptions.cpp32
-rw-r--r--test/SemaCXX/friend.cpp17
-rw-r--r--test/SemaCXX/function-type-qual.cpp9
-rw-r--r--test/SemaCXX/implicit-member-functions.cpp11
-rw-r--r--test/SemaCXX/init-priority-attr.cpp36
-rw-r--r--test/SemaCXX/instantiate-blocks.cpp19
-rw-r--r--test/SemaCXX/member-expr.cpp29
-rw-r--r--test/SemaCXX/new-array-size-conv.cpp27
-rw-r--r--test/SemaCXX/new-delete.cpp49
-rw-r--r--test/SemaCXX/overload-call.cpp30
-rw-r--r--test/SemaCXX/overloaded-builtin-operators.cpp16
-rw-r--r--test/SemaCXX/overloaded-operator.cpp9
-rw-r--r--test/SemaCXX/pseudo-destructors.cpp12
-rw-r--r--test/SemaCXX/reinterpret-cast.cpp12
-rw-r--r--test/SemaCXX/rval-references.cpp7
-rw-r--r--test/SemaCXX/typedef-redecl.cpp6
-rw-r--r--test/SemaCXX/using-directive.cpp5
-rw-r--r--test/SemaCXX/vector.cpp30
-rw-r--r--test/SemaCXX/warn-self-comparisons.cpp5
-rw-r--r--test/SemaCXX/warn-unreachable.cpp2
-rw-r--r--test/SemaCXX/warn-unused-variables.cpp2
-rw-r--r--test/SemaCXX/warn_false_to_pointer.cpp9
-rw-r--r--test/SemaCXX/wchar_t.cpp5
-rw-r--r--test/SemaObjC/duplicate-property-class-extension.m14
-rw-r--r--test/SemaObjC/format-strings-objc.m8
-rw-r--r--test/SemaObjC/return.m19
-rw-r--r--test/SemaObjC/super-class-protocol-conformance.m16
-rw-r--r--test/SemaObjCXX/instantiate-message.mm2
-rw-r--r--test/SemaObjCXX/instantiate-method-return.mm26
-rw-r--r--test/SemaObjCXX/message.mm6
-rw-r--r--test/SemaObjCXX/objc-pointer-conv.mm8
-rw-r--r--test/SemaObjCXX/overload.mm9
-rw-r--r--test/SemaTemplate/array-to-pointer-decay.cpp25
-rw-r--r--test/SemaTemplate/attributes.cpp23
-rw-r--r--test/SemaTemplate/class-template-ctor-initializer.cpp22
-rw-r--r--test/SemaTemplate/deduction.cpp9
-rw-r--r--test/SemaTemplate/dependent-type-identity.cpp12
-rw-r--r--test/SemaTemplate/destructor-template.cpp10
-rw-r--r--test/SemaTemplate/example-dynarray.cpp2
-rw-r--r--test/SemaTemplate/explicit-instantiation.cpp13
-rw-r--r--test/SemaTemplate/ext-vector-type.cpp4
-rw-r--r--test/SemaTemplate/instantiate-field.cpp9
-rw-r--r--test/SemaTemplate/instantiate-function-1.cpp4
-rw-r--r--test/SemaTemplate/instantiate-function-2.cpp11
-rw-r--r--test/SemaTemplate/instantiate-member-template.cpp33
-rw-r--r--test/SemaTemplate/instantiate-objc-1.mm1
-rw-r--r--test/SemaTemplate/member-function-template.cpp16
-rw-r--r--test/SemaTemplate/nested-name-spec-template.cpp19
-rw-r--r--test/SemaTemplate/self-comparison.cpp48
-rw-r--r--test/SemaTemplate/typename-specifier-4.cpp3
-rw-r--r--test/SemaTemplate/typename-specifier.cpp15
-rw-r--r--test/lit.cfg6
-rw-r--r--tools/Makefile8
-rw-r--r--tools/c-index-test/Makefile7
-rw-r--r--tools/c-index-test/c-index-test.c47
-rw-r--r--tools/driver/CMakeLists.txt1
-rw-r--r--tools/driver/Makefile13
-rw-r--r--tools/driver/cc1_main.cpp20
-rw-r--r--tools/driver/cc1as_main.cpp9
-rw-r--r--tools/libclang/CIndex.cpp41
-rw-r--r--tools/libclang/CIndexCodeCompletion.cpp5
-rw-r--r--tools/libclang/CIndexer.cpp1
-rw-r--r--tools/libclang/CMakeLists.txt3
-rw-r--r--tools/libclang/CXCursor.cpp8
-rw-r--r--tools/libclang/CXSourceLocation.h7
-rw-r--r--tools/libclang/CXTypes.cpp39
-rw-r--r--tools/libclang/Makefile11
-rw-r--r--tools/libclang/libclang.darwin.exports3
-rw-r--r--tools/libclang/libclang.exports4
-rwxr-xr-xtools/scan-build/ccc-analyzer3
-rwxr-xr-xutils/FuzzTest340
-rw-r--r--www/analyzer/installation.html4
-rw-r--r--www/analyzer/latest_checker.html.incl2
-rw-r--r--www/compatibility.html609
-rw-r--r--www/content.css3
-rw-r--r--www/cxx_compatibility.html282
-rw-r--r--www/hacking.html3
-rw-r--r--www/index.html4
-rw-r--r--www/menu.html.incl5
765 files changed, 45860 insertions, 15222 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1be646dfd2e3..1ba2a622d4e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,5 @@
# Clang version information
-# Make sure that CMake reconfigures when the version changes.
-configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/VER
- ${CMAKE_CURRENT_BINARY_DIR}/VER)
-
set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
@@ -28,12 +23,28 @@ if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
endif()
endif()
-# Compute the Clang version from the contents of VER
-file(READ ${CMAKE_CURRENT_SOURCE_DIR}/VER CLANG_VERSION_DATA)
+# Compute the Clang version from the LLVM version.
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
- ${CLANG_VERSION_DATA})
+ ${PACKAGE_VERSION})
message(STATUS "Clang version: ${CLANG_VERSION}")
+string(REGEX REPLACE "([0-9]+)\\.[0-9]+(\\.[0-9]+)?" "\\1" CLANG_VERSION_MAJOR
+ ${CLANG_VERSION})
+string(REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" CLANG_VERSION_MINOR
+ ${CLANG_VERSION})
+if (${CLANG_VERSION} MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
+ set(CLANG_HAS_VERSION_PATCHLEVEL 1)
+ string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" CLANG_VERSION_PATCHLEVEL
+ ${CLANG_VERSION})
+else()
+ set(CLANG_HAS_VERSION_PATCHLEVEL 0)
+endif()
+
+# Configure the Version.inc file.
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/clang/Basic/Version.inc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/include/clang/Basic/Version.inc)
+
# Add appropriate flags for GCC
if (CMAKE_COMPILER_IS_GNUCXX)
# FIXME: Turn off exceptions, RTTI:
@@ -41,6 +52,10 @@ if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings")
endif ()
+if (APPLE)
+ set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
+endif ()
+
macro(add_clang_library name)
set(srcs ${ARGN})
if(MSVC_IDE OR XCODE)
@@ -54,7 +69,9 @@ macro(add_clang_library name)
../../include/clang${dir}/*.def)
set(srcs ${srcs} ${headers})
endif(MSVC_IDE OR XCODE)
- if (SHARED_LIBRARY)
+ if (MODULE)
+ set(libkind MODULE)
+ elseif (SHARED_LIBRARY)
set(libkind SHARED)
else()
set(libkind)
diff --git a/Makefile b/Makefile
index 39cf9c6f57a1..f871c25274ed 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,63 @@
-LEVEL = ../..
-DIRS := include lib tools docs
+##===- Makefile --------------------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+# If CLANG_LEVEL is not set, then we are the top-level Makefile. Otherwise, we
+# are being included from a subdirectory makefile.
+
+ifndef CLANG_LEVEL
+
+IS_TOP_LEVEL := 1
+CLANG_LEVEL := .
+DIRS := include lib tools runtime docs
PARALLEL_DIRS :=
ifeq ($(BUILD_EXAMPLES),1)
PARALLEL_DIRS += examples
endif
+endif
+
+ifeq ($(MAKECMDGOALS),libs-only)
+ DIRS := $(filter-out tools docs, $(DIRS))
+ OPTIONAL_DIRS :=
+endif
+
+###
+# Common Makefile code, shared by all Clang Makefiles.
+
+# Set LLVM source root level.
+LEVEL := $(CLANG_LEVEL)/../..
+# Include LLVM common makefile.
include $(LEVEL)/Makefile.common
+# Set common Clang build flags.
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(CLANG_LEVEL)/include -I$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include
+ifdef CLANG_VENDOR
+CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
+endif
+
+# Disable -fstrict-aliasing. Darwin disables it by default (and LLVM doesn't
+# work with it enabled with GCC), Clang/llvm-gc don't support it yet, and newer
+# GCC's have false positive warnings with it on Linux (which prove a pain to
+# fix). For example:
+# http://gcc.gnu.org/PR41874
+# http://gcc.gnu.org/PR41838
+#
+# We can revisit this when LLVM/Clang support it.
+CXX.Flags += -fno-strict-aliasing
+
+###
+# Clang Top Level specific stuff.
+
+ifeq ($(IS_TOP_LEVEL),1)
+
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
$(RecursiveTargets)::
$(Verb) if [ ! -f test/Makefile ]; then \
@@ -26,6 +75,8 @@ report::
clean::
@ $(MAKE) -C test clean
+libs-only: all
+
tags::
$(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \
grep -v /lib/Headers | grep -v /test/`
@@ -37,3 +88,5 @@ cscope.files:
-or -name '*.h' > cscope.files
.PHONY: test report clean cscope.files
+
+endif
diff --git a/NOTES.txt b/NOTES.txt
index beceb7d1ccce..f66a96120a81 100644
--- a/NOTES.txt
+++ b/NOTES.txt
@@ -13,8 +13,7 @@ This is similar to -Eonly.
//===---------------------------------------------------------------------===//
-Creating and using a PTH file for performance measurement (use a release-asserts
-build).
+Creating and using a PTH file for performance measurement (use a release build).
$ clang -ccc-pch-is-pth -x objective-c-header INPUTS/Cocoa_h.m -o /tmp/tokencache
$ clang -cc1 -token-cache /tmp/tokencache INPUTS/Cocoa_h.m
diff --git a/README.txt b/README.txt
index 924ecc416c3a..44ce723acef8 100644
--- a/README.txt
+++ b/README.txt
@@ -4,7 +4,7 @@
Welcome to Clang. This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
-compiler intrastructure project.
+compiler infrastructure project.
Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj
index 43733f779378..40c1f5f458cd 100644
--- a/clang.xcodeproj/project.pbxproj
+++ b/clang.xcodeproj/project.pbxproj
@@ -19,9 +19,6 @@
1A2A54BD0FD1DD1C00F4CE45 /* HTMLPrint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54AC0FD1DD1C00F4CE45 /* HTMLPrint.cpp */; };
1A2A54BE0FD1DD1C00F4CE45 /* PrintParserCallbacks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54AD0FD1DD1C00F4CE45 /* PrintParserCallbacks.cpp */; };
1A2A54BF0FD1DD1C00F4CE45 /* PrintPreprocessedOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54AE0FD1DD1C00F4CE45 /* PrintPreprocessedOutput.cpp */; };
- 1A2A54C10FD1DD1C00F4CE45 /* RewriteMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54B00FD1DD1C00F4CE45 /* RewriteMacros.cpp */; };
- 1A2A54C20FD1DD1C00F4CE45 /* RewriteObjC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54B10FD1DD1C00F4CE45 /* RewriteObjC.cpp */; };
- 1A2A54C30FD1DD1C00F4CE45 /* RewriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54B20FD1DD1C00F4CE45 /* RewriteTest.cpp */; };
1A2A54C40FD1DD1C00F4CE45 /* StmtXML.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54B30FD1DD1C00F4CE45 /* StmtXML.cpp */; };
1A2A54C50FD1DD1C00F4CE45 /* Warnings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54B40FD1DD1C00F4CE45 /* Warnings.cpp */; };
1A30A9E90B93A4C800201A91 /* ExprCXX.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1A30A9E80B93A4C800201A91 /* ExprCXX.h */; };
@@ -171,6 +168,50 @@
BF89C3F911595A01001C2D68 /* SemaType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BF89C3F811595A01001C2D68 /* SemaType.cpp */; };
BF89C3FB11595A37001C2D68 /* SemaCodeComplete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BF89C3FA11595A37001C2D68 /* SemaCodeComplete.cpp */; };
BF89C3FD11595A5D001C2D68 /* SemaExceptionSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BF89C3FC11595A5D001C2D68 /* SemaExceptionSpec.cpp */; };
+ BFE2F6AB11DA955A0007EDC0 /* DeltaTree.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F67D11DA95590007EDC0 /* DeltaTree.d */; };
+ BFE2F6AC11DA955A0007EDC0 /* DeltaTree.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F67E11DA955A0007EDC0 /* DeltaTree.o */; };
+ BFE2F6AD11DA955A0007EDC0 /* FixItRewriter.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F67F11DA955A0007EDC0 /* FixItRewriter.d */; };
+ BFE2F6AE11DA955A0007EDC0 /* FixItRewriter.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68011DA955A0007EDC0 /* FixItRewriter.o */; };
+ BFE2F6AF11DA955A0007EDC0 /* FrontendActions.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68111DA955A0007EDC0 /* FrontendActions.d */; };
+ BFE2F6B011DA955A0007EDC0 /* FrontendActions.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68211DA955A0007EDC0 /* FrontendActions.o */; };
+ BFE2F6B111DA955A0007EDC0 /* HTMLPrint.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68311DA955A0007EDC0 /* HTMLPrint.d */; };
+ BFE2F6B211DA955A0007EDC0 /* HTMLPrint.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68411DA955A0007EDC0 /* HTMLPrint.o */; };
+ BFE2F6B311DA955A0007EDC0 /* HTMLRewrite.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68511DA955A0007EDC0 /* HTMLRewrite.d */; };
+ BFE2F6B411DA955A0007EDC0 /* HTMLRewrite.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68611DA955A0007EDC0 /* HTMLRewrite.o */; };
+ BFE2F6B511DA955A0007EDC0 /* RewriteMacros.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68711DA955A0007EDC0 /* RewriteMacros.d */; };
+ BFE2F6B611DA955A0007EDC0 /* RewriteMacros.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68811DA955A0007EDC0 /* RewriteMacros.o */; };
+ BFE2F6B711DA955A0007EDC0 /* RewriteObjC.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68911DA955A0007EDC0 /* RewriteObjC.d */; };
+ BFE2F6B811DA955A0007EDC0 /* RewriteObjC.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68A11DA955A0007EDC0 /* RewriteObjC.o */; };
+ BFE2F6B911DA955A0007EDC0 /* Rewriter.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68B11DA955A0007EDC0 /* Rewriter.d */; };
+ BFE2F6BA11DA955A0007EDC0 /* Rewriter.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68C11DA955A0007EDC0 /* Rewriter.o */; };
+ BFE2F6BB11DA955A0007EDC0 /* RewriteRope.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68D11DA955A0007EDC0 /* RewriteRope.d */; };
+ BFE2F6BC11DA955A0007EDC0 /* RewriteRope.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68E11DA955A0007EDC0 /* RewriteRope.o */; };
+ BFE2F6BD11DA955A0007EDC0 /* RewriteTest.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68F11DA955A0007EDC0 /* RewriteTest.d */; };
+ BFE2F6BE11DA955A0007EDC0 /* RewriteTest.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F69011DA955A0007EDC0 /* RewriteTest.o */; };
+ BFE2F6BF11DA955A0007EDC0 /* TokenRewriter.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69111DA955A0007EDC0 /* TokenRewriter.d */; };
+ BFE2F6C011DA955A0007EDC0 /* TokenRewriter.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F69211DA955A0007EDC0 /* TokenRewriter.o */; };
+ BFE2F6C111DA955A0007EDC0 /* DeltaTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69311DA955A0007EDC0 /* DeltaTree.cpp */; };
+ BFE2F6C211DA955A0007EDC0 /* FixItRewriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69411DA955A0007EDC0 /* FixItRewriter.cpp */; };
+ BFE2F6C311DA955A0007EDC0 /* FrontendActions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69511DA955A0007EDC0 /* FrontendActions.cpp */; };
+ BFE2F6C411DA955A0007EDC0 /* HTMLPrint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69611DA955A0007EDC0 /* HTMLPrint.cpp */; };
+ BFE2F6C511DA955A0007EDC0 /* HTMLRewrite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69711DA955A0007EDC0 /* HTMLRewrite.cpp */; };
+ BFE2F6C611DA955A0007EDC0 /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69811DA955A0007EDC0 /* Makefile */; };
+ BFE2F6C711DA955A0007EDC0 /* DeltaTree.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69B11DA955A0007EDC0 /* DeltaTree.d */; };
+ BFE2F6C811DA955A0007EDC0 /* DeltaTree.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F69C11DA955A0007EDC0 /* DeltaTree.o */; };
+ BFE2F6C911DA955A0007EDC0 /* HTMLRewrite.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69D11DA955A0007EDC0 /* HTMLRewrite.d */; };
+ BFE2F6CA11DA955A0007EDC0 /* HTMLRewrite.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F69E11DA955A0007EDC0 /* HTMLRewrite.o */; };
+ BFE2F6CB11DA955A0007EDC0 /* Rewriter.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69F11DA955A0007EDC0 /* Rewriter.d */; };
+ BFE2F6CC11DA955A0007EDC0 /* Rewriter.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F6A011DA955A0007EDC0 /* Rewriter.o */; };
+ BFE2F6CD11DA955A0007EDC0 /* RewriteRope.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A111DA955A0007EDC0 /* RewriteRope.d */; };
+ BFE2F6CE11DA955A0007EDC0 /* RewriteRope.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F6A211DA955A0007EDC0 /* RewriteRope.o */; };
+ BFE2F6CF11DA955A0007EDC0 /* TokenRewriter.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A311DA955A0007EDC0 /* TokenRewriter.d */; };
+ BFE2F6D011DA955A0007EDC0 /* TokenRewriter.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F6A411DA955A0007EDC0 /* TokenRewriter.o */; };
+ BFE2F6D111DA955A0007EDC0 /* RewriteMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A511DA955A0007EDC0 /* RewriteMacros.cpp */; };
+ BFE2F6D211DA955A0007EDC0 /* RewriteObjC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A611DA955A0007EDC0 /* RewriteObjC.cpp */; };
+ BFE2F6D311DA955A0007EDC0 /* Rewriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A711DA955A0007EDC0 /* Rewriter.cpp */; };
+ BFE2F6D411DA955A0007EDC0 /* RewriteRope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A811DA955A0007EDC0 /* RewriteRope.cpp */; };
+ BFE2F6D511DA955A0007EDC0 /* RewriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A911DA955A0007EDC0 /* RewriteTest.cpp */; };
+ BFE2F6D611DA955A0007EDC0 /* TokenRewriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6AA11DA955A0007EDC0 /* TokenRewriter.cpp */; };
DE01DA490B12ADA300AC22CE /* PPCallbacks.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE01DA480B12ADA300AC22CE /* PPCallbacks.h */; };
DE06756C0C051CFE00EBBFD8 /* ParseExprCXX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE06756B0C051CFE00EBBFD8 /* ParseExprCXX.cpp */; };
DE06B73E0A8307640050E87E /* LangOptions.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE06B73D0A8307640050E87E /* LangOptions.h */; };
@@ -391,9 +432,6 @@
1A2A54AC0FD1DD1C00F4CE45 /* HTMLPrint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HTMLPrint.cpp; path = lib/Frontend/HTMLPrint.cpp; sourceTree = "<group>"; };
1A2A54AD0FD1DD1C00F4CE45 /* PrintParserCallbacks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PrintParserCallbacks.cpp; path = lib/Frontend/PrintParserCallbacks.cpp; sourceTree = "<group>"; };
1A2A54AE0FD1DD1C00F4CE45 /* PrintPreprocessedOutput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PrintPreprocessedOutput.cpp; path = lib/Frontend/PrintPreprocessedOutput.cpp; sourceTree = "<group>"; };
- 1A2A54B00FD1DD1C00F4CE45 /* RewriteMacros.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RewriteMacros.cpp; path = lib/Frontend/RewriteMacros.cpp; sourceTree = "<group>"; };
- 1A2A54B10FD1DD1C00F4CE45 /* RewriteObjC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = RewriteObjC.cpp; path = lib/Frontend/RewriteObjC.cpp; sourceTree = "<group>"; tabWidth = 2; };
- 1A2A54B20FD1DD1C00F4CE45 /* RewriteTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RewriteTest.cpp; path = lib/Frontend/RewriteTest.cpp; sourceTree = "<group>"; };
1A2A54B30FD1DD1C00F4CE45 /* StmtXML.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StmtXML.cpp; path = lib/Frontend/StmtXML.cpp; sourceTree = "<group>"; };
1A2A54B40FD1DD1C00F4CE45 /* Warnings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Warnings.cpp; path = lib/Frontend/Warnings.cpp; sourceTree = "<group>"; };
1A30A9E80B93A4C800201A91 /* ExprCXX.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = ExprCXX.h; path = clang/AST/ExprCXX.h; sourceTree = "<group>"; tabWidth = 2; };
@@ -438,6 +476,10 @@
1A869AA70BA21ABA008DA07A /* LiteralSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LiteralSupport.cpp; sourceTree = "<group>"; };
1A97825A1108BA18002B98FC /* CGVTT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGVTT.cpp; path = lib/CodeGen/CGVTT.cpp; sourceTree = "<group>"; tabWidth = 2; };
1A986AB610D0746D00A8EA9E /* CGDeclCXX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGDeclCXX.cpp; path = lib/CodeGen/CGDeclCXX.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ 1AA1D35611BECFF70089CC3F /* CC1AsOptions.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CC1AsOptions.td; path = clang/Driver/CC1AsOptions.td; sourceTree = "<group>"; };
+ 1AA1D35711BECFF70089CC3F /* CC1Options.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CC1Options.td; path = clang/Driver/CC1Options.td; sourceTree = "<group>"; };
+ 1AA1D35811BECFF70089CC3F /* Options.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Options.td; path = clang/Driver/Options.td; sourceTree = "<group>"; };
+ 1AA1D35911BECFF70089CC3F /* OptParser.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = OptParser.td; path = clang/Driver/OptParser.td; sourceTree = "<group>"; };
1AA963AB10D8576800786C86 /* FullExpr.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = FullExpr.h; path = clang/AST/FullExpr.h; sourceTree = "<group>"; tabWidth = 2; };
1AB290021045858B00FE33D8 /* PartialDiagnostic.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; path = PartialDiagnostic.h; sourceTree = "<group>"; tabWidth = 2; };
1ABC36930C7A4BDC006DB0AB /* CGBuiltin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGBuiltin.cpp; path = lib/CodeGen/CGBuiltin.cpp; sourceTree = "<group>"; tabWidth = 2; };
@@ -661,6 +703,53 @@
BF89C3F811595A01001C2D68 /* SemaType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SemaType.cpp; path = lib/Sema/SemaType.cpp; sourceTree = "<group>"; };
BF89C3FA11595A37001C2D68 /* SemaCodeComplete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SemaCodeComplete.cpp; path = lib/Sema/SemaCodeComplete.cpp; sourceTree = "<group>"; };
BF89C3FC11595A5D001C2D68 /* SemaExceptionSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SemaExceptionSpec.cpp; path = lib/Sema/SemaExceptionSpec.cpp; sourceTree = "<group>"; };
+ BFE2F67A11DA95590007EDC0 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
+ BFE2F67C11DA95590007EDC0 /* .dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .dir; sourceTree = "<group>"; };
+ BFE2F67D11DA95590007EDC0 /* DeltaTree.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = DeltaTree.d; sourceTree = "<group>"; };
+ BFE2F67E11DA955A0007EDC0 /* DeltaTree.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = DeltaTree.o; sourceTree = "<group>"; };
+ BFE2F67F11DA955A0007EDC0 /* FixItRewriter.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = FixItRewriter.d; sourceTree = "<group>"; };
+ BFE2F68011DA955A0007EDC0 /* FixItRewriter.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = FixItRewriter.o; sourceTree = "<group>"; };
+ BFE2F68111DA955A0007EDC0 /* FrontendActions.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = FrontendActions.d; sourceTree = "<group>"; };
+ BFE2F68211DA955A0007EDC0 /* FrontendActions.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = FrontendActions.o; sourceTree = "<group>"; };
+ BFE2F68311DA955A0007EDC0 /* HTMLPrint.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = HTMLPrint.d; sourceTree = "<group>"; };
+ BFE2F68411DA955A0007EDC0 /* HTMLPrint.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = HTMLPrint.o; sourceTree = "<group>"; };
+ BFE2F68511DA955A0007EDC0 /* HTMLRewrite.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = HTMLRewrite.d; sourceTree = "<group>"; };
+ BFE2F68611DA955A0007EDC0 /* HTMLRewrite.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = HTMLRewrite.o; sourceTree = "<group>"; };
+ BFE2F68711DA955A0007EDC0 /* RewriteMacros.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = RewriteMacros.d; sourceTree = "<group>"; };
+ BFE2F68811DA955A0007EDC0 /* RewriteMacros.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = RewriteMacros.o; sourceTree = "<group>"; };
+ BFE2F68911DA955A0007EDC0 /* RewriteObjC.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = RewriteObjC.d; sourceTree = "<group>"; };
+ BFE2F68A11DA955A0007EDC0 /* RewriteObjC.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = RewriteObjC.o; sourceTree = "<group>"; };
+ BFE2F68B11DA955A0007EDC0 /* Rewriter.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = Rewriter.d; sourceTree = "<group>"; };
+ BFE2F68C11DA955A0007EDC0 /* Rewriter.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = Rewriter.o; sourceTree = "<group>"; };
+ BFE2F68D11DA955A0007EDC0 /* RewriteRope.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = RewriteRope.d; sourceTree = "<group>"; };
+ BFE2F68E11DA955A0007EDC0 /* RewriteRope.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = RewriteRope.o; sourceTree = "<group>"; };
+ BFE2F68F11DA955A0007EDC0 /* RewriteTest.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = RewriteTest.d; sourceTree = "<group>"; };
+ BFE2F69011DA955A0007EDC0 /* RewriteTest.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = RewriteTest.o; sourceTree = "<group>"; };
+ BFE2F69111DA955A0007EDC0 /* TokenRewriter.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = TokenRewriter.d; sourceTree = "<group>"; };
+ BFE2F69211DA955A0007EDC0 /* TokenRewriter.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = TokenRewriter.o; sourceTree = "<group>"; };
+ BFE2F69311DA955A0007EDC0 /* DeltaTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeltaTree.cpp; sourceTree = "<group>"; };
+ BFE2F69411DA955A0007EDC0 /* FixItRewriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FixItRewriter.cpp; sourceTree = "<group>"; };
+ BFE2F69511DA955A0007EDC0 /* FrontendActions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrontendActions.cpp; sourceTree = "<group>"; };
+ BFE2F69611DA955A0007EDC0 /* HTMLPrint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPrint.cpp; sourceTree = "<group>"; };
+ BFE2F69711DA955A0007EDC0 /* HTMLRewrite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLRewrite.cpp; sourceTree = "<group>"; };
+ BFE2F69811DA955A0007EDC0 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
+ BFE2F69A11DA955A0007EDC0 /* .dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .dir; sourceTree = "<group>"; };
+ BFE2F69B11DA955A0007EDC0 /* DeltaTree.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = DeltaTree.d; sourceTree = "<group>"; };
+ BFE2F69C11DA955A0007EDC0 /* DeltaTree.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = DeltaTree.o; sourceTree = "<group>"; };
+ BFE2F69D11DA955A0007EDC0 /* HTMLRewrite.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = HTMLRewrite.d; sourceTree = "<group>"; };
+ BFE2F69E11DA955A0007EDC0 /* HTMLRewrite.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = HTMLRewrite.o; sourceTree = "<group>"; };
+ BFE2F69F11DA955A0007EDC0 /* Rewriter.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = Rewriter.d; sourceTree = "<group>"; };
+ BFE2F6A011DA955A0007EDC0 /* Rewriter.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = Rewriter.o; sourceTree = "<group>"; };
+ BFE2F6A111DA955A0007EDC0 /* RewriteRope.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = RewriteRope.d; sourceTree = "<group>"; };
+ BFE2F6A211DA955A0007EDC0 /* RewriteRope.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = RewriteRope.o; sourceTree = "<group>"; };
+ BFE2F6A311DA955A0007EDC0 /* TokenRewriter.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = TokenRewriter.d; sourceTree = "<group>"; };
+ BFE2F6A411DA955A0007EDC0 /* TokenRewriter.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = TokenRewriter.o; sourceTree = "<group>"; };
+ BFE2F6A511DA955A0007EDC0 /* RewriteMacros.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteMacros.cpp; sourceTree = "<group>"; };
+ BFE2F6A611DA955A0007EDC0 /* RewriteObjC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteObjC.cpp; sourceTree = "<group>"; };
+ BFE2F6A711DA955A0007EDC0 /* Rewriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Rewriter.cpp; sourceTree = "<group>"; };
+ BFE2F6A811DA955A0007EDC0 /* RewriteRope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteRope.cpp; sourceTree = "<group>"; };
+ BFE2F6A911DA955A0007EDC0 /* RewriteTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteTest.cpp; sourceTree = "<group>"; };
+ BFE2F6AA11DA955A0007EDC0 /* TokenRewriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TokenRewriter.cpp; sourceTree = "<group>"; };
DE01DA480B12ADA300AC22CE /* PPCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PPCallbacks.h; sourceTree = "<group>"; };
DE06756B0C051CFE00EBBFD8 /* ParseExprCXX.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = ParseExprCXX.cpp; path = lib/Parse/ParseExprCXX.cpp; sourceTree = "<group>"; tabWidth = 2; };
DE06B73D0A8307640050E87E /* LangOptions.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.c.h; path = LangOptions.h; sourceTree = "<group>"; tabWidth = 2; };
@@ -807,24 +896,24 @@
DEDFE5270F63A9230035BD10 /* DeclNodes.def */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = text; name = DeclNodes.def; path = clang/AST/DeclNodes.def; sourceTree = "<group>"; tabWidth = 2; };
DEDFE5CB0F7206CC0035BD10 /* NestedNameSpecifier.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = NestedNameSpecifier.h; path = clang/AST/NestedNameSpecifier.h; sourceTree = "<group>"; tabWidth = 2; };
DEDFE6450F7B3B4E0035BD10 /* driver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = driver.cpp; path = tools/driver/driver.cpp; sourceTree = "<group>"; };
- DEDFE6480F7B3B830035BD10 /* Types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Types.cpp; path = lib/Driver/Types.cpp; sourceTree = "<group>"; };
- DEDFE6490F7B3B830035BD10 /* Tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Tools.h; path = lib/Driver/Tools.h; sourceTree = "<group>"; };
- DEDFE64A0F7B3B830035BD10 /* Tools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tools.cpp; path = lib/Driver/Tools.cpp; sourceTree = "<group>"; };
- DEDFE64B0F7B3B830035BD10 /* ToolChains.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ToolChains.h; path = lib/Driver/ToolChains.h; sourceTree = "<group>"; };
- DEDFE64C0F7B3B830035BD10 /* Compilation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Compilation.cpp; path = lib/Driver/Compilation.cpp; sourceTree = "<group>"; };
- DEDFE64D0F7B3B830035BD10 /* ArgList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ArgList.cpp; path = lib/Driver/ArgList.cpp; sourceTree = "<group>"; };
- DEDFE64E0F7B3B830035BD10 /* Arg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Arg.cpp; path = lib/Driver/Arg.cpp; sourceTree = "<group>"; };
- DEDFE64F0F7B3B830035BD10 /* Action.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Action.cpp; path = lib/Driver/Action.cpp; sourceTree = "<group>"; };
- DEDFE6500F7B3B830035BD10 /* Phases.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Phases.cpp; path = lib/Driver/Phases.cpp; sourceTree = "<group>"; };
- DEDFE6510F7B3B830035BD10 /* OptTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptTable.cpp; path = lib/Driver/OptTable.cpp; sourceTree = "<group>"; };
- DEDFE6520F7B3B830035BD10 /* Option.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Option.cpp; path = lib/Driver/Option.cpp; sourceTree = "<group>"; };
- DEDFE6530F7B3B830035BD10 /* Job.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Job.cpp; path = lib/Driver/Job.cpp; sourceTree = "<group>"; };
- DEDFE6540F7B3B830035BD10 /* InputInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InputInfo.h; path = lib/Driver/InputInfo.h; sourceTree = "<group>"; };
- DEDFE6550F7B3B830035BD10 /* ToolChains.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ToolChains.cpp; path = lib/Driver/ToolChains.cpp; sourceTree = "<group>"; };
- DEDFE6560F7B3B830035BD10 /* ToolChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ToolChain.cpp; path = lib/Driver/ToolChain.cpp; sourceTree = "<group>"; };
- DEDFE6570F7B3B830035BD10 /* Tool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tool.cpp; path = lib/Driver/Tool.cpp; sourceTree = "<group>"; };
- DEDFE6580F7B3B830035BD10 /* HostInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HostInfo.cpp; path = lib/Driver/HostInfo.cpp; sourceTree = "<group>"; };
- DEDFE6590F7B3B830035BD10 /* Driver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Driver.cpp; path = lib/Driver/Driver.cpp; sourceTree = "<group>"; };
+ DEDFE6480F7B3B830035BD10 /* Types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Types.cpp; path = lib/Driver/Types.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE6490F7B3B830035BD10 /* Tools.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = Tools.h; path = lib/Driver/Tools.h; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE64A0F7B3B830035BD10 /* Tools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Tools.cpp; path = lib/Driver/Tools.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE64B0F7B3B830035BD10 /* ToolChains.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = ToolChains.h; path = lib/Driver/ToolChains.h; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE64C0F7B3B830035BD10 /* Compilation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Compilation.cpp; path = lib/Driver/Compilation.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE64D0F7B3B830035BD10 /* ArgList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = ArgList.cpp; path = lib/Driver/ArgList.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE64E0F7B3B830035BD10 /* Arg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Arg.cpp; path = lib/Driver/Arg.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE64F0F7B3B830035BD10 /* Action.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Action.cpp; path = lib/Driver/Action.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE6500F7B3B830035BD10 /* Phases.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Phases.cpp; path = lib/Driver/Phases.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE6510F7B3B830035BD10 /* OptTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = OptTable.cpp; path = lib/Driver/OptTable.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE6520F7B3B830035BD10 /* Option.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Option.cpp; path = lib/Driver/Option.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE6530F7B3B830035BD10 /* Job.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Job.cpp; path = lib/Driver/Job.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE6540F7B3B830035BD10 /* InputInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = InputInfo.h; path = lib/Driver/InputInfo.h; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE6550F7B3B830035BD10 /* ToolChains.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = ToolChains.cpp; path = lib/Driver/ToolChains.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE6560F7B3B830035BD10 /* ToolChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = ToolChain.cpp; path = lib/Driver/ToolChain.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE6570F7B3B830035BD10 /* Tool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Tool.cpp; path = lib/Driver/Tool.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE6580F7B3B830035BD10 /* HostInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = HostInfo.cpp; path = lib/Driver/HostInfo.cpp; sourceTree = "<group>"; tabWidth = 2; };
+ DEDFE6590F7B3B830035BD10 /* Driver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Driver.cpp; path = lib/Driver/Driver.cpp; sourceTree = "<group>"; tabWidth = 2; };
DEDFF87F0F848CE30035BD10 /* TemplateName.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = TemplateName.h; path = clang/AST/TemplateName.h; sourceTree = "<group>"; tabWidth = 2; };
DEDFFF070F959EE60035BD10 /* Diagnostic.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Diagnostic.td; sourceTree = "<group>"; };
DEDFFF530F9704580035BD10 /* DiagnosticGroups.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DiagnosticGroups.td; sourceTree = "<group>"; };
@@ -841,7 +930,6 @@
DEF165150F8D46980098507F /* Types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Types.h; path = clang/Driver/Types.h; sourceTree = "<group>"; };
DEF165160F8D46980098507F /* Action.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Action.h; path = clang/Driver/Action.h; sourceTree = "<group>"; };
DEF165170F8D46980098507F /* Compilation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Compilation.h; path = clang/Driver/Compilation.h; sourceTree = "<group>"; };
- DEF165180F8D46980098507F /* Options.def */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Options.def; path = clang/Driver/Options.def; sourceTree = "<group>"; };
DEF165190F8D46980098507F /* Option.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Option.h; path = clang/Driver/Option.h; sourceTree = "<group>"; };
DEF1651A0F8D46980098507F /* Types.def */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Types.def; path = clang/Driver/Types.def; sourceTree = "<group>"; };
DEF1651B0F8D46980098507F /* ToolChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ToolChain.h; path = clang/Driver/ToolChain.h; sourceTree = "<group>"; };
@@ -880,6 +968,22 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ BFE2F6AC11DA955A0007EDC0 /* DeltaTree.o in Frameworks */,
+ BFE2F6AE11DA955A0007EDC0 /* FixItRewriter.o in Frameworks */,
+ BFE2F6B011DA955A0007EDC0 /* FrontendActions.o in Frameworks */,
+ BFE2F6B211DA955A0007EDC0 /* HTMLPrint.o in Frameworks */,
+ BFE2F6B411DA955A0007EDC0 /* HTMLRewrite.o in Frameworks */,
+ BFE2F6B611DA955A0007EDC0 /* RewriteMacros.o in Frameworks */,
+ BFE2F6B811DA955A0007EDC0 /* RewriteObjC.o in Frameworks */,
+ BFE2F6BA11DA955A0007EDC0 /* Rewriter.o in Frameworks */,
+ BFE2F6BC11DA955A0007EDC0 /* RewriteRope.o in Frameworks */,
+ BFE2F6BE11DA955A0007EDC0 /* RewriteTest.o in Frameworks */,
+ BFE2F6C011DA955A0007EDC0 /* TokenRewriter.o in Frameworks */,
+ BFE2F6C811DA955A0007EDC0 /* DeltaTree.o in Frameworks */,
+ BFE2F6CA11DA955A0007EDC0 /* HTMLRewrite.o in Frameworks */,
+ BFE2F6CC11DA955A0007EDC0 /* Rewriter.o in Frameworks */,
+ BFE2F6CE11DA955A0007EDC0 /* RewriteRope.o in Frameworks */,
+ BFE2F6D011DA955A0007EDC0 /* TokenRewriter.o in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -901,6 +1005,7 @@
08FB7795FE84155DC02AAC07 /* Libraries */ = {
isa = PBXGroup;
children = (
+ BFE2F67911DA95590007EDC0 /* Rewrite */,
90FD6D6C103C3D2D005F5B73 /* Index */,
DED7D7500A5242C7003AD0FB /* Basic */,
DED7D78C0A5242E6003AD0FB /* Lex */,
@@ -1012,9 +1117,6 @@
352246E50F5C6BE000D0D279 /* TextDiagnosticBuffer.cpp */,
352246E60F5C6BE000D0D279 /* TextDiagnosticPrinter.cpp */,
1ACB57E21105820D0047B991 /* TypeXML.cpp */,
- 1A2A54B00FD1DD1C00F4CE45 /* RewriteMacros.cpp */,
- 1A2A54B10FD1DD1C00F4CE45 /* RewriteObjC.cpp */,
- 1A2A54B20FD1DD1C00F4CE45 /* RewriteTest.cpp */,
1A2A54B30FD1DD1C00F4CE45 /* StmtXML.cpp */,
1ACB57E31105820D0047B991 /* VerifyDiagnosticsClient.cpp */,
1A2A54B40FD1DD1C00F4CE45 /* Warnings.cpp */,
@@ -1209,6 +1311,77 @@
name = "index-test";
sourceTree = "<group>";
};
+ BFE2F67911DA95590007EDC0 /* Rewrite */ = {
+ isa = PBXGroup;
+ children = (
+ BFE2F67A11DA95590007EDC0 /* CMakeLists.txt */,
+ BFE2F67B11DA95590007EDC0 /* Debug */,
+ BFE2F69311DA955A0007EDC0 /* DeltaTree.cpp */,
+ BFE2F69411DA955A0007EDC0 /* FixItRewriter.cpp */,
+ BFE2F69511DA955A0007EDC0 /* FrontendActions.cpp */,
+ BFE2F69611DA955A0007EDC0 /* HTMLPrint.cpp */,
+ BFE2F69711DA955A0007EDC0 /* HTMLRewrite.cpp */,
+ BFE2F69811DA955A0007EDC0 /* Makefile */,
+ BFE2F69911DA955A0007EDC0 /* Release-Asserts */,
+ BFE2F6A511DA955A0007EDC0 /* RewriteMacros.cpp */,
+ BFE2F6A611DA955A0007EDC0 /* RewriteObjC.cpp */,
+ BFE2F6A711DA955A0007EDC0 /* Rewriter.cpp */,
+ BFE2F6A811DA955A0007EDC0 /* RewriteRope.cpp */,
+ BFE2F6A911DA955A0007EDC0 /* RewriteTest.cpp */,
+ BFE2F6AA11DA955A0007EDC0 /* TokenRewriter.cpp */,
+ );
+ name = Rewrite;
+ path = lib/Rewrite;
+ sourceTree = "<group>";
+ };
+ BFE2F67B11DA95590007EDC0 /* Debug */ = {
+ isa = PBXGroup;
+ children = (
+ BFE2F67C11DA95590007EDC0 /* .dir */,
+ BFE2F67D11DA95590007EDC0 /* DeltaTree.d */,
+ BFE2F67E11DA955A0007EDC0 /* DeltaTree.o */,
+ BFE2F67F11DA955A0007EDC0 /* FixItRewriter.d */,
+ BFE2F68011DA955A0007EDC0 /* FixItRewriter.o */,
+ BFE2F68111DA955A0007EDC0 /* FrontendActions.d */,
+ BFE2F68211DA955A0007EDC0 /* FrontendActions.o */,
+ BFE2F68311DA955A0007EDC0 /* HTMLPrint.d */,
+ BFE2F68411DA955A0007EDC0 /* HTMLPrint.o */,
+ BFE2F68511DA955A0007EDC0 /* HTMLRewrite.d */,
+ BFE2F68611DA955A0007EDC0 /* HTMLRewrite.o */,
+ BFE2F68711DA955A0007EDC0 /* RewriteMacros.d */,
+ BFE2F68811DA955A0007EDC0 /* RewriteMacros.o */,
+ BFE2F68911DA955A0007EDC0 /* RewriteObjC.d */,
+ BFE2F68A11DA955A0007EDC0 /* RewriteObjC.o */,
+ BFE2F68B11DA955A0007EDC0 /* Rewriter.d */,
+ BFE2F68C11DA955A0007EDC0 /* Rewriter.o */,
+ BFE2F68D11DA955A0007EDC0 /* RewriteRope.d */,
+ BFE2F68E11DA955A0007EDC0 /* RewriteRope.o */,
+ BFE2F68F11DA955A0007EDC0 /* RewriteTest.d */,
+ BFE2F69011DA955A0007EDC0 /* RewriteTest.o */,
+ BFE2F69111DA955A0007EDC0 /* TokenRewriter.d */,
+ BFE2F69211DA955A0007EDC0 /* TokenRewriter.o */,
+ );
+ path = Debug;
+ sourceTree = "<group>";
+ };
+ BFE2F69911DA955A0007EDC0 /* Release-Asserts */ = {
+ isa = PBXGroup;
+ children = (
+ BFE2F69A11DA955A0007EDC0 /* .dir */,
+ BFE2F69B11DA955A0007EDC0 /* DeltaTree.d */,
+ BFE2F69C11DA955A0007EDC0 /* DeltaTree.o */,
+ BFE2F69D11DA955A0007EDC0 /* HTMLRewrite.d */,
+ BFE2F69E11DA955A0007EDC0 /* HTMLRewrite.o */,
+ BFE2F69F11DA955A0007EDC0 /* Rewriter.d */,
+ BFE2F6A011DA955A0007EDC0 /* Rewriter.o */,
+ BFE2F6A111DA955A0007EDC0 /* RewriteRope.d */,
+ BFE2F6A211DA955A0007EDC0 /* RewriteRope.o */,
+ BFE2F6A311DA955A0007EDC0 /* TokenRewriter.d */,
+ BFE2F6A411DA955A0007EDC0 /* TokenRewriter.o */,
+ );
+ path = "Release-Asserts";
+ sourceTree = "<group>";
+ };
C6859E8C029090F304C91782 /* Documentation */ = {
isa = PBXGroup;
children = (
@@ -1722,14 +1895,17 @@
DEF165160F8D46980098507F /* Action.h */,
DEF1651D0F8D46980098507F /* ArgList.h */,
DEF1651E0F8D46980098507F /* Arg.h */,
+ 1AA1D35611BECFF70089CC3F /* CC1AsOptions.td */,
+ 1AA1D35711BECFF70089CC3F /* CC1Options.td */,
DEF165170F8D46980098507F /* Compilation.h */,
DEF165240F8D46980098507F /* DriverDiagnostic.h */,
DEF165200F8D46980098507F /* Driver.h */,
DEF1651F0F8D46980098507F /* HostInfo.h */,
DEF165210F8D46980098507F /* Job.h */,
- DEF165180F8D46980098507F /* Options.def */,
DEF165190F8D46980098507F /* Option.h */,
+ 1AA1D35811BECFF70089CC3F /* Options.td */,
DEF1651C0F8D46980098507F /* Options.h */,
+ 1AA1D35911BECFF70089CC3F /* OptParser.td */,
DEF165230F8D46980098507F /* Phases.h */,
DEF165140F8D46980098507F /* Tool.h */,
DEF165150F8D46980098507F /* Types.h */,
@@ -1966,9 +2142,6 @@
1A2A54BD0FD1DD1C00F4CE45 /* HTMLPrint.cpp in Sources */,
1A2A54BE0FD1DD1C00F4CE45 /* PrintParserCallbacks.cpp in Sources */,
1A2A54BF0FD1DD1C00F4CE45 /* PrintPreprocessedOutput.cpp in Sources */,
- 1A2A54C10FD1DD1C00F4CE45 /* RewriteMacros.cpp in Sources */,
- 1A2A54C20FD1DD1C00F4CE45 /* RewriteObjC.cpp in Sources */,
- 1A2A54C30FD1DD1C00F4CE45 /* RewriteTest.cpp in Sources */,
1A2A54C40FD1DD1C00F4CE45 /* StmtXML.cpp in Sources */,
1A2A54C50FD1DD1C00F4CE45 /* Warnings.cpp in Sources */,
1A6FE7090FD6F85800E00CA9 /* CGTemporaries.cpp in Sources */,
@@ -2058,6 +2231,34 @@
1ABD23F71182449800A48E65 /* Type.cpp in Sources */,
1ABD23F81182449800A48E65 /* TypeLoc.cpp in Sources */,
1ABD23F91182449800A48E65 /* TypePrinter.cpp in Sources */,
+ BFE2F6AB11DA955A0007EDC0 /* DeltaTree.d in Sources */,
+ BFE2F6AD11DA955A0007EDC0 /* FixItRewriter.d in Sources */,
+ BFE2F6AF11DA955A0007EDC0 /* FrontendActions.d in Sources */,
+ BFE2F6B111DA955A0007EDC0 /* HTMLPrint.d in Sources */,
+ BFE2F6B311DA955A0007EDC0 /* HTMLRewrite.d in Sources */,
+ BFE2F6B511DA955A0007EDC0 /* RewriteMacros.d in Sources */,
+ BFE2F6B711DA955A0007EDC0 /* RewriteObjC.d in Sources */,
+ BFE2F6B911DA955A0007EDC0 /* Rewriter.d in Sources */,
+ BFE2F6BB11DA955A0007EDC0 /* RewriteRope.d in Sources */,
+ BFE2F6BD11DA955A0007EDC0 /* RewriteTest.d in Sources */,
+ BFE2F6BF11DA955A0007EDC0 /* TokenRewriter.d in Sources */,
+ BFE2F6C111DA955A0007EDC0 /* DeltaTree.cpp in Sources */,
+ BFE2F6C211DA955A0007EDC0 /* FixItRewriter.cpp in Sources */,
+ BFE2F6C311DA955A0007EDC0 /* FrontendActions.cpp in Sources */,
+ BFE2F6C411DA955A0007EDC0 /* HTMLPrint.cpp in Sources */,
+ BFE2F6C511DA955A0007EDC0 /* HTMLRewrite.cpp in Sources */,
+ BFE2F6C611DA955A0007EDC0 /* Makefile in Sources */,
+ BFE2F6C711DA955A0007EDC0 /* DeltaTree.d in Sources */,
+ BFE2F6C911DA955A0007EDC0 /* HTMLRewrite.d in Sources */,
+ BFE2F6CB11DA955A0007EDC0 /* Rewriter.d in Sources */,
+ BFE2F6CD11DA955A0007EDC0 /* RewriteRope.d in Sources */,
+ BFE2F6CF11DA955A0007EDC0 /* TokenRewriter.d in Sources */,
+ BFE2F6D111DA955A0007EDC0 /* RewriteMacros.cpp in Sources */,
+ BFE2F6D211DA955A0007EDC0 /* RewriteObjC.cpp in Sources */,
+ BFE2F6D311DA955A0007EDC0 /* Rewriter.cpp in Sources */,
+ BFE2F6D411DA955A0007EDC0 /* RewriteRope.cpp in Sources */,
+ BFE2F6D511DA955A0007EDC0 /* RewriteTest.cpp in Sources */,
+ BFE2F6D611DA955A0007EDC0 /* TokenRewriter.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/docs/InternalsManual.html b/docs/InternalsManual.html
index 5ef5dd842a6d..7aa26e00a4f1 100644
--- a/docs/InternalsManual.html
+++ b/docs/InternalsManual.html
@@ -118,8 +118,8 @@ classes somewhere else, or introduce some other solution.</p>
<p>The Clang Diagnostics subsystem is an important part of how the compiler
communicates with the human. Diagnostics are the warnings and errors produced
when the code is incorrect or dubious. In Clang, each diagnostic produced has
-(at the minimum) a unique ID, a <a href="#SourceLocation">SourceLocation</a> to
-"put the caret", an English translation associated with it, and a severity (e.g.
+(at the minimum) a unique ID, an English translation associated with it, a <a
+href="#SourceLocation">SourceLocation</a> to "put the caret", and a severity (e.g.
<tt>WARNING</tt> or <tt>ERROR</tt>). They can also optionally include a number
of arguments to the dianostic (which fill in "%0"'s in the string) as well as a
number of source ranges that related to the diagnostic.</p>
@@ -127,7 +127,7 @@ number of source ranges that related to the diagnostic.</p>
<p>In this section, we'll be giving examples produced by the Clang command line
driver, but diagnostics can be <a href="#DiagnosticClient">rendered in many
different ways</a> depending on how the DiagnosticClient interface is
-implemented. A representative example of a diagonstic is:</p>
+implemented. A representative example of a diagnostic is:</p>
<pre>
t.c:38:15: error: invalid operands to binary expression ('int *' and '_Complex float')
@@ -709,7 +709,7 @@ be the location of the "c" identifier.</li>
<li><b>void* "AnnotationValue"</b> - This contains an opaque object that the
parser gets from Sema through an Actions module, it is passed around and Sema
-intepretes it, based on the type of annotation token.</li>
+interprets it, based on the type of annotation token.</li>
<li><b>TokenKind "Kind"</b> - This indicates the kind of Annotation token this
is. See below for the different valid kinds.</li>
diff --git a/docs/Makefile b/docs/Makefile
index e9bbb28f68c4..053b263d27dc 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -7,7 +7,7 @@
#
##===----------------------------------------------------------------------===##
-LEVEL := ../../..
+CLANG_LEVEL := ..
DIRS := tools
ifdef BUILD_FOR_WEBSITE
@@ -22,7 +22,7 @@ $(PROJ_OBJ_DIR)/doxygen.cfg: doxygen.cfg.in
-e 's/@abs_top_builddir@/../g' > $@
endif
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
HTML := $(wildcard $(PROJ_SRC_DIR)/*.html) \
$(wildcard $(PROJ_SRC_DIR)/*.css)
diff --git a/docs/PCHInternals.html b/docs/PCHInternals.html
index e21ec5e90df3..109d5ed02558 100644
--- a/docs/PCHInternals.html
+++ b/docs/PCHInternals.html
@@ -144,6 +144,15 @@ deserialized from the precompiled header. These statistics can be
useful to determine whether the precompiled header implementation can
be improved by making more of the implementation lazy.</p>
+<p>Precompiled headers can be chained. When you create a PCH while
+including an existing PCH, Clang can create the new PCH by referencing
+the original file and only writing the new data to the new file. For
+example, you could create a PCH out of all the headers that are very
+commonly used throughout your project, and then create a PCH for every
+single source file in the project that includes the code that is
+specific to that file, so that recompiling the file itself is very fast,
+without duplicating the data from the common headers for every file.</p>
+
<h2 id="contents">Precompiled Header Contents</h2>
<img src="PCHLayout.png" align="right" alt="Precompiled header layout">
@@ -209,6 +218,27 @@ contents are verified along with the rest of the metadata.</dd>
</dl>
+<p>A chained PCH file (that is, one that references another PCH) has
+a slightly different metadata block, which contains the following
+information:</p>
+
+<dl>
+ <dt>Referenced file</dt>
+ <dd>The name of the referenced PCH file. It is looked up like a file
+specified using -include-pch.</dd>
+
+ <dt>PCH version</dt>
+ <dd>This is the same as in normal PCH files.</dd>
+
+ <dt>Original file name</dt>
+ <dd>The full path of the header that was used to generate this
+precompiled header.</dd>
+
+</dl>
+
+<p>The language options, target architecture and predefines buffer data
+is taken from the end of the chain, since they have to match anyway.</p>
+
<h3 id="sourcemgr">Source Manager Block</h3>
<p>The source manager block contains the serialized representation of
diff --git a/docs/UsersManual.html b/docs/UsersManual.html
index 5c5f6f916cf6..51e699fc32cb 100644
--- a/docs/UsersManual.html
+++ b/docs/UsersManual.html
@@ -36,7 +36,7 @@ td {
<ul>
<li><a href="#diagnostics_display">Controlling How Clang Displays Diagnostics</a></li>
<li><a href="#diagnostics_mappings">Diagnostic Mappings</a></li>
- <li><a href="#diagnostics_categories">Diagnostic Categories</a><li>
+ <li><a href="#diagnostics_categories">Diagnostic Categories</a></li>
<li><a href="#diagnostics_commandline">Controlling Diagnostics via Command Line Flags</a></li>
<li><a href="#diagnostics_pragmas">Controlling Diagnostics via Pragmas</a></li>
</ul>
@@ -53,16 +53,6 @@ td {
<li><a href="#c_ms">Microsoft extensions</a></li>
</ul>
</li>
-<li><a href="#objc">Objective-C Language Features</a>
- <ul>
- <li><a href="#objc_incompatibilities">Intentional Incompatibilities with
- GCC</a></li>
- </ul>
-</li>
-<li><a href="#cxx">C++ Language Features</a>
-</li>
-<li><a href="#objcxx">Objective C++ Language Features</a>
-</li>
<li><a href="#target_features">Target-Specific Features and Limitations</a>
<ul>
<li><a href="#target_arch">CPU Architectures Features and Limitations</a>
@@ -261,12 +251,29 @@ when this is enabled, Clang will print something like:</p>
<p>When this is disabled, Clang will just print:</p>
<pre>
- test.c:28:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
+ <b><font color="black">test.c:28:8: <font color="magenta">warning</font>: extra tokens at end of #endif directive [-Wextra-tokens]</font></b>
+ #endif bad
+ <font color="green">^</font>
+ <font color="green">//</font>
</pre>
</dd>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+<dt id="opt_fcolor_diagnostics"><b>-f[no-]color-diagnostics</b>: </dt>
+<dd>This option, which defaults to on when a color-capable terminal is
+ detected, controls whether or not Clang prints diagnostics in color.
+ When this option is enabled, Clang will use colors to highlight
+ specific parts of the diagnostic, e.g.,
+
+<pre>
+<test.c:2:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
+#endif bad
+ ^
+ //
+</pre>
+</dd>'
+<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<dt id="opt_fdiagnostics-show-option"><b>-f[no-]diagnostics-show-option</b>:
Enable <tt>[-Woption]</tt> information in diagnostic line.</dt>
<dd>This option, which defaults to on,
@@ -386,6 +393,66 @@ by commenting them out.</p>
and <a href="">-Wbaz</a>.</p>
</dd>
+<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+<dt id="opt_Wambiguous-member-template"><b>-Wambiguous-member-template</b>:
+Warn about unqualified uses of a member template whose name resolves
+to another template at the location of the use.</dt>
+<dd>This option, which defaults to on, enables a warning in the
+following code:</p>
+
+<pre>
+template&lt;typename T> struct set{};
+template&lt;typename T> struct trait { typedef const T& type; };
+struct Value {
+ template&lt;typename T> void set(typename trait&lt;T>::type value) {}
+};
+void foo() {
+ Value v;
+ v.set&lt;double>(3.2);
+}
+</pre>
+
+<p>C++ [basic.lookup.classref] requires this to be an error, but,
+because it's hard to work around, Clang downgrades it to a warning as
+an extension.</p>
+</dd>
+
+<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+<dt id="opt_Wbind-to-temporary-copy"><b>-Wbind-to-temporary-copy</b>: Warn about
+an unusable copy constructor when binding a reference to a temporary.</dt>
+<dd>This option, which defaults to on, enables warnings about binding a
+reference to a temporary when the temporary doesn't have a usable copy
+constructor. For example:</p>
+
+<pre>
+ struct NonCopyable {
+ NonCopyable();
+ private:
+ NonCopyable(const NonCopyable&);
+ };
+ void foo(const NonCopyable&);
+ void bar() {
+ foo(NonCopyable()); // Disallowed in C++98; allowed in C++0x.
+ }
+</pre>
+<pre>
+ struct NonCopyable2 {
+ NonCopyable2();
+ NonCopyable2(NonCopyable2&);
+ };
+ void foo(const NonCopyable2&);
+ void bar() {
+ foo(NonCopyable2()); // Disallowed in C++98; allowed in C++0x.
+ }
+</pre>
+
+<p>Note that if <tt>NonCopyable2::NonCopyable2()</tt> has a default
+argument whose instantiation produces a compile error, that error will
+still be a hard error in C++98 mode even if this warning is turned
+off.</p>
+
+</dd>
+
</dl>
<!-- ======================================================================= -->
@@ -717,11 +784,6 @@ extensions are not implemented yet:</p>
a relatively small feature, so it is likely to be implemented relatively
soon.</li>
-<li>clang does not support attributes on function pointers
-(<a href="http://llvm.org/bugs/show_bug.cgi?id=2461">bug 2461</a>). This is
-a relatively important feature, so it is likely to be implemented relatively
-soon.</li>
-
<li>clang does not support #pragma weak
(<a href="http://llvm.org/bugs/show_bug.cgi?id=3679">bug 3679</a>). Due to
the uses described in the bug, this is likely to be implemented at some
@@ -825,45 +887,6 @@ however where MSVC and GCC are incompatible clang follows the MSVC
definition.</li>
<!-- ======================================================================= -->
-<h2 id="objc">Objective-C Language Features</h2>
-<!-- ======================================================================= -->
-
-
-<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
-<h3 id="objc_incompatibilities">Intentional Incompatibilities with GCC</h3>
-<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
-
-<p>No cast of super, no lvalue casts.</p>
-
-
-
-<!-- ======================================================================= -->
-<h2 id="cxx">C++ Language Features</h2>
-<!-- ======================================================================= -->
-
-<p>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 <a
-href="http://clang.llvm.org/cxx_status.html">C++ Status</a> page for details or
-ask on the mailing list about how you can help.</p>
-
-<p>Note that released Clang compilers will refuse to even try to use clang to compile C++ code unless you pass the <tt>-ccc-clang-cxx</tt> 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 <tt>-ccc-clang-cxx</tt> flag.</p>
-
-<p>Clang strives to strictly conform to the C++ standard. That means
-it will reject invalid C++ code that another compiler may accept. If
-Clang reports errors in your code, please check
-the <a href="http://clang.llvm.org/cxx_compatibility.html">C++
-Compatibility</a> page to see whether they are C++-conformance bugs
-and how you can fix them.</p>
-
-<!-- ======================================================================= -->
-<h2 id="objcxx">Objective C++ Language Features</h2>
-<!-- ======================================================================= -->
-
-<p>At this point, Clang C++ support is not generally useful (and therefore,
-neither is Objective-C++). Please see the <a href="#cxx">C++ section</a> for
-more information.</p>
-
-<!-- ======================================================================= -->
<h2 id="target_features">Target-Specific Features and Limitations</h2>
<!-- ======================================================================= -->
diff --git a/docs/tools/Makefile b/docs/tools/Makefile
index 91bc447c083f..5521d6b764c9 100644
--- a/docs/tools/Makefile
+++ b/docs/tools/Makefile
@@ -37,10 +37,11 @@ clean:
else
# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
-LEVEL := ../../../..
-include $(LEVEL)/Makefile.common
+CLANG_LEVEL := ../..
+include $(CLANG_LEVEL)/Makefile
-CLANG_VERSION := $(shell cat $(PROJ_SRC_DIR)/../../VER)
+CLANG_VERSION := $(word 3,$(shell grep "CLANG_VERSION " \
+ $(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include/clang/Basic/Version.inc))
SRC_DOC_DIR=$(PROJ_SRC_DIR)/
DST_HTML_DIR=$(PROJ_OBJ_DIR)/
diff --git a/examples/Makefile b/examples/Makefile
index 869197db35d2..c4af25263398 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -7,8 +7,8 @@
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../..
+CLANG_LEVEL := ..
PARALLEL_DIRS := clang-interpreter PrintFunctionNames wpa
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
diff --git a/examples/PrintFunctionNames/CMakeLists.txt b/examples/PrintFunctionNames/CMakeLists.txt
index 49dd22ad8d0d..5ea75db42e02 100644
--- a/examples/PrintFunctionNames/CMakeLists.txt
+++ b/examples/PrintFunctionNames/CMakeLists.txt
@@ -1,26 +1,10 @@
-set(SHARED_LIBRARY TRUE)
+set(MODULE TRUE)
set(LLVM_NO_RTTI 1)
-set(LLVM_USED_LIBS
- clangIndex
- clangFrontend
- clangDriver
- clangSema
- clangAnalysis
- clangAST
- clangParse
- clangLex
- clangBasic)
-
-set( LLVM_LINK_COMPONENTS
- bitreader
- mc
- core
- )
-
add_clang_library(PrintFunctionNames PrintFunctionNames.cpp)
set_target_properties(PrintFunctionNames
PROPERTIES
- LINKER_LANGUAGE CXX)
+ LINKER_LANGUAGE CXX
+ PREFIX "")
diff --git a/examples/PrintFunctionNames/Makefile b/examples/PrintFunctionNames/Makefile
index 57d3ba9b0cd9..0ff5189437c7 100644
--- a/examples/PrintFunctionNames/Makefile
+++ b/examples/PrintFunctionNames/Makefile
@@ -7,21 +7,13 @@
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
LIBRARYNAME = PrintFunctionNames
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
-
-# 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
-# LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
-
LINK_LIBS_IN_SHARED = 1
SHARED_LIBRARY = 1
-LINK_COMPONENTS := bitreader mc core
USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \
clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
diff --git a/examples/PrintFunctionNames/PrintFunctionNames.cpp b/examples/PrintFunctionNames/PrintFunctionNames.cpp
index 5b7b66a4f7ff..397cf843fa7f 100644
--- a/examples/PrintFunctionNames/PrintFunctionNames.cpp
+++ b/examples/PrintFunctionNames/PrintFunctionNames.cpp
@@ -31,11 +31,24 @@ public:
}
};
-class PrintFunctionNamesAction : public ASTFrontendAction {
+class PrintFunctionNamesAction : public PluginASTAction {
protected:
ASTConsumer *CreateASTConsumer(CompilerInstance &CI, llvm::StringRef) {
return new PrintFunctionsConsumer();
}
+
+ bool ParseArgs(const std::vector<std::string>& args) {
+ for (unsigned i=0; i<args.size(); ++i)
+ llvm::errs() << "PrintFunctionNames arg = " << args[i] << "\n";
+ if (args.size() && args[0] == "help")
+ PrintHelp(llvm::errs());
+
+ return true;
+ }
+ void PrintHelp(llvm::raw_ostream& ros) {
+ ros << "Help for PrintFunctionNames plugin goes here\n";
+ }
+
};
}
diff --git a/examples/clang-interpreter/CMakeLists.txt b/examples/clang-interpreter/CMakeLists.txt
index 0f63b5f5b91b..1aa9b2b59224 100644
--- a/examples/clang-interpreter/CMakeLists.txt
+++ b/examples/clang-interpreter/CMakeLists.txt
@@ -18,8 +18,10 @@ set(LLVM_LINK_COMPONENTS
jit
interpreter
nativecodegen
+ asmparser
bitreader
bitwriter
+ codegen
ipo
selectiondag
)
diff --git a/examples/clang-interpreter/Makefile b/examples/clang-interpreter/Makefile
index fecc3f576c58..6fa58d22cbd9 100644
--- a/examples/clang-interpreter/Makefile
+++ b/examples/clang-interpreter/Makefile
@@ -7,24 +7,18 @@
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
TOOLNAME = clang-interpreter
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
NO_INSTALL = 1
# No plugins, optimize startup time.
TOOL_NO_EXPORTS = 1
-# 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
-# LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
-
LINK_COMPONENTS := jit interpreter nativecodegen bitreader bitwriter ipo \
- selectiondag
+ selectiondag asmparser
USEDLIBS = clangFrontend.a clangDriver.a clangCodeGen.a clangSema.a \
clangChecker.a clangAnalysis.a clangRewrite.a clangAST.a \
clangParse.a clangLex.a clangBasic.a
-include $(LLVM_SRC_ROOT)/Makefile.rules
+include $(CLANG_LEVEL)/Makefile
diff --git a/examples/clang-interpreter/main.cpp b/examples/clang-interpreter/main.cpp
index 86239548d340..ec4e8619829f 100644
--- a/examples/clang-interpreter/main.cpp
+++ b/examples/clang-interpreter/main.cpp
@@ -7,10 +7,10 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/CodeGen/CodeGenAction.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/Tool.h"
-#include "clang/Frontend/CodeGenAction.h"
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/DiagnosticOptions.h"
diff --git a/examples/wpa/CMakeLists.txt b/examples/wpa/CMakeLists.txt
index 8d443d6e3149..c2b2ce63a934 100644
--- a/examples/wpa/CMakeLists.txt
+++ b/examples/wpa/CMakeLists.txt
@@ -6,6 +6,8 @@ set(LLVM_USED_LIBS
clangDriver
clangSema
clangAnalysis
+ clangChecker
+ clangRewrite
clangAST
clangParse
clangLex
diff --git a/examples/wpa/Makefile b/examples/wpa/Makefile
index 6b7f407b6d23..bd6ebfdc9bfe 100644
--- a/examples/wpa/Makefile
+++ b/examples/wpa/Makefile
@@ -7,22 +7,17 @@
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
TOOLNAME = clang-wpa
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
NO_INSTALL = 1
# No plugins, optimize startup time.
TOOL_NO_EXPORTS = 1
-# 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
-# LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
+LINK_COMPONENTS := asmparser bitreader mc core
+USEDLIBS = clangChecker.a clangIndex.a clangFrontend.a clangDriver.a \
+ clangSema.a clangAnalysis.a clangAST.a clangParse.a clangLex.a \
+ clangBasic.a
-LINK_COMPONENTS := bitreader mc core
-USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \
- clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
-
-include $(LLVM_SRC_ROOT)/Makefile.rules
+include $(CLANG_LEVEL)/Makefile
diff --git a/examples/wpa/clang-wpa.cpp b/examples/wpa/clang-wpa.cpp
index b515e3314830..74ec368cfbe7 100644
--- a/examples/wpa/clang-wpa.cpp
+++ b/examples/wpa/clang-wpa.cpp
@@ -14,9 +14,18 @@
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
+#include "clang/Checker/PathSensitive/AnalysisManager.h"
+#include "clang/Checker/PathSensitive/GRExprEngine.h"
+#include "clang/Checker/PathSensitive/GRTransferFuncs.h"
+#include "clang/Checker/Checkers/LocalCheckers.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Index/CallGraph.h"
+#include "clang/Index/Indexer.h"
+#include "clang/Index/TranslationUnit.h"
+#include "clang/Index/DeclReferenceMap.h"
+#include "clang/Index/SelectorMap.h"
+#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
@@ -26,11 +35,50 @@ using namespace idx;
static llvm::cl::list<std::string>
InputFilenames(llvm::cl::Positional, llvm::cl::desc("<input AST files>"));
+static llvm::cl::opt<bool>
+ViewCallGraph("view-call-graph", llvm::cl::desc("Display the call graph."));
+
+static llvm::cl::opt<std::string>
+AnalyzeFunction("analyze-function",
+ llvm::cl::desc("Specify the entry function."));
+
+namespace {
+// A thin wrapper over ASTUnit implementing the TranslationUnit interface.
+class ASTUnitTU : public TranslationUnit {
+ ASTUnit *AST;
+ DeclReferenceMap DeclRefMap;
+ SelectorMap SelMap;
+
+public:
+ ASTUnitTU(ASTUnit *ast)
+ : AST(ast), DeclRefMap(AST->getASTContext()), SelMap(AST->getASTContext()) {
+ }
+
+ virtual ASTContext &getASTContext() {
+ return AST->getASTContext();
+ }
+
+ virtual Preprocessor &getPreprocessor() {
+ return AST->getPreprocessor();
+ }
+
+ virtual DeclReferenceMap &getDeclReferenceMap() {
+ return DeclRefMap;
+ }
+
+ virtual SelectorMap &getSelectorMap() {
+ return SelMap;
+ }
+};
+}
+
int main(int argc, char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv, "clang-wpa");
- FileManager FileMgr;
std::vector<ASTUnit*> ASTUnits;
+ Program Prog;
+ Indexer Idxer(Prog);
+
if (InputFilenames.empty())
return 0;
@@ -46,11 +94,52 @@ int main(int argc, char **argv) {
ASTUnits.push_back(AST.take());
}
- llvm::OwningPtr<CallGraph> CG;
- CG.reset(new CallGraph());
+ if (ViewCallGraph) {
+ llvm::OwningPtr<CallGraph> CG;
+ CG.reset(new CallGraph(Prog));
+
+ for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i)
+ CG->addTU(ASTUnits[i]->getASTContext());
+
+ CG->ViewCallGraph();
+ return 0;
+ }
+
+ if (AnalyzeFunction.empty())
+ return 0;
+
+ // Feed all ASTUnits to the Indexer.
+ for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i) {
+ ASTUnitTU *TU = new ASTUnitTU(ASTUnits[i]);
+ Idxer.IndexAST(TU);
+ }
+
+ Entity Ent = Entity::get(AnalyzeFunction, Prog);
+ FunctionDecl *FD;
+ TranslationUnit *TU;
+ llvm::tie(FD, TU) = Idxer.getDefinitionFor(Ent);
+
+ if (!FD)
+ return 0;
+
+ // Create an analysis engine.
+ Preprocessor &PP = TU->getPreprocessor();
+
+ // Hard code options for now.
+ AnalysisManager AMgr(TU->getASTContext(), PP.getDiagnostics(),
+ PP.getLangOptions(), /* PathDiagnostic */ 0,
+ CreateRegionStoreManager,
+ CreateRangeConstraintManager,
+ /* MaxNodes */ 300000, /* MaxLoop */ 3,
+ /* VisualizeEG */ false, /* VisualizeEGUbi */ false,
+ /* PurgeDead */ true, /* EagerlyAssume */ false,
+ /* TrimGraph */ false, /* InlineCall */ true);
- for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i)
- CG->addTU(ASTUnits[i]->getASTContext());
+ GRTransferFuncs* TF = MakeCFRefCountTF(AMgr.getASTContext(), /*GC*/false,
+ AMgr.getLangOptions());
+ GRExprEngine Eng(AMgr, TF);
- CG->ViewCallGraph();
+ Eng.ExecuteWorkList(AMgr.getStackFrame(FD), AMgr.getMaxNodes());
+
+ return 0;
}
diff --git a/include/Makefile b/include/Makefile
index f686d6a64606..79b9adfb7282 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -1,4 +1,4 @@
-LEVEL = ../../..
+CLANG_LEVEL := ..
DIRS := clang clang-c
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 86926bd683ba..b377b6d5fe2c 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -343,12 +343,6 @@ CINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range);
CINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range);
/**
- * \brief Determine if the source location occurs within the main file
- * of the translation unit (as opposed to an included header).
- */
-CINDEX_LINKAGE unsigned clang_isFromMainFile(CXSourceLocation loc);
-
-/**
* @}
*/
@@ -1092,7 +1086,9 @@ enum CXTypeKind {
CXType_Enum = 106,
CXType_Typedef = 107,
CXType_ObjCInterface = 108,
- CXType_ObjCObjectPointer = 109
+ CXType_ObjCObjectPointer = 109,
+ CXType_FunctionNoProto = 110,
+ CXType_FunctionProto = 111
};
/**
@@ -1145,6 +1141,17 @@ CINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T);
CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K);
/**
+ * \brief Retrieve the result type associated with a function type.
+ */
+CINDEX_LINKAGE CXType clang_getResultType(CXType T);
+
+/**
+ * \brief Retrieve the result type associated with a given cursor. This only
+ * returns a valid type of the cursor refers to a function or method.
+ */
+CINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C);
+
+/**
* @}
*/
diff --git a/include/clang-c/Makefile b/include/clang-c/Makefile
index 5e3522f79137..98ea7190e687 100644
--- a/include/clang-c/Makefile
+++ b/include/clang-c/Makefile
@@ -1,7 +1,7 @@
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
DIRS :=
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
install-local::
$(Echo) Installing Clang C API include files
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index 87a12cde2ad2..3799451360f4 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -62,6 +62,7 @@ namespace clang {
class RecordDecl;
class StoredDeclsMap;
class TagDecl;
+ class TemplateTemplateParmDecl;
class TemplateTypeParmDecl;
class TranslationUnitDecl;
class TypeDecl;
@@ -75,6 +76,8 @@ namespace clang {
/// ASTContext - This class holds long-lived AST nodes (such as types and
/// decls) that can be referred to throughout the semantic analysis of a file.
class ASTContext {
+ ASTContext &this_() { return *this; }
+
std::vector<Type*> Types;
llvm::FoldingSet<ExtQuals> ExtQualNodes;
llvm::FoldingSet<ComplexType> ComplexTypes;
@@ -95,9 +98,12 @@ class ASTContext {
llvm::FoldingSet<DependentDecltypeType> DependentDecltypeTypes;
llvm::FoldingSet<TemplateTypeParmType> TemplateTypeParmTypes;
llvm::FoldingSet<SubstTemplateTypeParmType> SubstTemplateTypeParmTypes;
- llvm::FoldingSet<TemplateSpecializationType> TemplateSpecializationTypes;
+ llvm::ContextualFoldingSet<TemplateSpecializationType, ASTContext&>
+ TemplateSpecializationTypes;
llvm::FoldingSet<ElaboratedType> ElaboratedTypes;
llvm::FoldingSet<DependentNameType> DependentNameTypes;
+ llvm::ContextualFoldingSet<DependentTemplateSpecializationType, ASTContext&>
+ DependentTemplateSpecializationTypes;
llvm::FoldingSet<ObjCObjectTypeImpl> ObjCObjectTypes;
llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
@@ -122,6 +128,30 @@ class ASTContext {
/// \brief Mapping from ObjCContainers to their ObjCImplementations.
llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*> ObjCImpls;
+ /// \brief Representation of a "canonical" template template parameter that
+ /// is used in canonical template names.
+ class CanonicalTemplateTemplateParm : public llvm::FoldingSetNode {
+ TemplateTemplateParmDecl *Parm;
+
+ public:
+ CanonicalTemplateTemplateParm(TemplateTemplateParmDecl *Parm)
+ : Parm(Parm) { }
+
+ TemplateTemplateParmDecl *getParam() const { return Parm; }
+
+ void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, Parm); }
+
+ static void Profile(llvm::FoldingSetNodeID &ID,
+ TemplateTemplateParmDecl *Parm);
+ };
+ llvm::FoldingSet<CanonicalTemplateTemplateParm> CanonTemplateTemplateParms;
+
+ TemplateTemplateParmDecl *getCanonicalTemplateTemplateParmDecl(
+ TemplateTemplateParmDecl *TTP);
+
+ /// \brief Whether __[u]int128_t identifier is installed.
+ bool IsInt128Installed;
+
/// BuiltinVaListType - built-in va list type.
/// This is initially null and set by Sema::LazilyCreateBuiltin when
/// a builtin that takes a valist is encountered.
@@ -162,6 +192,8 @@ class ASTContext {
/// \brief Type for the Block descriptor for Blocks CodeGen.
RecordDecl *BlockDescriptorExtendedType;
+ TypeSourceInfo NullTypeSourceInfo;
+
/// \brief Keeps track of all declaration attributes.
///
/// Since so few decls have attrs, we keep them in a hash map instead of
@@ -302,7 +334,8 @@ public:
/// \brief Note that the static data member \p Inst is an instantiation of
/// the static data member template \p Tmpl of a class template.
void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl,
- TemplateSpecializationKind TSK);
+ TemplateSpecializationKind TSK,
+ SourceLocation PointOfInstantiation = SourceLocation());
/// \brief If the given using decl is an instantiation of a
/// (possibly unresolved) using decl from a template instantiation,
@@ -329,6 +362,8 @@ public:
overridden_cxx_method_iterator
overridden_methods_end(const CXXMethodDecl *Method) const;
+ unsigned overridden_methods_size(const CXXMethodDecl *Method) const;
+
/// \brief Note that the given C++ \p Method overrides the given \p
/// Overridden method.
void addOverriddenMethod(const CXXMethodDecl *Method,
@@ -534,7 +569,7 @@ public:
/// getVectorType - Return the unique reference to a vector type of
/// the specified element type and size. VectorType must be a built-in type.
QualType getVectorType(QualType VectorType, unsigned NumElts,
- bool AltiVec, bool IsPixel);
+ VectorType::AltiVecSpecific AltiVecSpec);
/// getExtVectorType - Return the unique reference to an extended vector type
/// of the specified element type and size. VectorType must be a built-in
@@ -585,7 +620,11 @@ public:
/// getTypedefType - Return the unique reference to the type for the
/// specified typename decl.
- QualType getTypedefType(const TypedefDecl *Decl);
+ QualType getTypedefType(const TypedefDecl *Decl, QualType Canon = QualType());
+
+ QualType getRecordType(const RecordDecl *Decl);
+
+ QualType getEnumType(const EnumDecl *Decl);
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST);
@@ -599,13 +638,15 @@ public:
QualType getTemplateSpecializationType(TemplateName T,
const TemplateArgument *Args,
unsigned NumArgs,
- QualType Canon = QualType(),
- bool IsCurrentInstantiation = false);
+ QualType Canon = QualType());
+
+ QualType getCanonicalTemplateSpecializationType(TemplateName T,
+ const TemplateArgument *Args,
+ unsigned NumArgs);
QualType getTemplateSpecializationType(TemplateName T,
const TemplateArgumentListInfo &Args,
- QualType Canon = QualType(),
- bool IsCurrentInstantiation = false);
+ QualType Canon = QualType());
TypeSourceInfo *
getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc,
@@ -619,10 +660,16 @@ public:
NestedNameSpecifier *NNS,
const IdentifierInfo *Name,
QualType Canon = QualType());
- QualType getDependentNameType(ElaboratedTypeKeyword Keyword,
- NestedNameSpecifier *NNS,
- const TemplateSpecializationType *TemplateId,
- QualType Canon = QualType());
+
+ QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword,
+ NestedNameSpecifier *NNS,
+ const IdentifierInfo *Name,
+ const TemplateArgumentListInfo &Args);
+ QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword,
+ NestedNameSpecifier *NNS,
+ const IdentifierInfo *Name,
+ unsigned NumArgs,
+ const TemplateArgument *Args);
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl);
@@ -780,6 +827,10 @@ public:
/// purpose in characters.
CharUnits getObjCEncodingTypeSize(QualType t);
+ /// \brief Whether __[u]int128_t identifier is installed.
+ bool isInt128Installed() const { return IsInt128Installed; }
+ void setInt128Installed() { IsInt128Installed = true; }
+
/// This setter/getter represents the ObjC 'id' type. It is setup lazily, by
/// Sema. id is always a (typedef for a) pointer type, a pointer to a struct.
QualType getObjCIdType() const { return ObjCIdTypedefType; }
@@ -943,8 +994,9 @@ public:
const ASTRecordLayout &
getASTObjCImplementationLayout(const ObjCImplementationDecl *D);
- /// getKeyFunction - Get the key function for the given record decl.
- /// The key function is, according to the Itanium C++ ABI section 5.2.3:
+ /// getKeyFunction - Get the key function for the given record decl, or NULL
+ /// if there isn't one. The key function is, according to the Itanium C++ ABI
+ /// section 5.2.3:
///
/// ...the first non-pure virtual function that is not inline at the point
/// of class definition.
@@ -1013,6 +1065,8 @@ public:
return UnqualT1 == UnqualT2;
}
+ bool UnwrapSimilarPointerTypes(QualType &T1, QualType &T2);
+
/// \brief Retrieves the "canonical" declaration of
/// \brief Retrieves the "canonical" nested name specifier for a
@@ -1272,6 +1326,8 @@ public:
TypeSourceInfo *
getTrivialTypeSourceInfo(QualType T, SourceLocation Loc = SourceLocation());
+ TypeSourceInfo *getNullTypeSourceInfo() { return &NullTypeSourceInfo; }
+
/// \brief Add a deallocation callback that will be invoked when the
/// ASTContext is destroyed.
///
@@ -1280,6 +1336,38 @@ public:
/// \brief Data Pointer data that will be provided to the callback function
/// when it is called.
void AddDeallocation(void (*Callback)(void*), void *Data);
+
+ //===--------------------------------------------------------------------===//
+ // Statistics
+ //===--------------------------------------------------------------------===//
+
+ /// \brief The number of implicitly-declared default constructors.
+ static unsigned NumImplicitDefaultConstructors;
+
+ /// \brief The number of implicitly-declared default constructors for
+ /// which declarations were built.
+ static unsigned NumImplicitDefaultConstructorsDeclared;
+
+ /// \brief The number of implicitly-declared copy constructors.
+ static unsigned NumImplicitCopyConstructors;
+
+ /// \brief The number of implicitly-declared copy constructors for
+ /// which declarations were built.
+ static unsigned NumImplicitCopyConstructorsDeclared;
+
+ /// \brief The number of implicitly-declared copy assignment operators.
+ static unsigned NumImplicitCopyAssignmentOperators;
+
+ /// \brief The number of implicitly-declared copy assignment operators for
+ /// which declarations were built.
+ static unsigned NumImplicitCopyAssignmentOperatorsDeclared;
+
+ /// \brief The number of implicitly-declared destructors.
+ static unsigned NumImplicitDestructors;
+
+ /// \brief The number of implicitly-declared destructors for which
+ /// declarations were built.
+ static unsigned NumImplicitDestructorsDeclared;
private:
ASTContext(const ASTContext&); // DO NOT IMPLEMENT
@@ -1308,6 +1396,11 @@ private:
// by DeclContext objects. This probably should not be in ASTContext,
// but we include it here so that ASTContext can quickly deallocate them.
llvm::PointerIntPair<StoredDeclsMap*,1> LastSDM;
+
+ /// \brief A counter used to uniquely identify "blocks".
+ unsigned int UniqueBlockByRefTypeID;
+ unsigned int UniqueBlockParmTypeID;
+
friend class DeclContext;
friend class DeclarationNameTable;
void ReleaseDeclContextMaps();
diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h
index 3240e50b0787..9faa62eef6f7 100644
--- a/include/clang/AST/Attr.h
+++ b/include/clang/AST/Attr.h
@@ -16,6 +16,7 @@
#include "llvm/Support/Casting.h"
#include "llvm/ADT/StringRef.h"
+#include "clang/Basic/AttrKinds.h"
#include <cassert>
#include <cstring>
#include <algorithm>
@@ -25,6 +26,7 @@ namespace clang {
class ASTContext;
class IdentifierInfo;
class ObjCInterfaceDecl;
+ class Expr;
}
// Defined in ASTContext.h
@@ -41,75 +43,9 @@ namespace clang {
/// Attr - This represents one attribute.
class Attr {
-public:
- enum Kind {
- Alias,
- Aligned,
- AlignMac68k,
- AlwaysInline,
- AnalyzerNoReturn, // Clang-specific.
- Annotate,
- AsmLabel, // Represent GCC asm label extension.
- BaseCheck,
- Blocks,
- CDecl,
- Cleanup,
- Const,
- Constructor,
- Deprecated,
- Destructor,
- FastCall,
- Final,
- Format,
- FormatArg,
- GNUInline,
- Hiding,
- IBOutletKind, // Clang-specific. Use "Kind" suffix to not conflict w/ macro.
- IBOutletCollectionKind, // Clang-specific.
- IBActionKind, // Clang-specific. Use "Kind" suffix to not conflict w/ macro.
- Malloc,
- MaxFieldAlignment,
- NoDebug,
- NoInline,
- NonNull,
- NoReturn,
- NoThrow,
- ObjCException,
- ObjCNSObject,
- Override,
- CFReturnsRetained, // Clang/Checker-specific.
- CFReturnsNotRetained, // Clang/Checker-specific.
- NSReturnsRetained, // Clang/Checker-specific.
- NSReturnsNotRetained, // Clang/Checker-specific.
- Overloadable, // Clang-specific
- Packed,
- Pure,
- Regparm,
- ReqdWorkGroupSize, // OpenCL-specific
- Section,
- Sentinel,
- StdCall,
- ThisCall,
- TransparentUnion,
- Unavailable,
- Unused,
- Used,
- Visibility,
- WarnUnusedResult,
- Weak,
- WeakImport,
- WeakRef,
-
- FIRST_TARGET_ATTRIBUTE,
- DLLExport,
- DLLImport,
- MSP430Interrupt,
- X86ForceAlignArgPointer
- };
-
private:
Attr *Next;
- Kind AttrKind;
+ attr::Kind AttrKind;
bool Inherited : 1;
protected:
@@ -122,7 +58,7 @@ protected:
}
protected:
- Attr(Kind AK) : Next(0), AttrKind(AK), Inherited(false) {}
+ Attr(attr::Kind AK) : Next(0), AttrKind(AK), Inherited(false) {}
virtual ~Attr() {
assert(Next == 0 && "Destroy didn't work");
}
@@ -133,7 +69,7 @@ public:
/// declarations.
virtual bool isMerged() const { return true; }
- Kind getKind() const { return AttrKind; }
+ attr::Kind getKind() const { return AttrKind; }
Attr *getNext() { return Next; }
const Attr *getNext() const { return Next; }
@@ -163,13 +99,15 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *) { return true; }
};
+
+#include "clang/AST/Attrs.inc"
class AttrWithString : public Attr {
private:
const char *Str;
unsigned StrLen;
protected:
- AttrWithString(Attr::Kind AK, ASTContext &C, llvm::StringRef s);
+ AttrWithString(attr::Kind AK, ASTContext &C, llvm::StringRef s);
llvm::StringRef getString() const { return llvm::StringRef(Str, StrLen); }
void ReplaceString(ASTContext &C, llvm::StringRef newS);
public:
@@ -179,9 +117,9 @@ public:
#define DEF_SIMPLE_ATTR(ATTR) \
class ATTR##Attr : public Attr { \
public: \
- ATTR##Attr() : Attr(ATTR) {} \
+ ATTR##Attr() : Attr(attr::ATTR) {} \
virtual Attr *clone(ASTContext &C) const; \
- static bool classof(const Attr *A) { return A->getKind() == ATTR; } \
+ static bool classof(const Attr *A) { return A->getKind() == attr::ATTR; } \
static bool classof(const ATTR##Attr *A) { return true; } \
}
@@ -194,7 +132,7 @@ class MaxFieldAlignmentAttr : public Attr {
public:
MaxFieldAlignmentAttr(unsigned alignment)
- : Attr(MaxFieldAlignment), Alignment(alignment) {}
+ : Attr(attr::MaxFieldAlignment), Alignment(alignment) {}
/// getAlignment - The specified alignment in bits.
unsigned getAlignment() const { return Alignment; }
@@ -203,36 +141,58 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *A) {
- return A->getKind() == MaxFieldAlignment;
+ return A->getKind() == attr::MaxFieldAlignment;
}
static bool classof(const MaxFieldAlignmentAttr *A) { return true; }
};
DEF_SIMPLE_ATTR(AlignMac68k);
+/// \brief Atribute for specifying the alignment of a variable or type.
+///
+/// This node will either contain the precise Alignment (in bits, not bytes!)
+/// or will contain the expression for the alignment attribute in the case of
+/// a dependent expression within a class or function template. At template
+/// instantiation time these are transformed into concrete attributes.
class AlignedAttr : public Attr {
unsigned Alignment;
+ Expr *AlignmentExpr;
public:
AlignedAttr(unsigned alignment)
- : Attr(Aligned), Alignment(alignment) {}
+ : Attr(attr::Aligned), Alignment(alignment), AlignmentExpr(0) {}
+ AlignedAttr(Expr *E)
+ : Attr(attr::Aligned), Alignment(0), AlignmentExpr(E) {}
+
+ /// getAlignmentExpr - Get a dependent alignment expression if one is present.
+ Expr *getAlignmentExpr() const {
+ return AlignmentExpr;
+ }
+
+ /// isDependent - Is the alignment a dependent expression
+ bool isDependent() const {
+ return getAlignmentExpr();
+ }
+
+ /// getAlignment - The specified alignment in bits. Requires !isDependent().
+ unsigned getAlignment() const {
+ assert(!isDependent() && "Cannot get a value dependent alignment");
+ return Alignment;
+ }
- /// getAlignment - The specified alignment in bits.
- unsigned getAlignment() const { return Alignment; }
-
/// getMaxAlignment - Get the maximum alignment of attributes on this list.
unsigned getMaxAlignment() const {
const AlignedAttr *Next = getNext<AlignedAttr>();
if (Next)
- return std::max(Next->getMaxAlignment(), Alignment);
+ return std::max(Next->getMaxAlignment(), getAlignment());
else
- return Alignment;
+ return getAlignment();
}
virtual Attr* clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *A) {
- return A->getKind() == Aligned;
+ return A->getKind() == attr::Aligned;
}
static bool classof(const AlignedAttr *A) { return true; }
};
@@ -240,7 +200,7 @@ public:
class AnnotateAttr : public AttrWithString {
public:
AnnotateAttr(ASTContext &C, llvm::StringRef ann)
- : AttrWithString(Annotate, C, ann) {}
+ : AttrWithString(attr::Annotate, C, ann) {}
llvm::StringRef getAnnotation() const { return getString(); }
@@ -248,7 +208,7 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *A) {
- return A->getKind() == Annotate;
+ return A->getKind() == attr::Annotate;
}
static bool classof(const AnnotateAttr *A) { return true; }
};
@@ -256,7 +216,7 @@ public:
class AsmLabelAttr : public AttrWithString {
public:
AsmLabelAttr(ASTContext &C, llvm::StringRef L)
- : AttrWithString(AsmLabel, C, L) {}
+ : AttrWithString(attr::AsmLabel, C, L) {}
llvm::StringRef getLabel() const { return getString(); }
@@ -264,7 +224,7 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *A) {
- return A->getKind() == AsmLabel;
+ return A->getKind() == attr::AsmLabel;
}
static bool classof(const AsmLabelAttr *A) { return true; }
};
@@ -274,54 +234,56 @@ DEF_SIMPLE_ATTR(AlwaysInline);
class AliasAttr : public AttrWithString {
public:
AliasAttr(ASTContext &C, llvm::StringRef aliasee)
- : AttrWithString(Alias, C, aliasee) {}
+ : AttrWithString(attr::Alias, C, aliasee) {}
llvm::StringRef getAliasee() const { return getString(); }
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
- static bool classof(const Attr *A) { return A->getKind() == Alias; }
+ static bool classof(const Attr *A) { return A->getKind() == attr::Alias; }
static bool classof(const AliasAttr *A) { return true; }
};
class ConstructorAttr : public Attr {
int priority;
public:
- ConstructorAttr(int p) : Attr(Constructor), priority(p) {}
+ ConstructorAttr(int p) : Attr(attr::Constructor), priority(p) {}
int getPriority() const { return priority; }
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
- static bool classof(const Attr *A) { return A->getKind() == Constructor; }
+ static bool classof(const Attr *A)
+ { return A->getKind() == attr::Constructor; }
static bool classof(const ConstructorAttr *A) { return true; }
};
class DestructorAttr : public Attr {
int priority;
public:
- DestructorAttr(int p) : Attr(Destructor), priority(p) {}
+ DestructorAttr(int p) : Attr(attr::Destructor), priority(p) {}
int getPriority() const { return priority; }
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
- static bool classof(const Attr *A) { return A->getKind() == Destructor; }
+ static bool classof(const Attr *A)
+ { return A->getKind() == attr::Destructor; }
static bool classof(const DestructorAttr *A) { return true; }
};
class IBOutletAttr : public Attr {
public:
- IBOutletAttr() : Attr(IBOutletKind) {}
+ IBOutletAttr() : Attr(attr::IBOutlet) {}
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *A) {
- return A->getKind() == IBOutletKind;
+ return A->getKind() == attr::IBOutlet;
}
static bool classof(const IBOutletAttr *A) { return true; }
};
@@ -330,7 +292,7 @@ class IBOutletCollectionAttr : public Attr {
const ObjCInterfaceDecl *D;
public:
IBOutletCollectionAttr(const ObjCInterfaceDecl *d = 0)
- : Attr(IBOutletCollectionKind), D(d) {}
+ : Attr(attr::IBOutletCollection), D(d) {}
const ObjCInterfaceDecl *getClass() const { return D; }
@@ -338,35 +300,35 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *A) {
- return A->getKind() == IBOutletCollectionKind;
+ return A->getKind() == attr::IBOutletCollection;
}
static bool classof(const IBOutletCollectionAttr *A) { return true; }
};
class IBActionAttr : public Attr {
public:
- IBActionAttr() : Attr(IBActionKind) {}
+ IBActionAttr() : Attr(attr::IBAction) {}
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *A) {
- return A->getKind() == IBActionKind;
+ return A->getKind() == attr::IBAction;
}
static bool classof(const IBActionAttr *A) { return true; }
};
DEF_SIMPLE_ATTR(AnalyzerNoReturn);
DEF_SIMPLE_ATTR(Deprecated);
-DEF_SIMPLE_ATTR(Final);
DEF_SIMPLE_ATTR(GNUInline);
DEF_SIMPLE_ATTR(Malloc);
DEF_SIMPLE_ATTR(NoReturn);
+DEF_SIMPLE_ATTR(NoInstrumentFunction);
class SectionAttr : public AttrWithString {
public:
SectionAttr(ASTContext &C, llvm::StringRef N)
- : AttrWithString(Section, C, N) {}
+ : AttrWithString(attr::Section, C, N) {}
llvm::StringRef getName() const { return getString(); }
@@ -374,7 +336,7 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *A) {
- return A->getKind() == Section;
+ return A->getKind() == attr::Section;
}
static bool classof(const SectionAttr *A) { return true; }
};
@@ -408,7 +370,7 @@ public:
virtual Attr *clone(ASTContext &C) const;
- static bool classof(const Attr *A) { return A->getKind() == NonNull; }
+ static bool classof(const Attr *A) { return A->getKind() == attr::NonNull; }
static bool classof(const NonNullAttr *A) { return true; }
};
@@ -416,7 +378,7 @@ class FormatAttr : public AttrWithString {
int formatIdx, firstArg;
public:
FormatAttr(ASTContext &C, llvm::StringRef type, int idx, int first)
- : AttrWithString(Format, C, type), formatIdx(idx), firstArg(first) {}
+ : AttrWithString(attr::Format, C, type), formatIdx(idx), firstArg(first) {}
llvm::StringRef getType() const { return getString(); }
void setType(ASTContext &C, llvm::StringRef type);
@@ -426,27 +388,27 @@ public:
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
- static bool classof(const Attr *A) { return A->getKind() == Format; }
+ static bool classof(const Attr *A) { return A->getKind() == attr::Format; }
static bool classof(const FormatAttr *A) { return true; }
};
class FormatArgAttr : public Attr {
int formatIdx;
public:
- FormatArgAttr(int idx) : Attr(FormatArg), formatIdx(idx) {}
+ FormatArgAttr(int idx) : Attr(attr::FormatArg), formatIdx(idx) {}
int getFormatIdx() const { return formatIdx; }
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
- static bool classof(const Attr *A) { return A->getKind() == FormatArg; }
+ static bool classof(const Attr *A) { return A->getKind() == attr::FormatArg; }
static bool classof(const FormatArgAttr *A) { return true; }
};
class SentinelAttr : public Attr {
int sentinel, NullPos;
public:
- SentinelAttr(int sentinel_val, int nullPos) : Attr(Sentinel),
+ SentinelAttr(int sentinel_val, int nullPos) : Attr(attr::Sentinel),
sentinel(sentinel_val), NullPos(nullPos) {}
int getSentinel() const { return sentinel; }
int getNullPos() const { return NullPos; }
@@ -454,7 +416,7 @@ public:
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
- static bool classof(const Attr *A) { return A->getKind() == Sentinel; }
+ static bool classof(const Attr *A) { return A->getKind() == attr::Sentinel; }
static bool classof(const SentinelAttr *A) { return true; }
};
@@ -469,7 +431,7 @@ public:
private:
VisibilityTypes VisibilityType;
public:
- VisibilityAttr(VisibilityTypes v) : Attr(Visibility),
+ VisibilityAttr(VisibilityTypes v) : Attr(attr::Visibility),
VisibilityType(v) {}
VisibilityTypes getVisibility() const { return VisibilityType; }
@@ -477,7 +439,8 @@ public:
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
- static bool classof(const Attr *A) { return A->getKind() == Visibility; }
+ static bool classof(const Attr *A)
+ { return A->getKind() == attr::Visibility; }
static bool classof(const VisibilityAttr *A) { return true; }
};
@@ -491,13 +454,14 @@ DEF_SIMPLE_ATTR(ObjCException);
class OverloadableAttr : public Attr {
public:
- OverloadableAttr() : Attr(Overloadable) { }
+ OverloadableAttr() : Attr(attr::Overloadable) { }
virtual bool isMerged() const { return false; }
virtual Attr *clone(ASTContext &C) const;
- static bool classof(const Attr *A) { return A->getKind() == Overloadable; }
+ static bool classof(const Attr *A)
+ { return A->getKind() == attr::Overloadable; }
static bool classof(const OverloadableAttr *) { return true; }
};
@@ -509,14 +473,14 @@ public:
private:
BlocksAttrTypes BlocksAttrType;
public:
- BlocksAttr(BlocksAttrTypes t) : Attr(Blocks), BlocksAttrType(t) {}
+ BlocksAttr(BlocksAttrTypes t) : Attr(attr::Blocks), BlocksAttrType(t) {}
BlocksAttrTypes getType() const { return BlocksAttrType; }
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
- static bool classof(const Attr *A) { return A->getKind() == Blocks; }
+ static bool classof(const Attr *A) { return A->getKind() == attr::Blocks; }
static bool classof(const BlocksAttr *A) { return true; }
};
@@ -526,14 +490,14 @@ class CleanupAttr : public Attr {
FunctionDecl *FD;
public:
- CleanupAttr(FunctionDecl *fd) : Attr(Cleanup), FD(fd) {}
+ CleanupAttr(FunctionDecl *fd) : Attr(attr::Cleanup), FD(fd) {}
const FunctionDecl *getFunctionDecl() const { return FD; }
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
- static bool classof(const Attr *A) { return A->getKind() == Cleanup; }
+ static bool classof(const Attr *A) { return A->getKind() == attr::Cleanup; }
static bool classof(const CleanupAttr *A) { return true; }
};
@@ -545,14 +509,14 @@ class RegparmAttr : public Attr {
unsigned NumParams;
public:
- RegparmAttr(unsigned np) : Attr(Regparm), NumParams(np) {}
+ RegparmAttr(unsigned np) : Attr(attr::Regparm), NumParams(np) {}
unsigned getNumParams() const { return NumParams; }
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
- static bool classof(const Attr *A) { return A->getKind() == Regparm; }
+ static bool classof(const Attr *A) { return A->getKind() == attr::Regparm; }
static bool classof(const RegparmAttr *A) { return true; }
};
@@ -560,7 +524,7 @@ class ReqdWorkGroupSizeAttr : public Attr {
unsigned X, Y, Z;
public:
ReqdWorkGroupSizeAttr(unsigned X, unsigned Y, unsigned Z)
- : Attr(ReqdWorkGroupSize), X(X), Y(Y), Z(Z) {}
+ : Attr(attr::ReqdWorkGroupSize), X(X), Y(Y), Z(Z) {}
unsigned getXDim() const { return X; }
unsigned getYDim() const { return Y; }
@@ -570,22 +534,34 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *A) {
- return A->getKind() == ReqdWorkGroupSize;
+ return A->getKind() == attr::ReqdWorkGroupSize;
}
static bool classof(const ReqdWorkGroupSizeAttr *A) { return true; }
};
+class InitPriorityAttr : public Attr {
+ unsigned Priority;
+public:
+ InitPriorityAttr(unsigned priority)
+ : Attr(attr::InitPriority), Priority(priority) {}
+
+ virtual void Destroy(ASTContext &C) { Attr::Destroy(C); }
+
+ unsigned getPriority() const { return Priority; }
+
+ virtual Attr *clone(ASTContext &C) const;
+
+ static bool classof(const Attr *A)
+ { return A->getKind() == attr::InitPriority; }
+ static bool classof(const InitPriorityAttr *A) { return true; }
+};
+
// Checker-specific attributes.
DEF_SIMPLE_ATTR(CFReturnsNotRetained);
DEF_SIMPLE_ATTR(CFReturnsRetained);
DEF_SIMPLE_ATTR(NSReturnsNotRetained);
DEF_SIMPLE_ATTR(NSReturnsRetained);
-// C++0x member checking attributes.
-DEF_SIMPLE_ATTR(BaseCheck);
-DEF_SIMPLE_ATTR(Hiding);
-DEF_SIMPLE_ATTR(Override);
-
// Target-specific attributes
DEF_SIMPLE_ATTR(DLLImport);
DEF_SIMPLE_ATTR(DLLExport);
@@ -594,14 +570,15 @@ class MSP430InterruptAttr : public Attr {
unsigned Number;
public:
- MSP430InterruptAttr(unsigned n) : Attr(MSP430Interrupt), Number(n) {}
+ MSP430InterruptAttr(unsigned n) : Attr(attr::MSP430Interrupt), Number(n) {}
unsigned getNumber() const { return Number; }
virtual Attr *clone(ASTContext &C) const;
// Implement isa/cast/dyncast/etc.
- static bool classof(const Attr *A) { return A->getKind() == MSP430Interrupt; }
+ static bool classof(const Attr *A)
+ { return A->getKind() == attr::MSP430Interrupt; }
static bool classof(const MSP430InterruptAttr *A) { return true; }
};
diff --git a/include/clang/AST/CMakeLists.txt b/include/clang/AST/CMakeLists.txt
index c24ea06aa024..3b090715e083 100644
--- a/include/clang/AST/CMakeLists.txt
+++ b/include/clang/AST/CMakeLists.txt
@@ -1,5 +1,18 @@
-set(LLVM_TARGET_DEFINITIONS StmtNodes.td)
+set(LLVM_TARGET_DEFINITIONS ../Basic/Attr.td)
+tablegen(Attrs.inc
+ -gen-clang-attr-classes
+ -I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
+add_custom_target(ClangAttrClasses
+ DEPENDS Attrs.inc)
+
+set(LLVM_TARGET_DEFINITIONS ../Basic/StmtNodes.td)
tablegen(StmtNodes.inc
-gen-clang-stmt-nodes)
add_custom_target(ClangStmtNodes
DEPENDS StmtNodes.inc)
+
+set(LLVM_TARGET_DEFINITIONS ../Basic/DeclNodes.td)
+tablegen(DeclNodes.inc
+ -gen-clang-decl-nodes)
+add_custom_target(ClangDeclNodes
+ DEPENDS DeclNodes.inc)
diff --git a/include/clang/AST/CanonicalType.h b/include/clang/AST/CanonicalType.h
index 4afb81dd05eb..9f97fd8a7aee 100644
--- a/include/clang/AST/CanonicalType.h
+++ b/include/clang/AST/CanonicalType.h
@@ -247,6 +247,7 @@ public:
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isCharType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isWideCharType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegralType)
+ LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegralOrEnumerationType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isRealFloatingType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isComplexType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAnyComplexType)
@@ -269,8 +270,10 @@ public:
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isNullPtrType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isDependentType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isOverloadableType)
+ LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isArrayType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasPointerRepresentation)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasObjCPointerRepresentation)
+ LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasFloatingRepresentation)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isPromotableIntegerType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSignedIntegerType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isUnsignedIntegerType)
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 7d5b66e02a28..39cd51f606b5 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -28,6 +28,8 @@ class FunctionTemplateDecl;
class Stmt;
class CompoundStmt;
class StringLiteral;
+class NestedNameSpecifier;
+class TemplateParameterList;
class TemplateArgumentList;
class MemberSpecializationInfo;
class FunctionTemplateSpecializationInfo;
@@ -216,7 +218,7 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const NamedDecl *D) { return true; }
- static bool classofKind(Kind K) { return K >= NamedFirst && K <= NamedLast; }
+ static bool classofKind(Kind K) { return K >= firstNamed && K <= lastNamed; }
};
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
@@ -342,6 +344,9 @@ public:
static NamespaceDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<NamespaceDecl *>(const_cast<DeclContext*>(DC));
}
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
/// ValueDecl - Represent the declaration of a variable (in which case it is
@@ -361,7 +366,38 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const ValueDecl *D) { return true; }
- static bool classofKind(Kind K) { return K >= ValueFirst && K <= ValueLast; }
+ static bool classofKind(Kind K) { return K >= firstValue && K <= lastValue; }
+};
+
+/// QualifierInfo - A struct with extended info about a syntactic
+/// name qualifier, to be used for the case of out-of-line declarations.
+struct QualifierInfo {
+ /// NNS - The syntactic name qualifier.
+ NestedNameSpecifier *NNS;
+ /// NNSRange - The source range for the qualifier.
+ SourceRange NNSRange;
+ /// NumTemplParamLists - The number of template parameter lists
+ /// that were matched against the template-ids occurring into the NNS.
+ unsigned NumTemplParamLists;
+ /// TemplParamLists - A new-allocated array of size NumTemplParamLists,
+ /// containing pointers to the matched template parameter lists.
+ TemplateParameterList** TemplParamLists;
+
+ /// Default constructor.
+ QualifierInfo()
+ : NNS(0), NNSRange(), NumTemplParamLists(0), TemplParamLists(0) {}
+ /// setTemplateParameterListsInfo - Sets info about matched template
+ /// parameter lists.
+ void setTemplateParameterListsInfo(ASTContext &Context,
+ unsigned NumTPLists,
+ TemplateParameterList **TPLists);
+
+ void Destroy(ASTContext &Context);
+
+private:
+ // Copy constructor and copy assignment are disabled.
+ QualifierInfo(const QualifierInfo&);
+ QualifierInfo& operator=(const QualifierInfo&);
};
/// \brief Represents a ValueDecl that came out of a declarator.
@@ -369,10 +405,8 @@ public:
class DeclaratorDecl : public ValueDecl {
// A struct representing both a TInfo and a syntactic qualifier,
// to be used for the (uncommon) case of out-of-line declarations.
- struct ExtInfo {
+ struct ExtInfo : public QualifierInfo {
TypeSourceInfo *TInfo;
- NestedNameSpecifier *NNS;
- SourceRange NNSRange;
};
llvm::PointerUnion<TypeSourceInfo*, ExtInfo*> DeclInfo;
@@ -392,32 +426,55 @@ public:
TypeSourceInfo *getTypeSourceInfo() const {
return hasExtInfo()
- ? DeclInfo.get<ExtInfo*>()->TInfo
+ ? getExtInfo()->TInfo
: DeclInfo.get<TypeSourceInfo*>();
}
void setTypeSourceInfo(TypeSourceInfo *TI) {
if (hasExtInfo())
- DeclInfo.get<ExtInfo*>()->TInfo = TI;
+ getExtInfo()->TInfo = TI;
else
DeclInfo = TI;
}
+ /// getInnerLocStart - Return SourceLocation representing start of source
+ /// range ignoring outer template declarations.
+ virtual SourceLocation getInnerLocStart() const { return getLocation(); }
+
+ /// getOuterLocStart - Return SourceLocation representing start of source
+ /// range taking into account any outer template declarations.
+ SourceLocation getOuterLocStart() const;
+ SourceRange getSourceRange() const {
+ return SourceRange(getOuterLocStart(), getLocation());
+ }
+
NestedNameSpecifier *getQualifier() const {
- return hasExtInfo() ? DeclInfo.get<ExtInfo*>()->NNS : 0;
+ return hasExtInfo() ? getExtInfo()->NNS : 0;
}
SourceRange getQualifierRange() const {
- return hasExtInfo() ? DeclInfo.get<ExtInfo*>()->NNSRange : SourceRange();
+ return hasExtInfo() ? getExtInfo()->NNSRange : SourceRange();
}
void setQualifierInfo(NestedNameSpecifier *Qualifier,
SourceRange QualifierRange);
+ unsigned getNumTemplateParameterLists() const {
+ return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
+ }
+ TemplateParameterList *getTemplateParameterList(unsigned index) const {
+ assert(index < getNumTemplateParameterLists());
+ return getExtInfo()->TemplParamLists[index];
+ }
+ void setTemplateParameterListsInfo(ASTContext &Context, unsigned NumTPLists,
+ TemplateParameterList **TPLists) {
+ getExtInfo()->setTemplateParameterListsInfo(Context, NumTPLists, TPLists);
+ }
+
SourceLocation getTypeSpecStartLoc() const;
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const DeclaratorDecl *D) { return true; }
static bool classofKind(Kind K) {
- return K >= DeclaratorFirst && K <= DeclaratorLast;
+ return K >= firstDeclarator && K <= lastDeclarator;
}
};
@@ -555,6 +612,7 @@ public:
virtual void Destroy(ASTContext& C);
virtual ~VarDecl();
+ virtual SourceLocation getInnerLocStart() const;
virtual SourceRange getSourceRange() const;
StorageClass getStorageClass() const { return (StorageClass)SClass; }
@@ -908,7 +966,7 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const VarDecl *D) { return true; }
- static bool classofKind(Kind K) { return K >= VarFirst && K <= VarLast; }
+ static bool classofKind(Kind K) { return K >= firstVar && K <= lastVar; }
};
class ImplicitParamDecl : public VarDecl {
@@ -1063,6 +1121,15 @@ public:
None, Extern, Static, PrivateExtern
};
+ /// \brief The kind of templated function a FunctionDecl can be.
+ enum TemplatedKind {
+ TK_NonTemplate,
+ TK_FunctionTemplate,
+ TK_MemberSpecialization,
+ TK_FunctionTemplateSpecialization,
+ TK_DependentFunctionTemplateSpecialization
+ };
+
private:
/// ParamInfo - new[]'d array of pointers to VarDecls for the formal
/// parameters of this function. This is null if a prototype or if there are
@@ -1154,17 +1221,31 @@ public:
bool Qualified) const;
virtual SourceRange getSourceRange() const {
- return SourceRange(getLocation(), EndRangeLoc);
+ return SourceRange(getOuterLocStart(), EndRangeLoc);
}
void setLocEnd(SourceLocation E) {
EndRangeLoc = E;
}
+ /// \brief Returns true if the function has a body (definition). The
+ /// function body might be in any of the (re-)declarations of this
+ /// function. The variant that accepts a FunctionDecl pointer will
+ /// set that function declaration to the actual declaration
+ /// containing the body (if there is one).
+ bool hasBody(const FunctionDecl *&Definition) const;
+
+ virtual bool hasBody() const {
+ const FunctionDecl* Definition;
+ return hasBody(Definition);
+ }
+
/// getBody - Retrieve the body (definition) of the function. The
/// function body might be in any of the (re-)declarations of this
/// function. The variant that accepts a FunctionDecl pointer will
/// set that function declaration to the actual declaration
/// containing the body (if there is one).
+ /// NOTE: For checking if there is a body, use hasBody() instead, to avoid
+ /// unnecessary PCH de-serialization of the body.
Stmt *getBody(const FunctionDecl *&Definition) const;
virtual Stmt *getBody() const {
@@ -1301,6 +1382,12 @@ public:
QualType getResultType() const {
return getType()->getAs<FunctionType>()->getResultType();
}
+
+ /// \brief Determine the type of an expression that calls this function.
+ QualType getCallResultType() const {
+ return getType()->getAs<FunctionType>()->getCallResultType(getASTContext());
+ }
+
StorageClass getStorageClass() const { return StorageClass(SClass); }
void setStorageClass(StorageClass SC) { SClass = SC; }
@@ -1355,6 +1442,9 @@ public:
/// X<int>::A is required, it will be instantiated from the
/// declaration returned by getInstantiatedFromMemberFunction().
FunctionDecl *getInstantiatedFromMemberFunction() const;
+
+ /// \brief What kind of templated function this is.
+ TemplatedKind getTemplatedKind() const;
/// \brief If this function is an instantiation of a member function of a
/// class template specialization, retrieves the member specialization
@@ -1437,8 +1527,6 @@ public:
/// \brief Specify that this function declaration is actually a function
/// template specialization.
///
- /// \param Context the AST context in which this function resides.
- ///
/// \param Template the function template that this function template
/// specialization specializes.
///
@@ -1450,11 +1538,53 @@ public:
/// be inserted.
///
/// \param TSK the kind of template specialization this is.
+ ///
+ /// \param TemplateArgsAsWritten location info of template arguments.
+ ///
+ /// \param PointOfInstantiation point at which the function template
+ /// specialization was first instantiated.
void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
const TemplateArgumentList *TemplateArgs,
void *InsertPos,
TemplateSpecializationKind TSK = TSK_ImplicitInstantiation,
- const TemplateArgumentListInfo *TemplateArgsAsWritten = 0);
+ const TemplateArgumentListInfo *TemplateArgsAsWritten = 0,
+ SourceLocation PointOfInstantiation = SourceLocation());
+
+ /// \brief Specify that this function declaration is actually a function
+ /// template specialization.
+ ///
+ /// \param Template the function template that this function template
+ /// specialization specializes.
+ ///
+ /// \param NumTemplateArgs number of template arguments that produced this
+ /// function template specialization from the template.
+ ///
+ /// \param TemplateArgs array of template arguments that produced this
+ /// function template specialization from the template.
+ ///
+ /// \param TSK the kind of template specialization this is.
+ ///
+ /// \param NumTemplateArgsAsWritten number of template arguments that produced
+ /// this function template specialization from the template.
+ ///
+ /// \param TemplateArgsAsWritten array of location info for the template
+ /// arguments.
+ ///
+ /// \param LAngleLoc location of left angle token.
+ ///
+ /// \param RAngleLoc location of right angle token.
+ ///
+ /// \param PointOfInstantiation point at which the function template
+ /// specialization was first instantiated.
+ void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
+ unsigned NumTemplateArgs,
+ const TemplateArgument *TemplateArgs,
+ TemplateSpecializationKind TSK,
+ unsigned NumTemplateArgsAsWritten,
+ TemplateArgumentLoc *TemplateArgsAsWritten,
+ SourceLocation LAngleLoc,
+ SourceLocation RAngleLoc,
+ SourceLocation PointOfInstantiation);
/// \brief Specifies that this function declaration is actually a
/// dependent function template specialization.
@@ -1493,7 +1623,7 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const FunctionDecl *D) { return true; }
static bool classofKind(Kind K) {
- return K >= FunctionFirst && K <= FunctionLast;
+ return K >= firstFunction && K <= lastFunction;
}
static DeclContext *castToDeclContext(const FunctionDecl *D) {
return static_cast<DeclContext *>(const_cast<FunctionDecl*>(D));
@@ -1501,6 +1631,9 @@ public:
static FunctionDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<FunctionDecl *>(const_cast<DeclContext*>(DC));
}
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
@@ -1556,7 +1689,7 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const FieldDecl *D) { return true; }
- static bool classofKind(Kind K) { return K >= FieldFirst && K <= FieldLast; }
+ static bool classofKind(Kind K) { return K >= firstField && K <= lastField; }
};
/// EnumConstantDecl - An instance of this object exists for each enum constant
@@ -1625,7 +1758,7 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const TypeDecl *D) { return true; }
- static bool classofKind(Kind K) { return K >= TypeFirst && K <= TypeLast; }
+ static bool classofKind(Kind K) { return K >= firstType && K <= lastType; }
};
@@ -1715,10 +1848,7 @@ private:
// A struct representing syntactic qualifier info,
// to be used for the (uncommon) case of out-of-line declarations.
- struct ExtInfo {
- NestedNameSpecifier *NNS;
- SourceRange NNSRange;
- };
+ typedef QualifierInfo ExtInfo;
/// TypedefDeclOrQualifier - If the (out-of-line) tag declaration name
/// is qualified, it points to the qualifier info (nns and range);
@@ -1767,6 +1897,13 @@ public:
SourceLocation getTagKeywordLoc() const { return TagKeywordLoc; }
void setTagKeywordLoc(SourceLocation TKL) { TagKeywordLoc = TKL; }
+ /// getInnerLocStart - Return SourceLocation representing start of source
+ /// range ignoring outer template declarations.
+ virtual SourceLocation getInnerLocStart() const { return TagKeywordLoc; }
+
+ /// getOuterLocStart - Return SourceLocation representing start of source
+ /// range taking into account any outer template declarations.
+ SourceLocation getOuterLocStart() const;
virtual SourceRange getSourceRange() const;
virtual TagDecl* getCanonicalDecl();
@@ -1830,24 +1967,34 @@ public:
TypedefDecl *getTypedefForAnonDecl() const {
return hasExtInfo() ? 0 : TypedefDeclOrQualifier.get<TypedefDecl*>();
}
-
+
void setTypedefForAnonDecl(TypedefDecl *TDD);
-
+
NestedNameSpecifier *getQualifier() const {
- return hasExtInfo() ? TypedefDeclOrQualifier.get<ExtInfo*>()->NNS : 0;
+ return hasExtInfo() ? getExtInfo()->NNS : 0;
}
SourceRange getQualifierRange() const {
- return hasExtInfo()
- ? TypedefDeclOrQualifier.get<ExtInfo*>()->NNSRange
- : SourceRange();
+ return hasExtInfo() ? getExtInfo()->NNSRange : SourceRange();
}
void setQualifierInfo(NestedNameSpecifier *Qualifier,
SourceRange QualifierRange);
+ unsigned getNumTemplateParameterLists() const {
+ return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
+ }
+ TemplateParameterList *getTemplateParameterList(unsigned i) const {
+ assert(i < getNumTemplateParameterLists());
+ return getExtInfo()->TemplParamLists[i];
+ }
+ void setTemplateParameterListsInfo(ASTContext &Context, unsigned NumTPLists,
+ TemplateParameterList **TPLists) {
+ getExtInfo()->setTemplateParameterListsInfo(Context, NumTPLists, TPLists);
+ }
+
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const TagDecl *D) { return true; }
- static bool classofKind(Kind K) { return K >= TagFirst && K <= TagLast; }
+ static bool classofKind(Kind K) { return K >= firstTag && K <= lastTag; }
static DeclContext *castToDeclContext(const TagDecl *D) {
return static_cast<DeclContext *>(const_cast<TagDecl*>(D));
@@ -1855,6 +2002,9 @@ public:
static TagDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<TagDecl *>(const_cast<DeclContext*>(DC));
}
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
/// EnumDecl - Represents an enum. As an extension, we allow forward-declared
@@ -1896,9 +2046,17 @@ public:
return cast<EnumDecl>(TagDecl::getCanonicalDecl());
}
+ const EnumDecl *getPreviousDeclaration() const {
+ return cast_or_null<EnumDecl>(TagDecl::getPreviousDeclaration());
+ }
+ EnumDecl *getPreviousDeclaration() {
+ return cast_or_null<EnumDecl>(TagDecl::getPreviousDeclaration());
+ }
+
static EnumDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
SourceLocation TKL, EnumDecl *PrevDecl);
+ static EnumDecl *Create(ASTContext &C, EmptyShell Empty);
virtual void Destroy(ASTContext& C);
@@ -1917,11 +2075,17 @@ public:
typedef specific_decl_iterator<EnumConstantDecl> enumerator_iterator;
enumerator_iterator enumerator_begin() const {
- return enumerator_iterator(this->decls_begin());
+ const EnumDecl *E = cast_or_null<EnumDecl>(getDefinition());
+ if (!E)
+ E = this;
+ return enumerator_iterator(E->decls_begin());
}
enumerator_iterator enumerator_end() const {
- return enumerator_iterator(this->decls_end());
+ const EnumDecl *E = cast_or_null<EnumDecl>(getDefinition());
+ if (!E)
+ E = this;
+ return enumerator_iterator(E->decls_end());
}
/// getPromotionType - Return the integer type that enumerators
@@ -2010,6 +2174,14 @@ public:
SourceLocation L, IdentifierInfo *Id,
SourceLocation TKL = SourceLocation(),
RecordDecl* PrevDecl = 0);
+ static RecordDecl *Create(ASTContext &C, EmptyShell Empty);
+
+ const RecordDecl *getPreviousDeclaration() const {
+ return cast_or_null<RecordDecl>(TagDecl::getPreviousDeclaration());
+ }
+ RecordDecl *getPreviousDeclaration() {
+ return cast_or_null<RecordDecl>(TagDecl::getPreviousDeclaration());
+ }
virtual void Destroy(ASTContext& C);
@@ -2092,7 +2264,7 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const RecordDecl *D) { return true; }
static bool classofKind(Kind K) {
- return K >= RecordFirst && K <= RecordLast;
+ return K >= firstRecord && K <= lastRecord;
}
};
@@ -2127,11 +2299,13 @@ class BlockDecl : public Decl, public DeclContext {
unsigned NumParams;
Stmt *Body;
+ TypeSourceInfo *SignatureAsWritten;
protected:
BlockDecl(DeclContext *DC, SourceLocation CaretLoc)
: Decl(Block, DC, CaretLoc), DeclContext(Block),
- IsVariadic(false), ParamInfo(0), NumParams(0), Body(0) {}
+ IsVariadic(false), ParamInfo(0), NumParams(0), Body(0),
+ SignatureAsWritten(0) {}
virtual ~BlockDecl();
virtual void Destroy(ASTContext& C);
@@ -2148,6 +2322,9 @@ public:
Stmt *getBody() const { return (Stmt*) Body; }
void setBody(CompoundStmt *B) { Body = (Stmt*) B; }
+ void setSignatureAsWritten(TypeSourceInfo *Sig) { SignatureAsWritten = Sig; }
+ TypeSourceInfo *getSignatureAsWritten() const { return SignatureAsWritten; }
+
// Iterator access to formal parameters.
unsigned param_size() const { return getNumParams(); }
typedef ParmVarDecl **param_iterator;
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index c15aeef14ba6..2d2407ffb18d 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -68,12 +68,13 @@ class Decl {
public:
/// \brief Lists the kind of concrete classes of Decl.
enum Kind {
-#define DECL(Derived, Base) Derived,
-#define DECL_RANGE(CommonBase, Start, End) \
- CommonBase##First = Start, CommonBase##Last = End,
-#define LAST_DECL_RANGE(CommonBase, Start, End) \
- CommonBase##First = Start, CommonBase##Last = End
-#include "clang/AST/DeclNodes.def"
+#define DECL(DERIVED, BASE) DERIVED,
+#define ABSTRACT_DECL(DECL)
+#define DECL_RANGE(BASE, START, END) \
+ first##BASE = START, last##BASE = END,
+#define LAST_DECL_RANGE(BASE, START, END) \
+ first##BASE = START, last##BASE = END
+#include "clang/AST/DeclNodes.inc"
};
/// \brief A placeholder type used to construct an empty shell of a
@@ -244,7 +245,15 @@ protected:
HasAttrs(false), Implicit(false), Used(false),
Access(AS_none), PCHLevel(0),
IdentifierNamespace(getIdentifierNamespaceForKind(DK)) {
- if (Decl::CollectingStats()) addDeclKind(DK);
+ if (Decl::CollectingStats()) add(DK);
+ }
+
+ Decl(Kind DK, EmptyShell Empty)
+ : NextDeclInContext(0), DeclKind(DK), InvalidDecl(0),
+ HasAttrs(false), Implicit(false), Used(false),
+ Access(AS_none), PCHLevel(0),
+ IdentifierNamespace(getIdentifierNamespaceForKind(DK)) {
+ if (Decl::CollectingStats()) add(DK);
}
virtual ~Decl();
@@ -296,6 +305,7 @@ public:
}
bool hasAttrs() const { return HasAttrs; }
+ void initAttrs(Attr *attrs);
void addAttr(Attr *attr);
const Attr *getAttrs() const {
if (!HasAttrs) return 0; // common case, no attributes.
@@ -328,7 +338,11 @@ public:
/// \brief Whether this declaration was used, meaning that a definition
/// is required.
- bool isUsed() const;
+ ///
+ /// \param CheckUsedAttr When true, also consider the "used" attribute
+ /// (in addition to the "used" bit set by \c setUsed()) when determining
+ /// whether the function is used.
+ bool isUsed(bool CheckUsedAttr = true) const;
void setUsed(bool U = true) { Used = U; }
@@ -474,15 +488,16 @@ public:
/// top-level Stmt* of that body. Otherwise this method returns null.
virtual Stmt* getBody() const { return 0; }
- /// getCompoundBody - Returns getBody(), dyn_casted to a CompoundStmt.
- CompoundStmt* getCompoundBody() const;
+ /// \brief Returns true if this Decl represents a declaration for a body of
+ /// code, such as a function or method definition.
+ virtual bool hasBody() const { return getBody() != 0; }
/// getBodyRBrace - Gets the right brace of the body, if a body exists.
/// This works whether the body is a CompoundStmt or a CXXTryStmt.
SourceLocation getBodyRBrace() const;
// global temp stats (until we have a per-module visitor)
- static void addDeclKind(Kind k);
+ static void add(Kind k);
static bool CollectingStats(bool Enable = false);
static void PrintStats();
@@ -631,6 +646,8 @@ class DeclContext {
/// another pointer.
mutable Decl *LastDecl;
+ friend class ExternalASTSource;
+
protected:
DeclContext(Decl::Kind K)
: DeclKind(K), ExternalLexicalStorage(false),
@@ -687,7 +704,7 @@ public:
case Decl::ObjCMethod:
return true;
default:
- return DeclKind >= Decl::FunctionFirst && DeclKind <= Decl::FunctionLast;
+ return DeclKind >= Decl::firstFunction && DeclKind <= Decl::lastFunction;
}
}
@@ -700,7 +717,7 @@ public:
}
bool isRecord() const {
- return DeclKind >= Decl::RecordFirst && DeclKind <= Decl::RecordLast;
+ return DeclKind >= Decl::firstRecord && DeclKind <= Decl::lastRecord;
}
bool isNamespace() const {
@@ -1083,9 +1100,10 @@ public:
static bool classof(const Decl *D);
static bool classof(const DeclContext *D) { return true; }
-#define DECL_CONTEXT(Name) \
- static bool classof(const Name##Decl *D) { return true; }
-#include "clang/AST/DeclNodes.def"
+#define DECL(NAME, BASE)
+#define DECL_CONTEXT(NAME) \
+ static bool classof(const NAME##Decl *D) { return true; }
+#include "clang/AST/DeclNodes.inc"
void dumpDeclContext() const;
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index c19c200f265d..41474ab21e32 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -92,6 +92,53 @@ namespace llvm {
namespace clang {
+/// AccessSpecDecl - An access specifier followed by colon ':'.
+///
+/// An objects of this class represents sugar for the syntactic occurrence
+/// of an access specifier followed by a colon in the list of member
+/// specifiers of a C++ class definition.
+///
+/// Note that they do not represent other uses of access specifiers,
+/// such as those occurring in a list of base specifiers.
+/// Also note that this class has nothing to do with so-called
+/// "access declarations" (C++98 11.3 [class.access.dcl]).
+class AccessSpecDecl : public Decl {
+ /// ColonLoc - The location of the ':'.
+ SourceLocation ColonLoc;
+
+ AccessSpecDecl(AccessSpecifier AS, DeclContext *DC,
+ SourceLocation ASLoc, SourceLocation ColonLoc)
+ : Decl(AccessSpec, DC, ASLoc), ColonLoc(ColonLoc) {
+ setAccess(AS);
+ }
+public:
+ /// getAccessSpecifierLoc - The location of the access specifier.
+ SourceLocation getAccessSpecifierLoc() const { return getLocation(); }
+ /// setAccessSpecifierLoc - Sets the location of the access specifier.
+ void setAccessSpecifierLoc(SourceLocation ASLoc) { setLocation(ASLoc); }
+
+ /// getColonLoc - The location of the colon following the access specifier.
+ SourceLocation getColonLoc() const { return ColonLoc; }
+ /// setColonLoc - Sets the location of the colon.
+ void setColonLoc(SourceLocation CLoc) { ColonLoc = CLoc; }
+
+ SourceRange getSourceRange() const {
+ return SourceRange(getAccessSpecifierLoc(), getColonLoc());
+ }
+
+ static AccessSpecDecl *Create(ASTContext &C, AccessSpecifier AS,
+ DeclContext *DC, SourceLocation ASLoc,
+ SourceLocation ColonLoc) {
+ return new (C) AccessSpecDecl(AS, DC, ASLoc, ColonLoc);
+ }
+
+ // Implement isa/cast/dyncast/etc.
+ static bool classof(const Decl *D) { return classofKind(D->getKind()); }
+ static bool classof(const AccessSpecDecl *D) { return true; }
+ static bool classofKind(Kind K) { return K == AccessSpec; }
+};
+
+
/// CXXBaseSpecifier - A base class of a C++ class.
///
/// Each CXXBaseSpecifier represents a single, direct base class (or
@@ -271,7 +318,20 @@ class CXXRecordDecl : public RecordDecl {
/// ComputedVisibleConversions - True when visible conversion functions are
/// already computed and are available.
bool ComputedVisibleConversions : 1;
-
+
+ /// \brief Whether we have already declared the default constructor or
+ /// do not need to have one declared.
+ bool DeclaredDefaultConstructor : 1;
+
+ /// \brief Whether we have already declared the copy constructor.
+ bool DeclaredCopyConstructor : 1;
+
+ /// \brief Whether we have already declared the copy-assignment operator.
+ bool DeclaredCopyAssignment : 1;
+
+ /// \brief Whether we have already declared a destructor within the class.
+ bool DeclaredDestructor : 1;
+
/// Bases - Base classes of this class.
/// FIXME: This is wasted space for a union.
CXXBaseSpecifier *Bases;
@@ -367,6 +427,13 @@ public:
virtual const CXXRecordDecl *getCanonicalDecl() const {
return cast<CXXRecordDecl>(RecordDecl::getCanonicalDecl());
}
+
+ const CXXRecordDecl *getPreviousDeclaration() const {
+ return cast_or_null<CXXRecordDecl>(RecordDecl::getPreviousDeclaration());
+ }
+ CXXRecordDecl *getPreviousDeclaration() {
+ return cast_or_null<CXXRecordDecl>(RecordDecl::getPreviousDeclaration());
+ }
CXXRecordDecl *getDefinition() const {
if (!DefinitionData) return 0;
@@ -380,6 +447,7 @@ public:
SourceLocation TKL = SourceLocation(),
CXXRecordDecl* PrevDecl=0,
bool DelayTypeCreation = false);
+ static CXXRecordDecl *Create(ASTContext &C, EmptyShell Empty);
virtual void Destroy(ASTContext& C);
@@ -476,6 +544,20 @@ public:
return data().FirstFriend != 0;
}
+ /// \brief Determine whether this class has had its default constructor
+ /// declared implicitly or does not need one declared implicitly.
+ ///
+ /// This value is used for lazy creation of default constructors.
+ bool hasDeclaredDefaultConstructor() const {
+ return data().DeclaredDefaultConstructor;
+ }
+
+ /// \brief Note whether this class has already had its default constructor
+ /// implicitly declared or doesn't need one.
+ void setDeclaredDefaultConstructor(bool DDC) {
+ data().DeclaredDefaultConstructor = DDC;
+ }
+
/// hasConstCopyConstructor - Determines whether this class has a
/// copy constructor that accepts a const-qualified argument.
bool hasConstCopyConstructor(ASTContext &Context) const;
@@ -484,12 +566,18 @@ public:
CXXConstructorDecl *getCopyConstructor(ASTContext &Context,
unsigned TypeQuals) const;
- /// hasConstCopyAssignment - Determines whether this class has a
- /// copy assignment operator that accepts a const-qualified argument.
- /// It returns its decl in MD if found.
- bool hasConstCopyAssignment(ASTContext &Context,
- const CXXMethodDecl *&MD) const;
-
+ /// \brief Retrieve the copy-assignment operator for this class, if available.
+ ///
+ /// This routine attempts to find the copy-assignment operator for this
+ /// class, using a simplistic form of overload resolution.
+ ///
+ /// \param ArgIsConst Whether the argument to the copy-assignment operator
+ /// is const-qualified.
+ ///
+ /// \returns The copy-assignment operator that can be invoked, or NULL if
+ /// a unique copy-assignment operator could not be found.
+ CXXMethodDecl *getCopyAssignmentOperator(bool ArgIsConst) const;
+
/// addedConstructor - Notify the class that another constructor has
/// been added. This routine helps maintain information about the
/// class based on which constructors have been added.
@@ -509,9 +597,23 @@ public:
return data().UserDeclaredCopyConstructor;
}
+ /// \brief Determine whether this class has had its copy constructor
+ /// declared, either via the user or via an implicit declaration.
+ ///
+ /// This value is used for lazy creation of copy constructors.
+ bool hasDeclaredCopyConstructor() const {
+ return data().DeclaredCopyConstructor;
+ }
+
+ /// \brief Note whether this class has already had its copy constructor
+ /// declared.
+ void setDeclaredCopyConstructor(bool DCC) {
+ data().DeclaredCopyConstructor = DCC;
+ }
+
/// addedAssignmentOperator - Notify the class that another assignment
/// operator has been added. This routine helps maintain information about the
- /// class based on which operators have been added.
+ /// class based on which operators have been added.
void addedAssignmentOperator(ASTContext &Context, CXXMethodDecl *OpDecl);
/// hasUserDeclaredCopyAssignment - Whether this class has a
@@ -521,6 +623,20 @@ public:
return data().UserDeclaredCopyAssignment;
}
+ /// \brief Determine whether this class has had its copy assignment operator
+ /// declared, either via the user or via an implicit declaration.
+ ///
+ /// This value is used for lazy creation of copy assignment operators.
+ bool hasDeclaredCopyAssignment() const {
+ return data().DeclaredCopyAssignment;
+ }
+
+ /// \brief Note whether this class has already had its copy assignment
+ /// operator declared.
+ void setDeclaredCopyAssignment(bool DCA) {
+ data().DeclaredCopyAssignment = DCA;
+ }
+
/// hasUserDeclaredDestructor - Whether this class has a
/// user-declared destructor. When false, a destructor will be
/// implicitly declared.
@@ -533,8 +649,21 @@ public:
/// fully defined, a destructor will be implicitly declared.
void setUserDeclaredDestructor(bool UCD) {
data().UserDeclaredDestructor = UCD;
+ if (UCD)
+ data().DeclaredDestructor = true;
}
+ /// \brief Determine whether this class has had its destructor declared,
+ /// either via the user or via an implicit declaration.
+ ///
+ /// This value is used for lazy creation of destructors.
+ bool hasDeclaredDestructor() const { return data().DeclaredDestructor; }
+
+ /// \brief Note whether this class has already had its destructor declared.
+ void setDeclaredDestructor(bool DD) {
+ data().DeclaredDestructor = DD;
+ }
+
/// getConversions - Retrieve the overload set containing all of the
/// conversion functions in this class.
UnresolvedSetImpl *getConversionFunctions() {
@@ -726,10 +855,10 @@ public:
void setTemplateSpecializationKind(TemplateSpecializationKind TSK);
/// getDefaultConstructor - Returns the default constructor for this class
- CXXConstructorDecl *getDefaultConstructor(ASTContext &Context);
+ CXXConstructorDecl *getDefaultConstructor();
/// getDestructor - Returns the destructor decl for this class.
- CXXDestructorDecl *getDestructor(ASTContext &Context) const;
+ CXXDestructorDecl *getDestructor() const;
/// isLocalClass - If the class is a local class [class.local], returns
/// the enclosing function declaration.
@@ -920,14 +1049,15 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classofKind(Kind K) {
- return K == CXXRecord ||
- K == ClassTemplateSpecialization ||
- K == ClassTemplatePartialSpecialization;
+ return K >= firstCXXRecord && K <= lastCXXRecord;
}
static bool classof(const CXXRecordDecl *D) { return true; }
static bool classof(const ClassTemplateSpecializationDecl *D) {
return true;
}
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
/// CXXMethodDecl - Represents a static or instance method of a
@@ -984,6 +1114,7 @@ public:
method_iterator begin_overridden_methods() const;
method_iterator end_overridden_methods() const;
+ unsigned size_overridden_methods() const;
/// getParent - Returns the parent of this method declaration, which
/// is the class in which this method is defined.
@@ -1012,7 +1143,7 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const CXXMethodDecl *D) { return true; }
static bool classofKind(Kind K) {
- return K >= CXXMethod && K <= CXXConversion;
+ return K >= firstCXXMethod && K <= lastCXXMethod;
}
};
@@ -1387,6 +1518,9 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const CXXConstructorDecl *D) { return true; }
static bool classofKind(Kind K) { return K == CXXConstructor; }
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
/// CXXDestructorDecl - Represents a C++ destructor within a
@@ -1450,6 +1584,9 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const CXXDestructorDecl *D) { return true; }
static bool classofKind(Kind K) { return K == CXXDestructor; }
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
/// CXXConversionDecl - Represents a C++ conversion function within a
@@ -1504,6 +1641,9 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const CXXConversionDecl *D) { return true; }
static bool classofKind(Kind K) { return K == CXXConversion; }
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
/// LinkageSpecDecl - This represents a linkage specification. For example:
@@ -1607,7 +1747,7 @@ class UsingDirectiveDecl : public NamedDecl {
SourceLocation IdentLoc,
NamedDecl *Nominated,
DeclContext *CommonAncestor)
- : NamedDecl(Decl::UsingDirective, DC, L, getName()),
+ : NamedDecl(UsingDirective, DC, L, getName()),
NamespaceLoc(NamespcLoc), QualifierRange(QualifierRange),
Qualifier(Qualifier), IdentLoc(IdentLoc),
NominatedNamespace(Nominated),
@@ -1680,7 +1820,7 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const UsingDirectiveDecl *D) { return true; }
- static bool classofKind(Kind K) { return K == Decl::UsingDirective; }
+ static bool classofKind(Kind K) { return K == UsingDirective; }
// Friend for getUsingDirectiveName.
friend class DeclContext;
@@ -1714,7 +1854,7 @@ class NamespaceAliasDecl : public NamedDecl {
SourceRange QualifierRange,
NestedNameSpecifier *Qualifier,
SourceLocation IdentLoc, NamedDecl *Namespace)
- : NamedDecl(Decl::NamespaceAlias, DC, L, Alias), AliasLoc(AliasLoc),
+ : NamedDecl(NamespaceAlias, DC, L, Alias), AliasLoc(AliasLoc),
QualifierRange(QualifierRange), Qualifier(Qualifier),
IdentLoc(IdentLoc), Namespace(Namespace) { }
@@ -1786,7 +1926,7 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const NamespaceAliasDecl *D) { return true; }
- static bool classofKind(Kind K) { return K == Decl::NamespaceAlias; }
+ static bool classofKind(Kind K) { return K == NamespaceAlias; }
};
/// UsingShadowDecl - Represents a shadow declaration introduced into
@@ -1809,9 +1949,12 @@ class UsingShadowDecl : public NamedDecl {
UsingShadowDecl(DeclContext *DC, SourceLocation Loc, UsingDecl *Using,
NamedDecl *Target)
- : NamedDecl(UsingShadow, DC, Loc, Target->getDeclName()),
+ : NamedDecl(UsingShadow, DC, Loc, DeclarationName()),
Underlying(Target), Using(Using) {
- IdentifierNamespace = Target->getIdentifierNamespace();
+ if (Target) {
+ setDeclName(Target->getDeclName());
+ IdentifierNamespace = Target->getIdentifierNamespace();
+ }
setImplicit();
}
@@ -1828,7 +1971,11 @@ public:
/// \brief Sets the underlying declaration which has been brought into the
/// local scope.
- void setTargetDecl(NamedDecl* ND) { Underlying = ND; }
+ void setTargetDecl(NamedDecl* ND) {
+ assert(ND && "Target decl is null!");
+ Underlying = ND;
+ IdentifierNamespace = ND->getIdentifierNamespace();
+ }
/// \brief Gets the using declaration to which this declaration is tied.
UsingDecl *getUsingDecl() const { return Using; }
@@ -1866,7 +2013,7 @@ class UsingDecl : public NamedDecl {
UsingDecl(DeclContext *DC, SourceLocation L, SourceRange NNR,
SourceLocation UL, NestedNameSpecifier* TargetNNS,
DeclarationName Name, bool IsTypeNameArg)
- : NamedDecl(Decl::Using, DC, L, Name),
+ : NamedDecl(Using, DC, L, Name),
NestedNameRange(NNR), UsingLocation(UL), TargetNestedName(TargetNNS),
IsTypeName(IsTypeNameArg) {
}
@@ -1934,7 +2081,10 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const UsingDecl *D) { return true; }
- static bool classofKind(Kind K) { return K == Decl::Using; }
+ static bool classofKind(Kind K) { return K == Using; }
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
/// UnresolvedUsingValueDecl - Represents a dependent using
@@ -1960,7 +2110,7 @@ class UnresolvedUsingValueDecl : public ValueDecl {
NestedNameSpecifier *TargetNNS,
SourceLocation TargetNameLoc,
DeclarationName TargetName)
- : ValueDecl(Decl::UnresolvedUsingValue, DC, TargetNameLoc, TargetName, Ty),
+ : ValueDecl(UnresolvedUsingValue, DC, TargetNameLoc, TargetName, Ty),
TargetNestedNameRange(TargetNNR), UsingLocation(UsingLoc),
TargetNestedNameSpecifier(TargetNNS)
{ }
@@ -1997,7 +2147,7 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const UnresolvedUsingValueDecl *D) { return true; }
- static bool classofKind(Kind K) { return K == Decl::UnresolvedUsingValue; }
+ static bool classofKind(Kind K) { return K == UnresolvedUsingValue; }
};
/// UnresolvedUsingTypenameDecl - Represents a dependent using
@@ -2026,7 +2176,7 @@ class UnresolvedUsingTypenameDecl : public TypeDecl {
SourceLocation TypenameLoc,
SourceRange TargetNNR, NestedNameSpecifier *TargetNNS,
SourceLocation TargetNameLoc, IdentifierInfo *TargetName)
- : TypeDecl(Decl::UnresolvedUsingTypename, DC, TargetNameLoc, TargetName),
+ : TypeDecl(UnresolvedUsingTypename, DC, TargetNameLoc, TargetName),
TargetNestedNameRange(TargetNNR), UsingLocation(UsingLoc),
TypenameLocation(TypenameLoc), TargetNestedNameSpecifier(TargetNNS)
{ }
@@ -2070,7 +2220,7 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const UnresolvedUsingTypenameDecl *D) { return true; }
- static bool classofKind(Kind K) { return K == Decl::UnresolvedUsingTypename; }
+ static bool classofKind(Kind K) { return K == UnresolvedUsingTypename; }
};
/// StaticAssertDecl - Represents a C++0x static_assert declaration.
@@ -2098,7 +2248,7 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(StaticAssertDecl *D) { return true; }
- static bool classofKind(Kind K) { return K == Decl::StaticAssert; }
+ static bool classofKind(Kind K) { return K == StaticAssert; }
};
/// Insertion operator for diagnostics. This allows sending AccessSpecifier's
diff --git a/include/clang/AST/DeclFriend.h b/include/clang/AST/DeclFriend.h
index a20625da56b7..2807d16379ae 100644
--- a/include/clang/AST/DeclFriend.h
+++ b/include/clang/AST/DeclFriend.h
@@ -59,10 +59,14 @@ private:
FriendLoc(FriendL) {
}
+ explicit FriendDecl(EmptyShell Empty)
+ : Decl(Decl::Friend, Empty), NextFriend(0) { }
+
public:
static FriendDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L, FriendUnion Friend_,
SourceLocation FriendL);
+ static FriendDecl *Create(ASTContext &C, EmptyShell Empty);
/// If this friend declaration names an (untemplated but
/// possibly dependent) type, return the type; otherwise
@@ -87,6 +91,9 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const FriendDecl *D) { return true; }
static bool classofKind(Kind K) { return K == Decl::Friend; }
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
/// An iterator over the friend declarations of a class.
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index 97d165696aad..fb8596f50a0b 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -239,6 +239,12 @@ public:
QualType getResultType() const { return MethodDeclType; }
void setResultType(QualType T) { MethodDeclType = T; }
+ /// \brief Determine the type of an expression that sends a message to this
+ /// function.
+ QualType getSendResultType() const {
+ return getResultType().getCallResultType(getASTContext());
+ }
+
TypeSourceInfo *getResultTypeSourceInfo() const { return ResultTInfo; }
void setResultTypeSourceInfo(TypeSourceInfo *TInfo) { ResultTInfo = TInfo; }
@@ -417,8 +423,8 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const ObjCContainerDecl *D) { return true; }
static bool classofKind(Kind K) {
- return K >= ObjCContainerFirst &&
- K <= ObjCContainerLast;
+ return K >= firstObjCContainer &&
+ K <= lastObjCContainer;
}
static DeclContext *castToDeclContext(const ObjCContainerDecl *D) {
@@ -550,8 +556,8 @@ public:
void setCategoryList(ObjCCategoryDecl *category) {
CategoryList = category;
}
-
- ObjCCategoryDecl* getClassExtension() const;
+
+ ObjCCategoryDecl* getFirstClassExtension() const;
ObjCPropertyDecl
*FindPropertyVisibleInPrimaryClass(IdentifierInfo *PropertyId) const;
@@ -983,6 +989,7 @@ public:
}
bool IsClassExtension() const { return getIdentifier() == 0; }
+ const ObjCCategoryDecl *getNextClassExtension() const;
typedef specific_decl_iterator<ObjCIvarDecl> ivar_iterator;
ivar_iterator ivar_begin() const {
@@ -1059,7 +1066,7 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const ObjCImplDecl *D) { return true; }
static bool classofKind(Kind K) {
- return K >= ObjCImplFirst && K <= ObjCImplLast;
+ return K >= firstObjCImpl && K <= lastObjCImpl;
}
};
@@ -1306,9 +1313,9 @@ public:
enum PropertyControl { None, Required, Optional };
private:
SourceLocation AtLoc; // location of @property
- QualType DeclType;
+ TypeSourceInfo *DeclType;
unsigned PropertyAttributes : 8;
-
+ unsigned PropertyAttributesAsWritten : 8;
// @required/@optional
unsigned PropertyImplementation : 2;
@@ -1320,9 +1327,11 @@ private:
ObjCIvarDecl *PropertyIvarDecl; // Synthesize ivar for this property
ObjCPropertyDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
- SourceLocation AtLocation, QualType T)
+ SourceLocation AtLocation, TypeSourceInfo *T)
: NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation), DeclType(T),
- PropertyAttributes(OBJC_PR_noattr), PropertyImplementation(None),
+ PropertyAttributes(OBJC_PR_noattr),
+ PropertyAttributesAsWritten(OBJC_PR_noattr),
+ PropertyImplementation(None),
GetterName(Selector()),
SetterName(Selector()),
GetterMethodDecl(0), SetterMethodDecl(0) , PropertyIvarDecl(0) {}
@@ -1330,13 +1339,14 @@ public:
static ObjCPropertyDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
IdentifierInfo *Id, SourceLocation AtLocation,
- QualType T,
+ TypeSourceInfo *T,
PropertyControl propControl = None);
SourceLocation getAtLoc() const { return AtLoc; }
void setAtLoc(SourceLocation L) { AtLoc = L; }
- QualType getType() const { return DeclType; }
- void setType(QualType T) { DeclType = T; }
+ TypeSourceInfo *getTypeSourceInfo() const { return DeclType; }
+ QualType getType() const { return DeclType->getType(); }
+ void setType(TypeSourceInfo *T) { DeclType = T; }
PropertyAttributeKind getPropertyAttributes() const {
return PropertyAttributeKind(PropertyAttributes);
@@ -1345,6 +1355,14 @@ public:
PropertyAttributes |= PRVal;
}
+ PropertyAttributeKind getPropertyAttributesAsWritten() const {
+ return PropertyAttributeKind(PropertyAttributesAsWritten);
+ }
+
+ void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal) {
+ PropertyAttributesAsWritten = PRVal;
+ }
+
void makeitReadWriteAttribute(void) {
PropertyAttributes &= ~OBJC_PR_readonly;
PropertyAttributes |= OBJC_PR_readwrite;
diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h
index b7b90b14adfd..135dd3ae78d3 100644
--- a/include/clang/AST/DeclTemplate.h
+++ b/include/clang/AST/DeclTemplate.h
@@ -180,18 +180,29 @@ public:
TemplateArgumentListBuilder &Builder,
bool TakeArgs);
+ /// TemplateArgumentList - It copies the template arguments into a locally
+ /// new[]'d array.
+ TemplateArgumentList(ASTContext &Context,
+ const TemplateArgument *Args, unsigned NumArgs);
+
/// Produces a shallow copy of the given template argument list. This
/// assumes that the input argument list outlives it. This takes the list as
/// a pointer to avoid looking like a copy constructor, since this really
/// really isn't safe to use that way.
explicit TemplateArgumentList(const TemplateArgumentList *Other);
-
+
+ TemplateArgumentList() : NumFlatArguments(0), NumStructuredArguments(0) { }
+
/// Used to release the memory associated with a TemplateArgumentList
/// object. FIXME: This is currently not called anywhere, but the
/// memory will still be freed when using a BumpPtrAllocator.
void Destroy(ASTContext &C);
~TemplateArgumentList();
+
+ /// \brief Copies the template arguments into a locally new[]'d array.
+ void init(ASTContext &Context,
+ const TemplateArgument *Args, unsigned NumArgs);
/// \brief Retrieve the template argument at a given index.
const TemplateArgument &get(unsigned Idx) const {
@@ -261,12 +272,27 @@ public:
static bool classof(const ClassTemplateDecl *D) { return true; }
static bool classof(const TemplateTemplateParmDecl *D) { return true; }
static bool classofKind(Kind K) {
- return K >= TemplateFirst && K <= TemplateLast;
+ return K >= firstTemplate && K <= lastTemplate;
+ }
+
+ SourceRange getSourceRange() const {
+ return SourceRange(TemplateParams->getTemplateLoc(),
+ TemplatedDecl->getSourceRange().getEnd());
}
protected:
NamedDecl *TemplatedDecl;
TemplateParameterList* TemplateParams;
+
+public:
+ /// \brief Initialize the underlying templated declaration and
+ /// template parameters.
+ void init(NamedDecl *templatedDecl, TemplateParameterList* templateParams) {
+ assert(TemplatedDecl == 0 && "TemplatedDecl already set!");
+ assert(TemplateParams == 0 && "TemplateParams already set!");
+ TemplatedDecl = templatedDecl;
+ TemplateParams = templateParams;
+ }
};
/// \brief Provides information about a function template specialization,
@@ -353,8 +379,9 @@ class MemberSpecializationInfo {
public:
explicit
- MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK)
- : MemberAndTSK(IF, TSK - 1), PointOfInstantiation() {
+ MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK,
+ SourceLocation POI = SourceLocation())
+ : MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) {
assert(TSK != TSK_Undeclared &&
"Cannot encode undeclared template specializations for members");
}
@@ -602,6 +629,9 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const FunctionTemplateDecl *D) { return true; }
static bool classofKind(Kind K) { return K == FunctionTemplate; }
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
//===----------------------------------------------------------------------===//
@@ -634,9 +664,11 @@ protected:
public:
/// Get the nesting depth of the template parameter.
unsigned getDepth() const { return Depth; }
+ void setDepth(unsigned D) { Depth = D; }
/// Get the position of the template parameter within its parameter list.
unsigned getPosition() const { return Position; }
+ void setPosition(unsigned P) { Position = P; }
/// Get the index of the template parameter within its parameter list.
unsigned getIndex() const { return Position; }
@@ -675,6 +707,7 @@ public:
SourceLocation L, unsigned D, unsigned P,
IdentifierInfo *Id, bool Typename,
bool ParameterPack);
+ static TemplateTypeParmDecl *Create(ASTContext &C, EmptyShell Empty);
/// \brief Whether this template type parameter was declared with
/// the 'typename' keyword. If not, it was declared with the 'class'
@@ -711,6 +744,13 @@ public:
DefaultArgument = 0;
InheritedDefault = false;
}
+
+ /// \brief Set whether this template type parameter was declared with
+ /// the 'typename' or 'class' keyword.
+ void setDeclaredWithTypename(bool withTypename) { Typename = withTypename; }
+
+ /// \brief Set whether this is a parameter pack.
+ void setParameterPack(bool isParamPack) { ParameterPack = isParamPack; }
/// \brief Retrieve the depth of the template parameter.
unsigned getDepth() const;
@@ -734,15 +774,16 @@ public:
/// @endcode
class NonTypeTemplateParmDecl
: public VarDecl, protected TemplateParmPosition {
- /// \brief The default template argument, if any.
- Expr *DefaultArgument;
+ /// \brief The default template argument, if any, and whether or not
+ /// it was inherited.
+ llvm::PointerIntPair<Expr*, 1, bool> DefaultArgumentAndInherited;
NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D,
unsigned P, IdentifierInfo *Id, QualType T,
TypeSourceInfo *TInfo)
: VarDecl(NonTypeTemplateParm, DC, L, Id, T, TInfo, VarDecl::None,
VarDecl::None),
- TemplateParmPosition(D, P), DefaultArgument(0)
+ TemplateParmPosition(D, P), DefaultArgumentAndInherited(0, false)
{ }
public:
@@ -751,22 +792,43 @@ public:
unsigned P, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo);
using TemplateParmPosition::getDepth;
+ using TemplateParmPosition::setDepth;
using TemplateParmPosition::getPosition;
+ using TemplateParmPosition::setPosition;
using TemplateParmPosition::getIndex;
/// \brief Determine whether this template parameter has a default
/// argument.
- bool hasDefaultArgument() const { return DefaultArgument; }
+ bool hasDefaultArgument() const {
+ return DefaultArgumentAndInherited.getPointer() != 0;
+ }
/// \brief Retrieve the default argument, if any.
- Expr *getDefaultArgument() const { return DefaultArgument; }
+ Expr *getDefaultArgument() const {
+ return DefaultArgumentAndInherited.getPointer();
+ }
/// \brief Retrieve the location of the default argument, if any.
SourceLocation getDefaultArgumentLoc() const;
- /// \brief Set the default argument for this template parameter.
- void setDefaultArgument(Expr *DefArg) {
- DefaultArgument = DefArg;
+ /// \brief Determines whether the default argument was inherited
+ /// from a previous declaration of this template.
+ bool defaultArgumentWasInherited() const {
+ return DefaultArgumentAndInherited.getInt();
+ }
+
+ /// \brief Set the default argument for this template parameter, and
+ /// whether that default argument was inherited from another
+ /// declaration.
+ void setDefaultArgument(Expr *DefArg, bool Inherited) {
+ DefaultArgumentAndInherited.setPointer(DefArg);
+ DefaultArgumentAndInherited.setInt(Inherited);
+ }
+
+ /// \brief Removes the default argument of this template parameter.
+ void removeDefaultArgument() {
+ DefaultArgumentAndInherited.setPointer(0);
+ DefaultArgumentAndInherited.setInt(false);
}
// Implement isa/cast/dyncast/etc.
@@ -785,14 +847,17 @@ public:
class TemplateTemplateParmDecl
: public TemplateDecl, protected TemplateParmPosition {
- /// \brief The default template argument, if any.
+ /// DefaultArgument - The default template argument, if any.
TemplateArgumentLoc DefaultArgument;
+ /// Whether or not the default argument was inherited.
+ bool DefaultArgumentWasInherited;
TemplateTemplateParmDecl(DeclContext *DC, SourceLocation L,
unsigned D, unsigned P,
IdentifierInfo *Id, TemplateParameterList *Params)
: TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
- TemplateParmPosition(D, P), DefaultArgument()
+ TemplateParmPosition(D, P), DefaultArgument(),
+ DefaultArgumentWasInherited(false)
{ }
public:
@@ -807,24 +872,45 @@ public:
/// \brief Determine whether this template parameter has a default
/// argument.
- bool hasDefaultArgument() const {
- return !DefaultArgument.getArgument().isNull();
+ bool hasDefaultArgument() const {
+ return !DefaultArgument.getArgument().isNull();
}
/// \brief Retrieve the default argument, if any.
- const TemplateArgumentLoc &getDefaultArgument() const {
- return DefaultArgument;
+ const TemplateArgumentLoc &getDefaultArgument() const {
+ return DefaultArgument;
+ }
+
+ /// \brief Retrieve the location of the default argument, if any.
+ SourceLocation getDefaultArgumentLoc() const;
+
+ /// \brief Determines whether the default argument was inherited
+ /// from a previous declaration of this template.
+ bool defaultArgumentWasInherited() const {
+ return DefaultArgumentWasInherited;
}
- /// \brief Set the default argument for this template parameter.
- void setDefaultArgument(const TemplateArgumentLoc &DefArg) {
+ /// \brief Set the default argument for this template parameter, and
+ /// whether that default argument was inherited from another
+ /// declaration.
+ void setDefaultArgument(const TemplateArgumentLoc &DefArg, bool Inherited) {
DefaultArgument = DefArg;
+ DefaultArgumentWasInherited = Inherited;
+ }
+
+ /// \brief Removes the default argument of this template parameter.
+ void removeDefaultArgument() {
+ DefaultArgument = TemplateArgumentLoc();
+ DefaultArgumentWasInherited = false;
}
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const TemplateTemplateParmDecl *D) { return true; }
static bool classofKind(Kind K) { return K == TemplateTemplateParm; }
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
/// \brief Represents a class template specialization, which refers to
@@ -860,9 +946,22 @@ class ClassTemplateSpecializationDecl
llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
SpecializedTemplate;
- /// \brief The type-as-written of an explicit template specialization.
+ /// \brief Further info for explicit template specialization/instantiation.
+ struct ExplicitSpecializationInfo {
+ /// \brief The type-as-written.
+ TypeSourceInfo *TypeAsWritten;
+ /// \brief The location of the extern keyword.
+ SourceLocation ExternLoc;
+ /// \brief The location of the template keyword.
+ SourceLocation TemplateKeywordLoc;
+
+ ExplicitSpecializationInfo()
+ : TypeAsWritten(0), ExternLoc(), TemplateKeywordLoc() {}
+ };
+
+ /// \brief Further info for explicit template specialization/instantiation.
/// Does not apply to implicit specializations.
- TypeSourceInfo *TypeAsWritten;
+ ExplicitSpecializationInfo *ExplicitInfo;
/// \brief The template arguments used to describe this specialization.
TemplateArgumentList TemplateArgs;
@@ -881,12 +980,16 @@ protected:
TemplateArgumentListBuilder &Builder,
ClassTemplateSpecializationDecl *PrevDecl);
+ explicit ClassTemplateSpecializationDecl(Kind DK);
+
public:
static ClassTemplateSpecializationDecl *
Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation L,
ClassTemplateDecl *SpecializedTemplate,
TemplateArgumentListBuilder &Builder,
ClassTemplateSpecializationDecl *PrevDecl);
+ static ClassTemplateSpecializationDecl *
+ Create(ASTContext &Context, EmptyShell Empty);
virtual void Destroy(ASTContext& C);
@@ -903,6 +1006,14 @@ public:
return TemplateArgs;
}
+ /// \brief Initialize the template arguments of the class template
+ /// specialization.
+ void initTemplateArgs(TemplateArgument *Args, unsigned NumArgs) {
+ assert(TemplateArgs.flat_size() == 0 &&
+ "Template arguments already initialized!");
+ TemplateArgs.init(getASTContext(), Args, NumArgs);
+ }
+
/// \brief Determine the kind of specialization that this
/// declaration represents.
TemplateSpecializationKind getSpecializationKind() const {
@@ -943,6 +1054,19 @@ public:
SpecializedTemplate.get<ClassTemplateDecl*>());
}
+ /// \brief Retrieve the class template or class template partial
+ /// specialization which was specialized by this.
+ llvm::PointerUnion<ClassTemplateDecl *,
+ ClassTemplatePartialSpecializationDecl *>
+ getSpecializedTemplateOrPartial() const {
+ if (SpecializedPartialSpecialization *PartialSpec
+ = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
+ return PartialSpec->PartialSpecialization;
+
+ return const_cast<ClassTemplateDecl*>(
+ SpecializedTemplate.get<ClassTemplateDecl*>());
+ }
+
/// \brief Retrieve the set of template arguments that should be used
/// to instantiate members of the class template or class template partial
/// specialization from which this class template specialization was
@@ -967,6 +1091,8 @@ public:
/// template arguments have been deduced.
void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec,
TemplateArgumentList *TemplateArgs) {
+ assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
+ "Already set to a class template partial specialization!");
SpecializedPartialSpecialization *PS
= new (getASTContext()) SpecializedPartialSpecialization();
PS->PartialSpecialization = PartialSpec;
@@ -974,17 +1100,59 @@ public:
SpecializedTemplate = PS;
}
+ /// \brief Note that this class template specialization is actually an
+ /// instantiation of the given class template partial specialization whose
+ /// template arguments have been deduced.
+ void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec,
+ TemplateArgument *TemplateArgs,
+ unsigned NumTemplateArgs) {
+ ASTContext &Ctx = getASTContext();
+ setInstantiationOf(PartialSpec,
+ new (Ctx) TemplateArgumentList(Ctx, TemplateArgs,
+ NumTemplateArgs));
+ }
+
+ /// \brief Note that this class template specialization is an instantiation
+ /// of the given class template.
+ void setInstantiationOf(ClassTemplateDecl *TemplDecl) {
+ assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
+ "Previously set to a class template partial specialization!");
+ SpecializedTemplate = TemplDecl;
+ }
+
/// \brief Sets the type of this specialization as it was written by
/// the user. This will be a class template specialization type.
void setTypeAsWritten(TypeSourceInfo *T) {
- TypeAsWritten = T;
+ if (!ExplicitInfo) ExplicitInfo = new ExplicitSpecializationInfo;
+ ExplicitInfo->TypeAsWritten = T;
}
-
/// \brief Gets the type of this specialization as it was written by
/// the user, if it was so written.
TypeSourceInfo *getTypeAsWritten() const {
- return TypeAsWritten;
+ return ExplicitInfo ? ExplicitInfo->TypeAsWritten : 0;
+ }
+
+ /// \brief Gets the location of the extern keyword, if present.
+ SourceLocation getExternLoc() const {
+ return ExplicitInfo ? ExplicitInfo->ExternLoc : SourceLocation();
+ }
+ /// \brief Sets the location of the extern keyword.
+ void setExternLoc(SourceLocation Loc) {
+ if (!ExplicitInfo) ExplicitInfo = new ExplicitSpecializationInfo;
+ ExplicitInfo->ExternLoc = Loc;
+ }
+
+ /// \brief Sets the location of the template keyword.
+ void setTemplateKeywordLoc(SourceLocation Loc) {
+ if (!ExplicitInfo) ExplicitInfo = new ExplicitSpecializationInfo;
+ ExplicitInfo->TemplateKeywordLoc = Loc;
}
+ /// \brief Gets the location of the template keyword, if present.
+ SourceLocation getTemplateKeywordLoc() const {
+ return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc : SourceLocation();
+ }
+
+ SourceLocation getInnerLocStart() const { return getTemplateKeywordLoc(); }
void Profile(llvm::FoldingSetNodeID &ID) const {
Profile(ID, TemplateArgs.getFlatArgumentList(), TemplateArgs.flat_size(),
@@ -1001,8 +1169,8 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classofKind(Kind K) {
- return K == ClassTemplateSpecialization ||
- K == ClassTemplatePartialSpecialization;
+ return K >= firstClassTemplateSpecialization &&
+ K <= lastClassTemplateSpecialization;
}
static bool classof(const ClassTemplateSpecializationDecl *) {
@@ -1053,6 +1221,12 @@ class ClassTemplatePartialSpecializationDecl
TemplateParams(Params), ArgsAsWritten(ArgInfos),
NumArgsAsWritten(NumArgInfos), SequenceNumber(SequenceNumber),
InstantiatedFromMember(0, false) { }
+
+ ClassTemplatePartialSpecializationDecl()
+ : ClassTemplateSpecializationDecl(ClassTemplatePartialSpecialization),
+ TemplateParams(0), ArgsAsWritten(0),
+ NumArgsAsWritten(0), SequenceNumber(0),
+ InstantiatedFromMember(0, false) { }
public:
static ClassTemplatePartialSpecializationDecl *
@@ -1065,16 +1239,26 @@ public:
ClassTemplatePartialSpecializationDecl *PrevDecl,
unsigned SequenceNumber);
+ static ClassTemplatePartialSpecializationDecl *
+ Create(ASTContext &Context, EmptyShell Empty);
+
/// Get the list of template parameters
TemplateParameterList *getTemplateParameters() const {
return TemplateParams;
}
+ void initTemplateParameters(TemplateParameterList *Params) {
+ assert(TemplateParams == 0 && "TemplateParams already set");
+ TemplateParams = Params;
+ }
+
/// Get the template arguments as written.
TemplateArgumentLoc *getTemplateArgsAsWritten() const {
return ArgsAsWritten;
}
+ void initTemplateArgsAsWritten(const TemplateArgumentListInfo &ArgInfos);
+
/// Get the number of template arguments as written.
unsigned getNumTemplateArgsAsWritten() const {
return NumArgsAsWritten;
@@ -1083,6 +1267,7 @@ public:
/// \brief Get the sequence number for this class template partial
/// specialization.
unsigned getSequenceNumber() const { return SequenceNumber; }
+ void setSequenceNumber(unsigned N) { SequenceNumber = N; }
/// \brief Retrieve the member class template partial specialization from
/// which this particular class template partial specialization was
@@ -1199,26 +1384,19 @@ protected:
llvm::PointerIntPair<ClassTemplateDecl *, 1, bool> InstantiatedFromMember;
};
- // FIXME: Combine PreviousDeclaration with CommonPtr, as in
- // FunctionTemplateDecl.
-
- /// \brief Previous declaration of this class template.
- ClassTemplateDecl *PreviousDeclaration;
+ /// \brief A pointer to the previous declaration (if this is a redeclaration)
+ /// or to the data that is common to all declarations of this class template.
+ llvm::PointerUnion<Common*, ClassTemplateDecl*> CommonOrPrev;
- /// \brief Pointer to the data that is common to all of the
- /// declarations of this class template.
- ///
- /// The first declaration of a class template (e.g., the declaration
- /// with no "previous declaration") owns this pointer.
- Common *CommonPtr;
+ /// \brief Retrieves the "common" pointer shared by all
+ /// (re-)declarations of the same class template. Calling this routine
+ /// may implicitly allocate memory for the common pointer.
+ Common *getCommonPtr();
ClassTemplateDecl(DeclContext *DC, SourceLocation L, DeclarationName Name,
- TemplateParameterList *Params, NamedDecl *Decl,
- ClassTemplateDecl *PrevDecl, Common *CommonPtr)
+ TemplateParameterList *Params, NamedDecl *Decl)
: TemplateDecl(ClassTemplate, DC, L, Name, Params, Decl),
- PreviousDeclaration(PrevDecl), CommonPtr(CommonPtr) { }
-
- ~ClassTemplateDecl();
+ CommonOrPrev((Common*)0) { }
public:
/// Get the underlying class declarations of the template.
@@ -1226,13 +1404,30 @@ public:
return static_cast<CXXRecordDecl *>(TemplatedDecl);
}
- /// \brief Retrieve the previous declaration of this template.
- ClassTemplateDecl *getPreviousDeclaration() const {
- return PreviousDeclaration;
+ /// \brief Retrieve the previous declaration of this class template, or
+ /// NULL if no such declaration exists.
+ const ClassTemplateDecl *getPreviousDeclaration() const {
+ return CommonOrPrev.dyn_cast<ClassTemplateDecl*>();
+ }
+
+ /// \brief Retrieve the previous declaration of this function template, or
+ /// NULL if no such declaration exists.
+ ClassTemplateDecl *getPreviousDeclaration() {
+ return CommonOrPrev.dyn_cast<ClassTemplateDecl*>();
+ }
+
+ /// \brief Set the previous declaration of this class template.
+ void setPreviousDeclaration(ClassTemplateDecl *Prev) {
+ if (Prev)
+ CommonOrPrev = Prev;
}
virtual ClassTemplateDecl *getCanonicalDecl();
+ const ClassTemplateDecl *getCanonicalDecl() const {
+ return const_cast<ClassTemplateDecl*>(this)->getCanonicalDecl();
+ }
+
/// Create a class template node.
static ClassTemplateDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
@@ -1243,14 +1438,14 @@ public:
/// \brief Retrieve the set of specializations of this class template.
llvm::FoldingSet<ClassTemplateSpecializationDecl> &getSpecializations() {
- return CommonPtr->Specializations;
+ return getCommonPtr()->Specializations;
}
/// \brief Retrieve the set of partial specializations of this class
/// template.
llvm::FoldingSet<ClassTemplatePartialSpecializationDecl> &
getPartialSpecializations() {
- return CommonPtr->PartialSpecializations;
+ return getCommonPtr()->PartialSpecializations;
}
/// \brief Retrieve the partial specializations as an ordered list.
@@ -1281,7 +1476,7 @@ public:
/// typedef array this_type; // "array" is equivalent to "array<T, N>"
/// };
/// \endcode
- QualType getInjectedClassNameSpecialization(ASTContext &Context);
+ QualType getInjectedClassNameSpecialization();
/// \brief Retrieve the member class template that this class template was
/// derived from.
@@ -1303,13 +1498,13 @@ public:
/// X<T>::A<U>, a TemplateClassDecl (whose parent is X<T>, also a TCD).
///
/// \returns null if this is not an instantiation of a member class template.
- ClassTemplateDecl *getInstantiatedFromMemberTemplate() const {
- return CommonPtr->InstantiatedFromMember.getPointer();
+ ClassTemplateDecl *getInstantiatedFromMemberTemplate() {
+ return getCommonPtr()->InstantiatedFromMember.getPointer();
}
void setInstantiatedFromMemberTemplate(ClassTemplateDecl *CTD) {
- assert(!CommonPtr->InstantiatedFromMember.getPointer());
- CommonPtr->InstantiatedFromMember.setPointer(CTD);
+ assert(!getCommonPtr()->InstantiatedFromMember.getPointer());
+ getCommonPtr()->InstantiatedFromMember.setPointer(CTD);
}
/// \brief Determines whether this template was a specialization of a
@@ -1328,14 +1523,14 @@ public:
/// struct X<int>::Inner { /* ... */ };
/// \endcode
bool isMemberSpecialization() {
- return CommonPtr->InstantiatedFromMember.getInt();
+ return getCommonPtr()->InstantiatedFromMember.getInt();
}
/// \brief Note that this member template is a specialization.
void setMemberSpecialization() {
- assert(CommonPtr->InstantiatedFromMember.getPointer() &&
+ assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&
"Only member templates can be member template specializations");
- CommonPtr->InstantiatedFromMember.setInt(true);
+ getCommonPtr()->InstantiatedFromMember.setInt(true);
}
// Implement isa/cast/dyncast support
@@ -1344,6 +1539,9 @@ public:
static bool classofKind(Kind K) { return K == ClassTemplate; }
virtual void Destroy(ASTContext& C);
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
/// Declaration of a friend template. For example:
diff --git a/include/clang/AST/DeclVisitor.h b/include/clang/AST/DeclVisitor.h
index 140e5c0a2a99..aee1998028eb 100644
--- a/include/clang/AST/DeclVisitor.h
+++ b/include/clang/AST/DeclVisitor.h
@@ -30,20 +30,19 @@ class DeclVisitor {
public:
RetTy Visit(Decl *D) {
switch (D->getKind()) {
- default: assert(false && "Decl that isn't part of DeclNodes.def!");
-#define DECL(Derived, Base) \
- case Decl::Derived: DISPATCH(Derived##Decl, Derived##Decl);
-#define ABSTRACT_DECL(Derived, Base)
-#include "clang/AST/DeclNodes.def"
+ default: assert(false && "Decl that isn't part of DeclNodes.inc!");
+#define DECL(DERIVED, BASE) \
+ case Decl::DERIVED: DISPATCH(DERIVED##Decl, DERIVED##Decl);
+#define ABSTRACT_DECL(DECL)
+#include "clang/AST/DeclNodes.inc"
}
}
// If the implementation chooses not to implement a certain visit
// method, fall back to the parent.
-#define DECL(Derived, Base) \
- RetTy Visit##Derived##Decl(Derived##Decl *D) { DISPATCH(Base, Base); }
-#define ABSTRACT_DECL(Derived, Base) DECL(Derived, Base)
-#include "clang/AST/DeclNodes.def"
+#define DECL(DERIVED, BASE) \
+ RetTy Visit##DERIVED##Decl(DERIVED##Decl *D) { DISPATCH(BASE, BASE); }
+#include "clang/AST/DeclNodes.inc"
RetTy VisitDecl(Decl *D) { return RetTy(); }
};
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 66639e2ef733..807644349e56 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -162,9 +162,6 @@ public:
};
isLvalueResult isLvalue(ASTContext &Ctx) const;
- // Same as above, but excluding checks for non-object and void types in C
- isLvalueResult isLvalueInternal(ASTContext &Ctx) const;
-
/// isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type,
/// does not have an incomplete type, does not have a const-qualified type,
/// and if it is a structure or union, does not have any member (including,
@@ -194,6 +191,95 @@ public:
isModifiableLvalueResult isModifiableLvalue(ASTContext &Ctx,
SourceLocation *Loc = 0) const;
+ /// \brief The return type of classify(). Represents the C++0x expression
+ /// taxonomy.
+ class Classification {
+ public:
+ /// \brief The various classification results. Most of these mean prvalue.
+ enum Kinds {
+ CL_LValue,
+ CL_XValue,
+ CL_Function, // Functions cannot be lvalues in C.
+ CL_Void, // Void cannot be an lvalue in C.
+ CL_DuplicateVectorComponents, // A vector shuffle with dupes.
+ CL_MemberFunction, // An expression referring to a member function
+ CL_SubObjCPropertySetting,
+ CL_ClassTemporary, // A prvalue of class type
+ CL_PRValue // A prvalue for any other reason, of any other type
+ };
+ /// \brief The results of modification testing.
+ enum ModifiableType {
+ CM_Untested, // testModifiable was false.
+ CM_Modifiable,
+ CM_RValue, // Not modifiable because it's an rvalue
+ CM_Function, // Not modifiable because it's a function; C++ only
+ CM_LValueCast, // Same as CM_RValue, but indicates GCC cast-as-lvalue ext
+ CM_NotBlockQualified, // Not captured in the closure
+ CM_NoSetterProperty,// Implicit assignment to ObjC property without setter
+ CM_ConstQualified,
+ CM_ArrayType,
+ CM_IncompleteType
+ };
+
+ private:
+ friend class Expr;
+
+ unsigned short Kind;
+ unsigned short Modifiable;
+
+ explicit Classification(Kinds k, ModifiableType m)
+ : Kind(k), Modifiable(m)
+ {}
+
+ public:
+ Classification() {}
+
+ Kinds getKind() const { return static_cast<Kinds>(Kind); }
+ ModifiableType getModifiable() const {
+ assert(Modifiable != CM_Untested && "Did not test for modifiability.");
+ return static_cast<ModifiableType>(Modifiable);
+ }
+ bool isLValue() const { return Kind == CL_LValue; }
+ bool isXValue() const { return Kind == CL_XValue; }
+ bool isGLValue() const { return Kind <= CL_XValue; }
+ bool isPRValue() const { return Kind >= CL_Function; }
+ bool isRValue() const { return Kind >= CL_XValue; }
+ bool isModifiable() const { return getModifiable() == CM_Modifiable; }
+ };
+ /// \brief classify - Classify this expression according to the C++0x
+ /// expression taxonomy.
+ ///
+ /// C++0x defines ([basic.lval]) a new taxonomy of expressions to replace the
+ /// old lvalue vs rvalue. This function determines the type of expression this
+ /// is. There are three expression types:
+ /// - lvalues are classical lvalues as in C++03.
+ /// - prvalues are equivalent to rvalues in C++03.
+ /// - xvalues are expressions yielding unnamed rvalue references, e.g. a
+ /// function returning an rvalue reference.
+ /// lvalues and xvalues are collectively referred to as glvalues, while
+ /// prvalues and xvalues together form rvalues.
+ /// If a
+ Classification Classify(ASTContext &Ctx) const {
+ return ClassifyImpl(Ctx, 0);
+ }
+
+ /// \brief classifyModifiable - Classify this expression according to the
+ /// C++0x expression taxonomy, and see if it is valid on the left side
+ /// of an assignment.
+ ///
+ /// This function extends classify in that it also tests whether the
+ /// expression is modifiable (C99 6.3.2.1p1).
+ /// \param Loc A source location that might be filled with a relevant location
+ /// if the expression is not modifiable.
+ Classification ClassifyModifiable(ASTContext &Ctx, SourceLocation &Loc) const{
+ return ClassifyImpl(Ctx, &Loc);
+ }
+
+private:
+ Classification ClassifyImpl(ASTContext &Ctx, SourceLocation *Loc) const;
+
+public:
+
/// \brief If this expression refers to a bit-field, retrieve the
/// declaration of that bit-field.
FieldDecl *getBitField();
@@ -414,6 +500,7 @@ struct ExplicitTemplateArgumentList {
void initializeFrom(const TemplateArgumentListInfo &List);
void copyInto(TemplateArgumentListInfo &List) const;
+ static std::size_t sizeFor(unsigned NumTemplateArgs);
static std::size_t sizeFor(const TemplateArgumentListInfo &List);
};
@@ -474,27 +561,21 @@ class DeclRefExpr : public Expr {
ValueDecl *D, SourceLocation NameLoc,
const TemplateArgumentListInfo *TemplateArgs,
QualType T);
+
+ /// \brief Construct an empty declaration reference expression.
+ explicit DeclRefExpr(EmptyShell Empty)
+ : Expr(DeclRefExprClass, Empty) { }
-protected:
/// \brief Computes the type- and value-dependence flags for this
/// declaration reference expression.
void computeDependence();
- DeclRefExpr(StmtClass SC, ValueDecl *d, QualType t, SourceLocation l) :
- Expr(SC, t, false, false), DecoratedD(d, 0), Loc(l) {
- computeDependence();
- }
-
public:
DeclRefExpr(ValueDecl *d, QualType t, SourceLocation l) :
Expr(DeclRefExprClass, t, false, false), DecoratedD(d, 0), Loc(l) {
computeDependence();
}
- /// \brief Construct an empty declaration reference expression.
- explicit DeclRefExpr(EmptyShell Empty)
- : Expr(DeclRefExprClass, Empty) { }
-
static DeclRefExpr *Create(ASTContext &Context,
NestedNameSpecifier *Qualifier,
SourceRange QualifierRange,
@@ -502,6 +583,10 @@ public:
SourceLocation NameLoc,
QualType T,
const TemplateArgumentListInfo *TemplateArgs = 0);
+
+ /// \brief Construct an empty declaration reference expression.
+ static DeclRefExpr *CreateEmpty(ASTContext &Context,
+ bool HasQualifier, unsigned NumTemplateArgs);
ValueDecl *getDecl() { return DecoratedD.getPointer(); }
const ValueDecl *getDecl() const { return DecoratedD.getPointer(); }
@@ -591,6 +676,9 @@ public:
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+ friend class PCHStmtReader;
+ friend class PCHStmtWriter;
};
/// PredefinedExpr - [C99 6.4.2.2] - A predefined identifier such as __func__.
@@ -1560,11 +1648,6 @@ public:
Base(base), MemberDecl(memberdecl), MemberLoc(l), IsArrow(isarrow),
HasQualifierOrFoundDecl(false), HasExplicitTemplateArgumentList(false) {}
- /// \brief Build an empty member reference expression.
- explicit MemberExpr(EmptyShell Empty)
- : Expr(MemberExprClass, Empty), HasQualifierOrFoundDecl(false),
- HasExplicitTemplateArgumentList(false) { }
-
static MemberExpr *Create(ASTContext &C, Expr *base, bool isarrow,
NestedNameSpecifier *qual, SourceRange qualrange,
ValueDecl *memberdecl, DeclAccessPair founddecl,
@@ -1937,6 +2020,7 @@ public:
}
const CXXBaseSpecifierArray& getBasePath() const { return BasePath; }
+ CXXBaseSpecifierArray& getBasePath() { return BasePath; }
static bool classof(const Stmt *T) {
return T->getStmtClass() >= firstCastExprConstant &&
@@ -2169,7 +2253,8 @@ public:
/// predicates to categorize the respective opcodes.
bool isMultiplicativeOp() const { return Opc >= Mul && Opc <= Rem; }
- bool isAdditiveOp() const { return Opc == Add || Opc == Sub; }
+ static bool isAdditiveOp(Opcode Opc) { return Opc == Add || Opc == Sub; }
+ bool isAdditiveOp() const { return isAdditiveOp(Opc); }
static bool isShiftOp(Opcode Opc) { return Opc == Shl || Opc == Shr; }
bool isShiftOp() const { return isShiftOp(Opc); }
@@ -3153,7 +3238,7 @@ public:
~ParenListExpr() {}
/// \brief Build an empty paren list.
- //explicit ParenListExpr(EmptyShell Empty) : Expr(ParenListExprClass, Empty) { }
+ explicit ParenListExpr(EmptyShell Empty) : Expr(ParenListExprClass, Empty) { }
unsigned getNumExprs() const { return NumExprs; }
@@ -3183,6 +3268,9 @@ public:
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+ friend class PCHStmtReader;
+ friend class PCHStmtWriter;
};
@@ -3305,12 +3393,15 @@ class BlockDeclRefExpr : public Expr {
SourceLocation Loc;
bool IsByRef : 1;
bool ConstQualAdded : 1;
+ Stmt *CopyConstructorVal;
public:
// FIXME: Fix type/value dependence!
BlockDeclRefExpr(ValueDecl *d, QualType t, SourceLocation l, bool ByRef,
- bool constAdded = false)
- : Expr(BlockDeclRefExprClass, t, false, false), D(d), Loc(l), IsByRef(ByRef),
- ConstQualAdded(constAdded) {}
+ bool constAdded = false,
+ Stmt *copyConstructorVal = 0)
+ : Expr(BlockDeclRefExprClass, t, (!t.isNull() && t->isDependentType()),false),
+ D(d), Loc(l), IsByRef(ByRef),
+ ConstQualAdded(constAdded), CopyConstructorVal(copyConstructorVal) {}
// \brief Build an empty reference to a declared variable in a
// block.
@@ -3331,6 +3422,12 @@ public:
bool isConstQualAdded() const { return ConstQualAdded; }
void setConstQualAdded(bool C) { ConstQualAdded = C; }
+
+ const Expr *getCopyConstructorExpr() const
+ { return cast_or_null<Expr>(CopyConstructorVal); }
+ Expr *getCopyConstructorExpr()
+ { return cast_or_null<Expr>(CopyConstructorVal); }
+ void setCopyConstructorExpr(Expr *E) { CopyConstructorVal = E; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == BlockDeclRefExprClass;
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h
index 0c493f36df09..b9553815d8eb 100644
--- a/include/clang/AST/ExprCXX.h
+++ b/include/clang/AST/ExprCXX.h
@@ -465,7 +465,6 @@ class CXXDefaultArgExpr : public Expr {
/// \brief The location where the default argument expression was used.
SourceLocation Loc;
-protected:
CXXDefaultArgExpr(StmtClass SC, SourceLocation Loc, ParmVarDecl *param)
: Expr(SC,
param->hasUnparsedDefaultArg()
@@ -504,9 +503,6 @@ public:
// Retrieve the parameter that the argument was created from.
const ParmVarDecl *getParam() const { return Param.getPointer(); }
ParmVarDecl *getParam() { return Param.getPointer(); }
-
- /// isExprStored - Return true if this expression owns the expression.
- bool isExprStored() const { return Param.getInt(); }
// Retrieve the actual argument to the function call.
const Expr *getExpr() const {
@@ -519,16 +515,10 @@ public:
return *reinterpret_cast<Expr **> (this + 1);
return getParam()->getDefaultArg();
}
-
- void setExpr(Expr *E) {
- Param.setInt(true);
- Param.setPointer((ParmVarDecl*)E);
- }
/// \brief Retrieve the location where this default argument was actually
/// used.
SourceLocation getUsedLocation() const { return Loc; }
- void setUsedLocation(SourceLocation L) { Loc = L; }
virtual SourceRange getSourceRange() const {
// Default argument expressions have no representation in the
@@ -544,6 +534,9 @@ public:
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+ friend class PCHStmtReader;
+ friend class PCHStmtWriter;
};
/// CXXTemporary - Represents a C++ temporary.
@@ -655,6 +648,9 @@ public:
static CXXBindReferenceExpr *Create(ASTContext &C, Expr *SubExpr,
bool ExtendsLifetime,
bool RequiresTemporaryCopy);
+
+ explicit CXXBindReferenceExpr(EmptyShell Empty)
+ : Expr(CXXBindReferenceExprClass, Empty) { }
const Expr *getSubExpr() const { return cast<Expr>(SubExpr); }
Expr *getSubExpr() { return cast<Expr>(SubExpr); }
@@ -670,7 +666,7 @@ public:
// extendsLifetime - Whether binding this reference extends the lifetime of
// the expression being bound. FIXME: Add C++ reference.
- bool extendsLifetime() { return ExtendsLifetime; }
+ bool extendsLifetime() const { return ExtendsLifetime; }
// Implement isa/cast/dyncast/etc.
static bool classof(const Stmt *T) {
@@ -681,6 +677,8 @@ public:
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+ friend class PCHStmtReader;
};
/// CXXConstructExpr - Represents a call to a C++ constructor.
@@ -711,13 +709,20 @@ protected:
ConstructionKind ConstructKind = CK_Complete);
~CXXConstructExpr() { }
+ /// \brief Construct an empty C++ construction expression.
+ CXXConstructExpr(StmtClass SC, EmptyShell Empty)
+ : Expr(SC, Empty), Constructor(0), Elidable(0), ZeroInitialization(0),
+ ConstructKind(0), Args(0), NumArgs(0) { }
+
virtual void DoDestroy(ASTContext &C);
public:
- /// \brief Construct an empty C++ construction expression that will store
- /// \p numargs arguments.
- CXXConstructExpr(EmptyShell Empty, ASTContext &C, unsigned numargs);
-
+ /// \brief Construct an empty C++ construction expression.
+ explicit CXXConstructExpr(EmptyShell Empty)
+ : Expr(CXXConstructExprClass, Empty), Constructor(0),
+ Elidable(0), ZeroInitialization(0),
+ ConstructKind(0), Args(0), NumArgs(0) { }
+
static CXXConstructExpr *Create(ASTContext &C, QualType T,
SourceLocation Loc,
CXXConstructorDecl *D, bool Elidable,
@@ -790,6 +795,8 @@ public:
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+ friend class PCHStmtReader;
};
/// CXXFunctionalCastExpr - Represents an explicit C++ type conversion
@@ -829,12 +836,8 @@ public:
///
/// This expression type represents a C++ "functional" cast
/// (C++[expr.type.conv]) with N != 1 arguments that invokes a
-/// constructor to build a temporary object. If N == 0 but no
-/// constructor will be called (because the functional cast is
-/// performing a value-initialized an object whose class type has no
-/// user-declared constructors), CXXZeroInitValueExpr will represent
-/// the functional cast. Finally, with N == 1 arguments the functional
-/// cast expression will be represented by CXXFunctionalCastExpr.
+/// constructor to build a temporary object. With N == 1 arguments the
+/// functional cast expression will be represented by CXXFunctionalCastExpr.
/// Example:
/// @code
/// struct X { X(int, float); }
@@ -853,6 +856,8 @@ public:
Expr **Args,unsigned NumArgs,
SourceLocation rParenLoc,
bool ZeroInitialization = false);
+ explicit CXXTemporaryObjectExpr(EmptyShell Empty)
+ : CXXConstructExpr(CXXTemporaryObjectExprClass, Empty) { }
~CXXTemporaryObjectExpr() { }
@@ -866,24 +871,25 @@ public:
return T->getStmtClass() == CXXTemporaryObjectExprClass;
}
static bool classof(const CXXTemporaryObjectExpr *) { return true; }
+
+ friend class PCHStmtReader;
};
-/// CXXZeroInitValueExpr - [C++ 5.2.3p2]
+/// CXXScalarValueInitExpr - [C++ 5.2.3p2]
/// Expression "T()" which creates a value-initialized rvalue of type
-/// T, which is either a non-class type or a class type without any
-/// user-defined constructors.
+/// T, which is a non-class type.
///
-class CXXZeroInitValueExpr : public Expr {
+class CXXScalarValueInitExpr : public Expr {
SourceLocation TyBeginLoc;
SourceLocation RParenLoc;
public:
- CXXZeroInitValueExpr(QualType ty, SourceLocation tyBeginLoc,
+ CXXScalarValueInitExpr(QualType ty, SourceLocation tyBeginLoc,
SourceLocation rParenLoc ) :
- Expr(CXXZeroInitValueExprClass, ty, false, false),
+ Expr(CXXScalarValueInitExprClass, ty, false, false),
TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {}
- explicit CXXZeroInitValueExpr(EmptyShell Shell)
- : Expr(CXXZeroInitValueExprClass, Shell) { }
+ explicit CXXScalarValueInitExpr(EmptyShell Shell)
+ : Expr(CXXScalarValueInitExprClass, Shell) { }
SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
SourceLocation getRParenLoc() const { return RParenLoc; }
@@ -902,9 +908,9 @@ public:
}
static bool classof(const Stmt *T) {
- return T->getStmtClass() == CXXZeroInitValueExprClass;
+ return T->getStmtClass() == CXXScalarValueInitExprClass;
}
- static bool classof(const CXXZeroInitValueExpr *) { return true; }
+ static bool classof(const CXXScalarValueInitExpr *) { return true; }
// Iterators
virtual child_iterator child_begin();
@@ -916,15 +922,13 @@ public:
class CXXNewExpr : public Expr {
// Was the usage ::new, i.e. is the global new to be used?
bool GlobalNew : 1;
- // Was the form (type-id) used? Otherwise, it was new-type-id.
- bool ParenTypeId : 1;
// Is there an initializer? If not, built-ins are uninitialized, else they're
// value-initialized.
bool Initializer : 1;
// Do we allocate an array? If so, the first SubExpr is the size expression.
bool Array : 1;
// The number of placement new arguments.
- unsigned NumPlacementArgs : 14;
+ unsigned NumPlacementArgs : 15;
// The number of constructor arguments. This may be 1 even for non-class
// types; use the pseudo copy constructor.
unsigned NumConstructorArgs : 14;
@@ -941,12 +945,18 @@ class CXXNewExpr : public Expr {
// Must be null for all other types.
CXXConstructorDecl *Constructor;
+ /// \brief If the allocated type was expressed as a parenthesized type-id,
+ /// the source range covering the parenthesized type-id.
+ SourceRange TypeIdParens;
+
SourceLocation StartLoc;
SourceLocation EndLoc;
+ friend class PCHStmtReader;
public:
CXXNewExpr(ASTContext &C, bool globalNew, FunctionDecl *operatorNew,
- Expr **placementArgs, unsigned numPlaceArgs, bool ParenTypeId,
+ Expr **placementArgs, unsigned numPlaceArgs,
+ SourceRange TypeIdParens,
Expr *arraySize, CXXConstructorDecl *constructor, bool initializer,
Expr **constructorArgs, unsigned numConsArgs,
FunctionDecl *operatorDelete, QualType ty,
@@ -989,10 +999,11 @@ public:
return cast<Expr>(SubExprs[Array + i]);
}
+ bool isParenTypeId() const { return TypeIdParens.isValid(); }
+ SourceRange getTypeIdParens() const { return TypeIdParens; }
+
bool isGlobalNew() const { return GlobalNew; }
void setGlobalNew(bool V) { GlobalNew = V; }
- bool isParenTypeId() const { return ParenTypeId; }
- void setParenTypeId(bool V) { ParenTypeId = V; }
bool hasInitializer() const { return Initializer; }
void setHasInitializer(bool V) { Initializer = V; }
@@ -1082,18 +1093,26 @@ public:
: Expr(CXXDeleteExprClass, ty, false, false), GlobalDelete(globalDelete),
ArrayForm(arrayForm), OperatorDelete(operatorDelete), Argument(arg),
Loc(loc) { }
+ explicit CXXDeleteExpr(EmptyShell Shell)
+ : Expr(CXXDeleteExprClass, Shell), OperatorDelete(0), Argument(0) { }
bool isGlobalDelete() const { return GlobalDelete; }
bool isArrayForm() const { return ArrayForm; }
+
+ void setGlobalDelete(bool V) { GlobalDelete = V; }
+ void setArrayForm(bool V) { ArrayForm = V; }
FunctionDecl *getOperatorDelete() const { return OperatorDelete; }
+ void setOperatorDelete(FunctionDecl *D) { OperatorDelete = D; }
Expr *getArgument() { return cast<Expr>(Argument); }
const Expr *getArgument() const { return cast<Expr>(Argument); }
+ void setArgument(Expr *E) { Argument = E; }
virtual SourceRange getSourceRange() const {
return SourceRange(Loc, Argument->getLocEnd());
}
+ void setStartLoc(SourceLocation L) { Loc = L; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXDeleteExprClass;
@@ -1215,6 +1234,10 @@ public:
ScopeType(ScopeType), ColonColonLoc(ColonColonLoc), TildeLoc(TildeLoc),
DestroyedType(DestroyedType) { }
+ explicit CXXPseudoDestructorExpr(EmptyShell Shell)
+ : Expr(CXXPseudoDestructorExprClass, Shell),
+ Base(0), IsArrow(false), Qualifier(0), ScopeType(0) { }
+
void setBase(Expr *E) { Base = E; }
Expr *getBase() const { return cast<Expr>(Base); }
@@ -1227,11 +1250,13 @@ public:
/// the nested-name-specifier that precedes the member name. Otherwise,
/// returns an empty source range.
SourceRange getQualifierRange() const { return QualifierRange; }
+ void setQualifierRange(SourceRange R) { QualifierRange = R; }
/// \brief If the member name was qualified, retrieves the
/// nested-name-specifier that precedes the member name. Otherwise, returns
/// NULL.
NestedNameSpecifier *getQualifier() const { return Qualifier; }
+ void setQualifier(NestedNameSpecifier *NNS) { Qualifier = NNS; }
/// \brief Determine whether this pseudo-destructor expression was written
/// using an '->' (otherwise, it used a '.').
@@ -1240,6 +1265,7 @@ public:
/// \brief Retrieve the location of the '.' or '->' operator.
SourceLocation getOperatorLoc() const { return OperatorLoc; }
+ void setOperatorLoc(SourceLocation L) { OperatorLoc = L; }
/// \brief Retrieve the scope type in a qualified pseudo-destructor
/// expression.
@@ -1251,13 +1277,16 @@ public:
/// nested-name-specifier. It is stored as the "scope type" of the pseudo-
/// destructor expression.
TypeSourceInfo *getScopeTypeInfo() const { return ScopeType; }
+ void setScopeTypeInfo(TypeSourceInfo *Info) { ScopeType = Info; }
/// \brief Retrieve the location of the '::' in a qualified pseudo-destructor
/// expression.
SourceLocation getColonColonLoc() const { return ColonColonLoc; }
+ void setColonColonLoc(SourceLocation L) { ColonColonLoc = L; }
/// \brief Retrieve the location of the '~'.
SourceLocation getTildeLoc() const { return TildeLoc; }
+ void setTildeLoc(SourceLocation L) { TildeLoc = L; }
/// \brief Retrieve the source location information for the type
/// being destroyed.
@@ -1285,6 +1314,17 @@ public:
return DestroyedType.getLocation();
}
+ /// \brief Set the name of destroyed type for a dependent pseudo-destructor
+ /// expression.
+ void setDestroyedType(IdentifierInfo *II, SourceLocation Loc) {
+ DestroyedType = PseudoDestructorTypeStorage(II, Loc);
+ }
+
+ /// \brief Set the destroyed type.
+ void setDestroyedType(TypeSourceInfo *Info) {
+ DestroyedType = PseudoDestructorTypeStorage(Info);
+ }
+
virtual SourceRange getSourceRange() const;
static bool classof(const Stmt *T) {
@@ -1321,6 +1361,9 @@ public:
: Expr(UnaryTypeTraitExprClass, ty, false, queried->isDependentType()),
UTT(utt), Loc(loc), RParen(rparen), QueriedType(queried) { }
+ explicit UnaryTypeTraitExpr(EmptyShell Empty)
+ : Expr(UnaryTypeTraitExprClass, Empty), UTT((UnaryTypeTrait)0) { }
+
virtual SourceRange getSourceRange() const { return SourceRange(Loc, RParen);}
UnaryTypeTrait getTrait() const { return UTT; }
@@ -1337,6 +1380,8 @@ public:
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+ friend class PCHStmtReader;
};
/// \brief A reference to an overloaded function set, either an
@@ -1361,16 +1406,20 @@ class OverloadExpr : public Expr {
/// The location of the name.
SourceLocation NameLoc;
+protected:
/// True if the name was a template-id.
bool HasExplicitTemplateArgs;
-protected:
OverloadExpr(StmtClass K, ASTContext &C, QualType T, bool Dependent,
NestedNameSpecifier *Qualifier, SourceRange QRange,
DeclarationName Name, SourceLocation NameLoc,
bool HasTemplateArgs,
UnresolvedSetIterator Begin, UnresolvedSetIterator End);
+ OverloadExpr(StmtClass K, EmptyShell Empty)
+ : Expr(K, Empty), Results(0), NumResults(0),
+ Qualifier(0), HasExplicitTemplateArgs(false) { }
+
public:
/// Computes whether an unresolved lookup on the given declarations
/// and optional template arguments is type- and value-dependent.
@@ -1401,6 +1450,9 @@ public:
decls_iterator decls_end() const {
return UnresolvedSetIterator(Results + NumResults);
}
+
+ void initializeResults(ASTContext &C,
+ UnresolvedSetIterator Begin,UnresolvedSetIterator End);
/// Gets the number of declarations in the unresolved set.
unsigned getNumDecls() const { return NumResults; }
@@ -1415,9 +1467,11 @@ public:
/// Fetches the nested-name qualifier, if one was given.
NestedNameSpecifier *getQualifier() const { return Qualifier; }
+ void setQualifier(NestedNameSpecifier *NNS) { Qualifier = NNS; }
/// Fetches the range of the nested-name qualifier.
SourceRange getQualifierRange() const { return QualifierRange; }
+ void setQualifierRange(SourceRange R) { QualifierRange = R; }
/// \brief Determines whether this expression had an explicit
/// template argument list, e.g. f<int>.
@@ -1480,6 +1534,11 @@ class UnresolvedLookupExpr : public OverloadExpr {
RequiresADL(RequiresADL), Overloaded(Overloaded), NamingClass(NamingClass)
{}
+ UnresolvedLookupExpr(EmptyShell Empty)
+ : OverloadExpr(UnresolvedLookupExprClass, Empty),
+ RequiresADL(false), Overloaded(false), NamingClass(0)
+ {}
+
public:
static UnresolvedLookupExpr *Create(ASTContext &C,
bool Dependent,
@@ -1511,17 +1570,23 @@ public:
UnresolvedSetIterator Begin,
UnresolvedSetIterator End);
+ static UnresolvedLookupExpr *CreateEmpty(ASTContext &C,
+ unsigned NumTemplateArgs);
+
/// True if this declaration should be extended by
/// argument-dependent lookup.
bool requiresADL() const { return RequiresADL; }
+ void setRequiresADL(bool V) { RequiresADL = V; }
/// True if this lookup is overloaded.
bool isOverloaded() const { return Overloaded; }
+ void setOverloaded(bool V) { Overloaded = V; }
/// Gets the 'naming class' (in the sense of C++0x
/// [class.access.base]p5) of the lookup. This is the scope
/// that was looked in to find these results.
CXXRecordDecl *getNamingClass() const { return NamingClass; }
+ void setNamingClass(CXXRecordDecl *D) { NamingClass = D; }
// Note that, inconsistently with the explicit-template-argument AST
// nodes, users are *forbidden* from calling these methods on objects
@@ -1628,18 +1693,25 @@ public:
SourceLocation NameLoc,
const TemplateArgumentListInfo *TemplateArgs = 0);
+ static DependentScopeDeclRefExpr *CreateEmpty(ASTContext &C,
+ unsigned NumTemplateArgs);
+
/// \brief Retrieve the name that this expression refers to.
DeclarationName getDeclName() const { return Name; }
+ void setDeclName(DeclarationName N) { Name = N; }
/// \brief Retrieve the location of the name within the expression.
SourceLocation getLocation() const { return Loc; }
+ void setLocation(SourceLocation L) { Loc = L; }
/// \brief Retrieve the source range of the nested-name-specifier.
SourceRange getQualifierRange() const { return QualifierRange; }
+ void setQualifierRange(SourceRange R) { QualifierRange = R; }
/// \brief Retrieve the nested-name-specifier that qualifies this
/// declaration.
NestedNameSpecifier *getQualifier() const { return Qualifier; }
+ void setQualifier(NestedNameSpecifier *NNS) { Qualifier = NNS; }
/// Determines whether this lookup had explicit template arguments.
bool hasExplicitTemplateArgs() const { return HasExplicitTemplateArgs; }
@@ -1648,6 +1720,11 @@ public:
// nodes, users are *forbidden* from calling these methods on objects
// without explicit template arguments.
+ ExplicitTemplateArgumentList &getExplicitTemplateArgs() {
+ assert(hasExplicitTemplateArgs());
+ return *reinterpret_cast<ExplicitTemplateArgumentList*>(this + 1);
+ }
+
/// Gets a reference to the explicit template argument list.
const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const {
assert(hasExplicitTemplateArgs());
@@ -1792,6 +1869,9 @@ class CXXUnresolvedConstructExpr : public Expr {
unsigned NumArgs,
SourceLocation RParenLoc);
+ CXXUnresolvedConstructExpr(EmptyShell Empty, unsigned NumArgs)
+ : Expr(CXXUnresolvedConstructExprClass, Empty), NumArgs(NumArgs) { }
+
public:
static CXXUnresolvedConstructExpr *Create(ASTContext &C,
SourceLocation TyBegin,
@@ -1801,6 +1881,9 @@ public:
unsigned NumArgs,
SourceLocation RParenLoc);
+ static CXXUnresolvedConstructExpr *CreateEmpty(ASTContext &C,
+ unsigned NumArgs);
+
/// \brief Retrieve the source location where the type begins.
SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
void setTypeBeginLoc(SourceLocation L) { TyBeginLoc = L; }
@@ -1845,6 +1928,11 @@ public:
return *(arg_begin() + I);
}
+ void setArg(unsigned I, Expr *E) {
+ assert(I < NumArgs && "Argument index out-of-range");
+ *(arg_begin() + I) = E;
+ }
+
virtual SourceRange getSourceRange() const {
return SourceRange(TyBeginLoc, RParenLoc);
}
@@ -1908,20 +1996,6 @@ class CXXDependentScopeMemberExpr : public Expr {
/// \brief The location of the member name.
SourceLocation MemberLoc;
- /// \brief Retrieve the explicit template argument list that followed the
- /// member template name, if any.
- ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() {
- assert(HasExplicitTemplateArgs);
- return reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
- }
-
- /// \brief Retrieve the explicit template argument list that followed the
- /// member template name, if any.
- const ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() const {
- return const_cast<CXXDependentScopeMemberExpr *>(this)
- ->getExplicitTemplateArgumentList();
- }
-
CXXDependentScopeMemberExpr(ASTContext &C,
Expr *Base, QualType BaseType, bool IsArrow,
SourceLocation OperatorLoc,
@@ -1960,6 +2034,9 @@ public:
SourceLocation MemberLoc,
const TemplateArgumentListInfo *TemplateArgs);
+ static CXXDependentScopeMemberExpr *
+ CreateEmpty(ASTContext &C, unsigned NumTemplateArgs);
+
/// \brief True if this is an implicit access, i.e. one in which the
/// member being accessed was not written in the source. The source
/// location of the operator is invalid in this case.
@@ -1974,6 +2051,7 @@ public:
void setBase(Expr *E) { Base = E; }
QualType getBaseType() const { return BaseType; }
+ void setBaseType(QualType T) { BaseType = T; }
/// \brief Determine whether this member expression used the '->'
/// operator; otherwise, it used the '.' operator.
@@ -1987,10 +2065,12 @@ public:
/// \brief Retrieve the nested-name-specifier that qualifies the member
/// name.
NestedNameSpecifier *getQualifier() const { return Qualifier; }
+ void setQualifier(NestedNameSpecifier *NNS) { Qualifier = NNS; }
/// \brief Retrieve the source range covering the nested-name-specifier
/// that qualifies the member name.
SourceRange getQualifierRange() const { return QualifierRange; }
+ void setQualifierRange(SourceRange R) { QualifierRange = R; }
/// \brief Retrieve the first part of the nested-name-specifier that was
/// found in the scope of the member access expression when the member access
@@ -2006,6 +2086,9 @@ public:
NamedDecl *getFirstQualifierFoundInScope() const {
return FirstQualifierFoundInScope;
}
+ void setFirstQualifierFoundInScope(NamedDecl *D) {
+ FirstQualifierFoundInScope = D;
+ }
/// \brief Retrieve the name of the member that this expression
/// refers to.
@@ -2023,6 +2106,20 @@ public:
return HasExplicitTemplateArgs;
}
+ /// \brief Retrieve the explicit template argument list that followed the
+ /// member template name, if any.
+ ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() {
+ assert(HasExplicitTemplateArgs);
+ return reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
+ }
+
+ /// \brief Retrieve the explicit template argument list that followed the
+ /// member template name, if any.
+ const ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() const {
+ return const_cast<CXXDependentScopeMemberExpr *>(this)
+ ->getExplicitTemplateArgumentList();
+ }
+
/// \brief Copies the template arguments (if present) into the given
/// structure.
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const {
@@ -2030,6 +2127,12 @@ public:
getExplicitTemplateArgumentList()->copyInto(List);
}
+ /// \brief Initializes the template arguments using the given structure.
+ void initializeTemplateArgumentsFrom(const TemplateArgumentListInfo &List) {
+ assert(HasExplicitTemplateArgs);
+ getExplicitTemplateArgumentList()->initializeFrom(List);
+ }
+
/// \brief Retrieve the location of the left angle bracket following the
/// member name ('<'), if any.
SourceLocation getLAngleLoc() const {
@@ -2127,6 +2230,10 @@ class UnresolvedMemberExpr : public OverloadExpr {
SourceLocation MemberLoc,
const TemplateArgumentListInfo *TemplateArgs,
UnresolvedSetIterator Begin, UnresolvedSetIterator End);
+
+ UnresolvedMemberExpr(EmptyShell Empty)
+ : OverloadExpr(UnresolvedMemberExprClass, Empty), IsArrow(false),
+ HasUnresolvedUsing(false), Base(0) { }
public:
static UnresolvedMemberExpr *
@@ -2140,6 +2247,9 @@ public:
const TemplateArgumentListInfo *TemplateArgs,
UnresolvedSetIterator Begin, UnresolvedSetIterator End);
+ static UnresolvedMemberExpr *
+ CreateEmpty(ASTContext &C, unsigned NumTemplateArgs);
+
/// \brief True if this is an implicit access, i.e. one in which the
/// member being accessed was not written in the source. The source
/// location of the operator is invalid in this case.
@@ -2158,6 +2268,12 @@ public:
void setBase(Expr *E) { Base = E; }
QualType getBaseType() const { return BaseType; }
+ void setBaseType(QualType T) { BaseType = T; }
+
+ /// \brief Determine whether the lookup results contain an unresolved using
+ /// declaration.
+ bool hasUnresolvedUsing() const { return HasUnresolvedUsing; }
+ void setHasUnresolvedUsing(bool V) { HasUnresolvedUsing = V; }
/// \brief Determine whether this member expression used the '->'
/// operator; otherwise, it used the '.' operator.
diff --git a/include/clang/AST/ExternalASTSource.h b/include/clang/AST/ExternalASTSource.h
index 79e44511d32d..def9ced94c29 100644
--- a/include/clang/AST/ExternalASTSource.h
+++ b/include/clang/AST/ExternalASTSource.h
@@ -58,67 +58,85 @@ public:
virtual ~ExternalASTSource();
- /// \brief Resolve a type ID into a type, potentially building a new
- /// type.
- virtual QualType GetType(uint32_t ID) = 0;
-
/// \brief Resolve a declaration ID into a declaration, potentially
/// building a new declaration.
- virtual Decl *GetDecl(uint32_t ID) = 0;
+ ///
+ /// This method only needs to be implemented if the AST source ever
+ /// passes back decl sets as VisibleDeclaration objects.
+ virtual Decl *GetExternalDecl(uint32_t ID) = 0;
/// \brief Resolve a selector ID into a selector.
- virtual Selector GetSelector(uint32_t ID) = 0;
+ ///
+ /// This operation only needs to be implemented if the AST source
+ /// returns non-zero for GetNumKnownSelectors().
+ virtual Selector GetExternalSelector(uint32_t ID) = 0;
/// \brief Returns the number of selectors known to the external AST
/// source.
- virtual uint32_t GetNumKnownSelectors() = 0;
+ virtual uint32_t GetNumExternalSelectors() = 0;
- /// \brief Resolve the offset of a statement in the decl stream into a
- /// statement.
+ /// \brief Resolve the offset of a statement in the decl stream into
+ /// a statement.
///
- /// This operation will read a new statement from the external
- /// source each time it is called, and is meant to be used via a
- /// LazyOffsetPtr.
- virtual Stmt *GetDeclStmt(uint64_t Offset) = 0;
+ /// This operation is meant to be used via a LazyOffsetPtr. It only
+ /// needs to be implemented if the AST source uses methods like
+ /// FunctionDecl::setLazyBody when building decls.
+ virtual Stmt *GetExternalDeclStmt(uint64_t Offset) = 0;
- /// \brief Read all of the declarations lexically stored in a
- /// declaration context.
+ /// \brief Finds all declarations with the given name in the
+ /// given context.
///
- /// \param DC The declaration context whose declarations will be
- /// read.
+ /// Generally the final step of this method is either to call
+ /// SetExternalVisibleDeclsForName or to recursively call lookup on
+ /// the DeclContext after calling SetExternalVisibleDecls.
+ virtual DeclContext::lookup_result
+ FindExternalVisibleDeclsByName(const DeclContext *DC,
+ DeclarationName Name) = 0;
+
+ /// \brief Finds all declarations lexically contained within the given
+ /// DeclContext.
///
- /// \param Decls Vector that will contain the declarations loaded
- /// from the external source. The caller is responsible for merging
- /// these declarations with any declarations already stored in the
- /// declaration context.
- ///
- /// \returns true if there was an error while reading the
- /// declarations for this declaration context.
- virtual bool ReadDeclsLexicallyInContext(DeclContext *DC,
- llvm::SmallVectorImpl<uint32_t> &Decls) = 0;
-
- /// \brief Read all of the declarations visible from a declaration
- /// context.
- ///
- /// \param DC The declaration context whose visible declarations
- /// will be read.
- ///
- /// \param Decls A vector of visible declaration structures,
- /// providing the mapping from each name visible in the declaration
- /// context to the declaration IDs of declarations with that name.
- ///
- /// \returns true if there was an error while reading the
- /// declarations for this declaration context.
- virtual bool ReadDeclsVisibleInContext(DeclContext *DC,
- llvm::SmallVectorImpl<VisibleDeclaration> & Decls) = 0;
+ /// \return true if an error occurred
+ virtual bool FindExternalLexicalDecls(const DeclContext *DC,
+ llvm::SmallVectorImpl<Decl*> &Result) = 0;
/// \brief Function that will be invoked when we begin parsing a new
/// translation unit involving this external AST source.
+ ///
+ /// The default implementation of this method is a no-op.
virtual void StartTranslationUnit(ASTConsumer *Consumer) { }
/// \brief Print any statistics that have been gathered regarding
/// the external AST source.
+ ///
+ /// The default implementation of this method is a no-op.
virtual void PrintStats();
+
+protected:
+ /// \brief Initialize the context's lookup map with the given decls.
+ /// It is assumed that none of the declarations are redeclarations of
+ /// each other.
+ static void SetExternalVisibleDecls(const DeclContext *DC,
+ const llvm::SmallVectorImpl<VisibleDeclaration> &Decls);
+
+ /// \brief Initialize the context's lookup map with the given decls.
+ /// It is assumed that none of the declarations are redeclarations of
+ /// each other.
+ static void SetExternalVisibleDecls(const DeclContext *DC,
+ const llvm::SmallVectorImpl<NamedDecl*> &Decls);
+
+ static DeclContext::lookup_result
+ SetExternalVisibleDeclsForName(const DeclContext *DC,
+ const VisibleDeclaration &VD);
+
+ static DeclContext::lookup_result
+ SetExternalVisibleDeclsForName(const DeclContext *DC,
+ DeclarationName Name,
+ llvm::SmallVectorImpl<NamedDecl*> &Decls);
+
+ static DeclContext::lookup_result
+ SetNoExternalVisibleDeclsForName(const DeclContext *DC,
+ DeclarationName Name);
};
/// \brief A lazy pointer to an AST node (of base type T) that resides
@@ -185,7 +203,8 @@ public:
};
/// \brief A lazy pointer to a statement.
-typedef LazyOffsetPtr<Stmt, &ExternalASTSource::GetDeclStmt> LazyDeclStmtPtr;
+typedef LazyOffsetPtr<Stmt, &ExternalASTSource::GetExternalDeclStmt>
+ LazyDeclStmtPtr;
} // end namespace clang
diff --git a/include/clang/AST/Makefile b/include/clang/AST/Makefile
index a25977cad621..00a1e1bf7977 100644
--- a/include/clang/AST/Makefile
+++ b/include/clang/AST/Makefile
@@ -1,13 +1,23 @@
-LEVEL = ../../../../..
-BUILT_SOURCES = StmtNodes.inc
+CLANG_LEVEL := ../../..
+TD_SRC_DIR = $(PROJ_SRC_DIR)/../Basic
+BUILT_SOURCES = Attrs.inc StmtNodes.inc DeclNodes.inc
TABLEGEN_INC_FILES_COMMON = 1
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
-INPUT_TDS = $(PROJ_SRC_DIR)/StmtNodes.td
+$(ObjDir)/Attrs.inc.tmp : $(TD_SRC_DIR)/Attr.td $(TBLGEN) \
+ $(ObjDir)/.dir
+ $(Echo) "Building Clang attribute classes with tblgen"
+ $(Verb) $(TableGen) -gen-clang-attr-classes -o $(call SYSPATH, $@) \
+ -I $(PROJ_SRC_DIR)/../../ $<
-$(ObjDir)/StmtNodes.inc.tmp : StmtNodes.td $(TBLGEN) $(ObjDir)/.dir
+$(ObjDir)/StmtNodes.inc.tmp : $(TD_SRC_DIR)/StmtNodes.td $(TBLGEN) \
+ $(ObjDir)/.dir
$(Echo) "Building Clang statement node tables with tblgen"
$(Verb) $(TableGen) -gen-clang-stmt-nodes -o $(call SYSPATH, $@) $<
+$(ObjDir)/DeclNodes.inc.tmp : $(TD_SRC_DIR)/DeclNodes.td $(TBLGEN) \
+ $(ObjDir)/.dir
+ $(Echo) "Building Clang declaration node tables with tblgen"
+ $(Verb) $(TableGen) -gen-clang-decl-nodes -o $(call SYSPATH, $@) $<
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index 07865e0eb3f1..0853dddbe9e5 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -29,739 +29,1634 @@
#include "clang/AST/TemplateBase.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
+#include "clang/AST/TypeLoc.h"
+
+// The following three macros are used for meta programming. The code
+// using them is responsible for defining macro OPERATOR().
+
+// All unary operators.
+#define UNARYOP_LIST() \
+ OPERATOR(PostInc) OPERATOR(PostDec) \
+ OPERATOR(PreInc) OPERATOR(PreDec) \
+ OPERATOR(AddrOf) OPERATOR(Deref) \
+ OPERATOR(Plus) OPERATOR(Minus) \
+ OPERATOR(Not) OPERATOR(LNot) \
+ OPERATOR(Real) OPERATOR(Imag) \
+ OPERATOR(Extension) OPERATOR(OffsetOf)
+
+// All binary operators (excluding compound assign operators).
+#define BINOP_LIST() \
+ OPERATOR(PtrMemD) OPERATOR(PtrMemI) \
+ OPERATOR(Mul) OPERATOR(Div) OPERATOR(Rem) \
+ OPERATOR(Add) OPERATOR(Sub) OPERATOR(Shl) \
+ OPERATOR(Shr) \
+ \
+ OPERATOR(LT) OPERATOR(GT) OPERATOR(LE) \
+ OPERATOR(GE) OPERATOR(EQ) OPERATOR(NE) \
+ OPERATOR(And) OPERATOR(Xor) OPERATOR(Or) \
+ OPERATOR(LAnd) OPERATOR(LOr) \
+ \
+ OPERATOR(Assign) \
+ OPERATOR(Comma)
+
+// All compound assign operators.
+#define CAO_LIST() \
+ OPERATOR(Mul) OPERATOR(Div) OPERATOR(Rem) OPERATOR(Add) OPERATOR(Sub) \
+ OPERATOR(Shl) OPERATOR(Shr) OPERATOR(And) OPERATOR(Or) OPERATOR(Xor)
namespace clang {
-#define DISPATCH(NAME, CLASS, Var) \
-return getDerived().Visit ## NAME(static_cast<CLASS*>(Var))
-
-// We use preprocessor meta-programming to generate the Visit*()
-// methods for all subclasses of Stmt, Decl, and Type. Some of the
-// generated definitions, however, need to be customized. The
-// meta-programming technique we use doesn't let us select which
-// methods to generate. Therefore we have to generate ALL of them in
-// a helper class RecursiveASTVisitorImpl, and override the ones we
-// don't like in a child class RecursiveASTVisitor (C++ doesn't allow
-// overriding a method in the same class).
-//
-// Do not use this class directly - use RecursiveASTVisitor instead.
+// A helper macro to implement short-circuiting when recursing. It
+// invokes CALL_EXPR, which must be a method call, on the derived
+// object (s.t. a user of RecursiveASTVisitor can override the method
+// in CALL_EXPR).
+#define TRY_TO(CALL_EXPR) \
+ do { if (!getDerived().CALL_EXPR) return false; } while (0)
+
+/// \brief A class that does preorder depth-first traversal on the
+/// entire Clang AST and visits each node.
+///
+/// This class performs three distinct tasks:
+/// 1. traverse the AST (i.e. go to each node);
+/// 2. at a given node, walk up the class hierarchy, starting from
+/// the node's dynamic type, until the top-most class (e.g. Stmt,
+/// Decl, or Type) is reached.
+/// 3. given a (node, class) combination, where 'class' is some base
+/// class of the dynamic type of 'node', call a user-overridable
+/// function to actually visit the node.
+///
+/// These tasks are done by three groups of methods, respectively:
+/// 1. TraverseDecl(Decl *x) does task #1. It is the entry point
+/// for traversing an AST rooted at x. This method simply
+/// dispatches (i.e. forwards) to TraverseFoo(Foo *x) where Foo
+/// is the dynamic type of *x, which calls WalkUpFromFoo(x) and
+/// then recursively visits the child nodes of x.
+/// TraverseStmt(Stmt *x) and TraverseType(QualType x) work
+/// similarly.
+/// 2. WalkUpFromFoo(Foo *x) does task #2. It does not try to visit
+/// any child node of x. Instead, it first calls WalkUpFromBar(x)
+/// where Bar is the direct parent class of Foo (unless Foo has
+/// no parent), and then calls VisitFoo(x) (see the next list item).
+/// 3. VisitFoo(Foo *x) does task #3.
+///
+/// These three method groups are tiered (Traverse* > WalkUpFrom* >
+/// Visit*). A method (e.g. Traverse*) may call methods from the same
+/// tier (e.g. other Traverse*) or one tier lower (e.g. WalkUpFrom*).
+/// It may not call methods from a higher tier.
+///
+/// Note that since WalkUpFromFoo() calls WalkUpFromBar() (where Bar
+/// is Foo's super class) before calling VisitFoo(), the result is
+/// that the Visit*() methods for a given node are called in the
+/// top-down order (e.g. for a node of type NamedDecl, the order will
+/// be VisitDecl(), VisitNamedDecl(), and then VisitNamespaceDecl()).
+///
+/// This scheme guarantees that all Visit*() calls for the same AST
+/// node are grouped together. In other words, Visit*() methods for
+/// different nodes are never interleaved.
+///
+/// Clients of this visitor should subclass the visitor (providing
+/// themselves as the template argument, using the curiously recurring
+/// template pattern) and override any of the Traverse*, WalkUpFrom*,
+/// and Visit* methods for declarations, types, statements,
+/// expressions, or other AST nodes where the visitor should customize
+/// behavior. Most users only need to override Visit*. Advanced
+/// users may override Traverse* and WalkUpFrom* to implement custom
+/// traversal strategies. Returning false from one of these overridden
+/// functions will abort the entire traversal.
template<typename Derived>
-class RecursiveASTVisitorImpl {
+class RecursiveASTVisitor {
public:
/// \brief Return a reference to the derived class.
Derived &getDerived() { return *static_cast<Derived*>(this); }
/// \brief Recursively visit a statement or expression, by
- /// dispatching to Visit*() based on the argument's dynamic type.
- /// This is NOT meant to be overridden by a subclass.
+ /// dispatching to Traverse*() based on the argument's dynamic type.
///
- /// \returns true if the visitation was terminated early, false
+ /// \returns false if the visitation was terminated early, true
/// otherwise (including when the argument is NULL).
- bool Visit(Stmt *S);
+ bool TraverseStmt(Stmt *S);
/// \brief Recursively visit a type, by dispatching to
- /// Visit*Type() based on the argument's getTypeClass() property.
- /// This is NOT meant to be overridden by a subclass.
+ /// Traverse*Type() based on the argument's getTypeClass() property.
///
- /// \returns true if the visitation was terminated early, false
+ /// \returns false if the visitation was terminated early, true
/// otherwise (including when the argument is a Null type).
- bool Visit(QualType T);
+ bool TraverseType(QualType T);
+
+ /// \brief Recursively visit a type with location, by dispatching to
+ /// Traverse*TypeLoc() based on the argument type's getTypeClass() property.
+ ///
+ /// \returns false if the visitation was terminated early, true
+ /// otherwise (including when the argument is a Null type location).
+ bool TraverseTypeLoc(TypeLoc TL);
/// \brief Recursively visit a declaration, by dispatching to
- /// Visit*Decl() based on the argument's dynamic type. This is
- /// NOT meant to be overridden by a subclass.
+ /// Traverse*Decl() based on the argument's dynamic type.
///
- /// \returns true if the visitation was terminated early, false
+ /// \returns false if the visitation was terminated early, true
/// otherwise (including when the argument is NULL).
- bool Visit(Decl *D);
+ bool TraverseDecl(Decl *D);
/// \brief Recursively visit a C++ nested-name-specifier.
///
- /// \returns true if the visitation was terminated early, false otherwise.
- bool VisitNestedNameSpecifier(NestedNameSpecifier *NNS);
+ /// \returns false if the visitation was terminated early, true otherwise.
+ bool TraverseNestedNameSpecifier(NestedNameSpecifier *NNS);
- /// \brief Recursively visit a template name.
+ /// \brief Recursively visit a template name and dispatch to the
+ /// appropriate method.
///
- /// \returns true if the visitation was terminated early, false otherwise.
- bool VisitTemplateName(TemplateName Template);
+ /// \returns false if the visitation was terminated early, true otherwise.
+ bool TraverseTemplateName(TemplateName Template);
- /// \brief Recursively visit a template argument.
+ /// \brief Recursively visit a template argument and dispatch to the
+ /// appropriate method for the argument type.
///
- /// \returns true if the visitation was terminated early, false otherwise.
- bool VisitTemplateArgument(const TemplateArgument &Arg);
+ /// \returns false if the visitation was terminated early, true otherwise.
+ // FIXME: migrate callers to TemplateArgumentLoc instead.
+ bool TraverseTemplateArgument(const TemplateArgument &Arg);
- /// \brief Recursively visit a set of template arguments.
+ /// \brief Recursively visit a template argument location and dispatch to the
+ /// appropriate method for the argument type.
///
- /// \returns true if the visitation was terminated early, false otherwise.
- bool VisitTemplateArguments(const TemplateArgument *Args, unsigned NumArgs);
-
- // If the implementation chooses not to implement a certain visit method, fall
- // back on VisitExpr or whatever else is the superclass.
-#define STMT(CLASS, PARENT) \
-bool Visit ## CLASS(CLASS *S) { DISPATCH(PARENT, PARENT, S); }
-#include "clang/AST/StmtNodes.inc"
+ /// \returns false if the visitation was terminated early, true otherwise.
+ bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc);
- // If the implementation doesn't implement binary operator methods, fall back
- // on VisitBinaryOperator.
-#define BINOP_FALLBACK(NAME) \
-bool VisitBin ## NAME(BinaryOperator *S) { \
-DISPATCH(BinaryOperator, BinaryOperator, S); \
-}
- BINOP_FALLBACK(PtrMemD) BINOP_FALLBACK(PtrMemI)
- BINOP_FALLBACK(Mul) BINOP_FALLBACK(Div) BINOP_FALLBACK(Rem)
- BINOP_FALLBACK(Add) BINOP_FALLBACK(Sub) BINOP_FALLBACK(Shl)
- BINOP_FALLBACK(Shr)
-
- BINOP_FALLBACK(LT) BINOP_FALLBACK(GT) BINOP_FALLBACK(LE)
- BINOP_FALLBACK(GE) BINOP_FALLBACK(EQ) BINOP_FALLBACK(NE)
- BINOP_FALLBACK(And) BINOP_FALLBACK(Xor) BINOP_FALLBACK(Or)
- BINOP_FALLBACK(LAnd) BINOP_FALLBACK(LOr)
-
- BINOP_FALLBACK(Assign)
- BINOP_FALLBACK(Comma)
-#undef BINOP_FALLBACK
-
- // If the implementation doesn't implement compound assignment operator
- // methods, fall back on VisitCompoundAssignOperator.
-#define CAO_FALLBACK(NAME) \
-bool VisitBin ## NAME(CompoundAssignOperator *S) { \
-DISPATCH(CompoundAssignOperator, CompoundAssignOperator, S); \
-}
- CAO_FALLBACK(MulAssign) CAO_FALLBACK(DivAssign) CAO_FALLBACK(RemAssign)
- CAO_FALLBACK(AddAssign) CAO_FALLBACK(SubAssign) CAO_FALLBACK(ShlAssign)
- CAO_FALLBACK(ShrAssign) CAO_FALLBACK(AndAssign) CAO_FALLBACK(OrAssign)
- CAO_FALLBACK(XorAssign)
-#undef CAO_FALLBACK
-
- // If the implementation doesn't implement unary operator methods, fall back
- // on VisitUnaryOperator.
-#define UNARYOP_FALLBACK(NAME) \
-bool VisitUnary ## NAME(UnaryOperator *S) { \
-DISPATCH(UnaryOperator, UnaryOperator, S); \
-}
- UNARYOP_FALLBACK(PostInc) UNARYOP_FALLBACK(PostDec)
- UNARYOP_FALLBACK(PreInc) UNARYOP_FALLBACK(PreDec)
- UNARYOP_FALLBACK(AddrOf) UNARYOP_FALLBACK(Deref)
-
- UNARYOP_FALLBACK(Plus) UNARYOP_FALLBACK(Minus)
- UNARYOP_FALLBACK(Not) UNARYOP_FALLBACK(LNot)
- UNARYOP_FALLBACK(Real) UNARYOP_FALLBACK(Imag)
- UNARYOP_FALLBACK(Extension) UNARYOP_FALLBACK(OffsetOf)
-#undef UNARYOP_FALLBACK
-
- /// \brief Basis for statement and expression visitation, which
- /// visits all of the substatements and subexpressions.
+ /// \brief Recursively visit a set of template arguments.
+ /// This can be overridden by a subclass, but it's not expected that
+ /// will be needed -- this visitor always dispatches to another.
///
- /// The relation between Visit(Stmt *S) and this method is that
- /// the former dispatches to Visit*() based on S's dynamic type,
- /// which forwards the call up the inheritance chain until
- /// reaching VisitStmt(), which then calls Visit() on each
- /// substatement/subexpression.
- bool VisitStmt(Stmt *S);
-
- /// \brief Basis for type visitation, which by default does nothing.
+ /// \returns false if the visitation was terminated early, true otherwise.
+ // FIXME: take a TemplateArgumentLoc* (or TemplateArgumentListInfo) instead.
+ bool TraverseTemplateArguments(const TemplateArgument *Args,
+ unsigned NumArgs);
+
+ /// \brief Recursively visit a constructor initializer. This
+ /// automatically dispatches to another visitor for the initializer
+ /// expression, but not for the name of the initializer, so may
+ /// be overridden for clients that need access to the name.
///
- /// The relation between Visit(QualType T) and this method is
- /// that the former dispatches to Visit*Type(), which forwards the
- /// call up the inheritance chain until reaching VisitType().
- bool VisitType(Type *T);
+ /// \returns false if the visitation was terminated early, true otherwise.
+ bool TraverseConstructorInitializer(CXXBaseOrMemberInitializer *Init);
+
+ // ---- Methods on Stmts ----
-#define TYPE(Class, Base) \
- bool Visit##Class##Type(Class##Type *T);
+ // Declare Traverse*() for all concrete Stmt classes.
+#define ABSTRACT_STMT(STMT)
+#define STMT(CLASS, PARENT) \
+ bool Traverse##CLASS(CLASS *S);
+#include "clang/AST/StmtNodes.inc"
+ // The above header #undefs ABSTRACT_STMT and STMT upon exit.
+
+ // Define WalkUpFrom*() and empty Visit*() for all Stmt classes.
+ bool WalkUpFromStmt(Stmt *S) { return getDerived().VisitStmt(S); }
+ bool VisitStmt(Stmt *S) { return true; }
+#define STMT(CLASS, PARENT) \
+ bool WalkUpFrom##CLASS(CLASS *S) { \
+ TRY_TO(WalkUpFrom##PARENT(S)); \
+ TRY_TO(Visit##CLASS(S)); \
+ return true; \
+ } \
+ bool Visit##CLASS(CLASS *S) { return true; }
+#include "clang/AST/StmtNodes.inc"
+
+ // Define Traverse*(), WalkUpFrom*(), and Visit*() for unary
+ // operator methods. Unary operators are not classes in themselves
+ // (they're all opcodes in UnaryOperator) but do have visitors.
+#define OPERATOR(NAME) \
+ bool TraverseUnary##NAME(UnaryOperator *S) { \
+ TRY_TO(WalkUpFromUnary##NAME(S)); \
+ TRY_TO(TraverseStmt(S->getSubExpr())); \
+ return true; \
+ } \
+ bool WalkUpFromUnary##NAME(UnaryOperator *S) { \
+ TRY_TO(WalkUpFromUnaryOperator(S)); \
+ TRY_TO(VisitUnary##NAME(S)); \
+ return true; \
+ } \
+ bool VisitUnary##NAME(UnaryOperator *S) { return true; }
+
+ UNARYOP_LIST()
+#undef OPERATOR
+
+ // Define Traverse*(), WalkUpFrom*(), and Visit*() for binary
+ // operator methods. Binary operators are not classes in themselves
+ // (they're all opcodes in BinaryOperator) but do have visitors.
+#define GENERAL_BINOP_FALLBACK(NAME, BINOP_TYPE) \
+ bool TraverseBin##NAME(BINOP_TYPE *S) { \
+ TRY_TO(WalkUpFromBin##NAME(S)); \
+ TRY_TO(TraverseStmt(S->getLHS())); \
+ TRY_TO(TraverseStmt(S->getRHS())); \
+ return true; \
+ } \
+ bool WalkUpFromBin##NAME(BINOP_TYPE *S) { \
+ TRY_TO(WalkUpFrom##BINOP_TYPE(S)); \
+ TRY_TO(VisitBin##NAME(S)); \
+ return true; \
+ } \
+ bool VisitBin##NAME(BINOP_TYPE *S) { return true; }
+
+#define OPERATOR(NAME) GENERAL_BINOP_FALLBACK(NAME, BinaryOperator)
+ BINOP_LIST()
+#undef OPERATOR
+
+ // Define Traverse*(), WalkUpFrom*(), and Visit*() for compound
+ // assignment methods. Compound assignment operators are not
+ // classes in themselves (they're all opcodes in
+ // CompoundAssignOperator) but do have visitors.
+#define OPERATOR(NAME) \
+ GENERAL_BINOP_FALLBACK(NAME##Assign, CompoundAssignOperator)
+
+ CAO_LIST()
+#undef OPERATOR
+#undef GENERAL_BINOP_FALLBACK
+
+ // ---- Methods on Types ----
+ // FIXME: revamp to take TypeLoc's rather than Types.
+
+ // Declare Traverse*() for all concrete Type classes.
+#define ABSTRACT_TYPE(CLASS, BASE)
+#define TYPE(CLASS, BASE) \
+ bool Traverse##CLASS##Type(CLASS##Type *T);
+#include "clang/AST/TypeNodes.def"
+ // The above header #undefs ABSTRACT_TYPE and TYPE upon exit.
+
+ // Define WalkUpFrom*() and empty Visit*() for all Type classes.
+ bool WalkUpFromType(Type *T) { return getDerived().VisitType(T); }
+ bool VisitType(Type *T) { return true; }
+#define TYPE(CLASS, BASE) \
+ bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \
+ TRY_TO(WalkUpFrom##BASE(T)); \
+ TRY_TO(Visit##CLASS##Type(T)); \
+ return true; \
+ } \
+ bool Visit##CLASS##Type(CLASS##Type *T) { return true; }
#include "clang/AST/TypeNodes.def"
- /// \brief Basis for declaration and definition visitation, which
- /// visits all of the subnodes.
- ///
- /// The relation between Visit(Decl *) and this method is that the
- /// former dispatches to Visit*Decl(), which forwards the call up
- /// the inheritance chain until reaching VisitDecl().
- bool VisitDecl(Decl *D);
-
-#define DECL(Class, Base) \
- bool Visit##Class##Decl(Class##Decl *D) { \
- return getDerived().Visit##Base(D); \
+ // ---- Methods on TypeLocs ----
+ // FIXME: this currently just calls the matching Type methods
+
+ // Declare Traverse*() for all concrete Type classes.
+#define ABSTRACT_TYPELOC(CLASS, BASE)
+#define TYPELOC(CLASS, BASE) \
+ bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL);
+#include "clang/AST/TypeLocNodes.def"
+ // The above header #undefs ABSTRACT_TYPELOC and TYPELOC upon exit.
+
+ // Define WalkUpFrom*() and empty Visit*() for all TypeLoc classes.
+ bool WalkUpFromTypeLoc(TypeLoc TL) { return getDerived().VisitTypeLoc(TL); }
+ bool VisitTypeLoc(TypeLoc TL) { return true; }
+
+ // QualifiedTypeLoc and UnqualTypeLoc are not declared in
+ // TypeNodes.def and thus need to be handled specially.
+ bool WalkUpFromQualifiedTypeLoc(QualifiedTypeLoc TL) {
+ return getDerived().VisitUnqualTypeLoc(TL.getUnqualifiedLoc());
}
-#define ABSTRACT_DECL(Class, Base) DECL(Class, Base)
-#include "clang/AST/DeclNodes.def"
+ bool VisitQualifiedTypeLoc(QualifiedTypeLoc TL) { return true; }
+ bool WalkUpFromUnqualTypeLoc(UnqualTypeLoc TL) {
+ return getDerived().VisitUnqualTypeLoc(TL.getUnqualifiedLoc());
+ }
+ bool VisitUnqualTypeLoc(UnqualTypeLoc TL) { return true; }
+
+ // Note that BASE includes trailing 'Type' which CLASS doesn't.
+#define TYPE(CLASS, BASE) \
+ bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
+ TRY_TO(WalkUpFrom##BASE##Loc(TL)); \
+ TRY_TO(Visit##CLASS##TypeLoc(TL)); \
+ return true; \
+ } \
+ bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }
+#include "clang/AST/TypeNodes.def"
+
+ // ---- Methods on Decls ----
+
+ // Declare Traverse*() for all concrete Decl classes.
+#define ABSTRACT_DECL(DECL)
+#define DECL(CLASS, BASE) \
+ bool Traverse##CLASS##Decl(CLASS##Decl *D);
+#include "clang/AST/DeclNodes.inc"
+ // The above header #undefs ABSTRACT_DECL and DECL upon exit.
+
+ // Define WalkUpFrom*() and empty Visit*() for all Decl classes.
+ bool WalkUpFromDecl(Decl *D) { return getDerived().VisitDecl(D); }
+ bool VisitDecl(Decl *D) { return true; }
+#define DECL(CLASS, BASE) \
+ bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \
+ TRY_TO(WalkUpFrom##BASE(D)); \
+ TRY_TO(Visit##CLASS##Decl(D)); \
+ return true; \
+ } \
+ bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; }
+#include "clang/AST/DeclNodes.inc"
+
+private:
+ // These are helper methods used by more than one Traverse* method.
+ bool TraverseTemplateParameterListHelper(TemplateParameterList *TPL);
+ bool TraverseTemplateArgumentLocsHelper(const TemplateArgumentLoc *TAL,
+ unsigned Count);
+ bool TraverseRecordHelper(RecordDecl *D);
+ bool TraverseCXXRecordHelper(CXXRecordDecl *D);
+ bool TraverseDeclaratorHelper(DeclaratorDecl *D);
+ bool TraverseDeclContextHelper(DeclContext *DC);
+ bool TraverseFunctionHelper(FunctionDecl *D);
+ bool TraverseVarHelper(VarDecl *D);
};
+#define DISPATCH(NAME, CLASS, VAR) \
+ return getDerived().Traverse##NAME(static_cast<CLASS*>(VAR))
+
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::Visit(Stmt *S) {
+bool RecursiveASTVisitor<Derived>::TraverseStmt(Stmt *S) {
if (!S)
- return false;
+ return true;
// If we have a binary expr, dispatch to the subcode of the binop. A smart
// optimizer (e.g. LLVM) will fold this comparison into the switch stmt
// below.
if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(S)) {
switch (BinOp->getOpcode()) {
- case BinaryOperator::PtrMemD: DISPATCH(BinPtrMemD, BinaryOperator, S);
- case BinaryOperator::PtrMemI: DISPATCH(BinPtrMemI, BinaryOperator, S);
- case BinaryOperator::Mul: DISPATCH(BinMul, BinaryOperator, S);
- case BinaryOperator::Div: DISPATCH(BinDiv, BinaryOperator, S);
- case BinaryOperator::Rem: DISPATCH(BinRem, BinaryOperator, S);
- case BinaryOperator::Add: DISPATCH(BinAdd, BinaryOperator, S);
- case BinaryOperator::Sub: DISPATCH(BinSub, BinaryOperator, S);
- case BinaryOperator::Shl: DISPATCH(BinShl, BinaryOperator, S);
- case BinaryOperator::Shr: DISPATCH(BinShr, BinaryOperator, S);
-
- case BinaryOperator::LT: DISPATCH(BinLT, BinaryOperator, S);
- case BinaryOperator::GT: DISPATCH(BinGT, BinaryOperator, S);
- case BinaryOperator::LE: DISPATCH(BinLE, BinaryOperator, S);
- case BinaryOperator::GE: DISPATCH(BinGE, BinaryOperator, S);
- case BinaryOperator::EQ: DISPATCH(BinEQ, BinaryOperator, S);
- case BinaryOperator::NE: DISPATCH(BinNE, BinaryOperator, S);
-
- case BinaryOperator::And: DISPATCH(BinAnd, BinaryOperator, S);
- case BinaryOperator::Xor: DISPATCH(BinXor, BinaryOperator, S);
- case BinaryOperator::Or : DISPATCH(BinOr, BinaryOperator, S);
- case BinaryOperator::LAnd: DISPATCH(BinLAnd, BinaryOperator, S);
- case BinaryOperator::LOr : DISPATCH(BinLOr, BinaryOperator, S);
- case BinaryOperator::Assign: DISPATCH(BinAssign, BinaryOperator, S);
- case BinaryOperator::MulAssign:
- DISPATCH(BinMulAssign, CompoundAssignOperator, S);
- case BinaryOperator::DivAssign:
- DISPATCH(BinDivAssign, CompoundAssignOperator, S);
- case BinaryOperator::RemAssign:
- DISPATCH(BinRemAssign, CompoundAssignOperator, S);
- case BinaryOperator::AddAssign:
- DISPATCH(BinAddAssign, CompoundAssignOperator, S);
- case BinaryOperator::SubAssign:
- DISPATCH(BinSubAssign, CompoundAssignOperator, S);
- case BinaryOperator::ShlAssign:
- DISPATCH(BinShlAssign, CompoundAssignOperator, S);
- case BinaryOperator::ShrAssign:
- DISPATCH(BinShrAssign, CompoundAssignOperator, S);
- case BinaryOperator::AndAssign:
- DISPATCH(BinAndAssign, CompoundAssignOperator, S);
- case BinaryOperator::OrAssign:
- DISPATCH(BinOrAssign, CompoundAssignOperator, S);
- case BinaryOperator::XorAssign:
- DISPATCH(BinXorAssign, CompoundAssignOperator, S);
- case BinaryOperator::Comma: DISPATCH(BinComma, BinaryOperator, S);
+#define OPERATOR(NAME) \
+ case BinaryOperator::NAME: DISPATCH(Bin##PtrMemD, BinaryOperator, S);
+
+ BINOP_LIST()
+#undef OPERATOR
+#undef BINOP_LIST
+
+#define OPERATOR(NAME) \
+ case BinaryOperator::NAME##Assign: \
+ DISPATCH(Bin##NAME##Assign, CompoundAssignOperator, S);
+
+ CAO_LIST()
+#undef OPERATOR
+#undef CAO_LIST
}
} else if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(S)) {
switch (UnOp->getOpcode()) {
- case UnaryOperator::PostInc: DISPATCH(UnaryPostInc, UnaryOperator, S);
- case UnaryOperator::PostDec: DISPATCH(UnaryPostDec, UnaryOperator, S);
- case UnaryOperator::PreInc: DISPATCH(UnaryPreInc, UnaryOperator, S);
- case UnaryOperator::PreDec: DISPATCH(UnaryPreDec, UnaryOperator, S);
- case UnaryOperator::AddrOf: DISPATCH(UnaryAddrOf, UnaryOperator, S);
- case UnaryOperator::Deref: DISPATCH(UnaryDeref, UnaryOperator, S);
- case UnaryOperator::Plus: DISPATCH(UnaryPlus, UnaryOperator, S);
- case UnaryOperator::Minus: DISPATCH(UnaryMinus, UnaryOperator, S);
- case UnaryOperator::Not: DISPATCH(UnaryNot, UnaryOperator, S);
- case UnaryOperator::LNot: DISPATCH(UnaryLNot, UnaryOperator, S);
- case UnaryOperator::Real: DISPATCH(UnaryReal, UnaryOperator, S);
- case UnaryOperator::Imag: DISPATCH(UnaryImag, UnaryOperator, S);
- case UnaryOperator::Extension: DISPATCH(UnaryExtension, UnaryOperator, S);
- case UnaryOperator::OffsetOf: DISPATCH(UnaryOffsetOf, UnaryOperator, S);
+#define OPERATOR(NAME) \
+ case UnaryOperator::NAME: DISPATCH(Unary##NAME, UnaryOperator, S);
+
+ UNARYOP_LIST()
+#undef OPERATOR
+#undef UNARYOP_LIST
}
}
- // Top switch stmt: dispatch to VisitFooStmt for each FooStmt.
+ // Top switch stmt: dispatch to TraverseFooStmt for each concrete FooStmt.
switch (S->getStmtClass()) {
case Stmt::NoStmtClass: break;
#define ABSTRACT_STMT(STMT)
-#define STMT(CLASS, PARENT) \
-case Stmt::CLASS ## Class: DISPATCH(CLASS, CLASS, S);
+#define STMT(CLASS, PARENT) \
+ case Stmt::CLASS##Class: DISPATCH(CLASS, CLASS, S);
#include "clang/AST/StmtNodes.inc"
}
- return false;
+ return true;
}
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::Visit(QualType T) {
+bool RecursiveASTVisitor<Derived>::TraverseType(QualType T) {
if (T.isNull())
- return false;
+ return true;
switch (T->getTypeClass()) {
-#define ABSTRACT_TYPE(Class, Base)
-#define TYPE(Class, Base) \
- case Type::Class: DISPATCH(Class##Type, Class##Type, T.getTypePtr());
+#define ABSTRACT_TYPE(CLASS, BASE)
+#define TYPE(CLASS, BASE) \
+ case Type::CLASS: DISPATCH(CLASS##Type, CLASS##Type, T.getTypePtr());
#include "clang/AST/TypeNodes.def"
}
- return false;
+ return true;
}
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::Visit(Decl *D) {
+bool RecursiveASTVisitor<Derived>::TraverseTypeLoc(TypeLoc TL) {
+ if (TL.isNull())
+ return true;
+
+ switch (TL.getTypeLocClass()) {
+#define ABSTRACT_TYPELOC(CLASS, BASE)
+#define TYPELOC(CLASS, BASE) \
+ case TypeLoc::CLASS: \
+ return getDerived().Traverse##CLASS##TypeLoc(*cast<CLASS##TypeLoc>(&TL));
+#include "clang/AST/TypeLocNodes.def"
+ }
+
+ return true;
+}
+
+
+template<typename Derived>
+bool RecursiveASTVisitor<Derived>::TraverseDecl(Decl *D) {
if (!D)
- return false;
+ return true;
+
+ // As a syntax visitor, we want to ignore declarations for
+ // implicitly-defined declarations (ones not typed explicitly by the
+ // user).
+ if (D->isImplicit())
+ return true;
switch (D->getKind()) {
-#define ABSTRACT_DECL(Class, Base)
-#define DECL(Class, Base) \
- case Decl::Class: DISPATCH(Class##Decl, Class##Decl, D);
-#include "clang/AST/DeclNodes.def"
- }
+#define ABSTRACT_DECL(DECL)
+#define DECL(CLASS, BASE) \
+ case Decl::CLASS: DISPATCH(CLASS##Decl, CLASS##Decl, D);
+#include "clang/AST/DeclNodes.inc"
+ }
- return false;
+ return true;
}
+#undef DISPATCH
+
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitNestedNameSpecifier(
+bool RecursiveASTVisitor<Derived>::TraverseNestedNameSpecifier(
NestedNameSpecifier *NNS) {
- if (NNS->getPrefix() &&
- getDerived().VisitNestedNameSpecifier(NNS->getPrefix()))
+ if (!NNS)
return true;
+ if (NNS->getPrefix())
+ TRY_TO(TraverseNestedNameSpecifier(NNS->getPrefix()));
+
switch (NNS->getKind()) {
case NestedNameSpecifier::Identifier:
case NestedNameSpecifier::Namespace:
case NestedNameSpecifier::Global:
- return false;
+ return true;
case NestedNameSpecifier::TypeSpec:
case NestedNameSpecifier::TypeSpecWithTemplate:
- return Visit(QualType(NNS->getAsType(), 0));
+ TRY_TO(TraverseType(QualType(NNS->getAsType(), 0)));
}
- return false;
+ return true;
}
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitTemplateName(TemplateName Template) {
+bool RecursiveASTVisitor<Derived>::TraverseTemplateName(TemplateName Template) {
if (DependentTemplateName *DTN = Template.getAsDependentTemplateName())
- return DTN->getQualifier() &&
- getDerived().VisitNestedNameSpecifier(DTN->getQualifier());
-
- if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
- return getDerived().VisitNestedNameSpecifier(QTN->getQualifier());
+ TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
+ else if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
+ TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
- return false;
+ return true;
}
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitTemplateArgument(
+bool RecursiveASTVisitor<Derived>::TraverseTemplateArgument(
const TemplateArgument &Arg) {
switch (Arg.getKind()) {
case TemplateArgument::Null:
case TemplateArgument::Declaration:
case TemplateArgument::Integral:
- return false;
+ return true;
case TemplateArgument::Type:
- return Visit(Arg.getAsType());
+ return getDerived().TraverseType(Arg.getAsType());
case TemplateArgument::Template:
- return getDerived().VisitTemplateName(Arg.getAsTemplate());
+ return getDerived().TraverseTemplateName(Arg.getAsTemplate());
case TemplateArgument::Expression:
- return getDerived().Visit(Arg.getAsExpr());
+ return getDerived().TraverseStmt(Arg.getAsExpr());
case TemplateArgument::Pack:
- return getDerived().VisitTemplateArguments(Arg.pack_begin(),
- Arg.pack_size());
+ return getDerived().TraverseTemplateArguments(Arg.pack_begin(),
+ Arg.pack_size());
}
- return false;
+ return true;
}
+// FIXME: no template name location?
+// FIXME: no source locations for a template argument pack?
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitTemplateArguments(
- const TemplateArgument *Args,
- unsigned NumArgs) {
- for (unsigned I = 0; I != NumArgs; ++I)
- if (getDerived().VisitTemplateArgument(Args[I]))
- return true;
+bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLoc(
+ const TemplateArgumentLoc &ArgLoc) {
+ const TemplateArgument &Arg = ArgLoc.getArgument();
- return false;
-}
+ switch (Arg.getKind()) {
+ case TemplateArgument::Null:
+ case TemplateArgument::Declaration:
+ case TemplateArgument::Integral:
+ return true;
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitStmt(Stmt *Node) {
- for (Stmt::child_iterator C = Node->child_begin(), CEnd = Node->child_end();
- C != CEnd; ++C) {
- if (Visit(*C))
- return true;
+ case TemplateArgument::Type: {
+ TypeSourceInfo *TSI = ArgLoc.getTypeSourceInfo();
+ return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
}
- return false;
+ case TemplateArgument::Template:
+ return getDerived().TraverseTemplateName(Arg.getAsTemplate());
+
+ case TemplateArgument::Expression:
+ return getDerived().TraverseStmt(ArgLoc.getSourceExpression());
+
+ case TemplateArgument::Pack:
+ return getDerived().TraverseTemplateArguments(Arg.pack_begin(),
+ Arg.pack_size());
+ }
+
+ return true;
}
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitType(Type *T) {
- return false;
+bool RecursiveASTVisitor<Derived>::TraverseTemplateArguments(
+ const TemplateArgument *Args,
+ unsigned NumArgs) {
+ for (unsigned I = 0; I != NumArgs; ++I) {
+ TRY_TO(TraverseTemplateArgument(Args[I]));
+ }
+
+ return true;
}
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitBuiltinType(BuiltinType *T) {
- return getDerived().VisitType(T);
+bool RecursiveASTVisitor<Derived>::TraverseConstructorInitializer(
+ CXXBaseOrMemberInitializer *Init) {
+ // FIXME: recurse on TypeLoc of the base initializer if isBaseInitializer()?
+ if (Init->isWritten())
+ TRY_TO(TraverseStmt(Init->getInit()));
+ return true;
}
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitComplexType(ComplexType *T) {
- if (Visit(T->getElementType()))
- return true;
- return getDerived().VisitType(T);
-}
+// ----------------- Type traversal -----------------
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitPointerType(PointerType *T) {
- if (Visit(T->getPointeeType()))
- return true;
+// This macro makes available a variable T, the passed-in type.
+#define DEF_TRAVERSE_TYPE(TYPE, CODE) \
+ template<typename Derived> \
+ bool RecursiveASTVisitor<Derived>::Traverse##TYPE (TYPE *T) { \
+ TRY_TO(WalkUpFrom##TYPE (T)); \
+ { CODE; } \
+ return true; \
+ }
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_TYPE(BuiltinType, { })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitBlockPointerType(
- BlockPointerType *T) {
- if (Visit(T->getPointeeType()))
- return true;
+DEF_TRAVERSE_TYPE(ComplexType, {
+ TRY_TO(TraverseType(T->getElementType()));
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_TYPE(PointerType, {
+ TRY_TO(TraverseType(T->getPointeeType()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitReferenceType(ReferenceType *T) {
- if (Visit(T->getPointeeType()))
- return true;
+DEF_TRAVERSE_TYPE(BlockPointerType, {
+ TRY_TO(TraverseType(T->getPointeeType()));
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_TYPE(LValueReferenceType, {
+ TRY_TO(TraverseType(T->getPointeeType()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitLValueReferenceType(
- LValueReferenceType *T) {
- return getDerived().VisitReferenceType(T);
-}
+DEF_TRAVERSE_TYPE(RValueReferenceType, {
+ TRY_TO(TraverseType(T->getPointeeType()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitRValueReferenceType(
- RValueReferenceType *T) {
- return getDerived().VisitReferenceType(T);
-}
+DEF_TRAVERSE_TYPE(MemberPointerType, {
+ TRY_TO(TraverseType(QualType(T->getClass(), 0)));
+ TRY_TO(TraverseType(T->getPointeeType()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitMemberPointerType(
- MemberPointerType *T) {
- if (Visit(QualType(T->getClass(), 0)) || Visit(T->getPointeeType()))
- return true;
+DEF_TRAVERSE_TYPE(ConstantArrayType, {
+ TRY_TO(TraverseType(T->getElementType()));
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_TYPE(IncompleteArrayType, {
+ TRY_TO(TraverseType(T->getElementType()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitArrayType(ArrayType *T) {
- if (Visit(T->getElementType()))
- return true;
+DEF_TRAVERSE_TYPE(VariableArrayType, {
+ TRY_TO(TraverseType(T->getElementType()));
+ TRY_TO(TraverseStmt(T->getSizeExpr()));
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_TYPE(DependentSizedArrayType, {
+ TRY_TO(TraverseType(T->getElementType()));
+ if (T->getSizeExpr())
+ TRY_TO(TraverseStmt(T->getSizeExpr()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitConstantArrayType(
- ConstantArrayType *T) {
- return getDerived().VisitArrayType(T);
-}
+DEF_TRAVERSE_TYPE(DependentSizedExtVectorType, {
+ if (T->getSizeExpr())
+ TRY_TO(TraverseStmt(T->getSizeExpr()));
+ TRY_TO(TraverseType(T->getElementType()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitIncompleteArrayType(
- IncompleteArrayType *T) {
- return getDerived().VisitArrayType(T);
-}
+DEF_TRAVERSE_TYPE(VectorType, {
+ TRY_TO(TraverseType(T->getElementType()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitVariableArrayType(
- VariableArrayType *T) {
- if (Visit(T->getSizeExpr()))
- return true;
+DEF_TRAVERSE_TYPE(ExtVectorType, {
+ TRY_TO(TraverseType(T->getElementType()));
+ })
- return getDerived().VisitArrayType(T);
-}
+DEF_TRAVERSE_TYPE(FunctionNoProtoType, {
+ TRY_TO(TraverseType(T->getResultType()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitDependentSizedArrayType(
- DependentSizedArrayType *T) {
- if (T->getSizeExpr() && Visit(T->getSizeExpr()))
- return true;
+DEF_TRAVERSE_TYPE(FunctionProtoType, {
+ TRY_TO(TraverseType(T->getResultType()));
- return getDerived().VisitArrayType(T);
-}
+ for (FunctionProtoType::arg_type_iterator A = T->arg_type_begin(),
+ AEnd = T->arg_type_end();
+ A != AEnd; ++A) {
+ TRY_TO(TraverseType(*A));
+ }
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitDependentSizedExtVectorType(
- DependentSizedExtVectorType *T) {
- if ((T->getSizeExpr() && Visit(T->getSizeExpr())) ||
- Visit(T->getElementType()))
- return true;
+ for (FunctionProtoType::exception_iterator E = T->exception_begin(),
+ EEnd = T->exception_end();
+ E != EEnd; ++E) {
+ TRY_TO(TraverseType(*E));
+ }
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_TYPE(UnresolvedUsingType, { })
+DEF_TRAVERSE_TYPE(TypedefType, { })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitVectorType(VectorType *T) {
- if (Visit(T->getElementType()))
- return true;
+DEF_TRAVERSE_TYPE(TypeOfExprType, {
+ TRY_TO(TraverseStmt(T->getUnderlyingExpr()));
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_TYPE(TypeOfType, {
+ TRY_TO(TraverseType(T->getUnderlyingType()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitExtVectorType(ExtVectorType *T) {
- return getDerived().VisitVectorType(T);
-}
+DEF_TRAVERSE_TYPE(DecltypeType, {
+ TRY_TO(TraverseStmt(T->getUnderlyingExpr()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitFunctionType(FunctionType *T) {
- if (Visit(T->getResultType()))
- return true;
+DEF_TRAVERSE_TYPE(RecordType, { })
+DEF_TRAVERSE_TYPE(EnumType, { })
+DEF_TRAVERSE_TYPE(TemplateTypeParmType, { })
+DEF_TRAVERSE_TYPE(SubstTemplateTypeParmType, { })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_TYPE(TemplateSpecializationType, {
+ TRY_TO(TraverseTemplateName(T->getTemplateName()));
+ TRY_TO(TraverseTemplateArguments(T->getArgs(), T->getNumArgs()));
+ })
+
+DEF_TRAVERSE_TYPE(InjectedClassNameType, { })
+
+DEF_TRAVERSE_TYPE(ElaboratedType, {
+ if (T->getQualifier()) {
+ TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
+ }
+ TRY_TO(TraverseType(T->getNamedType()));
+ })
+
+DEF_TRAVERSE_TYPE(DependentNameType, {
+ TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
+ })
+
+DEF_TRAVERSE_TYPE(DependentTemplateSpecializationType, {
+ TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
+ TRY_TO(TraverseTemplateArguments(T->getArgs(), T->getNumArgs()));
+ })
+
+DEF_TRAVERSE_TYPE(ObjCInterfaceType, { })
+
+DEF_TRAVERSE_TYPE(ObjCObjectType, {
+ // We have to watch out here because an ObjCInterfaceType's base
+ // type is itself.
+ if (T->getBaseType().getTypePtr() != T)
+ TRY_TO(TraverseType(T->getBaseType()));
+ })
+
+DEF_TRAVERSE_TYPE(ObjCObjectPointerType, {
+ TRY_TO(TraverseType(T->getPointeeType()));
+ })
+
+#undef DEF_TRAVERSE_TYPE
+
+// ----------------- TypeLoc traversal -----------------
+
+// This macro makes available a variable TL, the passed-in TypeLoc.
+// It calls WalkUpFrom* for the Type in the given TypeLoc, in addition
+// to WalkUpFrom* for the TypeLoc itself, such that existing clients
+// that override the WalkUpFrom*Type() and/or Visit*Type() methods
+// continue to work.
+#define DEF_TRAVERSE_TYPELOC(TYPE, CODE) \
+ template<typename Derived> \
+ bool RecursiveASTVisitor<Derived>::Traverse##TYPE##Loc(TYPE##Loc TL) { \
+ TRY_TO(WalkUpFrom##TYPE(TL.getTypePtr())); \
+ TRY_TO(WalkUpFrom##TYPE##Loc(TL)); \
+ { CODE; } \
+ return true; \
+ }
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitFunctionNoProtoType(
- FunctionNoProtoType *T) {
- return getDerived().VisitFunctionType(T);
+bool RecursiveASTVisitor<Derived>::TraverseQualifiedTypeLoc(
+ QualifiedTypeLoc TL) {
+ // Move this over to the 'main' typeloc tree. Note that this is a
+ // move -- we pretend that we were really looking at the unqualified
+ // typeloc all along -- rather than a recursion, so we don't follow
+ // the normal CRTP plan of going through
+ // getDerived().TraverseTypeLoc. If we did, we'd be traversing
+ // twice for the same type (once as a QualifiedTypeLoc version of
+ // the type, once as an UnqualifiedTypeLoc version of the type),
+ // which in effect means we'd call VisitTypeLoc twice with the
+ // 'same' type. This solves that problem, at the cost of never
+ // seeing the qualified version of the type (unless the client
+ // subclasses TraverseQualifiedTypeLoc themselves). It's not a
+ // perfect solution. A perfect solution probably requires making
+ // QualifiedTypeLoc a wrapper around TypeLoc -- like QualType is a
+ // wrapper around Type* -- rather than being its own class in the
+ // type hierarchy.
+ return TraverseTypeLoc(TL.getUnqualifiedLoc());
}
+DEF_TRAVERSE_TYPELOC(BuiltinType, { })
+
+// FIXME: ComplexTypeLoc is unfinished
+DEF_TRAVERSE_TYPELOC(ComplexType, {
+ TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
+ })
+
+DEF_TRAVERSE_TYPELOC(PointerType, {
+ TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
+ })
+
+DEF_TRAVERSE_TYPELOC(BlockPointerType, {
+ TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
+ })
+
+DEF_TRAVERSE_TYPELOC(LValueReferenceType, {
+ TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
+ })
+
+DEF_TRAVERSE_TYPELOC(RValueReferenceType, {
+ TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
+ })
+
+// FIXME: location of base class?
+// We traverse this in the type case as well, but how is it not reached through
+// the pointee type?
+DEF_TRAVERSE_TYPELOC(MemberPointerType, {
+ TRY_TO(TraverseType(QualType(TL.getTypePtr()->getClass(), 0)));
+ TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
+ })
+
+DEF_TRAVERSE_TYPELOC(ConstantArrayType, {
+ TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
+ })
+
+DEF_TRAVERSE_TYPELOC(IncompleteArrayType, {
+ TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
+ })
+
+DEF_TRAVERSE_TYPELOC(VariableArrayType, {
+ TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
+ TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
+ })
+
+DEF_TRAVERSE_TYPELOC(DependentSizedArrayType, {
+ TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
+ if (TL.getTypePtr()->getSizeExpr())
+ TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
+ })
+
+// FIXME: order? why not size expr first?
+// FIXME: base VectorTypeLoc is unfinished
+DEF_TRAVERSE_TYPELOC(DependentSizedExtVectorType, {
+ if (TL.getTypePtr()->getSizeExpr())
+ TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
+ TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
+ })
+
+// FIXME: VectorTypeLoc is unfinished
+DEF_TRAVERSE_TYPELOC(VectorType, {
+ TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
+ })
+
+// FIXME: size and attributes
+// FIXME: base VectorTypeLoc is unfinished
+DEF_TRAVERSE_TYPELOC(ExtVectorType, {
+ TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
+ })
+
+DEF_TRAVERSE_TYPELOC(FunctionNoProtoType, {
+ TRY_TO(TraverseTypeLoc(TL.getResultLoc()));
+ })
+
+// FIXME: location of arguments, exception specifications (attributes?)
+// Note that we have the ParmVarDecl's here. Do we want to use them?
+DEF_TRAVERSE_TYPELOC(FunctionProtoType, {
+ TRY_TO(TraverseTypeLoc(TL.getResultLoc()));
+
+ FunctionProtoType *T = TL.getTypePtr();
+/*
+ for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
+ TRY_TO(TraverseDecl(TL.getArg(I)));
+ }
+*/
+ for (FunctionProtoType::arg_type_iterator A = T->arg_type_begin(),
+ AEnd = T->arg_type_end();
+ A != AEnd; ++A) {
+ TRY_TO(TraverseType(*A));
+ }
+ for (FunctionProtoType::exception_iterator E = T->exception_begin(),
+ EEnd = T->exception_end();
+ E != EEnd; ++E) {
+ TRY_TO(TraverseType(*E));
+ }
+ })
+
+DEF_TRAVERSE_TYPELOC(UnresolvedUsingType, { })
+DEF_TRAVERSE_TYPELOC(TypedefType, { })
+
+DEF_TRAVERSE_TYPELOC(TypeOfExprType, {
+ TRY_TO(TraverseStmt(TL.getUnderlyingExpr()));
+ })
+
+DEF_TRAVERSE_TYPELOC(TypeOfType, {
+ TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
+ })
+
+// FIXME: location of underlying expr
+DEF_TRAVERSE_TYPELOC(DecltypeType, {
+ TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
+ })
+
+DEF_TRAVERSE_TYPELOC(RecordType, { })
+DEF_TRAVERSE_TYPELOC(EnumType, { })
+DEF_TRAVERSE_TYPELOC(TemplateTypeParmType, { })
+DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmType, { })
+
+// FIXME: use the loc for the template name?
+DEF_TRAVERSE_TYPELOC(TemplateSpecializationType, {
+ TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
+ for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
+ TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
+ }
+ })
+
+DEF_TRAVERSE_TYPELOC(InjectedClassNameType, { })
+
+// FIXME: use the sourceloc on qualifier?
+DEF_TRAVERSE_TYPELOC(ElaboratedType, {
+ if (TL.getTypePtr()->getQualifier()) {
+ TRY_TO(TraverseNestedNameSpecifier(TL.getTypePtr()->getQualifier()));
+ }
+ TRY_TO(TraverseTypeLoc(TL.getNamedTypeLoc()));
+ })
+
+// FIXME: use the sourceloc on qualifier?
+DEF_TRAVERSE_TYPELOC(DependentNameType, {
+ TRY_TO(TraverseNestedNameSpecifier(TL.getTypePtr()->getQualifier()));
+ })
+
+DEF_TRAVERSE_TYPELOC(DependentTemplateSpecializationType, {
+ TRY_TO(TraverseNestedNameSpecifier(TL.getTypePtr()->getQualifier()));
+ for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
+ TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
+ }
+ })
+
+DEF_TRAVERSE_TYPELOC(ObjCInterfaceType, { })
+
+DEF_TRAVERSE_TYPELOC(ObjCObjectType, {
+ // We have to watch out here because an ObjCInterfaceType's base
+ // type is itself.
+ if (TL.getTypePtr()->getBaseType().getTypePtr() != TL.getTypePtr())
+ TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
+ })
+
+DEF_TRAVERSE_TYPELOC(ObjCObjectPointerType, {
+ TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
+ })
+
+#undef DEF_TRAVERSE_TYPELOC
+
+// ----------------- Decl traversal -----------------
+//
+// For a Decl, we automate (in the DEF_TRAVERSE_DECL macro) traversing
+// the children that come from the DeclContext associated with it.
+// Therefore each Traverse* only needs to worry about children other
+// than those.
+
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitFunctionProtoType(
- FunctionProtoType *T) {
- for (FunctionProtoType::arg_type_iterator A = T->arg_type_begin(),
- AEnd = T->arg_type_end();
- A != AEnd; ++A) {
- if (Visit(*A))
- return true;
- }
+bool RecursiveASTVisitor<Derived>::TraverseDeclContextHelper(DeclContext *DC) {
+ if (!DC)
+ return true;
- for (FunctionProtoType::exception_iterator E = T->exception_begin(),
- EEnd = T->exception_end();
- E != EEnd; ++E) {
- if (Visit(*E))
- return true;
+ for (DeclContext::decl_iterator Child = DC->decls_begin(),
+ ChildEnd = DC->decls_end();
+ Child != ChildEnd; ++Child) {
+ TRY_TO(TraverseDecl(*Child));
}
- return getDerived().VisitFunctionType(T);
+ return true;
}
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitUnresolvedUsingType(
- UnresolvedUsingType *T) {
- return getDerived().VisitType(T);
+// This macro makes available a variable D, the passed-in decl.
+#define DEF_TRAVERSE_DECL(DECL, CODE) \
+template<typename Derived> \
+bool RecursiveASTVisitor<Derived>::Traverse##DECL (DECL *D) { \
+ TRY_TO(WalkUpFrom##DECL (D)); \
+ { CODE; } \
+ TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \
+ return true; \
}
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitTypedefType(TypedefType *T) {
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_DECL(AccessSpecDecl, { })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitTypeOfExprType(TypeOfExprType *T) {
- if (Visit(T->getUnderlyingExpr()))
- return true;
+DEF_TRAVERSE_DECL(BlockDecl, {
+ // We don't traverse nodes in param_begin()/param_end(), as they
+ // appear in decls_begin()/decls_end() and thus are handled by the
+ // DEF_TRAVERSE_DECL macro already.
+ TRY_TO(TraverseStmt(D->getBody()));
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_DECL(FileScopeAsmDecl, {
+ TRY_TO(TraverseStmt(D->getAsmString()));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitTypeOfType(TypeOfType *T) {
- if (Visit(T->getUnderlyingType()))
- return true;
+DEF_TRAVERSE_DECL(FriendDecl, {
+ TRY_TO(TraverseDecl(D->getFriendDecl()));
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_DECL(FriendTemplateDecl, {
+ TRY_TO(TraverseDecl(D->getFriendDecl()));
+ for (unsigned I = 0, E = D->getNumTemplateParameters(); I < E; ++I) {
+ TemplateParameterList *TPL = D->getTemplateParameterList(I);
+ for (TemplateParameterList::iterator ITPL = TPL->begin(),
+ ETPL = TPL->end();
+ ITPL != ETPL; ++ITPL) {
+ TRY_TO(TraverseDecl(*ITPL));
+ }
+ }
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitDecltypeType(DecltypeType *T) {
- if (Visit(T->getUnderlyingExpr()))
+DEF_TRAVERSE_DECL(LinkageSpecDecl, { })
+
+DEF_TRAVERSE_DECL(ObjCClassDecl, {
+ // FIXME: implement this
+ })
+
+DEF_TRAVERSE_DECL(ObjCForwardProtocolDecl, {
+ // FIXME: implement this
+ })
+
+DEF_TRAVERSE_DECL(ObjCPropertyImplDecl, {
+ // FIXME: implement this
+ })
+
+DEF_TRAVERSE_DECL(StaticAssertDecl, {
+ TRY_TO(TraverseStmt(D->getAssertExpr()));
+ TRY_TO(TraverseStmt(D->getMessage()));
+ })
+
+DEF_TRAVERSE_DECL(TranslationUnitDecl, {
+ // Code in an unnamed namespace shows up automatically in
+ // decls_begin()/decls_end(). Thus we don't need to recurse on
+ // D->getAnonymousNamespace().
+ })
+
+DEF_TRAVERSE_DECL(NamespaceAliasDecl, {
+ // We shouldn't traverse an aliased namespace, since it will be
+ // defined (and, therefore, traversed) somewhere else.
+ //
+ // This return statement makes sure the traversal of nodes in
+ // decls_begin()/decls_end() (done in the DEF_TRAVERSE_DECL macro)
+ // is skipped - don't remove it.
return true;
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_DECL(NamespaceDecl, {
+ // Code in an unnamed namespace shows up automatically in
+ // decls_begin()/decls_end(). Thus we don't need to recurse on
+ // D->getAnonymousNamespace().
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitTagType(TagType *T) {
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_DECL(ObjCCompatibleAliasDecl, {
+ // FIXME: implement
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitRecordType(RecordType *T) {
- return getDerived().VisitTagType(T);
-}
+DEF_TRAVERSE_DECL(ObjCCategoryDecl, {
+ // FIXME: implement
+ })
+
+DEF_TRAVERSE_DECL(ObjCCategoryImplDecl, {
+ // FIXME: implement
+ })
+
+DEF_TRAVERSE_DECL(ObjCImplementationDecl, {
+ // FIXME: implement
+ })
+
+DEF_TRAVERSE_DECL(ObjCInterfaceDecl, {
+ // FIXME: implement
+ })
+
+DEF_TRAVERSE_DECL(ObjCProtocolDecl, {
+ // FIXME: implement
+ })
+
+DEF_TRAVERSE_DECL(ObjCMethodDecl, {
+ // FIXME: implement
+ })
+
+DEF_TRAVERSE_DECL(ObjCPropertyDecl, {
+ // FIXME: implement
+ })
+DEF_TRAVERSE_DECL(UsingDecl, {
+ TRY_TO(TraverseNestedNameSpecifier(D->getTargetNestedNameDecl()));
+ })
+
+DEF_TRAVERSE_DECL(UsingDirectiveDecl, {
+ TRY_TO(TraverseNestedNameSpecifier(D->getQualifier()));
+ })
+
+DEF_TRAVERSE_DECL(UsingShadowDecl, { })
+
+// A helper method for TemplateDecl's children.
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitEnumType(EnumType *T) {
- return getDerived().VisitType(T);
+bool RecursiveASTVisitor<Derived>::TraverseTemplateParameterListHelper(
+ TemplateParameterList *TPL) {
+ if (TPL) {
+ for (TemplateParameterList::iterator I = TPL->begin(), E = TPL->end();
+ I != E; ++I) {
+ TRY_TO(TraverseDecl(*I));
+ }
+ }
+ return true;
}
+DEF_TRAVERSE_DECL(ClassTemplateDecl, {
+ TRY_TO(TraverseDecl(D->getTemplatedDecl()));
+ TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
+ // We should not traverse the specializations/partial
+ // specializations. Those will show up in other contexts.
+ // getInstantiatedFromMemberTemplate() is just a link from a
+ // template instantiation back to the template from which it was
+ // instantiated, and thus should not be traversed either.
+ })
+
+DEF_TRAVERSE_DECL(FunctionTemplateDecl, {
+ TRY_TO(TraverseDecl(D->getTemplatedDecl()));
+ TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
+ })
+
+DEF_TRAVERSE_DECL(TemplateTemplateParmDecl, {
+ // D is the "T" in something like
+ // template <template <typename> class T> class container { };
+ TRY_TO(TraverseDecl(D->getTemplatedDecl()));
+ if (D->hasDefaultArgument()) {
+ TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
+ }
+ TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
+ })
+
+DEF_TRAVERSE_DECL(TemplateTypeParmDecl, {
+ // D is the "T" in something like "template<typename T> class vector;"
+ if (D->hasDefaultArgument())
+ TRY_TO(TraverseTypeLoc(D->getDefaultArgumentInfo()->getTypeLoc()));
+ if (D->getTypeForDecl())
+ TRY_TO(TraverseType(QualType(D->getTypeForDecl(), 0)));
+ })
+
+DEF_TRAVERSE_DECL(TypedefDecl, {
+ TRY_TO(TraverseType(D->getUnderlyingType()));
+ // We shouldn't traverse D->getTypeForDecl(); it's a result of
+ // declaring the typedef, not something that was written in the
+ // source.
+ })
+
+DEF_TRAVERSE_DECL(UnresolvedUsingTypenameDecl, {
+ // A dependent using declaration which was marked with 'typename'.
+ // template<class T> class A : public B<T> { using typename B<T>::foo; };
+ TRY_TO(TraverseNestedNameSpecifier(D->getTargetNestedNameSpecifier()));
+ // We shouldn't traverse D->getTypeForDecl(); it's a result of
+ // declaring the type, not something that was written in the
+ // source.
+ })
+
+DEF_TRAVERSE_DECL(EnumDecl, {
+ if (D->getTypeForDecl())
+ TRY_TO(TraverseType(QualType(D->getTypeForDecl(), 0)));
+
+ TRY_TO(TraverseNestedNameSpecifier(D->getQualifier()));
+ // The enumerators are already traversed by
+ // decls_begin()/decls_end().
+ })
+
+
+// Helper methods for RecordDecl and its children.
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitTemplateTypeParmType(
- TemplateTypeParmType *T) {
- return getDerived().VisitType(T);
+bool RecursiveASTVisitor<Derived>::TraverseRecordHelper(
+ RecordDecl *D) {
+ // We shouldn't traverse D->getTypeForDecl(); it's a result of
+ // declaring the type, not something that was written in the source.
+ //
+ // The anonymous struct or union object is the variable or field
+ // whose type is the anonymous struct or union. We shouldn't
+ // traverse D->getAnonymousStructOrUnionObject(), as it's not
+ // something that is explicitly written in the source.
+ TRY_TO(TraverseNestedNameSpecifier(D->getQualifier()));
+ return true;
}
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitSubstTemplateTypeParmType(
- SubstTemplateTypeParmType *T) {
- return getDerived().VisitType(T);
+bool RecursiveASTVisitor<Derived>::TraverseCXXRecordHelper(
+ CXXRecordDecl *D) {
+ if (!TraverseRecordHelper(D))
+ return false;
+ if (D->hasDefinition()) {
+ for (CXXRecordDecl::base_class_iterator I = D->bases_begin(),
+ E = D->bases_end();
+ I != E; ++I) {
+ TRY_TO(TraverseType(I->getType()));
+ }
+ // We don't traverse the friends or the conversions, as they are
+ // already in decls_begin()/decls_end().
+ }
+ return true;
}
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitTemplateSpecializationType(
- TemplateSpecializationType *T) {
- if (getDerived().VisitTemplateName(T->getTemplateName()) ||
- getDerived().VisitTemplateArguments(T->getArgs(), T->getNumArgs()))
+DEF_TRAVERSE_DECL(RecordDecl, {
+ TRY_TO(TraverseRecordHelper(D));
+ })
+
+DEF_TRAVERSE_DECL(CXXRecordDecl, {
+ TRY_TO(TraverseCXXRecordHelper(D));
+ })
+
+DEF_TRAVERSE_DECL(ClassTemplateSpecializationDecl, {
+ // For implicit instantiations ("set<int> x;"), we don't want to
+ // recurse at all, since the instatiated class isn't written in
+ // the source code anywhere. (Note the instatiated *type* --
+ // set<int> -- is written, and will still get a callback of
+ // TemplateSpecializationType). For explicit instantiations
+ // ("template set<int>;"), we do need a callback, since this
+ // is the only callback that's made for this instantiation.
+ // We use getTypeAsWritten() to distinguish.
+ // FIXME: see how we want to handle template specializations.
+ if (TypeSourceInfo *TSI = D->getTypeAsWritten())
+ TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
return true;
+ })
- return getDerived().VisitType(T);
+template <typename Derived>
+bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
+ const TemplateArgumentLoc *TAL, unsigned Count) {
+ for (unsigned I = 0; I < Count; ++I) {
+ TRY_TO(TraverseTemplateArgumentLoc(TAL[I]));
+ }
+ return true;
}
+DEF_TRAVERSE_DECL(ClassTemplatePartialSpecializationDecl, {
+ // The partial specialization.
+ if (TemplateParameterList *TPL = D->getTemplateParameters()) {
+ for (TemplateParameterList::iterator I = TPL->begin(), E = TPL->end();
+ I != E; ++I) {
+ TRY_TO(TraverseDecl(*I));
+ }
+ }
+ // The args that remains unspecialized.
+ TRY_TO(TraverseTemplateArgumentLocsHelper(
+ D->getTemplateArgsAsWritten(), D->getNumTemplateArgsAsWritten()));
+
+ // Don't need the ClassTemplatePartialSpecializationHelper, even
+ // though that's our parent class -- we already visit all the
+ // template args here.
+ TRY_TO(TraverseCXXRecordHelper(D));
+ })
+
+DEF_TRAVERSE_DECL(EnumConstantDecl, {
+ TRY_TO(TraverseStmt(D->getInitExpr()));
+ })
+
+DEF_TRAVERSE_DECL(UnresolvedUsingValueDecl, {
+ // Like UnresolvedUsingTypenameDecl, but without the 'typename':
+ // template <class T> Class A : public Base<T> { using Base<T>::foo; };
+ TRY_TO(TraverseNestedNameSpecifier(D->getTargetNestedNameSpecifier()));
+ })
+
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitInjectedClassNameType(
- InjectedClassNameType *T) {
- return getDerived().VisitType(T);
+bool RecursiveASTVisitor<Derived>::TraverseDeclaratorHelper(DeclaratorDecl *D) {
+ TRY_TO(TraverseNestedNameSpecifier(D->getQualifier()));
+ if (D->getTypeSourceInfo())
+ TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
+ return true;
}
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitElaboratedType(ElaboratedType *T) {
- if (T->getQualifier() &&
- getDerived().VisitNestedNameSpecifier(T->getQualifier()))
- return true;
- if (Visit(T->getNamedType()))
- return true;
+DEF_TRAVERSE_DECL(FieldDecl, {
+ TRY_TO(TraverseDeclaratorHelper(D));
+ if (D->isBitField())
+ TRY_TO(TraverseStmt(D->getBitWidth()));
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_DECL(ObjCAtDefsFieldDecl, {
+ TRY_TO(TraverseDeclaratorHelper(D));
+ if (D->isBitField())
+ TRY_TO(TraverseStmt(D->getBitWidth()));
+ // FIXME: implement the rest.
+ })
+
+DEF_TRAVERSE_DECL(ObjCIvarDecl, {
+ TRY_TO(TraverseDeclaratorHelper(D));
+ if (D->isBitField())
+ TRY_TO(TraverseStmt(D->getBitWidth()));
+ // FIXME: implement the rest.
+ })
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitDependentNameType(
- DependentNameType *T) {
- if (T->getQualifier() &&
- getDerived().VisitNestedNameSpecifier(T->getQualifier()))
+bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(FunctionDecl *D) {
+ TRY_TO(TraverseNestedNameSpecifier(D->getQualifier()));
+
+ // Visit the function type itself, which can be either
+ // FunctionNoProtoType or FunctionProtoType, or a typedef. If it's
+ // not a Function*ProtoType, then it can't have a body or arguments,
+ // so we have to do less work.
+ Type *FuncType = D->getType().getTypePtr();
+ if (FunctionProtoType *FuncProto = dyn_cast<FunctionProtoType>(FuncType)) {
+ if (D->isThisDeclarationADefinition()) {
+ // Don't call Traverse*, or the result type and parameter types
+ // will be double counted.
+ TRY_TO(WalkUpFromFunctionProtoType(FuncProto));
+ } else {
+ // This works around a bug in Clang that does not add the parameters
+ // to decls_begin/end for function declarations (as opposed to
+ // definitions):
+ // http://llvm.org/PR7442
+ // We work around this here by traversing the function type.
+ // This isn't perfect because we don't traverse the default
+ // values, if any. It also may not interact great with
+ // templates. But it's the best we can do until the bug is
+ // fixed.
+ // FIXME: replace the entire 'if' statement with
+ // TRY_TO(WalkUpFromFunctionProtoType(FuncProto));
+ // when the bug is fixed.
+ TRY_TO(TraverseFunctionProtoType(FuncProto));
+ return true;
+ }
+ } else if (FunctionNoProtoType *FuncNoProto =
+ dyn_cast<FunctionNoProtoType>(FuncType)) {
+ // Don't call Traverse*, or the result type will be double
+ // counted.
+ TRY_TO(WalkUpFromFunctionNoProtoType(FuncNoProto));
+ } else { // a typedef type, or who knows what
+ assert(!D->isThisDeclarationADefinition() && "Unexpected function type");
+ TRY_TO(TraverseType(D->getType()));
return true;
+ }
- if (T->getTemplateId() &&
- getDerived().VisitTemplateSpecializationType(
- const_cast<TemplateSpecializationType *>(T->getTemplateId())))
- return true;
+ TRY_TO(TraverseType(D->getResultType()));
+ TRY_TO(TraverseDeclContextHelper(D)); // Parameters.
- return getDerived().VisitType(T);
+ if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(D)) {
+ // Constructor initializers.
+ for (CXXConstructorDecl::init_iterator I = Ctor->init_begin(),
+ E = Ctor->init_end();
+ I != E; ++I) {
+ TRY_TO(TraverseConstructorInitializer(*I));
+ }
+ }
+
+ if (D->isThisDeclarationADefinition()) {
+ TRY_TO(TraverseStmt(D->getBody())); // Function body.
+ }
+ return true;
}
+DEF_TRAVERSE_DECL(FunctionDecl, {
+ // We skip decls_begin/decls_end, which are already covered by
+ // TraverseFunctionHelper().
+ return TraverseFunctionHelper(D);
+ })
+
+DEF_TRAVERSE_DECL(CXXMethodDecl, {
+ // We skip decls_begin/decls_end, which are already covered by
+ // TraverseFunctionHelper().
+ return TraverseFunctionHelper(D);
+ })
+
+DEF_TRAVERSE_DECL(CXXConstructorDecl, {
+ // We skip decls_begin/decls_end, which are already covered by
+ // TraverseFunctionHelper().
+ return TraverseFunctionHelper(D);
+ })
+
+// CXXConversionDecl is the declaration of a type conversion operator.
+// It's not a cast expression.
+DEF_TRAVERSE_DECL(CXXConversionDecl, {
+ // We skip decls_begin/decls_end, which are already covered by
+ // TraverseFunctionHelper().
+ return TraverseFunctionHelper(D);
+ })
+
+DEF_TRAVERSE_DECL(CXXDestructorDecl, {
+ // We skip decls_begin/decls_end, which are already covered by
+ // TraverseFunctionHelper().
+ return TraverseFunctionHelper(D);
+ })
+
template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitObjCInterfaceType(
- ObjCInterfaceType *T) {
- return getDerived().VisitObjCObjectType(T);
+bool RecursiveASTVisitor<Derived>::TraverseVarHelper(VarDecl *D) {
+ TRY_TO(TraverseDeclaratorHelper(D));
+ // FIXME: This often double-counts -- for instance, for all local
+ // vars, though not for global vars -- because the initializer is
+ // also captured when the var-decl is in a DeclStmt.
+ TRY_TO(TraverseStmt(D->getInit()));
+ return true;
}
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitObjCObjectType(ObjCObjectType *T) {
- // We have to watch out here because an ObjCInterfaceType's base
- // type is itself.
- if (T->getBaseType().getTypePtr() != T)
- if (Visit(T->getBaseType()))
- return true;
+DEF_TRAVERSE_DECL(VarDecl, {
+ TRY_TO(TraverseVarHelper(D));
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_DECL(ImplicitParamDecl, {
+ TRY_TO(TraverseVarHelper(D));
+ })
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitObjCObjectPointerType(
- ObjCObjectPointerType *T) {
- if (Visit(T->getPointeeType()))
- return true;
+DEF_TRAVERSE_DECL(NonTypeTemplateParmDecl, {
+ // A non-type template parameter, e.g. "S" in template<int S> class Foo ...
+ TRY_TO(TraverseStmt(D->getDefaultArgument()));
+ TRY_TO(TraverseVarHelper(D));
+ })
- return getDerived().VisitType(T);
-}
+DEF_TRAVERSE_DECL(ParmVarDecl, {
+ if (D->hasDefaultArg() &&
+ D->hasUninstantiatedDefaultArg() &&
+ !D->hasUnparsedDefaultArg())
+ TRY_TO(TraverseStmt(D->getUninstantiatedDefaultArg()));
-template<typename Derived>
-bool RecursiveASTVisitorImpl<Derived>::VisitDecl(Decl *D) {
- if (DeclContext *DC = dyn_cast<DeclContext>(D)) {
- for (DeclContext::decl_iterator Child = DC->decls_begin(),
- ChildEnd = DC->decls_end();
- Child != ChildEnd; ++Child)
- if (Visit(*Child))
- return true;
+ if (D->hasDefaultArg() &&
+ !D->hasUninstantiatedDefaultArg() &&
+ !D->hasUnparsedDefaultArg())
+ TRY_TO(TraverseStmt(D->getDefaultArg()));
- return false;
- }
+ TRY_TO(TraverseVarHelper(D));
+ })
- return false;
-}
+#undef DEF_TRAVERSE_DECL
-/// \brief A visitor that recursively walks the entire Clang AST.
-///
-/// Clients of this visitor should subclass the visitor (providing
-/// themselves as the template argument, using the curiously
-/// recurring template pattern) and override any of the Visit*
-/// methods (except Visit()) for declaration, type, statement,
-/// expression, or other AST nodes where the visitor should customize
-/// behavior. Returning "true" from one of these overridden functions
-/// will abort the entire traversal. An overridden Visit* method
-/// will not descend further into the AST for that node unless
-/// Base::Visit* is called.
-template<typename Derived>
-class RecursiveASTVisitor : public RecursiveASTVisitorImpl<Derived> {
- typedef RecursiveASTVisitorImpl<Derived> Impl;
-public:
- typedef RecursiveASTVisitor<Derived> Base;
-
- bool VisitDeclaratorDecl(DeclaratorDecl *D);
- bool VisitFunctionDecl(FunctionDecl *D);
- bool VisitVarDecl(VarDecl *D);
- bool VisitBlockDecl(BlockDecl *D);
- bool VisitDeclStmt(DeclStmt *S);
- bool VisitFunctionType(FunctionType *F);
- bool VisitFunctionProtoType(FunctionProtoType *F);
-};
+// ----------------- Stmt traversal -----------------
+//
+// For stmts, we automate (in the DEF_TRAVERSE_STMT macro) iterating
+// over the children defined in child_begin/child_end (every stmt
+// defines these, though sometimes the range is empty). Each
+// individual Traverse* method only needs to worry about children
+// other than those. To see what child_begin()/end() does for a given
+// class, see, e.g.,
+// http://clang.llvm.org/doxygen/Stmt_8cpp_source.html
+
+// This macro makes available a variable S, the passed-in stmt.
+#define DEF_TRAVERSE_STMT(STMT, CODE) \
+template<typename Derived> \
+bool RecursiveASTVisitor<Derived>::Traverse##STMT (STMT *S) { \
+ TRY_TO(WalkUpFrom##STMT(S)); \
+ { CODE; } \
+ for (Stmt::child_iterator C = S->child_begin(), CEnd = S->child_end(); \
+ C != CEnd; ++C) { \
+ TRY_TO(TraverseStmt(*C)); \
+ } \
+ return true; \
+}
-#define DEFINE_VISIT(Type, Name, Statement) \
- template<typename Derived> \
- bool RecursiveASTVisitor<Derived>::Visit ## Type (Type *Name) { \
- if (Impl::Visit ## Type (Name)) return true; \
- { Statement; } \
- return false; \
- }
+DEF_TRAVERSE_STMT(AsmStmt, {
+ TRY_TO(TraverseStmt(S->getAsmString()));
+ for (unsigned I = 0, E = S->getNumInputs(); I < E; ++I) {
+ TRY_TO(TraverseStmt(S->getInputConstraintLiteral(I)));
+ }
+ for (unsigned I = 0, E = S->getNumOutputs(); I < E; ++I) {
+ TRY_TO(TraverseStmt(S->getOutputConstraintLiteral(I)));
+ }
+ for (unsigned I = 0, E = S->getNumClobbers(); I < E; ++I) {
+ TRY_TO(TraverseStmt(S->getClobber(I)));
+ }
+ // child_begin()/end() iterates over inputExpr and outputExpr.
+ })
-DEFINE_VISIT(DeclaratorDecl, D, {
- if (TypeSourceInfo *TInfo = D->getTypeSourceInfo())
- return this->Visit(TInfo->getType());
+DEF_TRAVERSE_STMT(CXXCatchStmt, {
+ // We don't traverse S->getCaughtType(), as we are already
+ // traversing the exception object, which has this type.
+ // child_begin()/end() iterates over the handler block.
})
-DEFINE_VISIT(FunctionDecl, D, {
- if (D->isThisDeclarationADefinition())
- return this->Visit(D->getBody());
+DEF_TRAVERSE_STMT(ForStmt, {
+ TRY_TO(TraverseDecl(S->getConditionVariable()));
+ // child_begin()/end() iterates over init, cond, inc, and body stmts.
})
-DEFINE_VISIT(VarDecl, D, return this->Visit(D->getInit()))
+DEF_TRAVERSE_STMT(IfStmt, {
+ TRY_TO(TraverseDecl(S->getConditionVariable()));
+ // child_begin()/end() iterates over cond, then, and else stmts.
+ })
-DEFINE_VISIT(BlockDecl, D, return this->Visit(D->getBody()))
+DEF_TRAVERSE_STMT(WhileStmt, {
+ TRY_TO(TraverseDecl(S->getConditionVariable()));
+ // child_begin()/end() iterates over cond, then, and else stmts.
+ })
-DEFINE_VISIT(DeclStmt, S, {
- for (DeclStmt::decl_iterator I = S->decl_begin(), E = S->decl_end();
- I != E; ++I) {
- if (this->Visit(*I))
- return true;
+// These non-expr stmts (most of them), do not need any action except
+// iterating over the children.
+DEF_TRAVERSE_STMT(BreakStmt, { })
+DEF_TRAVERSE_STMT(CompoundStmt, { })
+DEF_TRAVERSE_STMT(ContinueStmt, { })
+DEF_TRAVERSE_STMT(CXXTryStmt, { })
+DEF_TRAVERSE_STMT(DeclStmt, { })
+DEF_TRAVERSE_STMT(DoStmt, { })
+DEF_TRAVERSE_STMT(GotoStmt, { })
+DEF_TRAVERSE_STMT(IndirectGotoStmt, { })
+DEF_TRAVERSE_STMT(LabelStmt, { })
+DEF_TRAVERSE_STMT(NullStmt, { })
+DEF_TRAVERSE_STMT(ObjCAtCatchStmt, { })
+DEF_TRAVERSE_STMT(ObjCAtFinallyStmt, { })
+DEF_TRAVERSE_STMT(ObjCAtSynchronizedStmt, { })
+DEF_TRAVERSE_STMT(ObjCAtThrowStmt, { })
+DEF_TRAVERSE_STMT(ObjCAtTryStmt, { })
+DEF_TRAVERSE_STMT(ObjCForCollectionStmt, { })
+DEF_TRAVERSE_STMT(ReturnStmt, { })
+DEF_TRAVERSE_STMT(SwitchStmt, { })
+DEF_TRAVERSE_STMT(SwitchCase, { })
+DEF_TRAVERSE_STMT(CaseStmt, { })
+DEF_TRAVERSE_STMT(DefaultStmt, { })
+
+DEF_TRAVERSE_STMT(CXXDependentScopeMemberExpr, {
+ if (S->hasExplicitTemplateArgs()) {
+ TRY_TO(TraverseTemplateArgumentLocsHelper(
+ S->getTemplateArgs(), S->getNumTemplateArgs()));
}
+ TRY_TO(TraverseNestedNameSpecifier(S->getQualifier()));
})
-// FunctionType is the common base class of FunctionNoProtoType (a
-// K&R-style function declaration that has no information about
-// its arguments) and FunctionProtoType.
-DEFINE_VISIT(FunctionType, F, return this->Visit(F->getResultType()))
+DEF_TRAVERSE_STMT(DeclRefExpr, {
+ TRY_TO(TraverseTemplateArgumentLocsHelper(
+ S->getTemplateArgs(), S->getNumTemplateArgs()));
+ // FIXME: Should we be recursing on the qualifier?
+ TRY_TO(TraverseNestedNameSpecifier(S->getQualifier()));
+ })
-DEFINE_VISIT(FunctionProtoType, F, {
- for (unsigned i = 0; i != F->getNumArgs(); ++i) {
- if (this->Visit(F->getArgType(i)))
- return true;
- }
- for (unsigned i = 0; i != F->getNumExceptions(); ++i) {
- if (this->Visit(F->getExceptionType(i)))
- return true;
+DEF_TRAVERSE_STMT(DependentScopeDeclRefExpr, {
+ // FIXME: Should we be recursing on these two things?
+ if (S->hasExplicitTemplateArgs()) {
+ TRY_TO(TraverseTemplateArgumentLocsHelper(
+ S->getExplicitTemplateArgs().getTemplateArgs(),
+ S->getNumTemplateArgs()));
}
+ TRY_TO(TraverseNestedNameSpecifier(S->getQualifier()));
})
-#undef DEFINE_VISIT
+DEF_TRAVERSE_STMT(MemberExpr, {
+ TRY_TO(TraverseTemplateArgumentLocsHelper(
+ S->getTemplateArgs(), S->getNumTemplateArgs()));
+ // FIXME: Should we be recursing on the qualifier?
+ TRY_TO(TraverseNestedNameSpecifier(S->getQualifier()));
+ })
-#undef DISPATCH
+DEF_TRAVERSE_STMT(ImplicitCastExpr, {
+ // We don't traverse the cast type, as it's not written in the
+ // source code.
+ })
+
+DEF_TRAVERSE_STMT(CStyleCastExpr, {
+ TRY_TO(TraverseType(S->getTypeAsWritten()));
+ })
+
+DEF_TRAVERSE_STMT(CXXFunctionalCastExpr, {
+ TRY_TO(TraverseType(S->getTypeAsWritten()));
+ })
+
+DEF_TRAVERSE_STMT(CXXConstCastExpr, {
+ TRY_TO(TraverseType(S->getTypeAsWritten()));
+ })
+
+DEF_TRAVERSE_STMT(CXXDynamicCastExpr, {
+ TRY_TO(TraverseType(S->getTypeAsWritten()));
+ })
+
+DEF_TRAVERSE_STMT(CXXReinterpretCastExpr, {
+ TRY_TO(TraverseType(S->getTypeAsWritten()));
+ })
+
+DEF_TRAVERSE_STMT(CXXStaticCastExpr, {
+ TRY_TO(TraverseType(S->getTypeAsWritten()));
+ })
+
+// InitListExpr is a tricky one, because we want to do all our work on
+// the syntactic form of the listexpr, but this method takes the
+// semantic form by default. We can't use the macro helper because it
+// calls WalkUp*() on the semantic form, before our code can convert
+// to the syntactic form.
+template<typename Derived>
+bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(InitListExpr *S) {
+ if (InitListExpr *Syn = S->getSyntacticForm())
+ S = Syn;
+ TRY_TO(WalkUpFromInitListExpr(S));
+ // All we need are the default actions. FIXME: use a helper function.
+ for (Stmt::child_iterator C = S->child_begin(), CEnd = S->child_end();
+ C != CEnd; ++C) {
+ TRY_TO(TraverseStmt(*C));
+ }
+ return true;
+}
+
+DEF_TRAVERSE_STMT(CXXScalarValueInitExpr, {
+ // This is called for code like 'return T()' where T is a built-in
+ // (i.e. non-class) type.
+ if (!S->isImplicit())
+ TRY_TO(TraverseType(S->getType()));
+ })
+
+DEF_TRAVERSE_STMT(CXXNewExpr, {
+ TRY_TO(TraverseType(S->getAllocatedType()));
+ })
+
+// These exprs (most of them), do not need any action except iterating
+// over the children.
+DEF_TRAVERSE_STMT(AddrLabelExpr, { })
+DEF_TRAVERSE_STMT(ArraySubscriptExpr, { })
+DEF_TRAVERSE_STMT(BlockDeclRefExpr, { })
+DEF_TRAVERSE_STMT(BlockExpr, { })
+DEF_TRAVERSE_STMT(ChooseExpr, { })
+DEF_TRAVERSE_STMT(CompoundLiteralExpr, { })
+DEF_TRAVERSE_STMT(CXXBindReferenceExpr, { })
+DEF_TRAVERSE_STMT(CXXBindTemporaryExpr, { })
+DEF_TRAVERSE_STMT(CXXBoolLiteralExpr, { })
+DEF_TRAVERSE_STMT(CXXDefaultArgExpr, { })
+DEF_TRAVERSE_STMT(CXXDeleteExpr, { })
+DEF_TRAVERSE_STMT(CXXExprWithTemporaries, { })
+DEF_TRAVERSE_STMT(CXXNullPtrLiteralExpr, { })
+DEF_TRAVERSE_STMT(CXXPseudoDestructorExpr, { })
+DEF_TRAVERSE_STMT(CXXThisExpr, { })
+DEF_TRAVERSE_STMT(CXXThrowExpr, { })
+DEF_TRAVERSE_STMT(CXXTypeidExpr, { })
+DEF_TRAVERSE_STMT(CXXUnresolvedConstructExpr, { })
+DEF_TRAVERSE_STMT(DesignatedInitExpr, { })
+DEF_TRAVERSE_STMT(ExtVectorElementExpr, { })
+DEF_TRAVERSE_STMT(GNUNullExpr, { })
+DEF_TRAVERSE_STMT(ImplicitValueInitExpr, { })
+DEF_TRAVERSE_STMT(ObjCEncodeExpr, { })
+DEF_TRAVERSE_STMT(ObjCImplicitSetterGetterRefExpr, { })
+DEF_TRAVERSE_STMT(ObjCIsaExpr, { })
+DEF_TRAVERSE_STMT(ObjCIvarRefExpr, { })
+DEF_TRAVERSE_STMT(ObjCMessageExpr, { })
+DEF_TRAVERSE_STMT(ObjCPropertyRefExpr, { })
+DEF_TRAVERSE_STMT(ObjCProtocolExpr, { })
+DEF_TRAVERSE_STMT(ObjCSelectorExpr, { })
+DEF_TRAVERSE_STMT(ObjCSuperExpr, { })
+DEF_TRAVERSE_STMT(OffsetOfExpr, { })
+DEF_TRAVERSE_STMT(ParenExpr, { })
+DEF_TRAVERSE_STMT(ParenListExpr, { })
+DEF_TRAVERSE_STMT(PredefinedExpr, { })
+DEF_TRAVERSE_STMT(ShuffleVectorExpr, { })
+DEF_TRAVERSE_STMT(SizeOfAlignOfExpr, { })
+DEF_TRAVERSE_STMT(StmtExpr, { })
+DEF_TRAVERSE_STMT(TypesCompatibleExpr, { })
+DEF_TRAVERSE_STMT(UnaryTypeTraitExpr, { })
+DEF_TRAVERSE_STMT(UnresolvedLookupExpr, { })
+DEF_TRAVERSE_STMT(UnresolvedMemberExpr, { })
+DEF_TRAVERSE_STMT(VAArgExpr, { })
+DEF_TRAVERSE_STMT(CXXConstructExpr, { })
+
+DEF_TRAVERSE_STMT(CXXTemporaryObjectExpr, {
+ // This is called for code like 'return T()' where T is a class type.
+ TRY_TO(TraverseType(S->getType()));
+ })
+
+DEF_TRAVERSE_STMT(CallExpr, { })
+DEF_TRAVERSE_STMT(CXXMemberCallExpr, { })
+DEF_TRAVERSE_STMT(CXXOperatorCallExpr, { })
+
+// These operators (all of them) do not need any action except
+// iterating over the children.
+DEF_TRAVERSE_STMT(ConditionalOperator, { })
+DEF_TRAVERSE_STMT(UnaryOperator, { })
+DEF_TRAVERSE_STMT(BinaryOperator, { })
+DEF_TRAVERSE_STMT(CompoundAssignOperator, { })
+
+// These literals (all of them) do not need any action.
+DEF_TRAVERSE_STMT(IntegerLiteral, { })
+DEF_TRAVERSE_STMT(CharacterLiteral, { })
+DEF_TRAVERSE_STMT(FloatingLiteral, { })
+DEF_TRAVERSE_STMT(ImaginaryLiteral, { })
+DEF_TRAVERSE_STMT(StringLiteral, { })
+DEF_TRAVERSE_STMT(ObjCStringLiteral, { })
+
+// FIXME: look at the following tricky-seeming exprs to see if we
+// need to recurse on anything. These are ones that have methods
+// returning decls or qualtypes or nestednamespecifier -- though I'm
+// not sure if they own them -- or just seemed very complicated, or
+// had lots of sub-types to explore.
+//
+// VisitOverloadExpr and its children: recurse on template args? etc?
+
+// FIXME: go through all the stmts and exprs again, and see which of them
+// create new types, and recurse on the types (TypeLocs?) of those.
+// Candidates:
+//
+// http://clang.llvm.org/doxygen/classclang_1_1CXXTypeidExpr.html
+// http://clang.llvm.org/doxygen/classclang_1_1SizeOfAlignOfExpr.html
+// http://clang.llvm.org/doxygen/classclang_1_1TypesCompatibleExpr.html
+// http://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html
+// Every class that has getQualifier.
+
+#undef DEF_TRAVERSE_STMT
+
+#undef TRY_TO
} // end namespace clang
diff --git a/include/clang/AST/Redeclarable.h b/include/clang/AST/Redeclarable.h
index 01f4b29a61f4..55e1f8477992 100644
--- a/include/clang/AST/Redeclarable.h
+++ b/include/clang/AST/Redeclarable.h
@@ -92,6 +92,11 @@ public:
return D;
}
+ /// \brief Returns true if this is the first declaration.
+ bool isFirstDeclaration() const {
+ return RedeclLink.NextIsLatest();
+ }
+
/// \brief Returns the most recent (re)declaration of this declaration.
decl_type *getMostRecentDeclaration() {
return getFirstDeclaration()->RedeclLink.getNext();
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index 9deae1561586..a0c95b1fce8c 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -99,11 +99,9 @@ public:
NoStmtClass = 0,
#define STMT(CLASS, PARENT) CLASS##Class,
#define STMT_RANGE(BASE, FIRST, LAST) \
- first##BASE##Constant = FIRST##Class, \
- last##BASE##Constant = LAST##Class,
+ first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
#define LAST_STMT_RANGE(BASE, FIRST, LAST) \
- first##BASE##Constant = FIRST##Class, \
- last##BASE##Constant = LAST##Class
+ first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
#define ABSTRACT_STMT(STMT)
#include "clang/AST/StmtNodes.inc"
};
@@ -617,24 +615,16 @@ public:
/// IfStmt - This represents an if/then/else.
///
class IfStmt : public Stmt {
- enum { COND, THEN, ELSE, END_EXPR };
+ enum { VAR, COND, THEN, ELSE, END_EXPR };
Stmt* SubExprs[END_EXPR];
- /// \brief If non-NULL, the declaration in the "if" statement.
- VarDecl *Var;
-
SourceLocation IfLoc;
SourceLocation ElseLoc;
public:
- IfStmt(SourceLocation IL, VarDecl *var, Expr *cond, Stmt *then,
- SourceLocation EL = SourceLocation(), Stmt *elsev = 0)
- : Stmt(IfStmtClass), Var(var), IfLoc(IL), ElseLoc(EL) {
- SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
- SubExprs[THEN] = then;
- SubExprs[ELSE] = elsev;
- }
-
+ IfStmt(ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond,
+ Stmt *then, SourceLocation EL = SourceLocation(), Stmt *elsev = 0);
+
/// \brief Build an empty if/then/else statement
explicit IfStmt(EmptyShell Empty) : Stmt(IfStmtClass, Empty) { }
@@ -646,8 +636,8 @@ public:
/// printf("x is %d", x);
/// }
/// \endcode
- VarDecl *getConditionVariable() const { return Var; }
- void setConditionVariable(VarDecl *V) { Var = V; }
+ VarDecl *getConditionVariable() const;
+ void setConditionVariable(ASTContext &C, VarDecl *V);
const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); }
@@ -689,9 +679,8 @@ protected:
/// SwitchStmt - This represents a 'switch' stmt.
///
class SwitchStmt : public Stmt {
- enum { COND, BODY, END_EXPR };
+ enum { VAR, COND, BODY, END_EXPR };
Stmt* SubExprs[END_EXPR];
- VarDecl *Var;
// This points to a linked list of case and default statements.
SwitchCase *FirstCase;
SourceLocation SwitchLoc;
@@ -700,12 +689,7 @@ protected:
virtual void DoDestroy(ASTContext &Ctx);
public:
- SwitchStmt(VarDecl *Var, Expr *cond)
- : Stmt(SwitchStmtClass), Var(Var), FirstCase(0)
- {
- SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
- SubExprs[BODY] = NULL;
- }
+ SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond);
/// \brief Build a empty switch statement.
explicit SwitchStmt(EmptyShell Empty) : Stmt(SwitchStmtClass, Empty) { }
@@ -719,8 +703,8 @@ public:
/// // ...
/// }
/// \endcode
- VarDecl *getConditionVariable() const { return Var; }
- void setConditionVariable(VarDecl *V) { Var = V; }
+ VarDecl *getConditionVariable() const;
+ void setConditionVariable(ASTContext &C, VarDecl *V);
const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
const Stmt *getBody() const { return SubExprs[BODY]; }
@@ -768,18 +752,12 @@ public:
/// WhileStmt - This represents a 'while' stmt.
///
class WhileStmt : public Stmt {
- enum { COND, BODY, END_EXPR };
- VarDecl *Var;
+ enum { VAR, COND, BODY, END_EXPR };
Stmt* SubExprs[END_EXPR];
SourceLocation WhileLoc;
public:
- WhileStmt(VarDecl *Var, Expr *cond, Stmt *body, SourceLocation WL)
- : Stmt(WhileStmtClass), Var(Var)
- {
- SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
- SubExprs[BODY] = body;
- WhileLoc = WL;
- }
+ WhileStmt(ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
+ SourceLocation WL);
/// \brief Build an empty while statement.
explicit WhileStmt(EmptyShell Empty) : Stmt(WhileStmtClass, Empty) { }
@@ -792,8 +770,8 @@ public:
/// // ...
/// }
/// \endcode
- VarDecl *getConditionVariable() const { return Var; }
- void setConditionVariable(VarDecl *V) { Var = V; }
+ VarDecl *getConditionVariable() const;
+ void setConditionVariable(ASTContext &C, VarDecl *V);
Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
@@ -875,23 +853,14 @@ public:
/// specified in the source.
///
class ForStmt : public Stmt {
- enum { INIT, COND, INC, BODY, END_EXPR };
+ enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
Stmt* SubExprs[END_EXPR]; // SubExprs[INIT] is an expression or declstmt.
- VarDecl *CondVar;
SourceLocation ForLoc;
SourceLocation LParenLoc, RParenLoc;
public:
- ForStmt(Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, Stmt *Body,
- SourceLocation FL, SourceLocation LP, SourceLocation RP)
- : Stmt(ForStmtClass), CondVar(condVar), ForLoc(FL), LParenLoc(LP),
- RParenLoc(RP)
- {
- SubExprs[INIT] = Init;
- SubExprs[COND] = reinterpret_cast<Stmt*>(Cond);
- SubExprs[INC] = reinterpret_cast<Stmt*>(Inc);
- SubExprs[BODY] = Body;
- }
+ ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc,
+ Stmt *Body, SourceLocation FL, SourceLocation LP, SourceLocation RP);
/// \brief Build an empty for statement.
explicit ForStmt(EmptyShell Empty) : Stmt(ForStmtClass, Empty) { }
@@ -906,8 +875,8 @@ public:
/// // ...
/// }
/// \endcode
- VarDecl *getConditionVariable() const { return CondVar; }
- void setConditionVariable(VarDecl *V) { CondVar = V; }
+ VarDecl *getConditionVariable() const;
+ void setConditionVariable(ASTContext &C, VarDecl *V);
Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
Expr *getInc() { return reinterpret_cast<Expr*>(SubExprs[INC]); }
diff --git a/include/clang/AST/StmtIterator.h b/include/clang/AST/StmtIterator.h
index a48f4e69468a..4da2e3474b1c 100644
--- a/include/clang/AST/StmtIterator.h
+++ b/include/clang/AST/StmtIterator.h
@@ -16,6 +16,7 @@
#include "llvm/System/DataTypes.h"
#include <cassert>
+#include <cstddef>
#include <iterator>
namespace clang {
diff --git a/include/clang/AST/TemplateBase.h b/include/clang/AST/TemplateBase.h
index 8b38001bd104..7d5123fb0449 100644
--- a/include/clang/AST/TemplateBase.h
+++ b/include/clang/AST/TemplateBase.h
@@ -256,6 +256,10 @@ public:
return Args.NumArgs;
}
+ /// Determines whether two template arguments are superficially the
+ /// same.
+ bool structurallyEquals(const TemplateArgument &Other) const;
+
/// \brief Construct a template argument pack.
void setArgumentPack(TemplateArgument *Args, unsigned NumArgs, bool CopyArgs);
@@ -476,6 +480,28 @@ public:
const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
const TemplateArgument &Arg);
+
+inline TemplateSpecializationType::iterator
+ TemplateSpecializationType::end() const {
+ return getArgs() + getNumArgs();
+}
+
+inline DependentTemplateSpecializationType::iterator
+ DependentTemplateSpecializationType::end() const {
+ return getArgs() + getNumArgs();
+}
+
+inline const TemplateArgument &
+ TemplateSpecializationType::getArg(unsigned Idx) const {
+ assert(Idx < getNumArgs() && "Template argument out of range");
+ return getArgs()[Idx];
+}
+
+inline const TemplateArgument &
+ DependentTemplateSpecializationType::getArg(unsigned Idx) const {
+ assert(Idx < getNumArgs() && "Template argument out of range");
+ return getArgs()[Idx];
+}
} // end namespace clang
diff --git a/include/clang/AST/TemplateName.h b/include/clang/AST/TemplateName.h
index 2e3b6df0549b..ddfac712734b 100644
--- a/include/clang/AST/TemplateName.h
+++ b/include/clang/AST/TemplateName.h
@@ -101,6 +101,14 @@ class TemplateName {
}
public:
+ // \brief Kind of name that is actually stored.
+ enum NameKind {
+ Template,
+ OverloadedTemplate,
+ QualifiedTemplate,
+ DependentTemplate
+ };
+
TemplateName() : Storage() { }
explicit TemplateName(TemplateDecl *Template) : Storage(Template) { }
explicit TemplateName(OverloadedTemplateStorage *Storage)
@@ -110,6 +118,9 @@ public:
/// \brief Determine whether this template name is NULL.
bool isNull() const { return Storage.isNull(); }
+
+ // \brief Get the kind of name that is actually stored.
+ NameKind getKind() const;
/// \brief Retrieve the the underlying template declaration that
/// this template name refers to, if known.
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index c24bddb30082..a1a29e6fef6b 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -271,6 +271,8 @@ public:
}
}
+ bool isSupersetOf(Qualifiers Other) const;
+
bool operator==(Qualifiers Other) const { return Mask == Other.Mask; }
bool operator!=(Qualifiers Other) const { return Mask != Other.Mask; }
@@ -627,6 +629,14 @@ public:
bool isAtLeastAsQualifiedAs(QualType Other) const;
QualType getNonReferenceType() const;
+ /// \brief Determine the type of an expression that calls a function of
+ /// with the given result type.
+ ///
+ /// This routine removes a top-level reference (since there are no
+ /// expressions of reference type) and deletes top-level cvr-qualifiers
+ /// from non-class types (in C++) or all types (in C).
+ QualType getCallResultType(ASTContext &Context) const;
+
/// getDesugaredType - Return the specified type with any "sugar" removed from
/// the type. This takes off typedefs, typeof's etc. If the outer level of
/// the type is already concrete, it returns it unmodified. This is similar
@@ -835,6 +845,9 @@ public:
/// Helper methods to distinguish type categories. All type predicates
/// operate on the canonical type, ignoring typedefs and qualifiers.
+ /// isBuiltinType - returns true if the type is a builtin type.
+ bool isBuiltinType() const;
+
/// isSpecificBuiltinType - Test for a particular builtin type.
bool isSpecificBuiltinType(unsigned K) const;
@@ -846,8 +859,11 @@ public:
bool isCharType() const;
bool isWideCharType() const;
bool isAnyCharacterType() const;
- bool isIntegralType() const;
+ bool isIntegralType(ASTContext &Ctx) const;
+ /// \brief Determine whether this type is an integral or enumeration type.
+ bool isIntegralOrEnumerationType() const;
+
/// Floating point categories.
bool isRealFloatingType() const; // C99 6.2.5p10 (float, double, long double)
/// isComplexType() does *not* include complex integers (a GCC extension).
@@ -923,6 +939,10 @@ public:
/// an objective pointer type for the purpose of GC'ability
bool hasObjCPointerRepresentation() const;
+ /// \brief Determine whether this type has a floating-point representation
+ /// of some sort, e.g., it is a floating-point type or a vector thereof.
+ bool hasFloatingRepresentation() const;
+
// Type Checking Functions: Check to see if this type is structurally the
// specified type, ignoring typedefs and qualifiers, and return a pointer to
// the best type we can.
@@ -1001,6 +1021,9 @@ public:
CanQualType getCanonicalTypeUnqualified() const; // in CanonicalType.h
void dump() const;
static bool classof(const Type *) { return true; }
+
+ friend class PCHReader;
+ friend class PCHWriter;
};
template <> inline const TypedefType *Type::getAs() const {
@@ -1640,6 +1663,13 @@ public:
/// Since the constructor takes the number of vector elements, the
/// client is responsible for converting the size into the number of elements.
class VectorType : public Type, public llvm::FoldingSetNode {
+public:
+ enum AltiVecSpecific {
+ NotAltiVec, // is not AltiVec vector
+ AltiVec, // is AltiVec vector
+ Pixel, // is AltiVec 'vector Pixel'
+ Bool // is AltiVec 'vector bool ...'
+ };
protected:
/// ElementType - The element type of the vector.
QualType ElementType;
@@ -1647,21 +1677,16 @@ protected:
/// NumElements - The number of elements in the vector.
unsigned NumElements;
- /// AltiVec - True if this is for an Altivec vector.
- bool AltiVec;
-
- /// Pixel - True if this is for an Altivec vector pixel.
- bool Pixel;
+ AltiVecSpecific AltiVecSpec;
VectorType(QualType vecType, unsigned nElements, QualType canonType,
- bool isAltiVec, bool isPixel) :
+ AltiVecSpecific altiVecSpec) :
Type(Vector, canonType, vecType->isDependentType()),
- ElementType(vecType), NumElements(nElements),
- AltiVec(isAltiVec), Pixel(isPixel) {}
+ ElementType(vecType), NumElements(nElements), AltiVecSpec(altiVecSpec) {}
VectorType(TypeClass tc, QualType vecType, unsigned nElements,
- QualType canonType, bool isAltiVec, bool isPixel)
+ QualType canonType, AltiVecSpecific altiVecSpec)
: Type(tc, canonType, vecType->isDependentType()), ElementType(vecType),
- NumElements(nElements), AltiVec(isAltiVec), Pixel(isPixel) {}
+ NumElements(nElements), AltiVecSpec(altiVecSpec) {}
friend class ASTContext; // ASTContext creates these.
virtual Linkage getLinkageImpl() const;
@@ -1674,22 +1699,18 @@ public:
bool isSugared() const { return false; }
QualType desugar() const { return QualType(this, 0); }
- bool isAltiVec() const { return AltiVec; }
-
- bool isPixel() const { return Pixel; }
-
+ AltiVecSpecific getAltiVecSpecific() const { return AltiVecSpec; }
+
void Profile(llvm::FoldingSetNodeID &ID) {
- Profile(ID, getElementType(), getNumElements(), getTypeClass(),
- AltiVec, Pixel);
+ Profile(ID, getElementType(), getNumElements(), getTypeClass(), AltiVecSpec);
}
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType,
unsigned NumElements, TypeClass TypeClass,
- bool isAltiVec, bool isPixel) {
+ unsigned AltiVecSpec) {
ID.AddPointer(ElementType.getAsOpaquePtr());
ID.AddInteger(NumElements);
ID.AddInteger(TypeClass);
- ID.AddBoolean(isAltiVec);
- ID.AddBoolean(isPixel);
+ ID.AddInteger(AltiVecSpec);
}
static bool classof(const Type *T) {
@@ -1705,7 +1726,7 @@ public:
/// points, colors, and textures (modeled after OpenGL Shading Language).
class ExtVectorType : public VectorType {
ExtVectorType(QualType vecType, unsigned nElements, QualType canonType) :
- VectorType(ExtVector, vecType, nElements, canonType, false, false) {}
+ VectorType(ExtVector, vecType, nElements, canonType, NotAltiVec) {}
friend class ASTContext; // ASTContext creates these.
public:
static int getPointAccessorIdx(char c) {
@@ -1875,6 +1896,7 @@ protected:
public:
QualType getResultType() const { return ResultType; }
+
unsigned getRegParmType() const { return RegParm; }
bool getNoReturnAttr() const { return NoReturn; }
CallingConv getCallConv() const { return (CallingConv)CallConv; }
@@ -1882,6 +1904,12 @@ public:
return ExtInfo(NoReturn, RegParm, (CallingConv)CallConv);
}
+ /// \brief Determine the type of an expression that calls a function of
+ /// this type.
+ QualType getCallResultType(ASTContext &Context) const {
+ return getResultType().getCallResultType(Context);
+ }
+
static llvm::StringRef getNameForCallConv(CallingConv CC);
static bool classof(const Type *T) {
@@ -2416,23 +2444,14 @@ public:
/// dependent.
class TemplateSpecializationType
: public Type, public llvm::FoldingSetNode {
-
- // The ASTContext is currently needed in order to profile expressions.
- // FIXME: avoid this.
- //
- // The bool is whether this is a current instantiation.
- llvm::PointerIntPair<ASTContext*, 1, bool> ContextAndCurrentInstantiation;
-
- /// \brief The name of the template being specialized.
+ /// \brief The name of the template being specialized.
TemplateName Template;
/// \brief - The number of template arguments named in this class
/// template specialization.
unsigned NumArgs;
- TemplateSpecializationType(ASTContext &Context,
- TemplateName T,
- bool IsCurrentInstantiation,
+ TemplateSpecializationType(TemplateName T,
const TemplateArgument *Args,
unsigned NumArgs, QualType Canon);
@@ -2467,13 +2486,13 @@ public:
/// True if this template specialization type matches a current
/// instantiation in the context in which it is found.
bool isCurrentInstantiation() const {
- return ContextAndCurrentInstantiation.getInt();
+ return isa<InjectedClassNameType>(getCanonicalTypeInternal());
}
typedef const TemplateArgument * iterator;
iterator begin() const { return getArgs(); }
- iterator end() const;
+ iterator end() const; // defined inline in TemplateBase.h
/// \brief Retrieve the name of the template that we are specializing.
TemplateName getTemplateName() const { return Template; }
@@ -2488,20 +2507,18 @@ public:
/// \brief Retrieve a specific template argument as a type.
/// \precondition @c isArgType(Arg)
- const TemplateArgument &getArg(unsigned Idx) const;
+ const TemplateArgument &getArg(unsigned Idx) const; // in TemplateBase.h
bool isSugared() const {
return !isDependentType() || isCurrentInstantiation();
}
QualType desugar() const { return getCanonicalTypeInternal(); }
- void Profile(llvm::FoldingSetNodeID &ID) {
- Profile(ID, Template, isCurrentInstantiation(), getArgs(), NumArgs,
- *ContextAndCurrentInstantiation.getPointer());
+ void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Ctx) {
+ Profile(ID, Template, getArgs(), NumArgs, Ctx);
}
static void Profile(llvm::FoldingSetNodeID &ID, TemplateName T,
- bool IsCurrentInstantiation,
const TemplateArgument *Args,
unsigned NumArgs,
ASTContext &Context);
@@ -2545,6 +2562,9 @@ class InjectedClassNameType : public Type {
friend class ASTContext; // ASTContext creates these.
friend class TagDecl; // TagDecl mutilates the Decl
+ friend class PCHReader; // FIXME: ASTContext::getInjectedClassNameType is not
+ // currently suitable for PCH reading, too much
+ // interdependencies.
InjectedClassNameType(CXXRecordDecl *D, QualType TST)
: Type(InjectedClassName, QualType(), true),
Decl(D), InjectedType(TST) {
@@ -2679,6 +2699,7 @@ class ElaboratedType : public TypeWithKeyword, public llvm::FoldingSetNode {
friend class ASTContext; // ASTContext creates these
public:
+ ~ElaboratedType();
/// \brief Retrieve the qualification on this type.
NestedNameSpecifier *getQualifier() const { return NNS; }
@@ -2723,11 +2744,8 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
/// \brief The nested name specifier containing the qualifier.
NestedNameSpecifier *NNS;
- typedef llvm::PointerUnion<const IdentifierInfo *,
- const TemplateSpecializationType *> NameType;
-
/// \brief The type that this typename specifier refers to.
- NameType Name;
+ const IdentifierInfo *Name;
DependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS,
const IdentifierInfo *Name, QualType CanonType)
@@ -2737,17 +2755,10 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
"DependentNameType requires a dependent nested-name-specifier");
}
- DependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS,
- const TemplateSpecializationType *Ty, QualType CanonType)
- : TypeWithKeyword(Keyword, DependentName, CanonType, true),
- NNS(NNS), Name(Ty) {
- assert(NNS->isDependent() &&
- "DependentNameType requires a dependent nested-name-specifier");
- }
-
friend class ASTContext; // ASTContext creates these
public:
+ virtual ~DependentNameType();
/// \brief Retrieve the qualification on this type.
NestedNameSpecifier *getQualifier() const { return NNS; }
@@ -2759,13 +2770,7 @@ public:
/// form of the original typename was terminated by an identifier,
/// e.g., "typename T::type".
const IdentifierInfo *getIdentifier() const {
- return Name.dyn_cast<const IdentifierInfo *>();
- }
-
- /// \brief Retrieve the type named by the typename specifier as a
- /// type specialization.
- const TemplateSpecializationType *getTemplateId() const {
- return Name.dyn_cast<const TemplateSpecializationType *>();
+ return Name;
}
bool isSugared() const { return false; }
@@ -2776,10 +2781,10 @@ public:
}
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword,
- NestedNameSpecifier *NNS, NameType Name) {
+ NestedNameSpecifier *NNS, const IdentifierInfo *Name) {
ID.AddInteger(Keyword);
ID.AddPointer(NNS);
- ID.AddPointer(Name.getOpaqueValue());
+ ID.AddPointer(Name);
}
static bool classof(const Type *T) {
@@ -2788,6 +2793,83 @@ public:
static bool classof(const DependentNameType *T) { return true; }
};
+/// DependentTemplateSpecializationType - Represents a template
+/// specialization type whose template cannot be resolved, e.g.
+/// A<T>::template B<T>
+class DependentTemplateSpecializationType :
+ public TypeWithKeyword, public llvm::FoldingSetNode {
+
+ /// \brief The nested name specifier containing the qualifier.
+ NestedNameSpecifier *NNS;
+
+ /// \brief The identifier of the template.
+ const IdentifierInfo *Name;
+
+ /// \brief - The number of template arguments named in this class
+ /// template specialization.
+ unsigned NumArgs;
+
+ const TemplateArgument *getArgBuffer() const {
+ return reinterpret_cast<const TemplateArgument*>(this+1);
+ }
+ TemplateArgument *getArgBuffer() {
+ return reinterpret_cast<TemplateArgument*>(this+1);
+ }
+
+ DependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword,
+ NestedNameSpecifier *NNS,
+ const IdentifierInfo *Name,
+ unsigned NumArgs,
+ const TemplateArgument *Args,
+ QualType Canon);
+
+ virtual void Destroy(ASTContext& C);
+
+ friend class ASTContext; // ASTContext creates these
+
+public:
+ virtual ~DependentTemplateSpecializationType();
+
+ NestedNameSpecifier *getQualifier() const { return NNS; }
+ const IdentifierInfo *getIdentifier() const { return Name; }
+
+ /// \brief Retrieve the template arguments.
+ const TemplateArgument *getArgs() const {
+ return getArgBuffer();
+ }
+
+ /// \brief Retrieve the number of template arguments.
+ unsigned getNumArgs() const { return NumArgs; }
+
+ const TemplateArgument &getArg(unsigned Idx) const; // in TemplateBase.h
+
+ typedef const TemplateArgument * iterator;
+ iterator begin() const { return getArgs(); }
+ iterator end() const; // inline in TemplateBase.h
+
+ bool isSugared() const { return false; }
+ QualType desugar() const { return QualType(this, 0); }
+
+ void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context) {
+ Profile(ID, Context, getKeyword(), NNS, Name, NumArgs, getArgs());
+ }
+
+ static void Profile(llvm::FoldingSetNodeID &ID,
+ ASTContext &Context,
+ ElaboratedTypeKeyword Keyword,
+ NestedNameSpecifier *Qualifier,
+ const IdentifierInfo *Name,
+ unsigned NumArgs,
+ const TemplateArgument *Args);
+
+ static bool classof(const Type *T) {
+ return T->getTypeClass() == DependentTemplateSpecialization;
+ }
+ static bool classof(const DependentTemplateSpecializationType *T) {
+ return true;
+ }
+};
+
/// ObjCObjectType - Represents a class type in Objective C.
/// Every Objective C type is a combination of a base type and a
/// list of protocols.
@@ -3310,6 +3392,12 @@ inline FunctionType::ExtInfo getFunctionExtInfo(QualType t) {
return getFunctionExtInfo(*t);
}
+/// \brief Determine whether this set of qualifiers is a superset of the given
+/// set of qualifiers.
+inline bool Qualifiers::isSupersetOf(Qualifiers Other) const {
+ return Mask != Other.Mask && (Mask | Other.Mask) == Mask;
+}
+
/// isMoreQualifiedThan - Determine whether this type is more
/// qualified than the Other type. For example, "const volatile int"
/// is more qualified than "const int", "volatile int", and
@@ -3454,6 +3542,10 @@ inline bool Type::isTemplateTypeParmType() const {
return isa<TemplateTypeParmType>(CanonicalType);
}
+inline bool Type::isBuiltinType() const {
+ return getAs<BuiltinType>();
+}
+
inline bool Type::isSpecificBuiltinType(unsigned K) const {
if (const BuiltinType *BT = getAs<BuiltinType>())
if (BT->getKind() == (BuiltinType::Kind) K)
diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h
index f988f0e33b39..842c06878453 100644
--- a/include/clang/AST/TypeLoc.h
+++ b/include/clang/AST/TypeLoc.h
@@ -142,7 +142,7 @@ private:
/// \brief Return the TypeLoc for a type source info.
inline TypeLoc TypeSourceInfo::getTypeLoc() const {
- return TypeLoc(Ty, (void*)(this + 1));
+ return TypeLoc(Ty, const_cast<void*>(static_cast<const void*>(this + 1)));
}
/// \brief Wrapper of type source information for a type with
@@ -657,7 +657,7 @@ struct ObjCInterfaceLocInfo {
};
/// \brief Wrapper for source info for ObjC interfaces.
-class ObjCInterfaceTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
+class ObjCInterfaceTypeLoc : public ConcreteTypeLoc<ObjCObjectTypeLoc,
ObjCInterfaceTypeLoc,
ObjCInterfaceType,
ObjCInterfaceLocInfo> {
@@ -1033,13 +1033,20 @@ public:
setLAngleLoc(Loc);
setRAngleLoc(Loc);
setTemplateNameLoc(Loc);
+ initializeArgLocs(getNumArgs(), getTypePtr()->getArgs(),
+ getArgInfos(), Loc);
+ }
- for (unsigned i = 0, e = getNumArgs(); i != e; ++i) {
+ static void initializeArgLocs(unsigned NumArgs,
+ const TemplateArgument *Args,
+ TemplateArgumentLocInfo *ArgInfos,
+ SourceLocation Loc) {
+ for (unsigned i = 0, e = NumArgs; i != e; ++i) {
TemplateArgumentLocInfo Info;
#ifndef NDEBUG
// If asserts are enabled, be sure to initialize the argument
// loc with the right kind of pointer.
- switch (getTypePtr()->getArg(i).getKind()) {
+ switch (Args[i].getKind()) {
case TemplateArgument::Expression:
case TemplateArgument::Declaration:
Info = TemplateArgumentLocInfo((Expr*) 0);
@@ -1050,7 +1057,7 @@ public:
break;
case TemplateArgument::Template:
- Info = TemplateArgumentLocInfo(SourceRange(), SourceLocation());
+ Info = TemplateArgumentLocInfo(SourceRange(Loc), Loc);
break;
case TemplateArgument::Integral:
@@ -1060,7 +1067,7 @@ public:
break;
}
#endif
- getArgInfos()[i] = Info;
+ ArgInfos[i] = Info;
}
}
@@ -1251,9 +1258,9 @@ public:
}
};
-struct DependentNameLocInfo {
- SourceLocation KeywordLoc;
- SourceRange QualifierRange;
+// This is exactly the structure of an ElaboratedTypeLoc whose inner
+// type is some sort of TypeDeclTypeLoc.
+struct DependentNameLocInfo : ElaboratedLocInfo {
SourceLocation NameLoc;
};
@@ -1303,6 +1310,107 @@ public:
}
};
+// This is exactly the structure of an ElaboratedTypeLoc whose inner
+// type is some sort of TemplateSpecializationTypeLoc.
+struct DependentTemplateSpecializationLocInfo : DependentNameLocInfo {
+ SourceLocation LAngleLoc;
+ SourceLocation RAngleLoc;
+ // followed by a TemplateArgumentLocInfo[]
+};
+
+class DependentTemplateSpecializationTypeLoc :
+ public ConcreteTypeLoc<UnqualTypeLoc,
+ DependentTemplateSpecializationTypeLoc,
+ DependentTemplateSpecializationType,
+ DependentTemplateSpecializationLocInfo> {
+public:
+ SourceLocation getKeywordLoc() const {
+ return this->getLocalData()->KeywordLoc;
+ }
+ void setKeywordLoc(SourceLocation Loc) {
+ this->getLocalData()->KeywordLoc = Loc;
+ }
+
+ SourceRange getQualifierRange() const {
+ return this->getLocalData()->QualifierRange;
+ }
+ void setQualifierRange(SourceRange Range) {
+ this->getLocalData()->QualifierRange = Range;
+ }
+
+ SourceLocation getNameLoc() const {
+ return this->getLocalData()->NameLoc;
+ }
+ void setNameLoc(SourceLocation Loc) {
+ this->getLocalData()->NameLoc = Loc;
+ }
+
+ SourceLocation getLAngleLoc() const {
+ return this->getLocalData()->LAngleLoc;
+ }
+ void setLAngleLoc(SourceLocation Loc) {
+ this->getLocalData()->LAngleLoc = Loc;
+ }
+
+ SourceLocation getRAngleLoc() const {
+ return this->getLocalData()->RAngleLoc;
+ }
+ void setRAngleLoc(SourceLocation Loc) {
+ this->getLocalData()->RAngleLoc = Loc;
+ }
+
+ unsigned getNumArgs() const {
+ return getTypePtr()->getNumArgs();
+ }
+
+ void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI) {
+#ifndef NDEBUG
+ AI.validateForArgument(getTypePtr()->getArg(i));
+#endif
+ getArgInfos()[i] = AI;
+ }
+ TemplateArgumentLocInfo getArgLocInfo(unsigned i) const {
+ return getArgInfos()[i];
+ }
+
+ TemplateArgumentLoc getArgLoc(unsigned i) const {
+ return TemplateArgumentLoc(getTypePtr()->getArg(i), getArgLocInfo(i));
+ }
+
+ SourceRange getLocalSourceRange() const {
+ if (getKeywordLoc().isValid())
+ return SourceRange(getKeywordLoc(), getRAngleLoc());
+ else
+ return SourceRange(getQualifierRange().getBegin(), getRAngleLoc());
+ }
+
+ void copy(DependentTemplateSpecializationTypeLoc Loc) {
+ unsigned size = getFullDataSize();
+ assert(size == Loc.getFullDataSize());
+ memcpy(Data, Loc.Data, size);
+ }
+
+ void initializeLocal(SourceLocation Loc) {
+ setKeywordLoc(Loc);
+ setQualifierRange(SourceRange(Loc));
+ setNameLoc(Loc);
+ setLAngleLoc(Loc);
+ setRAngleLoc(Loc);
+ TemplateSpecializationTypeLoc::initializeArgLocs(getNumArgs(),
+ getTypePtr()->getArgs(),
+ getArgInfos(), Loc);
+ }
+
+ unsigned getExtraLocalDataSize() const {
+ return getNumArgs() * sizeof(TemplateArgumentLocInfo);
+ }
+
+private:
+ TemplateArgumentLocInfo *getArgInfos() const {
+ return static_cast<TemplateArgumentLocInfo*>(getExtraLocalData());
+ }
+};
+
}
#endif
diff --git a/include/clang/AST/TypeLocBuilder.h b/include/clang/AST/TypeLocBuilder.h
index e729488e4313..880af267f324 100644
--- a/include/clang/AST/TypeLocBuilder.h
+++ b/include/clang/AST/TypeLocBuilder.h
@@ -79,7 +79,14 @@ class TypeLocBuilder {
size_t LocalSize = TypeSpecTypeLoc::LocalDataSize;
return cast<TypeSpecTypeLoc>(pushImpl(T, LocalSize));
}
-
+
+ /// Resets this builder to the newly-initialized state.
+ void clear() {
+#ifndef NDEBUG
+ LastTy = QualType();
+#endif
+ Index = Capacity;
+ }
/// Pushes space for a new TypeLoc of the given type. Invalidates
/// any TypeLocs previously retrieved from this builder.
diff --git a/include/clang/AST/TypeNodes.def b/include/clang/AST/TypeNodes.def
index 02508af67dd8..9cb56861a9ef 100644
--- a/include/clang/AST/TypeNodes.def
+++ b/include/clang/AST/TypeNodes.def
@@ -92,6 +92,7 @@ NON_CANONICAL_TYPE(SubstTemplateTypeParm, Type)
NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TemplateSpecialization, Type)
DEPENDENT_TYPE(InjectedClassName, Type)
DEPENDENT_TYPE(DependentName, Type)
+DEPENDENT_TYPE(DependentTemplateSpecialization, Type)
TYPE(ObjCObject, Type)
TYPE(ObjCInterface, ObjCObjectType)
TYPE(ObjCObjectPointer, Type)
diff --git a/include/clang/AST/UsuallyTinyPtrVector.h b/include/clang/AST/UsuallyTinyPtrVector.h
index 5ee40e05c956..534d4d4a367f 100644
--- a/include/clang/AST/UsuallyTinyPtrVector.h
+++ b/include/clang/AST/UsuallyTinyPtrVector.h
@@ -41,6 +41,7 @@ public:
typedef const T **iterator;
iterator begin() const;
iterator end() const;
+ size_t size() const;
void push_back(T *Method);
void Destroy();
@@ -56,7 +57,6 @@ UsuallyTinyPtrVector<T>::begin() const {
return &Vec->front();
}
-
template<typename T>
typename UsuallyTinyPtrVector<T>::iterator
UsuallyTinyPtrVector<T>::end() const {
@@ -72,6 +72,15 @@ UsuallyTinyPtrVector<T>::end() const {
}
template<typename T>
+size_t UsuallyTinyPtrVector<T>::size() const {
+ if ((Storage & 0x01) == 0)
+ return (Storage == 0) ? 0 : 1;
+
+ vector_type *Vec = reinterpret_cast<vector_type *>(Storage & ~0x01);
+ return Vec->size();
+}
+
+template<typename T>
void UsuallyTinyPtrVector<T>::push_back(T *Element) {
if (Storage == 0) {
// 0 -> 1 element.
diff --git a/include/clang/Analysis/Analyses/PrintfFormatString.h b/include/clang/Analysis/Analyses/PrintfFormatString.h
index e4f7c57061d4..d907637d39c5 100644
--- a/include/clang/Analysis/Analyses/PrintfFormatString.h
+++ b/include/clang/Analysis/Analyses/PrintfFormatString.h
@@ -25,8 +25,8 @@ namespace analyze_printf {
class ArgTypeResult {
public:
- enum Kind { UnknownTy, InvalidTy, SpecificTy, ObjCPointerTy, CStrTy,
- WCStrTy };
+ enum Kind { UnknownTy, InvalidTy, SpecificTy, ObjCPointerTy, CPointerTy,
+ CStrTy, WCStrTy };
private:
const Kind K;
QualType T;
@@ -57,6 +57,7 @@ public:
InvalidSpecifier = 0,
// C99 conversion specifiers.
dArg, // 'd'
+ IntAsCharArg, // 'c'
iArg, // 'i',
oArg, // 'o',
uArg, // 'u',
@@ -70,7 +71,6 @@ public:
GArg, // 'G',
aArg, // 'a',
AArg, // 'A',
- IntAsCharArg, // 'c'
CStrArg, // 's'
VoidPtrArg, // 'p'
OutIntPtrArg, // 'n'
@@ -124,45 +124,87 @@ public:
bool isUIntArg() const { return kind >= oArg && kind <= XArg; }
bool isDoubleArg() const { return kind >= fArg && kind <= AArg; }
Kind getKind() const { return kind; }
+ void setKind(Kind k) { kind = k; }
unsigned getLength() const {
// Conversion specifiers currently only are represented by
// single characters, but we be flexible.
return 1;
}
+ const char *toString() const;
private:
const char *Position;
Kind kind;
};
-enum LengthModifier {
- None,
- AsChar, // 'hh'
- AsShort, // 'h'
- AsLong, // 'l'
- AsLongLong, // 'll', 'q' (BSD, deprecated)
- AsIntMax, // 'j'
- AsSizeT, // 'z'
- AsPtrDiff, // 't'
- AsLongDouble, // 'L'
- AsWideChar = AsLong // for '%ls'
+class LengthModifier {
+public:
+ enum Kind {
+ None,
+ AsChar, // 'hh'
+ AsShort, // 'h'
+ AsLong, // 'l'
+ AsLongLong, // 'll', 'q' (BSD, deprecated)
+ AsIntMax, // 'j'
+ AsSizeT, // 'z'
+ AsPtrDiff, // 't'
+ AsLongDouble, // 'L'
+ AsWideChar = AsLong // for '%ls'
+ };
+
+ LengthModifier()
+ : Position(0), kind(None) {}
+ LengthModifier(const char *pos, Kind k)
+ : Position(pos), kind(k) {}
+
+ const char *getStart() const {
+ return Position;
+ }
+
+ unsigned getLength() const {
+ switch (kind) {
+ default:
+ return 1;
+ case AsLongLong:
+ case AsChar:
+ return 2;
+ case None:
+ return 0;
+ }
+ }
+
+ Kind getKind() const { return kind; }
+ void setKind(Kind k) { kind = k; }
+
+ const char *toString() const;
+
+private:
+ const char *Position;
+ Kind kind;
};
class OptionalAmount {
public:
enum HowSpecified { NotSpecified, Constant, Arg, Invalid };
- OptionalAmount(HowSpecified h, unsigned i, const char *st)
- : start(st), hs(h), amt(i) {}
+ OptionalAmount(HowSpecified howSpecified,
+ unsigned amount,
+ const char *amountStart,
+ unsigned amountLength,
+ bool usesPositionalArg)
+ : start(amountStart), length(amountLength), hs(howSpecified), amt(amount),
+ UsesPositionalArg(usesPositionalArg), UsesDotPrefix(0) {}
- OptionalAmount(bool b = true)
- : start(0), hs(b ? NotSpecified : Invalid), amt(0) {}
+ OptionalAmount(bool valid = true)
+ : start(0),length(0), hs(valid ? NotSpecified : Invalid), amt(0),
+ UsesPositionalArg(0), UsesDotPrefix(0) {}
bool isInvalid() const {
return hs == Invalid;
}
HowSpecified getHowSpecified() const { return hs; }
+ void setHowSpecified(HowSpecified h) { hs = h; }
bool hasDataArgument() const { return hs == Arg; }
@@ -177,36 +219,87 @@ public:
}
const char *getStart() const {
- return start;
+ // We include the . character if it is given.
+ return start - UsesDotPrefix;
+ }
+
+ unsigned getConstantLength() const {
+ assert(hs == Constant);
+ return length + UsesDotPrefix;
}
ArgTypeResult getArgType(ASTContext &Ctx) const;
+ void toString(llvm::raw_ostream &os) const;
+
+ bool usesPositionalArg() const { return (bool) UsesPositionalArg; }
+ unsigned getPositionalArgIndex() const {
+ assert(hasDataArgument());
+ return amt + 1;
+ }
+
+ bool usesDotPrefix() const { return UsesDotPrefix; }
+ void setUsesDotPrefix() { UsesDotPrefix = true; }
+
private:
const char *start;
+ unsigned length;
HowSpecified hs;
unsigned amt;
+ bool UsesPositionalArg : 1;
+ bool UsesDotPrefix;
+};
+
+// Class representing optional flags with location and representation
+// information.
+class OptionalFlag {
+public:
+ OptionalFlag(const char *Representation)
+ : representation(Representation), flag(false) {}
+ bool isSet() { return flag; }
+ void set() { flag = true; }
+ void clear() { flag = false; }
+ void setPosition(const char *position) {
+ assert(position);
+ this->position = position;
+ }
+ const char *getPosition() const {
+ assert(position);
+ return position;
+ }
+ const char *toString() const { return representation; }
+
+ // Overloaded operators for bool like qualities
+ operator bool() const { return flag; }
+ OptionalFlag& operator=(const bool &rhs) {
+ flag = rhs;
+ return *this; // Return a reference to myself.
+ }
+private:
+ const char *representation;
+ const char *position;
+ bool flag;
};
class FormatSpecifier {
LengthModifier LM;
- unsigned IsLeftJustified : 1;
- unsigned HasPlusPrefix : 1;
- unsigned HasSpacePrefix : 1;
- unsigned HasAlternativeForm : 1;
- unsigned HasLeadingZeroes : 1;
+ OptionalFlag IsLeftJustified; // '-'
+ OptionalFlag HasPlusPrefix; // '+'
+ OptionalFlag HasSpacePrefix; // ' '
+ OptionalFlag HasAlternativeForm; // '#'
+ OptionalFlag HasLeadingZeroes; // '0'
/// Positional arguments, an IEEE extension:
/// IEEE Std 1003.1, 2004 Edition
/// http://www.opengroup.org/onlinepubs/009695399/functions/printf.html
- unsigned UsesPositionalArg : 1;
+ bool UsesPositionalArg;
unsigned argIndex;
ConversionSpecifier CS;
OptionalAmount FieldWidth;
OptionalAmount Precision;
public:
- FormatSpecifier() : LM(None),
- IsLeftJustified(0), HasPlusPrefix(0), HasSpacePrefix(0),
- HasAlternativeForm(0), HasLeadingZeroes(0), UsesPositionalArg(0),
+ FormatSpecifier() :
+ IsLeftJustified("-"), HasPlusPrefix("+"), HasSpacePrefix(" "),
+ HasAlternativeForm("#"), HasLeadingZeroes("0"), UsesPositionalArg(false),
argIndex(0) {}
static FormatSpecifier Parse(const char *beg, const char *end);
@@ -218,12 +311,27 @@ public:
void setLengthModifier(LengthModifier lm) {
LM = lm;
}
- void setIsLeftJustified() { IsLeftJustified = 1; }
- void setHasPlusPrefix() { HasPlusPrefix = 1; }
- void setHasSpacePrefix() { HasSpacePrefix = 1; }
- void setHasAlternativeForm() { HasAlternativeForm = 1; }
- void setHasLeadingZeros() { HasLeadingZeroes = 1; }
- void setUsesPositionalArg() { UsesPositionalArg = 1; }
+ void setIsLeftJustified(const char *position) {
+ IsLeftJustified = true;
+ IsLeftJustified.setPosition(position);
+ }
+ void setHasPlusPrefix(const char *position) {
+ HasPlusPrefix = true;
+ HasPlusPrefix.setPosition(position);
+ }
+ void setHasSpacePrefix(const char *position) {
+ HasSpacePrefix = true;
+ HasSpacePrefix.setPosition(position);
+ }
+ void setHasAlternativeForm(const char *position) {
+ HasAlternativeForm = true;
+ HasAlternativeForm.setPosition(position);
+ }
+ void setHasLeadingZeros(const char *position) {
+ HasLeadingZeroes = true;
+ HasLeadingZeroes.setPosition(position);
+ }
+ void setUsesPositionalArg() { UsesPositionalArg = true; }
void setArgIndex(unsigned i) {
assert(CS.consumesDataArgument());
@@ -235,13 +343,18 @@ public:
return argIndex;
}
+ unsigned getPositionalArgIndex() const {
+ assert(CS.consumesDataArgument());
+ return argIndex + 1;
+ }
+
// Methods for querying the format specifier.
const ConversionSpecifier &getConversionSpecifier() const {
return CS;
}
- LengthModifier getLengthModifier() const {
+ const LengthModifier &getLengthModifier() const {
return LM;
}
@@ -255,6 +368,7 @@ public:
void setPrecision(const OptionalAmount &Amt) {
Precision = Amt;
+ Precision.setUsesDotPrefix();
}
const OptionalAmount &getPrecision() const {
@@ -268,12 +382,30 @@ public:
/// more than one type.
ArgTypeResult getArgType(ASTContext &Ctx) const;
- bool isLeftJustified() const { return (bool) IsLeftJustified; }
- bool hasPlusPrefix() const { return (bool) HasPlusPrefix; }
- bool hasAlternativeForm() const { return (bool) HasAlternativeForm; }
- bool hasLeadingZeros() const { return (bool) HasLeadingZeroes; }
- bool hasSpacePrefix() const { return (bool) HasSpacePrefix; }
- bool usesPositionalArg() const { return (bool) UsesPositionalArg; }
+ const OptionalFlag &isLeftJustified() const { return IsLeftJustified; }
+ const OptionalFlag &hasPlusPrefix() const { return HasPlusPrefix; }
+ const OptionalFlag &hasAlternativeForm() const { return HasAlternativeForm; }
+ const OptionalFlag &hasLeadingZeros() const { return HasLeadingZeroes; }
+ const OptionalFlag &hasSpacePrefix() const { return HasSpacePrefix; }
+ bool usesPositionalArg() const { return UsesPositionalArg; }
+
+ /// Changes the specifier and length according to a QualType, retaining any
+ /// flags or options. Returns true on success, or false when a conversion
+ /// was not successful.
+ bool fixType(QualType QT);
+
+ void toString(llvm::raw_ostream &os) const;
+
+ // Validation methods - to check if any element results in undefined behavior
+ bool hasValidPlusPrefix() const;
+ bool hasValidAlternativeForm() const;
+ bool hasValidLeadingZeros() const;
+ bool hasValidSpacePrefix() const;
+ bool hasValidLeftJustified() const;
+
+ bool hasValidLengthModifier() const;
+ bool hasValidPrecision() const;
+ bool hasValidFieldWidth() const;
};
enum PositionContext { FieldWidthPos = 0, PrecisionPos = 1 };
diff --git a/include/clang/Analysis/Support/BumpVector.h b/include/clang/Analysis/Support/BumpVector.h
index c6c9eedcbf09..7cd481238f81 100644
--- a/include/clang/Analysis/Support/BumpVector.h
+++ b/include/clang/Analysis/Support/BumpVector.h
@@ -24,6 +24,7 @@
#include "llvm/ADT/PointerIntPair.h"
#include <algorithm>
#include <cstring>
+#include <memory>
namespace clang {
diff --git a/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h b/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
index d627b88967f2..f20a49a6fcd8 100644
--- a/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
+++ b/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
@@ -22,13 +22,14 @@
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclCXX.h"
-#define DISPATCH_CASE(CASE,CLASS) \
-case Decl::CASE: \
-static_cast<ImplClass*>(this)->Visit##CLASS(static_cast<CLASS*>(D));\
+#define DISPATCH_CASE(CLASS) \
+case Decl::CLASS: \
+static_cast<ImplClass*>(this)->Visit##CLASS##Decl( \
+ static_cast<CLASS##Decl*>(D)); \
break;
-#define DEFAULT_DISPATCH(CLASS) void Visit##CLASS(CLASS* D) {}
-#define DEFAULT_DISPATCH_VARDECL(CLASS) void Visit##CLASS(CLASS* D)\
+#define DEFAULT_DISPATCH(CLASS) void Visit##CLASS##Decl(CLASS##Decl* D) {}
+#define DEFAULT_DISPATCH_VARDECL(CLASS) void Visit##CLASS##Decl(CLASS##Decl* D)\
{ static_cast<ImplClass*>(this)->VisitVarDecl(D); }
@@ -55,34 +56,39 @@ public:
void VisitDecl(Decl* D) {
switch (D->getKind()) {
- DISPATCH_CASE(Function,FunctionDecl)
- DISPATCH_CASE(CXXMethod,CXXMethodDecl)
- DISPATCH_CASE(Var,VarDecl)
- DISPATCH_CASE(ParmVar,ParmVarDecl) // FIXME: (same)
- DISPATCH_CASE(ImplicitParam,ImplicitParamDecl)
- DISPATCH_CASE(EnumConstant,EnumConstantDecl)
- DISPATCH_CASE(Typedef,TypedefDecl)
- DISPATCH_CASE(Record,RecordDecl) // FIXME: Refine. VisitStructDecl?
- DISPATCH_CASE(Enum,EnumDecl)
+ DISPATCH_CASE(Function)
+ DISPATCH_CASE(CXXMethod)
+ DISPATCH_CASE(Var)
+ DISPATCH_CASE(ParmVar) // FIXME: (same)
+ DISPATCH_CASE(ImplicitParam)
+ DISPATCH_CASE(EnumConstant)
+ DISPATCH_CASE(Typedef)
+ DISPATCH_CASE(Record) // FIXME: Refine. VisitStructDecl?
+ DISPATCH_CASE(CXXRecord)
+ DISPATCH_CASE(Enum)
default:
assert(false && "Subtype of ScopedDecl not handled.");
}
}
- DEFAULT_DISPATCH(VarDecl)
- DEFAULT_DISPATCH(FunctionDecl)
- DEFAULT_DISPATCH(CXXMethodDecl)
- DEFAULT_DISPATCH_VARDECL(ParmVarDecl)
- DEFAULT_DISPATCH(ImplicitParamDecl)
- DEFAULT_DISPATCH(EnumConstantDecl)
- DEFAULT_DISPATCH(TypedefDecl)
- DEFAULT_DISPATCH(RecordDecl)
- DEFAULT_DISPATCH(EnumDecl)
- DEFAULT_DISPATCH(ObjCInterfaceDecl)
- DEFAULT_DISPATCH(ObjCClassDecl)
- DEFAULT_DISPATCH(ObjCMethodDecl)
- DEFAULT_DISPATCH(ObjCProtocolDecl)
- DEFAULT_DISPATCH(ObjCCategoryDecl)
+ DEFAULT_DISPATCH(Var)
+ DEFAULT_DISPATCH(Function)
+ DEFAULT_DISPATCH(CXXMethod)
+ DEFAULT_DISPATCH_VARDECL(ParmVar)
+ DEFAULT_DISPATCH(ImplicitParam)
+ DEFAULT_DISPATCH(EnumConstant)
+ DEFAULT_DISPATCH(Typedef)
+ DEFAULT_DISPATCH(Record)
+ DEFAULT_DISPATCH(Enum)
+ DEFAULT_DISPATCH(ObjCInterface)
+ DEFAULT_DISPATCH(ObjCClass)
+ DEFAULT_DISPATCH(ObjCMethod)
+ DEFAULT_DISPATCH(ObjCProtocol)
+ DEFAULT_DISPATCH(ObjCCategory)
+
+ void VisitCXXRecordDecl(CXXRecordDecl *D) {
+ static_cast<ImplClass*>(this)->VisitRecordDecl(D);
+ }
};
} // end namespace clang
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td
new file mode 100644
index 000000000000..98871d26204f
--- /dev/null
+++ b/include/clang/Basic/Attr.td
@@ -0,0 +1,382 @@
+////////////////////////////////////////////////////////////////////////////////
+// Note: This file is a work in progress. Please do not apply non-trivial
+// updates unless you have talked to Sean Hunt <rideau3@gmail.com> prior.
+// Merely adding a new attribute is a trivial update.
+////////////////////////////////////////////////////////////////////////////////
+
+// An attribute's subject is whatever it appertains to. In this file, it is
+// more accurately a list of things that an attribute can appertain to. All
+// Decls and Stmts are possibly AttrSubjects (even though the syntax may not
+// allow attributes on a given Decl or Stmt).
+class AttrSubject;
+
+include "clang/Basic/DeclNodes.td"
+include "clang/Basic/StmtNodes.td"
+
+// A subset-subject is an AttrSubject constrained to operate only on some subset
+// of that subject.
+//
+// The description is used in output messages to specify what the subject
+// represents. FIXME: Deal with translation issues.
+//
+// The code fragment is a boolean expression that will confirm that the subject
+// meets the requirements; the subject will have the name S, and will have the
+// type specified by the base. It should be a simple boolean expression.
+class SubsetSubject<AttrSubject base, string description, code check>
+ : AttrSubject {
+ AttrSubject Base = base;
+ string Description = description;
+ code CheckCode = check;
+}
+
+// This is the type of a variable which C++0x defines [[aligned()]] as being
+// a possible subject.
+def NormalVar : SubsetSubject<Var, "non-register, non-parameter variable",
+ [{S->getStorageClass() != VarDecl::Register &&
+ S->getKind() != Decl::ImplicitParam
+ S->getKind() != Decl::ParmVar
+ S->getKind() != Decl::NonTypeTemplateParm}]>;
+def CXXVirtualMethod : SubsetSubject<CXXRecord, "virtual member function",
+ [{S->isVirtual()}]>;
+def NonBitField : SubsetSubject<Field, "non-bit field",
+ [{!S->isBitField()}]>;
+
+// A single argument to an attribute
+class Argument<string name> {
+ string Name = name;
+}
+
+class IdentifierArgument<string name> : Argument<name>;
+class IntArgument<string name> : Argument<name>;
+class StringArgument<string name> : Argument<name>;
+class ExprArgument<string name> : Argument<name>;
+class FunctionArgument<string name> : Argument<name>;
+class ObjCInterfaceArgument<string name> : Argument<name>;
+class UnsignedIntArgument<string name> : Argument<name>;
+class UnsignedIntOrTypeArgument<string name> : Argument<name>;
+
+// An integer argument with a default value
+class DefaultIntArgument<string name, int default> : IntArgument<name> {
+ int Default = default;
+}
+
+// Zero or more arguments of a type
+class VariadicArgument<Argument arg> : Argument<arg.Name> {
+ Argument VariadicArg = arg;
+}
+
+class Attr {
+ // The various ways in which an attribute can be spelled in source
+ list<string> Spellings;
+ // The things to which an attribute can appertain
+ list<AttrSubject> Subjects;
+ // The arguments allowed on an attribute
+ list<Argument> Args = [];
+ // The namespaces in which the attribute appears in C++0x attributes.
+ // The attribute will not be permitted in C++0x attribute-specifiers if
+ // this is empty; the empty string can be used as a namespace.
+ list<string> Namespaces = [];
+ // A temporary development bit to tell TableGen not to emit certain
+ // information about the attribute.
+ bit DoNotEmit = 1;
+}
+
+//
+// Attributes begin here
+//
+
+def Alias : Attr {
+ let Spellings = ["alias"];
+ let Args = [StringArgument<"AliasName">];
+}
+
+def Aligned : Attr {
+ let Spellings = ["align", "aligned"];
+ let Subjects = [NonBitField, NormalVar, Tag];
+ let Args = [UnsignedIntOrTypeArgument<"Alignment">];
+ let Namespaces = ["", "std"];
+}
+
+def AlignMac68k : Attr {
+ let Spellings = [];
+}
+
+def AlwaysInline : Attr {
+ let Spellings = ["always_inline"];
+}
+
+def AnalyzerNoReturn : Attr {
+ let Spellings = ["analyzer_noreturn"];
+}
+
+def Annotate : Attr {
+ let Spellings = ["annotate"];
+ let Args = [StringArgument<"Annotation">];
+}
+
+def AsmLabel : Attr {
+ let Spellings = [];
+ let Args = [StringArgument<"Label">];
+}
+
+def BaseCheck : Attr {
+ let Spellings = ["base_check"];
+ let Subjects = [CXXRecord];
+ let Namespaces = ["", "std"];
+ let DoNotEmit = 0;
+}
+
+def Blocks : Attr {
+ let Spellings = ["blocks"];
+ let Args = [IdentifierArgument<"Type">];
+}
+
+def CarriesDependency : Attr {
+ let Spellings = ["carries_dependency"];
+ let Subjects = [ParmVar, Function];
+ let Namespaces = ["", "std"];
+ let DoNotEmit = 0;
+}
+
+def CDecl : Attr {
+ let Spellings = ["cdecl", "__cdecl"];
+}
+
+def CFReturnsRetained : Attr {
+ let Spellings = ["cf_returns_retained"];
+}
+
+def CFReturnsNotRetained : Attr {
+ let Spellings = ["cf_returns_not_retained"];
+}
+
+def Cleanup : Attr {
+ let Spellings = ["cleanup"];
+ let Args = [FunctionArgument<"FunctionDecl">];
+}
+
+def Const : Attr {
+ let Spellings = ["const"];
+}
+
+def Constructor : Attr {
+ let Spellings = ["constructor"];
+ let Args = [IntArgument<"Priority">];
+}
+
+def Deprecated : Attr {
+ let Spellings = ["deprecated"];
+}
+
+def Destructor : Attr {
+ let Spellings = ["destructor"];
+ let Args = [IntArgument<"Priority">];
+}
+
+def DLLExport : Attr {
+ let Spellings = ["dllexport"];
+}
+
+def DLLImport : Attr {
+ let Spellings = ["dllimport"];
+}
+
+def FastCall : Attr {
+ let Spellings = ["fastcall", "__fastcall"];
+}
+
+def Final : Attr {
+ let Spellings = ["final"];
+ let Subjects = [CXXRecord, CXXVirtualMethod];
+ let Namespaces = ["", "std"];
+ let DoNotEmit = 0;
+}
+
+def Format : Attr {
+ let Spellings = ["format"];
+ let Args = [StringArgument<"Type">, IntArgument<"FormatIdx">,
+ IntArgument<"FirstArg">];
+}
+
+def FormatArg : Attr {
+ let Spellings = ["format_arg"];
+ let Args = [IntArgument<"FormatIdx">];
+}
+
+def GNUInline : Attr {
+ let Spellings = ["gnu_inline"];
+}
+
+def Hiding : Attr {
+ let Spellings = ["hiding"];
+ let Subjects = [Field, CXXMethod];
+ let Namespaces = ["", "std"];
+ let DoNotEmit = 0;
+}
+
+def IBAction : Attr {
+ let Spellings = ["ibaction"];
+}
+
+def IBOutlet : Attr {
+ let Spellings = ["iboutlet"];
+}
+
+def IBOutletCollection : Attr {
+ let Spellings = ["iboutletcollection"];
+ let Args = [ObjCInterfaceArgument<"Class">];
+}
+
+def Malloc : Attr {
+ let Spellings = ["malloc"];
+}
+
+def MaxFieldAlignment : Attr {
+ let Spellings = [];
+ let Args = [UnsignedIntArgument<"Alignment">];
+}
+
+def MSP430Interrupt : Attr {
+ let Spellings = [];
+ let Args = [UnsignedIntArgument<"Number">];
+}
+
+def NoDebug : Attr {
+ let Spellings = ["nodebug"];
+}
+
+def NoInline : Attr {
+ let Spellings = ["noinline"];
+}
+
+def NonNull : Attr {
+ let Spellings = ["nonnull"];
+ let Args = [VariadicArgument<UnsignedIntArgument<"Args">>];
+}
+
+def NoReturn : Attr {
+ let Spellings = ["noreturn"];
+ // FIXME: Does GCC allow this on the function instead?
+ let Subjects = [Function];
+ let Namespaces = ["", "std"];
+}
+
+def NoInstrumentFunction : Attr {
+ let Spellings = ["no_instrument_function"];
+ let Subjects = [Function];
+}
+
+def NoThrow : Attr {
+ let Spellings = ["nothrow"];
+}
+
+def NSReturnsRetained : Attr {
+ let Spellings = ["ns_returns_retained"];
+}
+
+def NSReturnsNotRetained : Attr {
+ let Spellings = ["ns_returns_not_retained"];
+}
+
+def ObjCException : Attr {
+ let Spellings = ["objc_exception"];
+}
+
+def ObjCNSObject : Attr {
+ let Spellings = ["NSOjbect"];
+}
+
+def Override : Attr {
+ let Spellings = ["override"];
+ let Subjects = [CXXVirtualMethod];
+ let Namespaces = ["", "std"];
+ let DoNotEmit = 0;
+}
+
+def Overloadable : Attr {
+ let Spellings = ["overloadable"];
+}
+
+def Packed : Attr {
+ let Spellings = ["packed"];
+}
+
+def Pure : Attr {
+ let Spellings = ["pure"];
+}
+
+def Regparm : Attr {
+ let Spellings = ["regparm"];
+ let Args = [UnsignedIntArgument<"NumParams">];
+}
+
+def ReqdWorkGroupSize : Attr {
+ let Spellings = ["reqd_work_group_size"];
+ let Args = [UnsignedIntArgument<"XDim">, UnsignedIntArgument<"YDim">,
+ UnsignedIntArgument<"ZDim">];
+}
+
+def InitPriority : Attr {
+ let Spellings = ["init_priority"];
+ let Args = [UnsignedIntArgument<"Priority">];
+}
+
+def Section : Attr {
+ let Spellings = ["section"];
+ let Args = [StringArgument<"Name">];
+}
+
+def Sentinel : Attr {
+ let Spellings = ["sentinel"];
+ let Args = [DefaultIntArgument<"NulPos", 0>,
+ DefaultIntArgument<"Sentinel", 0>];
+}
+
+def StdCall : Attr {
+ let Spellings = ["stdcall", "__stdcall"];
+}
+
+def ThisCall : Attr {
+ let Spellings = ["thiscall", "__thiscall"];
+}
+
+def TransparentUnion : Attr {
+ let Spellings = ["transparent_union"];
+}
+
+def Unavailable : Attr {
+ let Spellings = ["unavailable"];
+}
+
+def Unused : Attr {
+ let Spellings = ["unused"];
+}
+
+def Used : Attr {
+ let Spellings = ["used"];
+}
+
+def Visibility : Attr {
+ let Spellings = ["visibility"];
+ let Args = [StringArgument<"Visibility">];
+}
+
+def WarnUnusedResult : Attr {
+ let Spellings = ["warn_unused_result"];
+}
+
+def Weak : Attr {
+ let Spellings = ["weak"];
+}
+
+def WeakImport : Attr {
+ let Spellings = ["weak_import"];
+}
+
+def WeakRef : Attr {
+ let Spellings = ["weakref"];
+}
+
+def X86ForceAlignArgPointer : Attr {
+ let Spellings = [];
+}
diff --git a/include/clang/Basic/AttrKinds.h b/include/clang/Basic/AttrKinds.h
new file mode 100644
index 000000000000..822573b734a7
--- /dev/null
+++ b/include/clang/Basic/AttrKinds.h
@@ -0,0 +1,31 @@
+//===----- Attr.h - Enum values for C Attribute Kinds ----------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the attr::Kind enum
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_ATTRKINDS_H
+#define LLVM_CLANG_ATTRKINDS_H
+
+namespace clang {
+
+namespace attr {
+
+// Kind - This is a list of all the recognized kinds of attributes.
+enum Kind {
+#define ATTR(X) X,
+#include "clang/Basic/AttrList.inc"
+ NUM_ATTRS
+};
+
+} // end namespace attr
+} // end namespace clang
+
+#endif
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def
index b306954975f4..cad28243a31c 100644
--- a/include/clang/Basic/Builtins.def
+++ b/include/clang/Basic/Builtins.def
@@ -540,6 +540,7 @@ LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h")
// id objc_msgSend(id, SEL)
// but we need new type letters for that.
LIBBUILTIN(objc_msgSend, "v*.", "f", "objc/message.h")
+BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF")
// Builtin math library functions
LIBBUILTIN(pow, "ddd", "fe", "math.h")
diff --git a/include/clang/Basic/BuiltinsARM.def b/include/clang/Basic/BuiltinsARM.def
index 4973076ae24d..54e4c2b2083a 100644
--- a/include/clang/Basic/BuiltinsARM.def
+++ b/include/clang/Basic/BuiltinsARM.def
@@ -14,7 +14,13 @@
// The format of this database matches clang/Basic/Builtins.def.
-// FIXME: This is just a placeholder. NEON intrinsics should be listed here.
+// In libgcc
+BUILTIN(__clear_cache, "vc*c*", "")
BUILTIN(__builtin_thread_pointer, "v*", "")
+// NEON
+#define GET_NEON_BUILTINS
+#include "clang/Basic/arm_neon.inc"
+#undef GET_NEON_BUILTINS
+
#undef BUILTIN
diff --git a/include/clang/Basic/BuiltinsPPC.def b/include/clang/Basic/BuiltinsPPC.def
index 287bba96df25..e0518dcdb681 100644
--- a/include/clang/Basic/BuiltinsPPC.def
+++ b/include/clang/Basic/BuiltinsPPC.def
@@ -18,14 +18,6 @@
// The format of this database matches clang/Basic/Builtins.def.
// This is just a placeholder, the types and attributes are wrong.
-BUILTIN(__builtin_altivec_abs_v16qi, "V16UcV16Sc", "")
-BUILTIN(__builtin_altivec_abs_v8hi, "V8UsV8Ss", "")
-BUILTIN(__builtin_altivec_abs_v4si, "V4UiV4Si", "")
-
-BUILTIN(__builtin_altivec_abss_v16qi, "V16UcV16Sc", "")
-BUILTIN(__builtin_altivec_abss_v8hi, "V8UsV8Ss", "")
-BUILTIN(__builtin_altivec_abss_v4si, "V4UiV4Si", "")
-
BUILTIN(__builtin_altivec_vaddcuw, "V4UiV4UiV4Ui", "")
BUILTIN(__builtin_altivec_vaddsbs, "V16ScV16ScV16Sc", "")
@@ -49,6 +41,67 @@ BUILTIN(__builtin_altivec_vavguh, "V8UsV8UsV8Us", "")
BUILTIN(__builtin_altivec_vavgsw, "V4SiV4SiV4Si", "")
BUILTIN(__builtin_altivec_vavguw, "V4UiV4UiV4Ui", "")
+BUILTIN(__builtin_altivec_vrfip, "V4fV4f", "")
+
+BUILTIN(__builtin_altivec_vcfsx, "V4fV4ii", "")
+BUILTIN(__builtin_altivec_vcfux, "V4fV4ii", "")
+BUILTIN(__builtin_altivec_vctsxs, "V4SiV4fi", "")
+BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fi", "")
+
+BUILTIN(__builtin_altivec_dss, "vUi", "")
+BUILTIN(__builtin_altivec_dssall, "v", "")
+BUILTIN(__builtin_altivec_dst, "vv*iUi", "")
+BUILTIN(__builtin_altivec_dstt, "vv*iUi", "")
+BUILTIN(__builtin_altivec_dstst, "vv*iUi", "")
+BUILTIN(__builtin_altivec_dststt, "vv*iUi", "")
+
+BUILTIN(__builtin_altivec_vexptefp, "V4fV4f", "")
+
+BUILTIN(__builtin_altivec_vrfim, "V4fV4f", "")
+
+BUILTIN(__builtin_altivec_lvx, "V4iiv*", "")
+BUILTIN(__builtin_altivec_lvxl, "V4iiv*", "")
+BUILTIN(__builtin_altivec_lvebx, "V16civ*", "")
+BUILTIN(__builtin_altivec_lvehx, "V8siv*", "")
+BUILTIN(__builtin_altivec_lvewx, "V4iiv*", "")
+
+BUILTIN(__builtin_altivec_vlogefp, "V4fV4f", "")
+
+BUILTIN(__builtin_altivec_lvsl, "V16cUcv*", "")
+BUILTIN(__builtin_altivec_lvsr, "V16cUcv*", "")
+
+BUILTIN(__builtin_altivec_vmaddfp, "V4fV4fV4fV4f", "")
+BUILTIN(__builtin_altivec_vmhaddshs, "V8sV8sV8sV8s", "")
+BUILTIN(__builtin_altivec_vmhraddshs, "V8sV8sV8sV8s", "")
+
+BUILTIN(__builtin_altivec_vmsumubm, "V4UiV16UcV16UcV4Ui", "")
+BUILTIN(__builtin_altivec_vmsummbm, "V4SiV16ScV16UcV4Si", "")
+BUILTIN(__builtin_altivec_vmsumuhm, "V4UiV8UsV8UsV4Ui", "")
+BUILTIN(__builtin_altivec_vmsumshm, "V4SiV8SsV8SsV4Si", "")
+BUILTIN(__builtin_altivec_vmsumuhs, "V4UiV8UsV8UsV4Ui", "")
+BUILTIN(__builtin_altivec_vmsumshs, "V4SiV8SsV8SsV4Si", "")
+
+BUILTIN(__builtin_altivec_vmuleub, "V8UsV16UcV16Uc", "")
+BUILTIN(__builtin_altivec_vmulesb, "V8SsV16ScV16Sc", "")
+BUILTIN(__builtin_altivec_vmuleuh, "V4UiV8UsV8Us", "")
+BUILTIN(__builtin_altivec_vmulesh, "V4SiV8SsV8Ss", "")
+BUILTIN(__builtin_altivec_vmuloub, "V8UsV16UcV16Uc", "")
+BUILTIN(__builtin_altivec_vmulosb, "V8SsV16ScV16Sc", "")
+BUILTIN(__builtin_altivec_vmulouh, "V4UiV8UsV8Us", "")
+BUILTIN(__builtin_altivec_vmulosh, "V4SiV8SsV8Ss", "")
+
+BUILTIN(__builtin_altivec_vnmsubfp, "V4fV4fV4fV4f", "")
+
+BUILTIN(__builtin_altivec_vpkpx, "V8sV4UiV4Ui", "")
+BUILTIN(__builtin_altivec_vpkuhus, "V16UcV8UsV8Us", "")
+BUILTIN(__builtin_altivec_vpkshss, "V16ScV8SsV8Ss", "")
+BUILTIN(__builtin_altivec_vpkuwus, "V8UsV4UiV4Ui", "")
+BUILTIN(__builtin_altivec_vpkswss, "V8SsV4SiV4Si", "")
+BUILTIN(__builtin_altivec_vpkshus, "V16UcV8SsV8Ss", "")
+BUILTIN(__builtin_altivec_vpkswus, "V8UsV4SiV4Si", "")
+
+BUILTIN(__builtin_altivec_vperm_4si, "V4iV4iV4iV16Uc", "")
+
BUILTIN(__builtin_altivec_stvx, "vV4iiv*", "")
BUILTIN(__builtin_altivec_stvxl, "vV4iiv*", "")
BUILTIN(__builtin_altivec_stvebx, "vV16civ*", "")
@@ -92,6 +145,48 @@ BUILTIN(__builtin_altivec_vminfp, "V4fV4fV4f", "")
BUILTIN(__builtin_altivec_mtvscr, "vV4i", "")
+BUILTIN(__builtin_altivec_vrefp, "V4fV4f", "")
+
+BUILTIN(__builtin_altivec_vrlb, "V16cV16cV16Uc", "")
+BUILTIN(__builtin_altivec_vrlh, "V8sV8sV8Us", "")
+BUILTIN(__builtin_altivec_vrlw, "V4iV4iV4Ui", "")
+
+BUILTIN(__builtin_altivec_vsel_4si, "V4iV4iV4iV4Ui", "")
+
+BUILTIN(__builtin_altivec_vsl, "V4iV4iV4i", "")
+BUILTIN(__builtin_altivec_vslo, "V4iV4iV4i", "")
+
+BUILTIN(__builtin_altivec_vsrab, "V16cV16cV16Uc", "")
+BUILTIN(__builtin_altivec_vsrah, "V8sV8sV8Us", "")
+BUILTIN(__builtin_altivec_vsraw, "V4iV4iV4Ui", "")
+
+BUILTIN(__builtin_altivec_vsr, "V4iV4iV4i", "")
+BUILTIN(__builtin_altivec_vsro, "V4iV4iV4i", "")
+
+BUILTIN(__builtin_altivec_vrfin, "V4fV4f", "")
+
+BUILTIN(__builtin_altivec_vrsqrtefp, "V4fV4f", "")
+
+BUILTIN(__builtin_altivec_vsubcuw, "V4UiV4UiV4Ui", "")
+
+BUILTIN(__builtin_altivec_vsum4sbs, "V4SiV16ScV4Si", "")
+BUILTIN(__builtin_altivec_vsum4ubs, "V4UiV16UcV4Ui", "")
+BUILTIN(__builtin_altivec_vsum4shs, "V4SiV8SsV4Si", "")
+
+BUILTIN(__builtin_altivec_vsum2sws, "V4SiV4SiV4Si", "")
+
+BUILTIN(__builtin_altivec_vsumsws, "V4SiV4SiV4Si", "")
+
+BUILTIN(__builtin_altivec_vrfiz, "V4fV4f", "")
+
+BUILTIN(__builtin_altivec_vupkhsb, "V8sV16c", "")
+BUILTIN(__builtin_altivec_vupkhpx, "V4UiV8s", "")
+BUILTIN(__builtin_altivec_vupkhsh, "V4iV8s", "")
+
+BUILTIN(__builtin_altivec_vupklsb, "V8sV16c", "")
+BUILTIN(__builtin_altivec_vupklpx, "V4UiV8s", "")
+BUILTIN(__builtin_altivec_vupklsh, "V4iV8s", "")
+
BUILTIN(__builtin_altivec_vcmpbfp_p, "iiV4fV4f", "")
BUILTIN(__builtin_altivec_vcmpgefp_p, "iiV4fV4f", "")
diff --git a/include/clang/Basic/CMakeLists.txt b/include/clang/Basic/CMakeLists.txt
index c2a4e1364a9e..c5952365d593 100644
--- a/include/clang/Basic/CMakeLists.txt
+++ b/include/clang/Basic/CMakeLists.txt
@@ -18,3 +18,15 @@ tablegen(DiagnosticGroups.inc
-gen-clang-diag-groups)
add_custom_target(ClangDiagnosticGroups
DEPENDS DiagnosticGroups.inc)
+
+set(LLVM_TARGET_DEFINITIONS Attr.td)
+tablegen(AttrList.inc
+ -gen-clang-attr-list
+ -I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
+add_custom_target(ClangAttrList
+ DEPENDS AttrList.inc)
+
+# ARM NEON
+set(LLVM_TARGET_DEFINITIONS arm_neon.td)
+tablegen(arm_neon.inc -gen-arm-neon-sema)
+add_custom_target(ClangARMNeon DEPENDS arm_neon.inc)
diff --git a/include/clang/Basic/DeclNodes.td b/include/clang/Basic/DeclNodes.td
new file mode 100644
index 000000000000..203fb451e38b
--- /dev/null
+++ b/include/clang/Basic/DeclNodes.td
@@ -0,0 +1,70 @@
+class AttrSubject;
+
+class Decl<bit abstract = 0> : AttrSubject {
+ bit Abstract = abstract;
+}
+
+class DDecl<Decl base, bit abstract = 0> : Decl<abstract> {
+ Decl Base = base;
+}
+
+class DeclContext { }
+
+def TranslationUnit : Decl, DeclContext;
+def Named : Decl<1>;
+ def Namespace : DDecl<Named>, DeclContext;
+ def UsingDirective : DDecl<Named>;
+ def NamespaceAlias : DDecl<Named>;
+ def Type : DDecl<Named, 1>;
+ def Typedef : DDecl<Type>;
+ def UnresolvedUsingTypename : DDecl<Type>;
+ def Tag : DDecl<Type, 1>, DeclContext;
+ def Enum : DDecl<Tag>;
+ def Record : DDecl<Tag>;
+ def CXXRecord : DDecl<Record>;
+ def ClassTemplateSpecialization : DDecl<CXXRecord>;
+ def ClassTemplatePartialSpecialization
+ : DDecl<ClassTemplateSpecialization>;
+ def TemplateTypeParm : DDecl<Type>;
+ def Value : DDecl<Named, 1>;
+ def EnumConstant : DDecl<Value>;
+ def UnresolvedUsingValue : DDecl<Value>;
+ def Declarator : DDecl<Value, 1>;
+ def Function : DDecl<Declarator>, DeclContext;
+ def CXXMethod : DDecl<Function>;
+ def CXXConstructor : DDecl<CXXMethod>;
+ def CXXDestructor : DDecl<CXXMethod>;
+ def CXXConversion : DDecl<CXXMethod>;
+ def Field : DDecl<Declarator>;
+ def ObjCIvar : DDecl<Field>;
+ def ObjCAtDefsField : DDecl<Field>;
+ def Var : DDecl<Declarator>;
+ def ImplicitParam : DDecl<Var>;
+ def ParmVar : DDecl<Var>;
+ def NonTypeTemplateParm : DDecl<Var>;
+ def Template : DDecl<Named, 1>;
+ def FunctionTemplate : DDecl<Template>;
+ def ClassTemplate : DDecl<Template>;
+ def TemplateTemplateParm : DDecl<Template>;
+ def Using : DDecl<Named>;
+ def UsingShadow : DDecl<Named>;
+ def ObjCMethod : DDecl<Named>, DeclContext;
+ def ObjCContainer : DDecl<Named, 1>, DeclContext;
+ def ObjCCategory : DDecl<ObjCContainer>;
+ def ObjCProtocol : DDecl<ObjCContainer>;
+ def ObjCInterface : DDecl<ObjCContainer>;
+ def ObjCImpl : DDecl<ObjCContainer, 1>;
+ def ObjCCategoryImpl : DDecl<ObjCImpl>;
+ def ObjCImplementation : DDecl<ObjCImpl>;
+ def ObjCProperty : DDecl<Named>;
+ def ObjCCompatibleAlias : DDecl<Named>;
+def LinkageSpec : Decl, DeclContext;
+def ObjCPropertyImpl : Decl;
+def ObjCForwardProtocol : Decl;
+def ObjCClass : Decl;
+def FileScopeAsm : Decl;
+def AccessSpec : Decl;
+def Friend : Decl;
+def FriendTemplate : Decl;
+def StaticAssert : Decl;
+def Block : Decl, DeclContext;
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index 62f06edb7785..1fe0d8154cd4 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -24,7 +24,6 @@
namespace llvm {
template <typename T> class SmallVectorImpl;
- class raw_ostream;
}
namespace clang {
@@ -36,8 +35,6 @@ namespace clang {
class LangOptions;
class PartialDiagnostic;
class Preprocessor;
- class SourceManager;
- class SourceRange;
// Import the diagnostic enums themselves.
namespace diag {
@@ -98,8 +95,8 @@ namespace clang {
/// compilation.
class FixItHint {
public:
- /// \brief Tokens that should be removed to correct the error.
- SourceRange RemoveRange;
+ /// \brief Code that should be removed to correct the error.
+ CharSourceRange RemoveRange;
/// \brief The location at which we should insert code to correct
/// the error.
@@ -129,15 +126,18 @@ public:
/// \brief Create a code modification hint that removes the given
/// source range.
- static FixItHint CreateRemoval(SourceRange RemoveRange) {
+ static FixItHint CreateRemoval(CharSourceRange RemoveRange) {
FixItHint Hint;
Hint.RemoveRange = RemoveRange;
return Hint;
}
-
+ static FixItHint CreateRemoval(SourceRange RemoveRange) {
+ return CreateRemoval(CharSourceRange::getTokenRange(RemoveRange));
+ }
+
/// \brief Create a code modification hint that replaces the given
/// source range with the given code string.
- static FixItHint CreateReplacement(SourceRange RemoveRange,
+ static FixItHint CreateReplacement(CharSourceRange RemoveRange,
llvm::StringRef Code) {
FixItHint Hint;
Hint.RemoveRange = RemoveRange;
@@ -145,6 +145,11 @@ public:
Hint.CodeToInsert = Code;
return Hint;
}
+
+ static FixItHint CreateReplacement(SourceRange RemoveRange,
+ llvm::StringRef Code) {
+ return CreateReplacement(CharSourceRange::getTokenRange(RemoveRange), Code);
+ }
};
/// Diagnostic - This concrete class is used by the front-end to report
@@ -176,7 +181,14 @@ public:
ak_nestednamespec, // NestedNameSpecifier *
ak_declcontext // DeclContext *
};
-
+
+ /// Specifies which overload candidates to display when overload resolution
+ /// fails.
+ enum OverloadsShown {
+ Ovl_All, ///< Show all overloads.
+ Ovl_Best ///< Show just the "best" overload candidates.
+ };
+
/// ArgumentValue - This typedef represents on argument value, which is a
/// union discriminated by ArgumentKind, with a value.
typedef std::pair<ArgumentKind, intptr_t> ArgumentValue;
@@ -188,6 +200,7 @@ private:
bool ErrorsAsFatal; // Treat errors like fatal errors.
bool SuppressSystemWarnings; // Suppress warnings in system headers.
bool SuppressAllDiagnostics; // Suppress all diagnostics.
+ OverloadsShown ShowOverloads; // Which overload candidates to show.
unsigned ErrorLimit; // Cap of # errors emitted, 0 -> no limit.
unsigned TemplateBacktraceLimit; // Cap on depth of template backtrace stack,
// 0 -> no limit.
@@ -318,6 +331,13 @@ public:
}
bool getSuppressAllDiagnostics() const { return SuppressAllDiagnostics; }
+ /// \brief Specify which overload candidates to show when overload resolution
+ /// fails. By default, we show all candidates.
+ void setShowOverloads(OverloadsShown Val) {
+ ShowOverloads = Val;
+ }
+ OverloadsShown getShowOverloads() const { return ShowOverloads; }
+
/// \brief Pretend that the last diagnostic issued was ignored. This can
/// be used by clients who suppress diagnostics themselves.
void setLastDiagnosticIgnored() {
@@ -582,7 +602,7 @@ private:
/// DiagRanges - The list of ranges added to this diagnostic. It currently
/// only support 10 ranges, could easily be extended if needed.
- SourceRange DiagRanges[10];
+ CharSourceRange DiagRanges[10];
enum { MaxFixItHints = 3 };
@@ -681,7 +701,7 @@ public:
}
}
- void AddSourceRange(const SourceRange &R) const {
+ void AddSourceRange(const CharSourceRange &R) const {
assert(NumRanges <
sizeof(DiagObj->DiagRanges)/sizeof(DiagObj->DiagRanges[0]) &&
"Too many arguments to diagnostic!");
@@ -752,11 +772,17 @@ operator<<(const DiagnosticBuilder &DB, T *DC) {
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
const SourceRange &R) {
- DB.AddSourceRange(R);
+ DB.AddSourceRange(CharSourceRange::getTokenRange(R));
return DB;
}
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+ const CharSourceRange &R) {
+ DB.AddSourceRange(R);
+ return DB;
+}
+
+inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
const FixItHint &Hint) {
DB.AddFixItHint(Hint);
return DB;
@@ -849,7 +875,7 @@ public:
return DiagObj->NumDiagRanges;
}
- SourceRange getRange(unsigned Idx) const {
+ const CharSourceRange &getRange(unsigned Idx) const {
assert(Idx < DiagObj->NumDiagRanges && "Invalid diagnostic range index!");
return DiagObj->DiagRanges[Idx];
}
@@ -886,7 +912,7 @@ class StoredDiagnostic {
Diagnostic::Level Level;
FullSourceLoc Loc;
std::string Message;
- std::vector<SourceRange> Ranges;
+ std::vector<CharSourceRange> Ranges;
std::vector<FixItHint> FixIts;
public:
@@ -902,7 +928,7 @@ public:
const FullSourceLoc &getLocation() const { return Loc; }
llvm::StringRef getMessage() const { return Message; }
- typedef std::vector<SourceRange>::const_iterator range_iterator;
+ typedef std::vector<CharSourceRange>::const_iterator range_iterator;
range_iterator range_begin() const { return Ranges.begin(); }
range_iterator range_end() const { return Ranges.end(); }
unsigned range_size() const { return Ranges.size(); }
diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td
index 88e7dc19aec5..4b0bf57bef63 100644
--- a/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/include/clang/Basic/DiagnosticCommonKinds.td
@@ -66,6 +66,7 @@ def err_target_unknown_triple : Error<
"unknown target triple '%0', please use -triple or -arch">;
def err_target_unknown_cpu : Error<"unknown target CPU '%0'">;
def err_target_unknown_abi : Error<"unknown target ABI '%0'">;
+def err_target_unknown_cxxabi : Error<"unknown C++ ABI '%0'">;
def err_target_invalid_feature : Error<"invalid target feature '%0'">;
// Source manager
diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td
index c7cad7395c0b..989ec38d2950 100644
--- a/include/clang/Basic/DiagnosticFrontendKinds.td
+++ b/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -18,7 +18,10 @@ def err_fe_invalid_ast_action : Error<"invalid action for AST input">,
DefaultFatal;
// Error generated by the backend.
def err_fe_inline_asm : Error<"%0">, CatInlineAsm;
-def note_fe_inline_asm_here : Note<"generated from here">;
+def note_fe_inline_asm_here : Note<"instantated into assembly here">;
+
+
+
def err_fe_invalid_code_complete_file : Error<
"cannot locate code-completion file %0">, DefaultFatal;
def err_fe_stdout_binary : Error<"unable to change standard output to binary">,
@@ -186,9 +189,6 @@ def warn_pch_math_errno : Error<
"math functions %select{do not respect|respect}0 'errno' in PCH "
"file but they are currently set to %select{not respect|respect}1 "
"'errno'">;
-def warn_pch_overflow_checking : Error<
- "signed integer overflow checking was %select{disabled|enabled}0 in PCH "
- "file but is currently %select{disabled|enabled}1">;
def warn_pch_optimize : Error<
"the macro '__OPTIMIZE__' was %select{not defined|defined}0 in "
"the PCH file but is currently %select{undefined|defined}1">;
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td
index b79bf8e2edbe..930fe422cff0 100644
--- a/include/clang/Basic/DiagnosticGroups.td
+++ b/include/clang/Basic/DiagnosticGroups.td
@@ -17,11 +17,14 @@ def Implicit : DiagGroup<"implicit", [
]>;
// Empty DiagGroups are recognized by clang but ignored.
+def : DiagGroup<"abi">;
def : DiagGroup<"address">;
def AddressOfTemporary : DiagGroup<"address-of-temporary">;
def : DiagGroup<"aggregate-return">;
+def AmbigMemberTemplate : DiagGroup<"ambiguous-member-template">;
def : DiagGroup<"attributes">;
def : DiagGroup<"bad-function-cast">;
+def BoolConversions : DiagGroup<"bool-conversions">;
def : DiagGroup<"c++-compat">;
def : DiagGroup<"cast-align">;
def : DiagGroup<"cast-qual">;
@@ -51,6 +54,7 @@ def : DiagGroup<"inline">;
def : DiagGroup<"int-to-pointer-cast">;
def : DiagGroup<"invalid-pch">;
def LiteralRange : DiagGroup<"literal-range">;
+def : DiagGroup<"main">;
def MissingBraces : DiagGroup<"missing-braces">;
def : DiagGroup<"missing-declarations">;
def : DiagGroup<"missing-format-attribute">;
@@ -62,6 +66,7 @@ def : DiagGroup<"newline-eof">;
def LongLong : DiagGroup<"long-long">;
def MismatchedTags : DiagGroup<"mismatched-tags">;
def MissingFieldInitializers : DiagGroup<"missing-field-initializers">;
+def InitializerOverrides : DiagGroup<"initializer-overrides">;
def NonNull : DiagGroup<"nonnull">;
def : DiagGroup<"nonportable-cfstrings">;
def : DiagGroup<"non-virtual-dtor">;
@@ -70,13 +75,17 @@ def : DiagGroup<"overflow">;
def : DiagGroup<"overloaded-virtual">;
def : DiagGroup<"packed">;
def PointerArith : DiagGroup<"pointer-arith">;
+def PoundWarning : DiagGroup<"#warnings">,
+ DiagCategory<"#warning Directive">;
def : DiagGroup<"pointer-to-int-cast">;
def : DiagGroup<"redundant-decls">;
def ReturnType : DiagGroup<"return-type">;
+def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy">;
def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">;
def : DiagGroup<"sequence-point">;
def Shadow : DiagGroup<"shadow">;
def : DiagGroup<"shorten-64-to-32">;
+def : DiagGroup<"sign-promo">;
def SignCompare : DiagGroup<"sign-compare">;
def : DiagGroup<"synth">;
@@ -108,6 +117,7 @@ def Trigraphs : DiagGroup<"trigraphs">;
def : DiagGroup<"type-limits">;
def Uninitialized : DiagGroup<"uninitialized">;
def UnknownPragmas : DiagGroup<"unknown-pragmas">;
+def UnknownAttributes : DiagGroup<"unknown-attributes">;
def UnusedArgument : DiagGroup<"unused-argument">;
def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">;
def UnusedFunction : DiagGroup<"unused-function">;
@@ -137,7 +147,7 @@ def Parentheses : DiagGroup<"parentheses", [DiagGroup<"idiomatic-parentheses">]>
// -Wconversion has its own warnings, but we split this one out for
// legacy reasons.
def Conversion : DiagGroup<"conversion",
- [DiagGroup<"shorten-64-to-32">]>,
+ [DiagGroup<"shorten-64-to-32">, BoolConversions]>,
DiagCategory<"Value Conversion Issue">;
def Unused : DiagGroup<"unused",
@@ -157,6 +167,7 @@ def Format2 : DiagGroup<"format=2",
def Extra : DiagGroup<"extra", [
MissingFieldInitializers,
+ InitializerOverrides,
SemiBeforeMethodBody,
SignCompare,
UnusedParameter
diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td
index 848e85c8ba41..21c93e7e8fa2 100644
--- a/include/clang/Basic/DiagnosticLexKinds.td
+++ b/include/clang/Basic/DiagnosticLexKinds.td
@@ -106,7 +106,7 @@ def err_invalid_pth_file : Error<
//===----------------------------------------------------------------------===//
// Preprocessor Diagnostics
//===----------------------------------------------------------------------===//
-def pp_hash_warning : Warning<"#warning%0">, InGroup<DiagGroup<"#warnings">>;
+def pp_hash_warning : Warning<"#warning%0">, InGroup<PoundWarning>;
def pp_include_next_in_primary : Warning<
"#include_next in primary source file">;
def pp_include_macros_out_of_predefines : Error<
@@ -225,6 +225,9 @@ def err__Pragma_malformed : Error<
"_Pragma takes a parenthesized string literal">;
def err_pragma_comment_malformed : Error<
"pragma comment requires parenthesized identifier and optional string">;
+def err_pragma_message_malformed : Error<
+ "pragma message requires parenthesized string">;
+def warn_pragma_message : Warning<"%0">;
def warn_pragma_ignored : Warning<"unknown pragma ignored">,
InGroup<UnknownPragmas>, DefaultIgnore;
def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">,
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index 934bd0db1e01..ca761f9bf5e9 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -24,7 +24,9 @@ def ext_empty_source_file : Extension<"ISO C forbids an empty source file">;
def ext_top_level_semi : Extension<
"extra ';' outside of a function">;
def ext_extra_struct_semi : Extension<
- "extra ';' inside a struct or union">;
+ "extra ';' inside a %0">;
+def ext_extra_ivar_semi : Extension<
+ "extra ';' inside instance variable list">;
def ext_duplicate_declspec : Extension<"duplicate '%0' declaration specifier">;
def ext_plain_complex : ExtWarn<
@@ -35,6 +37,7 @@ def ext_thread_before : Extension<"'__thread' before 'static'">;
def ext_empty_struct_union_enum : Extension<"use of empty %0 extension">;
+def error_empty_enum : Error<"use of empty enum">;
def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
def err_invalid_short_spec : Error<"'short %0' is invalid">;
def err_invalid_long_spec : Error<"'long %0' is invalid">;
@@ -103,7 +106,7 @@ def err_expected_fn_body : Error<
"expected function body after function declarator">;
def err_expected_method_body : Error<"expected method body">;
def err_invalid_token_after_toplevel_declarator : Error<
- "invalid token after top level declarator">;
+ "expected ';' after top level declarator">;
def err_expected_statement : Error<"expected statement">;
def err_expected_lparen_after : Error<"expected '(' after '%0'">;
def err_expected_lparen_after_id : Error<"expected '(' after %0">;
@@ -168,11 +171,15 @@ def err_typename_invalid_functionspec : Error<
def err_invalid_decl_spec_combination : Error<
"cannot combine with previous '%0' declaration specifier">;
def err_invalid_vector_decl_spec_combination : Error<
- "cannot combine with previous '%0' declaration specifier. '__vector' must be first">;
+ "cannot combine with previous '%0' declaration specifier. "
+ "'__vector' must be first">;
def err_invalid_pixel_decl_spec_combination : Error<
- "'__pixel' must be preceded by '__vector'. '%0' declaration specifier not allowed here">;
-def err_invalid_vector_double_decl_spec_combination : Error<
- "cannot use 'double' with '__vector'">;
+ "'__pixel' must be preceded by '__vector'. "
+ "'%0' declaration specifier not allowed here">;
+def err_invalid_vector_decl_spec : Error<
+ "cannot use '%0' with '__vector'">;
+def err_invalid_vector_bool_decl_spec : Error<
+ "cannot use '%0' with '__vector bool'">;
def warn_vector_long_decl_spec_combination : Warning<
"Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
def err_friend_invalid_in_context : Error<
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 0ba31aee2ff5..8fac1edecfa8 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -21,12 +21,6 @@ def ext_expr_not_ice : Extension<
"expression is not integer constant expression "
"(but is allowed as an extension)">;
-def ext_null_pointer_expr_not_ice : Extension<
- "null pointer expression is not an integer constant expression "
- "(but is allowed as an extension)">;
-
-
-
// Semantic analysis of constant literals.
def ext_predef_outside_function : Warning<
"predefined identifier is only valid inside function">;
@@ -80,9 +74,10 @@ def err_designator_for_scalar_init : Error<
"designator in initializer for scalar type %0">;
def warn_subobject_initializer_overrides : Warning<
"subobject initialization overrides initialization of other fields "
- "within its enclosing subobject">;
+ "within its enclosing subobject">, InGroup<InitializerOverrides>;
def warn_initializer_overrides : Warning<
- "initializer overrides prior initialization of this subobject">;
+ "initializer overrides prior initialization of this subobject">,
+ InGroup<InitializerOverrides>;
def note_previous_initializer : Note<
"previous initialization %select{|with side effects }0is here"
"%select{| (side effects may not occur at run time)}0">;
@@ -125,6 +120,8 @@ def warn_use_out_of_scope_declaration : Warning<
"use of out-of-scope declaration of %0">;
def err_inline_non_function : Error<
"'inline' can only appear on functions">;
+def warn_qual_return_type : Warning<
+ "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">;
def warn_decl_shadow :
Warning<"declaration shadows a %select{"
@@ -230,6 +227,7 @@ def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
/// parser diagnostics
def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">;
+def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
def err_statically_allocated_object : Error<
"interface type cannot be statically allocated">;
def err_object_cannot_be_passed_returned_by_value : Error<
@@ -458,6 +456,9 @@ def warn_weak_vtable : Warning<
"emitted in every translation unit">,
InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
+def ext_using_undefined_std : ExtWarn<
+ "using directive refers to implicitly-defined namespace 'std'">;
+
// C++ exception specifications
def err_exception_spec_in_typedef : Error<
"exception specifications are not allowed in typedefs">;
@@ -486,6 +487,10 @@ def err_access : Error<
"%1 is a %select{private|protected}0 member of %3">, NoSFINAE;
def err_access_ctor : Error<
"calling a %select{private|protected}0 constructor of class %2">, NoSFINAE;
+def ext_rvalue_to_reference_access_ctor : ExtWarn<
+ "C++98 requires an accessible copy constructor for class %2 when binding "
+ "a reference to a temporary; was %select{private|protected}0">,
+ NoSFINAE, InGroup<BindToTemporaryCopy>;
def err_access_base : Error<
"%select{base class|inherited virtual base class}0 %1 has %select{private|"
"protected}3 %select{constructor|copy constructor|copy assignment operator|"
@@ -507,6 +512,9 @@ def err_access_dtor_vbase :
def err_access_dtor_temp :
Error<"temporary of type %0 has %select{private|protected}1 destructor">,
NoSFINAE;
+def err_access_dtor_exception :
+ Error<"exception object of type %0 has %select{private|protected}1 "
+ "destructor">, NoSFINAE;
def err_access_dtor_field :
Error<"field of type %1 has %select{private|protected}2 destructor">,
NoSFINAE;
@@ -549,6 +557,9 @@ def err_dependent_nested_name_spec : Error<
"parameter">;
def err_nested_name_member_ref_lookup_ambiguous : Error<
"lookup of %0 in member access expression is ambiguous">;
+def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
+ "lookup of %0 in member access expression is ambiguous; using member of %1">,
+ InGroup<AmbigMemberTemplate>;
def note_ambig_member_ref_object_type : Note<
"lookup in the object type %0 refers here">;
def note_ambig_member_ref_scope : Note<
@@ -744,6 +755,13 @@ def err_temp_copy_no_viable : Error<
"returning object|throwing object|copying member subobject|copying array "
"element|allocating object|copying temporary|initializing base subobject|"
"initializing vector element}0 of type %1">;
+def ext_rvalue_to_reference_temp_copy_no_viable : ExtWarn<
+ "no viable constructor %select{copying variable|copying parameter|"
+ "returning object|throwing object|copying member subobject|copying array "
+ "element|allocating object|copying temporary|initializing base subobject|"
+ "initializing vector element}0 of type %1; C++98 requires a copy "
+ "constructor when binding a reference to a temporary">,
+ InGroup<BindToTemporaryCopy>;
def err_temp_copy_ambiguous : Error<
"ambiguous constructor call when %select{copying variable|copying "
"parameter|returning object|throwing object|copying member subobject|copying "
@@ -797,9 +815,15 @@ def err_attribute_wrong_number_arguments : Error<
"attribute requires %0 argument(s)">;
def err_attribute_missing_parameter_name : Error<
"attribute requires unquoted parameter">;
-def err_attribute_invalid_vector_type : Error<"invalid vector type %0">;
+def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
def err_attribute_argument_not_int : Error<
"'%0' attribute requires integer constant">;
+def err_attribute_argument_outof_range : Error<
+ "init_priority attribute requires integer constant between "
+ "101 and 65535 inclusive">;
+def err_init_priority_object_attr : Error<
+ "can only use ‘init_priority’ attribute on file-scope definitions "
+ "of objects of class type">;
def err_attribute_argument_n_not_int : Error<
"'%0' attribute requires parameter %1 to be an integer constant">;
def err_attribute_argument_n_not_string : Error<
@@ -838,7 +862,8 @@ def err_attribute_address_space_too_high : Error<
def err_attribute_address_multiple_qualifiers : Error<
"multiple address spaces specified for type">;
def err_implicit_pointer_address_space_cast : Error<
- "illegal implicit cast between two pointers with different address spaces">;
+ "illegal implicit conversion between two pointers with different address "
+ "spaces">;
def err_as_qualified_auto_decl : Error<
"automatic variable qualified with an address space">;
def err_arg_with_address_space : Error<
@@ -854,6 +879,8 @@ def err_attribute_aligned_not_power_of_two : Error<
def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
"'%0' redeclared without %1 attribute: previous %1 ignored">;
def warn_attribute_ignored : Warning<"%0 attribute ignored">;
+def warn_unknown_attribute_ignored : Warning<
+ "unknown attribute %0 ignored">, InGroup<UnknownAttributes>;
def warn_attribute_precede_definition : Warning<
"attribute declaration must precede definition">;
def warn_attribute_void_function_method : Warning<
@@ -899,30 +926,34 @@ def err_cconv_knr : Error<
"function with no prototype cannot use %0 calling convention">;
def err_cconv_varargs : Error<
"variadic function cannot use %0 calling convention">;
+def err_regparm_mismatch : Error<"function declared with with regparm(%0) "
+ "attribute was previously declared %plural{0:without the regparm|1:"
+ "with the regparm(1)|2:with the regparm(2)|3:with the regparm(3)|:with the"
+ "regparm}1 attribute">;
def warn_impcast_vector_scalar : Warning<
- "implicit cast turns vector to scalar: %0 to %1">,
+ "implicit conversion turns vector to scalar: %0 to %1">,
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
def warn_impcast_complex_scalar : Warning<
- "implicit cast discards imaginary component: %0 to %1">,
+ "implicit conversion discards imaginary component: %0 to %1">,
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
def warn_impcast_float_precision : Warning<
- "implicit cast loses floating-point precision: %0 to %1">,
+ "implicit conversion loses floating-point precision: %0 to %1">,
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
def warn_impcast_float_integer : Warning<
- "implicit cast turns floating-point number into integer: %0 to %1">,
+ "implicit conversion turns floating-point number into integer: %0 to %1">,
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
def warn_impcast_integer_sign : Warning<
- "implicit cast changes signedness: %0 to %1">,
+ "implicit conversion changes signedness: %0 to %1">,
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
def warn_impcast_integer_sign_conditional : Warning<
"operand of ? changes signedness: %0 to %1">,
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
def warn_impcast_integer_precision : Warning<
- "implicit cast loses integer precision: %0 to %1">,
+ "implicit conversion loses integer precision: %0 to %1">,
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
def warn_impcast_integer_64_32 : Warning<
- "implicit cast loses integer precision: %0 to %1">,
+ "implicit conversion loses integer precision: %0 to %1">,
InGroup<DiagGroup<"shorten-64-to-32">>, DefaultIgnore;
def warn_attribute_ignored_for_field_of_type : Warning<
@@ -937,8 +968,8 @@ def warn_transparent_union_attribute_not_definition : Warning<
"transparent_union attribute can only be applied to a union definition; "
"attribute ignored">;
def warn_transparent_union_attribute_floating : Warning<
- "first field of a transparent union cannot have floating point or vector "
- "type; transparent_union attribute ignored">;
+ "first field of a transparent union cannot have %select{floating point|"
+ "vector}0 type %1; transparent_union attribute ignored">;
def warn_transparent_union_attribute_zero_fields : Warning<
"transparent union definition must contain at least one field; "
"transparent_union attribute ignored">;
@@ -1077,6 +1108,9 @@ def err_ovl_ambiguous_member_call : Error<
"call to member function %0 is ambiguous">;
def err_ovl_deleted_member_call : Error<
"call to %select{unavailable|deleted}0 member function %1">;
+def note_ovl_too_many_candidates : Note<
+ "remaining %0 candidate%s0 omitted; "
+ "pass -fshow-overloads=all to show them">;
def note_ovl_candidate : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
@@ -1084,6 +1118,10 @@ def note_ovl_candidate : Note<"candidate "
"is the implicit copy constructor|"
"is the implicit copy assignment operator}0%1">;
+def warn_init_pointer_from_false : Warning<
+ "initialization of pointer of type %0 from literal 'false'">,
+ InGroup<BoolConversions>;
+
def note_ovl_candidate_bad_deduction : Note<
"candidate template ignored: failed template argument deduction">;
def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
@@ -1168,6 +1206,17 @@ def note_ovl_candidate_bad_cvr : Note<"candidate "
"%select{const|volatile|const and volatile|restrict|const and restrict|"
"volatile and restrict|const, volatile, and restrict}3 qualifier"
"%select{||s||s|s|s}3">;
+def note_ovl_candidate_bad_base_to_derived_conv : Note<"candidate "
+ "%select{function|function|constructor|"
+ "function |function |constructor |"
+ "constructor (the implicit default constructor)|"
+ "constructor (the implicit copy constructor)|"
+ "function (the implicit copy assignment operator)}0%1"
+ " not viable: cannot %select{convert from|convert from|bind}2 "
+ "%select{base class pointer|superclass|base class object of type}2 %3 to "
+ "%select{derived class pointer|subclass|derived class reference}2 %4 for "
+ "%ordinal5 argument">;
+
def note_ambiguous_type_conversion: Note<
"because of ambiguity in conversion of %0 to %1">;
def note_ovl_builtin_binary_candidate : Note<
@@ -1234,6 +1283,7 @@ def err_template_param_different_kind : Error<
"%select{|template parameter }0redeclaration">;
def note_template_param_different_kind : Note<
"template parameter has a different kind in template argument">;
+
def err_template_nontype_parm_different_type : Error<
"template non-type parameter has a different type %0 in template "
"%select{|template parameter }1redeclaration">;
@@ -1528,6 +1578,8 @@ def err_explicit_instantiation_nontemplate_type : Error<
"explicit instantiation of non-templated type %0">;
def note_nontemplate_decl_here : Note<
"non-templated declaration is here">;
+def err_explicit_instantiation_in_class : Error<
+ "explicit instantiation of %0 in class scope">;
def err_explicit_instantiation_out_of_scope : Error<
"explicit instantiation of %0 not in a namespace enclosing %1">;
def err_explicit_instantiation_must_be_global : Error<
@@ -1560,10 +1612,9 @@ def note_explicit_instantiation_candidate : Note<
"explicit instantiation candidate function template here %0">;
def err_explicit_instantiation_inline : Error<
"explicit instantiation cannot be 'inline'">;
-def err_explicit_instantiation_without_qualified_id : Error<
- "qualifier in explicit instantiation of %q0 requires a template-id">;
-def err_explicit_instantiation_without_qualified_id_quals : Error<
- "qualifier in explicit instantiation of '%0%1' requires a template-id">;
+def ext_explicit_instantiation_without_qualified_id : ExtWarn<
+ "qualifier in explicit instantiation of %q0 requires a template-id "
+ "(a typedef is not permitted)">;
def err_explicit_instantiation_unqualified_wrong_namespace : Error<
"explicit instantiation of %q0 must occur in %1">;
def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
@@ -1588,6 +1639,8 @@ def note_typename_refers_here : Note<
"referenced member %0 is declared here">;
def err_typename_missing : Error<
"missing 'typename' prior to dependent type name '%0%1'">;
+def ext_typename_outside_of_template : ExtWarn<
+ "'typename' occurs outside of a template">;
def err_template_kw_refers_to_non_template : Error<
"%0 following the 'template' keyword does not refer to a template">;
@@ -1599,6 +1652,8 @@ def note_referenced_class_template : Error<
"class template declared here">;
def err_template_kw_missing : Error<
"missing 'template' keyword prior to dependent template name '%0%1'">;
+def ext_template_outside_of_template : ExtWarn<
+ "'template' keyword outside of a template">;
// C++0x Variadic Templates
def err_template_param_pack_default_arg : Error<
@@ -1606,6 +1661,18 @@ def err_template_param_pack_default_arg : Error<
def err_template_param_pack_must_be_last_template_parameter : Error<
"template parameter pack must be the last template parameter">;
+def err_template_parameter_pack_non_pack : Error<
+ "template %select{type|non-type|template}0 parameter%select{| pack}1 "
+ "conflicts with previous template %select{type|non-type|template}0 "
+ "parameter%select{ pack|}1">;
+def note_template_parameter_pack_non_pack : Note<
+ "template %select{type|non-type|template}0 parameter%select{| pack}1 "
+ "does not match template %select{type|non-type|template}0 "
+ "parameter%select{ pack|}1 in template argument">;
+def note_template_parameter_pack_here : Note<
+ "previous template %select{type|non-type|template}0 "
+ "parameter%select{| pack}1 declared here">;
+
def err_unexpected_typedef : Error<
"unexpected type name %0: expected expression">;
def err_unexpected_namespace : Error<
@@ -1674,6 +1741,9 @@ def ext_forward_ref_enum : Extension<
"ISO C forbids forward references to 'enum' types">;
def err_forward_ref_enum : Error<
"ISO C++ forbids forward references to 'enum' types">;
+def ext_forward_ref_enum_def : Extension<
+ "redeclaration of already-defined enum %0 is a GNU extension">, InGroup<GNU>;
+
def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
def err_duplicate_member : Error<"duplicate member %0">;
def err_misplaced_ivar : Error<
@@ -1848,6 +1918,8 @@ def err_illegal_decl_array_of_functions : Error<
"'%0' declared as array of functions of type %1">;
def err_illegal_decl_array_incomplete_type : Error<
"array has incomplete element type %0">;
+def err_illegal_message_expr_incomplete_type : Error<
+ "objective-c message has incomplete result type %0">;
def err_illegal_decl_array_of_references : Error<
"'%0' declared as array of references of type %1">;
def err_array_star_outside_prototype : Error<
@@ -2028,6 +2100,11 @@ def err_typecheck_unary_expr : Error<
"invalid argument type %0 to unary expression">;
def err_typecheck_indirection_requires_pointer : Error<
"indirection requires pointer operand (%0 invalid)">;
+def warn_indirection_through_null : Warning<
+ "indirection of non-volatile null pointer will be deleted, not trap">;
+def note_indirection_through_null : Note<
+ "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
+
def err_indirection_requires_nonfragile_object : Error<
"indirection cannot be to an interface in non-fragile ABI (%0 invalid)">;
def err_direct_interface_unsupported : Error<
@@ -2046,8 +2123,12 @@ def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
"ordered comparison of function pointers (%0 and %1)">;
def ext_typecheck_comparison_of_fptr_to_void : Extension<
"equality comparison between function pointer and void pointer (%0 and %1)">;
+def err_typecheck_comparison_of_fptr_to_void : Error<
+ "equality comparison between function pointer and void pointer (%0 and %1)">;
def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
"comparison between pointer and integer (%0 and %1)">;
+def err_typecheck_comparison_of_pointer_integer : Error<
+ "comparison between pointer and integer (%0 and %1)">;
def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
"comparison of distinct pointer types (%0 and %1)">;
def ext_typecheck_cond_incompatible_operands : ExtWarn<
@@ -2081,9 +2162,11 @@ def err_invalid_member_use_in_static_method : Error<
"invalid use of member %0 in static member function">;
def err_invalid_qualified_function_type : Error<
"type qualifier is not allowed on this function">;
+def err_invalid_qualified_function_pointer : Error<
+ "type qualifier is not allowed on this function %select{pointer|reference}0">;
def err_invalid_qualified_typedef_function_type_use : Error<
- "a qualified function type cannot be used to declare a nonmember function "
- "or a static member function">;
+ "a qualified function type cannot be used to declare a "
+ "%select{static member|nonmember}0 function">;
def err_invalid_non_static_member_use : Error<
"invalid use of nonstatic data member %0">;
@@ -2260,13 +2343,26 @@ def err_new_array_nonconst : Error<
"only the first dimension of an allocated array may have dynamic size">;
def err_new_array_init_args : Error<
"array 'new' cannot have initialization arguments">;
-def err_new_paren_array_nonconst : Error<
+def ext_new_paren_array_nonconst : ExtWarn<
"when type is in parentheses, array cannot have dynamic size">;
def err_placement_new_non_placement_delete : Error<
"'new' expression with placement arguments refers to non-placement "
"'operator delete'">;
def err_array_size_not_integral : Error<
"array size expression must have integral or enumerated type, not %0">;
+def err_array_size_incomplete_type : Error<
+ "array size expression has incomplete class type %0">;
+def err_array_size_explicit_conversion : Error<
+ "array size expression of type %0 requires explicit conversion to type %1">;
+def note_array_size_conversion : Note<
+ "conversion to %select{integral|enumeration}0 type %1 declared here">;
+def err_array_size_ambiguous_conversion : Error<
+ "ambiguous conversion of array size expression of type %0 to an integral or "
+ "enumeration type">;
+def ext_array_size_conversion : Extension<
+ "implicit conversion from array size expression of type %0 to "
+ "%select{integral|enumeration}1 type %2 is a C++0x extension">;
+
def err_default_init_const : Error<
"default initialization of an object of const type %0"
"%select{| requires a user-provided default constructor}1">;
@@ -2866,11 +2962,17 @@ def warn_printf_asterisk_missing_arg : Warning<
def warn_printf_asterisk_wrong_type : Warning<
"field %select{width|precision}0 should have type %1, but argument has type %2">,
InGroup<Format>;
-def warn_printf_nonsensical_precision: Warning<
- "precision used in '%0' conversion specifier (where it has no meaning)">,
+def warn_printf_nonsensical_optional_amount: Warning<
+ "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
InGroup<Format>;
def warn_printf_nonsensical_flag: Warning<
- "flag '%0' results in undefined behavior in '%1' conversion specifier">,
+ "flag '%0' results in undefined behavior with '%1' conversion specifier">,
+ InGroup<Format>;
+def warn_printf_nonsensical_length: Warning<
+ "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
+ InGroup<Format>;
+def warn_printf_ignored_flag: Warning<
+ "flag '%0' is ignored when flag '%1' is present">,
InGroup<Format>;
// CHECK: returning address/reference of stack memory
@@ -2886,8 +2988,10 @@ def err_ret_local_block : Error<
// For non-floating point, expressions of the form x == x or x != x
// should result in a warning, since these always evaluate to a constant.
-def warn_selfcomparison : Warning<
- "self-comparison always results in a constant value">;
+// Array comparisons have similar warnings
+def warn_comparison_always : Warning<
+ "%select{self-|array }0comparison always evaluates to %select{false|true|a constant}1">;
+
def warn_stringcompare : Warning<
"result of comparison against %select{a string literal|@encode}0 is "
"unspecified (use strncmp instead)">;
@@ -2956,13 +3060,13 @@ def err_first_argument_to_va_arg_not_of_type_va_list : Error<
"first argument to 'va_arg' is of type %0 and not 'va_list'">;
def warn_return_missing_expr : Warning<
- "non-void %select{function|method}1 %0 should return a value">,
+ "non-void %select{function|method}1 %0 should return a value">, DefaultError,
InGroup<ReturnType>;
def ext_return_missing_expr : ExtWarn<
- "non-void %select{function|method}1 %0 should return a value">,
+ "non-void %select{function|method}1 %0 should return a value">, DefaultError,
InGroup<ReturnType>;
def ext_return_has_expr : ExtWarn<
- "void %select{function|method}1 %0 should not return a value">,
+ "void %select{function|method}1 %0 should not return a value">, DefaultError,
InGroup<ReturnType>;
def ext_return_has_void_expr : Extension<
"void %select{function|method}1 %0 should not return void expression">;
@@ -2993,6 +3097,8 @@ def err_vector_incorrect_num_initializers : Error<
"%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
def err_altivec_empty_initializer : Error<"expected initializer">;
+def err_invalid_neon_type_code : Error<
+ "incompatible constant for this __builtin_neon function">;
def err_argument_invalid_range : Error<
"argument should be a value from %0 to %1">;
@@ -3003,7 +3109,9 @@ def err_constant_integer_arg_type : Error<
"argument to %0 must be a constant integer">;
def ext_mixed_decls_code : Extension<
- "ISO C90 forbids mixing declarations and code">;
+ "ISO C90 forbids mixing declarations and code">,
+ InGroup<DiagGroup<"declaration-after-statement">>;
+
def err_non_variable_decl_in_for : Error<
"declaration of non-local variable in 'for' loop">;
def err_toomany_element_decls : Error<
@@ -3094,6 +3202,11 @@ def err_undeclared_protocol_suggest : Error<
"cannot find protocol declaration for %0; did you mean %1?">;
def note_base_class_specified_here : Note<
"base class %0 specified here">;
+def err_using_directive_suggest : Error<
+ "no namespace named %0; did you mean %1?">;
+def err_using_directive_member_suggest : Error<
+ "no namespace named %0 in %1; did you mean %2?">;
+def note_namespace_defined_here : Note<"namespace %0 defined here">;
} // end of sema category
} // end of sema component.
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index 582d59c18a37..6b8bcdc52f6f 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -89,7 +89,8 @@ public:
// The 'this' pointer really points to a
// std::pair<IdentifierInfo, const char*>, where internal pointer
// points to the external string data.
- return ((std::pair<IdentifierInfo, const char*>*) this)->second;
+ typedef std::pair<IdentifierInfo, const char*> actualtype;
+ return ((const actualtype*) this)->second;
}
/// getLength - Efficiently return the length of this identifier info.
@@ -101,7 +102,8 @@ public:
// The 'this' pointer really points to a
// std::pair<IdentifierInfo, const char*>, where internal pointer
// points to the external string data.
- const char* p = ((std::pair<IdentifierInfo, const char*>*) this)->second-2;
+ typedef std::pair<IdentifierInfo, const char*> actualtype;
+ const char* p = ((const actualtype*) this)->second - 2;
return (((unsigned) p[0]) | (((unsigned) p[1]) << 8)) - 1;
}
diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h
index 1ed86f190af3..bbcceb70ac91 100644
--- a/include/clang/Basic/LangOptions.h
+++ b/include/clang/Basic/LangOptions.h
@@ -66,9 +66,6 @@ public:
unsigned MathErrno : 1; // Math functions must respect errno
// (modulo the platform support).
- unsigned OverflowChecking : 1; // Extension to call a handler function when
- // signed integer arithmetic overflows.
-
unsigned HeinousExtensions : 1; // Extensions that we really don't like and
// may be ripped out at any time.
@@ -102,20 +99,21 @@ public:
unsigned DumpRecordLayouts : 1; /// Dump the layout of IRgen'd records.
unsigned DumpVTableLayouts : 1; /// Dump the layouts of emitted vtables.
unsigned NoConstantCFStrings : 1; // Do not do CF strings
+ unsigned InlineVisibilityHidden : 1; // Whether inline C++ methods have
+ // hidden visibility by default.
+ unsigned SpellChecking : 1; // Whether to perform spell-checking for error
+ // recovery.
// FIXME: This is just a temporary option, for testing purposes.
unsigned NoBitFieldTypeAlign : 1;
private:
- unsigned GC : 2; // Objective-C Garbage Collection modes. We
- // declare this enum as unsigned because MSVC
- // insists on making enums signed. Set/Query
- // this value using accessors.
+ // We declare multibit enums as unsigned because MSVC insists on making enums
+ // signed. Set/Query these values using accessors.
+ unsigned GC : 2; // Objective-C Garbage Collection modes.
unsigned SymbolVisibility : 3; // Symbol's visibility.
- unsigned StackProtector : 2; // Whether stack protectors are on. We declare
- // this enum as unsigned because MSVC insists
- // on making enums signed. Set/Query this
- // value using accessors.
+ unsigned StackProtector : 2; // Whether stack protectors are on.
+ unsigned SignedOverflowBehavior : 2; // How to handle signed integer overflow.
public:
unsigned InstantiationDepth; // Maximum template instantiation depth.
@@ -129,13 +127,19 @@ public:
Protected,
Hidden
};
+
+ enum SignedOverflowBehaviorTy {
+ SOB_Undefined, // Default C standard behavior.
+ SOB_Defined, // -fwrapv
+ SOB_Trapping // -ftrapv
+ };
LangOptions() {
Trigraphs = BCPLComment = Bool = DollarIdents = AsmPreprocessor = 0;
GNUMode = GNUKeywords = ImplicitInt = Digraphs = 0;
HexFloats = 0;
GC = ObjC1 = ObjC2 = ObjCNonFragileABI = ObjCNonFragileABI2 = 0;
- NoConstantCFStrings = 0;
+ NoConstantCFStrings = 0; InlineVisibilityHidden = 0;
C99 = Microsoft = CPlusPlus = CPlusPlus0x = 0;
CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0;
Exceptions = SjLjExceptions = Freestanding = NoBuiltin = 0;
@@ -146,20 +150,19 @@ public:
AltiVec = OpenCL = StackProtector = 0;
SymbolVisibility = (unsigned) Default;
-
+
ThreadsafeStatics = 1;
POSIXThreads = 0;
Blocks = 0;
EmitAllDecls = 0;
MathErrno = 1;
-
+ SignedOverflowBehavior = SOB_Undefined;
+
AssumeSaneOperatorNew = 1;
-
- // FIXME: The default should be 1.
- AccessControl = 0;
+ AccessControl = 1;
ElideConstructors = 1;
- OverflowChecking = 0;
+ SignedOverflowBehavior = 0;
ObjCGCBitmapPrint = 0;
InstantiationDepth = 1024;
@@ -178,6 +181,7 @@ public:
CatchUndefined = 0;
DumpRecordLayouts = 0;
DumpVTableLayouts = 0;
+ SpellChecking = 1;
NoBitFieldTypeAlign = 0;
}
@@ -195,6 +199,13 @@ public:
return (VisibilityMode) SymbolVisibility;
}
void setVisibilityMode(VisibilityMode v) { SymbolVisibility = (unsigned) v; }
+
+ SignedOverflowBehaviorTy getSignedOverflowBehavior() const {
+ return (SignedOverflowBehaviorTy)SignedOverflowBehavior;
+ }
+ void setSignedOverflowBehavior(SignedOverflowBehaviorTy V) {
+ SignedOverflowBehavior = (unsigned)V;
+ }
};
} // end namespace clang
diff --git a/include/clang/Basic/Makefile b/include/clang/Basic/Makefile
index 48f7f9d8cc7b..7db3e2982af4 100644
--- a/include/clang/Basic/Makefile
+++ b/include/clang/Basic/Makefile
@@ -1,16 +1,33 @@
-LEVEL = ../../../../..
-BUILT_SOURCES = DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
+CLANG_LEVEL := ../../..
+BUILT_SOURCES = \
+ DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
DiagnosticCommonKinds.inc DiagnosticDriverKinds.inc \
DiagnosticFrontendKinds.inc DiagnosticLexKinds.inc \
DiagnosticParseKinds.inc DiagnosticSemaKinds.inc \
- DiagnosticGroups.inc
+ DiagnosticGroups.inc AttrList.inc arm_neon.inc \
+ Version.inc
TABLEGEN_INC_FILES_COMMON = 1
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
INPUT_TDS = $(wildcard $(PROJ_SRC_DIR)/Diagnostic*.td)
+# Compute the Clang version from the LLVM version, unless specified explicitly.
+ifndef CLANG_VERSION
+CLANG_VERSION := $(subst svn,,$(LLVMVersion))
+endif
+
+CLANG_VERSION_COMPONENTS := $(subst ., ,$(CLANG_VERSION))
+CLANG_VERSION_MAJOR := $(word 1,$(CLANG_VERSION_COMPONENTS))
+CLANG_VERSION_MINOR := $(word 2,$(CLANG_VERSION_COMPONENTS))
+CLANG_VERSION_PATCHLEVEL := $(word 3,$(CLANG_VERSION_COMPONENTS))
+ifeq ($(CLANG_VERSION_PATCHLEVEL),)
+CLANG_HAS_VERSION_PATCHLEVEL := 0
+else
+CLANG_HAS_VERSION_PATCHLEVEL := 1
+endif
+
$(ObjDir)/Diagnostic%Kinds.inc.tmp : Diagnostic.td Diagnostic%Kinds.td $(TBLGEN) $(ObjDir)/.dir
$(Echo) "Building Clang $(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) diagnostic tables with tblgen"
$(Verb) $(TableGen) -gen-clang-diags-defs -clang-component=$(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) -o $(call SYSPATH, $@) $<
@@ -19,4 +36,20 @@ $(ObjDir)/DiagnosticGroups.inc.tmp : Diagnostic.td DiagnosticGroups.td $(INPUT_T
$(Echo) "Building Clang diagnostic groups with tblgen"
$(Verb) $(TableGen) -gen-clang-diag-groups -o $(call SYSPATH, $@) $<
+$(ObjDir)/AttrList.inc.tmp : Attr.td $(TBLGEN) $(ObjDir)/.dir
+ $(Echo) "Building Clang attribute list with tblgen"
+ $(Verb) $(TableGen) -gen-clang-attr-list -o $(call SYSPATH, $@) \
+ -I $(PROJ_SRC_DIR)/../.. $<
+
+$(ObjDir)/arm_neon.inc.tmp : arm_neon.td $(TBLGEN) $(ObjDir)/.dir
+ $(Echo) "Building Clang arm_neon.inc with tblgen"
+ $(Verb) $(TableGen) -gen-arm-neon-sema -o $(call SYSPATH, $@) $<
+$(ObjDir)/Version.inc.tmp : Version.inc.in Makefile $(LLVM_OBJ_ROOT)/Makefile.config $(ObjDir)/.dir
+ $(Echo) "Updating Clang version info."
+ $(Verb)sed -e "s#@CLANG_VERSION@#$(CLANG_VERSION)#g" \
+ -e "s#@CLANG_VERSION_MAJOR@#$(CLANG_VERSION_MAJOR)#g" \
+ -e "s#@CLANG_VERSION_MINOR@#$(CLANG_VERSION_MINOR)#g" \
+ -e "s#@CLANG_VERSION_PATCHLEVEL@#$(CLANG_VERSION_PATCHLEVEL)#g" \
+ -e "s#@CLANG_HAS_VERSION_PATCHLEVEL@#$(CLANG_HAS_VERSION_PATCHLEVEL)#g" \
+ $< > $@
diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h
index 89fae87ae8ef..cd0da97e2ba3 100644
--- a/include/clang/Basic/PartialDiagnostic.h
+++ b/include/clang/Basic/PartialDiagnostic.h
@@ -59,7 +59,7 @@ public:
/// DiagRanges - The list of ranges added to this diagnostic. It currently
/// only support 10 ranges, could easily be extended if needed.
- SourceRange DiagRanges[10];
+ CharSourceRange DiagRanges[10];
enum { MaxFixItHints = 3 };
@@ -142,7 +142,7 @@ private:
DiagStorage = 0;
}
- void AddSourceRange(const SourceRange &R) const {
+ void AddSourceRange(const CharSourceRange &R) const {
if (!DiagStorage)
DiagStorage = getStorage();
@@ -264,10 +264,16 @@ public:
friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
const SourceRange &R) {
- PD.AddSourceRange(R);
+ PD.AddSourceRange(CharSourceRange::getTokenRange(R));
return PD;
}
+ friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
+ const CharSourceRange &R) {
+ PD.AddSourceRange(R);
+ return PD;
+ }
+
friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
const FixItHint &Hint) {
PD.AddFixItHint(Hint);
diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h
index 0bbeffefc725..35f27fbebd72 100644
--- a/include/clang/Basic/SourceLocation.h
+++ b/include/clang/Basic/SourceLocation.h
@@ -172,6 +172,56 @@ public:
return B != X.B || E != X.E;
}
};
+
+/// CharSourceRange - This class represents a character granular source range.
+/// The underlying SourceRange can either specify the starting/ending character
+/// of the range, or it can specify the start or the range and the start of the
+/// last token of the range (a "token range"). In the token range case, the
+/// size of the last token must be measured to determine the actual end of the
+/// range.
+class CharSourceRange {
+ SourceRange Range;
+ bool IsTokenRange;
+public:
+ CharSourceRange() : IsTokenRange(false) {}
+ CharSourceRange(SourceRange R, bool ITR) : Range(R),IsTokenRange(ITR){}
+
+ static CharSourceRange getTokenRange(SourceRange R) {
+ CharSourceRange Result;
+ Result.Range = R;
+ Result.IsTokenRange = true;
+ return Result;
+ }
+
+ static CharSourceRange getCharRange(SourceRange R) {
+ CharSourceRange Result;
+ Result.Range = R;
+ Result.IsTokenRange = false;
+ return Result;
+ }
+
+ static CharSourceRange getTokenRange(SourceLocation B, SourceLocation E) {
+ return getTokenRange(SourceRange(B, E));
+ }
+ static CharSourceRange getCharRange(SourceLocation B, SourceLocation E) {
+ return getCharRange(SourceRange(B, E));
+ }
+
+ /// isTokenRange - Return true if the end of this range specifies the start of
+ /// the last token. Return false if the end of this range specifies the last
+ /// character in the range.
+ bool isTokenRange() const { return IsTokenRange; }
+
+ SourceLocation getBegin() const { return Range.getBegin(); }
+ SourceLocation getEnd() const { return Range.getEnd(); }
+ const SourceRange &getAsRange() const { return Range; }
+
+ void setBegin(SourceLocation b) { Range.setBegin(b); }
+ void setEnd(SourceLocation e) { Range.setEnd(e); }
+
+ bool isValid() const { return Range.isValid(); }
+ bool isInvalid() const { return !isValid(); }
+};
/// FullSourceLoc - A SourceLocation and its associated SourceManager. Useful
/// for argument passing to functions that expect both objects.
diff --git a/include/clang/AST/StmtNodes.td b/include/clang/Basic/StmtNodes.td
index 60c94a609b4a..a2f69730a010 100644
--- a/include/clang/AST/StmtNodes.td
+++ b/include/clang/Basic/StmtNodes.td
@@ -1,4 +1,6 @@
-class Stmt<bit abstract = 0> {
+class AttrSubject;
+
+class Stmt<bit abstract = 0> : AttrSubject {
bit Abstract = abstract;
}
@@ -93,11 +95,10 @@ def CXXNullPtrLiteralExpr : DStmt<Expr>;
def CXXThisExpr : DStmt<Expr>;
def CXXThrowExpr : DStmt<Expr>;
def CXXDefaultArgExpr : DStmt<Expr>;
-def CXXZeroInitValueExpr : DStmt<Expr>;
+def CXXScalarValueInitExpr : DStmt<Expr>;
def CXXNewExpr : DStmt<Expr>;
def CXXDeleteExpr : DStmt<Expr>;
def CXXPseudoDestructorExpr : DStmt<Expr>;
-def UnresolvedLookupExpr : DStmt<Expr>;
def UnaryTypeTraitExpr : DStmt<Expr>;
def DependentScopeDeclRefExpr : DStmt<Expr>;
def CXXConstructExpr : DStmt<Expr>;
@@ -107,7 +108,9 @@ def CXXExprWithTemporaries : DStmt<Expr>;
def CXXTemporaryObjectExpr : DStmt<CXXConstructExpr>;
def CXXUnresolvedConstructExpr : DStmt<Expr>;
def CXXDependentScopeMemberExpr : DStmt<Expr>;
-def UnresolvedMemberExpr : DStmt<Expr>;
+def OverloadExpr : DStmt<Expr, 1>;
+def UnresolvedLookupExpr : DStmt<OverloadExpr>;
+def UnresolvedMemberExpr : DStmt<OverloadExpr>;
// Obj-C Expressions.
def ObjCStringLiteral : DStmt<Expr>;
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index 00fd9b92e13e..5763a12135e9 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -51,12 +51,14 @@ protected:
unsigned char FloatWidth, FloatAlign;
unsigned char DoubleWidth, DoubleAlign;
unsigned char LongDoubleWidth, LongDoubleAlign;
+ unsigned char LargeArrayMinWidth, LargeArrayAlign;
unsigned char LongWidth, LongAlign;
unsigned char LongLongWidth, LongLongAlign;
const char *DescriptionString;
const char *UserLabelPrefix;
const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat;
unsigned char RegParmMax, SSERegParmMax;
+ std::string CXXABI;
unsigned HasAlignMac68kSupport : 1;
@@ -194,6 +196,11 @@ public:
return *LongDoubleFormat;
}
+ // getLargeArrayMinWidth/Align - Return the minimum array size that is
+ // 'large' and its alignment.
+ unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; }
+ unsigned getLargeArrayAlign() const { return LargeArrayAlign; }
+
/// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this
/// target, in bits.
unsigned getIntMaxTWidth() const {
@@ -390,6 +397,11 @@ public:
return "";
}
+ /// getCXXABI - Get the C++ ABI in use.
+ virtual llvm::StringRef getCXXABI() const {
+ return CXXABI;
+ }
+
/// setCPU - Target the specific CPU.
///
/// \return - False on error (invalid CPU name).
@@ -406,6 +418,16 @@ public:
return false;
}
+ /// setCXXABI - Use this specific C++ ABI.
+ ///
+ /// \return - False on error (invalid ABI name).
+ virtual bool setCXXABI(const std::string &Name) {
+ if (Name != "itanium" && Name != "microsoft")
+ return false;
+ CXXABI = Name;
+ return true;
+ }
+
/// setFeatureEnabled - Enable or disable a specific target feature,
/// the feature name must be valid.
///
@@ -450,7 +472,12 @@ public:
return -1;
}
-
+ /// getStaticInitSectionSpecifier - Return the section to use for C++ static
+ /// initialization functions.
+ virtual const char *getStaticInitSectionSpecifier() const {
+ return 0;
+ }
+
protected:
virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
return PointerWidth;
diff --git a/include/clang/Basic/TargetOptions.h b/include/clang/Basic/TargetOptions.h
index eeaab1558fd1..19b0cbbf5820 100644
--- a/include/clang/Basic/TargetOptions.h
+++ b/include/clang/Basic/TargetOptions.h
@@ -19,6 +19,10 @@ namespace clang {
class TargetOptions {
public:
+ TargetOptions() {
+ CXXABI = "itanium";
+ }
+
/// If given, the name of the target triple to compile for. If not given the
/// target will be selected to match the host.
std::string Triple;
@@ -29,6 +33,10 @@ public:
/// If given, the name of the target ABI to use.
std::string ABI;
+ /// If given, the name of the target C++ ABI to use. If not given, defaults
+ /// to "itanium".
+ std::string CXXABI;
+
/// The list of target specific features to enable or disable -- this should
/// be a list of strings starting with by '+' or '-'.
std::vector<std::string> Features;
diff --git a/include/clang/Basic/Version.h b/include/clang/Basic/Version.h
index b3b61841a8c3..9948677662cd 100644
--- a/include/clang/Basic/Version.h
+++ b/include/clang/Basic/Version.h
@@ -17,15 +17,7 @@
#include "llvm/ADT/StringRef.h"
-/// \brief Clang major version
-#define CLANG_VERSION_MAJOR 2
-
-// FIXME: Updates to this file must also update CMakeLists.txt and VER.
-/// \brief Clang minor version
-#define CLANG_VERSION_MINOR 0
-
-/// \brief Clang patchlevel version
-// #define CLANG_VERSION_PATCHLEVEL 1
+#include "clang/Basic/Version.inc"
/// \brief Helper macro for CLANG_VERSION_STRING.
#define CLANG_MAKE_VERSION_STRING2(X) #X
diff --git a/include/clang/Basic/Version.inc.in b/include/clang/Basic/Version.inc.in
new file mode 100644
index 000000000000..ccf8430c8ba2
--- /dev/null
+++ b/include/clang/Basic/Version.inc.in
@@ -0,0 +1,6 @@
+#define CLANG_VERSION @CLANG_VERSION@
+#define CLANG_VERSION_MAJOR @CLANG_VERSION_MAJOR@
+#define CLANG_VERSION_MINOR @CLANG_VERSION_MINOR@
+#if @CLANG_HAS_VERSION_PATCHLEVEL@
+#define CLANG_VERSION_PATCHLEVEL @CLANG_VERSION_PATCHLEVEL@
+#endif
diff --git a/include/clang/Basic/arm_neon.td b/include/clang/Basic/arm_neon.td
new file mode 100644
index 000000000000..b42755ca72ae
--- /dev/null
+++ b/include/clang/Basic/arm_neon.td
@@ -0,0 +1,341 @@
+//===--- arm_neon.td - ARM NEON compiler interface ------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the TableGen definitions from which the ARM NEON header
+// file will be generated. See ARM document DUI0348B.
+//
+//===----------------------------------------------------------------------===//
+
+class Op;
+
+def OP_NONE : Op;
+def OP_ADD : Op;
+def OP_SUB : Op;
+def OP_MUL : Op;
+def OP_MLA : Op;
+def OP_MLS : Op;
+def OP_MUL_N : Op;
+def OP_MLA_N : Op;
+def OP_MLS_N : Op;
+def OP_EQ : Op;
+def OP_GE : Op;
+def OP_LE : Op;
+def OP_GT : Op;
+def OP_LT : Op;
+def OP_NEG : Op;
+def OP_NOT : Op;
+def OP_AND : Op;
+def OP_OR : Op;
+def OP_XOR : Op;
+def OP_ANDN : Op;
+def OP_ORN : Op;
+def OP_CAST : Op;
+def OP_HI : Op;
+def OP_LO : Op;
+def OP_CONC : Op;
+def OP_DUP : Op;
+def OP_SEL : Op;
+def OP_REV64 : Op;
+def OP_REV32 : Op;
+def OP_REV16 : Op;
+
+class Inst <string p, string t, Op o> {
+ string Prototype = p;
+ string Types = t;
+ Op Operand = o;
+ bit isShift = 0;
+}
+
+// Used to generate Builtins.def
+class SInst<string p, string t> : Inst<p, t, OP_NONE> {}
+class IInst<string p, string t> : Inst<p, t, OP_NONE> {}
+class WInst<string p, string t> : Inst<p, t, OP_NONE> {}
+
+// prototype: return (arg, arg, ...)
+// v: void
+// t: best-fit integer (int/poly args)
+// x: signed integer (int/float args)
+// u: unsigned integer (int/float args)
+// f: float (int args)
+// d: default
+// w: double width elements, same num elts
+// n: double width elements, half num elts
+// h: half width elements, double num elts
+// e: half width elements, double num elts, unsigned
+// i: constant int
+// l: constant uint64
+// s: scalar of element type
+// a: scalar of element type (splat to vector type)
+// k: default elt width, double num elts
+// #: array of default vectors
+// p: pointer type
+// c: const pointer type
+
+// sizes: