aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--TODO.txt1
-rw-r--r--clang.xcodeproj/project.pbxproj6
-rw-r--r--docs/UsersManual.html16
-rw-r--r--examples/CMakeLists.txt3
-rw-r--r--examples/Makefile14
-rw-r--r--examples/PrintFunctionNames/CMakeLists.txt26
-rw-r--r--examples/PrintFunctionNames/Makefile28
-rw-r--r--examples/PrintFunctionNames/PrintFunctionNames.cpp44
-rw-r--r--examples/PrintFunctionNames/README.txt10
-rw-r--r--examples/wpa/CMakeLists.txt23
-rw-r--r--examples/wpa/Makefile17
-rw-r--r--examples/wpa/clang-wpa.cpp56
-rw-r--r--include/clang-c/Index.h87
-rw-r--r--include/clang/AST/ASTContext.h42
-rw-r--r--include/clang/AST/CanonicalType.h2
-rw-r--r--include/clang/AST/CharUnits.h149
-rw-r--r--include/clang/AST/Decl.h80
-rw-r--r--include/clang/AST/DeclCXX.h16
-rw-r--r--include/clang/AST/DeclObjC.h6
-rw-r--r--include/clang/AST/Expr.h78
-rw-r--r--include/clang/AST/ExprCXX.h120
-rw-r--r--include/clang/AST/ExprObjC.h27
-rw-r--r--include/clang/AST/FullExpr.h89
-rw-r--r--include/clang/AST/RecordLayout.h2
-rw-r--r--include/clang/AST/Stmt.h24
-rw-r--r--include/clang/AST/StmtIterator.h37
-rw-r--r--include/clang/AST/TemplateBase.h2
-rw-r--r--include/clang/AST/Type.h52
-rw-r--r--include/clang/AST/TypeLoc.h7
-rw-r--r--include/clang/AST/TypeNodes.def2
-rw-r--r--include/clang/Analysis/Analyses/LiveVariables.h2
-rw-r--r--include/clang/Analysis/Analyses/UninitializedValues.h2
-rw-r--r--include/clang/Analysis/CFG.h116
-rw-r--r--include/clang/Analysis/FlowSensitive/DataflowValues.h2
-rw-r--r--include/clang/Analysis/LocalCheckers.h2
-rw-r--r--include/clang/Analysis/PathDiagnostic.h2
-rw-r--r--include/clang/Analysis/PathSensitive/AnalysisContext.h25
-rw-r--r--include/clang/Analysis/PathSensitive/AnalysisManager.h9
-rw-r--r--include/clang/Analysis/PathSensitive/BugReporter.h5
-rw-r--r--include/clang/Analysis/PathSensitive/Checker.h11
-rw-r--r--include/clang/Analysis/PathSensitive/CheckerVisitor.def27
-rw-r--r--include/clang/Analysis/PathSensitive/CheckerVisitor.h21
-rw-r--r--include/clang/Analysis/PathSensitive/ExplodedGraph.h2
-rw-r--r--include/clang/Analysis/PathSensitive/GRCoreEngine.h9
-rw-r--r--include/clang/Analysis/PathSensitive/GRExprEngine.h72
-rw-r--r--include/clang/Analysis/PathSensitive/GRState.h19
-rw-r--r--include/clang/Analysis/PathSensitive/GRSubEngine.h3
-rw-r--r--include/clang/Analysis/PathSensitive/GRTransferFuncs.h3
-rw-r--r--include/clang/Analysis/PathSensitive/MemRegion.h62
-rw-r--r--include/clang/Analysis/PathSensitive/SVals.h5
-rw-r--r--include/clang/Analysis/PathSensitive/Store.h5
-rw-r--r--include/clang/Analysis/PathSensitive/ValueManager.h7
-rw-r--r--include/clang/Analysis/ProgramPoint.h10
-rw-r--r--include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h3
-rw-r--r--include/clang/Analysis/Visitors/CFGRecStmtVisitor.h19
-rw-r--r--include/clang/Analysis/Visitors/CFGStmtVisitor.h12
-rw-r--r--include/clang/Basic/Builtins.def46
-rw-r--r--include/clang/Basic/Diagnostic.h13
-rw-r--r--include/clang/Basic/DiagnosticCommonKinds.td1
-rw-r--r--include/clang/Basic/DiagnosticFrontendKinds.td3
-rw-r--r--include/clang/Basic/DiagnosticGroups.td5
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td2
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td142
-rw-r--r--include/clang/Basic/LangOptions.h7
-rw-r--r--include/clang/Basic/TargetInfo.h21
-rw-r--r--include/clang/CodeGen/CodeGenOptions.h4
-rw-r--r--include/clang/Driver/CC1Options.td12
-rw-r--r--include/clang/Driver/Options.td29
-rw-r--r--include/clang/Driver/ToolChain.h7
-rw-r--r--include/clang/Frontend/ASTConsumers.h6
-rw-r--r--include/clang/Frontend/FrontendActions.h6
-rw-r--r--include/clang/Frontend/FrontendOptions.h1
-rw-r--r--include/clang/Frontend/PCHBitCodes.h2
-rw-r--r--include/clang/Frontend/TypeXML.def6
-rw-r--r--include/clang/Lex/Lexer.h6
-rw-r--r--include/clang/Lex/LiteralSupport.h10
-rw-r--r--include/clang/Parse/Action.h26
-rw-r--r--include/clang/Parse/DeclSpec.h2
-rw-r--r--include/clang/Parse/Parser.h5
-rw-r--r--include/clang/Sema/CodeCompleteConsumer.h12
-rw-r--r--lib/AST/ASTContext.cpp125
-rw-r--r--lib/AST/CMakeLists.txt1
-rw-r--r--lib/AST/Decl.cpp79
-rw-r--r--lib/AST/DeclCXX.cpp16
-rw-r--r--lib/AST/DeclGroup.cpp1
-rw-r--r--lib/AST/DeclarationName.cpp2
-rw-r--r--lib/AST/Expr.cpp56
-rw-r--r--lib/AST/ExprCXX.cpp73
-rw-r--r--lib/AST/ExprConstant.cpp72
-rw-r--r--lib/AST/FullExpr.cpp58
-rw-r--r--lib/AST/Stmt.cpp128
-rw-r--r--lib/AST/StmtIterator.cpp16
-rw-r--r--lib/AST/StmtProfile.cpp1
-rw-r--r--lib/AST/Type.cpp23
-rw-r--r--lib/AST/TypePrinter.cpp15
-rw-r--r--lib/Analysis/AnalysisContext.cpp16
-rw-r--r--lib/Analysis/BasicObjCFoundationChecks.cpp2
-rw-r--r--lib/Analysis/BasicStore.cpp17
-rw-r--r--lib/Analysis/CFG.cpp197
-rw-r--r--lib/Analysis/CFRefCount.cpp17
-rw-r--r--lib/Analysis/CallInliner.cpp94
-rw-r--r--lib/Analysis/CheckDeadStores.cpp24
-rw-r--r--lib/Analysis/GRCoreEngine.cpp14
-rw-r--r--lib/Analysis/GRExprEngine.cpp582
-rw-r--r--lib/Analysis/LiveVariables.cpp27
-rw-r--r--lib/Analysis/MallocChecker.cpp32
-rw-r--r--lib/Analysis/MemRegion.cpp18
-rw-r--r--lib/Analysis/NoReturnFunctionChecker.cpp5
-rw-r--r--lib/Analysis/OSAtomicChecker.cpp10
-rw-r--r--lib/Analysis/RegionStore.cpp29
-rw-r--r--lib/Analysis/SValuator.cpp17
-rw-r--r--lib/Analysis/SimpleConstraintManager.cpp28
-rw-r--r--lib/Analysis/Store.cpp21
-rw-r--r--lib/Basic/Diagnostic.cpp13
-rw-r--r--lib/Basic/FileManager.cpp5
-rw-r--r--lib/Basic/TargetInfo.cpp2
-rw-r--r--lib/Basic/Targets.cpp231
-rw-r--r--lib/CodeGen/CGBlocks.cpp5
-rw-r--r--lib/CodeGen/CGBuiltin.cpp39
-rw-r--r--lib/CodeGen/CGCXX.cpp845
-rw-r--r--lib/CodeGen/CGCall.cpp48
-rw-r--r--lib/CodeGen/CGCall.h20
-rw-r--r--lib/CodeGen/CGClass.cpp775
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp118
-rw-r--r--lib/CodeGen/CGDecl.cpp8
-rw-r--r--lib/CodeGen/CGException.cpp66
-rw-r--r--lib/CodeGen/CGExpr.cpp110
-rw-r--r--lib/CodeGen/CGExprAgg.cpp51
-rw-r--r--lib/CodeGen/CGExprCXX.cpp74
-rw-r--r--lib/CodeGen/CGExprComplex.cpp11
-rw-r--r--lib/CodeGen/CGExprScalar.cpp43
-rw-r--r--lib/CodeGen/CGObjC.cpp8
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp34
-rw-r--r--lib/CodeGen/CGObjCMac.cpp10
-rw-r--r--lib/CodeGen/CGRTTI.cpp1118
-rw-r--r--lib/CodeGen/CGRecordLayoutBuilder.cpp16
-rw-r--r--lib/CodeGen/CGRecordLayoutBuilder.h5
-rw-r--r--lib/CodeGen/CGTemporaries.cpp42
-rw-r--r--lib/CodeGen/CGVtable.cpp58
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp2
-rw-r--r--lib/CodeGen/CodeGenFunction.h33
-rw-r--r--lib/CodeGen/CodeGenModule.cpp8
-rw-r--r--lib/CodeGen/CodeGenModule.h24
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp11
-rw-r--r--lib/CodeGen/Mangle.cpp68
-rw-r--r--lib/CodeGen/ModuleBuilder.cpp2
-rw-r--r--lib/CodeGen/TargetABIInfo.cpp4
-rw-r--r--lib/Driver/CC1Options.cpp2
-rw-r--r--lib/Driver/Driver.cpp18
-rw-r--r--lib/Driver/ToolChain.cpp4
-rw-r--r--lib/Driver/ToolChains.cpp66
-rw-r--r--lib/Driver/ToolChains.h2
-rw-r--r--lib/Driver/Tools.cpp106
-rw-r--r--lib/Driver/Tools.h2
-rw-r--r--lib/Frontend/AnalysisConsumer.cpp57
-rw-r--r--lib/Frontend/CMakeLists.txt1
-rw-r--r--lib/Frontend/CompilerInvocation.cpp24
-rw-r--r--lib/Frontend/FrontendActions.cpp5
-rw-r--r--lib/Frontend/InitHeaderSearch.cpp13
-rw-r--r--lib/Frontend/PCHReader.cpp17
-rw-r--r--lib/Frontend/PCHReaderStmt.cpp2
-rw-r--r--lib/Frontend/PCHWriter.cpp19
-rw-r--r--lib/Frontend/PCHWriterStmt.cpp2
-rw-r--r--lib/Frontend/RewriteBlocks.cpp1152
-rw-r--r--lib/Frontend/RewriteObjC.cpp241
-rw-r--r--lib/Frontend/Warnings.cpp37
-rw-r--r--lib/Lex/Lexer.cpp30
-rw-r--r--lib/Lex/LiteralSupport.cpp22
-rw-r--r--lib/Lex/MacroArgs.cpp64
-rw-r--r--lib/Lex/MacroArgs.h2
-rw-r--r--lib/Lex/PPDirectives.cpp35
-rw-r--r--lib/Lex/Preprocessor.cpp15
-rw-r--r--lib/Lex/TokenLexer.cpp4
-rw-r--r--lib/Parse/ParseCXXInlineMethods.cpp10
-rw-r--r--lib/Parse/ParseDecl.cpp26
-rw-r--r--lib/Parse/ParseDeclCXX.cpp32
-rw-r--r--lib/Parse/ParseObjc.cpp2
-rw-r--r--lib/Parse/ParseStmt.cpp112
-rw-r--r--lib/Parse/ParseTemplate.cpp6
-rw-r--r--lib/Parse/ParseTentative.cpp19
-rw-r--r--lib/Parse/Parser.cpp13
-rw-r--r--lib/Sema/CodeCompleteConsumer.cpp17
-rw-r--r--lib/Sema/Lookup.h68
-rw-r--r--lib/Sema/Sema.cpp13
-rw-r--r--lib/Sema/Sema.h175
-rw-r--r--lib/Sema/SemaAccess.cpp2
-rw-r--r--lib/Sema/SemaCXXCast.cpp15
-rw-r--r--lib/Sema/SemaCXXScopeSpec.cpp50
-rw-r--r--lib/Sema/SemaChecking.cpp3
-rw-r--r--lib/Sema/SemaCodeComplete.cpp79
-rw-r--r--lib/Sema/SemaDecl.cpp342
-rw-r--r--lib/Sema/SemaDeclAttr.cpp19
-rw-r--r--lib/Sema/SemaDeclCXX.cpp449
-rw-r--r--lib/Sema/SemaDeclObjC.cpp13
-rw-r--r--lib/Sema/SemaExpr.cpp639
-rw-r--r--lib/Sema/SemaExprCXX.cpp274
-rw-r--r--lib/Sema/SemaExprObjC.cpp2
-rw-r--r--lib/Sema/SemaInit.cpp1140
-rw-r--r--lib/Sema/SemaInit.h181
-rw-r--r--lib/Sema/SemaLookup.cpp662
-rw-r--r--lib/Sema/SemaOverload.cpp397
-rw-r--r--lib/Sema/SemaStmt.cpp31
-rw-r--r--lib/Sema/SemaTemplate.cpp93
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp156
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp5
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp29
-rw-r--r--lib/Sema/SemaType.cpp39
-rw-r--r--lib/Sema/TreeTransform.h96
-rw-r--r--test/Analysis/CFDateGC.m10
-rw-r--r--test/Analysis/CFNumber.c8
-rw-r--r--test/Analysis/CFRetainRelease_NSAssertionHandler.m8
-rw-r--r--test/Analysis/CGColorSpace.c8
-rw-r--r--test/Analysis/CheckNSError.m8
-rw-r--r--test/Analysis/MissingDealloc.m2
-rw-r--r--test/Analysis/NSPanel.m8
-rw-r--r--test/Analysis/NSString-failed-cases.m8
-rw-r--r--test/Analysis/NSString.m16
-rw-r--r--test/Analysis/NSWindow.m8
-rw-r--r--test/Analysis/NoReturn.m8
-rw-r--r--test/Analysis/ObjCProperties.m8
-rw-r--r--test/Analysis/ObjCRetSigs.m2
-rw-r--r--test/Analysis/PR2599.m8
-rw-r--r--test/Analysis/PR2978.m2
-rw-r--r--test/Analysis/PR3991.m8
-rw-r--r--test/Analysis/array-struct.c8
-rw-r--r--test/Analysis/blocks.m2
-rw-r--r--test/Analysis/casts.c2
-rw-r--r--test/Analysis/casts.m4
-rw-r--r--test/Analysis/cfref_PR2519.c8
-rw-r--r--test/Analysis/cfref_rdar6080742.c8
-rw-r--r--test/Analysis/complex.c8
-rw-r--r--test/Analysis/concrete-address.c4
-rw-r--r--test/Analysis/conditional-op-missing-lhs.c2
-rw-r--r--test/Analysis/dead-stores.c10
-rw-r--r--test/Analysis/dead-stores.cpp77
-rw-r--r--test/Analysis/dead-stores.m2
-rw-r--r--test/Analysis/delegates.m4
-rw-r--r--test/Analysis/elementtype.c2
-rw-r--r--test/Analysis/exercise-ps.c4
-rw-r--r--test/Analysis/fields.c4
-rw-r--r--test/Analysis/func.c4
-rw-r--r--test/Analysis/malloc.c10
-rw-r--r--test/Analysis/misc-ps-64.m8
-rw-r--r--test/Analysis/misc-ps-basic-store.m2
-rw-r--r--test/Analysis/misc-ps-eager-assume.m2
-rw-r--r--test/Analysis/misc-ps-ranges.m4
-rw-r--r--test/Analysis/misc-ps-region-store-i386.m2
-rw-r--r--test/Analysis/misc-ps-region-store-x86_64.m2
-rw-r--r--test/Analysis/misc-ps-region-store.cpp91
-rw-r--r--test/Analysis/misc-ps-region-store.m52
-rw-r--r--test/Analysis/misc-ps-region-store.mm31
-rw-r--r--test/Analysis/misc-ps.m8
-rw-r--r--test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m8
-rw-r--r--test/Analysis/no-exit-cfg.c4
-rw-r--r--test/Analysis/no-outofbounds.c4
-rw-r--r--test/Analysis/null-deref-ps-region.c2
-rw-r--r--test/Analysis/null-deref-ps.c8
-rw-r--r--test/Analysis/outofbound.c2
-rw-r--r--test/Analysis/override-werror.c4
-rw-r--r--test/Analysis/plist-output.m2
-rw-r--r--test/Analysis/pr4209.m4
-rw-r--r--test/Analysis/pr_2542_rdar_6793404.m4
-rw-r--r--test/Analysis/pr_4164.c4
-rw-r--r--test/Analysis/ptr-arith.c4
-rw-r--r--test/Analysis/rdar-6442306-1.m4
-rw-r--r--test/Analysis/rdar-6540084.m2
-rw-r--r--test/Analysis/rdar-6541136-region.c2
-rw-r--r--test/Analysis/rdar-6541136.c2
-rw-r--r--test/Analysis/rdar-6562655.m4
-rw-r--r--test/Analysis/rdar-6582778-basic-store.c2
-rw-r--r--test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m4
-rw-r--r--test/Analysis/rdar-7168531.m4
-rw-r--r--test/Analysis/refcnt_naming.m4
-rw-r--r--test/Analysis/region-1.m4
-rw-r--r--test/Analysis/retain-release-basic-store.m2
-rw-r--r--test/Analysis/retain-release-gc-only.m4
-rw-r--r--test/Analysis/retain-release-region-store.m2
-rw-r--r--test/Analysis/retain-release.m4
-rw-r--r--test/Analysis/security-syntax-checks.m3
-rw-r--r--test/Analysis/sizeofpointer.c2
-rw-r--r--test/Analysis/stack-addr-ps.c4
-rw-r--r--test/Analysis/uninit-msg-expr.m4
-rw-r--r--test/Analysis/uninit-ps-rdar6145427.m4
-rw-r--r--test/Analysis/uninit-vals-ps-region.c2
-rw-r--r--test/Analysis/uninit-vals-ps.c4
-rw-r--r--test/Analysis/uninit-vals.c2
-rw-r--r--test/Analysis/uninit-vals.m4
-rw-r--r--test/Analysis/unions-region.m2
-rw-r--r--test/Analysis/unused-ivars.m2
-rw-r--r--test/CXX/basic/basic.def.odr/p2-typeid.cpp2
-rw-r--r--test/CXX/basic/basic.link/p9.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.argdep/p3.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp4
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.elab/templateid.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p5.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp11
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp37
-rw-r--r--test/CXX/basic/basic.start/basic.start.main/p2a.cpp2
-rw-r--r--test/CXX/basic/basic.start/basic.start.main/p2b.cpp2
-rw-r--r--test/CXX/basic/basic.start/basic.start.main/p2c.cpp2
-rw-r--r--test/CXX/basic/basic.start/basic.start.main/p2d.cpp2
-rw-r--r--test/CXX/basic/basic.start/basic.start.main/p2e.cpp2
-rw-r--r--test/CXX/basic/basic.start/basic.start.main/p2f.cpp4
-rw-r--r--test/CXX/basic/basic.start/basic.start.main/p2g.cpp2
-rw-r--r--test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp2
-rw-r--r--test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp2
-rw-r--r--test/CXX/basic/basic.stc/basic.stc.dynamic/p2-nodef.cpp2
-rw-r--r--test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp2
-rw-r--r--test/CXX/class.access/class.access.dcl/p1.cpp2
-rw-r--r--test/CXX/class.derived/class.virtual/p12.cpp2
-rw-r--r--test/CXX/class.derived/p2.cpp8
-rw-r--r--test/CXX/class/class.friend/p1-ambiguous.cpp2
-rw-r--r--test/CXX/class/class.friend/p1.cpp2
-rw-r--r--test/CXX/class/class.friend/p2.cpp2
-rw-r--r--test/CXX/class/class.friend/p6.cpp2
-rw-r--r--test/CXX/class/class.local/p1.cpp2
-rw-r--r--test/CXX/class/class.local/p2.cpp5
-rw-r--r--test/CXX/class/class.local/p3.cpp2
-rw-r--r--test/CXX/class/class.local/p4.cpp2
-rw-r--r--test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp2
-rw-r--r--test/CXX/class/class.nest/p1.cpp2
-rw-r--r--test/CXX/class/class.nested.type/p1.cpp2
-rw-r--r--test/CXX/class/class.union/p1.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp22
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p11.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p5-cxx0x.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p6-cxx0x.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udir/p1.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p3.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.list/basic.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/basic.cpp19
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p3.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp6
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p2.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp4
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p8.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p3.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp4
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp2
-rw-r--r--test/CXX/expr/expr.unary/expr.delete/p5.cpp2
-rw-r--r--test/CXX/expr/p3.cpp2
-rw-r--r--test/CXX/expr/p8.cpp2
-rw-r--r--test/CXX/expr/p9.cpp2
-rw-r--r--test/CXX/lex/lex.trigraph/p1.cpp2
-rw-r--r--test/CXX/lex/lex.trigraph/p2.cpp2
-rw-r--r--test/CXX/lex/lex.trigraph/p3.cpp2
-rw-r--r--test/CXX/over/over.match/over.match.best/p1.cpp2
-rw-r--r--test/CXX/over/over.over/p1.cpp2
-rw-r--r--test/CXX/over/over.over/p2.cpp4
-rw-r--r--test/CXX/over/over.over/p4.cpp4
-rw-r--r--test/CXX/special/class.dtor/p2.cpp2
-rw-r--r--test/CXX/special/class.free/p1.cpp2
-rw-r--r--test/CXX/special/class.free/p6.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class.spec/p6.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class/temp.mem.func/pr5056.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp6
-rw-r--r--test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp8
-rw-r--r--test/CXX/temp/temp.decls/temp.fct/temp.func.order/p4.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.fct/temp.func.order/p5.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.fct/temp.over.link/p6.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p1.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p3.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p5.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.mem/p1.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p1.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp37
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp4
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp4
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp2
-rw-r--r--test/CXX/temp/temp.param/p10.cpp2
-rw-r--r--test/CXX/temp/temp.param/p11.cpp2
-rw-r--r--test/CXX/temp/temp.param/p12.cpp2
-rw-r--r--test/CXX/temp/temp.param/p13.cpp2
-rw-r--r--test/CXX/temp/temp.param/p14.cpp2
-rw-r--r--test/CXX/temp/temp.param/p15-cxx0x.cpp2
-rw-r--r--test/CXX/temp/temp.param/p15.cpp2
-rw-r--r--test/CXX/temp/temp.param/p2.cpp2
-rw-r--r--test/CXX/temp/temp.param/p3.cpp6
-rw-r--r--test/CXX/temp/temp.param/p4.cpp2
-rw-r--r--test/CXX/temp/temp.param/p7.cpp2
-rw-r--r--test/CXX/temp/temp.param/p8.cpp2
-rw-r--r--test/CXX/temp/temp.param/p9.cpp2
-rw-r--r--test/CXX/temp/temp.res/temp.dep.res/temp.point/p1.cpp2
-rw-r--r--test/CXX/temp/temp.res/temp.dep/p3.cpp2
-rw-r--r--test/CXX/temp/temp.spec/p5.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p1.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p10.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p13.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p14.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p15.cpp4
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p16.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p19.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p21.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp6
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p5.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p6.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p1.cpp10
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p10.cpp4
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p12.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p2.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p3.cpp16
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p4.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p5.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p6.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p7.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p8.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p9.cpp2
-rw-r--r--test/CodeCompletion/call.cpp4
-rw-r--r--test/CodeCompletion/enum-switch-case-qualified.cpp16
-rw-r--r--test/CodeCompletion/enum-switch-case.c2
-rw-r--r--test/CodeCompletion/enum-switch-case.cpp12
-rw-r--r--test/CodeCompletion/function-templates.cpp4
-rw-r--r--test/CodeCompletion/functions.cpp2
-rw-r--r--test/CodeCompletion/macros.c4
-rw-r--r--test/CodeCompletion/member-access.c2
-rw-r--r--test/CodeCompletion/member-access.cpp18
-rw-r--r--test/CodeCompletion/namespace-alias.cpp2
-rw-r--r--test/CodeCompletion/namespace.cpp2
-rw-r--r--test/CodeCompletion/nested-name-specifier.cpp2
-rw-r--r--test/CodeCompletion/objc-message.m4
-rw-r--r--test/CodeCompletion/operator.cpp2
-rw-r--r--test/CodeCompletion/ordinary-name.c2
-rw-r--r--test/CodeCompletion/tag.c2
-rw-r--r--test/CodeCompletion/tag.cpp2
-rw-r--r--test/CodeCompletion/templates.cpp4
-rw-r--r--test/CodeCompletion/truncation.c4
-rw-r--r--test/CodeCompletion/using-namespace.cpp2
-rw-r--r--test/CodeCompletion/using.cpp2
-rw-r--r--test/CodeGen/2007-11-29-ArraySizeFromInitializer.c2
-rw-r--r--test/CodeGen/2008-02-07-bitfield-bug.c2
-rw-r--r--test/CodeGen/2008-02-08-bitfield-bug.c2
-rw-r--r--test/CodeGen/2008-02-26-inline-asm-bug.c2
-rw-r--r--test/CodeGen/2008-07-17-no-emit-on-error.c4
-rw-r--r--test/CodeGen/2008-07-21-mixed-var-fn-decl.c2
-rw-r--r--test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c2
-rw-r--r--test/CodeGen/2008-07-22-packed-bitfield-access.c2
-rw-r--r--test/CodeGen/2008-07-29-override-alias-decl.c2
-rw-r--r--test/CodeGen/2008-07-30-implicit-initialization.c2
-rw-r--r--test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c2
-rw-r--r--test/CodeGen/2008-07-31-asm-labels.c4
-rw-r--r--test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c2
-rw-r--r--test/CodeGen/2008-08-04-void-pointer-arithmetic.c2
-rw-r--r--test/CodeGen/2008-08-19-cast-of-typedef.c2
-rw-r--r--test/CodeGen/2008-08-25-incompatible-cond-expr.m2
-rw-r--r--test/CodeGen/2008-09-22-bad-switch-type.c2
-rw-r--r--test/CodeGen/2008-12-02-logical-or-fold.c2
-rw-r--r--test/CodeGen/2009-01-21-invalid-debug-info.m2
-rw-r--r--test/CodeGen/2009-03-22-increment-bitfield.c2
-rw-r--r--test/CodeGen/2009-04-23-dbg.c2
-rw-r--r--test/CodeGen/2009-05-22-callingconv.c2
-rw-r--r--test/CodeGen/2009-05-28-const-typedef.c2
-rw-r--r--test/CodeGen/2009-06-01-addrofknr.c2
-rw-r--r--test/CodeGen/2009-06-14-anonymous-union-init.c2
-rw-r--r--test/CodeGen/2009-07-31-DbgDeclare.c2
-rw-r--r--test/CodeGen/2009-08-14-vararray-crash.c2
-rw-r--r--test/CodeGen/2009-10-20-GlobalDebug.c2
-rw-r--r--test/CodeGen/OpaqueStruct.c2
-rw-r--r--test/CodeGen/PR2001-bitfield-reload.c2
-rw-r--r--test/CodeGen/PR2413-void-address-cast-error.c2
-rw-r--r--test/CodeGen/PR2643-null-store-to-bitfield.c2
-rw-r--r--test/CodeGen/PR2743-reference-missing-static.c2
-rw-r--r--test/CodeGen/PR3130-cond-constant.c2
-rw-r--r--test/CodeGen/PR3589-freestanding-libcalls.c6
-rw-r--r--test/CodeGen/PR3613-static-decl.c2
-rw-r--r--test/CodeGen/PR3709-int-to-pointer-sign.c2
-rw-r--r--test/CodeGen/PR4611-bitfield-layout.c2
-rw-r--r--test/CodeGen/PR5060-align.c2
-rw-r--r--test/CodeGen/address-space-cast.c2
-rw-r--r--test/CodeGen/address-space-compound-literal.c2
-rw-r--r--test/CodeGen/address-space-field1.c2
-rw-r--r--test/CodeGen/address-space-field2.c2
-rw-r--r--test/CodeGen/address-space-field3.c2
-rw-r--r--test/CodeGen/address-space-field4.c2
-rw-r--r--test/CodeGen/address-space.c10
-rw-r--r--test/CodeGen/alias.c2
-rw-r--r--test/CodeGen/align-local.c2
-rw-r--r--test/CodeGen/alignof.c2
-rw-r--r--test/CodeGen/always_inline.c4
-rw-r--r--test/CodeGen/arm-arguments.c4
-rw-r--r--test/CodeGen/arm_asm_clobber.c2
-rw-r--r--test/CodeGen/array.c2
-rw-r--r--test/CodeGen/asm-2.c2
-rw-r--r--test/CodeGen/asm-inout.c2
-rw-r--r--test/CodeGen/asm.c2
-rw-r--r--test/CodeGen/atomic.c2
-rw-r--r--test/CodeGen/attr-cleanup.c2
-rw-r--r--test/CodeGen/attr-nodebug.c2
-rw-r--r--test/CodeGen/attr-noinline.c2
-rw-r--r--test/CodeGen/attr-used.c2
-rw-r--r--test/CodeGen/attributes.c2
-rw-r--r--test/CodeGen/bitfield-assign.c4
-rw-r--r--test/CodeGen/bitfield-init.c2
-rw-r--r--test/CodeGen/bitfield-promote.c2
-rw-r--r--test/CodeGen/bitfield.c2
-rw-r--r--test/CodeGen/blocks-1.c2
-rw-r--r--test/CodeGen/blocks-2.c6
-rw-r--r--test/CodeGen/blocks-aligned-byref-variable.c4
-rw-r--r--test/CodeGen/blocks-seq.c2
-rw-r--r--test/CodeGen/blocks.c2
-rw-r--r--test/CodeGen/bool-bitfield.c2
-rw-r--r--test/CodeGen/bool-convert.c2
-rw-r--r--test/CodeGen/bool-init.c2
-rw-r--r--test/CodeGen/boolassign.c2
-rw-r--r--test/CodeGen/builtin-attributes.c2
-rw-r--r--test/CodeGen/builtin-count-zeros.c4
-rw-r--r--test/CodeGen/builtin-memfns.c2
-rw-r--r--test/CodeGen/builtin-nanf.c2
-rw-r--r--test/CodeGen/builtin-rename.c2
-rw-r--r--test/CodeGen/builtin-stackaddress.c4
-rw-r--r--test/CodeGen/builtin-unwind-init.c2
-rw-r--r--test/CodeGen/builtinmemcpy.c2
-rw-r--r--test/CodeGen/builtins-x86.c4
-rw-r--r--test/CodeGen/builtins.c2
-rw-r--r--test/CodeGen/builtinshufflevector.c2
-rw-r--r--test/CodeGen/c-strings.c2
-rw-r--r--test/CodeGen/call-knr-indirect.c2
-rw-r--r--test/CodeGen/cast.c2
-rw-r--r--test/CodeGen/cfstring.c2
-rw-r--r--test/CodeGen/cfstring2.c2
-rw-r--r--test/CodeGen/cleanup-stack.c2
-rw-r--r--test/CodeGen/complex.c2
-rw-r--r--test/CodeGen/compound-literal.c2
-rw-r--r--test/CodeGen/compound-type.c2
-rw-r--r--test/CodeGen/compound.c2
-rw-r--r--test/CodeGen/conditional-gnu-ext.c2
-rw-r--r--test/CodeGen/conditional.c2
-rw-r--r--test/CodeGen/const-init.c2
-rw-r--r--test/CodeGen/const-label-addr.c2
-rw-r--r--test/CodeGen/constant-comparison.c4
-rw-r--r--test/CodeGen/constructor-attribute.c2
-rw-r--r--test/CodeGen/cxx-condition.cpp2
-rw-r--r--test/CodeGen/cxx-default-arg.cpp2
-rw-r--r--test/CodeGen/cxx-value-init.cpp2
-rw-r--r--test/CodeGen/darwin-string-literals.c4
-rw-r--r--test/CodeGen/debug-info.c2
-rw-r--r--test/CodeGen/decl.c2
-rw-r--r--test/CodeGen/designated-initializers.c2
-rw-r--r--test/CodeGen/dllimport-dllexport.c2
-rw-r--r--test/CodeGen/dostmt.c2
-rw-r--r--test/CodeGen/emit-all-decls.c4
-rw-r--r--test/CodeGen/empty-union-init.c2
-rw-r--r--test/CodeGen/enum.c2
-rw-r--r--test/CodeGen/exprs.c2
-rw-r--r--test/CodeGen/ext-vector-shuffle.c6
-rw-r--r--test/CodeGen/ext-vector.c15
-rw-r--r--test/CodeGen/extern-block-var.c2
-rw-r--r--test/CodeGen/flexible-array-init.c2
-rw-r--r--test/CodeGen/func-decl-cleanup.c2
-rw-r--r--test/CodeGen/func-ptr-cast-decl.c6
-rw-r--r--test/CodeGen/func-return-member.c2
-rw-r--r--test/CodeGen/function-attributes.c2
-rw-r--r--test/CodeGen/function-decay.m2
-rw-r--r--test/CodeGen/functions.c2
-rw-r--r--test/CodeGen/global-decls.c2
-rw-r--r--test/CodeGen/global-init.c2
-rw-r--r--test/CodeGen/global-with-initialiser.c2
-rw-r--r--test/CodeGen/globalinit.c2
-rw-r--r--test/CodeGen/illegal-UTF8.m2
-rw-r--r--test/CodeGen/incomplete-function-type.c2
-rw-r--r--test/CodeGen/indirect-goto.c2
-rw-r--r--test/CodeGen/init-with-member-expr.c2
-rw-r--r--test/CodeGen/init.c2
-rw-r--r--test/CodeGen/inline.c6
-rw-r--r--test/CodeGen/inline2.c4
-rw-r--r--test/CodeGen/int-to-pointer.c2
-rw-r--r--test/CodeGen/kr-func-promote.c2
-rw-r--r--test/CodeGen/kr-style-block.c2
-rw-r--r--test/CodeGen/libcalls.c4
-rw-r--r--test/CodeGen/lineno-dbginfo.c2
-rw-r--r--test/CodeGen/linkage-redecl.c2
-rw-r--r--test/CodeGen/long-double-x86.c2
-rw-r--r--test/CodeGen/mandel.c2
-rw-r--r--test/CodeGen/mangle.c2
-rw-r--r--test/CodeGen/merge-attrs.c2
-rw-r--r--test/CodeGen/merge-statics.c2
-rw-r--r--test/CodeGen/no-common.c4
-rw-r--r--test/CodeGen/object-size.c4
-rw-r--r--test/CodeGen/offsetof.c2
-rw-r--r--test/CodeGen/opaque-pointer.c2
-rw-r--r--test/CodeGen/overloadable.c2
-rw-r--r--test/CodeGen/packed-union.c2
-rw-r--r--test/CodeGen/palignr.c2
-rw-r--r--test/CodeGen/parameter-passing.c6
-rw-r--r--test/CodeGen/pascal-string.c2
-rw-r--r--test/CodeGen/pointer-arithmetic.c2
-rw-r--r--test/CodeGen/pointer-cmp-type.c2
-rw-r--r--test/CodeGen/pointer-to-int.c2
-rw-r--r--test/CodeGen/pragma-pack-1.c2
-rw-r--r--test/CodeGen/pragma-pack-2.c4
-rw-r--r--test/CodeGen/pragma-pack-3.c4
-rw-r--r--test/CodeGen/pragma-weak.c2
-rw-r--r--test/CodeGen/predefined-expr.c2
-rw-r--r--test/CodeGen/private-extern.c2
-rw-r--r--test/CodeGen/rdr-6098585-default-after-caserange.c2
-rw-r--r--test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c2
-rw-r--r--test/CodeGen/rdr-6098585-empty-case-range.c2
-rw-r--r--test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c2
-rw-r--r--test/CodeGen/rdr-6098585-unsigned-caserange.c2
-rw-r--r--test/CodeGen/rdr-6732143-dangling-block-reference.m2
-rw-r--r--test/CodeGen/regparm.c2
-rw-r--r--test/CodeGen/shared-string-literals.c2
-rw-r--r--test/CodeGen/sizeof-vla.c2
-rw-r--r--test/CodeGen/stack-protector.c6
-rw-r--r--test/CodeGen/statements.c2
-rw-r--r--test/CodeGen/static-forward-decl-fun.c2
-rw-r--r--test/CodeGen/static-forward-decl.c2
-rw-r--r--test/CodeGen/static-local-union.c2
-rw-r--r--test/CodeGen/static-order.c2
-rw-r--r--test/CodeGen/staticinit.c2
-rw-r--r--test/CodeGen/stdcall-fastcall.c4
-rw-r--r--test/CodeGen/string-literal.c2
-rw-r--r--test/CodeGen/struct-comma.c2
-rw-r--r--test/CodeGen/struct-copy.c2
-rw-r--r--test/CodeGen/struct-init.c2
-rw-r--r--test/CodeGen/struct-passing.c2
-rw-r--r--test/CodeGen/struct-x86-darwin.c2
-rw-r--r--test/CodeGen/struct.c2
-rw-r--r--test/CodeGen/switch.c2
-rw-r--r--test/CodeGen/target-data.c6
-rw-r--r--test/CodeGen/tentative-decls.c2
-rw-r--r--test/CodeGen/thread-specifier.c2
-rw-r--r--test/CodeGen/trapv.c2
-rw-r--r--test/CodeGen/typedef-func.c2
-rw-r--r--test/CodeGen/typedef.c2
-rw-r--r--test/CodeGen/types.c2
-rw-r--r--test/CodeGen/uint128_t.c2
-rw-r--r--test/CodeGen/union-init.c2
-rw-r--r--test/CodeGen/union-init2.c2
-rw-r--r--test/CodeGen/union.c2
-rw-r--r--test/CodeGen/unreachable.c2
-rw-r--r--test/CodeGen/unwind-attr.c4
-rw-r--r--test/CodeGen/var-align.c2
-rw-r--r--test/CodeGen/variable-array.c2
-rw-r--r--test/CodeGen/vector.c2
-rw-r--r--test/CodeGen/vfprintf.c2
-rw-r--r--test/CodeGen/visibility.c6
-rw-r--r--test/CodeGen/vla.c2
-rw-r--r--test/CodeGen/volatile-1.c2
-rw-r--r--test/CodeGen/volatile.c2
-rw-r--r--test/CodeGen/weak-global.c2
-rw-r--r--test/CodeGen/weak-incomplete.c2
-rw-r--r--test/CodeGen/whilestmt.c2
-rw-r--r--test/CodeGen/writable-strings.c2
-rw-r--r--test/CodeGen/x86.c2
-rw-r--r--test/CodeGen/x86_32-arguments.c2
-rw-r--r--test/CodeGen/x86_64-arguments.c2
-rw-r--r--test/CodeGenCXX/PR4827-cast.cpp2
-rw-r--r--test/CodeGenCXX/PR4890-debug-info-dtor.cpp2
-rw-r--r--test/CodeGenCXX/PR4983-constructor-conversion.cpp2
-rw-r--r--test/CodeGenCXX/PR5050-constructor-conversion.cpp6
-rw-r--r--test/CodeGenCXX/PR5093-static-member-function.cpp2
-rw-r--r--test/CodeGenCXX/PR5834-constructor-conversion.cpp14
-rw-r--r--test/CodeGenCXX/__null.cpp2
-rw-r--r--test/CodeGenCXX/address-of-fntemplate.cpp2
-rw-r--r--test/CodeGenCXX/anonymous-namespaces.cpp2
-rw-r--r--test/CodeGenCXX/anonymous-union-member-initializer.cpp2
-rw-r--r--test/CodeGenCXX/array-construction.cpp6
-rw-r--r--test/CodeGenCXX/array-operator-delete-call.cpp6
-rw-r--r--test/CodeGenCXX/array-pointer-decay.cpp2
-rw-r--r--test/CodeGenCXX/array-value-initialize.cpp2
-rw-r--r--test/CodeGenCXX/assign-operator.cpp2
-rw-r--r--test/CodeGenCXX/attr.cpp2
-rw-r--r--test/CodeGenCXX/call-arg-zero-temp.cpp6
-rw-r--r--test/CodeGenCXX/cast-conversion.cpp16
-rw-r--r--test/CodeGenCXX/casts.cpp8
-rw-r--r--test/CodeGenCXX/class-layout.cpp6
-rw-r--r--test/CodeGenCXX/condition.cpp2
-rw-r--r--test/CodeGenCXX/conditional-expr-lvalue.cpp2
-rw-r--r--test/CodeGenCXX/conditional-temporaries.cpp2
-rw-r--r--test/CodeGenCXX/const-base-cast.cpp11
-rw-r--r--test/CodeGenCXX/const-global-linkage.cpp2
-rw-r--r--test/CodeGenCXX/const-init.cpp2
-rw-r--r--test/CodeGenCXX/constructor-conversion.cpp10
-rw-r--r--test/CodeGenCXX/constructor-convert.cpp2
-rw-r--r--test/CodeGenCXX/constructor-default-arg.cpp10
-rw-r--r--test/CodeGenCXX/constructor-for-array-members.cpp6
-rw-r--r--test/CodeGenCXX/constructor-init-reference.cpp2
-rw-r--r--test/CodeGenCXX/constructor-init.cpp23
-rw-r--r--test/CodeGenCXX/constructor-template.cpp4
-rw-r--r--test/CodeGenCXX/conversion-function.cpp22
-rw-r--r--test/CodeGenCXX/conversion-operator-base.cpp2
-rw-r--r--test/CodeGenCXX/convert-to-fptr.cpp8
-rw-r--r--test/CodeGenCXX/copy-assign-synthesis-1.cpp4
-rw-r--r--test/CodeGenCXX/copy-assign-synthesis-2.cpp2
-rw-r--r--test/CodeGenCXX/copy-assign-synthesis-3.cpp2
-rw-r--r--test/CodeGenCXX/copy-assign-synthesis.cpp2
-rw-r--r--test/CodeGenCXX/copy-constructor-elim-2.cpp7
-rw-r--r--test/CodeGenCXX/copy-constructor-elim.cpp2
-rw-r--r--test/CodeGenCXX/copy-constructor-synthesis-2.cpp2
-rw-r--r--test/CodeGenCXX/copy-constructor-synthesis.cpp4
-rw-r--r--test/CodeGenCXX/debug-info.cpp2
-rw-r--r--test/CodeGenCXX/decl-ref-init.cpp8
-rw-r--r--test/CodeGenCXX/default-arg-temps.cpp2
-rw-r--r--test/CodeGenCXX/default-arguments.cpp2
-rw-r--r--test/CodeGenCXX/default-constructor-default-argument.cpp2
-rw-r--r--test/CodeGenCXX/default-constructor-for-members.cpp6
-rw-r--r--test/CodeGenCXX/default-constructor-template-member.cpp2
-rw-r--r--test/CodeGenCXX/default-destructor-synthesis.cpp8
-rw-r--r--test/CodeGenCXX/delete-two-arg.cpp2
-rw-r--r--test/CodeGenCXX/delete.cpp2
-rw-r--r--test/CodeGenCXX/derived-to-base-conv.cpp12
-rw-r--r--test/CodeGenCXX/derived-to-base.cpp2
-rw-r--r--test/CodeGenCXX/destructor-calls.cpp2
-rw-r--r--test/CodeGenCXX/destructors.cpp2
-rw-r--r--test/CodeGenCXX/devirtualize-virtual-function-calls.cpp2
-rw-r--r--test/CodeGenCXX/dynamic-cast.cpp8
-rw-r--r--test/CodeGenCXX/dyncast.cpp4
-rw-r--r--test/CodeGenCXX/eh.cpp2
-rw-r--r--test/CodeGenCXX/elide-call-reference.cpp2
-rw-r--r--test/CodeGenCXX/empty-union.cpp2
-rw-r--r--test/CodeGenCXX/enum.cpp2
-rw-r--r--test/CodeGenCXX/eval-recursive-constant.cpp2
-rw-r--r--test/CodeGenCXX/exceptions.cpp2
-rw-r--r--test/CodeGenCXX/explicit-instantiation.cpp2
-rw-r--r--test/CodeGenCXX/expr.cpp2
-rw-r--r--test/CodeGenCXX/extern-c.cpp2
-rw-r--r--test/CodeGenCXX/function-template-explicit-specialization.cpp2
-rw-r--r--test/CodeGenCXX/function-template-specialization.cpp2
-rw-r--r--test/CodeGenCXX/global-array-destruction.cpp18
-rw-r--r--test/CodeGenCXX/global-init.cpp2
-rw-r--r--test/CodeGenCXX/global-llvm-constant.cpp2
-rw-r--r--test/CodeGenCXX/implicit-instantiation-1.cpp2
-rw-r--r--test/CodeGenCXX/init-incomplete-type.cpp2
-rw-r--r--test/CodeGenCXX/inline-functions.cpp2
-rw-r--r--test/CodeGenCXX/instantiate-init-list.cpp2
-rw-r--r--test/CodeGenCXX/key-function-vtable.cpp2
-rw-r--r--test/CodeGenCXX/mangle-extern-local.cpp2
-rw-r--r--test/CodeGenCXX/mangle-extreme.cpp2
-rw-r--r--test/CodeGenCXX/mangle-subst-std.cpp2
-rw-r--r--test/CodeGenCXX/mangle-subst.cpp2
-rw-r--r--test/CodeGenCXX/mangle-system-header.cpp2
-rw-r--r--test/CodeGenCXX/mangle-template.cpp2
-rw-r--r--test/CodeGenCXX/mangle-unnamed.cpp2
-rw-r--r--test/CodeGenCXX/mangle.cpp57
-rw-r--r--test/CodeGenCXX/member-call-parens.cpp2
-rw-r--r--test/CodeGenCXX/member-expressions.cpp2
-rw-r--r--test/CodeGenCXX/member-function-pointers.cpp2
-rw-r--r--test/CodeGenCXX/member-functions.cpp4
-rw-r--r--test/CodeGenCXX/member-init-struct.cpp2
-rw-r--r--test/CodeGenCXX/member-init-union.cpp2
-rw-r--r--test/CodeGenCXX/member-pointer-cast.cpp2
-rw-r--r--test/CodeGenCXX/member-pointer-type-convert.cpp2
-rw-r--r--test/CodeGenCXX/member-pointers-zero-init.cpp2
-rw-r--r--test/CodeGenCXX/member-templates.cpp2
-rw-r--r--test/CodeGenCXX/namespace-aliases.cpp2
-rw-r--r--test/CodeGenCXX/nested-base-member-access.cpp2
-rw-r--r--test/CodeGenCXX/new-operator-phi.cpp2
-rw-r--r--test/CodeGenCXX/new-with-default-arg.cpp2
-rw-r--r--test/CodeGenCXX/new.cpp8
-rw-r--r--test/CodeGenCXX/nullptr.cpp2
-rw-r--r--test/CodeGenCXX/operator-new.cpp16
-rw-r--r--test/CodeGenCXX/overload-binop-implicitconvert.cpp2
-rw-r--r--test/CodeGenCXX/predefined-expr-sizeof.cpp2
-rw-r--r--test/CodeGenCXX/predefined-expr.cpp143
-rw-r--r--test/CodeGenCXX/ptr-to-datamember.cpp2
-rw-r--r--test/CodeGenCXX/ptr-to-member-function.cpp8
-rw-r--r--test/CodeGenCXX/reference-bind-default-argument.cpp6
-rw-r--r--test/CodeGenCXX/reference-field.cpp2
-rw-r--r--test/CodeGenCXX/reference-init.cpp2
-rw-r--r--test/CodeGenCXX/references.cpp2
-rw-r--r--test/CodeGenCXX/reinterpret-cast.cpp4
-rw-r--r--test/CodeGenCXX/rtti-layout.cpp191
-rw-r--r--test/CodeGenCXX/rtti-linkage.cpp89
-rw-r--r--test/CodeGenCXX/rtti.cpp205
-rw-r--r--test/CodeGenCXX/static-assert.cpp2
-rw-r--r--test/CodeGenCXX/static-data-member.cpp2
-rw-r--r--test/CodeGenCXX/static-init-1.cpp2
-rw-r--r--test/CodeGenCXX/static-init-2.cpp2
-rw-r--r--test/CodeGenCXX/static-init.cpp4
-rw-r--r--test/CodeGenCXX/static-member-variable-explicit-specialization.cpp2
-rw-r--r--test/CodeGenCXX/temp-order.cpp2
-rw-r--r--test/CodeGenCXX/template-anonymous-union-member-initializer.cpp2
-rw-r--r--test/CodeGenCXX/template-linkage.cpp2
-rw-r--r--test/CodeGenCXX/temporaries.cpp51
-rw-r--r--test/CodeGenCXX/throw-expressions.cpp2
-rw-r--r--test/CodeGenCXX/trivial-constructor-init.cpp4
-rw-r--r--test/CodeGenCXX/try-catch.cpp13
-rw-r--r--test/CodeGenCXX/unary-type-trait.cpp2
-rw-r--r--test/CodeGenCXX/value-init.cpp25
-rw-r--r--test/CodeGenCXX/vararg-conversion-ctor.cpp2
-rw-r--r--test/CodeGenCXX/virt-call-offsets.cpp2
-rw-r--r--test/CodeGenCXX/virt-canonical-decl.cpp2
-rw-r--r--test/CodeGenCXX/virt-dtor-gen.cpp2
-rw-r--r--test/CodeGenCXX/virt-dtor-key.cpp2
-rw-r--r--test/CodeGenCXX/virt-template-vtable.cpp2
-rw-r--r--test/CodeGenCXX/virt-thunk-reference.cpp2
-rw-r--r--test/CodeGenCXX/virt.cpp16
-rw-r--r--test/CodeGenCXX/virtual-base-cast.cpp2
-rw-r--r--test/CodeGenCXX/virtual-base-ctor.cpp11
-rw-r--r--test/CodeGenCXX/virtual-base-destructor-call.cpp2
-rw-r--r--test/CodeGenCXX/virtual-bases.cpp2
-rw-r--r--test/CodeGenCXX/virtual-destructor-calls.cpp2
-rw-r--r--test/CodeGenCXX/virtual-destructor-synthesis.cpp2
-rw-r--r--test/CodeGenCXX/virtual-function-calls.cpp10
-rw-r--r--test/CodeGenCXX/virtual-functions-incomplete-types.cpp2
-rw-r--r--test/CodeGenCXX/virtual-implicit-copy-assignment.cpp2
-rw-r--r--test/CodeGenCXX/virtual-inherited-destructor.cpp2
-rw-r--r--test/CodeGenCXX/virtual-operator-call.cpp2
-rw-r--r--test/CodeGenCXX/virtual-pseudo-destructor-call.cpp2
-rw-r--r--test/CodeGenCXX/vtable-cast-crash.cpp2
-rw-r--r--test/CodeGenCXX/vtable-key-function.cpp2
-rw-r--r--test/CodeGenCXX/vtable-linkage.cpp2
-rw-r--r--test/CodeGenCXX/x86_64-arguments.cpp7
-rw-r--r--test/CodeGenObjC/2008-10-23-invalid-icmp.m2
-rw-r--r--test/CodeGenObjC/PR4541.m2
-rw-r--r--test/CodeGenObjC/PR4894-recursive-debug-crash.m2
-rw-r--r--test/CodeGenObjC/attr-strong.c2
-rw-r--r--test/CodeGenObjC/bitfield-1.m6
-rw-r--r--test/CodeGenObjC/bitfield-ivar-metadata.m2
-rw-r--r--test/CodeGenObjC/bitfield-ivar-offsets.m2
-rw-r--r--test/CodeGenObjC/blocks-1.m2
-rw-r--r--test/CodeGenObjC/blocks-2.m2
-rw-r--r--test/CodeGenObjC/blocks-3.m2
-rw-r--r--test/CodeGenObjC/blocks.m2
-rw-r--r--test/CodeGenObjC/category-super-class-meth.m2
-rw-r--r--test/CodeGenObjC/class-getter-dotsyntax.m2
-rw-r--r--test/CodeGenObjC/class-type.m6
-rw-r--r--test/CodeGenObjC/compatibility-alias.m2
-rw-r--r--test/CodeGenObjC/constant-strings.m6
-rw-r--r--test/CodeGenObjC/continuation-class.m2
-rw-r--r--test/CodeGenObjC/deadcode_strip_used_var.m4
-rw-r--r--test/CodeGenObjC/debug-info-linkagename.m2
-rw-r--r--test/CodeGenObjC/dot-syntax-1.m2
-rw-r--r--test/CodeGenObjC/dot-syntax.m2
-rw-r--r--test/CodeGenObjC/encode-test-1.m2
-rw-r--r--test/CodeGenObjC/encode-test-2.m2
-rw-r--r--test/CodeGenObjC/encode-test-3.m2
-rw-r--r--test/CodeGenObjC/encode-test-4.m2
-rw-r--r--test/CodeGenObjC/encode-test-5.m2
-rw-r--r--test/CodeGenObjC/encode-test.m2
-rw-r--r--test/CodeGenObjC/for-in.m2
-rw-r--r--test/CodeGenObjC/forward-class-impl-metadata.m2
-rw-r--r--test/CodeGenObjC/hidden-visibility.m2
-rw-r--r--test/CodeGenObjC/hidden.m2
-rw-r--r--test/CodeGenObjC/id-isa-codegen.m11
-rw-r--r--test/CodeGenObjC/image-info.m2
-rw-r--r--test/CodeGenObjC/implicit-objc_msgSend.m2
-rw-r--r--test/CodeGenObjC/implicit-property.m4
-rw-r--r--test/CodeGenObjC/interface-layout-64.m2
-rw-r--r--test/CodeGenObjC/interface.m2
-rw-r--r--test/CodeGenObjC/ivar-layout-64-bitfields.m2
-rw-r--r--test/CodeGenObjC/ivar-layout-64.m2
-rw-r--r--test/CodeGenObjC/ivar-layout-no-optimize.m2
-rw-r--r--test/CodeGenObjC/ivars.m4
-rw-r--r--test/CodeGenObjC/link-errors.m4
-rw-r--r--test/CodeGenObjC/message-arrays.m2
-rw-r--r--test/CodeGenObjC/messages-2.m2
-rw-r--r--test/CodeGenObjC/messages.m6
-rw-r--r--test/CodeGenObjC/metadata-symbols-32.m2
-rw-r--r--test/CodeGenObjC/metadata-symbols-64.m2
-rw-r--r--test/CodeGenObjC/metadata_symbols.m4
-rw-r--r--test/CodeGenObjC/missing-atend-metadata.m2
-rw-r--r--test/CodeGenObjC/nested-rethrow.m2
-rw-r--r--test/CodeGenObjC/newproperty-nested-synthesis-1.m2
-rw-r--r--test/CodeGenObjC/no-category-class.m2
-rw-r--r--test/CodeGenObjC/non-lazy-classes.m2
-rw-r--r--test/CodeGenObjC/objc-align.m4
-rw-r--r--test/CodeGenObjC/objc-assign-ivar.m2
-rw-r--r--test/CodeGenObjC/objc-gc-aggr-assign.m2
-rw-r--r--test/CodeGenObjC/objc-read-weak-byref.m8
-rw-r--r--test/CodeGenObjC/objc2-assign-global.m2
-rw-r--r--test/CodeGenObjC/objc2-ivar-assign.m2
-rw-r--r--test/CodeGenObjC/objc2-new-gc-api-strongcast.m2
-rw-r--r--test/CodeGenObjC/objc2-no-strong-cast.m2
-rw-r--r--test/CodeGenObjC/objc2-no-write-barrier.m2
-rw-r--r--test/CodeGenObjC/objc2-property-encode.m2
-rw-r--r--test/CodeGenObjC/objc2-protocol-enc.m2
-rw-r--r--test/CodeGenObjC/objc2-retain-codegen.m2
-rw-r--r--test/CodeGenObjC/objc2-strong-cast-1.m2
-rw-r--r--test/CodeGenObjC/objc2-strong-cast.m2
-rw-r--r--test/CodeGenObjC/objc2-weak-assign.m2
-rw-r--r--test/CodeGenObjC/objc2-weak-compare.m2
-rw-r--r--test/CodeGenObjC/objc2-weak-import-attribute.m2
-rw-r--r--test/CodeGenObjC/objc2-weak-ivar-debug.m4
-rw-r--r--test/CodeGenObjC/objc2-weak-ivar.m2
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-2.m2
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-3.m2
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-4.m2
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-5.m2
-rw-r--r--test/CodeGenObjC/objc2-write-barrier.m2
-rw-r--r--test/CodeGenObjC/object-incr-decr-1.m2
-rw-r--r--test/CodeGenObjC/overloadable.m2
-rw-r--r--test/CodeGenObjC/predefined-expr.m2
-rw-r--r--test/CodeGenObjC/property-aggr-type.m2
-rw-r--r--test/CodeGenObjC/property-agrr-getter.m2
-rw-r--r--test/CodeGenObjC/property-complex.m4
-rw-r--r--test/CodeGenObjC/property-getter-dot-syntax.m2
-rw-r--r--test/CodeGenObjC/property-incr-decr-1.m2
-rw-r--r--test/CodeGenObjC/property-list-in-class.m2
-rw-r--r--test/CodeGenObjC/property-setter-attr.m2
-rw-r--r--test/CodeGenObjC/property.m2
-rw-r--r--test/CodeGenObjC/protocol-in-extended-class.m4
-rw-r--r--test/CodeGenObjC/protocol-property-synth.m2
-rw-r--r--test/CodeGenObjC/protocols-lazy.m2
-rw-r--r--test/CodeGenObjC/protocols.m2
-rw-r--r--test/CodeGenObjC/runtime-fns.m4
-rw-r--r--test/CodeGenObjC/sel-as-builtin-type.m2
-rw-r--r--test/CodeGenObjC/super-classmethod-category.m2
-rw-r--r--test/CodeGenObjC/super-dotsyntax-property.m2
-rw-r--r--test/CodeGenObjC/super-message-fragileabi.m2
-rw-r--r--test/CodeGenObjC/synchronized.m2
-rw-r--r--test/CodeGenObjC/synthesize_ivar-cont-class.m2
-rw-r--r--test/CodeGenObjC/synthesize_ivar.m2
-rw-r--r--test/CodeGenObjC/try.m4
-rw-r--r--test/CodeGenObjC/undefined-protocol.m2
-rw-r--r--test/CodeGenObjC/unname-bf-metadata.m2
-rw-r--r--test/CodeGenObjC/variadic-sends.m4
-rw-r--r--test/CodeGenObjC/x86_64-struct-return-gc.m31
-rw-r--r--test/CodeGenObjCXX/mangle.mm2
-rw-r--r--test/Coverage/ast-printing.c8
-rw-r--r--test/Coverage/ast-printing.cpp8
-rw-r--r--test/Coverage/ast-printing.m6
-rw-r--r--test/Coverage/codegen-gnu.m2
-rw-r--r--test/Coverage/codegen-next.m4
-rw-r--r--test/Coverage/codegen.c10
-rw-r--r--test/Coverage/html-diagnostics.c2
-rw-r--r--test/Coverage/html-print.c2
-rw-r--r--test/Coverage/parse-callbacks.c4
-rw-r--r--test/Coverage/parse-callbacks.m4
-rw-r--r--test/Coverage/targets.c38
-rw-r--r--test/Coverage/verbose.c2
-rw-r--r--test/Driver/Xarch.c6
-rw-r--r--test/Driver/analyze.c2
-rw-r--r--test/Driver/arm-darwin-builtin.c2
-rw-r--r--test/Driver/ast.c4
-rw-r--r--test/Driver/bindings.c30
-rw-r--r--test/Driver/ccc-add-args.c2
-rw-r--r--test/Driver/clang-translation.c16
-rw-r--r--test/Driver/clang_cpp.c2
-rw-r--r--test/Driver/clang_f_opts.c6
-rw-r--r--test/Driver/cxx-pth.cpp4
-rw-r--r--test/Driver/darwin-arm.c2
-rw-r--r--test/Driver/darwin-as.c4
-rw-r--r--test/Driver/darwin-cc.c2
-rw-r--r--test/Driver/darwin-debug-flags.c11
-rw-r--r--test/Driver/darwin-ld.c20
-rw-r--r--test/Driver/darwin-version.c2
-rw-r--r--test/Driver/default-toolchain.c6
-rw-r--r--test/Driver/dragonfly.c2
-rw-r--r--test/Driver/emit-llvm.c12
-rw-r--r--test/Driver/flags.c6
-rw-r--r--test/Driver/freebsd.c2
-rw-r--r--test/Driver/hello.c2
-rw-r--r--test/Driver/immediate-options.c8
-rw-r--r--test/Driver/lto.c10
-rw-r--r--test/Driver/openbsd.c2
-rw-r--r--test/Driver/parsing.c8
-rw-r--r--test/Driver/phases.c22
-rw-r--r--test/Driver/preprocessor.c2
-rw-r--r--test/Driver/pth.c4
-rw-r--r--test/Driver/qa_override.c2
-rw-r--r--test/Driver/redzone.c4
-rw-r--r--test/Driver/std.c6
-rw-r--r--test/Driver/unknown-gcc-arch.c8
-rw-r--r--test/Driver/x86_features.c2
-rw-r--r--test/FixIt/fixit-at.c2
-rw-r--r--test/FixIt/fixit-c90.c2
-rw-r--r--test/FixIt/fixit-cxx0x.cpp2
-rw-r--r--test/FixIt/fixit-errors-1.c2
-rw-r--r--test/FixIt/fixit-errors.c2
-rw-r--r--test/FixIt/fixit-objc.m4
-rw-r--r--test/FixIt/fixit-pmem.cpp2
-rw-r--r--test/FixIt/fixit.c4
-rw-r--r--test/FixIt/fixit.cpp2
-rw-r--r--test/FixIt/typo.c22
-rw-r--r--test/FixIt/typo.cpp43
-rw-r--r--test/FixIt/typo.m9
-rw-r--r--test/Frontend/ast-codegen.c4
-rw-r--r--test/Frontend/ast-main.c6
-rw-r--r--test/Frontend/cpp-output.c4
-rw-r--r--test/Frontend/darwin-version.c18
-rw-r--r--test/Frontend/dependency-gen.c4
-rw-r--r--test/Frontend/output-failures.c2
-rw-r--r--test/Frontend/rewrite-macros.c2
-rw-r--r--test/Frontend/stdin.c2
-rw-r--r--test/Index/TestClassDecl.m2
-rw-r--r--test/Index/TestClassForwardDecl.m2
-rw-r--r--test/Index/c-index-api-fn-scan.m2
-rw-r--r--test/Index/c-index-api-loadTU-test.m2
-rw-r--r--test/Index/c-index-getCursor-test.m2
-rw-r--r--test/Index/c-index-pch.c4
-rw-r--r--test/Index/cindex-from-source.m2
-rw-r--r--test/Index/code-completion.cpp28
-rw-r--r--test/Index/comments.c2
-rw-r--r--test/Index/complete-member-access.m8
-rw-r--r--test/Index/complete-objc-message.m56
-rw-r--r--test/Index/complete-properties.m26
-rw-r--r--test/Index/complete-property-getset.m24
-rw-r--r--test/Index/cxx-operator-overload.cpp2
-rw-r--r--test/Index/find-decls.c4
-rw-r--r--test/Index/find-defs.c4
-rw-r--r--test/Index/find-refs.c4
-rw-r--r--test/Index/multiple-redecls.c2
-rw-r--r--test/Index/objc-decls.m4
-rw-r--r--test/Index/objc-message.m4
-rw-r--r--test/Index/recover-bad-code-rdar_7487294.c14
-rw-r--r--test/Index/remap-complete.c2
-rw-r--r--test/Index/resolve-loc.c2
-rw-r--r--test/Lexer/11-27-2007-FloatLiterals.c2
-rw-r--r--test/Lexer/badstring_in_if0.c2
-rw-r--r--test/Lexer/block_cmt_end.c10
-rw-r--r--test/Lexer/c90.c2
-rw-r--r--test/Lexer/char-escapes.c2
-rw-r--r--test/Lexer/comment-escape.c2
-rw-r--r--test/Lexer/constants-ms.c2
-rw-r--r--test/Lexer/constants.c24
-rw-r--r--test/Lexer/counter.c2
-rw-r--r--test/Lexer/cxx0x_keyword.cpp2
-rw-r--r--test/Lexer/cxx0x_keyword_as_cxx98.cpp2
-rw-r--r--test/Lexer/digraph.c2
-rw-r--r--test/Lexer/dollar-idents.c4
-rw-r--r--test/Lexer/escape_newline.c6
-rw-r--r--test/Lexer/has_feature_exceptions.cpp4
-rw-r--r--test/Lexer/has_feature_rtti.cpp4
-rw-r--r--test/Lexer/msdos-cpm-eof.c6
-rw-r--r--test/Lexer/multiple-include.c2
-rw-r--r--test/Lexer/numeric-literal-trash.c2
-rw-r--r--test/Lexer/pragma-mark.c2
-rw-r--r--test/Lexer/rdr-6096838-2.c2
-rw-r--r--test/Lexer/rdr-6096838.c4
-rw-r--r--test/Lexer/token-concat-2.c2
-rw-r--r--test/Lexer/token-concat.c2
-rw-r--r--test/Lexer/unknown-char.c2
-rw-r--r--test/Misc/caret-diags-macros.c2
-rw-r--r--test/Misc/caret-diags-scratch-buffer.c2
-rw-r--r--test/Misc/diag-mapping.c18
-rw-r--r--test/Misc/diag-mapping2.c14
-rw-r--r--test/Misc/emit-html-insert.c2
-rw-r--r--test/Misc/emit-html.c2
-rw-r--r--test/Misc/message-length.c4
-rw-r--r--test/Misc/predefines.c2
-rw-r--r--test/Misc/remap-file.c6
-rw-r--r--test/PCH/asm.c6
-rw-r--r--test/PCH/attrs.c6
-rw-r--r--test/PCH/blocks.c6
-rw-r--r--test/PCH/builtins.c6
-rw-r--r--test/PCH/cxx-method.cpp2
-rw-r--r--test/PCH/enum.c6
-rw-r--r--test/PCH/exprs.c6
-rw-r--r--test/PCH/ext_vector.c6
-rw-r--r--test/PCH/external-defs.c4
-rw-r--r--test/PCH/functions.c11
-rw-r--r--test/PCH/functions.h2
-rw-r--r--test/PCH/fuzzy-pch.c8
-rw-r--r--test/PCH/line-directive.c6
-rw-r--r--test/PCH/method_pool.m6
-rw-r--r--test/PCH/multiple_decls.c6
-rw-r--r--test/PCH/nonvisible-external-defs.c6
-rw-r--r--test/PCH/objc_exprs.m6
-rw-r--r--test/PCH/objc_import.m6
-rw-r--r--test/PCH/objc_methods.m6
-rw-r--r--test/PCH/objc_property.m6
-rw-r--r--test/PCH/pr4489.c4
-rw-r--r--test/PCH/preprocess.c6
-rw-r--r--test/PCH/reloc.c6
-rw-r--r--test/PCH/source-manager-stack.c6
-rw-r--r--test/PCH/stmts.c6
-rw-r--r--test/PCH/struct.c6
-rw-r--r--test/PCH/tentative-defs.c4
-rw-r--r--test/PCH/types.c6
-rw-r--r--test/PCH/va_arg.c6
-rw-r--r--test/PCH/variables.c6
-rw-r--r--test/PCH/variables.h2
-rwxr-xr-xtest/Parser/2008-10-31-parse-noop-failure.c2
-rw-r--r--test/Parser/CompoundStmtScope.c2
-rw-r--r--test/Parser/MicrosoftExtensions.c8
-rw-r--r--test/Parser/argument_qualified.c2
-rw-r--r--test/Parser/argument_redef.c2
-rw-r--r--test/Parser/argument_scope.c2
-rw-r--r--test/Parser/asm.c2
-rw-r--r--test/Parser/attributes.c2
-rw-r--r--test/Parser/bad-control.c2
-rw-r--r--test/Parser/block-block-storageclass.c2
-rw-r--r--test/Parser/block-pointer-decl.c2
-rw-r--r--test/Parser/builtin_classify_type.c2
-rw-r--r--test/Parser/builtin_types_compatible.c2
-rw-r--r--test/Parser/c-namespace.c2
-rw-r--r--test/Parser/char-literal-printing.c2
-rw-r--r--test/Parser/check-objc2-syntax-1.m2
-rw-r--r--test/Parser/check-syntax-1.m2
-rw-r--r--test/Parser/check_cast.c2
-rw-r--r--test/Parser/compound_literal.c2
-rw-r--r--test/Parser/control-scope.c4
-rw-r--r--test/Parser/cxx-ambig-paren-expr.cpp42
-rw-r--r--test/Parser/cxx-attributes.cpp2
-rw-r--r--test/Parser/cxx-bool.cpp2
-rw-r--r--test/Parser/cxx-casting.cpp2
-rw-r--r--test/Parser/cxx-class.cpp2
-rw-r--r--test/Parser/cxx-condition.cpp2
-rw-r--r--test/Parser/cxx-decl.cpp4
-rw-r--r--test/Parser/cxx-exception-spec.cpp2
-rw-r--r--test/Parser/cxx-extern-c-array.cpp2
-rw-r--r--test/Parser/cxx-friend.cpp2
-rw-r--r--test/Parser/cxx-member-initializers.cpp2
-rw-r--r--test/Parser/cxx-namespace-alias.cpp2
-rw-r--r--test/Parser/cxx-reference.cpp2
-rw-r--r--test/Parser/cxx-stmt.cpp10
-rw-r--r--test/Parser/cxx-template-argument.cpp9
-rw-r--r--test/Parser/cxx-template-decl.cpp2
-rw-r--r--test/Parser/cxx-throw.cpp2
-rw-r--r--test/Parser/cxx-typeid.cpp2
-rw-r--r--test/Parser/cxx-typeof.cpp2
-rw-r--r--test/Parser/cxx-using-declaration.cpp2
-rw-r--r--test/Parser/cxx-using-directive.cpp2
-rw-r--r--test/Parser/cxx-variadic-func.cpp2
-rw-r--r--test/Parser/cxx0x-attributes.cpp2
-rw-r--r--test/Parser/cxx0x-literal-operators.cpp2
-rw-r--r--test/Parser/cxx0x-rvalue-reference.cpp2
-rw-r--r--test/Parser/declarators.c2
-rw-r--r--test/Parser/designator.c2
-rw-r--r--test/Parser/encode.m2
-rw-r--r--test/Parser/enhanced-proto-1.m2
-rw-r--r--test/Parser/expressions.c2
-rw-r--r--test/Parser/expressions.m2
-rw-r--r--test/Parser/extension.c2
-rw-r--r--test/Parser/function-decls.c2
-rw-r--r--test/Parser/goto-ident.c2
-rw-r--r--test/Parser/if-scope-c90.c2
-rw-r--r--test/Parser/if-scope-c99.c2
-rw-r--r--test/Parser/implicit-casts.c2
-rw-r--r--test/Parser/method-prototype-1.m2
-rw-r--r--test/Parser/namelookup-bug-1.c2
-rw-r--r--test/Parser/namelookup-bug-2.c2
-rw-r--r--test/Parser/namespace-alias-attr.cpp2
-rw-r--r--test/Parser/objc-alias-printing.m2
-rw-r--r--test/Parser/objc-category-neg-1.m2
-rw-r--r--test/Parser/objc-forcollection-1.m2
-rw-r--r--test/Parser/objc-forcollection-neg-2.m2
-rw-r--r--test/Parser/objc-forcollection-neg.m2
-rw-r--r--test/Parser/objc-foreach-syntax.m2
-rw-r--r--test/Parser/objc-init.m2
-rw-r--r--test/Parser/objc-interfaces.m2
-rw-r--r--test/Parser/objc-messaging-1.m2
-rw-r--r--test/Parser/objc-messaging-neg-1.m2
-rw-r--r--test/Parser/objc-missing-impl.m2
-rw-r--r--test/Parser/objc-property-syntax.m2
-rw-r--r--test/Parser/objc-quirks.m2
-rw-r--r--test/Parser/objc-synthesized-recover.m2
-rw-r--r--test/Parser/objc-try-catch-1.m4
-rw-r--r--test/Parser/objc-type-printing.m2
-rw-r--r--test/Parser/offsetof.c2
-rw-r--r--test/Parser/parmvardecl_conversion.c2
-rw-r--r--test/Parser/pointer-arithmetic.c2
-rw-r--r--test/Parser/pointer_promotion.c2
-rw-r--r--test/Parser/pragma-pack.c2
-rw-r--r--test/Parser/pragma-weak.c2
-rw-r--r--test/Parser/prefix-attributes.m2
-rw-r--r--test/Parser/promote_types_in_proto.c2
-rw-r--r--test/Parser/recovery.c2
-rw-r--r--test/Parser/selector-1.m2
-rw-r--r--test/Parser/statements.c2
-rw-r--r--test/Parser/struct-recursion.c2
-rw-r--r--test/Parser/top-level-semi-cxx0x.cpp2
-rw-r--r--test/Parser/traditional_arg_scope.c2
-rw-r--r--test/Parser/typeof.c2
-rw-r--r--test/Parser/types.c2
-rw-r--r--test/Preprocessor/_Pragma-dependency.c4
-rw-r--r--test/Preprocessor/_Pragma-dependency2.c2
-rw-r--r--test/Preprocessor/_Pragma-location.c2
-rw-r--r--test/Preprocessor/_Pragma-physloc.c4
-rw-r--r--test/Preprocessor/_Pragma.c2
-rw-r--r--test/Preprocessor/assembler-with-cpp.c4
-rw-r--r--test/Preprocessor/builtin_line.c4
-rw-r--r--test/Preprocessor/c90.c2
-rw-r--r--test/Preprocessor/c99-6_10_3_3_p4.c2
-rw-r--r--test/Preprocessor/c99-6_10_3_4_p5.c2
-rw-r--r--test/Preprocessor/c99-6_10_3_4_p6.c2
-rw-r--r--test/Preprocessor/c99-6_10_3_4_p7.c2
-rw-r--r--test/Preprocessor/c99-6_10_3_4_p9.c2
-rw-r--r--test/Preprocessor/clang_headers.c2
-rw-r--r--test/Preprocessor/comment_save.c2
-rw-r--r--test/Preprocessor/comment_save_if.c2
-rw-r--r--test/Preprocessor/comment_save_macro.c6
-rw-r--r--test/Preprocessor/cxx_and.cpp8
-rw-r--r--test/Preprocessor/cxx_bitand.cpp6
-rw-r--r--test/Preprocessor/cxx_bitor.cpp10
-rw-r--r--test/Preprocessor/cxx_compl.cpp6
-rw-r--r--test/Preprocessor/cxx_not.cpp4
-rw-r--r--test/Preprocessor/cxx_not_eq.cpp6
-rw-r--r--test/Preprocessor/cxx_oper_keyword.cpp4
-rw-r--r--test/Preprocessor/cxx_oper_spelling.cpp2
-rw-r--r--test/Preprocessor/cxx_or.cpp8
-rw-r--r--test/Preprocessor/cxx_true.cpp6
-rw-r--r--test/Preprocessor/cxx_xor.cpp10
-rw-r--r--test/Preprocessor/dependencies-and-pp.c4
-rw-r--r--test/Preprocessor/disabled-cond-diags.c2
-rw-r--r--test/Preprocessor/dump-macros-spacing.c2
-rw-r--r--test/Preprocessor/dump-options.c4
-rw-r--r--test/Preprocessor/dump_macros.c2
-rw-r--r--test/Preprocessor/dumptokens_phyloc.c2
-rw-r--r--test/Preprocessor/expr_comma.c4
-rw-r--r--test/Preprocessor/expr_invalid_tok.c6
-rw-r--r--test/Preprocessor/expr_liveness.c4
-rw-r--r--test/Preprocessor/expr_multichar.c2
-rw-r--r--test/Preprocessor/expr_usual_conversions.c2
-rw-r--r--test/Preprocessor/extension-warning.c2
-rw-r--r--test/Preprocessor/feature_tests.c4
-rw-r--r--test/Preprocessor/function_macro_file.c2
-rw-r--r--test/Preprocessor/has_include.c2
-rw-r--r--test/Preprocessor/hash_line.c6
-rw-r--r--test/Preprocessor/hash_space.c2
-rw-r--r--test/Preprocessor/header_lookup1.c2
-rw-r--r--test/Preprocessor/if_warning.c4
-rw-r--r--test/Preprocessor/ifdef-recover.c2
-rw-r--r--test/Preprocessor/import_self.c2
-rw-r--r--test/Preprocessor/include-directive1.c2
-rw-r--r--test/Preprocessor/include-directive2.c2
-rw-r--r--test/Preprocessor/include-directive3.c2
-rw-r--r--test/Preprocessor/include-macros.c2
-rw-r--r--test/Preprocessor/include-pth.c4
-rw-r--r--test/Preprocessor/indent_macro.c2
-rw-r--r--test/Preprocessor/init.c60
-rw-r--r--test/Preprocessor/line-directive.c6
-rw-r--r--test/Preprocessor/macro-multiline.c2
-rw-r--r--test/Preprocessor/macro_arg_keyword.c2
-rw-r--r--test/Preprocessor/macro_disable.c4
-rw-r--r--test/Preprocessor/macro_disable2.c2
-rw-r--r--test/Preprocessor/macro_disable3.c2
-rw-r--r--test/Preprocessor/macro_disable4.c2
-rw-r--r--test/Preprocessor/macro_expand.c6
-rw-r--r--test/Preprocessor/macro_expandloc.c2
-rw-r--r--test/Preprocessor/macro_expandloc2.c2
-rw-r--r--test/Preprocessor/macro_fn.c2
-rw-r--r--test/Preprocessor/macro_fn_comma_swallow.c8
-rw-r--r--test/Preprocessor/macro_fn_disable_expand.c2
-rw-r--r--test/Preprocessor/macro_fn_lparen_scan.c8
-rw-r--r--test/Preprocessor/macro_fn_lparen_scan2.c2
-rw-r--r--test/Preprocessor/macro_fn_placemarker.c2
-rw-r--r--test/Preprocessor/macro_fn_preexpand.c4
-rw-r--r--test/Preprocessor/macro_fn_varargs_iso.c6
-rw-r--r--test/Preprocessor/macro_fn_varargs_named.c6
-rw-r--r--test/Preprocessor/macro_misc.c2
-rw-r--r--test/Preprocessor/macro_not_define.c2
-rw-r--r--test/Preprocessor/macro_paste_bad.c2
-rw-r--r--test/Preprocessor/macro_paste_bcpl_comment.c2
-rw-r--r--test/Preprocessor/macro_paste_c_block_comment.c6
-rw-r--r--test/Preprocessor/macro_paste_commaext.c10
-rw-r--r--test/Preprocessor/macro_paste_empty.c6
-rw-r--r--test/Preprocessor/macro_paste_hard.c6
-rw-r--r--test/Preprocessor/macro_paste_hashhash.c2
-rw-r--r--test/Preprocessor/macro_paste_mscomment.c2
-rw-r--r--test/Preprocessor/macro_paste_none.c2
-rw-r--r--test/Preprocessor/macro_paste_simple.c2
-rw-r--r--test/Preprocessor/macro_paste_spacing.c2
-rw-r--r--test/Preprocessor/macro_paste_spacing2.c2
-rw-r--r--test/Preprocessor/macro_rescan.c4
-rw-r--r--test/Preprocessor/macro_rescan2.c4
-rw-r--r--test/Preprocessor/macro_rescan_varargs.c2
-rw-r--r--test/Preprocessor/macro_rparen_scan.c2
-rw-r--r--test/Preprocessor/macro_rparen_scan2.c2
-rw-r--r--test/Preprocessor/macro_space.c2
-rw-r--r--test/Preprocessor/macro_undef.c2
-rw-r--r--test/Preprocessor/mi_opt.c2
-rw-r--r--test/Preprocessor/non_fragile_feature.m2
-rw-r--r--test/Preprocessor/non_fragile_feature1.m2
-rw-r--r--test/Preprocessor/objc-pp.m2
-rw-r--r--test/Preprocessor/optimize.c6
-rw-r--r--test/Preprocessor/output_paste_avoid.c2
-rw-r--r--test/Preprocessor/overflow.c2
-rw-r--r--test/Preprocessor/pic.c6
-rw-r--r--test/Preprocessor/pr2086.c2
-rw-r--r--test/Preprocessor/pragma_diagnostic.c33
-rw-r--r--test/Preprocessor/pragma_microsoft.c2
-rw-r--r--test/Preprocessor/pragma_poison.c2
-rw-r--r--test/Preprocessor/pragma_sysheader.c2
-rw-r--r--test/Preprocessor/pragma_unknown.c4
-rw-r--r--test/Preprocessor/print_line_count.c2
-rw-r--r--test/Preprocessor/print_line_track.c10
-rw-r--r--test/Preprocessor/pushable-diagnostics.c2
-rw-r--r--test/Preprocessor/skipping_unclean.c2
-rw-r--r--test/Preprocessor/stdint.c24
-rw-r--r--test/Preprocessor/stringize_misc.c2
-rw-r--r--test/Preprocessor/stringize_space.c2
-rw-r--r--test/Preprocessor/stringize_space2.c2
-rw-r--r--test/Preprocessor/undef-error.c2
-rw-r--r--test/Preprocessor/unterminated.c2
-rw-r--r--test/Preprocessor/x86_target_features.c6
-rw-r--r--test/Rewriter/block-test.c38
-rw-r--r--test/Rewriter/crash.m2
-rw-r--r--test/Rewriter/finally.m2
-rw-r--r--test/Rewriter/id-test-3.m2
-rw-r--r--test/Rewriter/ivar-encoding-1.m2
-rw-r--r--test/Rewriter/ivar-encoding-2.m2
-rw-r--r--test/Rewriter/metadata-test-1.m2
-rw-r--r--test/Rewriter/metadata-test-2.m2
-rw-r--r--test/Rewriter/method-encoding-1.m2
-rw-r--r--test/Rewriter/objc-encoding-bug-1.m2
-rw-r--r--test/Rewriter/objc-ivar-receiver-1.m4
-rw-r--r--test/Rewriter/objc-string-concat-1.m2
-rw-r--r--test/Rewriter/objc-super-test.m2
-rw-r--r--test/Rewriter/objc-synchronized-1.m2
-rw-r--r--test/Rewriter/properties.m2
-rw-r--r--test/Rewriter/protocol-rewrite-1.m2
-rw-r--r--test/Rewriter/rewrite-api-bug.m2
-rw-r--r--test/Rewriter/rewrite-block-ivar-call.mm12
-rw-r--r--test/Rewriter/rewrite-block-literal.c80
-rw-r--r--test/Rewriter/rewrite-foreach-1.m2
-rw-r--r--test/Rewriter/rewrite-foreach-2.m2
-rw-r--r--test/Rewriter/rewrite-foreach-3.m2
-rw-r--r--test/Rewriter/rewrite-foreach-4.m2
-rw-r--r--test/Rewriter/rewrite-foreach-5.m2
-rw-r--r--test/Rewriter/rewrite-foreach-6.m2
-rw-r--r--test/Rewriter/rewrite-nest.m2
-rw-r--r--test/Rewriter/rewrite-protocol-type-1.m2
-rw-r--r--test/Rewriter/rewrite-try-catch.m2
-rw-r--r--test/Rewriter/static-type-protocol-1.m2
-rw-r--r--test/Rewriter/undecl-objc-h.m2
-rw-r--r--test/Rewriter/undeclared-method-1.m2
-rw-r--r--test/Rewriter/undef-field-reference-1.m2
-rw-r--r--test/Rewriter/va-method.m2
-rw-r--r--test/Sema/128bitint.c2
-rw-r--r--test/Sema/PR2727.c4
-rw-r--r--test/Sema/PR2728.c4
-rw-r--r--test/Sema/PR2919-builtin-types-compat-strips-crv.c2
-rw-r--r--test/Sema/PR2923.c2
-rw-r--r--test/Sema/PR2963-enum-constant.c2
-rw-r--r--test/Sema/address-constant.c2
-rw-r--r--test/Sema/address_spaces.c2
-rw-r--r--test/Sema/align-arm-apcs.c2
-rw-r--r--test/Sema/align-x86.c2
-rw-r--r--test/Sema/altivec-init.c2
-rw-r--r--test/Sema/annotate.c2
-rw-r--r--test/Sema/anonymous-struct-union.c2
-rw-r--r--test/Sema/arg-duplicate.c2
-rw-r--r--test/Sema/arg-scope-c99.c2
-rw-r--r--test/Sema/arg-scope.c2
-rw-r--r--test/Sema/array-constraint.c2
-rw-r--r--test/Sema/array-declared-as-incorrect-type.c2
-rw-r--r--test/Sema/array-init.c4
-rw-r--r--test/Sema/asm.c2
-rw-r--r--test/Sema/assign-null.c2
-rw-r--r--test/Sema/assign.c2
-rw-r--r--test/Sema/ast-print.c2
-rw-r--r--test/Sema/attr-aligned.c2
-rw-r--r--test/Sema/attr-cleanup.c2
-rw-r--r--test/Sema/attr-decl-after-definition.c2
-rw-r--r--test/Sema/attr-deprecated.c2
-rw-r--r--test/Sema/attr-format_arg.c2
-rw-r--r--test/Sema/attr-malloc.c4
-rw-r--r--test/Sema/attr-mode.c2
-rw-r--r--test/Sema/attr-nodebug.c2
-rw-r--r--test/Sema/attr-noinline.c2
-rw-r--r--test/Sema/attr-noreturn.c7
-rw-r--r--test/Sema/attr-regparm.c2
-rw-r--r--test/Sema/attr-section.c2
-rw-r--r--test/Sema/attr-unused.c2
-rw-r--r--test/Sema/attr-used.c2
-rw-r--r--test/Sema/attr-weak.c2
-rw-r--r--test/Sema/bitfield-layout.c2
-rw-r--r--test/Sema/bitfield-promote-int-16bit.c2
-rw-r--r--test/Sema/bitfield-promote.c2
-rw-r--r--test/Sema/bitfield.c2
-rw-r--r--test/Sema/block-args.c2
-rw-r--r--test/Sema/block-as-object.m2
-rw-r--r--test/Sema/block-byref-args.c2
-rw-r--r--test/Sema/block-call.c2
-rw-r--r--test/Sema/block-labels.c2
-rw-r--r--test/Sema/block-literal.c2
-rw-r--r--test/Sema/block-misc.c2
-rw-r--r--test/Sema/block-printf-attribute-1.c2
-rw-r--r--test/Sema/block-return-1.c2
-rw-r--r--test/Sema/block-return-2.c2
-rw-r--r--test/Sema/block-return-3.c2
-rw-r--r--test/Sema/block-return.c2
-rw-r--r--test/Sema/block-sentinel-attribute.c2
-rw-r--r--test/Sema/block-storageclass.c2
-rw-r--r--test/Sema/builtin-object-size.c4
-rw-r--r--test/Sema/builtin-prefetch.c2
-rw-r--r--test/Sema/builtin-stackaddress.c2
-rw-r--r--test/Sema/builtin-unary-fp.c2
-rw-r--r--test/Sema/builtins.c11
-rw-r--r--test/Sema/c89-2.c2
-rw-r--r--test/Sema/c89.c2
-rw-r--r--test/Sema/callingconv.c2
-rw-r--r--test/Sema/carbon.c2
-rw-r--r--test/Sema/cast-to-union.c2
-rw-r--r--test/Sema/cast.c2
-rw-r--r--test/Sema/check-increment.c2
-rw-r--r--test/Sema/compare.c2
-rw-r--r--test/Sema/complex-int.c2
-rw-r--r--test/Sema/complex-promotion.c2
-rw-r--r--test/Sema/compound-literal.c2
-rw-r--r--test/Sema/conditional-expr.c2
-rw-r--r--test/Sema/conditional.c2
-rw-r--r--test/Sema/const-eval.c2
-rw-r--r--test/Sema/const-ptr-int-ptr-cast.c2
-rw-r--r--test/Sema/constant-builtins-2.c2
-rw-r--r--test/Sema/constant-builtins.c2
-rw-r--r--test/Sema/constructor-attribute.c2
-rw-r--r--test/Sema/conversion-64-32.c2
-rw-r--r--test/Sema/conversion.c2
-rw-r--r--test/Sema/darwin-align-cast.c2
-rw-r--r--test/Sema/decl-invalid.c2
-rw-r--r--test/Sema/decl-type-merging.c2
-rw-r--r--test/Sema/declspec.c3
-rw-r--r--test/Sema/default.c2
-rw-r--r--test/Sema/default1.c2
-rw-r--r--test/Sema/deref.c2
-rw-r--r--test/Sema/designated-initializers.c19
-rw-r--r--test/Sema/dllimport-dllexport.c2
-rw-r--r--test/Sema/enum.c2
-rw-r--r--test/Sema/expr-address-of.c2
-rw-r--r--test/Sema/expr-comma-c89.c2
-rw-r--r--test/Sema/expr-comma.c2
-rw-r--r--test/Sema/exprs.c2
-rw-r--r--test/Sema/ext_vector_casts.c2
-rw-r--r--test/Sema/ext_vector_components.c9
-rw-r--r--test/Sema/flexible-array-init.c2
-rw-r--r--test/Sema/floating-point-compare.c2
-rw-r--r--test/Sema/for.c2
-rw-r--r--test/Sema/format-attr-pr4470.c2
-rw-r--r--test/Sema/format-attribute-printf0.c2
-rw-r--r--test/Sema/format-attribute.c2
-rw-r--r--test/Sema/format-string-percentm.c2
-rw-r--r--test/Sema/format-strings.c3
-rw-r--r--test/Sema/freemain.c2
-rw-r--r--test/Sema/function-pointer-sentinel-attribute.c2
-rw-r--r--test/Sema/function-ptr.c2
-rw-r--r--test/Sema/function-redecl.c2
-rw-r--r--test/Sema/function-sentinel-attr.c2
-rw-r--r--test/Sema/function.c2
-rw-r--r--test/Sema/gnu89.c2
-rw-r--r--test/Sema/heinous-extensions-off.c2
-rw-r--r--test/Sema/heinous-extensions-on.c2
-rw-r--r--test/Sema/i-c-e.c2
-rw-r--r--test/Sema/if-empty-body.c2
-rw-r--r--test/Sema/illegal-types.c2
-rw-r--r--test/Sema/implicit-builtin-decl.c2
-rw-r--r--test/Sema/implicit-builtin-freestanding.c2
-rw-r--r--test/Sema/implicit-builtin-redecl.c2
-rw-r--r--test/Sema/implicit-cast.c2
-rw-r--r--test/Sema/implicit-decl.c2
-rw-r--r--test/Sema/implicit-def.c4
-rw-r--r--test/Sema/implicit-int.c2
-rw-r--r--test/Sema/incompatible-sign.c2
-rw-r--r--test/Sema/incomplete-call.c2
-rw-r--r--test/Sema/incomplete-decl.c2
-rw-r--r--test/Sema/indirect-goto.c2
-rw-r--r--test/Sema/init-struct-qualified.c2
-rw-r--r--test/Sema/init-vector.c2
-rw-r--r--test/Sema/init.c4
-rw-r--r--test/Sema/inline.c2
-rw-r--r--test/Sema/int-arith-convert.c2
-rw-r--r--test/Sema/invalid-decl.c2
-rw-r--r--test/Sema/invalid-init-diag.c2
-rw-r--r--test/Sema/invalid-struct-init.c2
-rw-r--r--test/Sema/knr-def-call.c2
-rw-r--r--test/Sema/knr-variadic-def.c2
-rw-r--r--test/Sema/member-reference.c2
-rw-r--r--test/Sema/merge-decls.c2
-rw-r--r--test/Sema/ms-fuzzy-asm.c3
-rw-r--r--test/Sema/nested-redef.c2
-rw-r--r--test/Sema/offsetof.c2
-rw-r--r--test/Sema/overloadable-complex.c2
-rw-r--r--test/Sema/overloadable.c2
-rw-r--r--test/Sema/parentheses.c4
-rw-r--r--test/Sema/pointer-addition.c2
-rw-r--r--test/Sema/pointer-conversion.c2
-rw-r--r--test/Sema/pointer-subtract-compat.c2
-rw-r--r--test/Sema/pragma-pack-2.c2
-rw-r--r--test/Sema/pragma-pack-3.c2
-rw-r--r--test/Sema/pragma-pack-4.c4
-rw-r--r--test/Sema/pragma-pack.c2
-rw-r--r--test/Sema/pragma-unused.c2
-rw-r--r--test/Sema/predef.c2
-rw-r--r--test/Sema/predefined-function.c2
-rw-r--r--test/Sema/private-extern.c2
-rw-r--r--test/Sema/promote-int-16bit.c2
-rw-r--r--test/Sema/rdar6248119.m2
-rw-r--r--test/Sema/rdr6094103-unordered-compare-promote.c2
-rw-r--r--test/Sema/recover-goto.c2
-rw-r--r--test/Sema/redefinition.c2
-rw-r--r--test/Sema/return-noreturn.c2
-rw-r--r--test/Sema/return-silent.c2
-rw-r--r--test/Sema/return.c6
-rw-r--r--test/Sema/scope-check.c2
-rw-r--r--test/Sema/self-comparison.c2
-rw-r--r--test/Sema/sentinel-attribute.c2
-rw-r--r--test/Sema/shift.c2
-rw-r--r--test/Sema/statements.c2
-rw-r--r--test/Sema/static-init.c2
-rw-r--r--test/Sema/stdcall-fastcall.c2
-rw-r--r--test/Sema/struct-cast.c2
-rw-r--r--test/Sema/struct-compat.c2
-rw-r--r--test/Sema/struct-decl.c2
-rw-r--r--test/Sema/struct-packed-align.c2
-rw-r--r--test/Sema/surpress-deprecated.c2
-rw-r--r--test/Sema/switch.c2
-rw-r--r--test/Sema/tentative-decls.c2
-rw-r--r--test/Sema/text-diag.c2
-rw-r--r--test/Sema/thread-specifier.c2
-rw-r--r--test/Sema/transparent-union-pointer.c2
-rw-r--r--test/Sema/transparent-union.c2
-rw-r--r--test/Sema/type-spec-struct-union.c2
-rw-r--r--test/Sema/typecheck-binop.c2
-rw-r--r--test/Sema/typedef-prototype.c2
-rw-r--r--test/Sema/typedef-redef.c2
-rw-r--r--test/Sema/typedef-retain.c2
-rw-r--r--test/Sema/typedef-variable-type.c2
-rw-r--r--test/Sema/types.c2
-rw-r--r--test/Sema/ucn-cstring.c2
-rw-r--r--test/Sema/unnamed-bitfield-init.c2
-rw-r--r--test/Sema/unused-expr.c14
-rw-r--r--test/Sema/usual-float.c2
-rw-r--r--test/Sema/va_arg_x86_32.c2
-rw-r--r--test/Sema/va_arg_x86_64.c2
-rw-r--r--test/Sema/var-redecl.c5
-rw-r--r--test/Sema/varargs-x86-64.c2
-rw-r--r--test/Sema/varargs.c4
-rw-r--r--test/Sema/variadic-block.c2
-rw-r--r--test/Sema/vector-assign.c2
-rw-r--r--test/Sema/vector-cast.c2
-rw-r--r--test/Sema/vector-init.c2
-rw-r--r--test/Sema/vfprintf-invalid-redecl.c2
-rw-r--r--test/Sema/vfprintf-valid-redecl.c2
-rw-r--r--test/Sema/vla.c2
-rw-r--r--test/Sema/void_arg.c2
-rw-r--r--test/Sema/warn-char-subscripts.c2
-rw-r--r--test/Sema/warn-freestanding-complex.c2
-rw-r--r--test/Sema/warn-missing-prototypes.c2
-rw-r--r--test/Sema/warn-unused-parameters.c2
-rw-r--r--test/Sema/warn-unused-variables.c2
-rw-r--r--test/Sema/wchar.c8
-rw-r--r--test/Sema/x86-intrinsics-headers.c6
-rw-r--r--test/SemaCXX/PR5086-ambig-resolution-enum.cpp2
-rw-r--r--test/SemaCXX/__null.cpp4
-rw-r--r--test/SemaCXX/abstract.cpp16
-rw-r--r--test/SemaCXX/access-base-class.cpp11
-rw-r--r--test/SemaCXX/access-control-check.cpp2
-rw-r--r--test/SemaCXX/access.cpp13
-rw-r--r--test/SemaCXX/addr-of-overloaded-function.cpp4
-rw-r--r--test/SemaCXX/address-of.cpp2
-rw-r--r--test/SemaCXX/aggregate-initialization.cpp10
-rw-r--r--test/SemaCXX/alignof-sizeof-reference.cpp2
-rw-r--r--test/SemaCXX/ambig-user-defined-conversions.cpp2
-rw-r--r--test/SemaCXX/ambiguous-builtin-unary-operator.cpp2
-rw-r--r--test/SemaCXX/anonymous-union.cpp2
-rw-r--r--test/SemaCXX/array-bound-merge.cpp2
-rw-r--r--test/SemaCXX/arrow-operator.cpp2
-rw-r--r--test/SemaCXX/attr-after-definition.cpp2
-rw-r--r--test/SemaCXX/attr-cxx0x.cpp2
-rw-r--r--test/SemaCXX/attr-deprecated.cpp2
-rw-r--r--test/SemaCXX/attr-format.cpp2
-rw-r--r--test/SemaCXX/attr-noreturn.cpp11
-rw-r--r--test/SemaCXX/attr-sentinel.cpp2
-rw-r--r--test/SemaCXX/attr-unavailable.cpp2
-rw-r--r--test/SemaCXX/auto-cxx0x.cpp2
-rw-r--r--test/SemaCXX/auto-cxx98.cpp2
-rw-r--r--test/SemaCXX/blocks.cpp2
-rw-r--r--test/SemaCXX/bool.cpp4
-rw-r--r--test/SemaCXX/builtin-ptrtomember-ambig.cpp2
-rw-r--r--test/SemaCXX/builtin-ptrtomember-overload-1.cpp2
-rw-r--r--test/SemaCXX/builtin-ptrtomember-overload.cpp2
-rw-r--r--test/SemaCXX/builtins.cpp4
-rw-r--r--test/SemaCXX/c99.cpp2
-rw-r--r--test/SemaCXX/cast-conversion.cpp2
-rw-r--r--test/SemaCXX/cast-explicit-ctor.cpp2
-rw-r--r--test/SemaCXX/class-base-member-init.cpp2
-rw-r--r--test/SemaCXX/class-layout.cpp2
-rw-r--r--test/SemaCXX/class-names.cpp2
-rw-r--r--test/SemaCXX/class.cpp2
-rw-r--r--test/SemaCXX/compare.cpp2
-rw-r--r--test/SemaCXX/complex-overload.cpp2
-rw-r--r--test/SemaCXX/composite-pointer-type.cpp2
-rw-r--r--test/SemaCXX/condition.cpp10
-rw-r--r--test/SemaCXX/conditional-expr.cpp13
-rw-r--r--test/SemaCXX/const-cast.cpp5
-rw-r--r--test/SemaCXX/constant-expression.cpp2
-rw-r--r--test/SemaCXX/constructor-initializer.cpp2
-rw-r--r--test/SemaCXX/constructor-recovery.cpp9
-rw-r--r--test/SemaCXX/constructor.cpp2
-rw-r--r--test/SemaCXX/conversion-delete-expr.cpp2
-rw-r--r--test/SemaCXX/conversion-function.cpp26
-rw-r--r--test/SemaCXX/convert-to-bool.cpp4
-rw-r--r--test/SemaCXX/converting-constructor.cpp6
-rw-r--r--test/SemaCXX/copy-assignment.cpp2
-rw-r--r--test/SemaCXX/copy-constructor-error.cpp9
-rw-r--r--test/SemaCXX/copy-initialization.cpp8
-rw-r--r--test/SemaCXX/cstyle-cast.cpp2
-rw-r--r--test/SemaCXX/cxx-member-pointer-op.cpp2
-rw-r--r--test/SemaCXX/dcl_ambig_res.cpp2
-rw-r--r--test/SemaCXX/dcl_init_aggr.cpp17
-rw-r--r--test/SemaCXX/decl-expr-ambiguity.cpp2
-rw-r--r--test/SemaCXX/decl-init-ref.cpp6
-rw-r--r--test/SemaCXX/decltype-crash.cpp4
-rw-r--r--test/SemaCXX/decltype-overloaded-functions.cpp6
-rw-r--r--test/SemaCXX/decltype-pr4444.cpp2
-rw-r--r--test/SemaCXX/decltype-pr4448.cpp2
-rw-r--r--test/SemaCXX/decltype-this.cpp2
-rw-r--r--test/SemaCXX/default-argument-temporaries.cpp2
-rw-r--r--test/SemaCXX/default-assignment-operator.cpp2
-rw-r--r--test/SemaCXX/default-constructor-initializers.cpp2
-rw-r--r--test/SemaCXX/default1.cpp10
-rw-r--r--test/SemaCXX/default2.cpp8
-rw-r--r--test/SemaCXX/deleted-function.cpp10
-rw-r--r--test/SemaCXX/dependent-types.cpp2
-rw-r--r--test/SemaCXX/derived-to-base-ambig.cpp2
-rw-r--r--test/SemaCXX/destructor.cpp2
-rw-r--r--test/SemaCXX/direct-initializer.cpp14
-rw-r--r--test/SemaCXX/do-while-scope.cpp2
-rw-r--r--test/SemaCXX/dynamic-cast.cpp2
-rw-r--r--test/SemaCXX/elaborated-type-specifier.cpp4
-rw-r--r--test/SemaCXX/empty-class-layout.cpp2
-rw-r--r--test/SemaCXX/enum.cpp25
-rw-r--r--test/SemaCXX/exception-spec.cpp12
-rw-r--r--test/SemaCXX/exceptions.cpp2
-rw-r--r--test/SemaCXX/expressions.cpp2
-rw-r--r--test/SemaCXX/fntype-decl.cpp2
-rw-r--r--test/SemaCXX/format-attribute.cpp2
-rw-r--r--test/SemaCXX/friend-class-nodecl.cpp2
-rw-r--r--test/SemaCXX/friend.cpp34
-rw-r--r--test/SemaCXX/function-overloaded-redecl.cpp2
-rw-r--r--test/SemaCXX/function-redecl.cpp2
-rw-r--r--test/SemaCXX/function-type-qual.cpp2
-rw-r--r--test/SemaCXX/functional-cast.cpp2
-rw-r--r--test/SemaCXX/i-c-e-cxx.cpp2
-rw-r--r--test/SemaCXX/illegal-member-initialization.cpp12
-rw-r--r--test/SemaCXX/implicit-int.cpp2
-rw-r--r--test/SemaCXX/implicit-member-functions.cpp2
-rw-r--r--test/SemaCXX/implicit-virtual-member-functions.cpp2
-rw-r--r--test/SemaCXX/incomplete-call.cpp2
-rw-r--r--test/SemaCXX/inherit.cpp2
-rw-r--r--test/SemaCXX/inline.cpp2
-rw-r--r--test/SemaCXX/invalid-member-expr.cpp2
-rw-r--r--test/SemaCXX/invalid-template-specifier.cpp2
-rw-r--r--test/SemaCXX/libstdcxx_is_pod_hack.cpp2
-rw-r--r--test/SemaCXX/linkage-spec.cpp2
-rw-r--r--test/SemaCXX/literal-type.cpp2
-rw-r--r--test/SemaCXX/member-expr-anonymous-union.cpp2
-rw-r--r--test/SemaCXX/member-expr-static.cpp2
-rw-r--r--test/SemaCXX/member-expr.cpp2
-rw-r--r--test/SemaCXX/member-location.cpp4
-rw-r--r--test/SemaCXX/member-name-lookup.cpp2
-rw-r--r--test/SemaCXX/member-operator-expr.cpp2
-rw-r--r--test/SemaCXX/member-pointer-size.cpp4
-rw-r--r--test/SemaCXX/member-pointer.cpp6
-rw-r--r--test/SemaCXX/member-pointers-2.cpp2
-rw-r--r--test/SemaCXX/missing-members.cpp2
-rw-r--r--test/SemaCXX/ms-exception-spec.cpp2
-rw-r--r--test/SemaCXX/namespace-alias.cpp2
-rw-r--r--test/SemaCXX/namespace.cpp2
-rw-r--r--test/SemaCXX/nested-name-spec.cpp32
-rw-r--r--test/SemaCXX/new-delete.cpp16
-rw-r--r--test/SemaCXX/no-implicit-builtin-decls.cpp4
-rw-r--r--test/SemaCXX/nullptr.cpp4
-rw-r--r--test/SemaCXX/offsetof.cpp2
-rw-r--r--test/SemaCXX/overload-call-copycon.cpp2
-rw-r--r--test/SemaCXX/overload-call.cpp2
-rw-r--r--test/SemaCXX/overload-decl.cpp2
-rw-r--r--test/SemaCXX/overload-member-call.cpp2
-rw-r--r--test/SemaCXX/overload-value-dep-arg.cpp2
-rw-r--r--test/SemaCXX/overloaded-builtin-operators.cpp2
-rw-r--r--test/SemaCXX/overloaded-operator-decl.cpp2
-rw-r--r--test/SemaCXX/overloaded-operator.cpp2
-rw-r--r--test/SemaCXX/prefetch-enum.cpp2
-rw-r--r--test/SemaCXX/primary-base.cpp2
-rw-r--r--test/SemaCXX/pseudo-destructors.cpp2
-rw-r--r--test/SemaCXX/ptrtomember-badcall.cpp2
-rw-r--r--test/SemaCXX/ptrtomember-overload-resolution.cpp2
-rw-r--r--test/SemaCXX/qual-id-test.cpp4
-rw-r--r--test/SemaCXX/qualification-conversion.cpp13
-rw-r--r--test/SemaCXX/qualified-id-lookup.cpp2
-rw-r--r--test/SemaCXX/qualified-names-diag.cpp2
-rw-r--r--test/SemaCXX/qualified-names-print.cpp2
-rw-r--r--test/SemaCXX/ref-init-ambiguous.cpp9
-rw-r--r--test/SemaCXX/references.cpp2
-rw-r--r--test/SemaCXX/reinterpret-cast.cpp2
-rw-r--r--test/SemaCXX/reinterpret-fn-obj-pedantic.cpp2
-rw-r--r--test/SemaCXX/return-stack-addr.cpp2
-rw-r--r--test/SemaCXX/return.cpp2
-rw-r--r--test/SemaCXX/rval-references-xfail.cpp14
-rw-r--r--test/SemaCXX/rval-references.cpp16
-rw-r--r--test/SemaCXX/statements.cpp2
-rw-r--r--test/SemaCXX/static-array-member.cpp2
-rw-r--r--test/SemaCXX/static-assert.cpp2
-rw-r--r--test/SemaCXX/static-cast-complete-type.cpp2
-rw-r--r--test/SemaCXX/static-cast.cpp2
-rw-r--r--test/SemaCXX/static-initializers.cpp2
-rw-r--r--test/SemaCXX/struct-class-redecl.cpp2
-rw-r--r--test/SemaCXX/switch-0x.cpp2
-rw-r--r--test/SemaCXX/switch.cpp2
-rw-r--r--test/SemaCXX/this.cpp2
-rw-r--r--test/SemaCXX/trivial-constructor.cpp2
-rw-r--r--test/SemaCXX/trivial-destructor.cpp2
-rw-r--r--test/SemaCXX/type-convert-construct.cpp2
-rw-r--r--test/SemaCXX/type-definition-in-specifier.cpp2
-rw-r--r--test/SemaCXX/type-dependent-exprs.cpp4
-rw-r--r--test/SemaCXX/type-traits-incomplete.cpp2
-rw-r--r--test/SemaCXX/type-traits.cpp4
-rw-r--r--test/SemaCXX/typedef-redecl.cpp10
-rw-r--r--test/SemaCXX/typeid.cpp10
-rw-r--r--test/SemaCXX/types_compatible_p.cpp2
-rw-r--r--test/SemaCXX/unknown-type-name.cpp2
-rw-r--r--test/SemaCXX/unreachable-catch-clauses.cpp2
-rw-r--r--test/SemaCXX/unused.cpp2
-rw-r--r--test/SemaCXX/user-defined-conversions.cpp2
-rw-r--r--test/SemaCXX/using-decl-1.cpp20
-rw-r--r--test/SemaCXX/using-decl-pr4441.cpp2
-rw-r--r--test/SemaCXX/using-decl-pr4450.cpp2
-rw-r--r--test/SemaCXX/using-decl-templates.cpp2
-rw-r--r--test/SemaCXX/using-directive.cpp2
-rw-r--r--test/SemaCXX/value-dependent-exprs.cpp2
-rw-r--r--test/SemaCXX/value-initialization.cpp2
-rw-r--r--test/SemaCXX/vararg-default-arg.cpp2
-rw-r--r--test/SemaCXX/vararg-non-pod.cpp2
-rw-r--r--test/SemaCXX/vector-casts.cpp2
-rw-r--r--test/SemaCXX/virtual-member-functions-key-function.cpp2
-rw-r--r--test/SemaCXX/virtual-override.cpp49
-rw-r--r--test/SemaCXX/virtuals.cpp2
-rw-r--r--test/SemaCXX/warn-assignment-condition.cpp2
-rw-r--r--test/SemaCXX/warn-char-subscripts.cpp2
-rw-r--r--test/SemaCXX/warn-for-var-in-else.cpp2
-rw-r--r--test/SemaCXX/warn-missing-prototypes.cpp2
-rw-r--r--test/SemaCXX/warn-reorder-ctor-initialization.cpp2
-rw-r--r--test/SemaCXX/warn-unused-variables.cpp13
-rw-r--r--test/SemaCXX/wchar_t.cpp16
-rw-r--r--test/SemaObjC/ContClassPropertyLookup.m2
-rw-r--r--test/SemaObjC/DoubleMethod.m2
-rw-r--r--test/SemaObjC/access-property-getter.m2
-rw-r--r--test/SemaObjC/alias-test-1.m2
-rw-r--r--test/SemaObjC/alias-test-2.m2
-rw-r--r--test/SemaObjC/argument-checking.m2
-rw-r--r--test/SemaObjC/at-defs.m2
-rw-r--r--test/SemaObjC/atomoic-property-synnthesis-rules.m2
-rw-r--r--test/SemaObjC/attr-cleanup.m2
-rw-r--r--test/SemaObjC/attr-deprecated.m2
-rw-r--r--test/SemaObjC/attr-malloc.m2
-rw-r--r--test/SemaObjC/attr-objc-exception.m2
-rw-r--r--test/SemaObjC/attr-objc-gc.m2
-rw-r--r--test/SemaObjC/bad-receiver-1.m2
-rw-r--r--test/SemaObjC/block-attr.m2
-rw-r--r--test/SemaObjC/block-explicit-return-type.m2
-rw-r--r--test/SemaObjC/block-ivar.m2
-rw-r--r--test/SemaObjC/blocks.m2
-rw-r--r--test/SemaObjC/call-super-2.m2
-rw-r--r--test/SemaObjC/catch-stmt.m2
-rw-r--r--test/SemaObjC/category-1.m2
-rw-r--r--test/SemaObjC/category-method-lookup-2.m2
-rw-r--r--test/SemaObjC/category-method-lookup.m2
-rw-r--r--test/SemaObjC/check-dup-decl-methods-1.m2
-rw-r--r--test/SemaObjC/check-dup-objc-decls-1.m2
-rw-r--r--test/SemaObjC/class-bitfield.m2
-rw-r--r--test/SemaObjC/class-conforming-protocol-1.m2
-rw-r--r--test/SemaObjC/class-conforming-protocol-2.m2
-rw-r--r--test/SemaObjC/class-def-test-1.m2
-rw-r--r--test/SemaObjC/class-extension-dup-methods.m2
-rw-r--r--test/SemaObjC/class-getter-using-dotsyntax.m2
-rw-r--r--test/SemaObjC/class-impl-1.m2
-rw-r--r--test/SemaObjC/class-method-lookup.m2
-rw-r--r--test/SemaObjC/class-method-self.m2
-rw-r--r--test/SemaObjC/class-property-access.m2
-rw-r--r--test/SemaObjC/class-proto-1.m2
-rw-r--r--test/SemaObjC/class-protocol.m2
-rw-r--r--test/SemaObjC/cocoa.m2
-rw-r--r--test/SemaObjC/compare-qualified-id.m2
-rw-r--r--test/SemaObjC/compatible-protocol-qualified-types.m2
-rw-r--r--test/SemaObjC/comptypes-1.m2
-rw-r--r--test/SemaObjC/comptypes-2.m2
-rw-r--r--test/SemaObjC/comptypes-3.m2
-rw-r--r--test/SemaObjC/comptypes-4.m2
-rw-r--r--test/SemaObjC/comptypes-5.m2
-rw-r--r--test/SemaObjC/comptypes-6.m2
-rw-r--r--test/SemaObjC/comptypes-7.m2
-rw-r--r--test/SemaObjC/comptypes-8.m2
-rw-r--r--test/SemaObjC/comptypes-9.m2
-rw-r--r--test/SemaObjC/comptypes-a.m2
-rw-r--r--test/SemaObjC/comptypes-legal.m2
-rw-r--r--test/SemaObjC/conditional-expr-2.m2
-rw-r--r--test/SemaObjC/conditional-expr-3.m2
-rw-r--r--test/SemaObjC/conditional-expr-4.m2
-rw-r--r--test/SemaObjC/conditional-expr-5.m2
-rw-r--r--test/SemaObjC/conditional-expr-6.m2
-rw-r--r--test/SemaObjC/conditional-expr.m2
-rw-r--r--test/SemaObjC/conflicting-ivar-test-1.m2
-rw-r--r--test/SemaObjC/continuation-class-err.m2
-rw-r--r--test/SemaObjC/crash-label.m2
-rw-r--r--test/SemaObjC/deref-interface.m2
-rw-r--r--test/SemaObjC/duplicate-ivar-check.m2
-rw-r--r--test/SemaObjC/enhanced-proto-2.m2
-rw-r--r--test/SemaObjC/error-property-gc-attr.m2
-rw-r--r--test/SemaObjC/exprs.m2
-rw-r--r--test/SemaObjC/foreach.m2
-rw-r--r--test/SemaObjC/format-arg-attribute.m2
-rw-r--r--test/SemaObjC/format-strings-objc.m2
-rw-r--r--test/SemaObjC/forward-class-1.m2
-rw-r--r--test/SemaObjC/forward-class-receiver.m2
-rw-r--r--test/SemaObjC/gcc-cast-ext.m2
-rw-r--r--test/SemaObjC/id-isa-ref.m2
-rw-r--r--test/SemaObjC/id.m2
-rw-r--r--test/SemaObjC/id_builtin.m2
-rw-r--r--test/SemaObjC/idiomatic-parentheses.m2
-rw-r--r--test/SemaObjC/ignore-weakimport-method.m2
-rw-r--r--test/SemaObjC/incompatible-protocol-qualified-types.m2
-rw-r--r--test/SemaObjC/inst-method-lookup-in-root.m2
-rw-r--r--test/SemaObjC/interface-1.m2
-rw-r--r--test/SemaObjC/interface-layout-2.m2
-rw-r--r--test/SemaObjC/interface-layout.m2
-rw-r--r--test/SemaObjC/interface-scope-2.m2
-rw-r--r--test/SemaObjC/interface-scope.m2
-rw-r--r--test/SemaObjC/interface-tu-variable.m2
-rw-r--r--test/SemaObjC/invalid-code.m2
-rw-r--r--test/SemaObjC/invalid-objc-decls-1.m2
-rw-r--r--test/SemaObjC/invalid-receiver.m2
-rw-r--r--test/SemaObjC/invalid-typename.m2
-rw-r--r--test/SemaObjC/ivar-access-package.m2
-rw-r--r--test/SemaObjC/ivar-access-tests.m2
-rw-r--r--test/SemaObjC/ivar-lookup.m2
-rw-r--r--test/SemaObjC/ivar-ref-misuse.m2
-rw-r--r--test/SemaObjC/ivar-sem-check-1.m2
-rw-r--r--test/SemaObjC/ivar-sem-check-2.m2
-rw-r--r--test/SemaObjC/legacy-implementation-1.m2
-rw-r--r--test/SemaObjC/message.m2
-rw-r--r--test/SemaObjC/method-arg-decay.m2
-rw-r--r--test/SemaObjC/method-arg-qualifier-warning.m2
-rw-r--r--test/SemaObjC/method-attributes.m2
-rw-r--r--test/SemaObjC/method-bad-param.m2
-rw-r--r--test/SemaObjC/method-conflict.m2
-rw-r--r--test/SemaObjC/method-def-1.m2
-rw-r--r--test/SemaObjC/method-def-2.m2
-rw-r--r--test/SemaObjC/method-encoding-2.m2
-rw-r--r--test/SemaObjC/method-lookup-2.m2
-rw-r--r--test/SemaObjC/method-lookup-3.m2
-rw-r--r--test/SemaObjC/method-lookup-4.m2
-rw-r--r--test/SemaObjC/method-lookup.m2
-rw-r--r--test/SemaObjC/method-no-context.m2
-rw-r--r--test/SemaObjC/method-not-defined.m2
-rw-r--r--test/SemaObjC/method-sentinel-attr.m2
-rw-r--r--test/SemaObjC/method-typecheck-1.m2
-rw-r--r--test/SemaObjC/method-typecheck-2.m2
-rw-r--r--test/SemaObjC/method-undef-category-warn-1.m2
-rw-r--r--test/SemaObjC/method-undef-extension-warn-1.m2
-rw-r--r--test/SemaObjC/method-undefined-warn-1.m2
-rw-r--r--test/SemaObjC/missing-method-context.m2
-rw-r--r--test/SemaObjC/newproperty-class-method-1.m4
-rw-r--r--test/SemaObjC/no-gc-weak-test.m2
-rw-r--r--test/SemaObjC/no-warn-qual-mismatch.m2
-rw-r--r--test/SemaObjC/no-warn-synth-protocol-meth.m2
-rw-r--r--test/SemaObjC/no-warn-unimpl-method.m2
-rw-r--r--test/SemaObjC/nonnull.m2
-rw-r--r--test/SemaObjC/nsobject-attribute-1.m2
-rw-r--r--test/SemaObjC/nsobject-attribute.m2
-rw-r--r--test/SemaObjC/objc-string-constant.m2
-rw-r--r--test/SemaObjC/objc2-merge-gc-attribue-decl.m2
-rw-r--r--test/SemaObjC/objc2-warn-weak-decl.m2
-rw-r--r--test/SemaObjC/property-10.m2
-rw-r--r--test/SemaObjC/property-11.m2
-rw-r--r--test/SemaObjC/property-12.m2
-rw-r--r--test/SemaObjC/property-13.m3
-rw-r--r--test/SemaObjC/property-2.m2
-rw-r--r--test/SemaObjC/property-3.m2
-rw-r--r--test/SemaObjC/property-4.m2
-rw-r--r--test/SemaObjC/property-5.m2
-rw-r--r--test/SemaObjC/property-6.m2
-rw-r--r--test/SemaObjC/property-7.m2
-rw-r--r--test/SemaObjC/property-8.m2
-rw-r--r--test/SemaObjC/property-9-impl-method.m2
-rw-r--r--test/SemaObjC/property-9.m2
-rw-r--r--test/SemaObjC/property-category-1.m2
-rw-r--r--test/SemaObjC/property-category-2.m2
-rw-r--r--test/SemaObjC/property-category-3.m2
-rw-r--r--test/SemaObjC/property-category-4.m2
-rw-r--r--test/SemaObjC/property-error-readonly-assign.m2
-rw-r--r--test/SemaObjC/property-expression-error.m2
-rw-r--r--test/SemaObjC/property-impl-misuse.m2
-rw-r--r--test/SemaObjC/property-inherited.m2
-rw-r--r--test/SemaObjC/property-ivar-mismatch.m2
-rw-r--r--test/SemaObjC/property-method-lookup-impl.m2
-rw-r--r--test/SemaObjC/property-missing.m2
-rw-r--r--test/SemaObjC/property-nonfragile-abi.m2
-rw-r--r--test/SemaObjC/property-noprotocol-warning.m2
-rw-r--r--test/SemaObjC/property-not-lvalue.m20
-rw-r--r--test/SemaObjC/property-redundant-decl-accessor.m2
-rw-r--r--test/SemaObjC/property-typecheck-1.m2
-rw-r--r--test/SemaObjC/property-user-setter.m3
-rw-r--r--test/SemaObjC/property-weak.m2
-rw-r--r--test/SemaObjC/property.m11
-rw-r--r--test/SemaObjC/props-on-prots.m2
-rw-r--r--test/SemaObjC/protocol-archane.m2
-rw-r--r--test/SemaObjC/protocol-attribute.m2
-rw-r--r--test/SemaObjC/protocol-expr-1.m2
-rw-r--r--test/SemaObjC/protocol-expr-neg-1.m2
-rw-r--r--test/SemaObjC/protocol-id-test-1.m2
-rw-r--r--test/SemaObjC/protocol-id-test-2.m2
-rw-r--r--test/SemaObjC/protocol-id-test-3.m2
-rw-r--r--test/SemaObjC/protocol-implementation-inherited.m2
-rw-r--r--test/SemaObjC/protocol-lookup-2.m2
-rw-r--r--test/SemaObjC/protocol-lookup.m2
-rw-r--r--test/SemaObjC/protocol-qualified-class-unsupported.m2
-rw-r--r--test/SemaObjC/protocol-typecheck.m2
-rw-r--r--test/SemaObjC/protocols.m2
-rw-r--r--test/SemaObjC/rdr-6211479-array-property.m2
-rw-r--r--test/SemaObjC/restrict-id-type.m2
-rw-r--r--test/SemaObjC/return.m2
-rw-r--r--test/SemaObjC/scope-check.m2
-rw-r--r--test/SemaObjC/selector-1.m2
-rw-r--r--test/SemaObjC/selector-error.m2
-rw-r--r--test/SemaObjC/selector-overload.m2
-rw-r--r--test/SemaObjC/sizeof-interface.m2
-rw-r--r--test/SemaObjC/static-ivar-ref-1.m4
-rw-r--r--test/SemaObjC/stmts.m2
-rw-r--r--test/SemaObjC/string.m4
-rw-r--r--test/SemaObjC/super-cat-prot.m2
-rw-r--r--test/SemaObjC/super-property-message-expr.m2
-rw-r--r--test/SemaObjC/super-property-notation.m2
-rw-r--r--test/SemaObjC/super.m2
-rw-r--r--test/SemaObjC/synchronized.m2
-rw-r--r--test/SemaObjC/synthesize-setter-contclass.m2
-rw-r--r--test/SemaObjC/synthesized-ivar.m2
-rw-r--r--test/SemaObjC/try-catch.m2
-rw-r--r--test/SemaObjC/typedef-class.m2
-rw-r--r--test/SemaObjC/ucn-objc-string.m2
-rw-r--r--test/SemaObjC/undeclared-selector.m2
-rw-r--r--test/SemaObjC/undef-class-messagin-error.m2
-rw-r--r--test/SemaObjC/undef-protocol-methods-1.m2
-rw-r--r--test/SemaObjC/undef-superclass-1.m2
-rw-r--r--test/SemaObjC/undefined-protocol-type-1.m2
-rw-r--r--test/SemaObjC/unused.m2
-rw-r--r--test/SemaObjC/va-method-1.m2
-rw-r--r--test/SemaObjC/warn-assign-property-nscopying.m2
-rw-r--r--test/SemaObjC/warn-selector-selection.m2
-rw-r--r--test/SemaObjC/warn-superclass-method-mismatch.m2
-rw-r--r--test/SemaObjC/warn-weak-field.m2
-rw-r--r--test/SemaObjC/weak-attr-ivar.m2
-rw-r--r--test/SemaObjC/writable-property-in-superclass.m2
-rw-r--r--test/SemaObjCXX/blocks.mm6
-rw-r--r--test/SemaObjCXX/category-lookup.mm2
-rw-r--r--test/SemaObjCXX/composite-objc-pointertype.mm2
-rw-r--r--test/SemaObjCXX/conditional-expr.mm6
-rw-r--r--test/SemaObjCXX/cstyle-cast.mm2
-rw-r--r--test/SemaObjCXX/function-pointer-void-star.mm9
-rw-r--r--test/SemaObjCXX/linkage-spec.mm2
-rw-r--r--test/SemaObjCXX/objc-decls-inside-namespace.mm2
-rw-r--r--test/SemaObjCXX/objc-pointer-conv.mm26
-rw-r--r--test/SemaObjCXX/overload.mm2
-rw-r--r--test/SemaObjCXX/protocol-lookup.mm2
-rw-r--r--test/SemaObjCXX/references.mm9
-rw-r--r--test/SemaObjCXX/reserved-keyword-selectors.mm2
-rw-r--r--test/SemaObjCXX/standard-conversion-to-bool.mm2
-rw-r--r--test/SemaObjCXX/vararg-non-pod.mm2
-rw-r--r--test/SemaObjCXX/void_to_obj.mm2
-rw-r--r--test/SemaTemplate/ackermann.cpp2
-rw-r--r--test/SemaTemplate/ambiguous-ovl-print.cpp2
-rw-r--r--test/SemaTemplate/anonymous-union.cpp19
-rw-r--r--test/SemaTemplate/canonical-expr-type-0x.cpp2
-rw-r--r--test/SemaTemplate/canonical-expr-type.cpp2
-rw-r--r--test/SemaTemplate/class-template-ctor-initializer.cpp2
-rw-r--r--test/SemaTemplate/class-template-decl.cpp2
-rw-r--r--test/SemaTemplate/class-template-id-2.cpp2
-rw-r--r--test/SemaTemplate/class-template-id.cpp8
-rw-r--r--test/SemaTemplate/class-template-spec.cpp2
-rw-r--r--test/SemaTemplate/constructor-template.cpp16
-rw-r--r--test/SemaTemplate/copy-ctor-assign.cpp2
-rw-r--r--test/SemaTemplate/current-instantiation.cpp2
-rw-r--r--test/SemaTemplate/deduction.cpp7
-rw-r--r--test/SemaTemplate/default-arguments-cxx0x.cpp2
-rw-r--r--test/SemaTemplate/default-arguments.cpp2
-rw-r--r--test/SemaTemplate/default-expr-arguments.cpp47
-rw-r--r--test/SemaTemplate/dependent-base-member-init.cpp2
-rw-r--r--test/SemaTemplate/dependent-expr.cpp7
-rw-r--r--test/SemaTemplate/dependent-names.cpp16
-rw-r--r--test/SemaTemplate/dependent-sized_array.cpp2
-rw-r--r--test/SemaTemplate/dependent-type-identity.cpp2
-rw-r--r--test/SemaTemplate/destructor-template.cpp2
-rw-r--r--test/SemaTemplate/enum-argument.cpp2
-rw-r--r--test/SemaTemplate/example-dynarray.cpp2
-rw-r--r--test/SemaTemplate/example-typelist.cpp2
-rw-r--r--test/SemaTemplate/explicit-instantiation.cpp6
-rw-r--r--test/SemaTemplate/explicit-specialization-member.cpp2
-rw-r--r--test/SemaTemplate/ext-vector-type.cpp2
-rw-r--r--test/SemaTemplate/extern-templates.cpp2
-rw-r--r--test/SemaTemplate/fibonacci.cpp2
-rw-r--r--test/SemaTemplate/friend-template.cpp12
-rw-r--r--test/SemaTemplate/friend.cpp2
-rw-r--r--test/SemaTemplate/fun-template-def.cpp10
-rw-r--r--test/SemaTemplate/function-template-specialization.cpp2
-rw-r--r--test/SemaTemplate/implicit-instantiation-1.cpp2
-rw-r--r--test/SemaTemplate/injected-class-name.cpp2
-rw-r--r--test/SemaTemplate/instantiate-anonymous-union.cpp2
-rw-r--r--test/SemaTemplate/instantiate-array.cpp2
-rw-r--r--test/SemaTemplate/instantiate-attr.cpp2
-rw-r--r--test/SemaTemplate/instantiate-c99.cpp2
-rw-r--r--test/SemaTemplate/instantiate-call.cpp4
-rw-r--r--test/SemaTemplate/instantiate-case.cpp2
-rw-r--r--test/SemaTemplate/instantiate-cast.cpp2
-rw-r--r--test/SemaTemplate/instantiate-clang.cpp2
-rw-r--r--test/SemaTemplate/instantiate-complete.cpp2
-rw-r--r--test/SemaTemplate/instantiate-decl-dtor.cpp11
-rw-r--r--test/SemaTemplate/instantiate-decl-init.cpp2
-rw-r--r--test/SemaTemplate/instantiate-declref-ice.cpp2
-rw-r--r--test/SemaTemplate/instantiate-declref.cpp2
-rw-r--r--test/SemaTemplate/instantiate-deeply.cpp2
-rw-r--r--test/SemaTemplate/instantiate-default-assignment-operator.cpp2
-rw-r--r--test/SemaTemplate/instantiate-dependent-nested-name.cpp2
-rw-r--r--test/SemaTemplate/instantiate-enum-2.cpp2
-rw-r--r--test/SemaTemplate/instantiate-enum.cpp2
-rw-r--r--test/SemaTemplate/instantiate-exception-spec.cpp2
-rw-r--r--test/SemaTemplate/instantiate-expr-1.cpp2
-rw-r--r--test/SemaTemplate/instantiate-expr-2.cpp2
-rw-r--r--test/SemaTemplate/instantiate-expr-3.cpp2
-rw-r--r--test/SemaTemplate/instantiate-expr-4.cpp29
-rw-r--r--test/SemaTemplate/instantiate-expr-5.cpp2
-rw-r--r--test/SemaTemplate/instantiate-expr-basic.cpp2
-rw-r--r--test/SemaTemplate/instantiate-field.cpp2
-rw-r--r--test/SemaTemplate/instantiate-friend-class.cpp2
-rw-r--r--test/SemaTemplate/instantiate-function-1.cpp4
-rw-r--r--test/SemaTemplate/instantiate-function-1.mm2
-rw-r--r--test/SemaTemplate/instantiate-function-2.cpp2
-rw-r--r--test/SemaTemplate/instantiate-init.cpp2
-rw-r--r--test/SemaTemplate/instantiate-member-class.cpp16
-rw-r--r--test/SemaTemplate/instantiate-member-expr.cpp27
-rw-r--r--test/SemaTemplate/instantiate-member-initializers.cpp2
-rw-r--r--test/SemaTemplate/instantiate-member-pointers.cpp2
-rw-r--r--test/SemaTemplate/instantiate-member-template.cpp8
-rw-r--r--test/SemaTemplate/instantiate-method.cpp4
-rw-r--r--test/SemaTemplate/instantiate-non-type-template-parameter.cpp2
-rw-r--r--test/SemaTemplate/instantiate-objc-1.mm2
-rw-r--r--test/SemaTemplate/instantiate-overloaded-arrow.cpp2
-rw-r--r--test/SemaTemplate/instantiate-static-var.cpp4
-rw-r--r--test/SemaTemplate/instantiate-subscript.cpp2
-rw-r--r--test/SemaTemplate/instantiate-template-template-parm.cpp4
-rw-r--r--test/SemaTemplate/instantiate-try-catch.cpp2
-rw-r--r--test/SemaTemplate/instantiate-type.cpp2
-rw-r--r--test/SemaTemplate/instantiate-typedef.cpp4
-rw-r--r--test/SemaTemplate/instantiate-using-decl.cpp16
-rw-r--r--test/SemaTemplate/instantiation-backtrace.cpp2
-rw-r--r--test/SemaTemplate/instantiation-default-1.cpp2
-rw-r--r--test/SemaTemplate/instantiation-default-2.cpp2
-rw-r--r--test/SemaTemplate/instantiation-default-3.cpp2
-rw-r--r--test/SemaTemplate/instantiation-depth.cpp2
-rw-r--r--test/SemaTemplate/member-access-expr.cpp16
-rw-r--r--test/SemaTemplate/member-function-template.cpp2
-rw-r--r--test/SemaTemplate/member-initializers.cpp2
-rw-r--r--test/SemaTemplate/member-template-access-expr.cpp2
-rw-r--r--test/SemaTemplate/metafun-apply.cpp10
-rw-r--r--test/SemaTemplate/nested-linkage.cpp2
-rw-r--r--test/SemaTemplate/nested-name-spec-template.cpp2
-rw-r--r--test/SemaTemplate/nested-template.cpp2
-rw-r--r--test/SemaTemplate/operator-function-id-template.cpp2
-rw-r--r--test/SemaTemplate/operator-template.cpp2
-rw-r--r--test/SemaTemplate/overload-uneval.cpp2
-rw-r--r--test/SemaTemplate/partial-spec-instantiate.cpp2
-rw-r--r--test/SemaTemplate/qualified-id.cpp2
-rw-r--r--test/SemaTemplate/qualified-names-diag.cpp2
-rw-r--r--test/SemaTemplate/recursive-template-instantiation.cpp4
-rw-r--r--test/SemaTemplate/temp.cpp2
-rw-r--r--test/SemaTemplate/temp_arg.cpp2
-rw-r--r--test/SemaTemplate/temp_arg_nontype.cpp14
-rw-r--r--test/SemaTemplate/temp_arg_template.cpp2
-rw-r--r--test/SemaTemplate/temp_arg_type.cpp2
-rw-r--r--test/SemaTemplate/temp_class_order.cpp2
-rw-r--r--test/SemaTemplate/temp_class_spec.cpp2
-rw-r--r--test/SemaTemplate/temp_class_spec_blocks.cpp2
-rw-r--r--test/SemaTemplate/temp_class_spec_neg.cpp2
-rw-r--r--test/SemaTemplate/temp_explicit.cpp2
-rw-r--r--test/SemaTemplate/temp_explicit_cxx0x.cpp2
-rw-r--r--test/SemaTemplate/temp_func_order.cpp2
-rw-r--r--test/SemaTemplate/template-class-traits.cpp2
-rw-r--r--test/SemaTemplate/template-decl-fail.cpp2
-rw-r--r--test/SemaTemplate/template-id-expr.cpp2
-rw-r--r--test/SemaTemplate/template-id-printing.cpp2
-rw-r--r--test/SemaTemplate/typename-specifier-2.cpp4
-rw-r--r--test/SemaTemplate/typename-specifier-3.cpp2
-rw-r--r--test/SemaTemplate/typename-specifier-4.cpp2
-rw-r--r--test/SemaTemplate/typename-specifier.cpp2
-rw-r--r--test/SemaTemplate/value-dependent-null-pointer-constant.cpp2
-rw-r--r--test/SemaTemplate/variadic-class-template-1.cpp2
-rw-r--r--test/SemaTemplate/variadic-class-template-2.cpp2
-rw-r--r--test/SemaTemplate/variadic-parse.cpp2
-rw-r--r--test/SemaTemplate/variadic-unsupported.cpp2
-rw-r--r--test/SemaTemplate/virtual-member-functions.cpp2
-rw-r--r--test/lit.cfg14
-rw-r--r--tools/CIndex/CIndex.cpp68
-rw-r--r--tools/CIndex/CIndex.exports1
-rw-r--r--tools/c-index-test/c-index-test.c28
-rw-r--r--tools/driver/cc1_main.cpp3
-rw-r--r--tools/driver/driver.cpp4
l---------tools/scan-build/c++-analyzer1
-rwxr-xr-xtools/scan-build/ccc-analyzer2
-rw-r--r--utils/C++Tests/LLVM-Code-Compile/lit.local.cfg34
-rwxr-xr-xutils/C++Tests/LLVM-Code-Symbols/check-symbols54
-rw-r--r--utils/C++Tests/LLVM-Code-Symbols/lit.local.cfg56
-rw-r--r--utils/C++Tests/LLVM-Code-Syntax/lit.local.cfg6
-rw-r--r--utils/C++Tests/lit.cfg1
-rw-r--r--www/cxx_status.html120
2151 files changed, 14159 insertions, 8808 deletions
diff --git a/Makefile b/Makefile
index 9002123dcaa3..8d3fa29a75a4 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ endif
include $(LEVEL)/Makefile.common
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
-all::
+$(RecursiveTargets)::
$(Verb) if [ ! -f test/Makefile ]; then \
$(MKDIR) test; \
$(CP) $(PROJ_SRC_DIR)/test/Makefile test/Makefile; \
diff --git a/TODO.txt b/TODO.txt
index 067f07b9d323..c63b1b33d6d6 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -69,7 +69,6 @@ More ideas for code modification hints:
//===---------------------------------------------------------------------===//
Options to support:
- -Wfatal-errors
-ftabstop=width
-fpreprocessed mode.
-nostdinc++
diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj
index 850cfd792f6a..ea72c9e6f04f 100644
--- a/clang.xcodeproj/project.pbxproj
+++ b/clang.xcodeproj/project.pbxproj
@@ -46,6 +46,7 @@
1A869AA80BA21ABA008DA07A /* LiteralSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A869AA70BA21ABA008DA07A /* LiteralSupport.cpp */; };
1A986AB710D0746D00A8EA9E /* CGDeclCXX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A986AB610D0746D00A8EA9E /* CGDeclCXX.cpp */; };
1AA1D91810125DE30078DEBC /* RecordLayoutBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA1D91610125DE30078DEBC /* RecordLayoutBuilder.cpp */; };
+ 1AA963C410D85A7300786C86 /* FullExpr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA963C310D85A7300786C86 /* FullExpr.cpp */; };
1ABC36940C7A4BDC006DB0AB /* CGBuiltin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ABC36930C7A4BDC006DB0AB /* CGBuiltin.cpp */; };
1ADD795410A90C6100741BBA /* TypePrinter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ADD795110A90C6100741BBA /* TypePrinter.cpp */; };
1ADD795510A90C6100741BBA /* TypeLoc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ADD795210A90C6100741BBA /* TypeLoc.cpp */; };
@@ -400,6 +401,8 @@
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; };
1AA1D91610125DE30078DEBC /* RecordLayoutBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = RecordLayoutBuilder.cpp; path = lib/AST/RecordLayoutBuilder.cpp; sourceTree = "<group>"; tabWidth = 2; };
1AA1D91710125DE30078DEBC /* RecordLayoutBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = RecordLayoutBuilder.h; path = lib/AST/RecordLayoutBuilder.h; sourceTree = "<group>"; tabWidth = 2; };
+ 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; };
+ 1AA963C310D85A7300786C86 /* FullExpr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = FullExpr.cpp; path = lib/AST/FullExpr.cpp; 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; };
1ADD795110A90C6100741BBA /* TypePrinter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypePrinter.cpp; path = lib/AST/TypePrinter.cpp; sourceTree = "<group>"; };
@@ -1348,6 +1351,7 @@
DE0FCA620A95859D00248FD5 /* Expr.h */,
1A30A9E80B93A4C800201A91 /* ExprCXX.h */,
35CEA05A0DF9E82700A41296 /* ExprObjC.h */,
+ 1AA963AB10D8576800786C86 /* FullExpr.h */,
DEDFE5CB0F7206CC0035BD10 /* NestedNameSpecifier.h */,
35EE48AE0E0C4CB200715C54 /* ParentMap.h */,
3547129D0C88881300B3E1D5 /* PrettyPrinter.h */,
@@ -1385,6 +1389,7 @@
DE0FCB330A9C21F100248FD5 /* Expr.cpp */,
1A32C17E0E1C87AD00A6B483 /* ExprConstant.cpp */,
35260CA40C7F75C000D66CE9 /* ExprCXX.cpp */,
+ 1AA963C310D85A7300786C86 /* FullExpr.cpp */,
3557D1A80EB136B100C59739 /* InheritViz.cpp */,
DEDFE5CE0F7206E40035BD10 /* NestedNameSpecifier.cpp */,
35EE48B00E0C4CCA00715C54 /* ParentMap.cpp */,
@@ -1929,6 +1934,7 @@
1ADD795610A90C6100741BBA /* TemplateBase.cpp in Sources */,
1A986AB710D0746D00A8EA9E /* CGDeclCXX.cpp in Sources */,
E16B523510D30B2400430AC9 /* cc1_main.cpp in Sources */,
+ 1AA963C410D85A7300786C86 /* FullExpr.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/docs/UsersManual.html b/docs/UsersManual.html
index b5aa6a8dcd70..13e020941472 100644
--- a/docs/UsersManual.html
+++ b/docs/UsersManual.html
@@ -578,14 +578,24 @@ adds runtime checks for undefined runtime behavior. If the check fails,
<tt>__builtin_trap()</tt> is used to indicate failure.
The checks are:
<p>
-<li>Subscripting where the static type of one operand is decayed from an
- array type and the other operand is greater than the size of the array or
- less than zero.</li>
+<li>Subscripting where the static type of one operand is variable
+ which is decayed from an array type and the other operand is
+ greater than the size of the array or less than zero.</li>
<li>Shift operators where the amount shifted is greater or equal to the
promoted bit-width of the left-hand-side or less than zero.</li>
+<li>If control flow reaches __builtin_unreachable.
+<li>When llvm implements more __builtin_object_size support, reads and
+ writes for objects that __builtin_object_size indicates we aren't
+ accessing valid memory. Bit-fields and vectors are not yet checked.
</p>
</dd>
+<dt id="opt_fno-assume-sane-operator-new"><b>-fno-assume-sane-operator-new</b>:
+Don't assume that the C++'s new operator is sane.</dt>
+<dd>This option tells the compiler to do not assume that C++'s global new
+operator will always return a pointer that do not
+alias any other pointer when the function returns.</dd>
+
<!-- ======================================================================= -->
<h2 id="c">C Language Features</h2>
<!-- ======================================================================= -->
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 000000000000..04332b7025d3
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_subdirectory(PrintFunctionNames)
+add_subdirectory(wpa)
+
diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644
index 000000000000..ced158f9d0b7
--- /dev/null
+++ b/examples/Makefile
@@ -0,0 +1,14 @@
+##===- examples/Makefile -----------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../../..
+
+PARALLEL_DIRS := PrintFunctionNames wpa
+
+include $(LEVEL)/Makefile.common
diff --git a/examples/PrintFunctionNames/CMakeLists.txt b/examples/PrintFunctionNames/CMakeLists.txt
new file mode 100644
index 000000000000..49dd22ad8d0d
--- /dev/null
+++ b/examples/PrintFunctionNames/CMakeLists.txt
@@ -0,0 +1,26 @@
+set(SHARED_LIBRARY 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)
diff --git a/examples/PrintFunctionNames/Makefile b/examples/PrintFunctionNames/Makefile
new file mode 100644
index 000000000000..3c0c1f82ad8a
--- /dev/null
+++ b/examples/PrintFunctionNames/Makefile
@@ -0,0 +1,28 @@
+##===- examples/PrintFunctionNames/Makefile ----------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../../../..
+LIBRARYNAME = PrintFunctionNames
+
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
+CXXFLAGS = -fno-rtti
+
+# Include this here so we can get the configuration of the targets that have
+# been configured for construction. We have to do this early so we can set up
+# 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
diff --git a/examples/PrintFunctionNames/PrintFunctionNames.cpp b/examples/PrintFunctionNames/PrintFunctionNames.cpp
new file mode 100644
index 000000000000..5b7b66a4f7ff
--- /dev/null
+++ b/examples/PrintFunctionNames/PrintFunctionNames.cpp
@@ -0,0 +1,44 @@
+//===- PrintFunctionNames.cpp ---------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Example clang plugin which simply prints the names of all the top-level decls
+// in the input file.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Frontend/FrontendPluginRegistry.h"
+#include "clang/AST/ASTConsumer.h"
+#include "clang/AST/AST.h"
+#include "llvm/Support/raw_ostream.h"
+using namespace clang;
+
+namespace {
+
+class PrintFunctionsConsumer : public ASTConsumer {
+public:
+ virtual void HandleTopLevelDecl(DeclGroupRef DG) {
+ for (DeclGroupRef::iterator i = DG.begin(), e = DG.end(); i != e; ++i) {
+ const Decl *D = *i;
+ if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
+ llvm::errs() << "top-level-decl: \"" << ND->getNameAsString() << "\"\n";
+ }
+ }
+};
+
+class PrintFunctionNamesAction : public ASTFrontendAction {
+protected:
+ ASTConsumer *CreateASTConsumer(CompilerInstance &CI, llvm::StringRef) {
+ return new PrintFunctionsConsumer();
+ }
+};
+
+}
+
+FrontendPluginRegistry::Add<PrintFunctionNamesAction>
+X("print-fns", "print function names");
diff --git a/examples/PrintFunctionNames/README.txt b/examples/PrintFunctionNames/README.txt
new file mode 100644
index 000000000000..ee6f7e865e91
--- /dev/null
+++ b/examples/PrintFunctionNames/README.txt
@@ -0,0 +1,10 @@
+This is a simple example demonstrating how to use clang's facility for
+providing AST consumers using a plugin.
+
+You will probably need to build clang so that it exports all symbols (disable
+TOOL_NO_EXPORT in the tools/clang Makefile).
+
+Once the plugin is built, you can run it using:
+--
+$ clang -cc1 -load path/to/PrintFunctionNames.so -plugin=print-fns some-input-file.c
+--
diff --git a/examples/wpa/CMakeLists.txt b/examples/wpa/CMakeLists.txt
new file mode 100644
index 000000000000..8d443d6e3149
--- /dev/null
+++ b/examples/wpa/CMakeLists.txt
@@ -0,0 +1,23 @@
+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_executable(clang-wpa
+ clang-wpa.cpp
+ )
+add_dependencies(clang-wpa clang-headers)
diff --git a/examples/wpa/Makefile b/examples/wpa/Makefile
new file mode 100644
index 000000000000..54b61d08571a
--- /dev/null
+++ b/examples/wpa/Makefile
@@ -0,0 +1,17 @@
+LEVEL = ../../../..
+
+TOOLNAME = clang-wpa
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
+CXXFLAGS = -fno-rtti
+NO_INSTALL = 1
+
+# No plugins, optimize startup time.
+TOOL_NO_EXPORTS = 1
+
+include $(LEVEL)/Makefile.config
+
+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
diff --git a/examples/wpa/clang-wpa.cpp b/examples/wpa/clang-wpa.cpp
new file mode 100644
index 000000000000..ae789fa9ae3c
--- /dev/null
+++ b/examples/wpa/clang-wpa.cpp
@@ -0,0 +1,56 @@
+//===--- clang-wpa.cpp - clang whole program analyzer ---------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This tool reads a sequence of precompiled AST files, and do various
+// cross translation unit analyses.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/SourceManager.h"
+#include "clang/Frontend/ASTUnit.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Index/CallGraph.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/raw_ostream.h"
+using namespace clang;
+using namespace idx;
+
+static llvm::cl::list<std::string>
+InputFilenames(llvm::cl::Positional, llvm::cl::desc("<input AST files>"));
+
+int main(int argc, char **argv) {
+ llvm::cl::ParseCommandLineOptions(argc, argv, "clang-wpa");
+ FileManager FileMgr;
+ std::vector<ASTUnit*> ASTUnits;
+
+ if (InputFilenames.empty())
+ return 0;
+
+ DiagnosticOptions DiagOpts;
+ llvm::OwningPtr<Diagnostic> Diags(
+ CompilerInstance::createDiagnostics(DiagOpts, argc, argv));
+
+ for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
+ const std::string &InFile = InputFilenames[i];
+ llvm::OwningPtr<ASTUnit> AST(ASTUnit::LoadFromPCHFile(InFile, *Diags));
+ if (!AST)
+ return 1;
+
+ ASTUnits.push_back(AST.take());
+ }
+
+ llvm::OwningPtr<CallGraph> CG;
+ CG.reset(new CallGraph());
+
+ for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i)
+ CG->addTU(ASTUnits[i]->getASTContext());
+
+ CG->ViewCallGraph();
+}
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 4e768097c402..03b4df12596a 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -17,6 +17,7 @@
#define CLANG_C_INDEX_H
#include <sys/stat.h>
+#include <time.h>
#ifdef __cplusplus
extern "C" {
@@ -555,23 +556,16 @@ enum CXCompletionChunkKind {
/**
* \brief A comma separator (',').
*/
- CXCompletionChunk_Comma
+ CXCompletionChunk_Comma,
+ /**
+ * \brief Text that specifies the result type of a given result.
+ *
+ * This special kind of informative chunk is not meant to be inserted into
+ * the text buffer. Rather, it is meant to illustrate the type that an
+ * expression using the given completion string would have.
+ */
+ CXCompletionChunk_ResultType
};
-
-/**
- * \brief Callback function that receives a single code-completion result.
- *
- * This callback will be invoked by \c clang_codeComplete() for each
- * code-completion result.
- *
- * \param completion_result a pointer to the current code-completion result,
- * providing one possible completion. The pointer itself is only valid
- * during the execution of the completion callback.
- *
- * \param client_data the client data provided to \c clang_codeComplete().
- */
-typedef void (*CXCompletionIterator)(CXCompletionResult *completion_result,
- CXClientData client_data);
/**
* \brief Determine the kind of a particular chunk within a completion string.
@@ -623,6 +617,26 @@ CINDEX_LINKAGE unsigned
clang_getNumCompletionChunks(CXCompletionString completion_string);
/**
+ * \brief Contains the results of code-completion.
+ *
+ * This data structure contains the results of code completion, as
+ * produced by \c clang_codeComplete. Its contents must be freed by
+ * \c clang_disposeCodeCompleteResults.
+ */
+typedef struct {
+ /**
+ * \brief The code-completion results.
+ */
+ CXCompletionResult *Results;
+
+ /**
+ * \brief The number of code-completion results stored in the
+ * \c Results array.
+ */
+ unsigned NumResults;
+} CXCodeCompleteResults;
+
+/**
* \brief Perform code completion at a given location in a source file.
*
* This function performs code completion at a particular file, line, and
@@ -634,7 +648,7 @@ clang_getNumCompletionChunks(CXCompletionString completion_string);
* to the parser, which recognizes this token and determines, based on the
* current location in the C/Objective-C/C++ grammar and the state of
* semantic analysis, what completions to provide. These completions are
- * enumerated through a callback interface to the client.
+ * returned via a new \c CXCodeCompleteResults structure.
*
* Code completion itself is meant to be triggered by the client when the
* user types punctuation characters or whitespace, at which point the
@@ -649,7 +663,7 @@ clang_getNumCompletionChunks(CXCompletionString completion_string);
* the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the
* client can filter the results based on the current token text ("get"), only
* showing those results that start with "get". The intent of this interface
- * is to separate the relatively high-latency acquisition of code-competion
+ * is to separate the relatively high-latency acquisition of code-completion
* results from the filtering of results on a per-character basis, which must
* have a lower latency.
*
@@ -690,24 +704,27 @@ clang_getNumCompletionChunks(CXCompletionString completion_string);
* Note that the column should point just after the syntactic construct that
* initiated code completion, and not in the middle of a lexical token.
*
- * \param completion_iterator a callback function that will receive
- * code-completion results.
- *
- * \param client_data client-specific data that will be passed back via the
- * code-completion callback function.
+ * \returns if successful, a new CXCodeCompleteResults structure
+ * containing code-completion results, which should eventually be
+ * freed with \c clang_disposeCodeCompleteResults(). If code
+ * completion fails, returns NULL.
+ */
+CINDEX_LINKAGE
+CXCodeCompleteResults *clang_codeComplete(CXIndex CIdx,
+ const char *source_filename,
+ int num_command_line_args,
+ const char **command_line_args,
+ unsigned num_unsaved_files,
+ struct CXUnsavedFile *unsaved_files,
+ const char *complete_filename,
+ unsigned complete_line,
+ unsigned complete_column);
+
+/**
+ * \brief Free the given set of code-completion results.
*/
-CINDEX_LINKAGE void clang_codeComplete(CXIndex CIdx,
- const char *source_filename,
- int num_command_line_args,
- const char **command_line_args,
- unsigned num_unsaved_files,
- struct CXUnsavedFile *unsaved_files,
- const char *complete_filename,
- unsigned complete_line,
- unsigned complete_column,
- CXCompletionIterator completion_iterator,
- CXClientData client_data);
-
+CINDEX_LINKAGE
+void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);
#ifdef __cplusplus
}
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index 3fc5aabde32c..bcab46d0f5ed 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -38,6 +38,7 @@ namespace clang {
class FileManager;
class ASTRecordLayout;
class BlockExpr;
+ class CharUnits;
class Expr;
class ExternalASTSource;
class IdentifierTable;
@@ -114,9 +115,6 @@ class ASTContext {
/// \brief Mapping from ObjCContainers to their ObjCImplementations.
llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*> ObjCImpls;
- llvm::DenseMap<unsigned, FixedWidthIntType*> SignedFixedWidthIntTypes;
- llvm::DenseMap<unsigned, FixedWidthIntType*> UnsignedFixedWidthIntTypes;
-
/// BuiltinVaListType - built-in va list type.
/// This is initially null and set by Sema::LazilyCreateBuiltin when
/// a builtin that takes a valist is encountered.
@@ -724,8 +722,6 @@ public:
void setBuiltinVaListType(QualType T);
QualType getBuiltinVaListType() const { return BuiltinVaListType; }
- QualType getFixedWidthIntType(unsigned Width, bool Signed);
-
/// getCVRQualifiedType - Returns a type with additional const,
/// volatile, or restrict qualifiers.
QualType getCVRQualifiedType(QualType T, unsigned CVR) {
@@ -812,19 +808,15 @@ public:
return getTypeInfo(T).first;
}
- /// getByteWidth - Return the size of a byte, in bits
- uint64_t getByteSize() {
+ /// getCharWidth - Return the size of the character type, in bits
+ uint64_t getCharWidth() {
return getTypeSize(CharTy);
}
- /// getTypeSizeInBytes - Return the size of the specified type, in bytes.
+ /// getTypeSizeInChars - Return the size of the specified type, in characters.
/// This method does not work on incomplete types.
- uint64_t getTypeSizeInBytes(QualType T) {
- return getTypeSize(T) / getByteSize();
- }
- uint64_t getTypeSizeInBytes(const Type *T) {
- return getTypeSize(T) / getByteSize();
- }
+ CharUnits getTypeSizeInChars(QualType T);
+ CharUnits getTypeSizeInChars(const Type *T);
/// getTypeAlign - Return the ABI-specified alignment of a type, in bits.
/// This method does not work on incomplete types.
@@ -906,12 +898,29 @@ public:
return getCanonicalType(T1) == getCanonicalType(T2);
}
+ /// \brief Returns this type as a completely-unqualified array type, capturing
+ /// the qualifiers in Quals. This only operates on canonical types in order
+ /// to ensure the ArrayType doesn't itself have qualifiers.
+ ///
+ /// \param T is the canonicalized QualType, which may be an ArrayType
+ ///
+ /// \param Quals will receive the full set of qualifiers that were
+ /// applied to the element type of the array.
+ ///
+ /// \returns if this is an array type, the completely unqualified array type
+ /// that corresponds to it. Otherwise, returns this->getUnqualifiedType().
+ QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals);
+
/// \brief Determine whether the given types are equivalent after
/// cvr-qualifiers have been removed.
bool hasSameUnqualifiedType(QualType T1, QualType T2) {
CanQualType CT1 = getCanonicalType(T1);
CanQualType CT2 = getCanonicalType(T2);
- return CT1.getUnqualifiedType() == CT2.getUnqualifiedType();
+
+ Qualifiers Quals;
+ QualType UnqualT1 = getUnqualifiedArrayType(CT1, Quals);
+ QualType UnqualT2 = getUnqualifiedArrayType(CT2, Quals);
+ return UnqualT1 == UnqualT2;
}
/// \brief Retrieves the "canonical" declaration of
@@ -1251,7 +1260,8 @@ inline void *operator new[](size_t Bytes, clang::ASTContext& C,
/// invoking it directly; see the new[] operator for more details. This operator
/// is called implicitly by the compiler if a placement new[] expression using
/// the ASTContext throws in the object constructor.
-inline void operator delete[](void *Ptr, clang::ASTContext &C) throw () {
+inline void operator delete[](void *Ptr, clang::ASTContext &C, size_t)
+ throw () {
C.Deallocate(Ptr);
}
diff --git a/include/clang/AST/CanonicalType.h b/include/clang/AST/CanonicalType.h
index af8d23692e19..93e41d38d48c 100644
--- a/include/clang/AST/CanonicalType.h
+++ b/include/clang/AST/CanonicalType.h
@@ -559,7 +559,7 @@ template<>
struct CanProxyAdaptor<FunctionProtoType>
: public CanProxyBase<FunctionProtoType> {
LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getResultType)
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumArgs);
+ LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumArgs)
CanQualType getArgType(unsigned i) const {
return CanQualType::CreateUnsafe(this->getTypePtr()->getArgType(i));
}
diff --git a/include/clang/AST/CharUnits.h b/include/clang/AST/CharUnits.h
new file mode 100644
index 000000000000..7b2833c53ffa
--- /dev/null
+++ b/include/clang/AST/CharUnits.h
@@ -0,0 +1,149 @@
+//===--- CharUnits.h - Character units for sizes and offsets ----*- 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 CharUnits class
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_AST_CHARUNITS_H
+#define LLVM_CLANG_AST_CHARUNITS_H
+
+#include "llvm/System/DataTypes.h"
+
+namespace clang {
+
+ /// CharUnits - This is an opaque type for sizes expressed in character units.
+ /// Instances of this type represent a quantity as a multiple of the size
+ /// of the standard C type, char, on the target architecture. As an opaque
+ /// type, CharUnits protects you from accidentally combining operations on
+ /// quantities in bit units and character units.
+ ///
+ /// It should be noted that characters and bytes are distinct concepts. Bytes
+ /// refer to addressable units of data storage on the target machine, and
+ /// characters are members of a set of elements used for the organization,
+ /// control, or representation of data. According to C99, bytes are allowed
+ /// to exceed characters in size, although currently, clang only supports
+ /// architectures where the two are the same size.
+ ///
+ /// For portability, never assume that a target character is 8 bits wide. Use
+ /// CharUnit values whereever you calculate sizes, offsets, or alignments
+ /// in character units.
+ class CharUnits {
+ public:
+ typedef int64_t RawType;
+
+ private:
+ RawType Quantity;
+
+ explicit CharUnits(RawType C) : Quantity(C) {}
+
+ public:
+
+ /// CharUnits - A default constructor.
+ CharUnits() : Quantity(0) {}
+
+ /// Zero - Construct a CharUnits quantity of zero.
+ static CharUnits Zero() {
+ return CharUnits(0);
+ }
+
+ /// One - Construct a CharUnits quantity of one.
+ static CharUnits One() {
+ return CharUnits(1);
+ }
+
+ /// fromRaw - Construct a CharUnits quantity from a raw integer type.
+ static CharUnits fromRaw(RawType Quantity) {
+ return CharUnits(Quantity);
+ }
+
+ // Compound assignment.
+ CharUnits& operator+= (const CharUnits &Other) {
+ Quantity += Other.Quantity;
+ return *this;
+ }
+ CharUnits& operator-= (const CharUnits &Other) {
+ Quantity -= Other.Quantity;
+ return *this;
+ }
+
+ // Comparison operators.
+ bool operator== (const CharUnits &Other) const {
+ return Quantity == Other.Quantity;
+ }
+ bool operator!= (const CharUnits &Other) const {
+ return Quantity != Other.Quantity;
+ }
+
+ // Relational operators.
+ bool operator< (const CharUnits &Other) const {
+ return Quantity < Other.Quantity;
+ }
+ bool operator<= (const CharUnits &Other) const {
+ return Quantity <= Other.Quantity;
+ }
+ bool operator> (const CharUnits &Other) const {
+ return Quantity > Other.Quantity;
+ }
+ bool operator>= (const CharUnits &Other) const {
+ return Quantity >= Other.Quantity;
+ }
+
+ // Other predicates.
+
+ /// isZero - Test whether the quantity equals zero.
+ bool isZero() const { return Quantity == 0; }
+
+ /// isOne - Test whether the quantity equals one.
+ bool isOne() const { return Quantity == 1; }
+
+ /// isPositive - Test whether the quanity is greater than zero.
+ bool isPositive() const { return Quantity > 0; }
+
+ /// isNegative - Test whether the quantity is less than zero.
+ bool isNegative() const { return Quantity < 0; }
+
+ // Arithmetic operators.
+ CharUnits operator* (RawType N) const {
+ return CharUnits(Quantity * N);
+ }
+ CharUnits operator/ (RawType N) const {
+ return CharUnits(Quantity / N);
+ }
+ RawType operator/ (const CharUnits &Other) const {
+ return Quantity / Other.Quantity;
+ }
+ CharUnits operator% (RawType N) const {
+ return CharUnits(Quantity % N);
+ }
+ RawType operator% (const CharUnits &Other) const {
+ return Quantity % Other.Quantity;
+ }
+ CharUnits operator+ (const CharUnits &Other) const {
+ return CharUnits(Quantity + Other.Quantity);
+ }
+ CharUnits operator- (const CharUnits &Other) const {
+ return CharUnits(Quantity - Other.Quantity);
+ }
+
+ // Conversions.
+
+ /// getRaw - Get the raw integer representation of this quantity.
+ RawType getRaw() const { return Quantity; }
+
+
+ }; // class CharUnit
+} // namespace clang
+
+inline clang::CharUnits operator* (clang::CharUnits::RawType Scale,
+ const clang::CharUnits &CU) {
+ return CU * Scale;
+}
+
+#endif // LLVM_CLANG_AST_CHARUNITS_H
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index ff2b30227860..d0d94aafb8d0 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -21,6 +21,7 @@
#include "clang/AST/ExternalASTSource.h"
namespace clang {
+class CXXTemporary;
class Expr;
class FunctionTemplateDecl;
class Stmt;
@@ -84,13 +85,20 @@ public:
class TranslationUnitDecl : public Decl, public DeclContext {
ASTContext &Ctx;
+ /// The (most recently entered) anonymous namespace for this
+ /// translation unit, if one has been created.
+ NamespaceDecl *AnonymousNamespace;
+
explicit TranslationUnitDecl(ASTContext &ctx)
: Decl(TranslationUnit, 0, SourceLocation()),
DeclContext(TranslationUnit),
- Ctx(ctx) {}
+ Ctx(ctx), AnonymousNamespace(0) {}
public:
ASTContext &getASTContext() const { return Ctx; }
+ NamespaceDecl *getAnonymousNamespace() const { return AnonymousNamespace; }
+ void setAnonymousNamespace(NamespaceDecl *D) { AnonymousNamespace = D; }
+
static TranslationUnitDecl *Create(ASTContext &C);
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return D->getKind() == TranslationUnit; }
@@ -198,6 +206,20 @@ public:
/// \brief Determine whether this declaration has linkage.
bool hasLinkage() const;
+ /// \brief Determine whether this declaration is a C++ class member.
+ bool isCXXClassMember() const {
+ const DeclContext *DC = getDeclContext();
+
+ // C++0x [class.mem]p1:
+ // The enumerators of an unscoped enumeration defined in
+ // the class are members of the class.
+ // FIXME: support C++0x scoped enumerations.
+ if (isa<EnumDecl>(DC))
+ DC = DC->getParent();
+
+ return DC->isRecord();
+ }
+
/// \brief Describes the different kinds of linkage
/// (C++ [basic.link], C99 6.2.2) that an entity may have.
enum Linkage {
@@ -246,10 +268,15 @@ class NamespaceDecl : public NamedDecl, public DeclContext {
// OrigNamespace of the first namespace decl points to itself.
NamespaceDecl *OrigNamespace, *NextNamespace;
+ // The (most recently entered) anonymous namespace inside this
+ // namespace.
+ NamespaceDecl *AnonymousNamespace;
+
NamespaceDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id)
: NamedDecl(Namespace, DC, L, Id), DeclContext(Namespace) {
OrigNamespace = this;
NextNamespace = 0;
+ AnonymousNamespace = 0;
}
public:
static NamespaceDecl *Create(ASTContext &C, DeclContext *DC,
@@ -277,6 +304,16 @@ public:
}
void setOriginalNamespace(NamespaceDecl *ND) { OrigNamespace = ND; }
+ NamespaceDecl *getAnonymousNamespace() const {
+ return AnonymousNamespace;
+ }
+
+ void setAnonymousNamespace(NamespaceDecl *D) {
+ assert(D->isAnonymousNamespace());
+ assert(D->getParent() == this);
+ AnonymousNamespace = D;
+ }
+
virtual NamespaceDecl *getCanonicalDecl() { return OrigNamespace; }
const NamespaceDecl *getCanonicalDecl() const { return OrigNamespace; }
@@ -769,14 +806,6 @@ class ParmVarDecl : public VarDecl {
/// in, inout, etc.
unsigned objcDeclQualifier : 6;
- /// \brief Retrieves the fake "value" of an unparsed
- static Expr *getUnparsedDefaultArgValue() {
- uintptr_t Value = (uintptr_t)-1;
- // Mask off the low bits
- Value &= ~(uintptr_t)0x07;
- return reinterpret_cast<Expr*> (Value);
- }
-
protected:
ParmVarDecl(Kind DK, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo,
@@ -798,22 +827,21 @@ public:
objcDeclQualifier = QTVal;
}
+ Expr *getDefaultArg();
const Expr *getDefaultArg() const {
- assert(!hasUnparsedDefaultArg() && "Default argument is not yet parsed!");
- assert(!hasUninstantiatedDefaultArg() &&
- "Default argument is not yet instantiated!");
- return getInit();
- }
- Expr *getDefaultArg() {
- assert(!hasUnparsedDefaultArg() && "Default argument is not yet parsed!");
- assert(!hasUninstantiatedDefaultArg() &&
- "Default argument is not yet instantiated!");
- return getInit();
+ return const_cast<ParmVarDecl *>(this)->getDefaultArg();
}
+
void setDefaultArg(Expr *defarg) {
Init = reinterpret_cast<Stmt *>(defarg);
}
+ unsigned getNumDefaultArgTemporaries() const;
+ CXXTemporary *getDefaultArgTemporary(unsigned i);
+ const CXXTemporary *getDefaultArgTemporary(unsigned i) const {
+ return const_cast<ParmVarDecl *>(this)->getDefaultArgTemporary(i);
+ }
+
/// \brief Retrieve the source range that covers the entire default
/// argument.
SourceRange getDefaultArgRange() const;
@@ -1152,7 +1180,7 @@ public:
/// represents an C++ overloaded operator, e.g., "operator+".
bool isOverloadedOperator() const {
return getOverloadedOperator() != OO_None;
- };
+ }
OverloadedOperatorKind getOverloadedOperator() const;
@@ -1421,7 +1449,7 @@ public:
};
-class TypedefDecl : public TypeDecl {
+class TypedefDecl : public TypeDecl, public Redeclarable<TypedefDecl> {
/// UnderlyingType - This is the type the typedef is set to.
TypeSourceInfo *TInfo;
@@ -1429,7 +1457,7 @@ class TypedefDecl : public TypeDecl {
IdentifierInfo *Id, TypeSourceInfo *TInfo)
: TypeDecl(Typedef, DC, L, Id), TInfo(TInfo) {}
- virtual ~TypedefDecl() {}
+ virtual ~TypedefDecl();
public:
static TypedefDecl *Create(ASTContext &C, DeclContext *DC,
@@ -1440,6 +1468,14 @@ public:
return TInfo;
}
+ /// Retrieves the canonical declaration of this typedef.
+ TypedefDecl *getCanonicalDecl() {
+ return getFirstDeclaration();
+ }
+ const TypedefDecl *getCanonicalDecl() const {
+ return getFirstDeclaration();
+ }
+
QualType getUnderlyingType() const {
return TInfo->getType();
}
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index 5507e99e45a9..02581c1241a4 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -1178,14 +1178,14 @@ public:
/// X(const X&);
/// };
/// @endcode
- bool isCopyConstructor(ASTContext &Context, unsigned &TypeQuals) const;
+ bool isCopyConstructor(unsigned &TypeQuals) const;
/// isCopyConstructor - Whether this constructor is a copy
/// constructor (C++ [class.copy]p2, which can be used to copy the
/// class.
- bool isCopyConstructor(ASTContext &Context) const {
+ bool isCopyConstructor() const {
unsigned TypeQuals = 0;
- return isCopyConstructor(Context, TypeQuals);
+ return isCopyConstructor(TypeQuals);
}
/// isConvertingConstructor - Whether this constructor is a
@@ -1338,11 +1338,16 @@ private:
// Location of the 'friend' specifier.
SourceLocation FriendLoc;
+ // FIXME: Hack to keep track of whether this was a friend function
+ // template specialization.
+ bool WasSpecialization;
+
FriendDecl(DeclContext *DC, SourceLocation L, FriendUnion Friend,
SourceLocation FriendL)
: Decl(Decl::Friend, DC, L),
Friend(Friend),
- FriendLoc(FriendL) {
+ FriendLoc(FriendL),
+ WasSpecialization(false) {
}
public:
@@ -1369,6 +1374,9 @@ public:
return FriendLoc;
}
+ bool wasSpecialization() const { return WasSpecialization; }
+ void setSpecialization(bool WS) { WasSpecialization = WS; }
+
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) {
return D->getKind() == Decl::Friend;
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index fd8c3ef7fc55..ba17eb1c1d60 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -527,7 +527,7 @@ public:
// Location information, modeled after the Stmt API.
SourceLocation getLocStart() const { return getLocation(); } // '@'interface
SourceLocation getLocEnd() const { return EndLoc; }
- void setLocEnd(SourceLocation LE) { EndLoc = LE; };
+ void setLocEnd(SourceLocation LE) { EndLoc = LE; }
void setClassLoc(SourceLocation Loc) { ClassLoc = Loc; }
SourceLocation getClassLoc() const { return ClassLoc; }
@@ -707,7 +707,7 @@ public:
// Location information, modeled after the Stmt API.
SourceLocation getLocStart() const { return getLocation(); } // '@'protocol
SourceLocation getLocEnd() const { return EndLoc; }
- void setLocEnd(SourceLocation LE) { EndLoc = LE; };
+ void setLocEnd(SourceLocation LE) { EndLoc = LE; }
static bool classof(const Decl *D) { return D->getKind() == ObjCProtocol; }
static bool classof(const ObjCProtocolDecl *D) { return true; }
@@ -871,7 +871,7 @@ public:
// Location information, modeled after the Stmt API.
SourceLocation getLocStart() const { return getLocation(); } // '@'interface
SourceLocation getLocEnd() const { return EndLoc; }
- void setLocEnd(SourceLocation LE) { EndLoc = LE; };
+ void setLocEnd(SourceLocation LE) { EndLoc = LE; }
static bool classof(const Decl *D) { return D->getKind() == ObjCCategory; }
static bool classof(const ObjCCategoryDecl *D) { return true; }
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 469598ff3723..0cb22df92ff7 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -53,14 +53,6 @@ protected:
/// (C++ [temp.dep.constexpr]).
bool ValueDependent : 1;
- // FIXME: Eventually, this constructor should go away and we should
- // require every subclass to provide type/value-dependence
- // information.
- Expr(StmtClass SC, QualType T)
- : Stmt(SC), TypeDependent(false), ValueDependent(false) {
- setType(T);
- }
-
Expr(StmtClass SC, QualType T, bool TD, bool VD)
: Stmt(SC), TypeDependent(TD), ValueDependent(VD) {
setType(T);
@@ -156,7 +148,8 @@ public:
LV_IncompleteVoidType,
LV_DuplicateVectorComponents,
LV_InvalidExpression,
- LV_MemberFunction
+ LV_MemberFunction,
+ LV_SubObjCPropertySetting
};
isLvalueResult isLvalue(ASTContext &Ctx) const;
@@ -185,7 +178,8 @@ public:
MLV_NotBlockQualified,
MLV_ReadonlyProperty,
MLV_NoSetterProperty,
- MLV_MemberFunction
+ MLV_MemberFunction,
+ MLV_SubObjCPropertySetting
};
isModifiableLvalueResult isModifiableLvalue(ASTContext &Ctx,
SourceLocation *Loc = 0) const;
@@ -607,7 +601,7 @@ public:
// type should be IntTy, LongTy, LongLongTy, UnsignedIntTy, UnsignedLongTy,
// or UnsignedLongLongTy
IntegerLiteral(const llvm::APInt &V, QualType type, SourceLocation l)
- : Expr(IntegerLiteralClass, type), Value(V), Loc(l) {
+ : Expr(IntegerLiteralClass, type, false, false), Value(V), Loc(l) {
assert(type->isIntegerType() && "Illegal type in IntegerLiteral");
}
@@ -641,7 +635,8 @@ class CharacterLiteral : public Expr {
public:
// type should be IntTy
CharacterLiteral(unsigned value, bool iswide, QualType type, SourceLocation l)
- : Expr(CharacterLiteralClass, type), Value(value), Loc(l), IsWide(iswide) {
+ : Expr(CharacterLiteralClass, type, false, false), Value(value), Loc(l),
+ IsWide(iswide) {
}
/// \brief Construct an empty character literal.
@@ -675,7 +670,8 @@ class FloatingLiteral : public Expr {
public:
FloatingLiteral(const llvm::APFloat &V, bool isexact,
QualType Type, SourceLocation L)
- : Expr(FloatingLiteralClass, Type), Value(V), IsExact(isexact), Loc(L) {}
+ : Expr(FloatingLiteralClass, Type, false, false), Value(V),
+ IsExact(isexact), Loc(L) {}
/// \brief Construct an empty floating-point literal.
explicit FloatingLiteral(EmptyShell Empty)
@@ -716,7 +712,7 @@ class ImaginaryLiteral : public Expr {
Stmt *Val;
public:
ImaginaryLiteral(Expr *val, QualType Ty)
- : Expr(ImaginaryLiteralClass, Ty), Val(val) {}
+ : Expr(ImaginaryLiteralClass, Ty, false, false), Val(val) {}
/// \brief Build an empty imaginary literal.
explicit ImaginaryLiteral(EmptyShell Empty)
@@ -760,7 +756,7 @@ class StringLiteral : public Expr {
unsigned NumConcatenated;
SourceLocation TokLocs[1];
- StringLiteral(QualType Ty) : Expr(StringLiteralClass, Ty) {}
+ StringLiteral(QualType Ty) : Expr(StringLiteralClass, Ty, false, false) {}
protected:
virtual void DoDestroy(ASTContext &C);
@@ -1174,6 +1170,11 @@ public:
Expr *getCallee() { return cast<Expr>(SubExprs[FN]); }
void setCallee(Expr *F) { SubExprs[FN] = F; }
+ Decl *getCalleeDecl();
+ const Decl *getCalleeDecl() const {
+ return const_cast<CallExpr*>(this)->getCalleeDecl();
+ }
+
/// \brief If the callee is a FunctionDecl, return it. Otherwise return 0.
FunctionDecl *getDirectCallee();
const FunctionDecl *getDirectCallee() const {
@@ -1459,10 +1460,11 @@ class CompoundLiteralExpr : public Expr {
Stmt *Init;
bool FileScope;
public:
+ // FIXME: Can compound literals be value-dependent?
CompoundLiteralExpr(SourceLocation lparenloc, QualType ty, Expr *init,
bool fileScope)
- : Expr(CompoundLiteralExprClass, ty), LParenLoc(lparenloc), Init(init),
- FileScope(fileScope) {}
+ : Expr(CompoundLiteralExprClass, ty, ty->isDependentType(), false),
+ LParenLoc(lparenloc), Init(init), FileScope(fileScope) {}
/// \brief Construct an empty compound literal.
explicit CompoundLiteralExpr(EmptyShell Empty)
@@ -1896,8 +1898,11 @@ public:
protected:
BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
- SourceLocation oploc, bool dead)
- : Expr(CompoundAssignOperatorClass, ResTy), Opc(opc), OpLoc(oploc) {
+ SourceLocation opLoc, bool dead)
+ : Expr(CompoundAssignOperatorClass, ResTy,
+ lhs->isTypeDependent() || rhs->isTypeDependent(),
+ lhs->isValueDependent() || rhs->isValueDependent()),
+ Opc(opc), OpLoc(opLoc) {
SubExprs[LHS] = lhs;
SubExprs[RHS] = rhs;
}
@@ -2026,7 +2031,8 @@ class AddrLabelExpr : public Expr {
public:
AddrLabelExpr(SourceLocation AALoc, SourceLocation LLoc, LabelStmt *L,
QualType t)
- : Expr(AddrLabelExprClass, t), AmpAmpLoc(AALoc), LabelLoc(LLoc), Label(L) {}
+ : Expr(AddrLabelExprClass, t, false, false),
+ AmpAmpLoc(AALoc), LabelLoc(LLoc), Label(L) {}
/// \brief Build an empty address of a label expression.
explicit AddrLabelExpr(EmptyShell Empty)
@@ -2061,9 +2067,11 @@ class StmtExpr : public Expr {
Stmt *SubStmt;
SourceLocation LParenLoc, RParenLoc;
public:
+ // FIXME: Does type-dependence need to be computed differently?
StmtExpr(CompoundStmt *substmt, QualType T,
SourceLocation lp, SourceLocation rp) :
- Expr(StmtExprClass, T), SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) { }
+ Expr(StmtExprClass, T, T->isDependentType(), false),
+ SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) { }
/// \brief Build an empty statement expression.
explicit StmtExpr(EmptyShell Empty) : Expr(StmtExprClass, Empty) { }
@@ -2102,8 +2110,8 @@ class TypesCompatibleExpr : public Expr {
public:
TypesCompatibleExpr(QualType ReturnType, SourceLocation BLoc,
QualType t1, QualType t2, SourceLocation RP) :
- Expr(TypesCompatibleExprClass, ReturnType), Type1(t1), Type2(t2),
- BuiltinLoc(BLoc), RParenLoc(RP) {}
+ Expr(TypesCompatibleExprClass, ReturnType, false, false),
+ Type1(t1), Type2(t2), BuiltinLoc(BLoc), RParenLoc(RP) {}
/// \brief Build an empty __builtin_type_compatible_p expression.
explicit TypesCompatibleExpr(EmptyShell Empty)
@@ -2153,11 +2161,13 @@ protected:
virtual void DoDestroy(ASTContext &C);
public:
+ // FIXME: Can a shufflevector be value-dependent? Does type-dependence need
+ // to be computed differently?
ShuffleVectorExpr(ASTContext &C, Expr **args, unsigned nexpr,
QualType Type, SourceLocation BLoc,
SourceLocation RP) :
- Expr(ShuffleVectorExprClass, Type), BuiltinLoc(BLoc),
- RParenLoc(RP), NumExprs(nexpr) {
+ Expr(ShuffleVectorExprClass, Type, Type->isDependentType(), false),
+ BuiltinLoc(BLoc), RParenLoc(RP), NumExprs(nexpr) {
SubExprs = new (C) Stmt*[nexpr];
for (unsigned i = 0; i < nexpr; i++)
@@ -2285,7 +2295,7 @@ class GNUNullExpr : public Expr {
public:
GNUNullExpr(QualType Ty, SourceLocation Loc)
- : Expr(GNUNullExprClass, Ty), TokenLoc(Loc) { }
+ : Expr(GNUNullExprClass, Ty, false, false), TokenLoc(Loc) { }
/// \brief Build an empty GNU __null expression.
explicit GNUNullExpr(EmptyShell Empty) : Expr(GNUNullExprClass, Empty) { }
@@ -2313,7 +2323,7 @@ class VAArgExpr : public Expr {
SourceLocation BuiltinLoc, RParenLoc;
public:
VAArgExpr(SourceLocation BLoc, Expr* e, QualType t, SourceLocation RPLoc)
- : Expr(VAArgExprClass, t),
+ : Expr(VAArgExprClass, t, t->isDependentType(), false),
Val(e),
BuiltinLoc(BLoc),
RParenLoc(RPLoc) { }
@@ -2795,7 +2805,7 @@ public:
class ImplicitValueInitExpr : public Expr {
public:
explicit ImplicitValueInitExpr(QualType ty)
- : Expr(ImplicitValueInitExprClass, ty) { }
+ : Expr(ImplicitValueInitExprClass, ty, false, false) { }
/// \brief Construct an empty implicit value initialization.
explicit ImplicitValueInitExpr(EmptyShell Empty)
@@ -2883,7 +2893,8 @@ class ExtVectorElementExpr : public Expr {
public:
ExtVectorElementExpr(QualType ty, Expr *base, IdentifierInfo &accessor,
SourceLocation loc)
- : Expr(ExtVectorElementExprClass, ty),
+ : Expr(ExtVectorElementExprClass, ty, base->isTypeDependent(),
+ base->isValueDependent()),
Base(base), Accessor(&accessor), AccessorLoc(loc) {}
/// \brief Build an empty vector element expression.
@@ -2938,7 +2949,7 @@ protected:
bool HasBlockDeclRefExprs;
public:
BlockExpr(BlockDecl *BD, QualType ty, bool hasBlockDeclRefExprs)
- : Expr(BlockExprClass, ty),
+ : Expr(BlockExprClass, ty, ty->isDependentType(), false),
TheBlock(BD), HasBlockDeclRefExprs(hasBlockDeclRefExprs) {}
/// \brief Build an empty block expression.
@@ -2983,10 +2994,11 @@ class BlockDeclRefExpr : public Expr {
bool IsByRef : 1;
bool ConstQualAdded : 1;
public:
+ // FIXME: Fix type/value dependence!
BlockDeclRefExpr(ValueDecl *d, QualType t, SourceLocation l, bool ByRef,
- bool constAdded = false) :
- Expr(BlockDeclRefExprClass, t), D(d), Loc(l), IsByRef(ByRef),
- ConstQualAdded(constAdded) {}
+ bool constAdded = false)
+ : Expr(BlockDeclRefExprClass, t, false, false), D(d), Loc(l), IsByRef(ByRef),
+ ConstQualAdded(constAdded) {}
// \brief Build an empty reference to a declared variable in a
// block.
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h
index 00ea202abde7..d0e21f576d75 100644
--- a/include/clang/AST/ExprCXX.h
+++ b/include/clang/AST/ExprCXX.h
@@ -224,7 +224,7 @@ class CXXBoolLiteralExpr : public Expr {
SourceLocation Loc;
public:
CXXBoolLiteralExpr(bool val, QualType Ty, SourceLocation l) :
- Expr(CXXBoolLiteralExprClass, Ty), Value(val), Loc(l) {}
+ Expr(CXXBoolLiteralExprClass, Ty, false, false), Value(val), Loc(l) {}
bool getValue() const { return Value; }
@@ -245,7 +245,7 @@ class CXXNullPtrLiteralExpr : public Expr {
SourceLocation Loc;
public:
CXXNullPtrLiteralExpr(QualType Ty, SourceLocation l) :
- Expr(CXXNullPtrLiteralExprClass, Ty), Loc(l) {}
+ Expr(CXXNullPtrLiteralExprClass, Ty, false, false), Loc(l) {}
virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
@@ -386,30 +386,70 @@ public:
/// parameter's default argument, when the call did not explicitly
/// supply arguments for all of the parameters.
class CXXDefaultArgExpr : public Expr {
- ParmVarDecl *Param;
+ /// \brief The parameter whose default is being used.
+ ///
+ /// When the bit is set, the subexpression is stored after the
+ /// CXXDefaultArgExpr itself. When the bit is clear, the parameter's
+ /// actual default expression is the subexpression.
+ llvm::PointerIntPair<ParmVarDecl *, 1, bool> Param;
+ /// \brief The location where the default argument expression was used.
+ SourceLocation Loc;
+
protected:
- CXXDefaultArgExpr(StmtClass SC, ParmVarDecl *param)
- : Expr(SC, param->hasUnparsedDefaultArg() ?
- param->getType().getNonReferenceType()
- : param->getDefaultArg()->getType()),
- Param(param) { }
-
+ CXXDefaultArgExpr(StmtClass SC, SourceLocation Loc, ParmVarDecl *param)
+ : Expr(SC,
+ param->hasUnparsedDefaultArg()
+ ? param->getType().getNonReferenceType()
+ : param->getDefaultArg()->getType(),
+ false, false),
+ Param(param, false), Loc(Loc) { }
+
+ CXXDefaultArgExpr(StmtClass SC, SourceLocation Loc, ParmVarDecl *param,
+ Expr *SubExpr)
+ : Expr(SC, SubExpr->getType(), false, false), Param(param, true), Loc(Loc)
+ {
+ *reinterpret_cast<Expr **>(this + 1) = SubExpr;
+ }
+
+protected:
+ virtual void DoDestroy(ASTContext &C);
+
public:
// Param is the parameter whose default argument is used by this
// expression.
- static CXXDefaultArgExpr *Create(ASTContext &C, ParmVarDecl *Param) {
- return new (C) CXXDefaultArgExpr(CXXDefaultArgExprClass, Param);
+ static CXXDefaultArgExpr *Create(ASTContext &C, SourceLocation Loc,
+ ParmVarDecl *Param) {
+ return new (C) CXXDefaultArgExpr(CXXDefaultArgExprClass, Loc, Param);
}
+ // Param is the parameter whose default argument is used by this
+ // expression, and SubExpr is the expression that will actually be used.
+ static CXXDefaultArgExpr *Create(ASTContext &C,
+ SourceLocation Loc,
+ ParmVarDecl *Param,
+ Expr *SubExpr);
+
// Retrieve the parameter that the argument was created from.
- const ParmVarDecl *getParam() const { return Param; }
- ParmVarDecl *getParam() { return Param; }
+ const ParmVarDecl *getParam() const { return Param.getPointer(); }
+ ParmVarDecl *getParam() { return Param.getPointer(); }
// Retrieve the actual argument to the function call.
- const Expr *getExpr() const { return Param->getDefaultArg(); }
- Expr *getExpr() { return Param->getDefaultArg(); }
+ const Expr *getExpr() const {
+ if (Param.getInt())
+ return *reinterpret_cast<Expr const * const*> (this + 1);
+ return getParam()->getDefaultArg();
+ }
+ Expr *getExpr() {
+ if (Param.getInt())
+ return *reinterpret_cast<Expr **> (this + 1);
+ return getParam()->getDefaultArg();
+ }
+ /// \brief Retrieve the location where this default argument was actually
+ /// used.
+ SourceLocation getUsedLocation() const { return Loc; }
+
virtual SourceRange getSourceRange() const {
// Default argument expressions have no representation in the
// source, so they have an empty source range.
@@ -452,8 +492,8 @@ class CXXBindTemporaryExpr : public Expr {
Stmt *SubExpr;
CXXBindTemporaryExpr(CXXTemporary *temp, Expr* subexpr)
- : Expr(CXXBindTemporaryExprClass,
- subexpr->getType()), Temp(temp), SubExpr(subexpr) { }
+ : Expr(CXXBindTemporaryExprClass, subexpr->getType(), false, false),
+ Temp(temp), SubExpr(subexpr) { }
~CXXBindTemporaryExpr() { }
protected:
@@ -489,15 +529,18 @@ public:
class CXXConstructExpr : public Expr {
CXXConstructorDecl *Constructor;
- bool Elidable;
-
+ SourceLocation Loc;
+ bool Elidable : 1;
+ bool ZeroInitialization : 1;
Stmt **Args;
unsigned NumArgs;
protected:
CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
+ SourceLocation Loc,
CXXConstructorDecl *d, bool elidable,
- Expr **args, unsigned numargs);
+ Expr **args, unsigned numargs,
+ bool ZeroInitialization = false);
~CXXConstructExpr() { }
virtual void DoDestroy(ASTContext &C);
@@ -508,17 +551,29 @@ public:
CXXConstructExpr(EmptyShell Empty, ASTContext &C, unsigned numargs);
static CXXConstructExpr *Create(ASTContext &C, QualType T,
+ SourceLocation Loc,
CXXConstructorDecl *D, bool Elidable,
- Expr **Args, unsigned NumArgs);
+ Expr **Args, unsigned NumArgs,
+ bool ZeroInitialization = false);
CXXConstructorDecl* getConstructor() const { return Constructor; }
void setConstructor(CXXConstructorDecl *C) { Constructor = C; }
+ SourceLocation getLocation() const { return Loc; }
+ void setLocation(SourceLocation Loc) { this->Loc = Loc; }
+
/// \brief Whether this construction is elidable.
bool isElidable() const { return Elidable; }
void setElidable(bool E) { Elidable = E; }
+ /// \brief Whether this construction first requires
+ /// zero-initialization before the initializer is called.
+ bool requiresZeroInitialization() const { return ZeroInitialization; }
+ void setRequiresZeroInitialization(bool ZeroInit) {
+ ZeroInitialization = ZeroInit;
+ }
+
typedef ExprIterator arg_iterator;
typedef ConstExprIterator const_arg_iterator;
@@ -546,13 +601,7 @@ public:
Args[Arg] = ArgExpr;
}
- virtual SourceRange getSourceRange() const {
- // FIXME: Should we know where the parentheses are, if there are any?
- if (NumArgs == 0)
- return SourceRange();
-
- return SourceRange(Args[0]->getLocStart(), Args[NumArgs - 1]->getLocEnd());
- }
+ virtual SourceRange getSourceRange() const;
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXConstructExprClass ||
@@ -1264,10 +1313,8 @@ class CXXExprWithTemporaries : public Expr {
CXXTemporary **Temps;
unsigned NumTemps;
- bool ShouldDestroyTemps;
-
CXXExprWithTemporaries(Expr *SubExpr, CXXTemporary **Temps,
- unsigned NumTemps, bool ShouldDestroyTemps);
+ unsigned NumTemps);
~CXXExprWithTemporaries();
protected:
@@ -1275,8 +1322,8 @@ protected:
public:
static CXXExprWithTemporaries *Create(ASTContext &C, Expr *SubExpr,
- CXXTemporary **Temps, unsigned NumTemps,
- bool ShouldDestroyTemporaries);
+ CXXTemporary **Temps,
+ unsigned NumTemps);
unsigned getNumTemporaries() const { return NumTemps; }
CXXTemporary *getTemporary(unsigned i) {
@@ -1284,14 +1331,9 @@ public:
return Temps[i];
}
const CXXTemporary *getTemporary(unsigned i) const {
- assert(i < NumTemps && "Index out of range");
- return Temps[i];
+ return const_cast<CXXExprWithTemporaries*>(this)->getTemporary(i);
}
- bool shouldDestroyTemporaries() const { return ShouldDestroyTemps; }
-
- void removeLastTemporary() { NumTemps--; }
-
Expr *getSubExpr() { return cast<Expr>(SubExpr); }
const Expr *getSubExpr() const { return cast<Expr>(SubExpr); }
void setSubExpr(Expr *E) { SubExpr = E; }
diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h
index 0613f4c095f8..0b0cd64ad721 100644
--- a/include/clang/AST/ExprObjC.h
+++ b/include/clang/AST/ExprObjC.h
@@ -30,7 +30,7 @@ class ObjCStringLiteral : public Expr {
SourceLocation AtLoc;
public:
ObjCStringLiteral(StringLiteral *SL, QualType T, SourceLocation L)
- : Expr(ObjCStringLiteralClass, T), String(SL), AtLoc(L) {}
+ : Expr(ObjCStringLiteralClass, T, false, false), String(SL), AtLoc(L) {}
explicit ObjCStringLiteral(EmptyShell Empty)
: Expr(ObjCStringLiteralClass, Empty) {}
@@ -100,7 +100,8 @@ class ObjCSelectorExpr : public Expr {
public:
ObjCSelectorExpr(QualType T, Selector selInfo,
SourceLocation at, SourceLocation rp)
- : Expr(ObjCSelectorExprClass, T), SelName(selInfo), AtLoc(at), RParenLoc(rp){}
+ : Expr(ObjCSelectorExprClass, T, false, false), SelName(selInfo), AtLoc(at),
+ RParenLoc(rp){}
explicit ObjCSelectorExpr(EmptyShell Empty)
: Expr(ObjCSelectorExprClass, Empty) {}
@@ -139,7 +140,7 @@ class ObjCProtocolExpr : public Expr {
public:
ObjCProtocolExpr(QualType T, ObjCProtocolDecl *protocol,
SourceLocation at, SourceLocation rp)
- : Expr(ObjCProtocolExprClass, T), TheProtocol(protocol),
+ : Expr(ObjCProtocolExprClass, T, false, false), TheProtocol(protocol),
AtLoc(at), RParenLoc(rp) {}
explicit ObjCProtocolExpr(EmptyShell Empty)
: Expr(ObjCProtocolExprClass, Empty) {}
@@ -178,7 +179,7 @@ public:
ObjCIvarRefExpr(ObjCIvarDecl *d,
QualType t, SourceLocation l, Expr *base=0,
bool arrow = false, bool freeIvar = false) :
- Expr(ObjCIvarRefExprClass, t), D(d),
+ Expr(ObjCIvarRefExprClass, t, false, false), D(d),
Loc(l), Base(base), IsArrow(arrow),
IsFreeIvar(freeIvar) {}
@@ -227,7 +228,8 @@ private:
public:
ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t,
SourceLocation l, Expr *base)
- : Expr(ObjCPropertyRefExprClass, t), AsProperty(PD), IdLoc(l), Base(base) {
+ : Expr(ObjCPropertyRefExprClass, t, false, false), AsProperty(PD),
+ IdLoc(l), Base(base) {
}
explicit ObjCPropertyRefExpr(EmptyShell Empty)
@@ -291,16 +293,17 @@ public:
QualType t,
ObjCMethodDecl *setter,
SourceLocation l, Expr *base)
- : Expr(ObjCImplicitSetterGetterRefExprClass, t), Setter(setter),
- Getter(getter), MemberLoc(l), Base(base), InterfaceDecl(0),
- ClassLoc(SourceLocation()) {
+ : Expr(ObjCImplicitSetterGetterRefExprClass, t, false, false),
+ Setter(setter), Getter(getter), MemberLoc(l), Base(base),
+ InterfaceDecl(0), ClassLoc(SourceLocation()) {
}
ObjCImplicitSetterGetterRefExpr(ObjCMethodDecl *getter,
QualType t,
ObjCMethodDecl *setter,
SourceLocation l, ObjCInterfaceDecl *C, SourceLocation CL)
- : Expr(ObjCImplicitSetterGetterRefExprClass, t), Setter(setter),
- Getter(getter), MemberLoc(l), Base(0), InterfaceDecl(C), ClassLoc(CL) {
+ : Expr(ObjCImplicitSetterGetterRefExprClass, t, false, false),
+ Setter(setter), Getter(getter), MemberLoc(l), Base(0), InterfaceDecl(C),
+ ClassLoc(CL) {
}
explicit ObjCImplicitSetterGetterRefExpr(EmptyShell Empty)
: Expr(ObjCImplicitSetterGetterRefExprClass, Empty){}
@@ -488,7 +491,7 @@ class ObjCSuperExpr : public Expr {
SourceLocation Loc;
public:
ObjCSuperExpr(SourceLocation L, QualType Type)
- : Expr(ObjCSuperExprClass, Type), Loc(L) { }
+ : Expr(ObjCSuperExprClass, Type, false, false), Loc(L) { }
explicit ObjCSuperExpr(EmptyShell Empty) : Expr(ObjCSuperExprClass, Empty) {}
SourceLocation getLoc() const { return Loc; }
@@ -519,7 +522,7 @@ class ObjCIsaExpr : public Expr {
bool IsArrow;
public:
ObjCIsaExpr(Expr *base, bool isarrow, SourceLocation l, QualType ty)
- : Expr(ObjCIsaExprClass, ty),
+ : Expr(ObjCIsaExprClass, ty, false, false),
Base(base), IsaMemberLoc(l), IsArrow(isarrow) {}
/// \brief Build an empty expression.
diff --git a/include/clang/AST/FullExpr.h b/include/clang/AST/FullExpr.h
new file mode 100644
index 000000000000..bb81bf0fe7c8
--- /dev/null
+++ b/include/clang/AST/FullExpr.h
@@ -0,0 +1,89 @@
+//===--- FullExpr.h - C++ full expression class -----------------*- 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 FullExpr interface, to be used for type safe handling
+// of full expressions.
+//
+// Full expressions are described in C++ [intro.execution]p12.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_CLANG_AST_FULLEXPR_H
+#define LLVM_CLANG_AST_FULLEXPR_H
+
+#include "llvm/ADT/PointerUnion.h"
+
+namespace clang {
+ class ASTContext;
+ class CXXTemporary;
+ class Expr;
+
+class FullExpr {
+ struct ExprAndTemporaries {
+ Expr *SubExpr;
+
+ unsigned NumTemps;
+
+ typedef CXXTemporary** temps_iterator;
+
+ temps_iterator temps_begin() {
+ return reinterpret_cast<CXXTemporary **>(this + 1);
+ }
+ temps_iterator temps_end() {
+ return temps_begin() + NumTemps;
+ }
+ };
+
+ typedef llvm::PointerUnion<Expr *, ExprAndTemporaries *> SubExprTy;
+ SubExprTy SubExpr;
+
+ FullExpr() { }
+
+public:
+ static FullExpr Create(ASTContext &Context, Expr *SubExpr,
+ CXXTemporary **Temps, unsigned NumTemps);
+ void Destroy(ASTContext &Context);
+
+ Expr *getExpr() {
+ if (Expr *E = SubExpr.dyn_cast<Expr *>())
+ return E;
+
+ return SubExpr.get<ExprAndTemporaries *>()->SubExpr;
+ }
+
+ const Expr *getExpr() const {
+ return const_cast<FullExpr*>(this)->getExpr();
+ }
+
+ typedef CXXTemporary** temps_iterator;
+
+ temps_iterator temps_begin() {
+ if (ExprAndTemporaries *ET = SubExpr.dyn_cast<ExprAndTemporaries *>())
+ return ET->temps_begin();
+
+ return 0;
+ }
+ temps_iterator temps_end() {
+ if (ExprAndTemporaries *ET = SubExpr.dyn_cast<ExprAndTemporaries *>())
+ return ET->temps_end();
+
+ return 0;
+ }
+
+ void *getAsOpaquePtr() const { return SubExpr.getOpaqueValue(); }
+
+ static FullExpr getFromOpaquePtr(void *Ptr) {
+ FullExpr E;
+ E.SubExpr = SubExprTy::getFromOpaqueValue(Ptr);
+ return E;
+ }
+};
+
+} // end namespace clang
+
+#endif
diff --git a/include/clang/AST/RecordLayout.h b/include/clang/AST/RecordLayout.h
index a8334b694080..e8d1788ded88 100644
--- a/include/clang/AST/RecordLayout.h
+++ b/include/clang/AST/RecordLayout.h
@@ -53,7 +53,7 @@ public:
PrimaryBaseInfo() {}
PrimaryBaseInfo(const CXXRecordDecl *Base, bool IsVirtual)
- : Value(Base, IsVirtual) {}
+ : Value(Base, Base && IsVirtual) {}
/// Value - Points to the primary base. The single-bit value
/// will be non-zero when the primary base is virtual.
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index d6f6a834d9c1..33edadc3a5e6 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -20,6 +20,7 @@
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/StmtIterator.h"
#include "clang/AST/DeclGroup.h"
+#include "clang/AST/FullExpr.h"
#include "llvm/ADT/SmallVector.h"
#include "clang/AST/ASTContext.h"
#include <string>
@@ -293,6 +294,9 @@ class DeclStmt : public Stmt {
DeclGroupRef DG;
SourceLocation StartLoc, EndLoc;
+protected:
+ virtual void DoDestroy(ASTContext &Ctx);
+
public:
DeclStmt(DeclGroupRef dg, SourceLocation startLoc,
SourceLocation endLoc) : Stmt(DeclStmtClass), DG(dg),
@@ -620,9 +624,9 @@ class IfStmt : public Stmt {
SourceLocation ElseLoc;
public:
- IfStmt(SourceLocation IL, VarDecl *Var, Expr *cond, Stmt *then,
+ IfStmt(SourceLocation IL, VarDecl *var, Expr *cond, Stmt *then,
SourceLocation EL = SourceLocation(), Stmt *elsev = 0)
- : Stmt(IfStmtClass), Var(Var), IfLoc(IL), ElseLoc(EL) {
+ : Stmt(IfStmtClass), Var(var), IfLoc(IL), ElseLoc(EL) {
SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
SubExprs[THEN] = then;
SubExprs[ELSE] = elsev;
@@ -670,9 +674,13 @@ public:
}
static bool classof(const IfStmt *) { return true; }
- // Iterators
+ // Iterators over subexpressions. The iterators will include iterating
+ // over the initialization expression referenced by the condition variable.
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+protected:
+ virtual void DoDestroy(ASTContext &Ctx);
};
/// SwitchStmt - This represents a 'switch' stmt.
@@ -805,6 +813,9 @@ public:
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+protected:
+ virtual void DoDestroy(ASTContext &Ctx);
};
/// DoStmt - This represents a 'do/while' stmt.
@@ -868,9 +879,9 @@ class ForStmt : public Stmt {
SourceLocation LParenLoc, RParenLoc;
public:
- ForStmt(Stmt *Init, Expr *Cond, VarDecl *CondVar, Expr *Inc, Stmt *Body,
+ 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),
+ : Stmt(ForStmtClass), CondVar(condVar), ForLoc(FL), LParenLoc(LP),
RParenLoc(RP)
{
SubExprs[INIT] = Init;
@@ -927,6 +938,9 @@ public:
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+protected:
+ virtual void DoDestroy(ASTContext &Ctx);
};
/// GotoStmt - This represents a direct goto.
diff --git a/include/clang/AST/StmtIterator.h b/include/clang/AST/StmtIterator.h
index f1aa2cd50f0f..a48f4e69468a 100644
--- a/include/clang/AST/StmtIterator.h
+++ b/include/clang/AST/StmtIterator.h
@@ -28,11 +28,12 @@ class StmtIteratorBase {
protected:
enum { DeclMode = 0x1, SizeOfTypeVAMode = 0x2, DeclGroupMode = 0x3,
Flags = 0x3 };
-
- union { Stmt** stmt; Decl* decl; Decl** DGI; };
+
+ Stmt **stmt;
+ union { Decl *decl; Decl **DGI; };
uintptr_t RawVAPtr;
- Decl** DGE;
-
+ Decl **DGE;
+
bool inDecl() const {
return (RawVAPtr & Flags) == DeclMode;
}
@@ -64,11 +65,11 @@ protected:
Stmt*& GetDeclExpr() const;
- StmtIteratorBase(Stmt** s) : stmt(s), RawVAPtr(0) {}
- StmtIteratorBase(Decl* d);
- StmtIteratorBase(VariableArrayType* t);
- StmtIteratorBase(Decl** dgi, Decl** dge);
- StmtIteratorBase() : stmt(NULL), RawVAPtr(0) {}
+ StmtIteratorBase(Stmt **s) : stmt(s), decl(0), RawVAPtr(0) {}
+ StmtIteratorBase(Decl *d, Stmt **s);
+ StmtIteratorBase(VariableArrayType *t);
+ StmtIteratorBase(Decl **dgi, Decl **dge);
+ StmtIteratorBase() : stmt(0), decl(0), RawVAPtr(0) {}
};
@@ -81,9 +82,9 @@ protected:
StmtIteratorImpl(const StmtIteratorBase& RHS) : StmtIteratorBase(RHS) {}
public:
StmtIteratorImpl() {}
- StmtIteratorImpl(Stmt** s) : StmtIteratorBase(s) {}
- StmtIteratorImpl(Decl** dgi, Decl** dge) : StmtIteratorBase(dgi, dge) {}
- StmtIteratorImpl(Decl* d) : StmtIteratorBase(d) {}
+ StmtIteratorImpl(Stmt **s) : StmtIteratorBase(s) {}
+ StmtIteratorImpl(Decl **dgi, Decl **dge) : StmtIteratorBase(dgi, dge) {}
+ StmtIteratorImpl(Decl *d, Stmt **s) : StmtIteratorBase(d, s) {}
StmtIteratorImpl(VariableArrayType* t) : StmtIteratorBase(t) {}
DERIVED& operator++() {
@@ -106,11 +107,11 @@ public:
}
bool operator==(const DERIVED& RHS) const {
- return stmt == RHS.stmt && RawVAPtr == RHS.RawVAPtr;
+ return stmt == RHS.stmt && decl == RHS.decl && RawVAPtr == RHS.RawVAPtr;
}
bool operator!=(const DERIVED& RHS) const {
- return stmt != RHS.stmt || RawVAPtr != RHS.RawVAPtr;
+ return stmt != RHS.stmt || decl != RHS.decl || RawVAPtr != RHS.RawVAPtr;
}
REFERENCE operator*() const {
@@ -124,11 +125,15 @@ struct StmtIterator : public StmtIteratorImpl<StmtIterator,Stmt*&> {
explicit StmtIterator() : StmtIteratorImpl<StmtIterator,Stmt*&>() {}
StmtIterator(Stmt** S) : StmtIteratorImpl<StmtIterator,Stmt*&>(S) {}
+
StmtIterator(Decl** dgi, Decl** dge)
: StmtIteratorImpl<StmtIterator,Stmt*&>(dgi, dge) {}
- StmtIterator(VariableArrayType* t):StmtIteratorImpl<StmtIterator,Stmt*&>(t) {}
- StmtIterator(Decl* D) : StmtIteratorImpl<StmtIterator,Stmt*&>(D) {}
+ StmtIterator(VariableArrayType* t)
+ : StmtIteratorImpl<StmtIterator,Stmt*&>(t) {}
+
+ StmtIterator(Decl* D, Stmt **s = 0)
+ : StmtIteratorImpl<StmtIterator,Stmt*&>(D, s) {}
};
struct ConstStmtIterator : public StmtIteratorImpl<ConstStmtIterator,
diff --git a/include/clang/AST/TemplateBase.h b/include/clang/AST/TemplateBase.h
index fe037992ad2f..50a100c6af13 100644
--- a/include/clang/AST/TemplateBase.h
+++ b/include/clang/AST/TemplateBase.h
@@ -221,7 +221,7 @@ public:
assert(Kind == Integral &&
"Cannot set the integral type of a non-integral template argument");
Integer.Type = T.getAsOpaquePtr();
- };
+ }
/// \brief Retrieve the template argument as an expression.
Expr *getAsExpr() const {
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index d22a646ece5b..9b0cdc3a52e6 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -531,7 +531,12 @@ public:
/// \brief Retrieve the set of CVR (const-volatile-restrict) qualifiers
/// applied to this type.
unsigned getCVRQualifiers() const;
-
+
+ /// \brief Retrieve the set of CVR (const-volatile-restrict) qualifiers
+ /// applied to this type, looking through any number of unqualified array
+ /// types to their element types' qualifiers.
+ unsigned getCVRQualifiersThroughArrayTypes() const;
+
bool isConstant(ASTContext& Ctx) const {
return QualType::isConstant(*this, Ctx);
}
@@ -1049,28 +1054,6 @@ public:
static bool classof(const BuiltinType *) { return true; }
};
-/// FixedWidthIntType - Used for arbitrary width types that we either don't
-/// want to or can't map to named integer types. These always have a lower
-/// integer rank than builtin types of the same width.
-class FixedWidthIntType : public Type {
-private:
- unsigned Width;
- bool Signed;
-public:
- FixedWidthIntType(unsigned W, bool S) : Type(FixedWidthInt, QualType(), false),
- Width(W), Signed(S) {}
-
- unsigned getWidth() const { return Width; }
- bool isSigned() const { return Signed; }
- const char *getName() const;
-
- bool isSugared() const { return false; }
- QualType desugar() const { return QualType(this, 0); }
-
- static bool classof(const Type *T) { return T->getTypeClass() == FixedWidthInt; }
- static bool classof(const FixedWidthIntType *) { return true; }
-};
-
/// ComplexType - C99 6.2.5p11 - Complex values. This supports the C99 complex
/// types (_Complex float etc) as well as the GCC integer complex extensions.
///
@@ -2708,7 +2691,20 @@ inline unsigned QualType::getCVRQualifiers() const {
return getLocalCVRQualifiers() |
getTypePtr()->getCanonicalTypeInternal().getLocalCVRQualifiers();
}
-
+
+/// getCVRQualifiersThroughArrayTypes - If there are CVR qualifiers for this
+/// type, returns them. Otherwise, if this is an array type, recurses
+/// on the element type until some qualifiers have been found or a non-array
+/// type reached.
+inline unsigned QualType::getCVRQualifiersThroughArrayTypes() const {
+ if (unsigned Quals = getCVRQualifiers())
+ return Quals;
+ QualType CT = getTypePtr()->getCanonicalTypeInternal();
+ if (const ArrayType *AT = dyn_cast<ArrayType>(CT))
+ return AT->getElementType().getCVRQualifiersThroughArrayTypes();
+ return 0;
+}
+
inline void QualType::removeConst() {
removeFastQualifiers(Qualifiers::Const);
}
@@ -2808,8 +2804,8 @@ inline bool QualType::getNoReturnAttr() const {
/// int".
inline bool QualType::isMoreQualifiedThan(QualType Other) const {
// FIXME: work on arbitrary qualifiers
- unsigned MyQuals = this->getCVRQualifiers();
- unsigned OtherQuals = Other.getCVRQualifiers();
+ unsigned MyQuals = this->getCVRQualifiersThroughArrayTypes();
+ unsigned OtherQuals = Other.getCVRQualifiersThroughArrayTypes();
if (getAddressSpace() != Other.getAddressSpace())
return false;
return MyQuals != OtherQuals && (MyQuals | OtherQuals) == MyQuals;
@@ -2821,8 +2817,8 @@ inline bool QualType::isMoreQualifiedThan(QualType Other) const {
/// "int", and "const volatile int".
inline bool QualType::isAtLeastAsQualifiedAs(QualType Other) const {
// FIXME: work on arbitrary qualifiers
- unsigned MyQuals = this->getCVRQualifiers();
- unsigned OtherQuals = Other.getCVRQualifiers();
+ unsigned MyQuals = this->getCVRQualifiersThroughArrayTypes();
+ unsigned OtherQuals = Other.getCVRQualifiersThroughArrayTypes();
if (getAddressSpace() != Other.getAddressSpace())
return false;
return (MyQuals | OtherQuals) == MyQuals;
diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h
index a9b7f7e94337..3e74d07ff7f3 100644
--- a/include/clang/AST/TypeLoc.h
+++ b/include/clang/AST/TypeLoc.h
@@ -1023,13 +1023,6 @@ class DependentSizedExtVectorTypeLoc :
DependentSizedExtVectorType> {
};
-// FIXME: I'm not sure how you actually specify these; with attributes?
-class FixedWidthIntTypeLoc :
- public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
- FixedWidthIntTypeLoc,
- FixedWidthIntType> {
-};
-
// FIXME: location of the '_Complex' keyword.
class ComplexTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
ComplexTypeLoc,
diff --git a/include/clang/AST/TypeNodes.def b/include/clang/AST/TypeNodes.def
index b9d37992a670..575011a8724c 100644
--- a/include/clang/AST/TypeNodes.def
+++ b/include/clang/AST/TypeNodes.def
@@ -52,7 +52,6 @@
#endif
TYPE(Builtin, Type)
-TYPE(FixedWidthInt, Type)
TYPE(Complex, Type)
TYPE(Pointer, Type)
TYPE(BlockPointer, Type)
@@ -92,7 +91,6 @@ TYPE(ObjCObjectPointer, Type)
#ifdef LEAF_TYPE
LEAF_TYPE(Enum)
LEAF_TYPE(Builtin)
-LEAF_TYPE(FixedWidthInt)
LEAF_TYPE(ObjCInterface)
LEAF_TYPE(TemplateTypeParm)
#undef LEAF_TYPE
diff --git a/include/clang/Analysis/Analyses/LiveVariables.h b/include/clang/Analysis/Analyses/LiveVariables.h
index 0077a8505170..44ab080acbf3 100644
--- a/include/clang/Analysis/Analyses/LiveVariables.h
+++ b/include/clang/Analysis/Analyses/LiveVariables.h
@@ -70,7 +70,7 @@ public:
LiveVariables(AnalysisContext &AC);
- /// IsLive - Return true if a variable is live at beginning of a
+ /// IsLive - Return true if a variable is live at the end of a
/// specified block.
bool isLive(const CFGBlock* B, const VarDecl* D) const;
diff --git a/include/clang/Analysis/Analyses/UninitializedValues.h b/include/clang/Analysis/Analyses/UninitializedValues.h
index 8a967c3f6edc..2b367b7e37f6 100644
--- a/include/clang/Analysis/Analyses/UninitializedValues.h
+++ b/include/clang/Analysis/Analyses/UninitializedValues.h
@@ -35,7 +35,7 @@ public:
struct AnalysisDataTy : public StmtDeclBitVector_Types::AnalysisDataTy {
AnalysisDataTy() : Observer(NULL), FullUninitTaint(true) {}
- virtual ~AnalysisDataTy() {};
+ virtual ~AnalysisDataTy() {}
ObserverTy* Observer;
bool FullUninitTaint;
diff --git a/include/clang/Analysis/CFG.h b/include/clang/Analysis/CFG.h
index e6f4cf961be0..38d4bdfcfced 100644
--- a/include/clang/Analysis/CFG.h
+++ b/include/clang/Analysis/CFG.h
@@ -15,8 +15,10 @@
#ifndef LLVM_CLANG_CFG_H
#define LLVM_CLANG_CFG_H
+#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/GraphTraits.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Casting.h"
#include "clang/Analysis/Support/BumpVector.h"
#include <cassert>
@@ -31,6 +33,17 @@ namespace clang {
class LangOptions;
class ASTContext;
+/// CFGElement - Represents a top-level expression in a basic block.
+class CFGElement {
+ llvm::PointerIntPair<Stmt *, 1> Data;
+public:
+ explicit CFGElement() {}
+ CFGElement(Stmt *S, bool lvalue) : Data(S, lvalue ? 1 : 0) {}
+ Stmt *getStmt() const { return Data.getPointer(); }
+ bool asLValue() const { return Data.getInt() == 1; }
+ operator Stmt*() const { return getStmt(); }
+};
+
/// CFGBlock - Represents a single basic block in a source-level CFG.
/// It consists of:
///
@@ -57,7 +70,7 @@ namespace clang {
///
class CFGBlock {
class StatementList {
- typedef BumpVector<Stmt*> ImplTy;
+ typedef BumpVector<CFGElement> ImplTy;
ImplTy Impl;
public:
StatementList(BumpVectorContext &C) : Impl(C, 4) {}
@@ -67,9 +80,9 @@ class CFGBlock {
typedef ImplTy::iterator reverse_iterator;
typedef ImplTy::const_iterator const_reverse_iterator;
- void push_back(Stmt *s, BumpVectorContext &C) { Impl.push_back(s, C); }
- Stmt *front() const { return Impl.back(); }
- Stmt *back() const { return Impl.front(); }
+ void push_back(CFGElement e, BumpVectorContext &C) { Impl.push_back(e, C); }
+ CFGElement front() const { return Impl.back(); }
+ CFGElement back() const { return Impl.front(); }
iterator begin() { return Impl.rbegin(); }
iterator end() { return Impl.rend(); }
@@ -80,7 +93,7 @@ class CFGBlock {
const_reverse_iterator rbegin() const { return Impl.begin(); }
const_reverse_iterator rend() const { return Impl.end(); }
- Stmt* operator[](size_t i) const {
+ CFGElement operator[](size_t i) const {
assert(i < Impl.size());
return Impl[Impl.size() - 1 - i];
}
@@ -121,7 +134,7 @@ public:
explicit CFGBlock(unsigned blockid, BumpVectorContext &C)
: Stmts(C), Label(NULL), Terminator(NULL), LoopTarget(NULL),
BlockID(blockid), Preds(C, 1), Succs(C, 1) {}
- ~CFGBlock() {};
+ ~CFGBlock() {}
// Statement iterators
typedef StatementList::iterator iterator;
@@ -129,8 +142,8 @@ public:
typedef StatementList::reverse_iterator reverse_iterator;
typedef StatementList::const_reverse_iterator const_reverse_iterator;
- Stmt* front() const { return Stmts.front(); }
- Stmt* back() const { return Stmts.back(); }
+ CFGElement front() const { return Stmts.front(); }
+ CFGElement back() const { return Stmts.back(); }
iterator begin() { return Stmts.begin(); }
iterator end() { return Stmts.end(); }
@@ -145,8 +158,7 @@ public:
unsigned size() const { return Stmts.size(); }
bool empty() const { return Stmts.empty(); }
- Stmt* operator[](size_t i) const { return Stmts[i]; }
-
+ CFGElement operator[](size_t i) const { return Stmts[i]; }
// CFG iterators
typedef AdjacentBlocks::iterator pred_iterator;
@@ -221,8 +233,8 @@ public:
Succs.push_back(Block, C);
}
- void appendStmt(Stmt* Statement, BumpVectorContext &C) {
- Stmts.push_back(Statement, C);
+ void appendStmt(Stmt* Statement, BumpVectorContext &C, bool asLValue) {
+ Stmts.push_back(CFGElement(Statement, asLValue), C);
}
};
@@ -333,7 +345,7 @@ public:
//===--------------------------------------------------------------------===//
CFG() : Entry(NULL), Exit(NULL), IndirectGotoBlock(NULL), NumBlockIDs(0),
- BlkExprMap(NULL), Blocks(BlkBVC, 10) {};
+ BlkExprMap(NULL), Blocks(BlkBVC, 10) {}
~CFG();
@@ -370,13 +382,25 @@ private:
namespace llvm {
+/// Implement simplify_type for CFGElement, so that we can dyn_cast from
+/// CFGElement to a specific Stmt class.
+template <> struct simplify_type<const ::clang::CFGElement> {
+ typedef ::clang::Stmt* SimpleType;
+ static SimpleType getSimplifiedValue(const ::clang::CFGElement &Val) {
+ return Val.getStmt();
+ }
+};
+
+template <> struct simplify_type< ::clang::CFGElement>
+ : public simplify_type<const ::clang::CFGElement> {};
+
// Traits for: CFGBlock
-template <> struct GraphTraits<clang::CFGBlock* > {
- typedef clang::CFGBlock NodeType;
- typedef clang::CFGBlock::succ_iterator ChildIteratorType;
+template <> struct GraphTraits< ::clang::CFGBlock* > {
+ typedef ::clang::CFGBlock NodeType;
+ typedef ::clang::CFGBlock::succ_iterator ChildIteratorType;
- static NodeType* getEntryNode(clang::CFGBlock* BB)
+ static NodeType* getEntryNode(::clang::CFGBlock* BB)
{ return BB; }
static inline ChildIteratorType child_begin(NodeType* N)
@@ -386,9 +410,9 @@ template <> struct GraphTraits<clang::CFGBlock* > {
{ return N->succ_end(); }
};
-template <> struct GraphTraits<const clang::CFGBlock* > {
- typedef const clang::CFGBlock NodeType;
- typedef clang::CFGBlock::const_succ_iterator ChildIteratorType;
+template <> struct GraphTraits< const ::clang::CFGBlock* > {
+ typedef const ::clang::CFGBlock NodeType;
+ typedef ::clang::CFGBlock::const_succ_iterator ChildIteratorType;
static NodeType* getEntryNode(const clang::CFGBlock* BB)
{ return BB; }
@@ -400,11 +424,11 @@ template <> struct GraphTraits<const clang::CFGBlock* > {
{ return N->succ_end(); }
};
-template <> struct GraphTraits<Inverse<const clang::CFGBlock*> > {
- typedef const clang::CFGBlock NodeType;
- typedef clang::CFGBlock::const_pred_iterator ChildIteratorType;
+template <> struct GraphTraits<Inverse<const ::clang::CFGBlock*> > {
+ typedef const ::clang::CFGBlock NodeType;
+ typedef ::clang::CFGBlock::const_pred_iterator ChildIteratorType;
- static NodeType *getEntryNode(Inverse<const clang::CFGBlock*> G)
+ static NodeType *getEntryNode(Inverse<const ::clang::CFGBlock*> G)
{ return G.Graph; }
static inline ChildIteratorType child_begin(NodeType* N)
@@ -416,36 +440,40 @@ template <> struct GraphTraits<Inverse<const clang::CFGBlock*> > {
// Traits for: CFG
-template <> struct GraphTraits<clang::CFG* >
- : public GraphTraits<clang::CFGBlock* > {
+template <> struct GraphTraits< ::clang::CFG* >
+ : public GraphTraits< ::clang::CFGBlock* > {
- typedef clang::CFG::iterator nodes_iterator;
+ typedef ::clang::CFG::iterator nodes_iterator;
- static NodeType *getEntryNode(clang::CFG* F) { return &F->getEntry(); }
- static nodes_iterator nodes_begin(clang::CFG* F) { return F->begin(); }
- static nodes_iterator nodes_end(clang::CFG* F) { return F->end(); }
+ static NodeType *getEntryNode(::clang::CFG* F) { return &F->getEntry(); }
+ static nodes_iterator nodes_begin(::clang::CFG* F) { return F->begin(); }
+ static nodes_iterator nodes_end(::clang::CFG* F) { return F->end(); }
};
-template <> struct GraphTraits< const clang::CFG* >
- : public GraphTraits< const clang::CFGBlock* > {
+template <> struct GraphTraits<const ::clang::CFG* >
+ : public GraphTraits<const ::clang::CFGBlock* > {
- typedef clang::CFG::const_iterator nodes_iterator;
+ typedef ::clang::CFG::const_iterator nodes_iterator;
- static NodeType *getEntryNode( const clang::CFG* F) { return &F->getEntry(); }
- static nodes_iterator nodes_begin( const clang::CFG* F) { return F->begin(); }
- static nodes_iterator nodes_end( const clang::CFG* F) { return F->end(); }
+ static NodeType *getEntryNode( const ::clang::CFG* F) {
+ return &F->getEntry();
+ }
+ static nodes_iterator nodes_begin( const ::clang::CFG* F) {
+ return F->begin();
+ }
+ static nodes_iterator nodes_end( const ::clang::CFG* F) {
+ return F->end();
+ }
};
-template <> struct GraphTraits<Inverse<const clang::CFG*> >
- : public GraphTraits<Inverse<const clang::CFGBlock*> > {
+template <> struct GraphTraits<Inverse<const ::clang::CFG*> >
+ : public GraphTraits<Inverse<const ::clang::CFGBlock*> > {
- typedef clang::CFG::const_iterator nodes_iterator;
+ typedef ::clang::CFG::const_iterator nodes_iterator;
- static NodeType *getEntryNode(const clang::CFG* F) { return &F->getExit(); }
- static nodes_iterator nodes_begin(const clang::CFG* F) { return F->begin();}
- static nodes_iterator nodes_end(const clang::CFG* F) { return F->end(); }
+ static NodeType *getEntryNode(const ::clang::CFG* F) { return &F->getExit(); }
+ static nodes_iterator nodes_begin(const ::clang::CFG* F) { return F->begin();}
+ static nodes_iterator nodes_end(const ::clang::CFG* F) { return F->end(); }
};
-
} // end llvm namespace
-
#endif
diff --git a/include/clang/Analysis/FlowSensitive/DataflowValues.h b/include/clang/Analysis/FlowSensitive/DataflowValues.h
index 648fe33ab0d4..7aa15c5b40ef 100644
--- a/include/clang/Analysis/FlowSensitive/DataflowValues.h
+++ b/include/clang/Analysis/FlowSensitive/DataflowValues.h
@@ -79,7 +79,7 @@ public:
/// InitializeValues - Invoked by the solver to initialize state needed for
/// dataflow analysis. This method is usually specialized by subclasses.
- void InitializeValues(const CFG& cfg) {};
+ void InitializeValues(const CFG& cfg) {}
/// getEdgeData - Retrieves the dataflow values associated with a
diff --git a/include/clang/Analysis/LocalCheckers.h b/include/clang/Analysis/LocalCheckers.h
index 8c70e4fc7b6c..9c343e078641 100644
--- a/include/clang/Analysis/LocalCheckers.h
+++ b/include/clang/Analysis/LocalCheckers.h
@@ -56,6 +56,8 @@ void RegisterExperimentalInternalChecks(GRExprEngine &Eng);
void CheckSecuritySyntaxOnly(const Decl *D, BugReporter &BR);
void CheckSizeofPointer(const Decl *D, BugReporter &BR);
+
+void RegisterCallInliner(GRExprEngine &Eng);
} // end namespace clang
#endif
diff --git a/include/clang/Analysis/PathDiagnostic.h b/include/clang/Analysis/PathDiagnostic.h
index 970b523e1b43..d380c45480cb 100644
--- a/include/clang/Analysis/PathDiagnostic.h
+++ b/include/clang/Analysis/PathDiagnostic.h
@@ -37,7 +37,7 @@ class PathDiagnosticClient : public DiagnosticClient {
public:
PathDiagnosticClient() {}
- virtual ~PathDiagnosticClient() {};
+ virtual ~PathDiagnosticClient() {}
virtual void
FlushDiagnostics(llvm::SmallVectorImpl<std::string> *FilesMade = 0) = 0;
diff --git a/include/clang/Analysis/PathSensitive/AnalysisContext.h b/include/clang/Analysis/PathSensitive/AnalysisContext.h
index abc33b778482..63ba558e3d5c 100644
--- a/include/clang/Analysis/PathSensitive/AnalysisContext.h
+++ b/include/clang/Analysis/PathSensitive/AnalysisContext.h
@@ -27,6 +27,7 @@ namespace clang {
class Decl;
class Stmt;
class CFG;
+class CFGBlock;
class LiveVariables;
class ParentMap;
class ImplicitParamDecl;
@@ -136,23 +137,38 @@ public:
};
class StackFrameContext : public LocationContext {
+ // The callsite where this stack frame is established.
const Stmt *CallSite;
+ // The parent block of the callsite.
+ const CFGBlock *Block;
+
+ // The index of the callsite in the CFGBlock.
+ unsigned Index;
+
friend class LocationContextManager;
StackFrameContext(AnalysisContext *ctx, const LocationContext *parent,
- const Stmt *s)
- : LocationContext(StackFrame, ctx, parent), CallSite(s) {}
+ const Stmt *s, const CFGBlock *blk, unsigned idx)
+ : LocationContext(StackFrame, ctx, parent), CallSite(s), Block(blk),
+ Index(idx) {}
public:
~StackFrameContext() {}
const Stmt *getCallSite() const { return CallSite; }
+ const CFGBlock *getCallSiteBlock() const { return Block; }
+
+ unsigned getIndex() const { return Index; }
+
void Profile(llvm::FoldingSetNodeID &ID);
static void Profile(llvm::FoldingSetNodeID &ID, AnalysisContext *ctx,
- const LocationContext *parent, const Stmt *s) {
+ const LocationContext *parent, const Stmt *s,
+ const CFGBlock *blk, unsigned idx) {
ProfileCommon(ID, StackFrame, ctx, parent, s);
+ ID.AddPointer(blk);
+ ID.AddInteger(idx);
}
static bool classof(const LocationContext* Ctx) {
@@ -230,7 +246,8 @@ public:
const StackFrameContext *getStackFrame(AnalysisContext *ctx,
const LocationContext *parent,
- const Stmt *s);
+ const Stmt *s, const CFGBlock *blk,
+ unsigned idx);
const ScopeContext *getScope(AnalysisContext *ctx,
const LocationContext *parent,
diff --git a/include/clang/Analysis/PathSensitive/AnalysisManager.h b/include/clang/Analysis/PathSensitive/AnalysisManager.h
index 9ef5cce1002b..8288864f2b61 100644
--- a/include/clang/Analysis/PathSensitive/AnalysisManager.h
+++ b/include/clang/Analysis/PathSensitive/AnalysisManager.h
@@ -73,7 +73,7 @@ public:
StoreManagerCreator getStoreManagerCreator() {
return CreateStoreMgr;
- };
+ }
ConstraintManagerCreator getConstraintManagerCreator() {
return CreateConstraintMgr;
@@ -132,14 +132,15 @@ public:
// Get the top level stack frame.
const StackFrameContext *getStackFrame(Decl const *D) {
- return LocCtxMgr.getStackFrame(AnaCtxMgr.getContext(D), 0, 0);
+ return LocCtxMgr.getStackFrame(AnaCtxMgr.getContext(D), 0, 0, 0, 0);
}
// Get a stack frame with parent.
StackFrameContext const *getStackFrame(Decl const *D,
LocationContext const *Parent,
- Stmt const *S) {
- return LocCtxMgr.getStackFrame(AnaCtxMgr.getContext(D), Parent, S);
+ Stmt const *S, const CFGBlock *Blk,
+ unsigned Idx) {
+ return LocCtxMgr.getStackFrame(AnaCtxMgr.getContext(D), Parent, S, Blk,Idx);
}
};
diff --git a/include/clang/Analysis/PathSensitive/BugReporter.h b/include/clang/Analysis/PathSensitive/BugReporter.h
index 58c80185435d..ccebf01b76af 100644
--- a/include/clang/Analysis/PathSensitive/BugReporter.h
+++ b/include/clang/Analysis/PathSensitive/BugReporter.h
@@ -203,7 +203,10 @@ public:
~RangedBugReport();
// FIXME: Move this out of line.
- void addRange(SourceRange R) { Ranges.push_back(R); }
+ void addRange(SourceRange R) {
+ assert(R.isValid());
+ Ranges.push_back(R);
+ }
// FIXME: Move this out of line.
void getRanges(const SourceRange*& beg, const SourceRange*& end) {
diff --git a/include/clang/Analysis/PathSensitive/Checker.h b/include/clang/Analysis/PathSensitive/Checker.h
index a625a7a25690..924a8b11b098 100644
--- a/include/clang/Analysis/PathSensitive/Checker.h
+++ b/include/clang/Analysis/PathSensitive/Checker.h
@@ -61,8 +61,12 @@ public:
return Eng;
}
+ AnalysisManager &getAnalysisManager() {
+ return Eng.getAnalysisManager();
+ }
+
ConstraintManager &getConstraintManager() {
- return Eng.getConstraintManager();
+ return Eng.getConstraintManager();
}
StoreManager &getStoreManager() {
@@ -265,6 +269,11 @@ public:
virtual bool EvalCallExpr(CheckerContext &C, const CallExpr *CE) {
return false;
}
+
+ virtual const GRState *EvalAssume(const GRState *state, SVal Cond,
+ bool Assumption) {
+ return state;
+ }
};
} // end clang namespace
diff --git a/include/clang/Analysis/PathSensitive/CheckerVisitor.def b/include/clang/Analysis/PathSensitive/CheckerVisitor.def
index 4144d1a0a734..7ec27efe5199 100644
--- a/include/clang/Analysis/PathSensitive/CheckerVisitor.def
+++ b/include/clang/Analysis/PathSensitive/CheckerVisitor.def
@@ -12,24 +12,27 @@
//===---------------------------------------------------------------------===//
#ifndef PREVISIT
-#define PREVISIT(NODE)
+#define PREVISIT(NODE, FALLBACK)
#endif
#ifndef POSTVISIT
-#define POSTVISIT(NODE)
+#define POSTVISIT(NODE, FALLBACK)
#endif
-PREVISIT(ArraySubscriptExpr)
-PREVISIT(BinaryOperator)
-PREVISIT(CallExpr)
-PREVISIT(CastExpr)
-PREVISIT(DeclStmt)
-PREVISIT(ObjCMessageExpr)
-PREVISIT(ReturnStmt)
+PREVISIT(ArraySubscriptExpr, Stmt)
+PREVISIT(BinaryOperator, Stmt)
+PREVISIT(CallExpr, Stmt)
+PREVISIT(CastExpr, Stmt)
+PREVISIT(CXXOperatorCallExpr, CallExpr)
+PREVISIT(DeclStmt, Stmt)
+PREVISIT(ObjCMessageExpr, Stmt)
+PREVISIT(ReturnStmt, Stmt)
-POSTVISIT(CallExpr)
-POSTVISIT(BlockExpr)
-POSTVISIT(BinaryOperator)
+POSTVISIT(BlockExpr, Stmt)
+POSTVISIT(BinaryOperator, Stmt)
+POSTVISIT(CallExpr, Stmt)
+POSTVISIT(CXXOperatorCallExpr, CallExpr)
+POSTVISIT(ObjCMessageExpr, Stmt)
#undef PREVISIT
#undef POSTVISIT
diff --git a/include/clang/Analysis/PathSensitive/CheckerVisitor.h b/include/clang/Analysis/PathSensitive/CheckerVisitor.h
index 7cef17eb6591..f5145bbb7a67 100644
--- a/include/clang/Analysis/PathSensitive/CheckerVisitor.h
+++ b/include/clang/Analysis/PathSensitive/CheckerVisitor.h
@@ -53,20 +53,20 @@ public:
static_cast<const BinaryOperator*>(S));
break;
-#define PREVISIT(NAME) \
+#define PREVISIT(NAME, FALLBACK) \
case Stmt::NAME ## Class:\
static_cast<ImplClass*>(this)->PreVisit ## NAME(C,static_cast<const NAME*>(S));\
break;
#include "clang/Analysis/PathSensitive/CheckerVisitor.def"
}
}
-
+
void PostVisit(CheckerContext &C, const Stmt *S) {
switch (S->getStmtClass()) {
default:
assert(false && "Unsupport statement.");
return;
-#define POSTVISIT(NAME) \
+#define POSTVISIT(NAME, FALLBACK) \
case Stmt::NAME ## Class:\
static_cast<ImplClass*>(this)->\
PostVisit ## NAME(C,static_cast<const NAME*>(S));\
@@ -75,12 +75,19 @@ break;
}
}
-#define PREVISIT(NAME) \
-void PreVisit ## NAME(CheckerContext &C, const NAME* S) {}
+ void PreVisitStmt(CheckerContext &C, const Stmt *S) {}
+ void PostVisitStmt(CheckerContext &C, const Stmt *S) {}
+
+#define PREVISIT(NAME, FALLBACK) \
+void PreVisit ## NAME(CheckerContext &C, const NAME* S) {\
+ PreVisit ## FALLBACK(C, S);\
+}
#include "clang/Analysis/PathSensitive/CheckerVisitor.def"
-#define POSTVISIT(NAME) \
-void PostVisit ## NAME(CheckerContext &C, const NAME* S) {}
+#define POSTVISIT(NAME, FALLBACK) \
+void PostVisit ## NAME(CheckerContext &C, const NAME* S) {\
+ PostVisit ## FALLBACK(C, S);\
+}
#include "clang/Analysis/PathSensitive/CheckerVisitor.def"
};
diff --git a/include/clang/Analysis/PathSensitive/ExplodedGraph.h b/include/clang/Analysis/PathSensitive/ExplodedGraph.h
index 76cab1ddc127..fb5e1b8a415f 100644
--- a/include/clang/Analysis/PathSensitive/ExplodedGraph.h
+++ b/include/clang/Analysis/PathSensitive/ExplodedGraph.h
@@ -207,7 +207,7 @@ class InterExplodedGraphMap {
public:
ExplodedNode* getMappedNode(const ExplodedNode* N) const;
- InterExplodedGraphMap() {};
+ InterExplodedGraphMap() {}
virtual ~InterExplodedGraphMap() {}
};
diff --git a/include/clang/Analysis/PathSensitive/GRCoreEngine.h b/include/clang/Analysis/PathSensitive/GRCoreEngine.h
index b78cc6adfc4a..74f7a147b841 100644
--- a/include/clang/Analysis/PathSensitive/GRCoreEngine.h
+++ b/include/clang/Analysis/PathSensitive/GRCoreEngine.h
@@ -75,8 +75,7 @@ class GRCoreEngine {
void ProcessEndPath(GREndPathNodeBuilder& Builder);
- void ProcessStmt(Stmt* S, GRStmtNodeBuilder& Builder);
-
+ void ProcessStmt(CFGElement E, GRStmtNodeBuilder& Builder);
bool ProcessBlockEntrance(CFGBlock* Blk, const GRState* State,
GRBlockCounter BC);
@@ -212,6 +211,8 @@ public:
/// of this builder.
CFGBlock* getBlock() const { return &B; }
+ unsigned getIndex() const { return Idx; }
+
void setAuditor(GRAuditor* A) { Auditor = A; }
const GRState* GetState(ExplodedNode* Pred) const {
@@ -402,7 +403,7 @@ public:
};
class GREndPathNodeBuilder {
- GRCoreEngine& Eng;
+ GRCoreEngine &Eng;
CFGBlock& B;
ExplodedNode* Pred;
@@ -415,6 +416,8 @@ public:
~GREndPathNodeBuilder();
+ GRWorkList &getWorkList() { return *Eng.WList; }
+
ExplodedNode* getPredecessor() const { return Pred; }
GRBlockCounter getBlockCounter() const {
diff --git a/include/clang/Analysis/PathSensitive/GRExprEngine.h b/include/clang/Analysis/PathSensitive/GRExprEngine.h
index 8b20a823c6a1..e05c6243846d 100644
--- a/include/clang/Analysis/PathSensitive/GRExprEngine.h
+++ b/include/clang/Analysis/PathSensitive/GRExprEngine.h
@@ -25,6 +25,7 @@
#include "clang/Analysis/PathSensitive/BugReporter.h"
#include "clang/AST/Type.h"
#include "clang/AST/ExprObjC.h"
+#include "clang/AST/ExprCXX.h"
namespace clang {
@@ -79,7 +80,7 @@ class GRExprEngine : public GRSubEngine {
typedef llvm::DenseMap<void *, unsigned> CheckerMap;
CheckerMap CheckerM;
- typedef std::vector<std::pair<void *, Checker*> >CheckersOrdered;
+ typedef std::vector<std::pair<void *, Checker*> > CheckersOrdered;
CheckersOrdered Checkers;
/// BR - The BugReporter associated with this engine. It is important that
@@ -110,10 +111,10 @@ public:
GRStmtNodeBuilder &getBuilder() { assert(Builder); return *Builder; }
/// setTransferFunctions
- void setTransferFunctions(GRTransferFuncs* tf);
+ void setTransferFunctionsAndCheckers(GRTransferFuncs* tf);
void setTransferFunctions(GRTransferFuncs& tf) {
- setTransferFunctions(&tf);
+ setTransferFunctionsAndCheckers(&tf);
}
/// ViewGraph - Visualize the ExplodedGraph created by executing the
@@ -149,7 +150,7 @@ public:
/// ProcessStmt - Called by GRCoreEngine. Used to generate new successor
/// nodes by processing the 'effects' of a block-level statement.
- void ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder);
+ void ProcessStmt(CFGElement E, GRStmtNodeBuilder& builder);
/// ProcessBlockEntrance - Called by GRCoreEngine when start processing
/// a CFGBlock. This method returns true if the analysis should continue
@@ -203,9 +204,10 @@ protected:
}
public:
- ExplodedNode* MakeNode(ExplodedNodeSet& Dst, Stmt* S, ExplodedNode* Pred, const GRState* St,
- ProgramPoint::Kind K = ProgramPoint::PostStmtKind,
- const void *tag = 0);
+ ExplodedNode* MakeNode(ExplodedNodeSet& Dst, Stmt* S, ExplodedNode* Pred,
+ const GRState* St,
+ ProgramPoint::Kind K = ProgramPoint::PostStmtKind,
+ const void *tag = 0);
protected:
/// CheckerVisit - Dispatcher for performing checker-specific logic
/// at specific statements.
@@ -263,15 +265,11 @@ protected:
/// VisitCall - Transfer function for function calls.
void VisitCall(CallExpr* CE, ExplodedNode* Pred,
CallExpr::arg_iterator AI, CallExpr::arg_iterator AE,
- ExplodedNodeSet& Dst);
- void VisitCallRec(CallExpr* CE, ExplodedNode* Pred,
- CallExpr::arg_iterator AI, CallExpr::arg_iterator AE,
- ExplodedNodeSet& Dst, const FunctionProtoType *,
- unsigned ParamIdx = 0);
+ ExplodedNodeSet& Dst, bool asLValue);
/// VisitCast - Transfer function logic for all casts (implicit and explicit).
void VisitCast(Expr* CastE, Expr* Ex, ExplodedNode* Pred,
- ExplodedNodeSet& Dst);
+ ExplodedNodeSet& Dst, bool asLValue);
/// VisitCompoundLiteralExpr - Transfer function logic for compound literals.
void VisitCompoundLiteralExpr(CompoundLiteralExpr* CL, ExplodedNode* Pred,
@@ -295,6 +293,11 @@ protected:
void VisitGuardedExpr(Expr* Ex, Expr* L, Expr* R, ExplodedNode* Pred,
ExplodedNodeSet& Dst);
+ /// VisitCondInit - Transfer function for handling the initialization
+ /// of a condition variable in an IfStmt, SwitchStmt, etc.
+ void VisitCondInit(VarDecl *VD, Stmt *S, ExplodedNode *Pred,
+ ExplodedNodeSet& Dst);
+
void VisitInitListExpr(InitListExpr* E, ExplodedNode* Pred,
ExplodedNodeSet& Dst);
@@ -315,19 +318,24 @@ protected:
void VisitObjCForCollectionStmt(ObjCForCollectionStmt* S, ExplodedNode* Pred,
ExplodedNodeSet& Dst);
- void VisitObjCForCollectionStmtAux(ObjCForCollectionStmt* S, ExplodedNode* Pred,
+ void VisitObjCForCollectionStmtAux(ObjCForCollectionStmt* S,
+ ExplodedNode* Pred,
ExplodedNodeSet& Dst, SVal ElementV);
/// VisitObjCMessageExpr - Transfer function for ObjC message expressions.
- void VisitObjCMessageExpr(ObjCMessageExpr* ME, ExplodedNode* Pred, ExplodedNodeSet& Dst);
+ void VisitObjCMessageExpr(ObjCMessageExpr* ME, ExplodedNode* Pred,
+ ExplodedNodeSet& Dst, bool asLValue);
void VisitObjCMessageExprArgHelper(ObjCMessageExpr* ME,
ObjCMessageExpr::arg_iterator I,
ObjCMessageExpr::arg_iterator E,
- ExplodedNode* Pred, ExplodedNodeSet& Dst);
+ ExplodedNode* Pred, ExplodedNodeSet& Dst,
+ bool asLValue);
- void VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME, ExplodedNode* Pred,
- ExplodedNodeSet& Dst);
+ void VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME,
+ ExplodedNode* Pred,
+ ExplodedNodeSet& Dst,
+ bool asLValue);
/// VisitReturnStmt - Transfer function logic for return statements.
void VisitReturnStmt(ReturnStmt* R, ExplodedNode* Pred, ExplodedNodeSet& Dst);
@@ -337,8 +345,11 @@ protected:
ExplodedNodeSet& Dst);
/// VisitUnaryOperator - Transfer function logic for unary operators.
- void VisitUnaryOperator(UnaryOperator* B, ExplodedNode* Pred, ExplodedNodeSet& Dst,
- bool asLValue);
+ void VisitUnaryOperator(UnaryOperator* B, ExplodedNode* Pred,
+ ExplodedNodeSet& Dst, bool asLValue);
+
+ void VisitCXXThisExpr(CXXThisExpr *TE, ExplodedNode *Pred,
+ ExplodedNodeSet & Dst);
/// EvalEagerlyAssume - Given the nodes in 'Src', eagerly assume symbolic
/// expressions of the form 'x != 0' and generate new nodes (stored in Dst)
@@ -353,9 +364,6 @@ protected:
return X.isValid() ? SVator.EvalComplement(cast<NonLoc>(X)) : X;
}
- bool EvalBuiltinFunction(const FunctionDecl *FD, CallExpr *CE,
- ExplodedNode *Pred, ExplodedNodeSet &Dst);
-
public:
SVal EvalBinOp(const GRState *state, BinaryOperator::Opcode op,
@@ -365,7 +373,7 @@ public:
SVal EvalBinOp(const GRState *state, BinaryOperator::Opcode op,
NonLoc L, SVal R, QualType T) {
- return R.isValid() ? SVator.EvalBinOpNN(state, op, L, cast<NonLoc>(R), T) : R;
+ return R.isValid() ? SVator.EvalBinOpNN(state,op,L, cast<NonLoc>(R), T) : R;
}
SVal EvalBinOp(const GRState *ST, BinaryOperator::Opcode Op,
@@ -399,15 +407,19 @@ public:
// FIXME: 'tag' should be removed, and a LocationContext should be used
// instead.
- void EvalLocation(ExplodedNodeSet &Dst, Stmt *S, ExplodedNode* Pred,
- const GRState* St, SVal location,
- const void *tag, bool isLoad);
-
- // FIXME: 'tag' should be removed, and a LocationContext should be used
- // instead.
void EvalStore(ExplodedNodeSet& Dst, Expr* AssignE, Expr* StoreE,
ExplodedNode* Pred, const GRState* St, SVal TargetLV, SVal Val,
const void *tag = 0);
+private:
+ void EvalLoadCommon(ExplodedNodeSet& Dst, Expr* Ex, ExplodedNode* Pred,
+ const GRState* St, SVal location, const void *tag,
+ QualType LoadTy);
+
+ // FIXME: 'tag' should be removed, and a LocationContext should be used
+ // instead.
+ void EvalLocation(ExplodedNodeSet &Dst, Stmt *S, ExplodedNode* Pred,
+ const GRState* St, SVal location,
+ const void *tag, bool isLoad);
};
} // end clang namespace
diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h
index 421ebbf9bd5e..424b0d77e84c 100644
--- a/include/clang/Analysis/PathSensitive/GRState.h
+++ b/include/clang/Analysis/PathSensitive/GRState.h
@@ -41,6 +41,7 @@ namespace clang {
class GRStateManager;
class GRTransferFuncs;
+class Checker;
typedef ConstraintManager* (*ConstraintManagerCreator)(GRStateManager&);
typedef StoreManager* (*StoreManagerCreator)(GRStateManager&);
@@ -160,6 +161,9 @@ public:
SymbolManager &getSymbolManager() const;
GRTransferFuncs &getTransferFuncs() const;
+ std::vector<std::pair<void *, Checker *> >::iterator checker_begin() const;
+ std::vector<std::pair<void *, Checker *> >::iterator checker_end() const;
+
//==---------------------------------------------------------------------==//
// Constraints on values.
//==---------------------------------------------------------------------==//
@@ -418,6 +422,9 @@ private:
/// for manipulating and creating SVals.
GRTransferFuncs* TF;
+ /// Reference to all checkers in GRExprEngine.
+ std::vector<std::pair<void *, Checker*> > *Checkers;
+
public:
GRStateManager(ASTContext& Ctx,
@@ -441,6 +448,8 @@ public:
GRTransferFuncs& getTransferFuncs() { return *TF; }
+ std::vector<std::pair<void *, Checker *> > &getCheckers() { return *Checkers;}
+
BasicValueFactory &getBasicVals() {
return ValueMgr.getBasicValueFactory();
}
@@ -697,6 +706,16 @@ inline GRTransferFuncs &GRState::getTransferFuncs() const {
return getStateManager().getTransferFuncs();
}
+inline std::vector<std::pair<void *, Checker *> >::iterator
+GRState::checker_begin() const {
+ return getStateManager().getCheckers().begin();
+}
+
+inline std::vector<std::pair<void *, Checker *> >::iterator
+GRState::checker_end() const {
+ return getStateManager().getCheckers().end();
+}
+
template<typename T>
const GRState *GRState::add(typename GRStateTrait<T>::key_type K) const {
return getStateManager().add<T>(this, K, get_context<T>());
diff --git a/include/clang/Analysis/PathSensitive/GRSubEngine.h b/include/clang/Analysis/PathSensitive/GRSubEngine.h
index 62e36f9e641e..330742d8bf99 100644
--- a/include/clang/Analysis/PathSensitive/GRSubEngine.h
+++ b/include/clang/Analysis/PathSensitive/GRSubEngine.h
@@ -17,6 +17,7 @@ namespace clang {
class Stmt;
class CFGBlock;
+class CFGElement;
class GRState;
class GRStateManager;
class GRBlockCounter;
@@ -37,7 +38,7 @@ public:
/// ProcessStmt - Called by GRCoreEngine. Used to generate new successor
/// nodes by processing the 'effects' of a block-level statement.
- virtual void ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder) = 0;
+ virtual void ProcessStmt(CFGElement E, GRStmtNodeBuilder& builder) = 0;
/// ProcessBlockEntrance - Called by GRCoreEngine when start processing
/// a CFGBlock. This method returns true if the analysis should continue
diff --git a/include/clang/Analysis/PathSensitive/GRTransferFuncs.h b/include/clang/Analysis/PathSensitive/GRTransferFuncs.h
index 2594618c16db..b058460a4934 100644
--- a/include/clang/Analysis/PathSensitive/GRTransferFuncs.h
+++ b/include/clang/Analysis/PathSensitive/GRTransferFuncs.h
@@ -80,9 +80,6 @@ public:
return state;
}
};
-
-GRTransferFuncs *CreateCallInliner(ASTContext &ctx);
-
} // end clang namespace
#endif
diff --git a/include/clang/Analysis/PathSensitive/MemRegion.h b/include/clang/Analysis/PathSensitive/MemRegion.h
index 2fe5ea0cf3ab..b57cfd7b5205 100644
--- a/include/clang/Analysis/PathSensitive/MemRegion.h
+++ b/include/clang/Analysis/PathSensitive/MemRegion.h
@@ -72,8 +72,8 @@ public:
VarRegionKind = BEG_DECL_REGIONS,
FieldRegionKind,
ObjCIvarRegionKind,
- ObjCObjectRegionKind,
- END_DECL_REGIONS = ObjCObjectRegionKind,
+ CXXObjectRegionKind,
+ END_DECL_REGIONS = CXXObjectRegionKind,
END_TYPED_REGIONS = END_DECL_REGIONS
};
@@ -662,33 +662,6 @@ public:
}
};
-class ObjCObjectRegion : public DeclRegion {
-
- friend class MemRegionManager;
-
- ObjCObjectRegion(const ObjCInterfaceDecl* ivd, const MemRegion* sReg)
- : DeclRegion(ivd, sReg, ObjCObjectRegionKind) {}
-
- static void ProfileRegion(llvm::FoldingSetNodeID& ID,
- const ObjCInterfaceDecl* ivd,
- const MemRegion* superRegion) {
- DeclRegion::ProfileRegion(ID, ivd, superRegion, ObjCObjectRegionKind);
- }
-
-public:
- const ObjCInterfaceDecl* getInterface() const {
- return cast<ObjCInterfaceDecl>(D);
- }
-
- QualType getValueType(ASTContext& C) const {
- return C.getObjCInterfaceType(getInterface());
- }
-
- static bool classof(const MemRegion* R) {
- return R->getKind() == ObjCObjectRegionKind;
- }
-};
-
class ObjCIvarRegion : public DeclRegion {
friend class MemRegionManager;
@@ -752,6 +725,30 @@ public:
}
};
+class CXXObjectRegion : public TypedRegion {
+ friend class MemRegionManager;
+
+ // T - The object type.
+ QualType T;
+
+ CXXObjectRegion(QualType t, const MemRegion *sReg)
+ : TypedRegion(sReg, CXXObjectRegionKind), T(t) {}
+
+ static void ProfileRegion(llvm::FoldingSetNodeID &ID,
+ QualType T, const MemRegion *sReg);
+
+public:
+ QualType getValueType(ASTContext& C) const {
+ return T;
+ }
+
+ void Profile(llvm::FoldingSetNodeID &ID) const;
+
+ static bool classof(const MemRegion* R) {
+ return R->getKind() == CXXObjectRegionKind;
+ }
+};
+
template<typename RegionTy>
const RegionTy* MemRegion::getAs() const {
if (const RegionTy* RT = dyn_cast<RegionTy>(this))
@@ -865,11 +862,6 @@ public:
return getFieldRegion(FR->getDecl(), superRegion);
}
- /// getObjCObjectRegion - Retrieve or create the memory region associated with
- /// the instance of a specified Objective-C class.
- const ObjCObjectRegion* getObjCObjectRegion(const ObjCInterfaceDecl* ID,
- const MemRegion* superRegion);
-
/// getObjCIvarRegion - Retrieve or create the memory region associated with
/// a specified Objective-c instance variable. 'superRegion' corresponds
/// to the containing region (which typically represents the Objective-C
@@ -877,6 +869,8 @@ public:
const ObjCIvarRegion *getObjCIvarRegion(const ObjCIvarDecl* ivd,
const MemRegion* superRegion);
+ const CXXObjectRegion *getCXXObjectRegion(QualType T);
+
const FunctionTextRegion *getFunctionTextRegion(const FunctionDecl *FD);
const BlockTextRegion *getBlockTextRegion(const BlockDecl *BD,
CanQualType locTy,
diff --git a/include/clang/Analysis/PathSensitive/SVals.h b/include/clang/Analysis/PathSensitive/SVals.h
index 8b5cf40e29cb..9206817989db 100644
--- a/include/clang/Analysis/PathSensitive/SVals.h
+++ b/include/clang/Analysis/PathSensitive/SVals.h
@@ -58,7 +58,7 @@ protected:
public:
SVal() : Data(0), Kind(0) {}
- ~SVal() {};
+ ~SVal() {}
/// BufferTy - A temporary buffer to hold a set of SVals.
typedef llvm::SmallVector<SVal,5> BufferTy;
@@ -244,7 +244,8 @@ public:
}
static inline bool IsLocType(QualType T) {
- return T->isAnyPointerType() || T->isBlockPointerType();
+ return T->isAnyPointerType() || T->isBlockPointerType() ||
+ T->isReferenceType();
}
};
diff --git a/include/clang/Analysis/PathSensitive/Store.h b/include/clang/Analysis/PathSensitive/Store.h
index 648710f7ad12..52d73da15bc1 100644
--- a/include/clang/Analysis/PathSensitive/Store.h
+++ b/include/clang/Analysis/PathSensitive/Store.h
@@ -103,6 +103,9 @@ public:
virtual SVal getLValueElement(QualType elementType, SVal offset, SVal Base)=0;
+ // T - the object type.
+ Loc getThisObject(QualType T);
+
// FIXME: Make out-of-line.
virtual DefinedOrUnknownSVal getSizeInElements(const GRState *state,
const MemRegion *region) {
@@ -201,7 +204,7 @@ public:
class Visitor {
public:
- virtual ~Visitor() {};
+ virtual ~Visitor() {}
virtual bool Visit(const MemRegion* Parent, const MemRegion* SubRegion) = 0;
};
diff --git a/include/clang/Analysis/PathSensitive/ValueManager.h b/include/clang/Analysis/PathSensitive/ValueManager.h
index ef4e069ce8e8..9cec3c421fbe 100644
--- a/include/clang/Analysis/PathSensitive/ValueManager.h
+++ b/include/clang/Analysis/PathSensitive/ValueManager.h
@@ -97,13 +97,6 @@ public:
DefinedOrUnknownSVal getRegionValueSymbolVal(const MemRegion *R,
QualType T = QualType());
- DefinedOrUnknownSVal getRegionValueSymbolValOrUnknown(const MemRegion *R,
- QualType T) {
- if (SymMgr.canSymbolicate(T))
- return getRegionValueSymbolVal(R, T);
- return UnknownVal();
- }
-
DefinedOrUnknownSVal getConjuredSymbolVal(const void *SymbolTag,
const Expr *E, unsigned Count);
DefinedOrUnknownSVal getConjuredSymbolVal(const void *SymbolTag,
diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h
index 5abe1abd5d39..332f9d384f0c 100644
--- a/include/clang/Analysis/ProgramPoint.h
+++ b/include/clang/Analysis/ProgramPoint.h
@@ -108,9 +108,13 @@ public:
return const_cast<CFGBlock*>(reinterpret_cast<const CFGBlock*>(getData1()));
}
- Stmt* getFirstStmt() const {
+ CFGElement getFirstElement() const {
const CFGBlock* B = getBlock();
- return B->empty() ? NULL : B->front();
+ return B->empty() ? CFGElement() : B->front();
+ }
+
+ Stmt *getFirstStmt() const {
+ return getFirstElement().getStmt();
}
static bool classof(const ProgramPoint* Location) {
@@ -129,7 +133,7 @@ public:
Stmt* getLastStmt() const {
const CFGBlock* B = getBlock();
- return B->empty() ? NULL : B->back();
+ return B->empty() ? CFGElement() : B->back();
}
Stmt* getTerminator() const {
diff --git a/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h b/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
index afc63616e9fc..d627b88967f2 100644
--- a/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
+++ b/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
@@ -20,6 +20,7 @@
#include "clang/Analysis/Visitors/CFGRecStmtVisitor.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
+#include "clang/AST/DeclCXX.h"
#define DISPATCH_CASE(CASE,CLASS) \
case Decl::CASE: \
@@ -55,6 +56,7 @@ 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)
@@ -69,6 +71,7 @@ public:
DEFAULT_DISPATCH(VarDecl)
DEFAULT_DISPATCH(FunctionDecl)
+ DEFAULT_DISPATCH(CXXMethodDecl)
DEFAULT_DISPATCH_VARDECL(ParmVarDecl)
DEFAULT_DISPATCH(ImplicitParamDecl)
DEFAULT_DISPATCH(EnumConstantDecl)
diff --git a/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h b/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h
index 83700a3a346d..75a4ac66012e 100644
--- a/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h
+++ b/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h
@@ -25,6 +25,25 @@ public:
void VisitStmt(Stmt* S) {
static_cast< ImplClass* >(this)->VisitChildren(S);
}
+
+ void VisitConditionVariableInit(Stmt *S) {
+ assert(S == this->getCurrentBlkStmt());
+ VarDecl *CondVar = 0;
+ switch (S->getStmtClass()) {
+#define CONDVAR_CASE(CLASS) \
+case Stmt::CLASS ## Class:\
+CondVar = cast<CLASS>(S)->getConditionVariable();\
+break;
+ CONDVAR_CASE(IfStmt)
+ CONDVAR_CASE(ForStmt)
+ CONDVAR_CASE(SwitchStmt)
+ CONDVAR_CASE(WhileStmt)
+#undef CONDVAR_CASE
+ default:
+ assert(false && "Infeasible");
+ }
+ static_cast<ImplClass*>(this)->Visit(CondVar->getInit());
+ }
// Defining operator() allows the visitor to be used as a C++ style functor.
void operator()(Stmt* S) { static_cast<ImplClass*>(this)->BlockStmt_Visit(S);}
diff --git a/include/clang/Analysis/Visitors/CFGStmtVisitor.h b/include/clang/Analysis/Visitors/CFGStmtVisitor.h
index 426b9ccd8a23..8a85ec15cdce 100644
--- a/include/clang/Analysis/Visitors/CFGStmtVisitor.h
+++ b/include/clang/Analysis/Visitors/CFGStmtVisitor.h
@@ -54,6 +54,13 @@ public:
else
return RetTy();
}
+
+ /// VisitConditionVariableInit - Handle the initialization of condition
+ /// variables at branches. Valid statements include IfStmt, ForStmt,
+ /// WhileStmt, and SwitchStmt.
+ RetTy VisitConditionVariableInit(Stmt *S) {
+ return RetTy();
+ }
/// BlockVisit_XXX - Visitor methods for visiting the "root" statements in
/// CFGBlocks. Root statements are the statements that appear explicitly in
@@ -65,6 +72,11 @@ public:
NullifyStmt cleanup(CurrentBlkStmt);
switch (S->getStmtClass()) {
+ case Stmt::IfStmtClass:
+ case Stmt::ForStmtClass:
+ case Stmt::WhileStmtClass:
+ case Stmt::SwitchStmtClass:
+ return static_cast<ImplClass*>(this)->VisitConditionVariableInit(S);
DISPATCH_CASE(StmtExpr)
DISPATCH_CASE(ConditionalOperator)
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def
index e700cdeb5d6c..14f735655f13 100644
--- a/include/clang/Basic/Builtins.def
+++ b/include/clang/Basic/Builtins.def
@@ -76,9 +76,9 @@
#endif
// Standard libc/libm functions:
-BUILTIN(__builtin_atan2 , "ddd" , "nc")
-BUILTIN(__builtin_atan2f, "fff" , "nc")
-BUILTIN(__builtin_atan2l, "LdLdLd", "nc")
+BUILTIN(__builtin_atan2 , "ddd" , "Fnc")
+BUILTIN(__builtin_atan2f, "fff" , "Fnc")
+BUILTIN(__builtin_atan2l, "LdLdLd", "Fnc")
BUILTIN(__builtin_abs , "ii" , "ncF")
BUILTIN(__builtin_copysign, "ddd", "ncF")
BUILTIN(__builtin_copysignf, "fff", "ncF")
@@ -86,36 +86,36 @@ BUILTIN(__builtin_copysignl, "LdLdLd", "ncF")
BUILTIN(__builtin_fabs , "dd" , "ncF")
BUILTIN(__builtin_fabsf, "ff" , "ncF")
BUILTIN(__builtin_fabsl, "LdLd", "ncF")
-BUILTIN(__builtin_fmod , "ddd" , "nc")
-BUILTIN(__builtin_fmodf, "fff" , "nc")
-BUILTIN(__builtin_fmodl, "LdLdLd", "nc")
-BUILTIN(__builtin_frexp , "ddi*" , "nc")
-BUILTIN(__builtin_frexpf, "ffi*" , "nc")
-BUILTIN(__builtin_frexpl, "LdLdi*", "nc")
+BUILTIN(__builtin_fmod , "ddd" , "Fnc")
+BUILTIN(__builtin_fmodf, "fff" , "Fnc")
+BUILTIN(__builtin_fmodl, "LdLdLd", "Fnc")
+BUILTIN(__builtin_frexp , "ddi*" , "Fnc")
+BUILTIN(__builtin_frexpf, "ffi*" , "Fnc")
+BUILTIN(__builtin_frexpl, "LdLdi*", "Fnc")
BUILTIN(__builtin_huge_val, "d", "nc")
BUILTIN(__builtin_huge_valf, "f", "nc")
BUILTIN(__builtin_huge_vall, "Ld", "nc")
BUILTIN(__builtin_inf , "d" , "nc")
BUILTIN(__builtin_inff , "f" , "nc")
BUILTIN(__builtin_infl , "Ld" , "nc")
-BUILTIN(__builtin_ldexp , "ddi" , "nc")
-BUILTIN(__builtin_ldexpf, "ffi" , "nc")
-BUILTIN(__builtin_ldexpl, "LdLdi", "nc")
-BUILTIN(__builtin_modf , "ddd*" , "nc")
-BUILTIN(__builtin_modff, "fff*" , "nc")
-BUILTIN(__builtin_modfl, "LdLdLd*", "nc")
+BUILTIN(__builtin_ldexp , "ddi" , "Fnc")
+BUILTIN(__builtin_ldexpf, "ffi" , "Fnc")
+BUILTIN(__builtin_ldexpl, "LdLdi", "Fnc")
+BUILTIN(__builtin_modf , "ddd*" , "Fnc")
+BUILTIN(__builtin_modff, "fff*" , "Fnc")
+BUILTIN(__builtin_modfl, "LdLdLd*", "Fnc")
BUILTIN(__builtin_nan, "dcC*" , "ncF")
BUILTIN(__builtin_nanf, "fcC*" , "ncF")
BUILTIN(__builtin_nanl, "LdcC*", "ncF")
BUILTIN(__builtin_nans, "dcC*" , "ncF")
BUILTIN(__builtin_nansf, "fcC*" , "ncF")
BUILTIN(__builtin_nansl, "LdcC*", "ncF")
-BUILTIN(__builtin_powi , "ddi" , "nc")
-BUILTIN(__builtin_powif, "ffi" , "nc")
-BUILTIN(__builtin_powil, "LdLdi", "nc")
-BUILTIN(__builtin_pow , "ddd" , "nc")
-BUILTIN(__builtin_powf, "fff" , "nc")
-BUILTIN(__builtin_powl, "LdLdLd", "nc")
+BUILTIN(__builtin_powi , "ddi" , "Fnc")
+BUILTIN(__builtin_powif, "ffi" , "Fnc")
+BUILTIN(__builtin_powil, "LdLdi", "Fnc")
+BUILTIN(__builtin_pow , "ddd" , "Fnc")
+BUILTIN(__builtin_powf, "fff" , "Fnc")
+BUILTIN(__builtin_powl, "LdLdLd", "Fnc")
// Standard unary libc/libm functions with double/float/long double variants:
BUILTIN(__builtin_acos , "dd" , "Fnc")
@@ -142,6 +142,9 @@ BUILTIN(__builtin_expl, "LdLd", "Fnc")
BUILTIN(__builtin_floor , "dd" , "Fnc")
BUILTIN(__builtin_floorf, "ff" , "Fnc")
BUILTIN(__builtin_floorl, "LdLd", "Fnc")
+BUILTIN(__builtin_hypot , "ddd" , "Fnc")
+BUILTIN(__builtin_hypotf, "fff" , "Fnc")
+BUILTIN(__builtin_hypotl, "LdLdLd", "Fnc")
BUILTIN(__builtin_log , "dd" , "Fnc")
BUILTIN(__builtin_log10 , "dd" , "Fnc")
BUILTIN(__builtin_log10f, "ff" , "Fnc")
@@ -475,6 +478,7 @@ BUILTIN(__sync_fetch_and_umax, "UiUi*Ui", "n")
// C99 library functions
// C99 stdlib.h
+LIBBUILTIN(abort, "v", "fr", "stdlib.h")
LIBBUILTIN(calloc, "v*zz", "f", "stdlib.h")
LIBBUILTIN(exit, "vi", "fr", "stdlib.h")
LIBBUILTIN(_Exit, "vi", "fr", "stdlib.h")
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index b2523f28d5e0..a2ccea7525ac 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -45,7 +45,7 @@ namespace clang {
DIAG_START_PARSE = DIAG_START_LEX + 300,
DIAG_START_AST = DIAG_START_PARSE + 300,
DIAG_START_SEMA = DIAG_START_AST + 100,
- DIAG_START_ANALYSIS = DIAG_START_SEMA + 1100,
+ DIAG_START_ANALYSIS = DIAG_START_SEMA + 1500,
DIAG_UPPER_LIMIT = DIAG_START_ANALYSIS + 100
};
@@ -76,7 +76,10 @@ namespace clang {
/// Map this diagnostic to "warning", but make it immune to -Werror. This
/// happens when you specify -Wno-error=foo.
- MAP_WARNING_NO_WERROR = 5
+ MAP_WARNING_NO_WERROR = 5,
+ /// Map this diagnostic to "error", but make it immune to -Wfatal-errors.
+ /// This happens for -Wno-fatal-errors=foo.
+ MAP_ERROR_NO_WFATAL = 6
};
}
@@ -178,6 +181,7 @@ private:
unsigned char AllExtensionsSilenced; // Used by __extension__
bool IgnoreAllWarnings; // Ignore all warnings: -w
bool WarningsAsErrors; // Treat warnings like errors:
+ bool ErrorsAsFatal; // Treat errors like fatal errors.
bool SuppressSystemWarnings; // Suppress warnings in system headers.
bool SuppressAllDiagnostics; // Suppress all diagnostics.
ExtensionHandling ExtBehavior; // Map extensions onto warnings or errors?
@@ -260,6 +264,11 @@ public:
void setWarningsAsErrors(bool Val) { WarningsAsErrors = Val; }
bool getWarningsAsErrors() const { return WarningsAsErrors; }
+ /// setErrorsAsFatal - When set to true, any error reported is made a
+ /// fatal error.
+ void setErrorsAsFatal(bool Val) { ErrorsAsFatal = Val; }
+ bool getErrorsAsFatal() const { return ErrorsAsFatal; }
+
/// setSuppressSystemWarnings - When set to true mask warnings that
/// come from system headers.
void setSuppressSystemWarnings(bool Val) { SuppressSystemWarnings = Val; }
diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td
index f319cf231a26..7e14a329dcab 100644
--- a/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/include/clang/Basic/DiagnosticCommonKinds.td
@@ -56,6 +56,7 @@ def note_invalid_subexpr_in_ice : Note<
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_invalid_feature : Error<"invalid target feature '%0'">;
diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td
index 252900d18b3f..66a841a8afae 100644
--- a/include/clang/Basic/DiagnosticFrontendKinds.td
+++ b/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -219,4 +219,7 @@ def err_not_a_pch_file : Error<
def warn_unknown_warning_option : Warning<
"unknown warning option '%0'">,
InGroup<DiagGroup<"unknown-warning-option"> >;
+def warn_unknown_warning_specifier : Warning<
+ "unknown %0 warning specifier: '%1'">,
+ InGroup<DiagGroup<"unknown-warning-option"> >;
}
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td
index 761478abd3d4..03aad8606352 100644
--- a/include/clang/Basic/DiagnosticGroups.td
+++ b/include/clang/Basic/DiagnosticGroups.td
@@ -171,8 +171,9 @@ def Most : DiagGroup<"most", [
def : DiagGroup<"all", [Most, Parentheses]>;
// Aliases.
-def : DiagGroup<"", [Extra]>; // -W = -Wextra
-def : DiagGroup<"endif-labels", [ExtraTokens]>; // endif-labels = endif-tokens
+def : DiagGroup<"", [Extra]>; // -W = -Wextra
+def : DiagGroup<"endif-labels", [ExtraTokens]>; // -Wendif-labels=-Wendif-tokens
+def : DiagGroup<"comments", [Comment]>; // -Wcomments = -Wcomment
// A warning group for warnings that we want to have on by default in clang,
// but which aren't on by default in GCC.
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index bf188cf14f91..98a74a5a0395 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -229,6 +229,8 @@ def warn_parens_disambiguated_as_function_decl : Warning<
"parentheses were disambiguated as a function declarator">;
def err_expected_member_or_base_name : Error<
"expected class member or base class name">;
+def err_expected_lbrace_after_base_specifiers : Error<
+ "expected '{' after base class list">;
def ext_ellipsis_exception_spec : Extension<
"exception specification of '...' is a Microsoft extension">;
def err_expected_catch : Error<"expected catch">;
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index a890323e6c0d..155633b08f3b 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -26,9 +26,13 @@ def ext_null_pointer_expr_not_ice : Extension<
-// Semantic analysis of string and character constant literals.
+// Semantic analysis of constant literals.
def ext_predef_outside_function : Warning<
"predefined identifier is only valid inside function">;
+def err_float_overflow : Error<
+ "magnitude of floating-point constant too large for type %0; maximum is %1">;
+def err_float_underflow : Error<
+ "magnitude of floating-point constant too small for type %0; minimum is %1">;
// C99 Designated Initializers
def err_array_designator_negative : Error<
@@ -182,11 +186,12 @@ def warn_unusual_main_decl : Warning<"'main' should not be declared "
def err_unusual_main_decl : Error<"'main' is not allowed to be declared "
"%select{static|inline|static or inline}0">;
def err_main_returns_nonint : Error<"'main' must return 'int'">;
-def err_main_surplus_args : Error<"%0 is too many arguments for 'main': "
+def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
"must be 0, 2, or 3">;
-def warn_main_one_arg : Warning<"one-argument 'main' is usually a mistake">;
-def err_main_arg_wrong : Error<"%select{first|second|third}0 argument of "
- "'main' should be of type %1">;
+def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">;
+def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
+ "parameter of 'main' (%select{argument count|argument array|environment|"
+ "platform-specific data}0) must be of type %1">;
/// parser diagnostics
def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">;
@@ -305,6 +310,8 @@ def note_property_declare : Note<
"property declared here">;
def error_synthesize_category_decl : Error<
"@synthesize not allowed in a category's implementation">;
+def error_reference_property : Error<
+ "property of reference type is not supported">;
def error_missing_property_interface : Error<
"property implementation in a category with no category declaration">;
def error_bad_category_property_decl : Error<
@@ -349,8 +356,6 @@ def err_enum_friend : Error<
"enum types cannot be friends">;
def err_friend_is_member : Error<
"friends cannot be members of the declaring class">;
-def ext_friend_inner_class : Extension<
- "C++ 98 does not allow inner classes as friends">;
def err_unelaborated_friend_type : Error<
"must specify '%select{struct|union|class|enum}0' to befriend %1">;
def err_qualified_friend_not_found : Error<
@@ -492,6 +497,9 @@ def err_covariant_return_ambiguous_derived_to_base_conv : Error<
def err_covariant_return_not_derived : Error<
"return type of virtual function %0 is not covariant with the return type of "
"the function it overrides (%1 is not derived from %2)">;
+def err_covariant_return_incomplete : Error<
+ "return type of virtual function %0 is not covariant with the return type of "
+ "the function it overrides (%1 is incomplete)">;
def err_covariant_return_type_different_qualifications : Error<
"return type of virtual function %0 is not covariant with the return type of "
"the function it overrides (%1 has different qualifiers than %2)">;
@@ -525,15 +533,19 @@ def err_destructor_name : Error<
"expected the class name after '~' to name the enclosing class">;
// C++ initialization
+def err_init_conversion_failed : Error<
+ "cannot initialize %select{a variable|a parameter|return object|an "
+ "exception object|a value|a base class|a member subobject|an array element}0"
+ " of type %1 with an %select{rvalue|lvalue}2 of type %3">;
+
def err_lvalue_to_rvalue_ref : Error<"rvalue reference cannot bind to lvalue">;
def err_invalid_initialization : Error<
"invalid initialization of reference of type %0 from expression of type %1">;
def err_lvalue_to_rvalue_ambig_ref : Error<"rvalue reference cannot bind to lvalue "
"due to multiple conversion functions">;
-// FIXME: passing in an English string as %1!
def err_not_reference_to_const_init : Error<
"non-const lvalue reference to type %0 cannot be initialized "
- "with a %1 of type %2">;
+ "with a %select{value|temporary}1 of type %2">;
def err_lvalue_reference_bind_to_temporary : Error<
"non-const lvalue reference to type %0 cannot bind to a temporary of type "
"%1">;
@@ -551,9 +563,8 @@ def err_init_list_bad_dest_type : Error<
"%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
"list">;
-// FIXME: passing in an English string as %1!
def err_reference_init_drops_quals : Error<
- "initialization of reference to type %0 with a %1 of type %2 drops "
+ "initialization of reference to type %0 with a %select{value|temporary}1 of type %2 drops "
"qualifiers">;
def err_reference_bind_to_bitfield : Error<
"%select{non-const|volatile}0 reference cannot bind to bit-field %1">;
@@ -572,9 +583,20 @@ def note_uninit_reference_member : Note<
def warn_field_is_uninit : Warning<"field is uninitialized when used here">,
InGroup<DiagGroup<"uninitialized">>;
+def err_temp_copy_no_viable : Error<
+ "no viable copy constructor %select{copying variable|copying parameter|"
+ "returning object|throwing object}0 of type %1">;
+def err_temp_copy_ambiguous : Error<
+ "ambiguous copy constructor call when %select{copying variable|copying "
+ "parameter|returning object|throwing object}0 of type %1">;
+def err_temp_copy_deleted : Error<
+ "%select{copying variable|copying parameter|returning object|throwing "
+ "object}0 of type %1 invokes deleted copy constructor">;
+
// C++0x decltype
def err_cannot_determine_declared_type_of_overloaded_function : Error<
- "can't determine the declared type of an overloaded function">;
+ "cannot determine the %select{type|declared type}0 of an overloaded "
+ "function">;
// C++0x auto
def err_auto_variable_cannot_appear_in_own_initializer : Error<
@@ -641,8 +663,6 @@ def err_unsupported_vector_size : Error<
"unsupported type %0 for vector_size attribute, please use on typedef">;
def err_ext_vector_component_exceeds_length : Error<
"vector component access exceeds type %0">;
-def err_ext_vector_component_requires_even : Error<
- "vector component access invalid for odd-sized type %0">;
def err_ext_vector_component_name_illegal : Error<
"illegal vector component name '%0'">;
def err_attribute_address_space_not_int : Error<
@@ -670,6 +690,8 @@ def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
def warn_attribute_ignored : Warning<"%0 attribute ignored">;
def warn_attribute_precede_definition : Warning<
"attribute declaration must precede definition">;
+def warn_attribute_void_function : Warning<
+ "attribute %0 cannot be applied to functions without return value">;
def warn_attribute_weak_on_field : Warning<
"__weak attribute cannot be specified on a field declaration">;
def warn_attribute_weak_on_local : Warning<
@@ -994,6 +1016,8 @@ def err_template_arg_unnamed_type : Error<
"template argument uses unnamed type">;
def note_template_unnamed_type_here : Note<
"unnamed type used in template argument was declared here">;
+def err_template_arg_overload_type : Error<
+ "template argument is the type of an unresolved overloaded function">;
def err_template_arg_not_class_template : Error<
"template argument does not refer to a class template or template "
"template parameter">;
@@ -1283,7 +1307,9 @@ def err_unexpected_typedef : Error<
def err_unexpected_namespace : Error<
"unexpected namespace name %0: expected expression">;
def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
-def err_undeclared_use : Error<"use of undeclared '%0'">;
+def note_dependent_var_use : Note<"must qualify identifier to find this "
+ "declaration in dependent base class">;
+def err_undeclared_use : Error<"use of undeclared %0">;
def warn_deprecated : Warning<"%0 is deprecated">,
InGroup<DiagGroup<"deprecated-declarations">>;
def warn_unavailable : Warning<"%0 is unavailable">,
@@ -1365,6 +1391,8 @@ def warn_typecheck_function_qualifiers : Warning<
"qualifier on function type %0 has unspecified behavior">;
def err_typecheck_invalid_restrict_not_pointer : Error<
"restrict requires a pointer or reference (%0 is invalid)">;
+def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
+ "restrict requires a pointer or reference">;
def err_typecheck_invalid_restrict_invalid_pointee : Error<
"pointer to function type %0 may not be 'restrict' qualified">;
def ext_typecheck_zero_array_size : Extension<
@@ -1497,11 +1525,8 @@ def ext_sizeof_function_type : Extension<
"invalid application of 'sizeof' to a function type">, InGroup<PointerArith>;
def ext_sizeof_void_type : Extension<
"invalid application of '%0' to a void type">, InGroup<PointerArith>;
-// FIXME: merge with %select
-def err_sizeof_incomplete_type : Error<
- "invalid application of 'sizeof' to an incomplete type %0">;
-def err_alignof_incomplete_type : Error<
- "invalid application of '__alignof' to an incomplete type %0">;
+def err_sizeof_alignof_incomplete_type : Error<
+ "invalid application of '%select{sizeof|__alignof}0' to an incomplete type %1">;
def err_sizeof_alignof_bitfield : Error<
"invalid application of '%select{sizeof|__alignof}0' to bit-field">;
def err_offsetof_incomplete_type : Error<
@@ -1586,9 +1611,8 @@ def err_out_of_line_declaration : Error<
def note_member_def_close_match : Note<"member declaration nearly matches">;
def err_typecheck_ivar_variable_size : Error<
"instance variables must have a constant size">;
-// FIXME: Improve with %select
def err_typecheck_illegal_increment_decrement : Error<
- "cannot modify value of type %0">;
+ "cannot %select{decrement|increment}1 value of type %0">;
def err_typecheck_arithmetic_incomplete_type : Error<
"arithmetic on pointer to incomplete type %0">;
def err_typecheck_pointer_arith_function_type : Error<
@@ -1609,7 +1633,7 @@ def err_typecheck_incomplete_array_needs_initializer : Error<
"definition of variable with array type needs an explicit size "
"or an initializer">;
def err_array_init_not_init_list : Error<
- "array initializater must be an initializer "
+ "array initializer must be an initializer "
"list%select{| or string literal}0">;
def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
@@ -1699,6 +1723,8 @@ def err_unexpected_interface : Error<
def err_ref_non_value : Error<"%0 does not refer to a value">;
def err_property_not_found : Error<
"property %0 not found on object of type %1">;
+def err_duplicate_property : Error<
+ "property has a previous declaration">;
def ext_gnu_void_ptr : Extension<
"use of GNU void* extension">, InGroup<PointerArith>;
def ext_gnu_ptr_func_arith : Extension<
@@ -1712,6 +1738,8 @@ def ext_integer_complement_complex : Extension<
"ISO C does not support '~' for complex conjugation of %0">;
def error_nosetter_property_assignment : Error<
"setter method is needed to assign to object using property" " assignment syntax">;
+def error_no_subobject_property_setting : Error<
+ "cannot assign to a sub-structure of an ivar using property" " assignment syntax">;
def ext_freestanding_complex : Extension<
"complex numbers are an extension in a freestanding C99 implementation">;
@@ -1810,6 +1838,7 @@ def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
// Other C++ expressions
def err_need_header_before_typeid : Error<
"you need to include <typeinfo> before using the 'typeid' operator">;
+def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
def err_static_illegal_in_new : Error<
"the 'static' modifier for the array size is not legal in new expressions">;
def err_array_new_needs_size : Error<
@@ -1824,8 +1853,8 @@ def err_new_paren_array_nonconst : Error<
"when type is in parentheses, array cannot have dynamic size">;
def err_array_size_not_integral : Error<
"array size expression must have integral or enumerated type, not %0">;
-def err_new_uninitialized_const : Error<
- "must provide an initializer if the allocated object is 'const'">;
+def err_default_init_const : Error<
+ "default initialization of an object of const type %0">;
def err_delete_operand : Error<"cannot delete expression of type %0">;
def err_ambiguous_delete_operand : Error<"ambiguous conversion of delete "
"expression of type %0 to a pointer">;
@@ -1928,9 +1957,11 @@ def warn_value_always_zero : Warning<
"%0 is always %select{zero|false|NULL}1 in this context">;
// assignment related diagnostics (also for argument passing, returning, etc).
-// FIXME: %2 is an english string here.
+// In most of these diagnostics the %2 is a value from the
+// Sema::AssignmentAction enumeration
def err_typecheck_convert_incompatible : Error<
- "incompatible type %2 %1, expected %0">;
+ "incompatible type %select{assigning|passing|returning|converting|initializing|sending|casting}2"
+ " %1, expected %0">;
def err_typecheck_convert_ambiguous : Error<
"ambiguity in initializing value of type %0 with initializer of type %1">;
def err_cannot_initialize_decl_noname : Error<
@@ -1939,31 +1970,43 @@ def err_cannot_initialize_decl_noname : Error<
def err_cannot_initialize_decl : Error<
"cannot initialize %0 with an %select{rvalue|lvalue}1 of type %2">;
def warn_incompatible_qualified_id : Warning<
- "incompatible type %2 %1, expected %0">;
+ "incompatible type %select{assigning|passing|returning|converting|initializing|sending|casting}2"
+ " %1, expected %0">;
def ext_typecheck_convert_pointer_int : ExtWarn<
- "incompatible pointer to integer conversion %2 %1, expected %0">;
+ "incompatible pointer to integer conversion "
+ "%select{assigning|passing|returning|converting|initializing|sending|casting}2 %1, expected %0">;
def ext_typecheck_convert_int_pointer : ExtWarn<
- "incompatible integer to pointer conversion %2 %1, expected %0">;
+ "incompatible integer to pointer conversion "
+ "%select{assigning|passing|returning|converting|initializing|sending|casting}2 %1, expected %0">;
def ext_typecheck_convert_pointer_void_func : Extension<
- "%2 %1 converts between void* and function pointer, expected %0">;
+ "%select{assigning|passing|returning|converting|initializing|sending|casting}2"
+ " %1 converts between void* and function pointer, expected %0">;
def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
- "pointer types point to integer types with different sign %2 %1, expected %0">,
+ "pointer types point to integer types with different sign "
+ "%select{assigning|passing|returning|converting|initializing|sending|casting}2 %1, expected %0">,
InGroup<DiagGroup<"pointer-sign">>;
def ext_typecheck_convert_incompatible_pointer : ExtWarn<
- "incompatible pointer types %2 %1, expected %0">;
+ "incompatible pointer types "
+ "%select{assigning|passing|returning|converting|initializing|sending|casting}2 %1, expected %0">;
def ext_typecheck_convert_discards_qualifiers : ExtWarn<
- "%2 %1 discards qualifiers, expected %0">;
+ "%select{assigning|passing|returning|converting|initializing|sending|casting}2"
+ " %1 discards qualifiers, expected %0">;
def ext_nested_pointer_qualifier_mismatch : ExtWarn<
- "%2, %0 and %1 have different qualifiers in nested pointer types">;
+ "%select{assigning|passing|returning|converting|initializing|sending|casting}2,"
+ " %0 and %1 have different qualifiers in nested pointer types">;
def warn_incompatible_vectors : Warning<
- "incompatible vector types %2 %1, expected %0">,
+ "incompatible vector types %select{assigning|passing|returning|converting|initializing|sending|casting}2"
+ " %1, expected %0">,
InGroup<VectorConversions>, DefaultIgnore;
def err_int_to_block_pointer : Error<
- "invalid conversion %2 integer %1, expected block pointer %0">;
+ "invalid conversion "
+ "%select{assigning|passing|returning|converting|initializing|sending|casting}2"
+ " integer %1, expected block pointer %0">;
def err_typecheck_comparison_of_distinct_blocks : Error<
"comparison of distinct block types (%0 and %1)">;
def err_typecheck_convert_incompatible_block_pointer : Error<
- "incompatible block pointer types %2 %1, expected %0">;
+ "incompatible block pointer types "
+ "%select{assigning|passing|returning|converting|initializing|sending|casting}2 %1, expected %0">;
def err_typecheck_array_not_modifiable_lvalue : Error<
"array type %0 is not assignable">;
@@ -2506,4 +2549,27 @@ def warn_attribute_method_def : Warning<
def ext_typecheck_base_super : Warning<
"method parameter type %0 does not match "
"super class method parameter type %1">, InGroup<SuperSubClassMismatch>, DefaultIgnore;
+
+// Spell-checking diagnostics
+def err_unknown_typename_suggest : Error<
+ "unknown type name %0; did you mean %1?">;
+def err_unknown_nested_typename_suggest : Error<
+ "no type named %0 in %1; did you mean %2?">;
+def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %2?">;
+def err_undeclared_use_suggest : Error<
+ "use of undeclared %0; did you mean %1?">;
+def err_undeclared_var_use_suggest : Error<
+ "use of undeclared identifier %0; did you mean %1?">;
+def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
+def err_no_member_template_suggest : Error<
+ "no template named %0 in %1; did you mean %2?">;
+def err_mem_init_not_member_or_class_suggest : Error<
+ "initializer %0 does not name a non-static data member or base "
+ "class; did you mean the %select{base class|member}1 %2?">;
+def err_field_designator_unknown_suggest : Error<
+ "field designator %0 does not refer to any field in type %1; did you mean "
+ "%2?">;
+
}
+
+
diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h
index e17279e2664a..2b6092dea309 100644
--- a/include/clang/Basic/LangOptions.h
+++ b/include/clang/Basic/LangOptions.h
@@ -89,7 +89,10 @@ public:
unsigned ShortWChar : 1; // Force wchar_t to be unsigned short int.
unsigned OpenCL : 1; // OpenCL C99 language extensions.
-
+
+ unsigned AssumeSaneOperatorNew : 1; // Whether to add __attribute__((malloc))
+ // to the declaration of C++'s new
+ // operators
unsigned ElideConstructors : 1; // Whether C++ copy constructors should be
// elided if possible.
unsigned CatchUndefined :1; // Generate code to check for undefined ops.
@@ -141,6 +144,8 @@ public:
EmitAllDecls = 0;
MathErrno = 1;
+ AssumeSaneOperatorNew = 1;
+
// FIXME: The default should be 1.
AccessControl = 0;
ElideConstructors = 1;
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index 49eaafec7db7..0d95e6a60323 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -61,8 +61,11 @@ protected:
public:
/// CreateTargetInfo - Construct a target for the given options.
- static TargetInfo* CreateTargetInfo(Diagnostic &Diags,
- const TargetOptions &Opts);
+ ///
+ /// \param Opts - The options to use to initialize the target. The target may
+ /// modify the options to canonicalize the target feature information to match
+ /// what the backend expects.
+ static TargetInfo* CreateTargetInfo(Diagnostic &Diags, TargetOptions &Opts);
virtual ~TargetInfo();
@@ -360,6 +363,15 @@ public:
return "";
}
+ /// setCPU - Target the specific CPU.
+ ///
+ /// \return - False on error (invalid CPU name).
+ //
+ // FIXME: Remove this.
+ virtual bool setCPU(const std::string &Name) {
+ return true;
+ }
+
/// setABI - Use the specific ABI.
///
/// \return - False on error (invalid ABI name).
@@ -380,7 +392,10 @@ public:
/// HandleTargetOptions - Perform initialization based on the user configured
/// set of features (e.g., +sse4). The list is guaranteed to have at most one
/// entry per feature.
- virtual void HandleTargetFeatures(const std::vector<std::string> &Features) {
+ ///
+ /// The target may modify the features list, to change which options are
+ /// passed onwards to the backend.
+ virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
}
// getRegParmMax - Returns maximal number of args passed in registers.
diff --git a/include/clang/CodeGen/CodeGenOptions.h b/include/clang/CodeGen/CodeGenOptions.h
index c8fb37b9ddc0..8682715ce552 100644
--- a/include/clang/CodeGen/CodeGenOptions.h
+++ b/include/clang/CodeGen/CodeGenOptions.h
@@ -58,6 +58,10 @@ public:
/// Enable additional debugging information.
std::string DebugPass;
+ /// The string to embed in the debug information for the compile unit, if
+ /// non-empty.
+ std::string DwarfDebugFlags;
+
/// The ABI to use for passing floating point arguments.
std::string FloatABI;
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index a9566f3f9d47..6a0d81692045 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -20,8 +20,8 @@ include "OptParser.td"
def target_abi : Separate<"-target-abi">,
HelpText<"Target a particular ABI type">;
-def mcpu : Separate<"-mcpu">,
- HelpText<"Target a specific cpu type ('-mcpu help' for details)">;
+def target_cpu : Separate<"-target-cpu">,
+ HelpText<"Target a specific cpu type">;
def target_feature : Separate<"-target-feature">,
HelpText<"Target specific attributes">;
def triple : Separate<"-triple">,
@@ -104,6 +104,8 @@ def disable_llvm_optzns : Flag<"-disable-llvm-optzns">,
HelpText<"Don't run LLVM optimization passes">;
def disable_red_zone : Flag<"-disable-red-zone">,
HelpText<"Do not emit code that uses the red zone.">;
+def dwarf_debug_flags : Separate<"-dwarf-debug-flags">,
+ HelpText<"The string to embed in the Dwarf debug flags record.">;
def g : Flag<"-g">, HelpText<"Generate source level debug information">;
def fcatch_undefined_behavior : Flag<"-fcatch-undefined-behavior">,
HelpText<"Generate runtime checks for undefined behavior.">;
@@ -282,8 +284,6 @@ def rewrite_objc : Flag<"-rewrite-objc">,
HelpText<"Rewrite ObjC into C (code rewriter example)">;
def rewrite_macros : Flag<"-rewrite-macros">,
HelpText<"Expand macros without full preprocessing">;
-def rewrite_blocks : Flag<"-rewrite-blocks">,
- HelpText<"Rewrite Blocks to C">;
}
@@ -304,8 +304,12 @@ def faltivec : Flag<"-faltivec">,
HelpText<"Enable AltiVec vector initializer syntax">;
def faccess_control : Flag<"-faccess-control">,
HelpText<"Enable C++ access control">;
+def fno_assume_sane_operator_new : Flag<"-fno-assume-sane-operator-new">,
+ HelpText<"Don't assume that C++'s global operator new can't alias any pointer">;
def fdollars_in_identifiers : Flag<"-fdollars-in-identifiers">,
HelpText<"Allow '$' in identifiers">;
+def fno_dollars_in_identifiers : Flag<"-fno-dollars-in-identifiers">,
+ HelpText<"Disallow '$' in identifiers">;
def femit_all_decls : Flag<"-femit-all-decls">,
HelpText<"Emit all declarations, even if unused">;
def fblocks : Flag<"-fblocks">,
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
index 3592fc946846..247e1f5117f9 100644
--- a/include/clang/Driver/Options.td
+++ b/include/clang/Driver/Options.td
@@ -17,23 +17,27 @@ include "OptParser.td"
/////////
// Groups
-def I_Group : OptionGroup<"<I group>">;
-def M_Group : OptionGroup<"<M group>">;
+// Meta-group which defines
+def CompileOnly_Group : OptionGroup<"<CompileOnly group>">;
+
+def I_Group : OptionGroup<"<I group>">, Group<CompileOnly_Group>;
+def M_Group : OptionGroup<"<M group>">, Group<CompileOnly_Group>;
def T_Group : OptionGroup<"<T group>">;
-def O_Group : OptionGroup<"<O group>">;
-def W_Group : OptionGroup<"<W group>">;
+def O_Group : OptionGroup<"<O group>">, Group<CompileOnly_Group>;
+def W_Group : OptionGroup<"<W group>">, Group<CompileOnly_Group>;
def X_Group : OptionGroup<"<X group>">;
def a_Group : OptionGroup<"<a group>">;
def d_Group : OptionGroup<"<d group>">;
-def f_Group : OptionGroup<"<f group>">;
+def f_Group : OptionGroup<"<f group>">, Group<CompileOnly_Group>;
def g_Group : OptionGroup<"<g group>">;
-def i_Group : OptionGroup<"<i group>">;
+def i_Group : OptionGroup<"<i group>">, Group<CompileOnly_Group>;
def clang_i_Group : OptionGroup<"<clang i group>">, Group<i_Group>;
-def m_Group : OptionGroup<"<m group>">;
-def m_x86_Features_Group : OptionGroup<"<m x86 features group>">;
+def m_Group : OptionGroup<"<m group>">, Group<CompileOnly_Group>;
+def m_x86_Features_Group : OptionGroup<"<m x86 features group>">, Group<m_Group>;
def u_Group : OptionGroup<"<u group>">;
-def pedantic_Group : OptionGroup<"<pedantic group>">;
+def pedantic_Group : OptionGroup<"<pedantic group>">,
+ Group<CompileOnly_Group>;
// Temporary groups for clang options which we know we don't support,
// but don't want to verbosely warn the user about.
@@ -116,7 +120,7 @@ def A : JoinedOrSeparate<"-A">;
def B : JoinedOrSeparate<"-B">, Flags<[Unsupported]>;
def CC : Flag<"-CC">;
def C : Flag<"-C">;
-def D : JoinedOrSeparate<"-D">;
+def D : JoinedOrSeparate<"-D">, Group<CompileOnly_Group>;
def E : Flag<"-E">, Flags<[DriverOption]>,
HelpText<"Only run the preprocessor">;
def F : JoinedOrSeparate<"-F">;
@@ -152,7 +156,7 @@ def Tbss : JoinedOrSeparate<"-Tbss">, Group<T_Group>;
def Tdata : JoinedOrSeparate<"-Tdata">, Group<T_Group>;
def Ttext : JoinedOrSeparate<"-Ttext">, Group<T_Group>;
def T : JoinedOrSeparate<"-T">, Group<T_Group>;
-def U : JoinedOrSeparate<"-U">;
+def U : JoinedOrSeparate<"-U">, Group<CompileOnly_Group>;
def V : JoinedOrSeparate<"-V">, Flags<[DriverOption, Unsupported]>;
def Wa_COMMA : CommaJoined<"-Wa,">,
HelpText<"Pass the comma separated arguments in <arg> to the assembler">,
@@ -226,6 +230,7 @@ def fPIC : Flag<"-fPIC">, Group<f_Group>;
def fPIE : Flag<"-fPIE">, Group<f_Group>;
def fapple_kext : Flag<"-fapple-kext">, Group<f_Group>;
def fasm_blocks : Flag<"-fasm-blocks">, Group<clang_ignored_f_Group>;
+def fassume_sane_operator_new : Flag<"-fassume-sane-operator-new">, Group<f_Group>;
def fastcp : Flag<"-fastcp">, Group<f_Group>;
def fastf : Flag<"-fastf">, Group<f_Group>;
def fast : Flag<"-fast">, Group<f_Group>;
@@ -277,6 +282,7 @@ def fmudflap : Flag<"-fmudflap">, Group<f_Group>;
def fnested_functions : Flag<"-fnested-functions">, Group<f_Group>;
def fnext_runtime : Flag<"-fnext-runtime">, Group<f_Group>;
def fno_asynchronous_unwind_tables : Flag<"-fno-asynchronous-unwind-tables">, Group<f_Group>;
+def fno_assume_sane_operator_new : Flag<"-fno-assume-sane-operator-new">, Group<f_Group>;
def fno_blocks : Flag<"-fno-blocks">, Group<f_Group>;
def fno_builtin_strcat : Flag<"-fno-builtin-strcat">, Group<f_Group>;
def fno_builtin_strcpy : Flag<"-fno-builtin-strcpy">, Group<f_Group>;
@@ -389,6 +395,7 @@ def mcpu_EQ : Joined<"-mcpu=">, Group<m_Group>, Flags<[DriverOption]>;
def mdynamic_no_pic : Joined<"-mdynamic-no-pic">, Group<m_Group>, Flags<[NoArgumentUnused]>;
def mfix_and_continue : Flag<"-mfix-and-continue">, Group<clang_ignored_m_Group>;
def mfloat_abi_EQ : Joined<"-mfloat-abi=">, Group<m_Group>;
+def mfpu_EQ : Joined<"-mfpu=">, Group<m_Group>;
def mhard_float : Flag<"-mhard-float">, Group<m_Group>;
def miphoneos_version_min_EQ : Joined<"-miphoneos-version-min=">, Group<m_Group>;
def mkernel : Flag<"-mkernel">, Group<m_Group>;
diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h
index df651a6c3d00..b3c2d05ef563 100644
--- a/include/clang/Driver/ToolChain.h
+++ b/include/clang/Driver/ToolChain.h
@@ -19,6 +19,7 @@ namespace clang {
namespace driver {
class Compilation;
class DerivedArgList;
+ class Driver;
class HostInfo;
class InputArgList;
class JobAction;
@@ -49,7 +50,7 @@ public:
// Accessors
- const HostInfo &getHost() const { return Host; }
+ const Driver &getDriver() const;
const llvm::Triple &getTriple() const { return Triple; }
std::string getArchName() const { return Triple.getArchName(); }
@@ -113,6 +114,10 @@ public:
/// for this tool chain, or 0 if this tool chain does not force a
/// particular PIC mode.
virtual const char *GetForcedPicModel() const = 0;
+
+ /// UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf
+ /// compile unit information.
+ virtual bool UseDwarfDebugFlags() const { return false; }
};
} // end namespace driver
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h
index 20bf83ee0456..978b0d2b2aa6 100644
--- a/include/clang/Frontend/ASTConsumers.h
+++ b/include/clang/Frontend/ASTConsumers.h
@@ -101,12 +101,6 @@ ASTConsumer *CreatePCHGenerator(const Preprocessor &PP,
llvm::raw_ostream *OS,
const char *isysroot = 0);
-// Block rewriter: rewrites code using the Apple blocks extension to pure
-// C code. Output is always sent to stdout.
-ASTConsumer *CreateBlockRewriter(const std::string &InFile,
- Diagnostic &Diags,
- const LangOptions &LangOpts);
-
// Inheritance viewer: for C++ code, creates a graph of the inheritance
// tree for the given class and displays it with "dotty".
ASTConsumer *CreateInheritanceViewer(const std::string& clsname);
diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h
index e755fe1b1b5f..33bb8aaf6e1d 100644
--- a/include/clang/Frontend/FrontendActions.h
+++ b/include/clang/Frontend/FrontendActions.h
@@ -110,12 +110,6 @@ protected:
llvm::StringRef InFile);
};
-class RewriteBlocksAction : public ASTFrontendAction {
-protected:
- virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
- llvm::StringRef InFile);
-};
-
class SyntaxOnlyAction : public ASTFrontendAction {
protected:
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index 36fea7f71337..735a86a70fcb 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -41,7 +41,6 @@ namespace frontend {
PluginAction, ///< Run a plugin action, \see ActionName.
PrintDeclContext, ///< Print DeclContext and their Decls.
PrintPreprocessedInput, ///< -E mode.
- RewriteBlocks, ///< ObjC->C Rewriter for Blocks.
RewriteMacros, ///< Expand macros but not #includes.
RewriteObjC, ///< ObjC->C Rewriter.
RewriteTest, ///< Rewriter playground
diff --git a/include/clang/Frontend/PCHBitCodes.h b/include/clang/Frontend/PCHBitCodes.h
index c8c49c83f940..536bd4139006 100644
--- a/include/clang/Frontend/PCHBitCodes.h
+++ b/include/clang/Frontend/PCHBitCodes.h
@@ -357,8 +357,6 @@ namespace clang {
enum TypeCode {
/// \brief An ExtQualType record.
TYPE_EXT_QUAL = 1,
- /// \brief A FixedWidthIntType record.
- TYPE_FIXED_WIDTH_INT = 2,
/// \brief A ComplexType record.
TYPE_COMPLEX = 3,
/// \brief A PointerType record.
diff --git a/include/clang/Frontend/TypeXML.def b/include/clang/Frontend/TypeXML.def
index 35f5debe5cf0..dd5018af82aa 100644
--- a/include/clang/Frontend/TypeXML.def
+++ b/include/clang/Frontend/TypeXML.def
@@ -103,12 +103,6 @@ NODE_XML(BuiltinType, "FundamentalType")
END_ENUM_XML
END_NODE_XML
-NODE_XML(FixedWidthIntType, "FixedWidthIntType")
- ID_ATTRIBUTE_XML
- ATTRIBUTE_XML(getWidth(), "width") // unsigned
- ATTRIBUTE_XML(isSigned(), "is_signed") // boolean
-END_NODE_XML
-
NODE_XML(PointerType, "PointerType")
ID_ATTRIBUTE_XML
TYPE_ATTRIBUTE_XML(getPointeeType())
diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h
index fc65b1fc5449..0f36df43e232 100644
--- a/include/clang/Lex/Lexer.h
+++ b/include/clang/Lex/Lexer.h
@@ -255,8 +255,8 @@ public:
// string processing, because we know we need to read until we find the
// closing '"' character.
//
- // The second interface is the combination of PeekCharAndSize with
- // ConsumeChar. PeekCharAndSize reads a phase 1/2 translated character,
+ // The second interface is the combination of getCharAndSize with
+ // ConsumeChar. getCharAndSize reads a phase 1/2 translated character,
// returning it and its size. If the lexer decides that this character is
// part of the current token, it calls ConsumeChar on it. This two stage
// approach allows us to emit diagnostics for characters (e.g. warnings about
@@ -287,7 +287,7 @@ public:
}
private:
- /// ConsumeChar - When a character (identified by PeekCharAndSize) is consumed
+ /// ConsumeChar - When a character (identified by getCharAndSize) is consumed
/// and added to a given token, check to see if there are diagnostics that
/// need to be emitted or flags that need to be set on the token. If so, do
/// it.
diff --git a/include/clang/Lex/LiteralSupport.h b/include/clang/Lex/LiteralSupport.h
index c4ab5aebf721..2334d728f6e3 100644
--- a/include/clang/Lex/LiteralSupport.h
+++ b/include/clang/Lex/LiteralSupport.h
@@ -16,15 +16,10 @@
#define CLANG_LITERALSUPPORT_H
#include <string>
+#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/System/DataTypes.h"
-namespace llvm {
- class APInt;
- class APFloat;
- struct fltSemantics;
-}
-
namespace clang {
class Diagnostic;
@@ -82,8 +77,7 @@ public:
/// The optional bool isExact (passed-by-reference) has its value
/// set to true if the returned APFloat can represent the number in the
/// literal exactly, and false otherwise.
- llvm::APFloat GetFloatValue(const llvm::fltSemantics &Format,
- bool* isExact = NULL);
+ llvm::APFloat::opStatus GetFloatValue(llvm::APFloat &Result);
private:
diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h
index b7540f9993d0..4cbc21ad014a 100644
--- a/include/clang/Parse/Action.h
+++ b/include/clang/Parse/Action.h
@@ -131,7 +131,7 @@ public:
};
template<typename T>
- FullExprArg FullExpr(T &Arg) {
+ FullExprArg MakeFullExpr(T &Arg) {
return FullExprArg(ActOnFinishFullExpr(move(Arg)));
}
@@ -662,6 +662,12 @@ public:
/// struct, or union).
virtual void ActOnTagStartDefinition(Scope *S, DeclPtrTy TagDecl) { }
+ /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
+ /// C++ record definition's base-specifiers clause and are starting its
+ /// member declarations.
+ virtual void ActOnStartCXXMemberDeclarations(Scope *S, DeclPtrTy TagDecl,
+ SourceLocation LBraceLoc) { }
+
/// ActOnTagFinishDefinition - Invoked once we have finished parsing
/// the definition of a tag (enumeration, class, struct, or union).
virtual void ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagDecl,
@@ -1351,6 +1357,14 @@ public:
virtual void ActOnReenterTemplateScope(Scope *S, DeclPtrTy Template) {
}
+ /// ActOnStartDelayedMemberDeclarations - We have completed parsing
+ /// a C++ class, and we are about to start parsing any parts of
+ /// member declarations that could not be parsed earlier. Enter
+ /// the appropriate record scope.
+ virtual void ActOnStartDelayedMemberDeclarations(Scope *S,
+ DeclPtrTy Record) {
+ }
+
/// ActOnStartDelayedCXXMethodDeclaration - We have completed
/// parsing a top-level (non-nested) C++ class, and we are now
/// parsing those parts of the given Method declaration that could
@@ -1381,6 +1395,14 @@ public:
DeclPtrTy Method) {
}
+ /// ActOnFinishDelayedMemberDeclarations - We have finished parsing
+ /// a C++ class, and we are about to start parsing any parts of
+ /// member declarations that could not be parsed earlier. Enter the
+ /// appropriate record scope.
+ virtual void ActOnFinishDelayedMemberDeclarations(Scope *S,
+ DeclPtrTy Record) {
+ }
+
/// ActOnStaticAssertDeclaration - Parse a C++0x static_assert declaration.
virtual DeclPtrTy ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
ExprArg AssertExpr,
@@ -1734,7 +1756,7 @@ public:
ASTTemplateArgsPtr TemplateArgs,
SourceLocation RAngleLoc) {
return TypeResult();
- };
+ }
/// \brief Note that a template ID was used with a tag.
///
diff --git a/include/clang/Parse/DeclSpec.h b/include/clang/Parse/DeclSpec.h
index b766890b7023..7c99e3e58254 100644
--- a/include/clang/Parse/DeclSpec.h
+++ b/include/clang/Parse/DeclSpec.h
@@ -995,7 +995,7 @@ struct DeclaratorChunk {
/// stack, not objects that are allocated in large quantities on the heap.
class Declarator {
public:
- enum TheContext {
+ enum TheContext {
FileContext, // File scope declaration.
PrototypeContext, // Within a function prototype.
KNRTypeListContext, // K&R type definition list for formals.
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index e47de506fd1f..2214797b8f7b 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -1243,10 +1243,7 @@ private:
CreatedScope = true;
P.EnterScope(0); // Not a decl scope.
- if (P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS))
- SS.setScopeRep(0);
-
- if (!SS.isInvalid())
+ if (!P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS))
EnteredScope = true;
}
diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h
index 84c179f789d1..aec10f32fe63 100644
--- a/include/clang/Sema/CodeCompleteConsumer.h
+++ b/include/clang/Sema/CodeCompleteConsumer.h
@@ -61,6 +61,9 @@ public:
/// \brief A piece of text that describes something about the result but
/// should not be inserted into the buffer.
CK_Informative,
+ /// \brief A piece of text that describes the type of an entity or, for
+ /// functions and methods, the return type.
+ CK_ResultType,
/// \brief A piece of text that describes the parameter that corresponds
/// to the code-completion location within a function call, message send,
/// macro invocation, etc.
@@ -120,6 +123,9 @@ public:
/// \brief Create a new informative chunk.
static Chunk CreateInformative(llvm::StringRef Informative);
+ /// \brief Create a new result type chunk.
+ static Chunk CreateResultType(llvm::StringRef ResultType);
+
/// \brief Create a new current-parameter chunk.
static Chunk CreateCurrentParameter(llvm::StringRef CurrentParameter);
@@ -186,6 +192,12 @@ public:
Chunks.push_back(Chunk::CreateInformative(Text));
}
+ /// \brief Add a new result-type chunk.
+ /// The text will be copied.
+ void AddResultTypeChunk(llvm::StringRef ResultType) {
+ Chunks.push_back(Chunk::CreateResultType(ResultType));
+ }
+
/// \brief Add a new current-parameter chunk.
/// The text will be copied.
void AddCurrentParameterChunk(llvm::StringRef CurrentParameter) {
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index cc7055dc68b8..74e74e7aba0b 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "clang/AST/ASTContext.h"
+#include "clang/AST/CharUnits.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
@@ -55,44 +56,43 @@ ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM,
}
ASTContext::~ASTContext() {
- // Deallocate all the types.
- while (!Types.empty()) {
- Types.back()->Destroy(*this);
- Types.pop_back();
- }
+ if (FreeMemory) {
+ // Deallocate all the types.
+ while (!Types.empty()) {
+ Types.back()->Destroy(*this);
+ Types.pop_back();
+ }
- {
- llvm::FoldingSet<ExtQuals>::iterator
- I = ExtQualNodes.begin(), E = ExtQualNodes.end();
- while (I != E)
+ for (llvm::FoldingSet<ExtQuals>::iterator
+ I = ExtQualNodes.begin(), E = ExtQualNodes.end(); I != E; ) {
+ // Increment in loop to prevent using deallocated memory.
Deallocate(&*I++);
+ }
}
- {
- llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
- I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end();
- while (I != E) {
- ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second);
- delete R;
- }
+ for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
+ I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) {
+ // Increment in loop to prevent using deallocated memory.
+ ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second);
+ delete R;
}
- {
- llvm::DenseMap<const ObjCContainerDecl*, const ASTRecordLayout*>::iterator
- I = ObjCLayouts.begin(), E = ObjCLayouts.end();
- while (I != E) {
- ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second);
- delete R;
- }
+ for (llvm::DenseMap<const ObjCContainerDecl*,
+ const ASTRecordLayout*>::iterator
+ I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; ) {
+ // Increment in loop to prevent using deallocated memory.
+ ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second);
+ delete R;
}
// Destroy nested-name-specifiers.
for (llvm::FoldingSet<NestedNameSpecifier>::iterator
NNS = NestedNameSpecifiers.begin(),
NNSEnd = NestedNameSpecifiers.end();
- NNS != NNSEnd;
- /* Increment in loop */)
+ NNS != NNSEnd; ) {
+ // Increment in loop to prevent using deallocated memory.
(*NNS++).Destroy(*this);
+ }
if (GlobalNestedNameSpecifier)
GlobalNestedNameSpecifier->Destroy(*this);
@@ -694,13 +694,6 @@ ASTContext::getTypeInfo(const Type *T) {
break;
}
break;
- case Type::FixedWidthInt:
- // FIXME: This isn't precisely correct; the width/alignment should depend
- // on the available types for the target
- Width = cast<FixedWidthIntType>(T)->getWidth();
- Width = std::max(llvm::NextPowerOf2(Width - 1), (uint64_t)8);
- Align = Width;
- break;
case Type::ObjCObjectPointer:
Width = Target.getPointerWidth(0);
Align = Target.getPointerAlign(0);
@@ -818,6 +811,15 @@ ASTContext::getTypeInfo(const Type *T) {
return std::make_pair(Width, Align);
}
+/// getTypeSizeInChars - Return the size of the specified type, in characters.
+/// This method does not work on incomplete types.
+CharUnits ASTContext::getTypeSizeInChars(QualType T) {
+ return CharUnits::fromRaw(getTypeSize(T) / getCharWidth());
+}
+CharUnits ASTContext::getTypeSizeInChars(const Type *T) {
+ return CharUnits::fromRaw(getTypeSize(T) / getCharWidth());
+}
+
/// getPreferredTypeAlign - Return the "preferred" alignment of the specified
/// type for the current target in bits. This can be different than the ABI
/// alignment in cases where it is beneficial for performance to overalign
@@ -1056,9 +1058,7 @@ ASTContext::getObjCLayout(const ObjCInterfaceDecl *D,
// Add in synthesized ivar count if laying out an implementation.
if (Impl) {
- unsigned FieldCount = D->ivar_size();
unsigned SynthCount = CountSynthesizedIvars(D);
- FieldCount += SynthCount;
// If there aren't any sythesized ivars then reuse the interface
// entry. Note we can't cache this because we simply free all
// entries later; however we shouldn't look up implementations
@@ -1267,15 +1267,6 @@ QualType ASTContext::getComplexType(QualType T) {
return QualType(New, 0);
}
-QualType ASTContext::getFixedWidthIntType(unsigned Width, bool Signed) {
- llvm::DenseMap<unsigned, FixedWidthIntType*> &Map = Signed ?
- SignedFixedWidthIntTypes : UnsignedFixedWidthIntTypes;
- FixedWidthIntType *&Entry = Map[Width];
- if (!Entry)
- Entry = new FixedWidthIntType(Width, Signed);
- return QualType(Entry, 0);
-}
-
/// getPointerType - Return the uniqued reference to the type for a pointer to
/// the specified type.
QualType ASTContext::getPointerType(QualType T) {
@@ -2381,6 +2372,42 @@ CanQualType ASTContext::getCanonicalType(QualType T) {
VAT->getBracketsRange()));
}
+QualType ASTContext::getUnqualifiedArrayType(QualType T,
+ Qualifiers &Quals) {
+ assert(T.isCanonical() && "Only operates on canonical types");
+ if (!isa<ArrayType>(T)) {
+ Quals = T.getLocalQualifiers();
+ return T.getLocalUnqualifiedType();
+ }
+
+ assert(!T.hasQualifiers() && "canonical array type has qualifiers!");
+ const ArrayType *AT = cast<ArrayType>(T);
+ QualType Elt = AT->getElementType();
+ QualType UnqualElt = getUnqualifiedArrayType(getCanonicalType(Elt), Quals);
+ if (Elt == UnqualElt)
+ return T;
+
+ if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(T)) {
+ return getConstantArrayType(UnqualElt, CAT->getSize(),
+ CAT->getSizeModifier(), 0);
+ }
+
+ if (const IncompleteArrayType *IAT = dyn_cast<IncompleteArrayType>(T)) {
+ return getIncompleteArrayType(UnqualElt, IAT->getSizeModifier(), 0);
+ }
+
+ if (const VariableArrayType *VAT = dyn_cast<VariableArrayType>(T)) {
+ return getVariableArrayType(UnqualElt, VAT->getSizeExpr()->Retain(),
+ VAT->getSizeModifier(), 0,
+ SourceRange());
+ }
+
+ const DependentSizedArrayType *DSAT = cast<DependentSizedArrayType>(T);
+ return getDependentSizedArrayType(UnqualElt, DSAT->getSizeExpr()->Retain(),
+ DSAT->getSizeModifier(), 0,
+ SourceRange());
+}
+
DeclarationName ASTContext::getNameForTemplate(TemplateName Name) {
if (TemplateDecl *TD = Name.getAsTemplateDecl())
return TD->getDeclName();
@@ -2682,12 +2709,6 @@ unsigned ASTContext::getIntegerRank(Type *T) {
if (T->isSpecificBuiltinType(BuiltinType::Char32))
T = getFromTargetType(Target.getChar32Type()).getTypePtr();
- // There are two things which impact the integer rank: the width, and
- // the ordering of builtins. The builtin ordering is encoded in the
- // bottom three bits; the width is encoded in the bits above that.
- if (FixedWidthIntType* FWIT = dyn_cast<FixedWidthIntType>(T))
- return FWIT->getWidth() << 3;
-
switch (cast<BuiltinType>(T)->getKind()) {
default: assert(0 && "getIntegerRank(): not a built-in integer");
case BuiltinType::Bool:
@@ -4500,9 +4521,6 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) {
return QualType();
}
- case Type::FixedWidthInt:
- // Distinct fixed-width integers are not compatible.
- return QualType();
case Type::TemplateSpecialization:
assert(false && "Dependent types have no size");
break;
@@ -4518,9 +4536,6 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) {
unsigned ASTContext::getIntWidth(QualType T) {
if (T->isBooleanType())
return 1;
- if (FixedWidthIntType *FWIT = dyn_cast<FixedWidthIntType>(T)) {
- return FWIT->getWidth();
- }
if (EnumType *ET = dyn_cast<EnumType>(T))
T = ET->getDecl()->getIntegerType();
// For builtin types, just use the standard type sizing method
diff --git a/lib/AST/CMakeLists.txt b/lib/AST/CMakeLists.txt
index 0f0b22d65f6f..5aecf878c920 100644
--- a/lib/AST/CMakeLists.txt
+++ b/lib/AST/CMakeLists.txt
@@ -16,6 +16,7 @@ add_clang_library(clangAST
Expr.cpp
ExprCXX.cpp
ExprConstant.cpp
+ FullExpr.cpp
InheritViz.cpp
NestedNameSpecifier.cpp
ParentMap.cpp
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 4d0d4225ce73..e112fa3928de 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -19,6 +19,7 @@
#include "clang/AST/TypeLoc.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/Expr.h"
+#include "clang/AST/ExprCXX.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/IdentifierTable.h"
@@ -91,6 +92,34 @@ ParmVarDecl *ParmVarDecl::Create(ASTContext &C, DeclContext *DC,
return new (C) ParmVarDecl(ParmVar, DC, L, Id, T, TInfo, S, DefArg);
}
+Expr *ParmVarDecl::getDefaultArg() {
+ assert(!hasUnparsedDefaultArg() && "Default argument is not yet parsed!");
+ assert(!hasUninstantiatedDefaultArg() &&
+ "Default argument is not yet instantiated!");
+
+ Expr *Arg = getInit();
+ if (CXXExprWithTemporaries *E = dyn_cast_or_null<CXXExprWithTemporaries>(Arg))
+ return E->getSubExpr();
+
+ return Arg;
+}
+
+unsigned ParmVarDecl::getNumDefaultArgTemporaries() const {
+ if (const CXXExprWithTemporaries *E =
+ dyn_cast<CXXExprWithTemporaries>(getInit()))
+ return E->getNumTemporaries();
+
+ return 0;
+}
+
+CXXTemporary *ParmVarDecl::getDefaultArgTemporary(unsigned i) {
+ assert(getNumDefaultArgTemporaries() &&
+ "Default arguments does not have any temporaries!");
+
+ CXXExprWithTemporaries *E = cast<CXXExprWithTemporaries>(getInit());
+ return E->getTemporary(i);
+}
+
SourceRange ParmVarDecl::getDefaultArgRange() const {
if (const Expr *E = getInit())
return E->getSourceRange();
@@ -183,6 +212,9 @@ TypedefDecl *TypedefDecl::Create(ASTContext &C, DeclContext *DC,
return new (C) TypedefDecl(DC, L, Id, TInfo);
}
+// Anchor TypedefDecl's vtable here.
+TypedefDecl::~TypedefDecl() {}
+
EnumDecl *EnumDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, SourceLocation TKL,
EnumDecl *PrevDecl) {
@@ -426,11 +458,6 @@ std::string NamedDecl::getQualifiedNameAsString(const PrintingPolicy &P) const {
return getNameAsString();
while (Ctx) {
- if (Ctx->isFunctionOrMethod())
- // FIXME: That probably will happen, when D was member of local
- // scope class/struct/union. How do we handle this case?
- break;
-
if (const ClassTemplateSpecializationDecl *Spec
= dyn_cast<ClassTemplateSpecializationDecl>(Ctx)) {
const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
@@ -440,6 +467,48 @@ std::string NamedDecl::getQualifiedNameAsString(const PrintingPolicy &P) const {
TemplateArgs.flat_size(),
P);
Names.push_back(Spec->getIdentifier()->getNameStart() + TemplateArgsStr);
+ } else if (const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(Ctx)) {
+ if (ND->isAnonymousNamespace())
+ Names.push_back("<anonymous namespace>");
+ else
+ Names.push_back(ND->getNameAsString());
+ } else if (const RecordDecl *RD = dyn_cast<RecordDecl>(Ctx)) {
+ if (!RD->getIdentifier()) {
+ std::string RecordString = "<anonymous ";
+ RecordString += RD->getKindName();
+ RecordString += ">";
+ Names.push_back(RecordString);
+ } else {
+ Names.push_back(RD->getNameAsString());
+ }
+ } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(Ctx)) {
+ std::string Proto = FD->getNameAsString();
+
+ const FunctionProtoType *FT = 0;
+ if (FD->hasWrittenPrototype())
+ FT = dyn_cast<FunctionProtoType>(FD->getType()->getAs<FunctionType>());
+
+ Proto += "(";
+ if (FT) {
+ llvm::raw_string_ostream POut(Proto);
+ unsigned NumParams = FD->getNumParams();
+ for (unsigned i = 0; i < NumParams; ++i) {
+ if (i)
+ POut << ", ";
+ std::string Param;
+ FD->getParamDecl(i)->getType().getAsStringInternal(Param, P);
+ POut << Param;
+ }
+
+ if (FT->isVariadic()) {
+ if (NumParams > 0)
+ POut << ", ";
+ POut << "...";
+ }
+ }
+ Proto += ")";
+
+ Names.push_back(Proto);
} else if (const NamedDecl *ND = dyn_cast<NamedDecl>(Ctx))
Names.push_back(ND->getNameAsString());
else
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 292a3ed630ca..bbbb19a35b4a 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -164,8 +164,7 @@ CXXConstructorDecl *CXXRecordDecl::getCopyConstructor(ASTContext &Context,
if (isa<FunctionTemplateDecl>(*Con))
continue;
- if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context,
- FoundTQs)) {
+ if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(FoundTQs)) {
if (((TypeQuals & Qualifiers::Const) == (FoundTQs & Qualifiers::Const)) ||
(!(TypeQuals & Qualifiers::Const) && (FoundTQs & Qualifiers::Const)))
return cast<CXXConstructorDecl>(*Con);
@@ -246,7 +245,7 @@ CXXRecordDecl::addedConstructor(ASTContext &Context,
// Note when we have a user-declared copy constructor, which will
// suppress the implicit declaration of a copy constructor.
- if (ConDecl->isCopyConstructor(Context)) {
+ if (ConDecl->isCopyConstructor()) {
UserDeclaredCopyConstructor = true;
// C++ [class.copy]p6:
@@ -757,8 +756,7 @@ bool CXXConstructorDecl::isDefaultConstructor() const {
}
bool
-CXXConstructorDecl::isCopyConstructor(ASTContext &Context,
- unsigned &TypeQuals) const {
+CXXConstructorDecl::isCopyConstructor(unsigned &TypeQuals) const {
// C++ [class.copy]p2:
// A non-template constructor for class X is a copy constructor
// if its first parameter is of type X&, const X&, volatile X& or
@@ -779,6 +777,8 @@ CXXConstructorDecl::isCopyConstructor(ASTContext &Context,
return false;
// Is it a reference to our class type?
+ ASTContext &Context = getASTContext();
+
CanQualType PointeeType
= Context.getCanonicalType(ParamRefType->getPointeeType());
CanQualType ClassTy
@@ -874,7 +874,11 @@ FriendDecl *FriendDecl::Create(ASTContext &C, DeclContext *DC,
isa<CXXRecordDecl>(D) ||
isa<FunctionTemplateDecl>(D) ||
isa<ClassTemplateDecl>(D));
- assert(D->getFriendObjectKind());
+
+ // As a temporary hack, we permit template instantiation to point
+ // to the original declaration when instantiating members.
+ assert(D->getFriendObjectKind() ||
+ (cast<CXXRecordDecl>(DC)->getTemplateSpecializationKind()));
}
#endif
diff --git a/lib/AST/DeclGroup.cpp b/lib/AST/DeclGroup.cpp
index 5bdc88173461..434bf00d354e 100644
--- a/lib/AST/DeclGroup.cpp
+++ b/lib/AST/DeclGroup.cpp
@@ -32,6 +32,7 @@ DeclGroup::DeclGroup(unsigned numdecls, Decl** decls) : NumDecls(numdecls) {
}
void DeclGroup::Destroy(ASTContext& C) {
+ // Decls are destroyed by the DeclContext.
this->~DeclGroup();
C.Deallocate((void*) this);
}
diff --git a/lib/AST/DeclarationName.cpp b/lib/AST/DeclarationName.cpp
index 0ce03c214054..60c40e24fb31 100644
--- a/lib/AST/DeclarationName.cpp
+++ b/lib/AST/DeclarationName.cpp
@@ -210,7 +210,7 @@ std::string DeclarationName::getAsString() const {
}
case CXXOperatorName: {
- static const char *OperatorNames[NUM_OVERLOADED_OPERATORS] = {
+ static const char* const OperatorNames[NUM_OVERLOADED_OPERATORS] = {
0,
#define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
Spelling,
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 139e04b2ed5e..04a6abca87c9 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -174,6 +174,8 @@ std::string PredefinedExpr::ComputeName(ASTContext &Context, IdentType IT,
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
if (MD->isVirtual())
Out << "virtual ";
+ if (MD->isStatic())
+ Out << "static ";
}
PrintingPolicy Policy(Context.getLangOptions());
@@ -203,6 +205,14 @@ std::string PredefinedExpr::ComputeName(ASTContext &Context, IdentType IT,
}
Proto += ")";
+ if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
+ Qualifiers ThisQuals = Qualifiers::fromCVRMask(MD->getTypeQualifiers());
+ if (ThisQuals.hasConst())
+ Proto += " const";
+ if (ThisQuals.hasVolatile())
+ Proto += " volatile";
+ }
+
if (!isa<CXXConstructorDecl>(FD) && !isa<CXXDestructorDecl>(FD))
AFT->getResultType().getAsStringInternal(Proto, Policy);
@@ -398,14 +408,20 @@ void CallExpr::DoDestroy(ASTContext& C) {
C.Deallocate(this);
}
-FunctionDecl *CallExpr::getDirectCallee() {
+Decl *CallExpr::getCalleeDecl() {
Expr *CEE = getCallee()->IgnoreParenCasts();
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(CEE))
- return dyn_cast<FunctionDecl>(DRE->getDecl());
+ return DRE->getDecl();
+ if (MemberExpr *ME = dyn_cast<MemberExpr>(CEE))
+ return ME->getMemberDecl();
return 0;
}
+FunctionDecl *CallExpr::getDirectCallee() {
+ return dyn_cast_or_null<FunctionDecl>(getCalleeDecl());
+}
+
/// setNumArgs - This changes the number of arguments present in this call.
/// Any orphaned expressions are deleted by this, and any new operands are set
/// to null.
@@ -858,7 +874,7 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1,
case CXXMemberCallExprClass: {
// If this is a direct call, get the callee.
const CallExpr *CE = cast<CallExpr>(this);
- if (const FunctionDecl *FD = CE->getDirectCallee()) {
+ if (const Decl *FD = CE->getCalleeDecl()) {
// If the callee has attribute pure, const, or warn_unused_result, warn
// about it. void foo() { strlen("bar"); } should warn.
//
@@ -1047,8 +1063,13 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
// -- If E2 is a non-static data member [...]. If E1 is an
// lvalue, then E1.E2 is an lvalue.
- if (isa<FieldDecl>(Member))
- return m->isArrow() ? LV_Valid : m->getBase()->isLvalue(Ctx);
+ if (isa<FieldDecl>(Member)) {
+ if (m->isArrow())
+ return LV_Valid;
+ Expr *BaseExp = m->getBase();
+ return (BaseExp->getStmtClass() == ObjCPropertyRefExprClass) ?
+ LV_SubObjCPropertySetting : BaseExp->isLvalue(Ctx);
+ }
// -- If it refers to a static member function [...], then
// E1.E2 is an lvalue.
@@ -1065,9 +1086,13 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
// Not an lvalue.
return LV_InvalidExpression;
}
-
+
// C99 6.5.2.3p4
- return m->isArrow() ? LV_Valid : m->getBase()->isLvalue(Ctx);
+ if (m->isArrow())
+ return LV_Valid;
+ Expr *BaseExp = m->getBase();
+ return (BaseExp->getStmtClass() == ObjCPropertyRefExprClass) ?
+ LV_SubObjCPropertySetting : BaseExp->isLvalue(Ctx);
}
case UnaryOperatorClass:
if (cast<UnaryOperator>(this)->getOpcode() == UnaryOperator::Deref)
@@ -1204,6 +1229,16 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
return LV_Valid;
}
+ case Expr::CXXExprWithTemporariesClass:
+ return cast<CXXExprWithTemporaries>(this)->getSubExpr()->isLvalue(Ctx);
+
+ case Expr::ObjCMessageExprClass:
+ if (const ObjCMethodDecl *Method
+ = cast<ObjCMessageExpr>(this)->getMethodDecl())
+ if (Method->getResultType()->isLValueReferenceType())
+ return LV_Valid;
+ break;
+
default:
break;
}
@@ -1244,6 +1279,7 @@ Expr::isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc) const {
}
return MLV_InvalidExpression;
case LV_MemberFunction: return MLV_MemberFunction;
+ case LV_SubObjCPropertySetting: return MLV_SubObjCPropertySetting;
}
// The following is illegal:
@@ -1996,7 +2032,7 @@ ObjCMessageExpr::ObjCMessageExpr(Expr *receiver, Selector selInfo,
QualType retType, ObjCMethodDecl *mproto,
SourceLocation LBrac, SourceLocation RBrac,
Expr **ArgExprs, unsigned nargs)
- : Expr(ObjCMessageExprClass, retType), SelName(selInfo),
+ : Expr(ObjCMessageExprClass, retType, false, false), SelName(selInfo),
MethodProto(mproto) {
NumArgs = nargs;
SubExprs = new Stmt*[NumArgs+1];
@@ -2015,7 +2051,7 @@ ObjCMessageExpr::ObjCMessageExpr(IdentifierInfo *clsName, Selector selInfo,
QualType retType, ObjCMethodDecl *mproto,
SourceLocation LBrac, SourceLocation RBrac,
Expr **ArgExprs, unsigned nargs)
- : Expr(ObjCMessageExprClass, retType), SelName(selInfo),
+ : Expr(ObjCMessageExprClass, retType, false, false), SelName(selInfo),
MethodProto(mproto) {
NumArgs = nargs;
SubExprs = new Stmt*[NumArgs+1];
@@ -2033,7 +2069,7 @@ ObjCMessageExpr::ObjCMessageExpr(ObjCInterfaceDecl *cls, Selector selInfo,
QualType retType, ObjCMethodDecl *mproto,
SourceLocation LBrac, SourceLocation RBrac,
Expr **ArgExprs, unsigned nargs)
-: Expr(ObjCMessageExprClass, retType), SelName(selInfo),
+: Expr(ObjCMessageExprClass, retType, false, false), SelName(selInfo),
MethodProto(mproto) {
NumArgs = nargs;
SubExprs = new Stmt*[NumArgs+1];
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
index a9f96adae137..81584b700270 100644
--- a/lib/AST/ExprCXX.cpp
+++ b/lib/AST/ExprCXX.cpp
@@ -282,6 +282,18 @@ bool UnaryTypeTraitExpr::EvaluateTrait(ASTContext& C) const {
}
}
+SourceRange CXXConstructExpr::getSourceRange() const {
+ // FIXME: Should we know where the parentheses are, if there are any?
+ for (std::reverse_iterator<Stmt**> I(&Args[NumArgs]), E(&Args[0]); I!=E;++I) {
+ // Ignore CXXDefaultExprs when computing the range, as they don't
+ // have a range.
+ if (!isa<CXXDefaultArgExpr>(*I))
+ return SourceRange(Loc, (*I)->getLocEnd());
+ }
+
+ return SourceRange(Loc);
+}
+
SourceRange CXXOperatorCallExpr::getSourceRange() const {
OverloadedOperatorKind Kind = getOperator();
if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
@@ -340,6 +352,21 @@ const char *CXXNamedCastExpr::getCastName() const {
}
}
+CXXDefaultArgExpr *
+CXXDefaultArgExpr::Create(ASTContext &C, SourceLocation Loc,
+ ParmVarDecl *Param, Expr *SubExpr) {
+ void *Mem = C.Allocate(sizeof(CXXDefaultArgExpr) + sizeof(Stmt *));
+ return new (Mem) CXXDefaultArgExpr(CXXDefaultArgExprClass, Loc, Param,
+ SubExpr);
+}
+
+void CXXDefaultArgExpr::DoDestroy(ASTContext &C) {
+ if (Param.getInt())
+ getExpr()->Destroy(C);
+ this->~CXXDefaultArgExpr();
+ C.Deallocate(this);
+}
+
CXXTemporary *CXXTemporary::Create(ASTContext &C,
const CXXDestructorDecl *Destructor) {
return new (C) CXXTemporary(Destructor);
@@ -372,34 +399,40 @@ CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(ASTContext &C,
Expr **Args,
unsigned NumArgs,
SourceLocation rParenLoc)
- : CXXConstructExpr(C, CXXTemporaryObjectExprClass, writtenTy, Cons,
- false, Args, NumArgs),
+ : CXXConstructExpr(C, CXXTemporaryObjectExprClass, writtenTy, tyBeginLoc,
+ Cons, false, Args, NumArgs),
TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {
}
CXXConstructExpr *CXXConstructExpr::Create(ASTContext &C, QualType T,
+ SourceLocation Loc,
CXXConstructorDecl *D, bool Elidable,
- Expr **Args, unsigned NumArgs) {
- return new (C) CXXConstructExpr(C, CXXConstructExprClass, T, D, Elidable,
- Args, NumArgs);
+ Expr **Args, unsigned NumArgs,
+ bool ZeroInitialization) {
+ return new (C) CXXConstructExpr(C, CXXConstructExprClass, T, Loc, D,
+ Elidable, Args, NumArgs, ZeroInitialization);
}
CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
+ SourceLocation Loc,
CXXConstructorDecl *D, bool elidable,
- Expr **args, unsigned numargs)
+ Expr **args, unsigned numargs,
+ bool ZeroInitialization)
: Expr(SC, T,
T->isDependentType(),
(T->isDependentType() ||
CallExpr::hasAnyValueDependentArguments(args, numargs))),
- Constructor(D), Elidable(elidable), Args(0), NumArgs(numargs) {
- if (NumArgs) {
- Args = new (C) Stmt*[NumArgs];
-
- for (unsigned i = 0; i != NumArgs; ++i) {
- assert(args[i] && "NULL argument in CXXConstructExpr");
- Args[i] = args[i];
- }
+ Constructor(D), Loc(Loc), Elidable(elidable),
+ ZeroInitialization(ZeroInitialization), Args(0), NumArgs(numargs)
+{
+ if (NumArgs) {
+ Args = new (C) Stmt*[NumArgs];
+
+ for (unsigned i = 0; i != NumArgs; ++i) {
+ assert(args[i] && "NULL argument in CXXConstructExpr");
+ Args[i] = args[i];
}
+ }
}
CXXConstructExpr::CXXConstructExpr(EmptyShell Empty, ASTContext &C,
@@ -420,12 +453,10 @@ void CXXConstructExpr::DoDestroy(ASTContext &C) {
CXXExprWithTemporaries::CXXExprWithTemporaries(Expr *subexpr,
CXXTemporary **temps,
- unsigned numtemps,
- bool shoulddestroytemps)
+ unsigned numtemps)
: Expr(CXXExprWithTemporariesClass, subexpr->getType(),
subexpr->isTypeDependent(), subexpr->isValueDependent()),
- SubExpr(subexpr), Temps(0), NumTemps(numtemps),
- ShouldDestroyTemps(shoulddestroytemps) {
+ SubExpr(subexpr), Temps(0), NumTemps(numtemps) {
if (NumTemps > 0) {
Temps = new CXXTemporary*[NumTemps];
for (unsigned i = 0; i < NumTemps; ++i)
@@ -436,10 +467,8 @@ CXXExprWithTemporaries::CXXExprWithTemporaries(Expr *subexpr,
CXXExprWithTemporaries *CXXExprWithTemporaries::Create(ASTContext &C,
Expr *SubExpr,
CXXTemporary **Temps,
- unsigned NumTemps,
- bool ShouldDestroyTemps){
- return new (C) CXXExprWithTemporaries(SubExpr, Temps, NumTemps,
- ShouldDestroyTemps);
+ unsigned NumTemps) {
+ return new (C) CXXExprWithTemporaries(SubExpr, Temps, NumTemps);
}
void CXXExprWithTemporaries::DoDestroy(ASTContext &C) {
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 13831dc1f52c..06afec7675f1 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -222,7 +222,6 @@ public:
APValue VisitParenExpr(ParenExpr *E) { return Visit(E->getSubExpr()); }
APValue VisitDeclRefExpr(DeclRefExpr *E);
- APValue VisitBlockExpr(BlockExpr *E);
APValue VisitPredefinedExpr(PredefinedExpr *E) { return APValue(E, 0); }
APValue VisitCompoundLiteralExpr(CompoundLiteralExpr *E);
APValue VisitMemberExpr(MemberExpr *E);
@@ -270,13 +269,6 @@ APValue LValueExprEvaluator::VisitDeclRefExpr(DeclRefExpr *E) {
return APValue();
}
-APValue LValueExprEvaluator::VisitBlockExpr(BlockExpr *E) {
- if (E->hasBlockDeclRefExprs())
- return APValue();
-
- return APValue(E, 0);
-}
-
APValue LValueExprEvaluator::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
if (!Info.AnyLValue && !E->isFileScope())
return APValue();
@@ -366,7 +358,7 @@ public:
APValue VisitParenExpr(ParenExpr *E) { return Visit(E->getSubExpr()); }
APValue VisitBinaryOperator(const BinaryOperator *E);
- APValue VisitCastExpr(const CastExpr* E);
+ APValue VisitCastExpr(CastExpr* E);
APValue VisitUnaryExtension(const UnaryOperator *E)
{ return Visit(E->getSubExpr()); }
APValue VisitUnaryAddrOf(const UnaryOperator *E);
@@ -443,23 +435,49 @@ APValue PointerExprEvaluator::VisitUnaryAddrOf(const UnaryOperator *E) {
}
-APValue PointerExprEvaluator::VisitCastExpr(const CastExpr* E) {
- const Expr* SubExpr = E->getSubExpr();
+APValue PointerExprEvaluator::VisitCastExpr(CastExpr* E) {
+ Expr* SubExpr = E->getSubExpr();
- // Check for pointer->pointer cast
- if (SubExpr->getType()->isPointerType() ||
- SubExpr->getType()->isObjCObjectPointerType() ||
- SubExpr->getType()->isNullPtrType()) {
- APValue Result;
- if (EvaluatePointer(SubExpr, Result, Info))
+ switch (E->getCastKind()) {
+ default:
+ break;
+
+ case CastExpr::CK_Unknown: {
+ // FIXME: The handling for CK_Unknown is ugly/shouldn't be necessary!
+
+ // Check for pointer->pointer cast
+ if (SubExpr->getType()->isPointerType() ||
+ SubExpr->getType()->isObjCObjectPointerType() ||
+ SubExpr->getType()->isNullPtrType() ||
+ SubExpr->getType()->isBlockPointerType())
+ return Visit(SubExpr);
+
+ if (SubExpr->getType()->isIntegralType()) {
+ APValue Result;
+ if (!EvaluateIntegerOrLValue(SubExpr, Result, Info))
+ break;
+
+ if (Result.isInt()) {
+ Result.getInt().extOrTrunc((unsigned)Info.Ctx.getTypeSize(E->getType()));
+ return APValue(0, Result.getInt().getZExtValue());
+ }
+
+ // Cast is of an lvalue, no need to change value.
return Result;
- return APValue();
+ }
+ break;
}
- if (SubExpr->getType()->isIntegralType()) {
+ case CastExpr::CK_NoOp:
+ case CastExpr::CK_BitCast:
+ case CastExpr::CK_AnyPointerToObjCPointerCast:
+ case CastExpr::CK_AnyPointerToBlockPointerCast:
+ return Visit(SubExpr);
+
+ case CastExpr::CK_IntegralToPointer: {
APValue Result;
if (!EvaluateIntegerOrLValue(SubExpr, Result, Info))
- return APValue();
+ break;
if (Result.isInt()) {
Result.getInt().extOrTrunc((unsigned)Info.Ctx.getTypeSize(E->getType()));
@@ -469,14 +487,13 @@ APValue PointerExprEvaluator::VisitCastExpr(const CastExpr* E) {
// Cast is of an lvalue, no need to change value.
return Result;
}
-
- if (SubExpr->getType()->isFunctionType() ||
- SubExpr->getType()->isBlockPointerType() ||
- SubExpr->getType()->isArrayType()) {
+ case CastExpr::CK_ArrayToPointerDecay:
+ case CastExpr::CK_FunctionToPointerDecay: {
APValue Result;
if (EvaluateLValue(SubExpr, Result, Info))
return Result;
- return APValue();
+ break;
+ }
}
return APValue();
@@ -970,8 +987,9 @@ bool IntExprEvaluator::VisitCallExpr(const CallExpr *E) {
}
}
+ // TODO: Perhaps we should let LLVM lower this?
if (E->getArg(0)->HasSideEffects(Info.Ctx)) {
- if (E->getArg(1)->EvaluateAsInt(Info.Ctx).getZExtValue() < 2)
+ if (E->getArg(1)->EvaluateAsInt(Info.Ctx).getZExtValue() == 0)
return Success(-1ULL, E);
return Success(0, E);
}
@@ -1290,8 +1308,6 @@ unsigned IntExprEvaluator::GetAlignOfExpr(const Expr *E) {
/// VisitSizeAlignOfExpr - Evaluate a sizeof or alignof with a result as the
/// expression's type.
bool IntExprEvaluator::VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E) {
- QualType DstTy = E->getType();
-
// Handle alignof separately.
if (!E->isSizeOf()) {
if (E->isArgumentType())
diff --git a/lib/AST/FullExpr.cpp b/lib/AST/FullExpr.cpp
new file mode 100644
index 000000000000..f47284f3d060
--- /dev/null
+++ b/lib/AST/FullExpr.cpp
@@ -0,0 +1,58 @@
+//===--- FullExpr.cpp - C++ full expression class ---------------*- 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 FullExpr interface, to be used for type safe handling
+// of full expressions.
+//
+// Full expressions are described in C++ [intro.execution]p12.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/FullExpr.h"
+#include "clang/AST/Expr.h"
+#include "clang/AST/ExprCXX.h"
+#include "llvm/Support/AlignOf.h"
+using namespace clang;
+
+FullExpr FullExpr::Create(ASTContext &Context, Expr *SubExpr,
+ CXXTemporary **Temporaries, unsigned NumTemporaries) {
+ FullExpr E;
+
+ if (!NumTemporaries) {
+ E.SubExpr = SubExpr;
+ return E;
+ }
+
+ unsigned Size = sizeof(FullExpr)
+ + sizeof(CXXTemporary *) * NumTemporaries;
+
+ unsigned Align = llvm::AlignOf<ExprAndTemporaries>::Alignment;
+ ExprAndTemporaries *ET =
+ static_cast<ExprAndTemporaries *>(Context.Allocate(Size, Align));
+
+ ET->SubExpr = SubExpr;
+ std::copy(Temporaries, Temporaries + NumTemporaries, ET->temps_begin());
+
+ return E;
+}
+
+void FullExpr::Destroy(ASTContext &Context) {
+ if (Expr *E = SubExpr.dyn_cast<Expr *>()) {
+ E->Destroy(Context);
+ return;
+ }
+
+ ExprAndTemporaries *ET = SubExpr.get<ExprAndTemporaries *>();
+ for (ExprAndTemporaries::temps_iterator i = ET->temps_begin(),
+ e = ET->temps_end(); i != e; ++i)
+ (*i)->Destroy(Context);
+
+ Context.Deallocate(ET);
+}
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index fad80ec0cf23..7c7aeb8d3e1d 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -47,17 +47,6 @@ const char *Stmt::getStmtClassName() const {
return getStmtInfoTableEntry((StmtClass)sClass).Name;
}
-void Stmt::DestroyChildren(ASTContext &C) {
- for (child_iterator I = child_begin(), E = child_end(); I !=E; )
- if (Stmt* Child = *I++) Child->Destroy(C);
-}
-
-void Stmt::DoDestroy(ASTContext &C) {
- DestroyChildren(C);
- this->~Stmt();
- C.Deallocate((void *)this);
-}
-
void Stmt::PrintStats() {
// Ensure the table is primed.
getStmtInfoTableEntry(Stmt::NullStmtClass);
@@ -93,20 +82,6 @@ bool Stmt::CollectingStats(bool Enable) {
return StatSwitch;
}
-void SwitchStmt::DoDestroy(ASTContext &Ctx) {
- // Destroy the SwitchCase statements in this switch. In the normal
- // case, this loop will merely decrement the reference counts from
- // the Retain() calls in addSwitchCase();
- SwitchCase *SC = FirstCase;
- while (SC) {
- SwitchCase *Next = SC->getNextSwitchCase();
- SC->Destroy(Ctx);
- SC = Next;
- }
-
- Stmt::DoDestroy(Ctx);
-}
-
void CompoundStmt::setStmts(ASTContext &C, Stmt **Stmts, unsigned NumStmts) {
if (this->Body)
C.Deallocate(Body);
@@ -412,6 +387,71 @@ ObjCAtCatchStmt::ObjCAtCatchStmt(SourceLocation atCatchLoc,
RParenLoc = rparenloc;
}
+//===----------------------------------------------------------------------===//
+// AST Destruction.
+//===----------------------------------------------------------------------===//
+
+void Stmt::DestroyChildren(ASTContext &C) {
+ for (child_iterator I = child_begin(), E = child_end(); I !=E; )
+ if (Stmt* Child = *I++) Child->Destroy(C);
+}
+
+static void BranchDestroy(ASTContext &C, Stmt *S, Stmt **SubExprs,
+ unsigned NumExprs) {
+ // We do not use child_iterator here because that will include
+ // the expressions referenced by the condition variable.
+ for (Stmt **I = SubExprs, **E = SubExprs + NumExprs; I != E; ++I)
+ if (Stmt *Child = *I) Child->Destroy(C);
+
+ S->~Stmt();
+ C.Deallocate((void *) S);
+}
+
+void Stmt::DoDestroy(ASTContext &C) {
+ DestroyChildren(C);
+ this->~Stmt();
+ C.Deallocate((void *)this);
+}
+
+void CXXCatchStmt::DoDestroy(ASTContext& C) {
+ if (ExceptionDecl)
+ ExceptionDecl->Destroy(C);
+ Stmt::DoDestroy(C);
+}
+
+void DeclStmt::DoDestroy(ASTContext &C) {
+ // Don't use StmtIterator to iterate over the Decls, as that can recurse
+ // into VLA size expressions (which are owned by the VLA). Further, Decls
+ // are owned by the DeclContext, and will be destroyed with them.
+ if (DG.isDeclGroup())
+ DG.getDeclGroup().Destroy(C);
+}
+
+void IfStmt::DoDestroy(ASTContext &C) {
+ BranchDestroy(C, this, SubExprs, END_EXPR);
+}
+
+void ForStmt::DoDestroy(ASTContext &C) {
+ BranchDestroy(C, this, SubExprs, END_EXPR);
+}
+
+void SwitchStmt::DoDestroy(ASTContext &C) {
+ // Destroy the SwitchCase statements in this switch. In the normal
+ // case, this loop will merely decrement the reference counts from
+ // the Retain() calls in addSwitchCase();
+ SwitchCase *SC = FirstCase;
+ while (SC) {
+ SwitchCase *Next = SC->getNextSwitchCase();
+ SC->Destroy(C);
+ SC = Next;
+ }
+
+ BranchDestroy(C, this, SubExprs, END_EXPR);
+}
+
+void WhileStmt::DoDestroy(ASTContext &C) {
+ BranchDestroy(C, this, SubExprs, END_EXPR);
+}
//===----------------------------------------------------------------------===//
// Child Iterators for iterating over subexpressions/substatements
@@ -447,24 +487,40 @@ Stmt::child_iterator LabelStmt::child_begin() { return &SubStmt; }
Stmt::child_iterator LabelStmt::child_end() { return &SubStmt+1; }
// IfStmt
-Stmt::child_iterator IfStmt::child_begin() { return &SubExprs[0]; }
-Stmt::child_iterator IfStmt::child_end() { return &SubExprs[0]+END_EXPR; }
+Stmt::child_iterator IfStmt::child_begin() {
+ return child_iterator(Var, &SubExprs[0]);
+}
+Stmt::child_iterator IfStmt::child_end() {
+ return child_iterator(0, &SubExprs[0]+END_EXPR);
+}
// SwitchStmt
-Stmt::child_iterator SwitchStmt::child_begin() { return &SubExprs[0]; }
-Stmt::child_iterator SwitchStmt::child_end() { return &SubExprs[0]+END_EXPR; }
+Stmt::child_iterator SwitchStmt::child_begin() {
+ return child_iterator(Var, &SubExprs[0]);
+}
+Stmt::child_iterator SwitchStmt::child_end() {
+ return child_iterator(0, &SubExprs[0]+END_EXPR);
+}
// WhileStmt
-Stmt::child_iterator WhileStmt::child_begin() { return &SubExprs[0]; }
-Stmt::child_iterator WhileStmt::child_end() { return &SubExprs[0]+END_EXPR; }
+Stmt::child_iterator WhileStmt::child_begin() {
+ return child_iterator(Var, &SubExprs[0]);
+}
+Stmt::child_iterator WhileStmt::child_end() {
+ return child_iterator(0, &SubExprs[0]+END_EXPR);
+}
// DoStmt
Stmt::child_iterator DoStmt::child_begin() { return &SubExprs[0]; }
Stmt::child_iterator DoStmt::child_end() { return &SubExprs[0]+END_EXPR; }
// ForStmt
-Stmt::child_iterator ForStmt::child_begin() { return &SubExprs[0]; }
-Stmt::child_iterator ForStmt::child_end() { return &SubExprs[0]+END_EXPR; }
+Stmt::child_iterator ForStmt::child_begin() {
+ return child_iterator(CondVar, &SubExprs[0]);
+}
+Stmt::child_iterator ForStmt::child_end() {
+ return child_iterator(0, &SubExprs[0]+END_EXPR);
+}
// ObjCForCollectionStmt
Stmt::child_iterator ObjCForCollectionStmt::child_begin() {
@@ -565,12 +621,6 @@ QualType CXXCatchStmt::getCaughtType() const {
return QualType();
}
-void CXXCatchStmt::DoDestroy(ASTContext& C) {
- if (ExceptionDecl)
- ExceptionDecl->Destroy(C);
- Stmt::DoDestroy(C);
-}
-
// CXXTryStmt
Stmt::child_iterator CXXTryStmt::child_begin() { return &Stmts[0]; }
Stmt::child_iterator CXXTryStmt::child_end() { return &Stmts[0]+Stmts.size(); }
diff --git a/lib/AST/StmtIterator.cpp b/lib/AST/StmtIterator.cpp
index 4f62b66e257d..7fc7c96750de 100644
--- a/lib/AST/StmtIterator.cpp
+++ b/lib/AST/StmtIterator.cpp
@@ -65,7 +65,7 @@ void StmtIteratorBase::NextDecl(bool ImmediateAdvance) {
assert (getVAPtr() == NULL);
if (inDecl()) {
- assert (decl);
+ assert(decl);
// FIXME: SIMPLIFY AWAY.
if (ImmediateAdvance)
@@ -74,7 +74,7 @@ void StmtIteratorBase::NextDecl(bool ImmediateAdvance) {
return;
}
else {
- assert (inDeclGroup());
+ assert(inDeclGroup());
if (ImmediateAdvance)
++DGI;
@@ -113,19 +113,19 @@ bool StmtIteratorBase::HandleDecl(Decl* D) {
return false;
}
-StmtIteratorBase::StmtIteratorBase(Decl* d)
- : decl(d), RawVAPtr(DeclMode) {
- assert (decl);
- NextDecl(false);
+StmtIteratorBase::StmtIteratorBase(Decl *d, Stmt **s)
+ : stmt(s), decl(d), RawVAPtr(d ? DeclMode : 0) {
+ if (decl)
+ NextDecl(false);
}
StmtIteratorBase::StmtIteratorBase(Decl** dgi, Decl** dge)
- : DGI(dgi), RawVAPtr(DeclGroupMode), DGE(dge) {
+ : stmt(0), DGI(dgi), RawVAPtr(DeclGroupMode), DGE(dge) {
NextDecl(false);
}
StmtIteratorBase::StmtIteratorBase(VariableArrayType* t)
-: decl(0), RawVAPtr(SizeOfTypeVAMode) {
+ : stmt(0), decl(0), RawVAPtr(SizeOfTypeVAMode) {
RawVAPtr |= reinterpret_cast<uintptr_t>(t);
}
diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp
index e2d772b7dd12..b74e1ef0bab4 100644
--- a/lib/AST/StmtProfile.cpp
+++ b/lib/AST/StmtProfile.cpp
@@ -540,7 +540,6 @@ StmtProfiler::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *S) {
void StmtProfiler::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *S) {
VisitExpr(S);
- ID.AddBoolean(S->shouldDestroyTemporaries());
for (unsigned I = 0, N = S->getNumTemporaries(); I != N; ++I)
VisitDecl(
const_cast<CXXDestructorDecl *>(S->getTemporary(I)->getDestructor()));
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 687beaea08c2..e0055f187825 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -387,8 +387,6 @@ bool Type::isIntegerType() const {
// FIXME: In C++, enum types are never integer types.
if (TT->getDecl()->isEnum() && TT->getDecl()->isDefinition())
return true;
- if (isa<FixedWidthIntType>(CanonicalType))
- return true;
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
return VT->getElementType()->isIntegerType();
return false;
@@ -397,13 +395,11 @@ bool Type::isIntegerType() const {
bool Type::isIntegralType() const {
if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
return BT->getKind() >= BuiltinType::Bool &&
- BT->getKind() <= BuiltinType::LongLong;
+ BT->getKind() <= BuiltinType::Int128;
if (const TagType *TT = dyn_cast<TagType>(CanonicalType))
if (TT->getDecl()->isEnum() && TT->getDecl()->isDefinition())
return true; // Complete enum types are integral.
// FIXME: In C++, enum types are never integral.
- if (isa<FixedWidthIntType>(CanonicalType))
- return true;
return false;
}
@@ -453,16 +449,12 @@ bool Type::isAnyCharacterType() const {
bool Type::isSignedIntegerType() const {
if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
return BT->getKind() >= BuiltinType::Char_S &&
- BT->getKind() <= BuiltinType::LongLong;
+ BT->getKind() <= BuiltinType::Int128;
}
if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
return ET->getDecl()->getIntegerType()->isSignedIntegerType();
- if (const FixedWidthIntType *FWIT =
- dyn_cast<FixedWidthIntType>(CanonicalType))
- return FWIT->isSigned();
-
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
return VT->getElementType()->isSignedIntegerType();
return false;
@@ -481,10 +473,6 @@ bool Type::isUnsignedIntegerType() const {
if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
return ET->getDecl()->getIntegerType()->isUnsignedIntegerType();
- if (const FixedWidthIntType *FWIT =
- dyn_cast<FixedWidthIntType>(CanonicalType))
- return !FWIT->isSigned();
-
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
return VT->getElementType()->isUnsignedIntegerType();
return false;
@@ -515,8 +503,6 @@ bool Type::isRealType() const {
BT->getKind() <= BuiltinType::LongDouble;
if (const TagType *TT = dyn_cast<TagType>(CanonicalType))
return TT->getDecl()->isEnum() && TT->getDecl()->isDefinition();
- if (isa<FixedWidthIntType>(CanonicalType))
- return true;
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
return VT->getElementType()->isRealType();
return false;
@@ -530,8 +516,6 @@ bool Type::isArithmeticType() const {
// GCC allows forward declaration of enum types (forbid by C99 6.7.2.3p2).
// If a body isn't seen by the time we get here, return false.
return ET->getDecl()->isDefinition();
- if (isa<FixedWidthIntType>(CanonicalType))
- return true;
return isa<ComplexType>(CanonicalType) || isa<VectorType>(CanonicalType);
}
@@ -545,8 +529,6 @@ bool Type::isScalarType() const {
return true;
return false;
}
- if (isa<FixedWidthIntType>(CanonicalType))
- return true;
return isa<PointerType>(CanonicalType) ||
isa<BlockPointerType>(CanonicalType) ||
isa<MemberPointerType>(CanonicalType) ||
@@ -725,6 +707,7 @@ bool Type::isSpecifierType() const {
case Typename:
case ObjCInterface:
case ObjCObjectPointer:
+ case Elaborated:
return true;
default:
return false;
diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp
index 4a2b95617290..818657c2a763 100644
--- a/lib/AST/TypePrinter.cpp
+++ b/lib/AST/TypePrinter.cpp
@@ -94,21 +94,6 @@ void TypePrinter::PrintBuiltin(const BuiltinType *T, std::string &S) {
}
}
-void TypePrinter::PrintFixedWidthInt(const FixedWidthIntType *T,
- std::string &S) {
- // FIXME: Once we get bitwidth attribute, write as
- // "int __attribute__((bitwidth(x)))".
- std::string prefix = "__clang_fixedwidth";
- prefix += llvm::utostr_32(T->getWidth());
- prefix += (char)(T->isSigned() ? 'S' : 'U');
- if (S.empty()) {
- S = prefix;
- } else {
- // Prefix the basic type, e.g. 'int X'.
- S = prefix + S;
- }
-}
-
void TypePrinter::PrintComplex(const ComplexType *T, std::string &S) {
Print(T->getElementType(), S);
S = "_Complex " + S;
diff --git a/lib/Analysis/AnalysisContext.cpp b/lib/Analysis/AnalysisContext.cpp
index 05e5196c5b97..97e6d914d450 100644
--- a/lib/Analysis/AnalysisContext.cpp
+++ b/lib/Analysis/AnalysisContext.cpp
@@ -105,7 +105,7 @@ void LocationContext::ProfileCommon(llvm::FoldingSetNodeID &ID,
}
void StackFrameContext::Profile(llvm::FoldingSetNodeID &ID) {
- Profile(ID, getAnalysisContext(), getParent(), CallSite);
+ Profile(ID, getAnalysisContext(), getParent(), CallSite, Block, Index);
}
void ScopeContext::Profile(llvm::FoldingSetNodeID &ID) {
@@ -145,8 +145,18 @@ LocationContextManager::getLocationContext(AnalysisContext *ctx,
const StackFrameContext*
LocationContextManager::getStackFrame(AnalysisContext *ctx,
const LocationContext *parent,
- const Stmt *s) {
- return getLocationContext<StackFrameContext, Stmt>(ctx, parent, s);
+ const Stmt *s, const CFGBlock *blk,
+ unsigned idx) {
+ llvm::FoldingSetNodeID ID;
+ StackFrameContext::Profile(ID, ctx, parent, s, blk, idx);
+ void *InsertPos;
+ StackFrameContext *L =
+ cast_or_null<StackFrameContext>(Contexts.FindNodeOrInsertPos(ID, InsertPos));
+ if (!L) {
+ L = new StackFrameContext(ctx, parent, s, blk, idx);
+ Contexts.InsertNode(L, InsertPos);
+ }
+ return L;
}
const ScopeContext *
diff --git a/lib/Analysis/BasicObjCFoundationChecks.cpp b/lib/Analysis/BasicObjCFoundationChecks.cpp
index c91377986496..67483d979291 100644
--- a/lib/Analysis/BasicObjCFoundationChecks.cpp
+++ b/lib/Analysis/BasicObjCFoundationChecks.cpp
@@ -294,7 +294,7 @@ namespace {
}
static Optional<uint64_t> GetCFNumberSize(ASTContext& Ctx, uint64_t i) {
- static unsigned char FixedSize[] = { 8, 16, 32, 64, 32, 64 };
+ static const unsigned char FixedSize[] = { 8, 16, 32, 64, 32, 64 };
if (i < kCFNumberCharType)
return FixedSize[i-1];
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp
index a38aaa7eb268..224281b17770 100644
--- a/lib/Analysis/BasicStore.cpp
+++ b/lib/Analysis/BasicStore.cpp
@@ -479,15 +479,14 @@ Store BasicStoreManager::getInitialStore(const LocationContext *InitLoc) {
const Decl& CD = *InitLoc->getDecl();
if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(&CD)) {
if (MD->getSelfDecl() == PD) {
- // FIXME: Just use a symbolic region, and remove ObjCObjectRegion
- // entirely.
- const ObjCObjectRegion *SelfRegion =
- MRMgr.getObjCObjectRegion(MD->getClassInterface(),
- MRMgr.getHeapRegion());
-
- St = BindInternal(St, ValMgr.makeLoc(MRMgr.getVarRegion(PD, InitLoc)),
- ValMgr.makeLoc(SelfRegion));
-
+ // FIXME: Add type constraints (when they become available) to
+ // SelfRegion? (i.e., it implements MD->getClassInterface()).
+ const MemRegion *VR = MRMgr.getVarRegion(PD, InitLoc);
+ const MemRegion *SelfRegion =
+ ValMgr.getRegionValueSymbolVal(VR).getAsRegion();
+ assert(SelfRegion);
+ St = BindInternal(St, ValMgr.makeLoc(VR),
+ loc::MemRegionVal(SelfRegion));
// Scan the method for ivar references. While this requires an
// entire AST scan, the cost should not be high in practice.
St = scanForIvars(MD->getBody(), PD, SelfRegion, St);
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp
index e1a1e72c2043..eab7da7e8370 100644
--- a/lib/Analysis/CFG.cpp
+++ b/lib/Analysis/CFG.cpp
@@ -34,6 +34,17 @@ static SourceLocation GetEndLoc(Decl* D) {
return D->getLocation();
}
+
+class AddStmtChoice {
+public:
+ enum Kind { NotAlwaysAdd = 0, AlwaysAdd, AlwaysAddAsLValue };
+public:
+ AddStmtChoice(Kind kind) : k(kind) {}
+ bool alwaysAdd() const { return k != NotAlwaysAdd; }
+ bool asLValue() const { return k == AlwaysAddAsLValue; }
+private:
+ Kind k;
+};
/// CFGBuilder - This class implements CFG construction from an AST.
/// The builder is stateful: an instance of the builder should be used to only
@@ -84,15 +95,16 @@ public:
private:
// Visitors to walk an AST and construct the CFG.
- CFGBlock *VisitAddrLabelExpr(AddrLabelExpr *A, bool alwaysAdd);
- CFGBlock *VisitBinaryOperator(BinaryOperator *B, bool alwaysAdd);
- CFGBlock *VisitBlockExpr(BlockExpr* E, bool alwaysAdd);
+ CFGBlock *VisitAddrLabelExpr(AddrLabelExpr *A, AddStmtChoice asc);
+ CFGBlock *VisitBinaryOperator(BinaryOperator *B, AddStmtChoice asc);
+ CFGBlock *VisitBlockExpr(BlockExpr* E, AddStmtChoice asc);
CFGBlock *VisitBreakStmt(BreakStmt *B);
- CFGBlock *VisitCallExpr(CallExpr *C, bool alwaysAdd);
+ CFGBlock *VisitCallExpr(CallExpr *C, AddStmtChoice asc);
CFGBlock *VisitCaseStmt(CaseStmt *C);
- CFGBlock *VisitChooseExpr(ChooseExpr *C);
+ CFGBlock *VisitChooseExpr(ChooseExpr *C, AddStmtChoice asc);
CFGBlock *VisitCompoundStmt(CompoundStmt *C);
- CFGBlock *VisitConditionalOperator(ConditionalOperator *C);
+ CFGBlock *VisitConditionalOperator(ConditionalOperator *C,
+ AddStmtChoice asc);
CFGBlock *VisitContinueStmt(ContinueStmt *C);
CFGBlock *VisitCXXCatchStmt(CXXCatchStmt *S) { return NYS(); }
CFGBlock *VisitCXXThrowExpr(CXXThrowExpr *T);
@@ -112,13 +124,13 @@ private:
CFGBlock *VisitObjCAtTryStmt(ObjCAtTryStmt *S);
CFGBlock *VisitObjCForCollectionStmt(ObjCForCollectionStmt *S);
CFGBlock *VisitReturnStmt(ReturnStmt* R);
- CFGBlock *VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E, bool alwaysAdd);
- CFGBlock *VisitStmtExpr(StmtExpr *S, bool alwaysAdd);
+ CFGBlock *VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E, AddStmtChoice asc);
+ CFGBlock *VisitStmtExpr(StmtExpr *S, AddStmtChoice asc);
CFGBlock *VisitSwitchStmt(SwitchStmt *S);
CFGBlock *VisitWhileStmt(WhileStmt *W);
- CFGBlock *Visit(Stmt *S, bool alwaysAdd = false);
- CFGBlock *VisitStmt(Stmt *S, bool alwaysAdd);
+ CFGBlock *Visit(Stmt *S, AddStmtChoice asc = AddStmtChoice::NotAlwaysAdd);
+ CFGBlock *VisitStmt(Stmt *S, AddStmtChoice asc);
CFGBlock *VisitChildren(Stmt* S);
// NYS == Not Yet Supported
@@ -130,10 +142,13 @@ private:
void autoCreateBlock() { if (!Block) Block = createBlock(); }
CFGBlock *createBlock(bool add_successor = true);
bool FinishBlock(CFGBlock* B);
- CFGBlock *addStmt(Stmt *S) { return Visit(S, true); }
+ CFGBlock *addStmt(Stmt *S, AddStmtChoice asc = AddStmtChoice::AlwaysAdd) {
+ return Visit(S, asc);
+ }
- void AppendStmt(CFGBlock *B, Stmt *S) {
- B->appendStmt(S, cfg->getBumpVectorContext());
+ void AppendStmt(CFGBlock *B, Stmt *S,
+ AddStmtChoice asc = AddStmtChoice::AlwaysAdd) {
+ B->appendStmt(S, cfg->getBumpVectorContext(), asc.asLValue());
}
void AddSuccessor(CFGBlock *B, CFGBlock *S) {
@@ -278,38 +293,38 @@ bool CFGBuilder::FinishBlock(CFGBlock* B) {
/// Visit - Walk the subtree of a statement and add extra
/// blocks for ternary operators, &&, and ||. We also process "," and
/// DeclStmts (which may contain nested control-flow).
-CFGBlock* CFGBuilder::Visit(Stmt * S, bool alwaysAdd) {
+CFGBlock* CFGBuilder::Visit(Stmt * S, AddStmtChoice asc) {
tryAgain:
switch (S->getStmtClass()) {
default:
- return VisitStmt(S, alwaysAdd);
+ return VisitStmt(S, asc);
case Stmt::AddrLabelExprClass:
- return VisitAddrLabelExpr(cast<AddrLabelExpr>(S), alwaysAdd);
+ return VisitAddrLabelExpr(cast<AddrLabelExpr>(S), asc);
case Stmt::BinaryOperatorClass:
- return VisitBinaryOperator(cast<BinaryOperator>(S), alwaysAdd);
+ return VisitBinaryOperator(cast<BinaryOperator>(S), asc);
case Stmt::BlockExprClass:
- return VisitBlockExpr(cast<BlockExpr>(S), alwaysAdd);
+ return VisitBlockExpr(cast<BlockExpr>(S), asc);
case Stmt::BreakStmtClass:
return VisitBreakStmt(cast<BreakStmt>(S));
case Stmt::CallExprClass:
- return VisitCallExpr(cast<CallExpr>(S), alwaysAdd);
+ return VisitCallExpr(cast<CallExpr>(S), asc);
case Stmt::CaseStmtClass:
return VisitCaseStmt(cast<CaseStmt>(S));
case Stmt::ChooseExprClass:
- return VisitChooseExpr(cast<ChooseExpr>(S));
+ return VisitChooseExpr(cast<ChooseExpr>(S), asc);
case Stmt::CompoundStmtClass:
return VisitCompoundStmt(cast<CompoundStmt>(S));
case Stmt::ConditionalOperatorClass:
- return VisitConditionalOperator(cast<ConditionalOperator>(S));
+ return VisitConditionalOperator(cast<ConditionalOperator>(S), asc);
case Stmt::ContinueStmtClass:
return VisitContinueStmt(cast<ContinueStmt>(S));
@@ -367,10 +382,10 @@ tryAgain:
return VisitReturnStmt(cast<ReturnStmt>(S));
case Stmt::SizeOfAlignOfExprClass:
- return VisitSizeOfAlignOfExpr(cast<SizeOfAlignOfExpr>(S), alwaysAdd);
+ return VisitSizeOfAlignOfExpr(cast<SizeOfAlignOfExpr>(S), asc);
case Stmt::StmtExprClass:
- return VisitStmtExpr(cast<StmtExpr>(S), alwaysAdd);
+ return VisitStmtExpr(cast<StmtExpr>(S), asc);
case Stmt::SwitchStmtClass:
return VisitSwitchStmt(cast<SwitchStmt>(S));
@@ -380,10 +395,10 @@ tryAgain:
}
}
-CFGBlock *CFGBuilder::VisitStmt(Stmt *S, bool alwaysAdd) {
- if (alwaysAdd) {
+CFGBlock *CFGBuilder::VisitStmt(Stmt *S, AddStmtChoice asc) {
+ if (asc.alwaysAdd()) {
autoCreateBlock();
- AppendStmt(Block, S);
+ AppendStmt(Block, S, asc);
}
return VisitChildren(S);
@@ -399,21 +414,23 @@ CFGBlock *CFGBuilder::VisitChildren(Stmt* Terminator) {
return B;
}
-CFGBlock *CFGBuilder::VisitAddrLabelExpr(AddrLabelExpr *A, bool alwaysAdd) {
+CFGBlock *CFGBuilder::VisitAddrLabelExpr(AddrLabelExpr *A,
+ AddStmtChoice asc) {
AddressTakenLabels.insert(A->getLabel());
- if (alwaysAdd) {
+ if (asc.alwaysAdd()) {
autoCreateBlock();
- AppendStmt(Block, A);
+ AppendStmt(Block, A, asc);
}
return Block;
}
-CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B, bool alwaysAdd) {
+CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B,
+ AddStmtChoice asc) {
if (B->isLogicalOp()) { // && or ||
CFGBlock* ConfluenceBlock = Block ? Block : createBlock();
- AppendStmt(ConfluenceBlock, B);
+ AppendStmt(ConfluenceBlock, B, asc);
if (!FinishBlock(ConfluenceBlock))
return 0;
@@ -450,18 +467,18 @@ CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B, bool alwaysAdd) {
}
else if (B->getOpcode() == BinaryOperator::Comma) { // ,
autoCreateBlock();
- AppendStmt(Block, B);
+ AppendStmt(Block, B, asc);
addStmt(B->getRHS());
return addStmt(B->getLHS());
}
- return VisitStmt(B, alwaysAdd);
+ return VisitStmt(B, asc);
}
-CFGBlock *CFGBuilder::VisitBlockExpr(BlockExpr *E, bool alwaysAdd) {
- if (alwaysAdd) {
+CFGBlock *CFGBuilder::VisitBlockExpr(BlockExpr *E, AddStmtChoice asc) {
+ if (asc.alwaysAdd()) {
autoCreateBlock();
- AppendStmt(Block, E);
+ AppendStmt(Block, E, asc);
}
return Block;
}
@@ -487,7 +504,7 @@ CFGBlock *CFGBuilder::VisitBreakStmt(BreakStmt *B) {
return Block;
}
-CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, bool alwaysAdd) {
+CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, AddStmtChoice asc) {
// If this is a call to a no-return function, this stops the block here.
bool NoReturn = false;
if (C->getCallee()->getType().getNoReturnAttr()) {
@@ -499,14 +516,14 @@ CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, bool alwaysAdd) {
NoReturn = true;
if (!NoReturn)
- return VisitStmt(C, alwaysAdd);
+ return VisitStmt(C, asc);
if (Block && !FinishBlock(Block))
return 0;
// Create new block with no successor for the remaining pieces.
Block = createBlock(false);
- AppendStmt(Block, C);
+ AppendStmt(Block, C, asc);
// Wire this to the exit block directly.
AddSuccessor(Block, &cfg->getExit());
@@ -514,9 +531,10 @@ CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, bool alwaysAdd) {
return VisitChildren(C);
}
-CFGBlock *CFGBuilder::VisitChooseExpr(ChooseExpr *C) {
+CFGBlock *CFGBuilder::VisitChooseExpr(ChooseExpr *C,
+ AddStmtChoice asc) {
CFGBlock* ConfluenceBlock = Block ? Block : createBlock();
- AppendStmt(ConfluenceBlock, C);
+ AppendStmt(ConfluenceBlock, C, asc);
if (!FinishBlock(ConfluenceBlock))
return 0;
@@ -555,11 +573,12 @@ CFGBlock* CFGBuilder::VisitCompoundStmt(CompoundStmt* C) {
return LastBlock;
}
-CFGBlock *CFGBuilder::VisitConditionalOperator(ConditionalOperator *C) {
+CFGBlock *CFGBuilder::VisitConditionalOperator(ConditionalOperator *C,
+ AddStmtChoice asc) {
// Create the confluence block that will "merge" the results of the ternary
// expression.
CFGBlock* ConfluenceBlock = Block ? Block : createBlock();
- AppendStmt(ConfluenceBlock, C);
+ AppendStmt(ConfluenceBlock, C, asc);
if (!FinishBlock(ConfluenceBlock))
return 0;
@@ -670,7 +689,10 @@ CFGBlock *CFGBuilder::VisitDeclSubExpr(Decl* D) {
case Stmt::StringLiteralClass:
break;
default:
- Block = addStmt(Init);
+ Block = addStmt(Init,
+ VD->getType()->isReferenceType()
+ ? AddStmtChoice::AlwaysAddAsLValue
+ : AddStmtChoice::AlwaysAdd);
}
}
@@ -754,7 +776,19 @@ CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) {
// Add the condition as the last statement in the new block. This may create
// new blocks as the condition may contain control-flow. Any newly created
// blocks will be pointed to be "Block".
- return addStmt(I->getCond());
+ Block = addStmt(I->getCond());
+
+ // Finally, if the IfStmt contains a condition variable, add both the IfStmt
+ // and the condition variable initialization to the CFG.
+ if (VarDecl *VD = I->getConditionVariable()) {
+ if (Expr *Init = VD->getInit()) {
+ autoCreateBlock();
+ AppendStmt(Block, I, AddStmtChoice::AlwaysAdd);
+ addStmt(Init);
+ }
+ }
+
+ return Block;
}
@@ -776,7 +810,7 @@ CFGBlock* CFGBuilder::VisitReturnStmt(ReturnStmt* R) {
// Add the return statement to the block. This may create new blocks if R
// contains control-flow (short-circuit operations).
- return VisitStmt(R, true);
+ return VisitStmt(R, AddStmtChoice::AlwaysAdd);
}
CFGBlock* CFGBuilder::VisitLabelStmt(LabelStmt* L) {
@@ -854,6 +888,19 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) {
if (Stmt* C = F->getCond()) {
Block = ExitConditionBlock;
EntryConditionBlock = addStmt(C);
+ assert(Block == EntryConditionBlock);
+
+ // If this block contains a condition variable, add both the condition
+ // variable and initializer to the CFG.
+ if (VarDecl *VD = F->getConditionVariable()) {
+ if (Expr *Init = VD->getInit()) {
+ autoCreateBlock();
+ AppendStmt(Block, F, AddStmtChoice::AlwaysAdd);
+ EntryConditionBlock = addStmt(Init);
+ assert(Block == EntryConditionBlock);
+ }
+ }
+
if (Block) {
if (!FinishBlock(EntryConditionBlock))
return 0;
@@ -1000,7 +1047,7 @@ CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
// Walk the 'element' expression to see if there are any side-effects. We
// generate new blocks as necesary. We DON'T add the statement by default to
// the CFG unless it contains control-flow.
- EntryConditionBlock = Visit(S->getElement(), false);
+ EntryConditionBlock = Visit(S->getElement(), AddStmtChoice::NotAlwaysAdd);
if (Block) {
if (!FinishBlock(EntryConditionBlock))
return 0;
@@ -1096,6 +1143,18 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) {
Block = ExitConditionBlock;
EntryConditionBlock = addStmt(C);
assert(Block == EntryConditionBlock);
+
+ // If this block contains a condition variable, add both the condition
+ // variable and initializer to the CFG.
+ if (VarDecl *VD = W->getConditionVariable()) {
+ if (Expr *Init = VD->getInit()) {
+ autoCreateBlock();
+ AppendStmt(Block, W, AddStmtChoice::AlwaysAdd);
+ EntryConditionBlock = addStmt(Init);
+ assert(Block == EntryConditionBlock);
+ }
+ }
+
if (Block) {
if (!FinishBlock(EntryConditionBlock))
return 0;
@@ -1182,7 +1241,7 @@ CFGBlock* CFGBuilder::VisitObjCAtThrowStmt(ObjCAtThrowStmt* S) {
// Add the statement to the block. This may create new blocks if S contains
// control-flow (short-circuit operations).
- return VisitStmt(S, true);
+ return VisitStmt(S, AddStmtChoice::AlwaysAdd);
}
CFGBlock* CFGBuilder::VisitCXXThrowExpr(CXXThrowExpr* T) {
@@ -1198,7 +1257,7 @@ CFGBlock* CFGBuilder::VisitCXXThrowExpr(CXXThrowExpr* T) {
// Add the statement to the block. This may create new blocks if S contains
// control-flow (short-circuit operations).
- return VisitStmt(T, true);
+ return VisitStmt(T, AddStmtChoice::AlwaysAdd);
}
CFGBlock *CFGBuilder::VisitDoStmt(DoStmt* D) {
@@ -1316,9 +1375,9 @@ CFGBlock* CFGBuilder::VisitContinueStmt(ContinueStmt* C) {
}
CFGBlock *CFGBuilder::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E,
- bool alwaysAdd) {
+ AddStmtChoice asc) {
- if (alwaysAdd) {
+ if (asc.alwaysAdd()) {
autoCreateBlock();
AppendStmt(Block, E);
}
@@ -1335,8 +1394,8 @@ CFGBlock *CFGBuilder::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E,
/// VisitStmtExpr - Utility method to handle (nested) statement
/// expressions (a GCC extension).
-CFGBlock* CFGBuilder::VisitStmtExpr(StmtExpr *SE, bool alwaysAdd) {
- if (alwaysAdd) {
+CFGBlock* CFGBuilder::VisitStmtExpr(StmtExpr *SE, AddStmtChoice asc) {
+ if (asc.alwaysAdd()) {
autoCreateBlock();
AppendStmt(Block, SE);
}
@@ -1391,8 +1450,19 @@ CFGBlock* CFGBuilder::VisitSwitchStmt(SwitchStmt* Terminator) {
SwitchTerminatedBlock->setTerminator(Terminator);
assert (Terminator->getCond() && "switch condition must be non-NULL");
Block = SwitchTerminatedBlock;
-
- return addStmt(Terminator->getCond());
+ Block = addStmt(Terminator->getCond());
+
+ // Finally, if the SwitchStmt contains a condition variable, add both the
+ // SwitchStmt and the condition variable initialization to the CFG.
+ if (VarDecl *VD = Terminator->getConditionVariable()) {
+ if (Expr *Init = VD->getInit()) {
+ autoCreateBlock();
+ AppendStmt(Block, Terminator, AddStmtChoice::AlwaysAdd);
+ addStmt(Init);
+ }
+ }
+
+ return Block;
}
CFGBlock* CFGBuilder::VisitCaseStmt(CaseStmt* CS) {
@@ -1514,17 +1584,20 @@ namespace {
typedef llvm::DenseMap<const Stmt*,unsigned> BlkExprMapTy;
}
-static void FindSubExprAssignments(Stmt* Terminator, llvm::SmallPtrSet<Expr*,50>& Set) {
- if (!Terminator)
+static void FindSubExprAssignments(Stmt *S,
+ llvm::SmallPtrSet<Expr*,50>& Set) {
+ if (!S)
return;
- for (Stmt::child_iterator I=Terminator->child_begin(), E=Terminator->child_end(); I!=E; ++I) {
- if (!*I) continue;
-
- if (BinaryOperator* B = dyn_cast<BinaryOperator>(*I))
+ for (Stmt::child_iterator I=S->child_begin(), E=S->child_end(); I!=E; ++I) {
+ Stmt *child = *I;
+ if (!child)
+ continue;
+
+ if (BinaryOperator* B = dyn_cast<BinaryOperator>(child))
if (B->isAssignmentOp()) Set.insert(B);
- FindSubExprAssignments(*I, Set);
+ FindSubExprAssignments(child, Set);
}
}
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 9639ad98fa69..a15a8f16c46f 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1149,7 +1149,11 @@ RetainSummary* RetainSummaryManager::getSummary(FunctionDecl* FD) {
// [PR 3337] Use 'getAs<FunctionType>' to strip away any typedefs on the
// function's type.
const FunctionType* FT = FD->getType()->getAs<FunctionType>();
- const char* FName = FD->getIdentifier()->getNameStart();
+ const IdentifierInfo *II = FD->getIdentifier();
+ if (!II)
+ break;
+
+ const char* FName = II->getNameStart();
// Strip away preceding '_'. Doing this here will effect all the checks
// down below.
@@ -2938,6 +2942,17 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst,
QualType T = Ex->getType();
+ // For CallExpr, use the result type to know if it returns a reference.
+ if (const CallExpr *CE = dyn_cast<CallExpr>(Ex)) {
+ const Expr *Callee = CE->getCallee();
+ if (const FunctionDecl *FD = state->getSVal(Callee).getAsFunctionDecl())
+ T = FD->getResultType();
+ }
+ else if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(Ex)) {
+ if (const ObjCMethodDecl *MD = ME->getMethodDecl())
+ T = MD->getResultType();
+ }
+
if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())) {
unsigned Count = Builder.getCurrentBlockCount();
ValueManager &ValMgr = Eng.getValueManager();
diff --git a/lib/Analysis/CallInliner.cpp b/lib/Analysis/CallInliner.cpp
index 43523c293d58..d18bbcc0174a 100644
--- a/lib/Analysis/CallInliner.cpp
+++ b/lib/Analysis/CallInliner.cpp
@@ -11,36 +11,46 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Analysis/PathSensitive/GRExprEngine.h"
-#include "clang/Analysis/PathSensitive/GRTransferFuncs.h"
+#include "clang/Analysis/PathSensitive/CheckerVisitor.h"
+#include "clang/Analysis/PathSensitive/GRState.h"
+#include "clang/Analysis/LocalCheckers.h"
using namespace clang;
namespace {
-
-class CallInliner : public GRTransferFuncs {
- ASTContext &Ctx;
+class CallInliner : public Checker {
public:
- CallInliner(ASTContext &ctx) : Ctx(ctx) {}
+ static void *getTag() {
+ static int x;
+ return &x;
+ }
- void EvalCall(ExplodedNodeSet& Dst, GRExprEngine& Engine,
- GRStmtNodeBuilder& Builder, CallExpr* CE, SVal L,
- ExplodedNode* Pred);
-
+ virtual bool EvalCallExpr(CheckerContext &C, const CallExpr *CE);
+ virtual void EvalEndPath(GREndPathNodeBuilder &B,void *tag,GRExprEngine &Eng);
};
+}
+void clang::RegisterCallInliner(GRExprEngine &Eng) {
+ Eng.registerCheck(new CallInliner());
}
-void CallInliner::EvalCall(ExplodedNodeSet& Dst, GRExprEngine& Engine,
- GRStmtNodeBuilder& Builder, CallExpr* CE, SVal L,
- ExplodedNode* Pred) {
- FunctionDecl const *FD = L.getAsFunctionDecl();
+bool CallInliner::EvalCallExpr(CheckerContext &C, const CallExpr *CE) {
+ const GRState *state = C.getState();
+ const Expr *Callee = CE->getCallee();
+ SVal L = state->getSVal(Callee);
+
+ const FunctionDecl *FD = L.getAsFunctionDecl();
if (!FD)
- return; // GRExprEngine is responsible for the autotransition.
+ return false;
+
+ if (!FD->isThisDeclarationADefinition())
+ return false;
+ GRStmtNodeBuilder &Builder = C.getNodeBuilder();
// Make a new LocationContext.
- StackFrameContext const *LocCtx =
- Engine.getAnalysisManager().getStackFrame(FD, Pred->getLocationContext(), CE);
+ const StackFrameContext *LocCtx = C.getAnalysisManager().getStackFrame(FD,
+ C.getPredecessor()->getLocationContext(), CE,
+ Builder.getBlock(), Builder.getIndex());
CFGBlock const *Entry = &(LocCtx->getCFG()->getEntry());
@@ -54,22 +64,50 @@ void CallInliner::EvalCall(ExplodedNodeSet& Dst, GRExprEngine& Engine,
// Construct an edge representing the starting location in the function.
BlockEdge Loc(Entry, SuccB, LocCtx);
- GRState const *state = Builder.GetState(Pred);
- state = Engine.getStoreManager().EnterStackFrame(state, LocCtx);
-
+ state = C.getStoreManager().EnterStackFrame(state, LocCtx);
+ // This is a hack. We really should not use the GRStmtNodeBuilder.
bool isNew;
- ExplodedNode *SuccN = Engine.getGraph().getNode(Loc, state, &isNew);
- SuccN->addPredecessor(Pred, Engine.getGraph());
-
- Builder.Deferred.erase(Pred);
+ GRExprEngine &Eng = C.getEngine();
+ ExplodedNode *Pred = C.getPredecessor();
+
- // This is a hack. We really should not use the GRStmtNodeBuilder.
+ ExplodedNode *SuccN = Eng.getGraph().getNode(Loc, state, &isNew);
+ SuccN->addPredecessor(Pred, Eng.getGraph());
+ C.getNodeBuilder().Deferred.erase(Pred);
+
if (isNew)
Builder.getWorkList()->Enqueue(SuccN);
Builder.HasGeneratedNode = true;
+
+ return true;
}
-
-GRTransferFuncs *clang::CreateCallInliner(ASTContext &ctx) {
- return new CallInliner(ctx);
+
+void CallInliner::EvalEndPath(GREndPathNodeBuilder &B, void *tag,
+ GRExprEngine &Eng) {
+ const GRState *state = B.getState();
+ ExplodedNode *Pred = B.getPredecessor();
+ const StackFrameContext *LocCtx =
+ cast<StackFrameContext>(Pred->getLocationContext());
+
+ const Stmt *CE = LocCtx->getCallSite();
+
+ // Check if this is the top level stack frame.
+ if (!LocCtx->getParent())
+ return;
+
+ PostStmt NodeLoc(CE, LocCtx->getParent());
+
+ bool isNew;
+ ExplodedNode *Succ = Eng.getGraph().getNode(NodeLoc, state, &isNew);
+ Succ->addPredecessor(Pred, Eng.getGraph());
+
+ // When creating the new work list unit, increment the statement index to
+ // point to the statement after the CallExpr.
+ if (isNew)
+ B.getWorkList().Enqueue(Succ,
+ *const_cast<CFGBlock*>(LocCtx->getCallSiteBlock()),
+ LocCtx->getIndex() + 1);
+
+ B.HasGeneratedNode = true;
}
diff --git a/lib/Analysis/CheckDeadStores.cpp b/lib/Analysis/CheckDeadStores.cpp
index db9016fa1e64..6e4d8998620d 100644
--- a/lib/Analysis/CheckDeadStores.cpp
+++ b/lib/Analysis/CheckDeadStores.cpp
@@ -84,7 +84,14 @@ public:
const LiveVariables::AnalysisDataTy& AD,
const LiveVariables::ValTy& Live) {
- if (VD->hasLocalStorage() && !Live(VD, AD) &&
+ if (!VD->hasLocalStorage())
+ return;
+ // Reference types confuse the dead stores checker. Skip them
+ // for now.
+ if (VD->getType()->getAs<ReferenceType>())
+ return;
+
+ if (!Live(VD, AD) &&
!(VD->getAttr<UnusedAttr>() || VD->getAttr<BlocksAttr>()))
Report(VD, dsk, Ex->getSourceRange().getBegin(),
Val->getSourceRange());
@@ -93,7 +100,6 @@ public:
void CheckDeclRef(DeclRefExpr* DR, Expr* Val, DeadStoreKind dsk,
const LiveVariables::AnalysisDataTy& AD,
const LiveVariables::ValTy& Live) {
-
if (VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl()))
CheckVarDecl(VD, DR, Val, dsk, AD, Live);
}
@@ -183,13 +189,22 @@ public:
if (!V)
continue;
-
- if (V->hasLocalStorage())
+
+ if (V->hasLocalStorage()) {
+ // Reference types confuse the dead stores checker. Skip them
+ // for now.
+ if (V->getType()->getAs<ReferenceType>())
+ return;
+
if (Expr* E = V->getInit()) {
// Don't warn on C++ objects (yet) until we can show that their
// constructors/destructors don't have side effects.
if (isa<CXXConstructExpr>(E))
return;
+
+ if (isa<CXXExprWithTemporaries>(E))
+ return;
+
// A dead initialization is a variable that is dead after it
// is initialized. We don't flag warnings for those variables
// marked 'unused'.
@@ -218,6 +233,7 @@ public:
Report(V, DeadInit, V->getLocation(), E->getSourceRange());
}
}
+ }
}
}
};
diff --git a/lib/Analysis/GRCoreEngine.cpp b/lib/Analysis/GRCoreEngine.cpp
index 644dd199bead..209452a3927a 100644
--- a/lib/Analysis/GRCoreEngine.cpp
+++ b/lib/Analysis/GRCoreEngine.cpp
@@ -122,8 +122,8 @@ void GRCoreEngine::ProcessEndPath(GREndPathNodeBuilder& Builder) {
SubEngine.ProcessEndPath(Builder);
}
-void GRCoreEngine::ProcessStmt(Stmt* S, GRStmtNodeBuilder& Builder) {
- SubEngine.ProcessStmt(S, Builder);
+void GRCoreEngine::ProcessStmt(CFGElement E, GRStmtNodeBuilder& Builder) {
+ SubEngine.ProcessStmt(E, Builder);
}
bool GRCoreEngine::ProcessBlockEntrance(CFGBlock* Blk, const GRState* State,
@@ -213,9 +213,9 @@ void GRCoreEngine::HandleBlockEdge(const BlockEdge& L, ExplodedNode* Pred) {
CFGBlock* Blk = L.getDst();
// Check if we are entering the EXIT block.
- if (Blk == &(Pred->getLocationContext()->getCFG()->getExit())) {
+ if (Blk == &(L.getLocationContext()->getCFG()->getExit())) {
- assert (Pred->getLocationContext()->getCFG()->getExit().size() == 0
+ assert (L.getLocationContext()->getCFG()->getExit().size() == 0
&& "EXIT block cannot contain Stmts.");
// Process the final state transition.
@@ -241,10 +241,10 @@ void GRCoreEngine::HandleBlockEntrance(const BlockEntrance& L,
WList->setBlockCounter(Counter);
// Process the entrance of the block.
- if (Stmt* S = L.getFirstStmt()) {
+ if (CFGElement E = L.getFirstElement()) {
GRStmtNodeBuilder Builder(L.getBlock(), 0, Pred, this,
SubEngine.getStateManager());
- ProcessStmt(S, Builder);
+ ProcessStmt(E, Builder);
}
else
HandleBlockExit(L.getBlock(), Pred);
@@ -447,7 +447,7 @@ GRStmtNodeBuilder::generateNodeInternal(const Stmt* S, const GRState* state,
ProgramPoint::Kind K,
const void *tag) {
- const ProgramPoint &L = GetProgramPoint(S, K, Pred->getLocationContext(),tag);
+ const ProgramPoint &L = GetProgramPoint(S, K, Pred->getLocationContext(),tag);
return generateNodeInternal(L, state, Pred);
}
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index 51e6a547529f..2ce8edd1cc46 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -33,6 +33,7 @@
using namespace clang;
using llvm::dyn_cast;
+using llvm::dyn_cast_or_null;
using llvm::cast;
using llvm::APSInt;
@@ -45,6 +46,29 @@ static inline Selector GetNullarySelector(const char* name, ASTContext& Ctx) {
return Ctx.Selectors.getSelector(0, &II);
}
+
+static bool CalleeReturnsReference(const CallExpr *CE) {
+ const Expr *Callee = CE->getCallee();
+ QualType T = Callee->getType();
+
+ if (const PointerType *PT = T->getAs<PointerType>()) {
+ const FunctionType *FT = PT->getPointeeType()->getAs<FunctionType>();
+ T = FT->getResultType();
+ }
+ else {
+ const BlockPointerType *BT = T->getAs<BlockPointerType>();
+ T = BT->getPointeeType()->getAs<FunctionType>()->getResultType();
+ }
+ return T->isReferenceType();
+}
+
+static bool ReceiverReturnsReference(const ObjCMessageExpr *ME) {
+ const ObjCMethodDecl *MD = ME->getMethodDecl();
+ if (!MD)
+ return false;
+ return MD->getResultType()->isReferenceType();
+}
+
//===----------------------------------------------------------------------===//
// Batch auditor. DEPRECATED.
//===----------------------------------------------------------------------===//
@@ -227,7 +251,7 @@ void GRExprEngine::CheckerVisitBind(const Stmt *AssignE, const Stmt *StoreE,
CurrSet = (PrevSet == &Tmp) ? &Src : &Tmp;
CurrSet->clear();
}
-
+
void *tag = I->first;
Checker *checker = I->second;
@@ -306,8 +330,9 @@ GRExprEngine::~GRExprEngine() {
// Utility methods.
//===----------------------------------------------------------------------===//
-void GRExprEngine::setTransferFunctions(GRTransferFuncs* tf) {
+void GRExprEngine::setTransferFunctionsAndCheckers(GRTransferFuncs* tf) {
StateMgr.TF = tf;
+ StateMgr.Checkers = &Checkers;
tf->RegisterChecks(*this);
tf->RegisterPrinters(getStateManager().Printers);
}
@@ -333,43 +358,55 @@ const GRState* GRExprEngine::getInitialState(const LocationContext *InitLoc) {
// FIXME: It would be nice if we had a more general mechanism to add
// such preconditions. Some day.
- const Decl *D = InitLoc->getDecl();
-
- if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
- // Precondition: the first argument of 'main' is an integer guaranteed
- // to be > 0.
- if (FD->getIdentifier()->getName() == "main" &&
- FD->getNumParams() > 0) {
+ do {
+ const Decl *D = InitLoc->getDecl();
+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
+ // Precondition: the first argument of 'main' is an integer guaranteed
+ // to be > 0.
+ const IdentifierInfo *II = FD->getIdentifier();
+ if (!II || !(II->getName() == "main" && FD->getNumParams() > 0))
+ break;
+
const ParmVarDecl *PD = FD->getParamDecl(0);
QualType T = PD->getType();
- if (T->isIntegerType())
- if (const MemRegion *R = state->getRegion(PD, InitLoc)) {
- SVal V = state->getSVal(loc::MemRegionVal(R));
- SVal Constraint_untested = EvalBinOp(state, BinaryOperator::GT, V,
- ValMgr.makeZeroVal(T),
- getContext().IntTy);
-
- if (DefinedOrUnknownSVal *Constraint =
- dyn_cast<DefinedOrUnknownSVal>(&Constraint_untested)) {
- if (const GRState *newState = state->Assume(*Constraint, true))
- state = newState;
- }
- }
+ if (!T->isIntegerType())
+ break;
+
+ const MemRegion *R = state->getRegion(PD, InitLoc);
+ if (!R)
+ break;
+
+ SVal V = state->getSVal(loc::MemRegionVal(R));
+ SVal Constraint_untested = EvalBinOp(state, BinaryOperator::GT, V,
+ ValMgr.makeZeroVal(T),
+ getContext().IntTy);
+
+ DefinedOrUnknownSVal *Constraint =
+ dyn_cast<DefinedOrUnknownSVal>(&Constraint_untested);
+
+ if (!Constraint)
+ break;
+
+ if (const GRState *newState = state->Assume(*Constraint, true))
+ state = newState;
+
+ break;
}
- }
- else if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
- // Precondition: 'self' is always non-null upon entry to an Objective-C
- // method.
- const ImplicitParamDecl *SelfD = MD->getSelfDecl();
- const MemRegion *R = state->getRegion(SelfD, InitLoc);
- SVal V = state->getSVal(loc::MemRegionVal(R));
+
+ if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
+ // Precondition: 'self' is always non-null upon entry to an Objective-C
+ // method.
+ const ImplicitParamDecl *SelfD = MD->getSelfDecl();
+ const MemRegion *R = state->getRegion(SelfD, InitLoc);
+ SVal V = state->getSVal(loc::MemRegionVal(R));
- if (const Loc *LV = dyn_cast<Loc>(&V)) {
- // Assume that the pointer value in 'self' is non-null.
- state = state->Assume(*LV, true);
- assert(state && "'self' cannot be null");
+ if (const Loc *LV = dyn_cast<Loc>(&V)) {
+ // Assume that the pointer value in 'self' is non-null.
+ state = state->Assume(*LV, true);
+ assert(state && "'self' cannot be null");
+ }
}
- }
+ } while (0);
return state;
}
@@ -378,17 +415,15 @@ const GRState* GRExprEngine::getInitialState(const LocationContext *InitLoc) {
// Top-level transfer function logic (Dispatcher).
//===----------------------------------------------------------------------===//
-void GRExprEngine::ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder) {
-
+void GRExprEngine::ProcessStmt(CFGElement CE, GRStmtNodeBuilder& builder) {
+ CurrentStmt = CE.getStmt();
PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
- S->getLocStart(),
+ CurrentStmt->getLocStart(),
"Error evaluating statement");
Builder = &builder;
EntryNode = builder.getLastNode();
- CurrentStmt = S;
-
// Set up our simple checks.
if (BatchAuditor)
Builder->setAuditor(BatchAuditor.get());
@@ -415,7 +450,7 @@ void GRExprEngine::ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder) {
// FIXME: This should soon be removed.
ExplodedNodeSet Tmp2;
- getTF().EvalDeadSymbols(Tmp2, *this, *Builder, EntryNode, S,
+ getTF().EvalDeadSymbols(Tmp2, *this, *Builder, EntryNode, CurrentStmt,
CleanedState, SymReaper);
if (Checkers.empty())
@@ -437,8 +472,8 @@ void GRExprEngine::ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder) {
Checker *checker = I->second;
for (ExplodedNodeSet::iterator NI = SrcSet->begin(), NE = SrcSet->end();
NI != NE; ++NI)
- checker->GR_EvalDeadSymbols(*DstSet, *Builder, *this, S, *NI,
- SymReaper, tag);
+ checker->GR_EvalDeadSymbols(*DstSet, *Builder, *this, CurrentStmt,
+ *NI, SymReaper, tag);
SrcSet = DstSet;
}
}
@@ -457,7 +492,10 @@ void GRExprEngine::ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder) {
Builder->SetCleanedState(*I == EntryNode ? CleanedState : GetState(*I));
// Visit the statement.
- Visit(S, *I, Dst);
+ if (CE.asLValue())
+ VisitLValue(cast<Expr>(CurrentStmt), *I, Dst);
+ else
+ Visit(CurrentStmt, *I, Dst);
// Do we need to auto-generate a node? We only need to do this to generate
// a node with a "cleaned" state; GRCoreEngine will actually handle
@@ -465,7 +503,7 @@ void GRExprEngine::ProcessStmt(Stmt* S, GRStmtNodeBuilder& builder) {
if (Dst.size() == 1 && *Dst.begin() == EntryNode
&& !Builder->HasGeneratedNode && !HasAutoGenerated) {
HasAutoGenerated = true;
- builder.generateNode(S, GetState(EntryNode), *I);
+ builder.generateNode(CurrentStmt, GetState(EntryNode), *I);
}
}
@@ -504,7 +542,6 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
case Stmt::CXXTypeidExprClass:
case Stmt::CXXBoolLiteralExprClass:
case Stmt::CXXNullPtrLiteralExprClass:
- case Stmt::CXXThisExprClass:
case Stmt::CXXThrowExprClass:
case Stmt::CXXDefaultArgExprClass:
case Stmt::CXXZeroInitValueExprClass:
@@ -565,7 +602,8 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
break;
}
- if (AMgr.shouldEagerlyAssume() && (B->isRelationalOp() || B->isEqualityOp())) {
+ if (AMgr.shouldEagerlyAssume() &&
+ (B->isRelationalOp() || B->isEqualityOp())) {
ExplodedNodeSet Tmp;
VisitBinaryOperator(cast<BinaryOperator>(S), Pred, Tmp, false);
EvalEagerlyAssume(Dst, Tmp, cast<Expr>(S));
@@ -579,7 +617,7 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
case Stmt::CallExprClass:
case Stmt::CXXOperatorCallExprClass: {
CallExpr* C = cast<CallExpr>(S);
- VisitCall(C, Pred, C->arg_begin(), C->arg_end(), Dst);
+ VisitCall(C, Pred, C->arg_begin(), C->arg_end(), Dst, false);
break;
}
@@ -606,6 +644,10 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
break;
}
+ case Stmt::CXXThisExprClass:
+ VisitCXXThisExpr(cast<CXXThisExpr>(S), Pred, Dst);
+ break;
+
case Stmt::DeclRefExprClass:
VisitDeclRefExpr(cast<DeclRefExpr>(S), Pred, Dst, false);
break;
@@ -614,12 +656,24 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
VisitDeclStmt(cast<DeclStmt>(S), Pred, Dst);
break;
+ case Stmt::ForStmtClass:
+ // This case isn't for branch processing, but for handling the
+ // initialization of a condition variable.
+ VisitCondInit(cast<ForStmt>(S)->getConditionVariable(), S, Pred, Dst);
+ break;
+
case Stmt::ImplicitCastExprClass:
case Stmt::CStyleCastExprClass: {
CastExpr* C = cast<CastExpr>(S);
- VisitCast(C, C->getSubExpr(), Pred, Dst);
+ VisitCast(C, C->getSubExpr(), Pred, Dst, false);
break;
}
+
+ case Stmt::IfStmtClass:
+ // This case isn't for branch processing, but for handling the
+ // initialization of a condition variable.
+ VisitCondInit(cast<IfStmt>(S)->getConditionVariable(), S, Pred, Dst);
+ break;
case Stmt::InitListExprClass:
VisitInitListExpr(cast<InitListExpr>(S), Pred, Dst);
@@ -637,10 +691,9 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
VisitObjCForCollectionStmt(cast<ObjCForCollectionStmt>(S), Pred, Dst);
break;
- case Stmt::ObjCMessageExprClass: {
- VisitObjCMessageExpr(cast<ObjCMessageExpr>(S), Pred, Dst);
+ case Stmt::ObjCMessageExprClass:
+ VisitObjCMessageExpr(cast<ObjCMessageExpr>(S), Pred, Dst, false);
break;
- }
case Stmt::ObjCAtThrowStmtClass: {
// FIXME: This is not complete. We basically treat @throw as
@@ -687,10 +740,16 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
case Stmt::StringLiteralClass:
VisitLValue(cast<StringLiteral>(S), Pred, Dst);
break;
+
+ case Stmt::SwitchStmtClass:
+ // This case isn't for branch processing, but for handling the
+ // initialization of a condition variable.
+ VisitCondInit(cast<SwitchStmt>(S)->getConditionVariable(), S, Pred, Dst);
+ break;
case Stmt::UnaryOperatorClass: {
UnaryOperator *U = cast<UnaryOperator>(S);
- if (AMgr.shouldEagerlyAssume() && (U->getOpcode() == UnaryOperator::LNot)) {
+ if (AMgr.shouldEagerlyAssume()&&(U->getOpcode() == UnaryOperator::LNot)) {
ExplodedNodeSet Tmp;
VisitUnaryOperator(U, Pred, Tmp, false);
EvalEagerlyAssume(Dst, Tmp, U);
@@ -699,48 +758,92 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
VisitUnaryOperator(U, Pred, Dst, false);
break;
}
+
+ case Stmt::WhileStmtClass:
+ // This case isn't for branch processing, but for handling the
+ // initialization of a condition variable.
+ VisitCondInit(cast<WhileStmt>(S)->getConditionVariable(), S, Pred, Dst);
+ break;
}
}
void GRExprEngine::VisitLValue(Expr* Ex, ExplodedNode* Pred,
ExplodedNodeSet& Dst) {
+
+ PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
+ Ex->getLocStart(),
+ "Error evaluating statement");
+
Ex = Ex->IgnoreParens();
- if (Ex != CurrentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(Ex)) {
+ if (Ex != CurrentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(Ex)){
Dst.Add(Pred);
return;
}
switch (Ex->getStmtClass()) {
+ // C++ stuff we don't support yet.
+ case Stmt::CXXExprWithTemporariesClass:
+ case Stmt::CXXMemberCallExprClass:
+ case Stmt::CXXZeroInitValueExprClass: {
+ SaveAndRestore<bool> OldSink(Builder->BuildSinks);
+ Builder->BuildSinks = true;
+ MakeNode(Dst, Ex, Pred, GetState(Pred));
+ break;
+ }
case Stmt::ArraySubscriptExprClass:
VisitArraySubscriptExpr(cast<ArraySubscriptExpr>(Ex), Pred, Dst, true);
return;
+ case Stmt::BinaryOperatorClass:
+ case Stmt::CompoundAssignOperatorClass:
+ VisitBinaryOperator(cast<BinaryOperator>(Ex), Pred, Dst, true);
+ return;
+
case Stmt::BlockDeclRefExprClass:
VisitBlockDeclRefExpr(cast<BlockDeclRefExpr>(Ex), Pred, Dst, true);
return;
+
+ case Stmt::CallExprClass:
+ case Stmt::CXXOperatorCallExprClass: {
+ CallExpr *C = cast<CallExpr>(Ex);
+ assert(CalleeReturnsReference(C));
+ VisitCall(C, Pred, C->arg_begin(), C->arg_end(), Dst, true);
+ break;
+ }
+
+ case Stmt::CompoundLiteralExprClass:
+ VisitCompoundLiteralExpr(cast<CompoundLiteralExpr>(Ex), Pred, Dst, true);
+ return;
case Stmt::DeclRefExprClass:
VisitDeclRefExpr(cast<DeclRefExpr>(Ex), Pred, Dst, true);
return;
-
- case Stmt::ObjCIvarRefExprClass:
- VisitObjCIvarRefExpr(cast<ObjCIvarRefExpr>(Ex), Pred, Dst, true);
- return;
-
- case Stmt::UnaryOperatorClass:
- VisitUnaryOperator(cast<UnaryOperator>(Ex), Pred, Dst, true);
- return;
-
+
+ case Stmt::ImplicitCastExprClass:
+ case Stmt::CStyleCastExprClass: {
+ CastExpr *C = cast<CastExpr>(Ex);
+ QualType T = Ex->getType();
+ VisitCast(C, C->getSubExpr(), Pred, Dst, true);
+ break;
+ }
+
case Stmt::MemberExprClass:
VisitMemberExpr(cast<MemberExpr>(Ex), Pred, Dst, true);
return;
- case Stmt::CompoundLiteralExprClass:
- VisitCompoundLiteralExpr(cast<CompoundLiteralExpr>(Ex), Pred, Dst, true);
+ case Stmt::ObjCIvarRefExprClass:
+ VisitObjCIvarRefExpr(cast<ObjCIvarRefExpr>(Ex), Pred, Dst, true);
+ return;
+
+ case Stmt::ObjCMessageExprClass: {
+ ObjCMessageExpr *ME = cast<ObjCMessageExpr>(Ex);
+ assert(ReceiverReturnsReference(ME));
+ VisitObjCMessageExpr(ME, Pred, Dst, true);
return;
+ }
case Stmt::ObjCPropertyRefExprClass:
case Stmt::ObjCImplicitSetterGetterRefExprClass:
@@ -765,11 +868,10 @@ void GRExprEngine::VisitLValue(Expr* Ex, ExplodedNode* Pred,
return;
}
- case Stmt::BinaryOperatorClass:
- case Stmt::CompoundAssignOperatorClass:
- VisitBinaryOperator(cast<BinaryOperator>(Ex), Pred, Dst, true);
+ case Stmt::UnaryOperatorClass:
+ VisitUnaryOperator(cast<UnaryOperator>(Ex), Pred, Dst, true);
return;
-
+
default:
// Arbitrary subexpressions can return aggregate temporaries that
// can be used in a lvalue context. We need to enhance our support
@@ -1023,7 +1125,8 @@ void GRExprEngine::ProcessIndirectGoto(GRIndirectGotoNodeBuilder& builder) {
void GRExprEngine::VisitGuardedExpr(Expr* Ex, Expr* L, Expr* R,
ExplodedNode* Pred, ExplodedNodeSet& Dst) {
- assert (Ex == CurrentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(Ex));
+ assert(Ex == CurrentStmt &&
+ Pred->getLocationContext()->getCFG()->isBlkExpr(Ex));
const GRState* state = GetState(Pred);
SVal X = state->getSVal(Ex);
@@ -1147,7 +1250,7 @@ void GRExprEngine::VisitLogicalExpr(BinaryOperator* B, ExplodedNode* Pred,
assert(B->getOpcode() == BinaryOperator::LAnd ||
B->getOpcode() == BinaryOperator::LOr);
- assert(B == CurrentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(B));
+ assert(B==CurrentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(B));
const GRState* state = GetState(Pred);
SVal X = state->getSVal(B);
@@ -1232,13 +1335,23 @@ void GRExprEngine::VisitCommonDeclRefExpr(Expr *Ex, const NamedDecl *D,
SVal V = state->getLValue(VD, Pred->getLocationContext());
- if (asLValue)
+ if (asLValue) {
+ // For references, the 'lvalue' is the pointer address stored in the
+ // reference region.
+ if (VD->getType()->isReferenceType()) {
+ if (const MemRegion *R = V.getAsRegion())
+ V = state->getSVal(R);
+ else
+ V = UnknownVal();
+ }
+
MakeNode(Dst, Ex, Pred, state->BindExpr(Ex, V),
ProgramPoint::PostLValueKind);
+ }
else
EvalLoad(Dst, Ex, Pred, state, V);
- return;
+ return;
} else if (const EnumConstantDecl* ED = dyn_cast<EnumConstantDecl>(D)) {
assert(!asLValue && "EnumConstantDecl does not have lvalue.");
@@ -1415,6 +1528,37 @@ void GRExprEngine::EvalLoad(ExplodedNodeSet& Dst, Expr *Ex, ExplodedNode* Pred,
const GRState* state, SVal location,
const void *tag, QualType LoadTy) {
+ // Are we loading from a region? This actually results in two loads; one
+ // to fetch the address of the referenced value and one to fetch the
+ // referenced value.
+ if (const TypedRegion *TR =
+ dyn_cast_or_null<TypedRegion>(location.getAsRegion())) {
+
+ QualType ValTy = TR->getValueType(getContext());
+ if (const ReferenceType *RT = ValTy->getAs<ReferenceType>()) {
+ static int loadReferenceTag = 0;
+ ExplodedNodeSet Tmp;
+ EvalLoadCommon(Tmp, Ex, Pred, state, location, &loadReferenceTag,
+ getContext().getPointerType(RT->getPointeeType()));
+
+ // Perform the load from the referenced value.
+ for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end() ; I!=E; ++I) {
+ state = GetState(*I);
+ location = state->getSVal(Ex);
+ EvalLoadCommon(Dst, Ex, *I, state, location, tag, LoadTy);
+ }
+ return;
+ }
+ }
+
+ EvalLoadCommon(Dst, Ex, Pred, state, location, tag, LoadTy);
+}
+
+void GRExprEngine::EvalLoadCommon(ExplodedNodeSet& Dst, Expr *Ex,
+ ExplodedNode* Pred,
+ const GRState* state, SVal location,
+ const void *tag, QualType LoadTy) {
+
// Evaluate the location (checks for bad dereferences).
ExplodedNodeSet Tmp;
EvalLocation(Tmp, Ex, Pred, state, location, tag, true);
@@ -1489,94 +1633,111 @@ void GRExprEngine::EvalLocation(ExplodedNodeSet &Dst, Stmt *S,
// Transfer function: Function calls.
//===----------------------------------------------------------------------===//
+namespace {
+class CallExprWLItem {
+public:
+ CallExpr::arg_iterator I;
+ ExplodedNode *N;
+
+ CallExprWLItem(const CallExpr::arg_iterator &i, ExplodedNode *n)
+ : I(i), N(n) {}
+};
+} // end anonymous namespace
+
void GRExprEngine::VisitCall(CallExpr* CE, ExplodedNode* Pred,
CallExpr::arg_iterator AI,
CallExpr::arg_iterator AE,
- ExplodedNodeSet& Dst) {
+ ExplodedNodeSet& Dst, bool asLValue) {
+
// Determine the type of function we're calling (if available).
const FunctionProtoType *Proto = NULL;
QualType FnType = CE->getCallee()->IgnoreParens()->getType();
if (const PointerType *FnTypePtr = FnType->getAs<PointerType>())
Proto = FnTypePtr->getPointeeType()->getAs<FunctionProtoType>();
- VisitCallRec(CE, Pred, AI, AE, Dst, Proto, /*ParamIdx=*/0);
-}
-
-void GRExprEngine::VisitCallRec(CallExpr* CE, ExplodedNode* Pred,
- CallExpr::arg_iterator AI,
- CallExpr::arg_iterator AE,
- ExplodedNodeSet& Dst,
- const FunctionProtoType *Proto,
- unsigned ParamIdx) {
+ // Create a worklist to process the arguments.
+ llvm::SmallVector<CallExprWLItem, 20> WorkList;
+ WorkList.reserve(AE - AI);
+ WorkList.push_back(CallExprWLItem(AI, Pred));
+
+ ExplodedNodeSet ArgsEvaluated;
- // Process the arguments.
- if (AI != AE) {
- // If the call argument is being bound to a reference parameter,
- // visit it as an lvalue, not an rvalue.
+ while (!WorkList.empty()) {
+ CallExprWLItem Item = WorkList.back();
+ WorkList.pop_back();
+
+ if (Item.I == AE) {
+ ArgsEvaluated.insert(Item.N);
+ continue;
+ }
+
+ // Evaluate the argument.
+ ExplodedNodeSet Tmp;
+ const unsigned ParamIdx = Item.I - AI;
+
bool VisitAsLvalue = false;
if (Proto && ParamIdx < Proto->getNumArgs())
VisitAsLvalue = Proto->getArgType(ParamIdx)->isReferenceType();
-
- ExplodedNodeSet DstTmp;
+
if (VisitAsLvalue)
- VisitLValue(*AI, Pred, DstTmp);
+ VisitLValue(*Item.I, Item.N, Tmp);
else
- Visit(*AI, Pred, DstTmp);
- ++AI;
+ Visit(*Item.I, Item.N, Tmp);
+
+ // Enqueue evaluating the next argument on the worklist.
+ ++(Item.I);
- for (ExplodedNodeSet::iterator DI=DstTmp.begin(), DE=DstTmp.end(); DI != DE;
- ++DI)
- VisitCallRec(CE, *DI, AI, AE, Dst, Proto, ParamIdx + 1);
-
- return;
+ for (ExplodedNodeSet::iterator NI=Tmp.begin(), NE=Tmp.end(); NI!=NE; ++NI)
+ WorkList.push_back(CallExprWLItem(Item.I, *NI));
}
- // If we reach here we have processed all of the arguments. Evaluate
- // the callee expression.
+ // Now process the call itself.
ExplodedNodeSet DstTmp;
Expr* Callee = CE->getCallee()->IgnoreParens();
-
- { // Enter new scope to make the lifetime of 'DstTmp2' bounded.
+
+ for (ExplodedNodeSet::iterator NI=ArgsEvaluated.begin(),
+ NE=ArgsEvaluated.end(); NI != NE; ++NI) {
+ // Evaluate the callee.
ExplodedNodeSet DstTmp2;
- Visit(Callee, Pred, DstTmp2);
-
+ Visit(Callee, *NI, DstTmp2);
// Perform the previsit of the CallExpr, storing the results in DstTmp.
CheckerVisit(CE, DstTmp, DstTmp2, true);
}
-
- // Finally, evaluate the function call.
+
+ // Finally, evaluate the function call. We try each of the checkers
+ // to see if the can evaluate the function call.
ExplodedNodeSet DstTmp3;
+
for (ExplodedNodeSet::iterator DI = DstTmp.begin(), DE = DstTmp.end();
DI != DE; ++DI) {
-
+
const GRState* state = GetState(*DI);
SVal L = state->getSVal(Callee);
-
+
// FIXME: Add support for symbolic function calls (calls involving
// function pointer values that are symbolic).
SaveAndRestore<bool> OldSink(Builder->BuildSinks);
ExplodedNodeSet DstChecker;
-
+
// If the callee is processed by a checker, skip the rest logic.
if (CheckerEvalCall(CE, DstChecker, *DI))
DstTmp3.insert(DstChecker);
else {
for (ExplodedNodeSet::iterator DI_Checker = DstChecker.begin(),
- DE_Checker = DstChecker.end();
- DI_Checker != DE_Checker; ++DI_Checker) {
-
- // Dispatch to the plug-in transfer function.
+ DE_Checker = DstChecker.end();
+ DI_Checker != DE_Checker; ++DI_Checker) {
+
+ // Dispatch to the plug-in transfer function.
unsigned OldSize = DstTmp3.size();
SaveOr OldHasGen(Builder->HasGeneratedNode);
Pred = *DI_Checker;
-
+
// Dispatch to transfer function logic to handle the call itself.
// FIXME: Allow us to chain together transfer functions.
- assert(Builder && "GRStmtNodeBuilder must be defined.");
-
+ assert(Builder && "GRStmtNodeBuilder must be defined.");
getTF().EvalCall(DstTmp3, *this, *Builder, CE, L, Pred);
-
+
// Handle the case where no nodes where generated. Auto-generate that
// contains the updated state if we aren't generating sinks.
if (!Builder->BuildSinks && DstTmp3.size() == OldSize &&
@@ -1585,9 +1746,31 @@ void GRExprEngine::VisitCallRec(CallExpr* CE, ExplodedNode* Pred,
}
}
}
-
- // Perform the post-condition check of the CallExpr.
- CheckerVisit(CE, Dst, DstTmp3, false);
+
+ // Finally, perform the post-condition check of the CallExpr and store
+ // the created nodes in 'Dst'.
+
+ if (!(!asLValue && CalleeReturnsReference(CE))) {
+ CheckerVisit(CE, Dst, DstTmp3, false);
+ return;
+ }
+
+ // Handle the case where the called function returns a reference but
+ // we expect an rvalue. For such cases, convert the reference to
+ // an rvalue.
+ // FIXME: This conversion doesn't actually happen unless the result
+ // of CallExpr is consumed by another expression.
+ ExplodedNodeSet DstTmp4;
+ CheckerVisit(CE, DstTmp4, DstTmp3, false);
+ QualType LoadTy = CE->getType();
+
+ static int *ConvertToRvalueTag = 0;
+ for (ExplodedNodeSet::iterator NI = DstTmp4.begin(), NE = DstTmp4.end();
+ NI!=NE; ++NI) {
+ const GRState *state = GetState(*NI);
+ EvalLoad(Dst, CE, *NI, state, state->getSVal(CE),
+ &ConvertToRvalueTag, LoadTy);
+ }
}
//===----------------------------------------------------------------------===//
@@ -1764,16 +1947,18 @@ void GRExprEngine::VisitObjCForCollectionStmtAux(ObjCForCollectionStmt* S,
//===----------------------------------------------------------------------===//
void GRExprEngine::VisitObjCMessageExpr(ObjCMessageExpr* ME, ExplodedNode* Pred,
- ExplodedNodeSet& Dst){
+ ExplodedNodeSet& Dst, bool asLValue){
VisitObjCMessageExprArgHelper(ME, ME->arg_begin(), ME->arg_end(),
- Pred, Dst);
+ Pred, Dst, asLValue);
}
void GRExprEngine::VisitObjCMessageExprArgHelper(ObjCMessageExpr* ME,
- ObjCMessageExpr::arg_iterator AI,
- ObjCMessageExpr::arg_iterator AE,
- ExplodedNode* Pred, ExplodedNodeSet& Dst) {
+ ObjCMessageExpr::arg_iterator AI,
+ ObjCMessageExpr::arg_iterator AE,
+ ExplodedNode* Pred,
+ ExplodedNodeSet& Dst,
+ bool asLValue) {
if (AI == AE) {
// Process the receiver.
@@ -1784,12 +1969,12 @@ void GRExprEngine::VisitObjCMessageExprArgHelper(ObjCMessageExpr* ME,
for (ExplodedNodeSet::iterator NI = Tmp.begin(), NE = Tmp.end(); NI != NE;
++NI)
- VisitObjCMessageExprDispatchHelper(ME, *NI, Dst);
+ VisitObjCMessageExprDispatchHelper(ME, *NI, Dst, asLValue);
return;
}
- VisitObjCMessageExprDispatchHelper(ME, Pred, Dst);
+ VisitObjCMessageExprDispatchHelper(ME, Pred, Dst, asLValue);
return;
}
@@ -1799,12 +1984,13 @@ void GRExprEngine::VisitObjCMessageExprArgHelper(ObjCMessageExpr* ME,
++AI;
for (ExplodedNodeSet::iterator NI = Tmp.begin(), NE = Tmp.end();NI != NE;++NI)
- VisitObjCMessageExprArgHelper(ME, AI, AE, *NI, Dst);
+ VisitObjCMessageExprArgHelper(ME, AI, AE, *NI, Dst, asLValue);
}
void GRExprEngine::VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME,
ExplodedNode* Pred,
- ExplodedNodeSet& Dst) {
+ ExplodedNodeSet& Dst,
+ bool asLValue) {
// Handle previsits checks.
ExplodedNodeSet Src, DstTmp;
@@ -1812,12 +1998,17 @@ void GRExprEngine::VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME,
CheckerVisit(ME, DstTmp, Src, true);
- unsigned size = Dst.size();
+ ExplodedNodeSet PostVisitSrc;
for (ExplodedNodeSet::iterator DI = DstTmp.begin(), DE = DstTmp.end();
DI!=DE; ++DI) {
+
Pred = *DI;
bool RaisesException = false;
+
+ unsigned OldSize = PostVisitSrc.size();
+ SaveAndRestore<bool> OldSink(Builder->BuildSinks);
+ SaveOr OldHasGen(Builder->HasGeneratedNode);
if (const Expr *Receiver = ME->getReceiver()) {
const GRState *state = Pred->getState();
@@ -1832,8 +2023,8 @@ void GRExprEngine::VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME,
// There are three cases: can be nil or non-nil, must be nil, must be
// non-nil. We handle must be nil, and merge the rest two into non-nil.
if (nilState && !notNilState) {
- CheckerEvalNilReceiver(ME, Dst, nilState, Pred);
- return;
+ CheckerEvalNilReceiver(ME, PostVisitSrc, nilState, Pred);
+ continue;
}
assert(notNilState);
@@ -1844,39 +2035,29 @@ void GRExprEngine::VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME,
// Check if we raise an exception. For now treat these as sinks.
// Eventually we will want to handle exceptions properly.
- SaveAndRestore<bool> OldSink(Builder->BuildSinks);
if (RaisesException)
Builder->BuildSinks = true;
// Dispatch to plug-in transfer function.
- SaveOr OldHasGen(Builder->HasGeneratedNode);
- EvalObjCMessageExpr(Dst, ME, Pred, notNilState);
+ EvalObjCMessageExpr(PostVisitSrc, ME, Pred, notNilState);
}
else {
-
IdentifierInfo* ClsName = ME->getClassName();
Selector S = ME->getSelector();
// Check for special instance methods.
-
if (!NSExceptionII) {
ASTContext& Ctx = getContext();
-
NSExceptionII = &Ctx.Idents.get("NSException");
}
if (ClsName == NSExceptionII) {
-
enum { NUM_RAISE_SELECTORS = 2 };
// Lazily create a cache of the selectors.
-
if (!NSExceptionInstanceRaiseSelectors) {
-
ASTContext& Ctx = getContext();
-
NSExceptionInstanceRaiseSelectors = new Selector[NUM_RAISE_SELECTORS];
-
llvm::SmallVector<IdentifierInfo*, NUM_RAISE_SELECTORS> II;
unsigned idx = 0;
@@ -1894,26 +2075,51 @@ void GRExprEngine::VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME,
for (unsigned i = 0; i < NUM_RAISE_SELECTORS; ++i)
if (S == NSExceptionInstanceRaiseSelectors[i]) {
- RaisesException = true; break;
+ RaisesException = true;
+ break;
}
}
// Check if we raise an exception. For now treat these as sinks.
// Eventually we will want to handle exceptions properly.
- SaveAndRestore<bool> OldSink(Builder->BuildSinks);
if (RaisesException)
Builder->BuildSinks = true;
// Dispatch to plug-in transfer function.
- SaveOr OldHasGen(Builder->HasGeneratedNode);
- EvalObjCMessageExpr(Dst, ME, Pred, Builder->GetState(Pred));
+ EvalObjCMessageExpr(PostVisitSrc, ME, Pred, Builder->GetState(Pred));
}
+
+ // Handle the case where no nodes where generated. Auto-generate that
+ // contains the updated state if we aren't generating sinks.
+ if (!Builder->BuildSinks && PostVisitSrc.size() == OldSize &&
+ !Builder->HasGeneratedNode)
+ MakeNode(PostVisitSrc, ME, Pred, GetState(Pred));
}
- // Handle the case where no nodes where generated. Auto-generate that
- // contains the updated state if we aren't generating sinks.
- if (!Builder->BuildSinks && Dst.size() == size && !Builder->HasGeneratedNode)
- MakeNode(Dst, ME, Pred, GetState(Pred));
+ // Finally, perform the post-condition check of the ObjCMessageExpr and store
+ // the created nodes in 'Dst'.
+ if (!(!asLValue && ReceiverReturnsReference(ME))) {
+ CheckerVisit(ME, Dst, PostVisitSrc, false);
+ return;
+ }
+
+ // Handle the case where the message expression returns a reference but
+ // we expect an rvalue. For such cases, convert the reference to
+ // an rvalue.
+ // FIXME: This conversion doesn't actually happen unless the result
+ // of ObjCMessageExpr is consumed by another expression.
+ ExplodedNodeSet DstRValueConvert;
+ CheckerVisit(ME, DstRValueConvert, PostVisitSrc, false);
+ QualType LoadTy = ME->getType();
+
+ static int *ConvertToRvalueTag = 0;
+ for (ExplodedNodeSet::iterator NI = DstRValueConvert.begin(),
+ NE = DstRValueConvert.end();
+ NI!=NE; ++NI) {
+ const GRState *state = GetState(*NI);
+ EvalLoad(Dst, ME, *NI, state, state->getSVal(ME),
+ &ConvertToRvalueTag, LoadTy);
+ }
}
//===----------------------------------------------------------------------===//
@@ -1921,7 +2127,7 @@ void GRExprEngine::VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME,
//===----------------------------------------------------------------------===//
void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, ExplodedNode* Pred,
- ExplodedNodeSet& Dst){
+ ExplodedNodeSet& Dst, bool asLValue){
ExplodedNodeSet S1;
QualType T = CastE->getType();
QualType ExTy = Ex->getType();
@@ -1929,7 +2135,8 @@ void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, ExplodedNode* Pred,
if (const ExplicitCastExpr *ExCast=dyn_cast_or_null<ExplicitCastExpr>(CastE))
T = ExCast->getTypeAsWritten();
- if (ExTy->isArrayType() || ExTy->isFunctionType() || T->isReferenceType())
+ if (ExTy->isArrayType() || ExTy->isFunctionType() || T->isReferenceType() ||
+ asLValue)
VisitLValue(Ex, Pred, S1);
else
Visit(Ex, Pred, S1);
@@ -1939,10 +2146,19 @@ void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, ExplodedNode* Pred,
// Check for casting to "void".
if (T->isVoidType()) {
+ assert(!asLValue);
for (ExplodedNodeSet::iterator I = S2.begin(), E = S2.end(); I != E; ++I)
Dst.Add(*I);
return;
}
+
+ // If we are evaluating the cast in an lvalue context, we implicitly want
+ // the cast to evaluate to a location.
+ if (asLValue) {
+ ASTContext &Ctx = getContext();
+ T = Ctx.getPointerType(Ctx.getCanonicalType(T));
+ ExTy = Ctx.getPointerType(Ctx.getCanonicalType(ExTy));
+ }
for (ExplodedNodeSet::iterator I = S2.begin(), E = S2.end(); I != E; ++I) {
ExplodedNode* N = *I;
@@ -1992,8 +2208,12 @@ void GRExprEngine::VisitDeclStmt(DeclStmt *DS, ExplodedNode *Pred,
// time a function is called those values may not be current.
ExplodedNodeSet Tmp;
- if (InitEx)
- Visit(InitEx, Pred, Tmp);
+ if (InitEx) {
+ if (VD->getType()->isReferenceType())
+ VisitLValue(InitEx, Pred, Tmp);
+ else
+ Visit(InitEx, Pred, Tmp);
+ }
else
Tmp.Add(Pred);
@@ -2009,7 +2229,6 @@ void GRExprEngine::VisitDeclStmt(DeclStmt *DS, ExplodedNode *Pred,
if (InitEx) {
SVal InitVal = state->getSVal(InitEx);
- QualType T = VD->getType();
// Recover some path-sensitivity if a scalar value evaluated to
// UnknownVal.
@@ -2020,7 +2239,7 @@ void GRExprEngine::VisitDeclStmt(DeclStmt *DS, ExplodedNode *Pred,
}
EvalBind(Dst, DS, DS, *I, state,
- loc::MemRegionVal(state->getRegion(VD, LC)), InitVal, true);
+ loc::MemRegionVal(state->getRegion(VD, LC)), InitVal, true);
}
else {
state = state->bindDeclWithNoInit(state->getRegion(VD, LC));
@@ -2029,6 +2248,33 @@ void GRExprEngine::VisitDeclStmt(DeclStmt *DS, ExplodedNode *Pred,
}
}
+void GRExprEngine::VisitCondInit(VarDecl *VD, Stmt *S,
+ ExplodedNode *Pred, ExplodedNodeSet& Dst) {
+
+ Expr* InitEx = VD->getInit();
+ ExplodedNodeSet Tmp;
+ Visit(InitEx, Pred, Tmp);
+
+ for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
+ ExplodedNode *N = *I;
+ const GRState *state = GetState(N);
+
+ const LocationContext *LC = N->getLocationContext();
+ SVal InitVal = state->getSVal(InitEx);
+
+ // Recover some path-sensitivity if a scalar value evaluated to
+ // UnknownVal.
+ if (InitVal.isUnknown() ||
+ !getConstraintManager().canReasonAbout(InitVal)) {
+ InitVal = ValMgr.getConjuredSymbolVal(NULL, InitEx,
+ Builder->getCurrentBlockCount());
+ }
+
+ EvalBind(Dst, S, S, N, state,
+ loc::MemRegionVal(state->getRegion(VD, LC)), InitVal, true);
+ }
+}
+
namespace {
// This class is used by VisitInitListExpr as an item in a worklist
// for processing the values contained in an InitListExpr.
@@ -2082,7 +2328,7 @@ void GRExprEngine::VisitInitListExpr(InitListExpr* E, ExplodedNode* Pred,
InitListExpr::reverse_iterator NewItr = X.Itr + 1;
- for (ExplodedNodeSet::iterator NI=Tmp.begin(), NE=Tmp.end(); NI!=NE; ++NI) {
+ for (ExplodedNodeSet::iterator NI=Tmp.begin(),NE=Tmp.end();NI!=NE;++NI) {
// Get the last initializer value.
state = GetState(*NI);
SVal InitV = state->getSVal(cast<Expr>(*X.Itr));
@@ -2114,7 +2360,7 @@ void GRExprEngine::VisitInitListExpr(InitListExpr* E, ExplodedNode* Pred,
ExplodedNodeSet Tmp;
Expr* Init = E->getInit(0);
Visit(Init, Pred, Tmp);
- for (ExplodedNodeSet::iterator I = Tmp.begin(), EI = Tmp.end(); I != EI; ++I) {
+ for (ExplodedNodeSet::iterator I=Tmp.begin(), EI=Tmp.end(); I != EI; ++I) {
state = GetState(*I);
MakeNode(Dst, E, *I, state->BindExpr(E, state->getSVal(Init)));
}
@@ -2382,7 +2628,7 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, ExplodedNode* Pred,
ExplodedNodeSet Tmp2;
EvalLoad(Tmp2, Ex, *I, state, V1);
- for (ExplodedNodeSet::iterator I2 = Tmp2.begin(), E2 = Tmp2.end(); I2!=E2; ++I2) {
+ for (ExplodedNodeSet::iterator I2=Tmp2.begin(), E2=Tmp2.end();I2!=E2;++I2) {
state = GetState(*I2);
SVal V2_untested = state->getSVal(Ex);
@@ -2445,14 +2691,23 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, ExplodedNode* Pred,
}
}
-void GRExprEngine::VisitAsmStmt(AsmStmt* A, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
+
+void GRExprEngine::VisitCXXThisExpr(CXXThisExpr *TE, ExplodedNode *Pred,
+ ExplodedNodeSet & Dst) {
+ // Get the this object region from StoreManager.
+ Loc V = getStoreManager().getThisObject(TE->getType()->getPointeeType());
+ MakeNode(Dst, TE, Pred, GetState(Pred)->BindExpr(TE, V));
+}
+
+void GRExprEngine::VisitAsmStmt(AsmStmt* A, ExplodedNode* Pred,
+ ExplodedNodeSet& Dst) {
VisitAsmStmtHelperOutputs(A, A->begin_outputs(), A->end_outputs(), Pred, Dst);
}
void GRExprEngine::VisitAsmStmtHelperOutputs(AsmStmt* A,
AsmStmt::outputs_iterator I,
AsmStmt::outputs_iterator E,
- ExplodedNode* Pred, ExplodedNodeSet& Dst) {
+ ExplodedNode* Pred, ExplodedNodeSet& Dst) {
if (I == E) {
VisitAsmStmtHelperInputs(A, A->begin_inputs(), A->end_inputs(), Pred, Dst);
return;
@@ -2463,14 +2718,15 @@ void GRExprEngine::VisitAsmStmtHelperOutputs(AsmStmt* A,
++I;
- for (ExplodedNodeSet::iterator NI = Tmp.begin(), NE = Tmp.end(); NI != NE; ++NI)
+ for (ExplodedNodeSet::iterator NI = Tmp.begin(), NE = Tmp.end();NI != NE;++NI)
VisitAsmStmtHelperOutputs(A, I, E, *NI, Dst);
}
void GRExprEngine::VisitAsmStmtHelperInputs(AsmStmt* A,
AsmStmt::inputs_iterator I,
AsmStmt::inputs_iterator E,
- ExplodedNode* Pred, ExplodedNodeSet& Dst) {
+ ExplodedNode* Pred,
+ ExplodedNodeSet& Dst) {
if (I == E) {
// We have processed both the inputs and the outputs. All of the outputs
@@ -2598,7 +2854,7 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
// Simulate the effects of a "store": bind the value of the RHS
// to the L-Value represented by the LHS.
- EvalStore(Tmp3, B, LHS, *I2, state->BindExpr(B, ExprVal), LeftV, RightV);
+ EvalStore(Tmp3, B, LHS, *I2, state->BindExpr(B, ExprVal), LeftV,RightV);
continue;
}
diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp
index 84e268f3fdaa..0b2620e609c2 100644
--- a/lib/Analysis/LiveVariables.cpp
+++ b/lib/Analysis/LiveVariables.cpp
@@ -112,6 +112,11 @@ public:
void VisitUnaryOperator(UnaryOperator* U);
void Visit(Stmt *S);
void VisitTerminator(CFGBlock* B);
+
+ /// VisitConditionVariableInit - Handle the initialization of condition
+ /// variables at branches. Valid statements include IfStmt, ForStmt,
+ /// WhileStmt, and SwitchStmt.
+ void VisitConditionVariableInit(Stmt *S);
void SetTopValue(LiveVariables::ValTy& V) {
V = AD.AlwaysLive;
@@ -126,7 +131,9 @@ void TransferFuncs::Visit(Stmt *S) {
if (AD.Observer)
AD.Observer->ObserveStmt(S,AD,LiveState);
- if (getCFG().isBlkExpr(S)) LiveState(S,AD) = Dead;
+ if (getCFG().isBlkExpr(S))
+ LiveState(S, AD) = Dead;
+
StmtVisitor<TransferFuncs,void>::Visit(S);
}
else if (!getCFG().isBlkExpr(S)) {
@@ -142,6 +149,11 @@ void TransferFuncs::Visit(Stmt *S) {
LiveState(S,AD) = Alive;
}
}
+
+void TransferFuncs::VisitConditionVariableInit(Stmt *S) {
+ assert(!getCFG().isBlkExpr(S));
+ CFGRecStmtVisitor<TransferFuncs>::VisitConditionVariableInit(S);
+}
void TransferFuncs::VisitTerminator(CFGBlock* B) {
@@ -289,17 +301,8 @@ void TransferFuncs::VisitDeclStmt(DeclStmt* DS) {
//===----------------------------------------------------------------------===//
namespace {
-
-struct Merge {
- typedef StmtDeclBitVector_Types::ValTy ValTy;
-
- void operator()(ValTy& Dst, const ValTy& Src) {
- Dst.OrDeclBits(Src);
- Dst.OrBlkExprBits(Src);
- }
-};
-
-typedef DataflowSolver<LiveVariables, TransferFuncs, Merge> Solver;
+ typedef StmtDeclBitVector_Types::Union Merge;
+ typedef DataflowSolver<LiveVariables, TransferFuncs, Merge> Solver;
} // end anonymous namespace
//===----------------------------------------------------------------------===//
diff --git a/lib/Analysis/MallocChecker.cpp b/lib/Analysis/MallocChecker.cpp
index 2ed070a170cd..fab73ee7b104 100644
--- a/lib/Analysis/MallocChecker.cpp
+++ b/lib/Analysis/MallocChecker.cpp
@@ -23,13 +23,13 @@ using namespace clang;
namespace {
class RefState {
- enum Kind { Allocated, Released, Escaped } K;
+ enum Kind { AllocateUnchecked, AllocateFailed, Released, Escaped } K;
const Stmt *S;
public:
RefState(Kind k, const Stmt *s) : K(k), S(s) {}
- bool isAllocated() const { return K == Allocated; }
+ bool isAllocated() const { return K == AllocateUnchecked; }
bool isReleased() const { return K == Released; }
bool isEscaped() const { return K == Escaped; }
@@ -37,7 +37,12 @@ public:
return K == X.K && S == X.S;
}
- static RefState getAllocated(const Stmt *s) { return RefState(Allocated, s); }
+ static RefState getAllocateUnchecked(const Stmt *s) {
+ return RefState(AllocateUnchecked, s);
+ }
+ static RefState getAllocateFailed() {
+ return RefState(AllocateFailed, 0);
+ }
static RefState getReleased(const Stmt *s) { return RefState(Released, s); }
static RefState getEscaped(const Stmt *s) { return RefState(Escaped, s); }
@@ -62,6 +67,8 @@ public:
void EvalDeadSymbols(CheckerContext &C,const Stmt *S,SymbolReaper &SymReaper);
void EvalEndPath(GREndPathNodeBuilder &B, void *tag, GRExprEngine &Eng);
void PreVisitReturnStmt(CheckerContext &C, const ReturnStmt *S);
+ const GRState *EvalAssume(const GRState *state, SVal Cond, bool Assumption);
+
private:
void MallocMem(CheckerContext &C, const CallExpr *CE);
const GRState *MallocMemAux(CheckerContext &C, const CallExpr *CE,
@@ -74,6 +81,8 @@ private:
};
} // end anonymous namespace
+typedef llvm::ImmutableMap<SymbolRef, RefState> RegionStateTy;
+
namespace clang {
template <>
struct GRStateTrait<RegionState>
@@ -144,7 +153,7 @@ const GRState *MallocChecker::MallocMemAux(CheckerContext &C,
SymbolRef Sym = RetVal.getAsLocSymbol();
assert(Sym);
// Set the symbol's state to Allocated.
- return state->set<RegionState>(Sym, RefState::getAllocated(CE));
+ return state->set<RegionState>(Sym, RefState::getAllocateUnchecked(CE));
}
void MallocChecker::FreeMem(CheckerContext &C, const CallExpr *CE) {
@@ -298,3 +307,18 @@ void MallocChecker::PreVisitReturnStmt(CheckerContext &C, const ReturnStmt *S) {
C.addTransition(state);
}
+
+const GRState *MallocChecker::EvalAssume(const GRState *state, SVal Cond,
+ bool Assumption) {
+ // If a symblic region is assumed to NULL, set its state to AllocateFailed.
+ // FIXME: should also check symbols assumed to non-null.
+
+ RegionStateTy RS = state->get<RegionState>();
+
+ for (RegionStateTy::iterator I = RS.begin(), E = RS.end(); I != E; ++I) {
+ if (state->getSymVal(I.getKey()))
+ state = state->set<RegionState>(I.getKey(),RefState::getAllocateFailed());
+ }
+
+ return state;
+}
diff --git a/lib/Analysis/MemRegion.cpp b/lib/Analysis/MemRegion.cpp
index bc3a5b704552..74fe3bf5ee5c 100644
--- a/lib/Analysis/MemRegion.cpp
+++ b/lib/Analysis/MemRegion.cpp
@@ -291,6 +291,17 @@ void BlockDataRegion::Profile(llvm::FoldingSetNodeID& ID) const {
BlockDataRegion::ProfileRegion(ID, BC, LC, getSuperRegion());
}
+void CXXObjectRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
+ QualType T,
+ const MemRegion *sReg) {
+ ID.AddPointer(T.getTypePtr());
+ ID.AddPointer(sReg);
+}
+
+void CXXObjectRegion::Profile(llvm::FoldingSetNodeID &ID) const {
+ ProfileRegion(ID, T, getSuperRegion());
+}
+
//===----------------------------------------------------------------------===//
// Region pretty-printing.
//===----------------------------------------------------------------------===//
@@ -552,10 +563,9 @@ MemRegionManager::getObjCIvarRegion(const ObjCIvarDecl* d,
return getSubRegion<ObjCIvarRegion>(d, superRegion);
}
-const ObjCObjectRegion*
-MemRegionManager::getObjCObjectRegion(const ObjCInterfaceDecl* d,
- const MemRegion* superRegion) {
- return getSubRegion<ObjCObjectRegion>(d, superRegion);
+const CXXObjectRegion *
+MemRegionManager::getCXXObjectRegion(QualType T) {
+ return getSubRegion<CXXObjectRegion>(T, getUnknownRegion());
}
const AllocaRegion*
diff --git a/lib/Analysis/NoReturnFunctionChecker.cpp b/lib/Analysis/NoReturnFunctionChecker.cpp
index 6806273d4b4b..5cfd9acd5f56 100644
--- a/lib/Analysis/NoReturnFunctionChecker.cpp
+++ b/lib/Analysis/NoReturnFunctionChecker.cpp
@@ -45,13 +45,12 @@ bool NoReturnFunctionChecker::EvalCallExpr(CheckerContext &C,
if (FD->getAttr<NoReturnAttr>() || FD->getAttr<AnalyzerNoReturnAttr>())
BuildSinks = true;
- else {
+ else if (const IdentifierInfo *II = FD->getIdentifier()) {
// HACK: Some functions are not marked noreturn, and don't return.
// Here are a few hardwired ones. If this takes too long, we can
// potentially cache these results.
- using llvm::StringRef;
BuildSinks
- = llvm::StringSwitch<bool>(StringRef(FD->getIdentifier()->getName()))
+ = llvm::StringSwitch<bool>(llvm::StringRef(II->getName()))
.Case("exit", true)
.Case("panic", true)
.Case("error", true)
diff --git a/lib/Analysis/OSAtomicChecker.cpp b/lib/Analysis/OSAtomicChecker.cpp
index 5a893458830c..cf16796b1b14 100644
--- a/lib/Analysis/OSAtomicChecker.cpp
+++ b/lib/Analysis/OSAtomicChecker.cpp
@@ -44,11 +44,15 @@ bool OSAtomicChecker::EvalCallExpr(CheckerContext &C,const CallExpr *CE) {
if (!FD)
return false;
- const char *FName = FD->getNameAsCString();
+ const IdentifierInfo *II = FD->getIdentifier();
+ if (!II)
+ return false;
+
+ llvm::StringRef FName(II->getName());
// Check for compare and swap.
- if (strncmp(FName, "OSAtomicCompareAndSwap", 22) == 0 ||
- strncmp(FName, "objc_atomicCompareAndSwap", 25) == 0)
+ if (FName.startswith("OSAtomicCompareAndSwap") ||
+ FName.startswith("objc_atomicCompareAndSwap"))
return EvalOSAtomicCompareAndSwap(C, CE);
// FIXME: Other atomics.
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index b5eeb1ea1170..3bc9dccda6bf 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -349,6 +349,7 @@ public:
SVal RetrieveArray(const GRState *St, const TypedRegion* R);
+ /// Get the state and region whose binding this region R corresponds to.
std::pair<const GRState*, const MemRegion*>
GetLazyBinding(RegionBindings B, const MemRegion *R);
@@ -539,8 +540,7 @@ const GRState *RegionStoreManager::InvalidateRegions(const GRState *state,
}
// Handle the region itself.
- if (isa<AllocaRegion>(R) || isa<SymbolicRegion>(R) ||
- isa<ObjCObjectRegion>(R)) {
+ if (isa<AllocaRegion>(R) || isa<SymbolicRegion>(R)) {
// Invalidate the region by setting its default value to
// conjured symbol. The type of the symbol is irrelavant.
DefinedOrUnknownSVal V = ValMgr.getConjuredSymbolVal(R, Ex, Ctx.IntTy,
@@ -744,8 +744,8 @@ DefinedOrUnknownSVal RegionStoreManager::getSizeInElements(const GRState *state,
case MemRegion::ElementRegionKind:
case MemRegion::FieldRegionKind:
case MemRegion::ObjCIvarRegionKind:
- case MemRegion::ObjCObjectRegionKind:
case MemRegion::SymbolicRegionKind:
+ case MemRegion::CXXObjectRegionKind:
return UnknownVal();
case MemRegion::StringRegionKind: {
@@ -867,8 +867,8 @@ SVal RegionStoreManager::EvalBinOp(const GRState *state,
// Fall-through.
case MemRegion::CompoundLiteralRegionKind:
case MemRegion::FieldRegionKind:
- case MemRegion::ObjCObjectRegionKind:
case MemRegion::ObjCIvarRegionKind:
+ case MemRegion::CXXObjectRegionKind:
return UnknownVal();
case MemRegion::FunctionTextRegionKind:
@@ -987,12 +987,12 @@ RegionStoreManager::Retrieve(const GRState *state, Loc L, QualType T) {
assert(!isa<UnknownVal>(L) && "location unknown");
assert(!isa<UndefinedVal>(L) && "location undefined");
-
+
// FIXME: Is this even possible? Shouldn't this be treated as a null
// dereference at a higher level?
if (isa<loc::ConcreteInt>(L))
return SValuator::CastResult(state, UndefinedVal());
-
+
const MemRegion *MR = cast<loc::MemRegionVal>(L).getRegion();
// FIXME: return symbolic value for these cases.
@@ -1090,8 +1090,7 @@ RegionStoreManager::Retrieve(const GRState *state, Loc L, QualType T) {
}
// All other values are symbolic.
- return SValuator::CastResult(state,
- ValMgr.getRegionValueSymbolValOrUnknown(R, RTy));
+ return SValuator::CastResult(state, ValMgr.getRegionValueSymbolVal(R, RTy));
}
std::pair<const GRState*, const MemRegion*>
@@ -1256,7 +1255,7 @@ SVal RegionStoreManager::RetrieveFieldOrElementCommon(const GRState *state,
}
// All other values are symbolic.
- return ValMgr.getRegionValueSymbolValOrUnknown(R, Ty);
+ return ValMgr.getRegionValueSymbolVal(R, Ty);
}
SVal RegionStoreManager::RetrieveObjCIvar(const GRState* state,
@@ -1296,7 +1295,7 @@ SVal RegionStoreManager::RetrieveVar(const GRState *state,
if (R->hasGlobalsOrParametersStorage() ||
isa<UnknownSpaceRegion>(R->getMemorySpace()))
- return ValMgr.getRegionValueSymbolValOrUnknown(R, VD->getType());
+ return ValMgr.getRegionValueSymbolVal(R, VD->getType());
return UndefinedVal();
}
@@ -1307,7 +1306,7 @@ SVal RegionStoreManager::RetrieveLazySymbol(const GRState *state,
QualType valTy = R->getValueType(getContext());
// All other values are symbolic.
- return ValMgr.getRegionValueSymbolValOrUnknown(R, valTy);
+ return ValMgr.getRegionValueSymbolVal(R, valTy);
}
SVal RegionStoreManager::RetrieveStruct(const GRState *state,
@@ -1425,7 +1424,13 @@ const GRState *RegionStoreManager::Bind(const GRState *state, Loc L, SVal V) {
// Binding directly to a symbolic region should be treated as binding
// to element 0.
QualType T = SR->getSymbol()->getType(getContext());
- T = T->getAs<PointerType>()->getPointeeType();
+
+ // FIXME: Is this the right way to handle symbols that are references?
+ if (const PointerType *PT = T->getAs<PointerType>())
+ T = PT->getPointeeType();
+ else
+ T = T->getAs<ReferenceType>()->getPointeeType();
+
R = GetElementZeroRegion(SR, T);
}
diff --git a/lib/Analysis/SValuator.cpp b/lib/Analysis/SValuator.cpp
index ac727b0ac696..49bc0c4c5988 100644
--- a/lib/Analysis/SValuator.cpp
+++ b/lib/Analysis/SValuator.cpp
@@ -72,10 +72,14 @@ SValuator::CastResult SValuator::EvalCast(SVal val, const GRState *state,
// Check for casts from integers to pointers.
if (Loc::IsLocType(castTy) && originalTy->isIntegerType()) {
if (nonloc::LocAsInteger *LV = dyn_cast<nonloc::LocAsInteger>(&val)) {
- // Just unpackage the lval and return it.
+ if (const MemRegion *R = LV->getLoc().getAsRegion()) {
+ StoreManager &storeMgr = ValMgr.getStateManager().getStoreManager();
+ R = storeMgr.CastRegion(R, castTy);
+ return R ? CastResult(state, loc::MemRegionVal(R))
+ : CastResult(state, UnknownVal());
+ }
return CastResult(state, LV->getLoc());
}
-
goto DispatchCast;
}
@@ -136,15 +140,12 @@ SValuator::CastResult SValuator::EvalCast(SVal val, const GRState *state,
// different type. If the MemRegion* returned is NULL, this expression
// evaluates to UnknownVal.
R = storeMgr.CastRegion(R, castTy);
-
- if (R)
- return CastResult(state, loc::MemRegionVal(R));
-
- return CastResult(state, UnknownVal());
+ return R ? CastResult(state, loc::MemRegionVal(R))
+ : CastResult(state, UnknownVal());
}
- // All other cases.
DispatchCast:
+ // All other cases.
return CastResult(state,
isa<Loc>(val) ? EvalCastL(cast<Loc>(val), castTy)
: EvalCastNL(cast<NonLoc>(val), castTy));
diff --git a/lib/Analysis/SimpleConstraintManager.cpp b/lib/Analysis/SimpleConstraintManager.cpp
index 015db76080df..23c3b4175835 100644
--- a/lib/Analysis/SimpleConstraintManager.cpp
+++ b/lib/Analysis/SimpleConstraintManager.cpp
@@ -15,6 +15,7 @@
#include "SimpleConstraintManager.h"
#include "clang/Analysis/PathSensitive/GRExprEngine.h"
#include "clang/Analysis/PathSensitive/GRState.h"
+#include "clang/Analysis/PathSensitive/Checker.h"
namespace clang {
@@ -72,8 +73,17 @@ const GRState *SimpleConstraintManager::Assume(const GRState *state, Loc Cond,
// EvalAssume is used to call into the GRTransferFunction object to perform
// any checker-specific update of the state based on this assumption being
// true or false.
- return state ? state->getTransferFuncs().EvalAssume(state, Cond, Assumption)
- : NULL;
+
+ if (!state)
+ return 0;
+
+ std::vector<std::pair<void *, Checker*> >::iterator
+ I = state->checker_begin(), E = state->checker_end();
+
+ for (; I != E; ++I) {
+ state = I->second->EvalAssume(state, Cond, Assumption);
+ }
+ return state->getTransferFuncs().EvalAssume(state, Cond, Assumption);
}
const GRState *SimpleConstraintManager::AssumeAux(const GRState *state,
@@ -128,8 +138,18 @@ const GRState *SimpleConstraintManager::Assume(const GRState *state,
// EvalAssume is used to call into the GRTransferFunction object to perform
// any checker-specific update of the state based on this assumption being
// true or false.
- return state ? state->getTransferFuncs().EvalAssume(state, Cond, Assumption)
- : NULL;
+
+ if (!state)
+ return 0;
+
+ std::vector<std::pair<void *, Checker*> >::iterator
+ I = state->checker_begin(), E = state->checker_end();
+
+ for (; I != E; ++I) {
+ state = I->second->EvalAssume(state, Cond, Assumption);
+ }
+
+ return state->getTransferFuncs().EvalAssume(state, Cond, Assumption);
}
const GRState *SimpleConstraintManager::AssumeAux(const GRState *state,
diff --git a/lib/Analysis/Store.cpp b/lib/Analysis/Store.cpp
index e6ff6e5af47f..8d911b844fc0 100644
--- a/lib/Analysis/Store.cpp
+++ b/lib/Analysis/Store.cpp
@@ -98,7 +98,6 @@ const MemRegion *StoreManager::CastRegion(const MemRegion *R, QualType CastToTy)
}
case MemRegion::StringRegionKind:
- case MemRegion::ObjCObjectRegionKind:
// FIXME: Need to handle arbitrary downcasts.
case MemRegion::SymbolicRegionKind:
case MemRegion::AllocaRegionKind:
@@ -106,6 +105,7 @@ const MemRegion *StoreManager::CastRegion(const MemRegion *R, QualType CastToTy)
case MemRegion::FieldRegionKind:
case MemRegion::ObjCIvarRegionKind:
case MemRegion::VarRegionKind:
+ case MemRegion::CXXObjectRegionKind:
return MakeElementRegion(R, PointeeTy);
case MemRegion::ElementRegionKind: {
@@ -198,11 +198,21 @@ const MemRegion *StoreManager::CastRegion(const MemRegion *R, QualType CastToTy)
/// as another region.
SVal StoreManager::CastRetrievedVal(SVal V, const TypedRegion *R,
QualType castTy) {
+
+#ifndef NDEBUG
if (castTy.isNull())
return V;
+
+ ASTContext &Ctx = ValMgr.getContext();
+ QualType T = R->getValueType(Ctx);
+
+ // Automatically translate references to pointers.
+ if (const ReferenceType *RT = T->getAs<ReferenceType>())
+ T = Ctx.getPointerType(RT->getPointeeType());
+
+ assert(ValMgr.getContext().hasSameUnqualifiedType(castTy, T));
+#endif
- assert(ValMgr.getContext().hasSameUnqualifiedType(castTy,
- R->getValueType(ValMgr.getContext())));
return V;
}
@@ -230,3 +240,8 @@ SVal StoreManager::getLValueCompoundLiteral(const CompoundLiteralExpr* CL,
const LocationContext *LC) {
return loc::MemRegionVal(MRMgr.getCompoundLiteralRegion(CL, LC));
}
+
+Loc StoreManager::getThisObject(QualType T) {
+ const CXXObjectRegion *R = MRMgr.getCXXObjectRegion(T);
+ return loc::MemRegionVal(R);
+}
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index 8d0d81326db0..4351f66be32f 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -203,6 +203,7 @@ Diagnostic::Diagnostic(DiagnosticClient *client) : Client(client) {
AllExtensionsSilenced = 0;
IgnoreAllWarnings = false;
WarningsAsErrors = false;
+ ErrorsAsFatal = false;
SuppressSystemWarnings = false;
SuppressAllDiagnostics = false;
ExtBehavior = Ext_Ignore;
@@ -326,9 +327,13 @@ Diagnostic::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass) const {
return Diagnostic::Ignored;
Result = Diagnostic::Warning;
if (ExtBehavior == Ext_Error) Result = Diagnostic::Error;
+ if (Result == Diagnostic::Error && ErrorsAsFatal)
+ Result = Diagnostic::Fatal;
break;
case diag::MAP_ERROR:
Result = Diagnostic::Error;
+ if (ErrorsAsFatal)
+ Result = Diagnostic::Fatal;
break;
case diag::MAP_FATAL:
Result = Diagnostic::Fatal;
@@ -349,6 +354,8 @@ Diagnostic::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass) const {
if (WarningsAsErrors)
Result = Diagnostic::Error;
+ if (Result == Diagnostic::Error && ErrorsAsFatal)
+ Result = Diagnostic::Fatal;
break;
case diag::MAP_WARNING_NO_WERROR:
@@ -361,6 +368,12 @@ Diagnostic::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass) const {
return Diagnostic::Ignored;
break;
+
+ case diag::MAP_ERROR_NO_WFATAL:
+ // Diagnostics specified as -Wno-fatal-error=foo should be errors, but
+ // unaffected by -Wfatal-errors.
+ Result = Diagnostic::Error;
+ break;
}
// Okay, we're about to return this as a "diagnostic to emit" one last check:
diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp
index 434ff39e77ec..c4296c3f1c7b 100644
--- a/lib/Basic/FileManager.cpp
+++ b/lib/Basic/FileManager.cpp
@@ -219,6 +219,11 @@ static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr,
///
const DirectoryEntry *FileManager::getDirectory(const char *NameStart,
const char *NameEnd) {
+ // stat doesn't like trailing separators (at least on Windows).
+ if (((NameEnd - NameStart) > 1) &&
+ ((*(NameEnd - 1) == '/') || (*(NameEnd - 1) == '\\')))
+ NameEnd--;
+
++NumDirLookups;
llvm::StringMapEntry<DirectoryEntry *> &NamedDirEnt =
DirEntries.GetOrCreateValue(NameStart, NameEnd);
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp
index a1f97f4eeb24..493beeea6dc5 100644
--- a/lib/Basic/TargetInfo.cpp
+++ b/lib/Basic/TargetInfo.cpp
@@ -360,6 +360,8 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
Info.setAllowsRegister();
break;
case 'm': // memory operand.
+ case 'o': // offsettable memory operand
+ case 'V': // non-offsettable memory operand
Info.setAllowsMemory();
break;
case 'g': // general register, memory operand or immediate integer.
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index e5a4c434c341..b6b5c6c1ef9b 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -323,11 +323,14 @@ protected:
Define(Defs, "__PPU__", "1");
Define(Defs, "__CELLOS_LV2__", "1");
Define(Defs, "__ELF__", "1");
+ Define(Defs, "__LP32__", "1");
}
public:
PS3PPUTargetInfo(const std::string& triple)
: OSTargetInfo<Target>(triple) {
this->UserLabelPrefix = "";
+ this->LongWidth = this->LongAlign = this->PointerWidth = this->PointerAlign = 32;
+ this->SizeType = TargetInfo::UnsignedInt;
}
};
@@ -625,7 +628,7 @@ const Builtin::Info BuiltinInfo[] = {
#include "clang/Basic/BuiltinsX86.def"
};
-const char *GCCRegNames[] = {
+static const char* const GCCRegNames[] = {
"ax", "dx", "cx", "bx", "si", "di", "bp", "sp",
"st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)",
"argp", "flags", "fspr", "dirflag", "frame",
@@ -685,7 +688,7 @@ public:
bool Enabled) const;
virtual void getDefaultFeatures(const std::string &CPU,
llvm::StringMap<bool> &Features) const;
- virtual void HandleTargetFeatures(const std::vector<std::string> &Features);
+ virtual void HandleTargetFeatures(std::vector<std::string> &Features);
};
void X86TargetInfo::getDefaultFeatures(const std::string &CPU,
@@ -802,8 +805,7 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
/// HandleTargetOptions - Perform initialization based on the user
/// configured set of features.
-void
-X86TargetInfo::HandleTargetFeatures(const std::vector<std::string> &Features) {
+void X86TargetInfo::HandleTargetFeatures(std::vector<std::string> &Features) {
// Remember the maximum enabled sselevel.
for (unsigned i = 0, e = Features.size(); i !=e; ++i) {
// Ignore disabled features.
@@ -993,8 +995,8 @@ public:
WCharType = UnsignedShort;
DoubleAlign = LongLongAlign = 64;
DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
- "i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-"
- "a0:0:64-f80:32:32-n8:16:32";
+ "i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-"
+ "v128:128:128-a0:0:64-f80:32:32-n8:16:32";
}
virtual void getTargetDefines(const LangOptions &Opts,
std::vector<char> &Defines) const {
@@ -1181,52 +1183,40 @@ public:
namespace {
class ARMTargetInfo : public TargetInfo {
- enum {
- Armv4t,
- Armv5,
- Armv6,
- Armv7a,
- XScale
- } ArmArch;
+ // Possible FPU choices.
+ enum FPUMode {
+ NoFPU,
+ VFP2FPU,
+ VFP3FPU,
+ NeonFPU
+ };
- static const TargetInfo::GCCRegAlias GCCRegAliases[];
- static const char * const GCCRegNames[];
+ static bool FPUModeIsVFP(FPUMode Mode) {
+ return Mode >= VFP2FPU && Mode <= NeonFPU;
+ }
+
+ static const TargetInfo::GCCRegAlias GCCRegAliases[];
+ static const char * const GCCRegNames[];
- std::string ABI;
- bool IsThumb;
+ std::string ABI, CPU;
+
+ unsigned FPU : 3;
+
+ unsigned IsThumb : 1;
+
+ // Initialized via features.
+ unsigned SoftFloat : 1;
+ unsigned SoftFloatABI : 1;
public:
ARMTargetInfo(const std::string &TripleStr)
- : TargetInfo(TripleStr), ABI("aapcs-linux"), IsThumb(false)
+ : TargetInfo(TripleStr), ABI("aapcs-linux"), CPU("arm1136j-s")
{
- llvm::Triple Triple(TripleStr);
-
SizeType = UnsignedInt;
PtrDiffType = SignedInt;
- // FIXME: This shouldn't be done this way, we should use features to
- // indicate the arch. See lib/Driver/Tools.cpp.
- llvm::StringRef Version(""), Arch = Triple.getArchName();
- if (Arch.startswith("arm"))
- Version = Arch.substr(3);
- else if (Arch.startswith("thumb"))
- Version = Arch.substr(5);
- if (Version == "v7")
- ArmArch = Armv7a;
- else if (Version.empty() || Version == "v6" || Version == "v6t2")
- ArmArch = Armv6;
- else if (Version == "v5")
- ArmArch = Armv5;
- else if (Version == "v4t")
- ArmArch = Armv4t;
- else if (Arch == "xscale" || Arch == "thumbv5e")
- ArmArch = XScale;
- else
- ArmArch = Armv6;
-
- if (Arch.startswith("thumb"))
- IsThumb = true;
-
+ // FIXME: Should we just treat this as a feature?
+ IsThumb = getTriple().getArchName().startswith("thumb");
if (IsThumb) {
DescriptionString = ("e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-"
"i64:64:64-f32:32:32-f64:64:64-"
@@ -1269,6 +1259,88 @@ public:
return true;
}
+
+ void getDefaultFeatures(const std::string &CPU,
+ llvm::StringMap<bool> &Features) const {
+ // FIXME: This should not be here.
+ Features["vfp2"] = false;
+ Features["vfp3"] = false;
+ Features["neon"] = false;
+
+ if (CPU == "arm1136jf-s" || CPU == "arm1176jzf-s" || CPU == "mpcore")
+ Features["vfp2"] = true;
+ else if (CPU == "cortex-a8" || CPU == "cortex-a9")
+ Features["neon"] = true;
+ }
+
+ virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
+ const std::string &Name,
+ bool Enabled) const {
+ if (Name == "soft-float" || Name == "soft-float-abi") {
+ Features[Name] = Enabled;
+ } else if (Name == "vfp2" || Name == "vfp3" || Name == "neon") {
+ // These effectively are a single option, reset them when any is enabled.
+ if (Enabled)
+ Features["vfp2"] = Features["vfp3"] = Features["neon"] = false;
+ Features[Name] = Enabled;
+ } else
+ return false;
+
+ return true;
+ }
+
+ virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
+ FPU = NoFPU;
+ SoftFloat = SoftFloatABI = false;
+ for (unsigned i = 0, e = Features.size(); i != e; ++i) {
+ if (Features[i] == "+soft-float")
+ SoftFloat = true;
+ else if (Features[i] == "+soft-float-abi")
+ SoftFloatABI = true;
+ else if (Features[i] == "+vfp2")
+ FPU = VFP2FPU;
+ else if (Features[i] == "+vfp3")
+ FPU = VFP3FPU;
+ else if (Features[i] == "+neon")
+ FPU = NeonFPU;
+ }
+
+ // Remove front-end specific options which the backend handles differently.
+ std::vector<std::string>::iterator it;
+ it = std::find(Features.begin(), Features.end(), "+soft-float");
+ if (it != Features.end())
+ Features.erase(it);
+ it = std::find(Features.begin(), Features.end(), "+soft-float-abi");
+ if (it != Features.end())
+ Features.erase(it);
+ }
+
+ static const char *getCPUDefineSuffix(llvm::StringRef Name) {
+ return llvm::StringSwitch<const char*>(Name)
+ .Cases("arm8", "arm810", "4")
+ .Cases("strongarm", "strongarm110", "strongarm1100", "strongarm1110", "4")
+ .Cases("arm7tdmi", "arm7tdmi-s", "arm710t", "arm720t", "arm9", "4T")
+ .Cases("arm9tdmi", "arm920", "arm920t", "arm922t", "arm940t", "4T")
+ .Case("ep9312", "4T")
+ .Cases("arm10tdmi", "arm1020t", "5T")
+ .Cases("arm9e", "arm946e-s", "arm966e-s", "arm968e-s", "5TE")
+ .Case("arm926ej-s", "5TEJ")
+ .Cases("arm10e", "arm1020e", "arm1022e", "5TE")
+ .Cases("xscale", "iwmmxt", "5TE")
+ .Case("arm1136j-s", "6J")
+ .Cases("arm1176jz-s", "arm1176jzf-s", "6ZK")
+ .Cases("arm1136jf-s", "mpcorenovfp", "mpcore", "6K")
+ .Cases("arm1156t2-s", "arm1156t2f-s", "6T2")
+ .Cases("cortex-a8", "cortex-a9", "7A")
+ .Default(0);
+ }
+ virtual bool setCPU(const std::string &Name) {
+ if (!getCPUDefineSuffix(Name))
+ return false;
+
+ CPU = Name;
+ return true;
+ }
virtual void getTargetDefines(const LangOptions &Opts,
std::vector<char> &Defs) const {
// Target identification.
@@ -1276,46 +1348,55 @@ public:
Define(Defs, "__arm__");
// Target properties.
+ Define(Defs, "__ARMEL__");
Define(Defs, "__LITTLE_ENDIAN__");
+ Define(Defs, "__REGISTER_PREFIX__", "");
+
+ llvm::StringRef CPUArch = getCPUDefineSuffix(CPU);
+ std::string ArchName = "__ARM_ARCH_";
+ ArchName += CPUArch;
+ ArchName += "__";
+ Define(Defs, ArchName);
// Subtarget options.
- //
- // FIXME: Neither THUMB_INTERWORK nor SOFTFP is not being set correctly
- // here.
- if (ArmArch == Armv7a) {
- Define(Defs, "__ARM_ARCH_7A__");
- Define(Defs, "__THUMB_INTERWORK__");
- } else if (ArmArch == Armv6) {
- Define(Defs, "__ARM_ARCH_6K__");
- Define(Defs, "__THUMB_INTERWORK__");
- } else if (ArmArch == Armv5) {
- Define(Defs, "__ARM_ARCH_5TEJ__");
+
+ // FIXME: It's more complicated than this and we don't really support
+ // interworking.
+ if ('5' <= CPUArch[0] && CPUArch[0] <= '7')
Define(Defs, "__THUMB_INTERWORK__");
+
+ if (ABI == "aapcs" || ABI == "aapcs-linux")
+ Define(Defs, "__ARM_EABI__");
+
+ if (SoftFloat)
Define(Defs, "__SOFTFP__");
- } else if (ArmArch == Armv4t) {
- Define(Defs, "__ARM_ARCH_4T__");
- Define(Defs, "__SOFTFP__");
- } else if (ArmArch == XScale) {
- Define(Defs, "__ARM_ARCH_5TE__");
- Define(Defs, "__XSCALE__");
- Define(Defs, "__SOFTFP__");
- }
- Define(Defs, "__ARMEL__");
+ if (CPU == "xscale")
+ Define(Defs, "__XSCALE__");
+ bool IsThumb2 = IsThumb && (CPUArch == "6T2" || CPUArch.startswith("7"));
if (IsThumb) {
Define(Defs, "__THUMBEL__");
Define(Defs, "__thumb__");
- if (ArmArch == Armv7a)
+ if (IsThumb2)
Define(Defs, "__thumb2__");
}
// Note, this is always on in gcc, even though it doesn't make sense.
Define(Defs, "__APCS_32__");
- // FIXME: This should be conditional on VFP instruction support.
- Define(Defs, "__VFP_FP__");
- Define(Defs, "__USING_SJLJ_EXCEPTIONS__");
+ if (FPUModeIsVFP((FPUMode) FPU))
+ Define(Defs, "__VFP_FP__");
+
+ // This only gets set when Neon instructions are actually available, unlike
+ // the VFP define, hence the soft float and arch check. This is subtly
+ // different from gcc, we follow the intent which was that it should be set
+ // when Neon instructions are actually available.
+ if (FPU == NeonFPU && !SoftFloat && IsThumb2)
+ Define(Defs, "__ARM_NEON__");
+
+ if (getTriple().getOS() == llvm::Triple::Darwin)
+ Define(Defs, "__USING_SJLJ_EXCEPTIONS__");
}
virtual void getTargetBuiltins(const Builtin::Info *&Records,
unsigned &NumRecords) const {
@@ -1602,7 +1683,7 @@ namespace {
IntPtrType = SignedShort;
PtrDiffType = SignedInt;
SigAtomicType = SignedLong;
- DescriptionString = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8-n8:16";
+ DescriptionString = "e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16";
}
virtual void getTargetDefines(const LangOptions &Opts,
std::vector<char> &Defines) const {
@@ -2111,7 +2192,7 @@ static TargetInfo *AllocateTarget(const std::string &T) {
/// CreateTargetInfo - Return the target info object for the specified target
/// triple.
TargetInfo *TargetInfo::CreateTargetInfo(Diagnostic &Diags,
- const TargetOptions &Opts) {
+ TargetOptions &Opts) {
llvm::Triple Triple(Opts.Triple);
// Construct the target
@@ -2121,6 +2202,12 @@ TargetInfo *TargetInfo::CreateTargetInfo(Diagnostic &Diags,
return 0;
}
+ // Set the target CPU if specified.
+ if (!Opts.CPU.empty() && !Target->setCPU(Opts.CPU)) {
+ Diags.Report(diag::err_target_unknown_cpu) << Opts.CPU;
+ return 0;
+ }
+
// Set the target ABI if specified.
if (!Opts.ABI.empty() && !Target->setABI(Opts.ABI)) {
Diags.Report(diag::err_target_unknown_abi) << Opts.ABI;
@@ -2149,11 +2236,11 @@ TargetInfo *TargetInfo::CreateTargetInfo(Diagnostic &Diags,
//
// FIXME: If we are completely confident that we have the right set, we only
// need to pass the minuses.
- std::vector<std::string> StrFeatures;
+ Opts.Features.clear();
for (llvm::StringMap<bool>::const_iterator it = Features.begin(),
ie = Features.end(); it != ie; ++it)
- StrFeatures.push_back(std::string(it->second ? "+" : "-") + it->first());
- Target->HandleTargetFeatures(StrFeatures);
+ Opts.Features.push_back(std::string(it->second ? "+" : "-") + it->first());
+ Target->HandleTargetFeatures(Opts.Features);
return Target.take();
}
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index 9e44db0aa0a7..1bece7fec6fa 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -460,7 +460,8 @@ const llvm::Type *BlockModule::getGenericExtendedBlockLiteralType() {
return GenericExtendedBlockLiteralType;
}
-RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E) {
+RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E,
+ ReturnValueSlot ReturnValue) {
const BlockPointerType *BPT =
E->getCallee()->getType()->getAs<BlockPointerType>();
@@ -509,7 +510,7 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E) {
Func = Builder.CreateBitCast(Func, BlockFTyPtr);
// And call the block.
- return EmitCall(FnInfo, Func, Args);
+ return EmitCall(FnInfo, Func, ReturnValue, Args);
}
uint64_t CodeGenFunction::AllocateBlockDecl(const BlockDeclRefExpr *E) {
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index c70443245c76..866c58780b9c 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -209,10 +209,19 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
const llvm::Type *ResType[] = {
ConvertType(E->getType())
};
+
+ // LLVM only supports 0 and 2, make sure that we pass along that
+ // as a boolean.
+ Value *Ty = EmitScalarExpr(E->getArg(1));
+ ConstantInt *CI = dyn_cast<ConstantInt>(Ty);
+ assert(CI);
+ uint64_t val = CI->getZExtValue();
+ CI = ConstantInt::get(llvm::Type::getInt1Ty(VMContext), (val & 0x2) >> 1);
+
Value *F = CGM.getIntrinsic(Intrinsic::objectsize, ResType, 1);
return RValue::get(Builder.CreateCall2(F,
EmitScalarExpr(E->getArg(0)),
- EmitScalarExpr(E->getArg(1))));
+ CI));
}
case Builtin::BI__builtin_prefetch: {
Value *Locality, *RW, *Address = EmitScalarExpr(E->getArg(0));
@@ -229,6 +238,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
return RValue::get(Builder.CreateCall(F));
}
case Builtin::BI__builtin_unreachable: {
+ if (CatchUndefined && HaveInsertPoint())
+ EmitBranch(getTrapBB());
Value *V = Builder.CreateUnreachable();
Builder.ClearInsertionPoint();
return RValue::get(V);
@@ -300,6 +311,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), 1));
return RValue::get(Address);
}
+ case Builtin::BImemcpy:
case Builtin::BI__builtin_memcpy: {
Value *Address = EmitScalarExpr(E->getArg(0));
Builder.CreateCall4(CGM.getMemCpyFn(), Address,
@@ -308,6 +320,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), 1));
return RValue::get(Address);
}
+ case Builtin::BImemmove:
case Builtin::BI__builtin_memmove: {
Value *Address = EmitScalarExpr(E->getArg(0));
Builder.CreateCall4(CGM.getMemMoveFn(), Address,
@@ -316,6 +329,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), 1));
return RValue::get(Address);
}
+ case Builtin::BImemset:
case Builtin::BI__builtin_memset: {
Value *Address = EmitScalarExpr(E->getArg(0));
Builder.CreateCall4(CGM.getMemSetFn(), Address,
@@ -326,12 +340,20 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
return RValue::get(Address);
}
case Builtin::BI__builtin_return_address: {
+ Value *Depth = EmitScalarExpr(E->getArg(0));
+ Depth = Builder.CreateIntCast(Depth,
+ llvm::Type::getInt32Ty(VMContext),
+ false, "tmp");
Value *F = CGM.getIntrinsic(Intrinsic::returnaddress, 0, 0);
- return RValue::get(Builder.CreateCall(F, EmitScalarExpr(E->getArg(0))));
+ return RValue::get(Builder.CreateCall(F, Depth));
}
case Builtin::BI__builtin_frame_address: {
+ Value *Depth = EmitScalarExpr(E->getArg(0));
+ Depth = Builder.CreateIntCast(Depth,
+ llvm::Type::getInt32Ty(VMContext),
+ false, "tmp");
Value *F = CGM.getIntrinsic(Intrinsic::frameaddress, 0, 0);
- return RValue::get(Builder.CreateCall(F, EmitScalarExpr(E->getArg(0))));
+ return RValue::get(Builder.CreateCall(F, Depth));
}
case Builtin::BI__builtin_extract_return_addr: {
// FIXME: There should be a target hook for this
@@ -565,9 +587,10 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
// that function.
if (getContext().BuiltinInfo.isLibFunction(BuiltinID) ||
getContext().BuiltinInfo.isPredefinedLibFunction(BuiltinID))
- return EmitCall(CGM.getBuiltinLibFunction(FD, BuiltinID),
- E->getCallee()->getType(), E->arg_begin(),
- E->arg_end());
+ return EmitCall(E->getCallee()->getType(),
+ CGM.getBuiltinLibFunction(FD, BuiltinID),
+ ReturnValueSlot(),
+ E->arg_begin(), E->arg_end());
// See if we have a target specific intrinsic.
const char *Name = getContext().BuiltinInfo.GetName(BuiltinID);
@@ -848,7 +871,5 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
const CallExpr *E) {
- switch (BuiltinID) {
- default: return 0;
- }
+ return 0;
}
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 0d11be22201c..cc006d9dd6c1 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -28,6 +28,7 @@ using namespace CodeGen;
RValue CodeGenFunction::EmitCXXMemberCall(const CXXMethodDecl *MD,
llvm::Value *Callee,
+ ReturnValueSlot ReturnValue,
llvm::Value *This,
CallExpr::const_arg_iterator ArgBeg,
CallExpr::const_arg_iterator ArgEnd) {
@@ -46,8 +47,8 @@ RValue CodeGenFunction::EmitCXXMemberCall(const CXXMethodDecl *MD,
EmitCallArgs(Args, FPT, ArgBeg, ArgEnd);
QualType ResultType = MD->getType()->getAs<FunctionType>()->getResultType();
- return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args),
- Callee, Args, MD);
+ return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), Callee,
+ ReturnValue, Args, MD);
}
/// canDevirtualizeMemberFunctionCalls - Checks whether virtual calls on given
@@ -78,9 +79,10 @@ static bool canDevirtualizeMemberFunctionCalls(const Expr *Base) {
return false;
}
-RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) {
+RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE,
+ ReturnValueSlot ReturnValue) {
if (isa<BinaryOperator>(CE->getCallee()->IgnoreParens()))
- return EmitCXXMemberPointerCallExpr(CE);
+ return EmitCXXMemberPointerCallExpr(CE, ReturnValue);
const MemberExpr *ME = cast<MemberExpr>(CE->getCallee()->IgnoreParens());
const CXXMethodDecl *MD = cast<CXXMethodDecl>(ME->getMemberDecl());
@@ -88,9 +90,8 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) {
if (MD->isStatic()) {
// The method is static, emit it as we would a regular call.
llvm::Value *Callee = CGM.GetAddrOfFunction(MD);
- return EmitCall(Callee, getContext().getPointerType(MD->getType()),
- CE->arg_begin(), CE->arg_end(), 0);
-
+ return EmitCall(getContext().getPointerType(MD->getType()), Callee,
+ ReturnValue, CE->arg_begin(), CE->arg_end());
}
const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
@@ -139,12 +140,13 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) {
Callee = CGM.GetAddrOfFunction(MD, Ty);
}
- return EmitCXXMemberCall(MD, Callee, This,
+ return EmitCXXMemberCall(MD, Callee, ReturnValue, This,
CE->arg_begin(), CE->arg_end());
}
RValue
-CodeGenFunction::EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E) {
+CodeGenFunction::EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E,
+ ReturnValueSlot ReturnValue) {
const BinaryOperator *BO =
cast<BinaryOperator>(E->getCallee()->IgnoreParens());
const Expr *BaseExpr = BO->getLHS();
@@ -247,13 +249,14 @@ CodeGenFunction::EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E) {
// And the rest of the call args
EmitCallArgs(Args, FPT, E->arg_begin(), E->arg_end());
QualType ResultType = BO->getType()->getAs<FunctionType>()->getResultType();
- return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args),
- Callee, Args, 0);
+ return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), Callee,
+ ReturnValue, Args);
}
RValue
CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
- const CXXMethodDecl *MD) {
+ const CXXMethodDecl *MD,
+ ReturnValueSlot ReturnValue) {
assert(MD->isInstance() &&
"Trying to emit a member call expr on a static method!");
@@ -283,7 +286,7 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
else
Callee = CGM.GetAddrOfFunction(MD, Ty);
- return EmitCXXMemberCall(MD, Callee, This,
+ return EmitCXXMemberCall(MD, Callee, ReturnValue, This,
E->arg_begin() + 1, E->arg_end());
}
@@ -508,7 +511,7 @@ CodeGenFunction::EmitCXXConstructorCall(const CXXConstructorDecl *D,
llvm::Value *This,
CallExpr::const_arg_iterator ArgBeg,
CallExpr::const_arg_iterator ArgEnd) {
- if (D->isCopyConstructor(getContext())) {
+ if (D->isCopyConstructor()) {
const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(D->getDeclContext());
if (ClassDecl->hasTrivialCopyConstructor()) {
assert(!ClassDecl->hasUserDeclaredCopyConstructor() &&
@@ -527,7 +530,7 @@ CodeGenFunction::EmitCXXConstructorCall(const CXXConstructorDecl *D,
llvm::Value *Callee = CGM.GetAddrOfCXXConstructor(D, Type);
- EmitCXXMemberCall(D, Callee, This, ArgBeg, ArgEnd);
+ EmitCXXMemberCall(D, Callee, ReturnValueSlot(), This, ArgBeg, ArgEnd);
}
void CodeGenFunction::EmitCXXDestructorCall(const CXXDestructorDecl *DD,
@@ -552,7 +555,8 @@ void CodeGenFunction::EmitCXXDestructorCall(const CXXDestructorDecl *DD,
// FIXME: We should try to share this code with EmitCXXMemberCall.
QualType ResultType = DD->getType()->getAs<FunctionType>()->getResultType();
- EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), Callee, Args, DD);
+ EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), Callee,
+ ReturnValueSlot(), Args, DD);
}
void
@@ -564,22 +568,33 @@ CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest,
getContext().getAsConstantArrayType(E->getType());
// For a copy constructor, even if it is trivial, must fall thru so
// its argument is code-gen'ed.
- if (!CD->isCopyConstructor(getContext())) {
+ if (!CD->isCopyConstructor()) {
QualType InitType = E->getType();
if (Array)
InitType = getContext().getBaseElementType(Array);
const CXXRecordDecl *RD =
cast<CXXRecordDecl>(InitType->getAs<RecordType>()->getDecl());
if (RD->hasTrivialConstructor())
- return;
+ return;
}
// Code gen optimization to eliminate copy constructor and return
// its first argument instead.
if (getContext().getLangOptions().ElideConstructors && E->isElidable()) {
const Expr *Arg = E->getArg(0);
-
+
+ if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
+ assert((ICE->getCastKind() == CastExpr::CK_NoOp ||
+ ICE->getCastKind() == CastExpr::CK_ConstructorConversion ||
+ ICE->getCastKind() == CastExpr::CK_UserDefinedConversion) &&
+ "Unknown implicit cast kind in constructor elision");
+ Arg = ICE->getSubExpr();
+ }
+
+ if (const CXXFunctionalCastExpr *FCE = dyn_cast<CXXFunctionalCastExpr>(Arg))
+ Arg = FCE->getSubExpr();
+
if (const CXXBindTemporaryExpr *BindExpr =
- dyn_cast<CXXBindTemporaryExpr>(Arg))
+ dyn_cast<CXXBindTemporaryExpr>(Arg))
Arg = BindExpr->getSubExpr();
EmitAggExpr(Arg, Dest, false);
@@ -591,6 +606,7 @@ CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest,
BasePtr = llvm::PointerType::getUnqual(BasePtr);
llvm::Value *BaseAddrPtr =
Builder.CreateBitCast(Dest, BasePtr);
+
EmitCXXAggrConstructorCall(CD, Array, BaseAddrPtr,
E->arg_begin(), E->arg_end());
}
@@ -793,7 +809,7 @@ CodeGenFunction::GenerateCovariantThunk(llvm::Function *Fn,
}
RValue RV = EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
- Callee, CallArgs, MD);
+ Callee, ReturnValueSlot(), CallArgs, MD);
if (ShouldAdjustReturnPointer && !Adjustment.ReturnAdjustment.isEmpty()) {
bool CanBeZero = !(ResultType->isReferenceType()
// FIXME: attr nonnull can't be zero either
@@ -1043,765 +1059,70 @@ CodeGenFunction::BuildVirtualCall(const CXXDestructorDecl *DD, CXXDtorType Type,
return ::BuildVirtualCall(*this, VtableIndex, This, Ty);
}
-/// EmitClassAggrMemberwiseCopy - This routine generates code to copy a class
-/// array of objects from SrcValue to DestValue. Copying can be either a bitwise
-/// copy or via a copy constructor call.
-// FIXME. Consolidate this with EmitCXXAggrConstructorCall.
-void CodeGenFunction::EmitClassAggrMemberwiseCopy(llvm::Value *Dest,
- llvm::Value *Src,
- const ArrayType *Array,
- const CXXRecordDecl *BaseClassDecl,
- QualType Ty) {
- const ConstantArrayType *CA = dyn_cast<ConstantArrayType>(Array);
- assert(CA && "VLA cannot be copied over");
- bool BitwiseCopy = BaseClassDecl->hasTrivialCopyConstructor();
-
- // Create a temporary for the loop index and initialize it with 0.
- llvm::Value *IndexPtr = CreateTempAlloca(llvm::Type::getInt64Ty(VMContext),
- "loop.index");
- llvm::Value* zeroConstant =
- llvm::Constant::getNullValue(llvm::Type::getInt64Ty(VMContext));
- Builder.CreateStore(zeroConstant, IndexPtr);
- // Start the loop with a block that tests the condition.
- llvm::BasicBlock *CondBlock = createBasicBlock("for.cond");
- llvm::BasicBlock *AfterFor = createBasicBlock("for.end");
-
- EmitBlock(CondBlock);
-
- llvm::BasicBlock *ForBody = createBasicBlock("for.body");
- // Generate: if (loop-index < number-of-elements fall to the loop body,
- // otherwise, go to the block after the for-loop.
- uint64_t NumElements = getContext().getConstantArrayElementCount(CA);
- llvm::Value * NumElementsPtr =
- llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext), NumElements);
- llvm::Value *Counter = Builder.CreateLoad(IndexPtr);
- llvm::Value *IsLess = Builder.CreateICmpULT(Counter, NumElementsPtr,
- "isless");
- // If the condition is true, execute the body.
- Builder.CreateCondBr(IsLess, ForBody, AfterFor);
-
- EmitBlock(ForBody);
- llvm::BasicBlock *ContinueBlock = createBasicBlock("for.inc");
- // Inside the loop body, emit the constructor call on the array element.
- Counter = Builder.CreateLoad(IndexPtr);
- Src = Builder.CreateInBoundsGEP(Src, Counter, "srcaddress");
- Dest = Builder.CreateInBoundsGEP(Dest, Counter, "destaddress");
- if (BitwiseCopy)
- EmitAggregateCopy(Dest, Src, Ty);
- else if (CXXConstructorDecl *BaseCopyCtor =
- BaseClassDecl->getCopyConstructor(getContext(), 0)) {
- llvm::Value *Callee = CGM.GetAddrOfCXXConstructor(BaseCopyCtor,
- Ctor_Complete);
- CallArgList CallArgs;
- // Push the this (Dest) ptr.
- CallArgs.push_back(std::make_pair(RValue::get(Dest),
- BaseCopyCtor->getThisType(getContext())));
-
- // Push the Src ptr.
- CallArgs.push_back(std::make_pair(RValue::get(Src),
- BaseCopyCtor->getParamDecl(0)->getType()));
- QualType ResultType =
- BaseCopyCtor->getType()->getAs<FunctionType>()->getResultType();
- EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
- Callee, CallArgs, BaseCopyCtor);
- }
- EmitBlock(ContinueBlock);
-
- // Emit the increment of the loop counter.
- llvm::Value *NextVal = llvm::ConstantInt::get(Counter->getType(), 1);
- Counter = Builder.CreateLoad(IndexPtr);
- NextVal = Builder.CreateAdd(Counter, NextVal, "inc");
- Builder.CreateStore(NextVal, IndexPtr);
-
- // Finally, branch back up to the condition for the next iteration.
- EmitBranch(CondBlock);
-
- // Emit the fall-through block.
- EmitBlock(AfterFor, true);
-}
-
-/// EmitClassAggrCopyAssignment - This routine generates code to assign a class
-/// array of objects from SrcValue to DestValue. Assignment can be either a
-/// bitwise assignment or via a copy assignment operator function call.
-/// FIXME. This can be consolidated with EmitClassAggrMemberwiseCopy
-void CodeGenFunction::EmitClassAggrCopyAssignment(llvm::Value *Dest,
- llvm::Value *Src,
- const ArrayType *Array,
- const CXXRecordDecl *BaseClassDecl,
- QualType Ty) {
- const ConstantArrayType *CA = dyn_cast<ConstantArrayType>(Array);
- assert(CA && "VLA cannot be asssigned");
- bool BitwiseAssign = BaseClassDecl->hasTrivialCopyAssignment();
-
- // Create a temporary for the loop index and initialize it with 0.
- llvm::Value *IndexPtr = CreateTempAlloca(llvm::Type::getInt64Ty(VMContext),
- "loop.index");
- llvm::Value* zeroConstant =
- llvm::Constant::getNullValue(llvm::Type::getInt64Ty(VMContext));
- Builder.CreateStore(zeroConstant, IndexPtr);
- // Start the loop with a block that tests the condition.
- llvm::BasicBlock *CondBlock = createBasicBlock("for.cond");
- llvm::BasicBlock *AfterFor = createBasicBlock("for.end");
-
- EmitBlock(CondBlock);
-
- llvm::BasicBlock *ForBody = createBasicBlock("for.body");
- // Generate: if (loop-index < number-of-elements fall to the loop body,
- // otherwise, go to the block after the for-loop.
- uint64_t NumElements = getContext().getConstantArrayElementCount(CA);
- llvm::Value * NumElementsPtr =
- llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext), NumElements);
- llvm::Value *Counter = Builder.CreateLoad(IndexPtr);
- llvm::Value *IsLess = Builder.CreateICmpULT(Counter, NumElementsPtr,
- "isless");
- // If the condition is true, execute the body.
- Builder.CreateCondBr(IsLess, ForBody, AfterFor);
-
- EmitBlock(ForBody);
- llvm::BasicBlock *ContinueBlock = createBasicBlock("for.inc");
- // Inside the loop body, emit the assignment operator call on array element.
- Counter = Builder.CreateLoad(IndexPtr);
- Src = Builder.CreateInBoundsGEP(Src, Counter, "srcaddress");
- Dest = Builder.CreateInBoundsGEP(Dest, Counter, "destaddress");
- const CXXMethodDecl *MD = 0;
- if (BitwiseAssign)
- EmitAggregateCopy(Dest, Src, Ty);
- else {
- bool hasCopyAssign = BaseClassDecl->hasConstCopyAssignment(getContext(),
- MD);
- assert(hasCopyAssign && "EmitClassAggrCopyAssignment - No user assign");
- (void)hasCopyAssign;
- const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
- const llvm::Type *LTy =
- CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD),
- FPT->isVariadic());
- llvm::Constant *Callee = CGM.GetAddrOfFunction(MD, LTy);
-
- CallArgList CallArgs;
- // Push the this (Dest) ptr.
- CallArgs.push_back(std::make_pair(RValue::get(Dest),
- MD->getThisType(getContext())));
-
- // Push the Src ptr.
- CallArgs.push_back(std::make_pair(RValue::get(Src),
- MD->getParamDecl(0)->getType()));
- QualType ResultType = MD->getType()->getAs<FunctionType>()->getResultType();
- EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
- Callee, CallArgs, MD);
- }
- EmitBlock(ContinueBlock);
-
- // Emit the increment of the loop counter.
- llvm::Value *NextVal = llvm::ConstantInt::get(Counter->getType(), 1);
- Counter = Builder.CreateLoad(IndexPtr);
- NextVal = Builder.CreateAdd(Counter, NextVal, "inc");
- Builder.CreateStore(NextVal, IndexPtr);
-
- // Finally, branch back up to the condition for the next iteration.
- EmitBranch(CondBlock);
-
- // Emit the fall-through block.
- EmitBlock(AfterFor, true);
-}
-
-/// EmitClassMemberwiseCopy - This routine generates code to copy a class
-/// object from SrcValue to DestValue. Copying can be either a bitwise copy
-/// or via a copy constructor call.
-void CodeGenFunction::EmitClassMemberwiseCopy(
- llvm::Value *Dest, llvm::Value *Src,
- const CXXRecordDecl *ClassDecl,
- const CXXRecordDecl *BaseClassDecl, QualType Ty) {
- if (ClassDecl) {
- Dest = GetAddressOfBaseClass(Dest, ClassDecl, BaseClassDecl,
- /*NullCheckValue=*/false);
- Src = GetAddressOfBaseClass(Src, ClassDecl, BaseClassDecl,
- /*NullCheckValue=*/false);
- }
- if (BaseClassDecl->hasTrivialCopyConstructor()) {
- EmitAggregateCopy(Dest, Src, Ty);
- return;
- }
-
- if (CXXConstructorDecl *BaseCopyCtor =
- BaseClassDecl->getCopyConstructor(getContext(), 0)) {
- llvm::Value *Callee = CGM.GetAddrOfCXXConstructor(BaseCopyCtor,
- Ctor_Complete);
- CallArgList CallArgs;
- // Push the this (Dest) ptr.
- CallArgs.push_back(std::make_pair(RValue::get(Dest),
- BaseCopyCtor->getThisType(getContext())));
-
- // Push the Src ptr.
- CallArgs.push_back(std::make_pair(RValue::get(Src),
- BaseCopyCtor->getParamDecl(0)->getType()));
- QualType ResultType =
- BaseCopyCtor->getType()->getAs<FunctionType>()->getResultType();
- EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
- Callee, CallArgs, BaseCopyCtor);
- }
-}
-
-/// EmitClassCopyAssignment - This routine generates code to copy assign a class
-/// object from SrcValue to DestValue. Assignment can be either a bitwise
-/// assignment of via an assignment operator call.
-// FIXME. Consolidate this with EmitClassMemberwiseCopy as they share a lot.
-void CodeGenFunction::EmitClassCopyAssignment(
- llvm::Value *Dest, llvm::Value *Src,
- const CXXRecordDecl *ClassDecl,
- const CXXRecordDecl *BaseClassDecl,
- QualType Ty) {
- if (ClassDecl) {
- Dest = GetAddressOfBaseClass(Dest, ClassDecl, BaseClassDecl,
- /*NullCheckValue=*/false);
- Src = GetAddressOfBaseClass(Src, ClassDecl, BaseClassDecl,
- /*NullCheckValue=*/false);
- }
- if (BaseClassDecl->hasTrivialCopyAssignment()) {
- EmitAggregateCopy(Dest, Src, Ty);
+void CodeGenFunction::InitializeVtablePtrs(const CXXRecordDecl *ClassDecl) {
+ if (!ClassDecl->isDynamicClass())
return;
- }
-
- const CXXMethodDecl *MD = 0;
- bool ConstCopyAssignOp = BaseClassDecl->hasConstCopyAssignment(getContext(),
- MD);
- assert(ConstCopyAssignOp && "EmitClassCopyAssignment - missing copy assign");
- (void)ConstCopyAssignOp;
-
- const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
- const llvm::Type *LTy =
- CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD),
- FPT->isVariadic());
- llvm::Constant *Callee = CGM.GetAddrOfFunction(MD, LTy);
-
- CallArgList CallArgs;
- // Push the this (Dest) ptr.
- CallArgs.push_back(std::make_pair(RValue::get(Dest),
- MD->getThisType(getContext())));
-
- // Push the Src ptr.
- CallArgs.push_back(std::make_pair(RValue::get(Src),
- MD->getParamDecl(0)->getType()));
- QualType ResultType =
- MD->getType()->getAs<FunctionType>()->getResultType();
- EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
- Callee, CallArgs, MD);
-}
-
-/// SynthesizeDefaultConstructor - synthesize a default constructor
-void
-CodeGenFunction::SynthesizeDefaultConstructor(const CXXConstructorDecl *Ctor,
- CXXCtorType Type,
- llvm::Function *Fn,
- const FunctionArgList &Args) {
- assert(!Ctor->isTrivial() && "shouldn't need to generate trivial ctor");
- StartFunction(GlobalDecl(Ctor, Type), Ctor->getResultType(), Fn, Args,
- SourceLocation());
- EmitCtorPrologue(Ctor, Type);
- FinishFunction();
-}
-
-/// SynthesizeCXXCopyConstructor - This routine implicitly defines body of a
-/// copy constructor, in accordance with section 12.8 (p7 and p8) of C++03
-/// The implicitly-defined copy constructor for class X performs a memberwise
-/// copy of its subobjects. The order of copying is the same as the order of
-/// initialization of bases and members in a user-defined constructor
-/// Each subobject is copied in the manner appropriate to its type:
-/// if the subobject is of class type, the copy constructor for the class is
-/// used;
-/// if the subobject is an array, each element is copied, in the manner
-/// appropriate to the element type;
-/// if the subobject is of scalar type, the built-in assignment operator is
-/// used.
-/// Virtual base class subobjects shall be copied only once by the
-/// implicitly-defined copy constructor
-
-void
-CodeGenFunction::SynthesizeCXXCopyConstructor(const CXXConstructorDecl *Ctor,
- CXXCtorType Type,
- llvm::Function *Fn,
- const FunctionArgList &Args) {
- const CXXRecordDecl *ClassDecl = Ctor->getParent();
- assert(!ClassDecl->hasUserDeclaredCopyConstructor() &&
- "SynthesizeCXXCopyConstructor - copy constructor has definition already");
- assert(!Ctor->isTrivial() && "shouldn't need to generate trivial ctor");
- StartFunction(GlobalDecl(Ctor, Type), Ctor->getResultType(), Fn, Args,
- SourceLocation());
-
- FunctionArgList::const_iterator i = Args.begin();
- const VarDecl *ThisArg = i->first;
- llvm::Value *ThisObj = GetAddrOfLocalVar(ThisArg);
- llvm::Value *LoadOfThis = Builder.CreateLoad(ThisObj, "this");
- const VarDecl *SrcArg = (i+1)->first;
- llvm::Value *SrcObj = GetAddrOfLocalVar(SrcArg);
- llvm::Value *LoadOfSrc = Builder.CreateLoad(SrcObj);
-
- for (CXXRecordDecl::base_class_const_iterator Base = ClassDecl->bases_begin();
- Base != ClassDecl->bases_end(); ++Base) {
- // FIXME. copy constrution of virtual base NYI
- if (Base->isVirtual())
- continue;
-
- CXXRecordDecl *BaseClassDecl
- = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
- EmitClassMemberwiseCopy(LoadOfThis, LoadOfSrc, ClassDecl, BaseClassDecl,
- Base->getType());
- }
- for (CXXRecordDecl::field_iterator I = ClassDecl->field_begin(),
- E = ClassDecl->field_end(); I != E; ++I) {
- const FieldDecl *Field = *I;
-
- QualType FieldType = getContext().getCanonicalType(Field->getType());
- const ConstantArrayType *Array =
- getContext().getAsConstantArrayType(FieldType);
- if (Array)
- FieldType = getContext().getBaseElementType(FieldType);
-
- if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
- CXXRecordDecl *FieldClassDecl
- = cast<CXXRecordDecl>(FieldClassType->getDecl());
- LValue LHS = EmitLValueForField(LoadOfThis, Field, false, 0);
- LValue RHS = EmitLValueForField(LoadOfSrc, Field, false, 0);
- if (Array) {
- const llvm::Type *BasePtr = ConvertType(FieldType);
- BasePtr = llvm::PointerType::getUnqual(BasePtr);
- llvm::Value *DestBaseAddrPtr =
- Builder.CreateBitCast(LHS.getAddress(), BasePtr);
- llvm::Value *SrcBaseAddrPtr =
- Builder.CreateBitCast(RHS.getAddress(), BasePtr);
- EmitClassAggrMemberwiseCopy(DestBaseAddrPtr, SrcBaseAddrPtr, Array,
- FieldClassDecl, FieldType);
- }
- else
- EmitClassMemberwiseCopy(LHS.getAddress(), RHS.getAddress(),
- 0 /*ClassDecl*/, FieldClassDecl, FieldType);
- continue;
- }
-
- if (Field->getType()->isReferenceType()) {
- unsigned FieldIndex = CGM.getTypes().getLLVMFieldNo(Field);
-
- llvm::Value *LHS = Builder.CreateStructGEP(LoadOfThis, FieldIndex,
- "lhs.ref");
-
- llvm::Value *RHS = Builder.CreateStructGEP(LoadOfThis, FieldIndex,
- "rhs.ref");
-
- // Load the value in RHS.
- RHS = Builder.CreateLoad(RHS);
-
- // And store it in the LHS
- Builder.CreateStore(RHS, LHS);
-
- continue;
- }
- // Do a built-in assignment of scalar data members.
- LValue LHS = EmitLValueForField(LoadOfThis, Field, false, 0);
- LValue RHS = EmitLValueForField(LoadOfSrc, Field, false, 0);
-
- if (!hasAggregateLLVMType(Field->getType())) {
- RValue RVRHS = EmitLoadOfLValue(RHS, Field->getType());
- EmitStoreThroughLValue(RVRHS, LHS, Field->getType());
- } else if (Field->getType()->isAnyComplexType()) {
- ComplexPairTy Pair = LoadComplexFromAddr(RHS.getAddress(),
- RHS.isVolatileQualified());
- StoreComplexToAddr(Pair, LHS.getAddress(), LHS.isVolatileQualified());
- } else {
- EmitAggregateCopy(LHS.getAddress(), RHS.getAddress(), Field->getType());
- }
- }
-
- InitializeVtablePtrs(ClassDecl);
- FinishFunction();
-}
-
-/// SynthesizeCXXCopyAssignment - Implicitly define copy assignment operator.
-/// Before the implicitly-declared copy assignment operator for a class is
-/// implicitly defined, all implicitly- declared copy assignment operators for
-/// its direct base classes and its nonstatic data members shall have been
-/// implicitly defined. [12.8-p12]
-/// The implicitly-defined copy assignment operator for class X performs
-/// memberwise assignment of its subob- jects. The direct base classes of X are
-/// assigned first, in the order of their declaration in
-/// the base-specifier-list, and then the immediate nonstatic data members of X
-/// are assigned, in the order in which they were declared in the class
-/// definition.Each subobject is assigned in the manner appropriate to its type:
-/// if the subobject is of class type, the copy assignment operator for the
-/// class is used (as if by explicit qualification; that is, ignoring any
-/// possible virtual overriding functions in more derived classes);
-///
-/// if the subobject is an array, each element is assigned, in the manner
-/// appropriate to the element type;
-///
-/// if the subobject is of scalar type, the built-in assignment operator is
-/// used.
-void CodeGenFunction::SynthesizeCXXCopyAssignment(const CXXMethodDecl *CD,
- llvm::Function *Fn,
- const FunctionArgList &Args) {
-
- const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(CD->getDeclContext());
- assert(!ClassDecl->hasUserDeclaredCopyAssignment() &&
- "SynthesizeCXXCopyAssignment - copy assignment has user declaration");
- StartFunction(CD, CD->getResultType(), Fn, Args, SourceLocation());
-
- FunctionArgList::const_iterator i = Args.begin();
- const VarDecl *ThisArg = i->first;
- llvm::Value *ThisObj = GetAddrOfLocalVar(ThisArg);
- llvm::Value *LoadOfThis = Builder.CreateLoad(ThisObj, "this");
- const VarDecl *SrcArg = (i+1)->first;
- llvm::Value *SrcObj = GetAddrOfLocalVar(SrcArg);
- llvm::Value *LoadOfSrc = Builder.CreateLoad(SrcObj);
-
- for (CXXRecordDecl::base_class_const_iterator Base = ClassDecl->bases_begin();
- Base != ClassDecl->bases_end(); ++Base) {
- // FIXME. copy assignment of virtual base NYI
- if (Base->isVirtual())
- continue;
+ llvm::Constant *Vtable = CGM.getVtableInfo().getVtable(ClassDecl);
+ CodeGenModule::AddrSubMap_t& AddressPoints =
+ *(*CGM.AddressPoints[ClassDecl])[ClassDecl];
+ llvm::Value *ThisPtr = LoadCXXThis();
+ const ASTRecordLayout &Layout = getContext().getASTRecordLayout(ClassDecl);
+ // Store address points for virtual bases
+ for (CXXRecordDecl::base_class_const_iterator I =
+ ClassDecl->vbases_begin(), E = ClassDecl->vbases_end(); I != E; ++I) {
+ const CXXBaseSpecifier &Base = *I;
CXXRecordDecl *BaseClassDecl
- = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
- EmitClassCopyAssignment(LoadOfThis, LoadOfSrc, ClassDecl, BaseClassDecl,
- Base->getType());
- }
-
- for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
- FieldEnd = ClassDecl->field_end();
- Field != FieldEnd; ++Field) {
- QualType FieldType = getContext().getCanonicalType((*Field)->getType());
- const ConstantArrayType *Array =
- getContext().getAsConstantArrayType(FieldType);
- if (Array)
- FieldType = getContext().getBaseElementType(FieldType);
-
- if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
- CXXRecordDecl *FieldClassDecl
- = cast<CXXRecordDecl>(FieldClassType->getDecl());
- LValue LHS = EmitLValueForField(LoadOfThis, *Field, false, 0);
- LValue RHS = EmitLValueForField(LoadOfSrc, *Field, false, 0);
- if (Array) {
- const llvm::Type *BasePtr = ConvertType(FieldType);
- BasePtr = llvm::PointerType::getUnqual(BasePtr);
- llvm::Value *DestBaseAddrPtr =
- Builder.CreateBitCast(LHS.getAddress(), BasePtr);
- llvm::Value *SrcBaseAddrPtr =
- Builder.CreateBitCast(RHS.getAddress(), BasePtr);
- EmitClassAggrCopyAssignment(DestBaseAddrPtr, SrcBaseAddrPtr, Array,
- FieldClassDecl, FieldType);
- }
- else
- EmitClassCopyAssignment(LHS.getAddress(), RHS.getAddress(),
- 0 /*ClassDecl*/, FieldClassDecl, FieldType);
- continue;
- }
- // Do a built-in assignment of scalar data members.
- LValue LHS = EmitLValueForField(LoadOfThis, *Field, false, 0);
- LValue RHS = EmitLValueForField(LoadOfSrc, *Field, false, 0);
- if (!hasAggregateLLVMType(Field->getType())) {
- RValue RVRHS = EmitLoadOfLValue(RHS, Field->getType());
- EmitStoreThroughLValue(RVRHS, LHS, Field->getType());
- } else if (Field->getType()->isAnyComplexType()) {
- ComplexPairTy Pair = LoadComplexFromAddr(RHS.getAddress(),
- RHS.isVolatileQualified());
- StoreComplexToAddr(Pair, LHS.getAddress(), LHS.isVolatileQualified());
- } else {
- EmitAggregateCopy(LHS.getAddress(), RHS.getAddress(), Field->getType());
- }
- }
-
- // return *this;
- Builder.CreateStore(LoadOfThis, ReturnValue);
-
- FinishFunction();
-}
-
-static void EmitBaseInitializer(CodeGenFunction &CGF,
- const CXXRecordDecl *ClassDecl,
- CXXBaseOrMemberInitializer *BaseInit,
- CXXCtorType CtorType) {
- assert(BaseInit->isBaseInitializer() &&
- "Must have base initializer!");
-
- llvm::Value *ThisPtr = CGF.LoadCXXThis();
-
- const Type *BaseType = BaseInit->getBaseClass();
- CXXRecordDecl *BaseClassDecl =
- cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl());
- llvm::Value *V = CGF.GetAddressOfBaseClass(ThisPtr, ClassDecl,
- BaseClassDecl,
- /*NullCheckValue=*/false);
- CGF.EmitCXXConstructorCall(BaseInit->getConstructor(),
- CtorType, V,
- BaseInit->const_arg_begin(),
- BaseInit->const_arg_end());
-}
-
-static void EmitMemberInitializer(CodeGenFunction &CGF,
- const CXXRecordDecl *ClassDecl,
- CXXBaseOrMemberInitializer *MemberInit) {
- assert(MemberInit->isMemberInitializer() &&
- "Must have member initializer!");
-
- // non-static data member initializers.
- FieldDecl *Field = MemberInit->getMember();
- QualType FieldType = CGF.getContext().getCanonicalType(Field->getType());
-
- llvm::Value *ThisPtr = CGF.LoadCXXThis();
- LValue LHS;
- if (FieldType->isReferenceType()) {
- // FIXME: This is really ugly; should be refactored somehow
- unsigned idx = CGF.CGM.getTypes().getLLVMFieldNo(Field);
- llvm::Value *V = CGF.Builder.CreateStructGEP(ThisPtr, idx, "tmp");
- assert(!FieldType.getObjCGCAttr() && "fields cannot have GC attrs");
- LHS = LValue::MakeAddr(V, CGF.MakeQualifiers(FieldType));
- } else {
- LHS = CGF.EmitLValueForField(ThisPtr, Field, ClassDecl->isUnion(), 0);
- }
-
- // If we are initializing an anonymous union field, drill down to the field.
- if (MemberInit->getAnonUnionMember()) {
- Field = MemberInit->getAnonUnionMember();
- LHS = CGF.EmitLValueForField(LHS.getAddress(), Field,
- /*IsUnion=*/true, 0);
- FieldType = Field->getType();
- }
-
- // If the field is an array, branch based on the element type.
- const ConstantArrayType *Array =
- CGF.getContext().getAsConstantArrayType(FieldType);
- if (Array)
- FieldType = CGF.getContext().getBaseElementType(FieldType);
-
- // We lose the constructor for anonymous union members, so handle them
- // explicitly.
- // FIXME: This is somwhat ugly.
- if (MemberInit->getAnonUnionMember() && FieldType->getAs<RecordType>()) {
- if (MemberInit->getNumArgs())
- CGF.EmitAggExpr(*MemberInit->arg_begin(), LHS.getAddress(),
- LHS.isVolatileQualified());
- else
- CGF.EmitAggregateClear(LHS.getAddress(), Field->getType());
- return;
- }
-
- if (FieldType->getAs<RecordType>()) {
- assert(MemberInit->getConstructor() &&
- "EmitCtorPrologue - no constructor to initialize member");
- if (Array) {
- const llvm::Type *BasePtr = CGF.ConvertType(FieldType);
- BasePtr = llvm::PointerType::getUnqual(BasePtr);
- llvm::Value *BaseAddrPtr =
- CGF.Builder.CreateBitCast(LHS.getAddress(), BasePtr);
- CGF.EmitCXXAggrConstructorCall(MemberInit->getConstructor(),
- Array, BaseAddrPtr,
- MemberInit->const_arg_begin(),
- MemberInit->const_arg_end());
- }
- else
- CGF.EmitCXXConstructorCall(MemberInit->getConstructor(),
- Ctor_Complete, LHS.getAddress(),
- MemberInit->const_arg_begin(),
- MemberInit->const_arg_end());
- return;
- }
-
- assert(MemberInit->getNumArgs() == 1 && "Initializer count must be 1 only");
- Expr *RhsExpr = *MemberInit->arg_begin();
- RValue RHS;
- if (FieldType->isReferenceType()) {
- RHS = CGF.EmitReferenceBindingToExpr(RhsExpr, FieldType,
- /*IsInitializer=*/true);
- CGF.EmitStoreThroughLValue(RHS, LHS, FieldType);
- } else if (Array) {
- CGF.EmitMemSetToZero(LHS.getAddress(), Field->getType());
- } else if (!CGF.hasAggregateLLVMType(RhsExpr->getType())) {
- RHS = RValue::get(CGF.EmitScalarExpr(RhsExpr, true));
- CGF.EmitStoreThroughLValue(RHS, LHS, FieldType);
- } else if (RhsExpr->getType()->isAnyComplexType()) {
- CGF.EmitComplexExprIntoAddr(RhsExpr, LHS.getAddress(),
- LHS.isVolatileQualified());
- } else {
- // Handle member function pointers; other aggregates shouldn't get this far.
- CGF.EmitAggExpr(RhsExpr, LHS.getAddress(), LHS.isVolatileQualified());
- }
-}
-
-/// EmitCtorPrologue - This routine generates necessary code to initialize
-/// base classes and non-static data members belonging to this constructor.
-/// FIXME: This needs to take a CXXCtorType.
-void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD,
- CXXCtorType CtorType) {
- const CXXRecordDecl *ClassDecl = CD->getParent();
-
- // FIXME: Add vbase initialization
-
- for (CXXConstructorDecl::init_const_iterator B = CD->init_begin(),
- E = CD->init_end();
- B != E; ++B) {
- CXXBaseOrMemberInitializer *Member = (*B);
-
- assert(LiveTemporaries.empty() &&
- "Should not have any live temporaries at initializer start!");
-
- if (Member->isBaseInitializer())
- EmitBaseInitializer(*this, ClassDecl, Member, CtorType);
- else
- EmitMemberInitializer(*this, ClassDecl, Member);
-
- // Pop any live temporaries that the initializers might have pushed.
- while (!LiveTemporaries.empty())
- PopCXXTemporary();
+ = cast<CXXRecordDecl>(Base.getType()->getAs<RecordType>()->getDecl());
+ uint64_t Offset = Layout.getVBaseClassOffset(BaseClassDecl);
+ InitializeVtablePtrsRecursive(BaseClassDecl, Vtable, AddressPoints,
+ ThisPtr, Offset);
}
- InitializeVtablePtrs(ClassDecl);
+ // Store address points for non-virtual bases and current class
+ InitializeVtablePtrsRecursive(ClassDecl, Vtable, AddressPoints, ThisPtr, 0);
}
-void CodeGenFunction::InitializeVtablePtrs(const CXXRecordDecl *ClassDecl) {
+void CodeGenFunction::InitializeVtablePtrsRecursive(
+ const CXXRecordDecl *ClassDecl,
+ llvm::Constant *Vtable,
+ CodeGenModule::AddrSubMap_t& AddressPoints,
+ llvm::Value *ThisPtr,
+ uint64_t Offset) {
if (!ClassDecl->isDynamicClass())
return;
-
- // Initialize the vtable pointer.
- // FIXME: This needs to initialize secondary vtable pointers too.
- llvm::Value *ThisPtr = LoadCXXThis();
- llvm::Constant *Vtable = CGM.getVtableInfo().getVtable(ClassDecl);
- uint64_t AddressPoint = CGM.getVtableInfo().getVtableAddressPoint(ClassDecl);
-
- llvm::Value *VtableAddressPoint =
- Builder.CreateConstInBoundsGEP2_64(Vtable, 0, AddressPoint);
-
- llvm::Value *VtableField =
- Builder.CreateBitCast(ThisPtr,
- VtableAddressPoint->getType()->getPointerTo());
-
- Builder.CreateStore(VtableAddressPoint, VtableField);
-}
-
-/// EmitDtorEpilogue - Emit all code that comes at the end of class's
-/// destructor. This is to call destructors on members and base classes
-/// in reverse order of their construction.
-/// FIXME: This needs to take a CXXDtorType.
-void CodeGenFunction::EmitDtorEpilogue(const CXXDestructorDecl *DD,
- CXXDtorType DtorType) {
- assert(!DD->isTrivial() &&
- "Should not emit dtor epilogue for trivial dtor!");
-
- const CXXRecordDecl *ClassDecl = DD->getParent();
-
- // Collect the fields.
- llvm::SmallVector<const FieldDecl *, 16> FieldDecls;
- for (CXXRecordDecl::field_iterator I = ClassDecl->field_begin(),
- E = ClassDecl->field_end(); I != E; ++I) {
- const FieldDecl *Field = *I;
-
- QualType FieldType = getContext().getCanonicalType(Field->getType());
- FieldType = getContext().getBaseElementType(FieldType);
-
- const RecordType *RT = FieldType->getAs<RecordType>();
- if (!RT)
- continue;
-
- CXXRecordDecl *FieldClassDecl = cast<CXXRecordDecl>(RT->getDecl());
- if (FieldClassDecl->hasTrivialDestructor())
- continue;
-
- FieldDecls.push_back(Field);
- }
-
- // Now destroy the fields.
- for (size_t i = FieldDecls.size(); i > 0; --i) {
- const FieldDecl *Field = FieldDecls[i - 1];
-
- QualType FieldType = Field->getType();
- const ConstantArrayType *Array =
- getContext().getAsConstantArrayType(FieldType);
- if (Array)
- FieldType = getContext().getBaseElementType(FieldType);
-
- const RecordType *RT = FieldType->getAs<RecordType>();
- CXXRecordDecl *FieldClassDecl = cast<CXXRecordDecl>(RT->getDecl());
-
- llvm::Value *ThisPtr = LoadCXXThis();
-
- LValue LHS = EmitLValueForField(ThisPtr, Field,
- /*isUnion=*/false,
- // FIXME: Qualifiers?
- /*CVRQualifiers=*/0);
- if (Array) {
- const llvm::Type *BasePtr = ConvertType(FieldType);
- BasePtr = llvm::PointerType::getUnqual(BasePtr);
- llvm::Value *BaseAddrPtr =
- Builder.CreateBitCast(LHS.getAddress(), BasePtr);
- EmitCXXAggrDestructorCall(FieldClassDecl->getDestructor(getContext()),
- Array, BaseAddrPtr);
- } else
- EmitCXXDestructorCall(FieldClassDecl->getDestructor(getContext()),
- Dtor_Complete, LHS.getAddress());
- }
-
- // Destroy non-virtual bases.
- for (CXXRecordDecl::reverse_base_class_const_iterator I =
- ClassDecl->bases_rbegin(), E = ClassDecl->bases_rend(); I != E; ++I) {
+ // Store address points for non-virtual bases
+ const ASTRecordLayout &Layout = getContext().getASTRecordLayout(ClassDecl);
+ for (CXXRecordDecl::base_class_const_iterator I =
+ ClassDecl->bases_begin(), E = ClassDecl->bases_end(); I != E; ++I) {
const CXXBaseSpecifier &Base = *I;
-
- // Ignore virtual bases.
if (Base.isVirtual())
continue;
-
CXXRecordDecl *BaseClassDecl
= cast<CXXRecordDecl>(Base.getType()->getAs<RecordType>()->getDecl());
-
- // Ignore trivial destructors.
- if (BaseClassDecl->hasTrivialDestructor())
- continue;
- const CXXDestructorDecl *D = BaseClassDecl->getDestructor(getContext());
-
- llvm::Value *V = GetAddressOfBaseClass(LoadCXXThis(),
- ClassDecl, BaseClassDecl,
- /*NullCheckValue=*/false);
- EmitCXXDestructorCall(D, Dtor_Base, V);
+ uint64_t NewOffset = Offset + Layout.getBaseClassOffset(BaseClassDecl);
+ InitializeVtablePtrsRecursive(BaseClassDecl, Vtable, AddressPoints,
+ ThisPtr, NewOffset);
}
- // If we're emitting a base destructor, we don't want to emit calls to the
- // virtual bases.
- if (DtorType == Dtor_Base)
- return;
-
- // Handle virtual bases.
- for (CXXRecordDecl::reverse_base_class_const_iterator I =
- ClassDecl->vbases_rbegin(), E = ClassDecl->vbases_rend(); I != E; ++I) {
- const CXXBaseSpecifier &Base = *I;
- CXXRecordDecl *BaseClassDecl
- = cast<CXXRecordDecl>(Base.getType()->getAs<RecordType>()->getDecl());
-
- // Ignore trivial destructors.
- if (BaseClassDecl->hasTrivialDestructor())
- continue;
- const CXXDestructorDecl *D = BaseClassDecl->getDestructor(getContext());
- llvm::Value *V = GetAddressOfBaseClass(LoadCXXThis(),
- ClassDecl, BaseClassDecl,
- /*NullCheckValue=*/false);
- EmitCXXDestructorCall(D, Dtor_Base, V);
- }
-
- // If we have a deleting destructor, emit a call to the delete operator.
- if (DtorType == Dtor_Deleting) {
- assert(DD->getOperatorDelete() &&
- "operator delete missing - EmitDtorEpilogue");
- EmitDeleteCall(DD->getOperatorDelete(), LoadCXXThis(),
- getContext().getTagDeclType(ClassDecl));
- }
-}
-
-void CodeGenFunction::SynthesizeDefaultDestructor(const CXXDestructorDecl *Dtor,
- CXXDtorType DtorType,
- llvm::Function *Fn,
- const FunctionArgList &Args) {
- assert(!Dtor->getParent()->hasUserDeclaredDestructor() &&
- "SynthesizeDefaultDestructor - destructor has user declaration");
+ // Compute the address point
+ assert(AddressPoints.count(std::make_pair(ClassDecl, Offset)) &&
+ "Missing address point for class");
+ uint64_t AddressPoint = AddressPoints[std::make_pair(ClassDecl, Offset)];
+ llvm::Value *VtableAddressPoint =
+ Builder.CreateConstInBoundsGEP2_64(Vtable, 0, AddressPoint);
- StartFunction(GlobalDecl(Dtor, DtorType), Dtor->getResultType(), Fn, Args,
- SourceLocation());
+ // Compute the address to store the address point
+ const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGM.getLLVMContext());
+ llvm::Value *VtableField = Builder.CreateBitCast(ThisPtr, Int8PtrTy);
+ VtableField = Builder.CreateConstInBoundsGEP1_64(VtableField, Offset/8);
+ const llvm::Type *AddressPointPtrTy =
+ VtableAddressPoint->getType()->getPointerTo();
+ VtableField = Builder.CreateBitCast(VtableField, AddressPointPtrTy);
- EmitDtorEpilogue(Dtor, DtorType);
- FinishFunction();
+ // Store address point
+ Builder.CreateStore(VtableAddressPoint, VtableField);
}
+
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 4856f5404c1a..2dda0b883f04 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -346,6 +346,7 @@ static llvm::Value *CreateCoercedLoad(llvm::Value *SrcPtr,
/// destination type; the upper bits of the src will be lost.
static void CreateCoercedStore(llvm::Value *Src,
llvm::Value *DstPtr,
+ bool DstIsVolatile,
CodeGenFunction &CGF) {
const llvm::Type *SrcTy = Src->getType();
const llvm::Type *DstTy =
@@ -359,7 +360,7 @@ static void CreateCoercedStore(llvm::Value *Src,
llvm::Value *Casted =
CGF.Builder.CreateBitCast(DstPtr, llvm::PointerType::getUnqual(SrcTy));
// FIXME: Use better alignment / avoid requiring aligned store.
- CGF.Builder.CreateStore(Src, Casted)->setAlignment(1);
+ CGF.Builder.CreateStore(Src, Casted, DstIsVolatile)->setAlignment(1);
} else {
// Otherwise do coercion through memory. This is stupid, but
// simple.
@@ -377,7 +378,7 @@ static void CreateCoercedStore(llvm::Value *Src,
llvm::LoadInst *Load = CGF.Builder.CreateLoad(Casted);
// FIXME: Use better alignment / avoid requiring aligned load.
Load->setAlignment(1);
- CGF.Builder.CreateStore(Load, DstPtr);
+ CGF.Builder.CreateStore(Load, DstPtr, DstIsVolatile);
}
}
@@ -732,7 +733,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
// result in a new alloca anyway, so we could just store into that
// directly if we broke the abstraction down more.
llvm::Value *V = CreateTempAlloca(ConvertTypeForMem(Ty), "coerce");
- CreateCoercedStore(AI, V, *this);
+ CreateCoercedStore(AI, V, /*DestIsVolatile=*/false, *this);
// Match to what EmitParmDecl is expecting for this type.
if (!CodeGenFunction::hasAggregateLLVMType(Ty)) {
V = EmitLoadOfScalar(V, false, Ty);
@@ -809,6 +810,7 @@ RValue CodeGenFunction::EmitCallArg(const Expr *E, QualType ArgType) {
RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
llvm::Value *Callee,
+ ReturnValueSlot ReturnValue,
const CallArgList &CallArgs,
const Decl *TargetDecl) {
// FIXME: We no longer need the types from CallArgs; lift up and simplify.
@@ -821,9 +823,13 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
// If the call returns a temporary with struct return, create a temporary
- // alloca to hold the result.
- if (CGM.ReturnTypeUsesSret(CallInfo))
- Args.push_back(CreateTempAlloca(ConvertTypeForMem(RetTy)));
+ // alloca to hold the result, unless one is given to us.
+ if (CGM.ReturnTypeUsesSret(CallInfo)) {
+ llvm::Value *Value = ReturnValue.getValue();
+ if (!Value)
+ Value = CreateTempAlloca(ConvertTypeForMem(RetTy));
+ Args.push_back(Value);
+ }
assert(CallInfo.arg_size() == CallArgs.size() &&
"Mismatch between function signature & arguments.");
@@ -972,9 +978,15 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
return RValue::getComplex(std::make_pair(Real, Imag));
}
if (CodeGenFunction::hasAggregateLLVMType(RetTy)) {
- llvm::Value *V = CreateTempAlloca(ConvertTypeForMem(RetTy), "agg.tmp");
- Builder.CreateStore(CI, V);
- return RValue::getAggregate(V);
+ llvm::Value *DestPtr = ReturnValue.getValue();
+ bool DestIsVolatile = ReturnValue.isVolatile();
+
+ if (!DestPtr) {
+ DestPtr = CreateTempAlloca(ConvertTypeForMem(RetTy), "agg.tmp");
+ DestIsVolatile = false;
+ }
+ Builder.CreateStore(CI, DestPtr, DestIsVolatile);
+ return RValue::getAggregate(DestPtr);
}
return RValue::get(CI);
@@ -984,14 +996,20 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
return GetUndefRValue(RetTy);
case ABIArgInfo::Coerce: {
- // FIXME: Avoid the conversion through memory if possible.
- llvm::Value *V = CreateTempAlloca(ConvertTypeForMem(RetTy), "coerce");
- CreateCoercedStore(CI, V, *this);
+ llvm::Value *DestPtr = ReturnValue.getValue();
+ bool DestIsVolatile = ReturnValue.isVolatile();
+
+ if (!DestPtr) {
+ DestPtr = CreateTempAlloca(ConvertTypeForMem(RetTy), "coerce");
+ DestIsVolatile = false;
+ }
+
+ CreateCoercedStore(CI, DestPtr, DestIsVolatile, *this);
if (RetTy->isAnyComplexType())
- return RValue::getComplex(LoadComplexFromAddr(V, false));
+ return RValue::getComplex(LoadComplexFromAddr(DestPtr, false));
if (CodeGenFunction::hasAggregateLLVMType(RetTy))
- return RValue::getAggregate(V);
- return RValue::get(EmitLoadOfScalar(V, false, RetTy));
+ return RValue::getAggregate(DestPtr);
+ return RValue::get(EmitLoadOfScalar(DestPtr, false, RetTy));
}
case ABIArgInfo::Expand:
diff --git a/lib/CodeGen/CGCall.h b/lib/CodeGen/CGCall.h
index ebf801dcaad1..427ab5f4cbc8 100644
--- a/lib/CodeGen/CGCall.h
+++ b/lib/CodeGen/CGCall.h
@@ -15,7 +15,8 @@
#ifndef CLANG_CODEGEN_CGCALL_H
#define CLANG_CODEGEN_CGCALL_H
-#include <llvm/ADT/FoldingSet.h>
+#include "llvm/ADT/FoldingSet.h"
+#include "llvm/Value.h"
#include "clang/AST/Type.h"
#include "CGValue.h"
@@ -123,6 +124,23 @@ namespace CodeGen {
begin->Profile(ID);
}
};
+
+ /// ReturnValueSlot - Contains the address where the return value of a
+ /// function can be stored, and whether the address is volatile or not.
+ class ReturnValueSlot {
+ llvm::PointerIntPair<llvm::Value *, 1, bool> Value;
+
+ public:
+ ReturnValueSlot() {}
+ ReturnValueSlot(llvm::Value *Value, bool IsVolatile)
+ : Value(Value, IsVolatile) {}
+
+ bool isNull() const { return !getValue(); }
+
+ bool isVolatile() const { return Value.getInt(); }
+ llvm::Value *getValue() const { return Value.getPointer(); }
+ };
+
} // end namespace CodeGen
} // end namespace clang
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp
index fd2afe70e00e..953b8c89dddd 100644
--- a/lib/CodeGen/CGClass.cpp
+++ b/lib/CodeGen/CGClass.cpp
@@ -269,3 +269,778 @@ CodeGenFunction::GetAddressOfDerivedClass(llvm::Value *Value,
return Value;
}
+
+/// EmitClassAggrMemberwiseCopy - This routine generates code to copy a class
+/// array of objects from SrcValue to DestValue. Copying can be either a bitwise
+/// copy or via a copy constructor call.
+// FIXME. Consolidate this with EmitCXXAggrConstructorCall.
+void CodeGenFunction::EmitClassAggrMemberwiseCopy(llvm::Value *Dest,
+ llvm::Value *Src,
+ const ArrayType *Array,
+ const CXXRecordDecl *BaseClassDecl,
+ QualType Ty) {
+ const ConstantArrayType *CA = dyn_cast<ConstantArrayType>(Array);
+ assert(CA && "VLA cannot be copied over");
+ bool BitwiseCopy = BaseClassDecl->hasTrivialCopyConstructor();
+
+ // Create a temporary for the loop index and initialize it with 0.
+ llvm::Value *IndexPtr = CreateTempAlloca(llvm::Type::getInt64Ty(VMContext),
+ "loop.index");
+ llvm::Value* zeroConstant =
+ llvm::Constant::getNullValue(llvm::Type::getInt64Ty(VMContext));
+ Builder.CreateStore(zeroConstant, IndexPtr);
+ // Start the loop with a block that tests the condition.
+ llvm::BasicBlock *CondBlock = createBasicBlock("for.cond");
+ llvm::BasicBlock *AfterFor = createBasicBlock("for.end");
+
+ EmitBlock(CondBlock);
+
+ llvm::BasicBlock *ForBody = createBasicBlock("for.body");
+ // Generate: if (loop-index < number-of-elements fall to the loop body,
+ // otherwise, go to the block after the for-loop.
+ uint64_t NumElements = getContext().getConstantArrayElementCount(CA);
+ llvm::Value * NumElementsPtr =
+ llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext), NumElements);
+ llvm::Value *Counter = Builder.CreateLoad(IndexPtr);
+ llvm::Value *IsLess = Builder.CreateICmpULT(Counter, NumElementsPtr,
+ "isless");
+ // If the condition is true, execute the body.
+ Builder.CreateCondBr(IsLess, ForBody, AfterFor);
+
+ EmitBlock(ForBody);
+ llvm::BasicBlock *ContinueBlock = createBasicBlock("for.inc");
+ // Inside the loop body, emit the constructor call on the array element.
+ Counter = Builder.CreateLoad(IndexPtr);
+ Src = Builder.CreateInBoundsGEP(Src, Counter, "srcaddress");
+ Dest = Builder.CreateInBoundsGEP(Dest, Counter, "destaddress");
+ if (BitwiseCopy)
+ EmitAggregateCopy(Dest, Src, Ty);
+ else if (CXXConstructorDecl *BaseCopyCtor =
+ BaseClassDecl->getCopyConstructor(getContext(), 0)) {
+ llvm::Value *Callee = CGM.GetAddrOfCXXConstructor(BaseCopyCtor,
+ Ctor_Complete);
+ CallArgList CallArgs;
+ // Push the this (Dest) ptr.
+ CallArgs.push_back(std::make_pair(RValue::get(Dest),
+ BaseCopyCtor->getThisType(getContext())));
+
+ // Push the Src ptr.
+ CallArgs.push_back(std::make_pair(RValue::get(Src),
+ BaseCopyCtor->getParamDecl(0)->getType()));
+ QualType ResultType =
+ BaseCopyCtor->getType()->getAs<FunctionType>()->getResultType();
+ EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
+ Callee, ReturnValueSlot(), CallArgs, BaseCopyCtor);
+ }
+ EmitBlock(ContinueBlock);
+
+ // Emit the increment of the loop counter.
+ llvm::Value *NextVal = llvm::ConstantInt::get(Counter->getType(), 1);
+ Counter = Builder.CreateLoad(IndexPtr);
+ NextVal = Builder.CreateAdd(Counter, NextVal, "inc");
+ Builder.CreateStore(NextVal, IndexPtr);
+
+ // Finally, branch back up to the condition for the next iteration.
+ EmitBranch(CondBlock);
+
+ // Emit the fall-through block.
+ EmitBlock(AfterFor, true);
+}
+
+/// EmitClassAggrCopyAssignment - This routine generates code to assign a class
+/// array of objects from SrcValue to DestValue. Assignment can be either a
+/// bitwise assignment or via a copy assignment operator function call.
+/// FIXME. This can be consolidated with EmitClassAggrMemberwiseCopy
+void CodeGenFunction::EmitClassAggrCopyAssignment(llvm::Value *Dest,
+ llvm::Value *Src,
+ const ArrayType *Array,
+ const CXXRecordDecl *BaseClassDecl,
+ QualType Ty) {
+ const ConstantArrayType *CA = dyn_cast<ConstantArrayType>(Array);
+ assert(CA && "VLA cannot be asssigned");
+ bool BitwiseAssign = BaseClassDecl->hasTrivialCopyAssignment();
+
+ // Create a temporary for the loop index and initialize it with 0.
+ llvm::Value *IndexPtr = CreateTempAlloca(llvm::Type::getInt64Ty(VMContext),
+ "loop.index");
+ llvm::Value* zeroConstant =
+ llvm::Constant::getNullValue(llvm::Type::getInt64Ty(VMContext));
+ Builder.CreateStore(zeroConstant, IndexPtr);
+ // Start the loop with a block that tests the condition.
+ llvm::BasicBlock *CondBlock = createBasicBlock("for.cond");
+ llvm::BasicBlock *AfterFor = createBasicBlock("for.end");
+
+ EmitBlock(CondBlock);
+
+ llvm::BasicBlock *ForBody = createBasicBlock("for.body");
+ // Generate: if (loop-index < number-of-elements fall to the loop body,
+ // otherwise, go to the block after the for-loop.
+ uint64_t NumElements = getContext().getConstantArrayElementCount(CA);
+ llvm::Value * NumElementsPtr =
+ llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext), NumElements);
+ llvm::Value *Counter = Builder.CreateLoad(IndexPtr);
+ llvm::Value *IsLess = Builder.CreateICmpULT(Counter, NumElementsPtr,
+ "isless");
+ // If the condition is true, execute the body.
+ Builder.CreateCondBr(IsLess, ForBody, AfterFor);
+
+ EmitBlock(ForBody);
+ llvm::BasicBlock *ContinueBlock = createBasicBlock("for.inc");
+ // Inside the loop body, emit the assignment operator call on array element.
+ Counter = Builder.CreateLoad(IndexPtr);
+ Src = Builder.CreateInBoundsGEP(Src, Counter, "srcaddress");
+ Dest = Builder.CreateInBoundsGEP(Dest, Counter, "destaddress");
+ const CXXMethodDecl *MD = 0;
+ if (BitwiseAssign)
+ EmitAggregateCopy(Dest, Src, Ty);
+ else {
+ bool hasCopyAssign = BaseClassDecl->hasConstCopyAssignment(getContext(),
+ MD);
+ assert(hasCopyAssign && "EmitClassAggrCopyAssignment - No user assign");
+ (void)hasCopyAssign;
+ const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
+ const llvm::Type *LTy =
+ CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD),
+ FPT->isVariadic());
+ llvm::Constant *Callee = CGM.GetAddrOfFunction(MD, LTy);
+
+ CallArgList CallArgs;
+ // Push the this (Dest) ptr.
+ CallArgs.push_back(std::make_pair(RValue::get(Dest),
+ MD->getThisType(getContext())));
+
+ // Push the Src ptr.
+ CallArgs.push_back(std::make_pair(RValue::get(Src),
+ MD->getParamDecl(0)->getType()));
+ QualType ResultType = MD->getType()->getAs<FunctionType>()->getResultType();
+ EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
+ Callee, ReturnValueSlot(), CallArgs, MD);
+ }
+ EmitBlock(ContinueBlock);
+
+ // Emit the increment of the loop counter.
+ llvm::Value *NextVal = llvm::ConstantInt::get(Counter->getType(), 1);
+ Counter = Builder.CreateLoad(IndexPtr);
+ NextVal = Builder.CreateAdd(Counter, NextVal, "inc");
+ Builder.CreateStore(NextVal, IndexPtr);
+
+ // Finally, branch back up to the condition for the next iteration.
+ EmitBranch(CondBlock);
+
+ // Emit the fall-through block.
+ EmitBlock(AfterFor, true);
+}
+
+/// EmitClassMemberwiseCopy - This routine generates code to copy a class
+/// object from SrcValue to DestValue. Copying can be either a bitwise copy
+/// or via a copy constructor call.
+void CodeGenFunction::EmitClassMemberwiseCopy(
+ llvm::Value *Dest, llvm::Value *Src,
+ const CXXRecordDecl *ClassDecl,
+ const CXXRecordDecl *BaseClassDecl, QualType Ty) {
+ if (ClassDecl) {
+ Dest = GetAddressOfBaseClass(Dest, ClassDecl, BaseClassDecl,
+ /*NullCheckValue=*/false);
+ Src = GetAddressOfBaseClass(Src, ClassDecl, BaseClassDecl,
+ /*NullCheckValue=*/false);
+ }
+ if (BaseClassDecl->hasTrivialCopyConstructor()) {
+ EmitAggregateCopy(Dest, Src, Ty);
+ return;
+ }
+
+ if (CXXConstructorDecl *BaseCopyCtor =
+ BaseClassDecl->getCopyConstructor(getContext(), 0)) {
+ llvm::Value *Callee = CGM.GetAddrOfCXXConstructor(BaseCopyCtor,
+ Ctor_Complete);
+ CallArgList CallArgs;
+ // Push the this (Dest) ptr.
+ CallArgs.push_back(std::make_pair(RValue::get(Dest),
+ BaseCopyCtor->getThisType(getContext())));
+
+ // Push the Src ptr.
+ CallArgs.push_back(std::make_pair(RValue::get(Src),
+ BaseCopyCtor->getParamDecl(0)->getType()));
+ QualType ResultType =
+ BaseCopyCtor->getType()->getAs<FunctionType>()->getResultType();
+ EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
+ Callee, ReturnValueSlot(), CallArgs, BaseCopyCtor);
+ }
+}
+
+/// EmitClassCopyAssignment - This routine generates code to copy assign a class
+/// object from SrcValue to DestValue. Assignment can be either a bitwise
+/// assignment of via an assignment operator call.
+// FIXME. Consolidate this with EmitClassMemberwiseCopy as they share a lot.
+void CodeGenFunction::EmitClassCopyAssignment(
+ llvm::Value *Dest, llvm::Value *Src,
+ const CXXRecordDecl *ClassDecl,
+ const CXXRecordDecl *BaseClassDecl,
+ QualType Ty) {
+ if (ClassDecl) {
+ Dest = GetAddressOfBaseClass(Dest, ClassDecl, BaseClassDecl,
+ /*NullCheckValue=*/false);
+ Src = GetAddressOfBaseClass(Src, ClassDecl, BaseClassDecl,
+ /*NullCheckValue=*/false);
+ }
+ if (BaseClassDecl->hasTrivialCopyAssignment()) {
+ EmitAggregateCopy(Dest, Src, Ty);
+ return;
+ }
+
+ const CXXMethodDecl *MD = 0;
+ bool ConstCopyAssignOp = BaseClassDecl->hasConstCopyAssignment(getContext(),
+ MD);
+ assert(ConstCopyAssignOp && "EmitClassCopyAssignment - missing copy assign");
+ (void)ConstCopyAssignOp;
+
+ const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
+ const llvm::Type *LTy =
+ CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD),
+ FPT->isVariadic());
+ llvm::Constant *Callee = CGM.GetAddrOfFunction(MD, LTy);
+
+ CallArgList CallArgs;
+ // Push the this (Dest) ptr.
+ CallArgs.push_back(std::make_pair(RValue::get(Dest),
+ MD->getThisType(getContext())));
+
+ // Push the Src ptr.
+ CallArgs.push_back(std::make_pair(RValue::get(Src),
+ MD->getParamDecl(0)->getType()));
+ QualType ResultType =
+ MD->getType()->getAs<FunctionType>()->getResultType();
+ EmitCall(CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
+ Callee, ReturnValueSlot(), CallArgs, MD);
+}
+
+/// SynthesizeDefaultConstructor - synthesize a default constructor
+void
+CodeGenFunction::SynthesizeDefaultConstructor(const CXXConstructorDecl *Ctor,
+ CXXCtorType Type,
+ llvm::Function *Fn,
+ const FunctionArgList &Args) {
+ assert(!Ctor->isTrivial() && "shouldn't need to generate trivial ctor");
+ StartFunction(GlobalDecl(Ctor, Type), Ctor->getResultType(), Fn, Args,
+ SourceLocation());
+ EmitCtorPrologue(Ctor, Type);
+ FinishFunction();
+}
+
+/// SynthesizeCXXCopyConstructor - This routine implicitly defines body of a
+/// copy constructor, in accordance with section 12.8 (p7 and p8) of C++03
+/// The implicitly-defined copy constructor for class X performs a memberwise
+/// copy of its subobjects. The order of copying is the same as the order of
+/// initialization of bases and members in a user-defined constructor
+/// Each subobject is copied in the manner appropriate to its type:
+/// if the subobject is of class type, the copy constructor for the class is
+/// used;
+/// if the subobject is an array, each element is copied, in the manner
+/// appropriate to the element type;
+/// if the subobject is of scalar type, the built-in assignment operator is
+/// used.
+/// Virtual base class subobjects shall be copied only once by the
+/// implicitly-defined copy constructor
+
+void
+CodeGenFunction::SynthesizeCXXCopyConstructor(const CXXConstructorDecl *Ctor,
+ CXXCtorType Type,
+ llvm::Function *Fn,
+ const FunctionArgList &Args) {
+ const CXXRecordDecl *ClassDecl = Ctor->getParent();
+ assert(!ClassDecl->hasUserDeclaredCopyConstructor() &&
+ "SynthesizeCXXCopyConstructor - copy constructor has definition already");
+ assert(!Ctor->isTrivial() && "shouldn't need to generate trivial ctor");
+ StartFunction(GlobalDecl(Ctor, Type), Ctor->getResultType(), Fn, Args,
+ SourceLocation());
+
+ FunctionArgList::const_iterator i = Args.begin();
+ const VarDecl *ThisArg = i->first;
+ llvm::Value *ThisObj = GetAddrOfLocalVar(ThisArg);
+ llvm::Value *LoadOfThis = Builder.CreateLoad(ThisObj, "this");
+ const VarDecl *SrcArg = (i+1)->first;
+ llvm::Value *SrcObj = GetAddrOfLocalVar(SrcArg);
+ llvm::Value *LoadOfSrc = Builder.CreateLoad(SrcObj);
+
+ for (CXXRecordDecl::base_class_const_iterator Base = ClassDecl->bases_begin();
+ Base != ClassDecl->bases_end(); ++Base) {
+ // FIXME. copy constrution of virtual base NYI
+ if (Base->isVirtual())
+ continue;
+
+ CXXRecordDecl *BaseClassDecl
+ = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+ EmitClassMemberwiseCopy(LoadOfThis, LoadOfSrc, ClassDecl, BaseClassDecl,
+ Base->getType());
+ }
+
+ for (CXXRecordDecl::field_iterator I = ClassDecl->field_begin(),
+ E = ClassDecl->field_end(); I != E; ++I) {
+ const FieldDecl *Field = *I;
+
+ QualType FieldType = getContext().getCanonicalType(Field->getType());
+ const ConstantArrayType *Array =
+ getContext().getAsConstantArrayType(FieldType);
+ if (Array)
+ FieldType = getContext().getBaseElementType(FieldType);
+
+ if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
+ CXXRecordDecl *FieldClassDecl
+ = cast<CXXRecordDecl>(FieldClassType->getDecl());
+ LValue LHS = EmitLValueForField(LoadOfThis, Field, false, 0);
+ LValue RHS = EmitLValueForField(LoadOfSrc, Field, false, 0);
+ if (Array) {
+ const llvm::Type *BasePtr = ConvertType(FieldType);
+ BasePtr = llvm::PointerType::getUnqual(BasePtr);
+ llvm::Value *DestBaseAddrPtr =
+ Builder.CreateBitCast(LHS.getAddress(), BasePtr);
+ llvm::Value *SrcBaseAddrPtr =
+ Builder.CreateBitCast(RHS.getAddress(), BasePtr);
+ EmitClassAggrMemberwiseCopy(DestBaseAddrPtr, SrcBaseAddrPtr, Array,
+ FieldClassDecl, FieldType);
+ }
+ else
+ EmitClassMemberwiseCopy(LHS.getAddress(), RHS.getAddress(),
+ 0 /*ClassDecl*/, FieldClassDecl, FieldType);
+ continue;
+ }
+
+ if (Field->getType()->isReferenceType()) {
+ unsigned FieldIndex = CGM.getTypes().getLLVMFieldNo(Field);
+
+ llvm::Value *LHS = Builder.CreateStructGEP(LoadOfThis, FieldIndex,
+ "lhs.ref");
+
+ llvm::Value *RHS = Builder.CreateStructGEP(LoadOfThis, FieldIndex,
+ "rhs.ref");
+
+ // Load the value in RHS.
+ RHS = Builder.CreateLoad(RHS);
+
+ // And store it in the LHS
+ Builder.CreateStore(RHS, LHS);
+
+ continue;
+ }
+ // Do a built-in assignment of scalar data members.
+ LValue LHS = EmitLValueForField(LoadOfThis, Field, false, 0);
+ LValue RHS = EmitLValueForField(LoadOfSrc, Field, false, 0);
+
+ if (!hasAggregateLLVMType(Field->getType())) {
+ RValue RVRHS = EmitLoadOfLValue(RHS, Field->getType());
+ EmitStoreThroughLValue(RVRHS, LHS, Field->getType());
+ } else if (Field->getType()->isAnyComplexType()) {
+ ComplexPairTy Pair = LoadComplexFromAddr(RHS.getAddress(),
+ RHS.isVolatileQualified());
+ StoreComplexToAddr(Pair, LHS.getAddress(), LHS.isVolatileQualified());
+ } else {
+ EmitAggregateCopy(LHS.getAddress(), RHS.getAddress(), Field->getType());
+ }
+ }
+
+ InitializeVtablePtrs(ClassDecl);
+ FinishFunction();
+}
+
+/// SynthesizeCXXCopyAssignment - Implicitly define copy assignment operator.
+/// Before the implicitly-declared copy assignment operator for a class is
+/// implicitly defined, all implicitly- declared copy assignment operators for
+/// its direct base classes and its nonstatic data members shall have been
+/// implicitly defined. [12.8-p12]
+/// The implicitly-defined copy assignment operator for class X performs
+/// memberwise assignment of its subob- jects. The direct base classes of X are
+/// assigned first, in the order of their declaration in
+/// the base-specifier-list, and then the immediate nonstatic data members of X
+/// are assigned, in the order in which they were declared in the class
+/// definition.Each subobject is assigned in the manner appropriate to its type:
+/// if the subobject is of class type, the copy assignment operator for the
+/// class is used (as if by explicit qualification; that is, ignoring any
+/// possible virtual overriding functions in more derived classes);
+///
+/// if the subobject is an array, each element is assigned, in the manner
+/// appropriate to the element type;
+///
+/// if the subobject is of scalar type, the built-in assignment operator is
+/// used.
+void CodeGenFunction::SynthesizeCXXCopyAssignment(const CXXMethodDecl *CD,
+ llvm::Function *Fn,
+ const FunctionArgList &Args) {
+
+ const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(CD->getDeclContext());
+ assert(!ClassDecl->hasUserDeclaredCopyAssignment() &&
+ "SynthesizeCXXCopyAssignment - copy assignment has user declaration");
+ StartFunction(CD, CD->getResultType(), Fn, Args, SourceLocation());
+
+ FunctionArgList::const_iterator i = Args.begin();
+ const VarDecl *ThisArg = i->first;
+ llvm::Value *ThisObj = GetAddrOfLocalVar(ThisArg);
+ llvm::Value *LoadOfThis = Builder.CreateLoad(ThisObj, "this");
+ const VarDecl *SrcArg = (i+1)->first;
+ llvm::Value *SrcObj = GetAddrOfLocalVar(SrcArg);
+ llvm::Value *LoadOfSrc = Builder.CreateLoad(SrcObj);
+
+ for (CXXRecordDecl::base_class_const_iterator Base = ClassDecl->bases_begin();
+ Base != ClassDecl->bases_end(); ++Base) {
+ // FIXME. copy assignment of virtual base NYI
+ if (Base->isVirtual())
+ continue;
+
+ CXXRecordDecl *BaseClassDecl
+ = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+ EmitClassCopyAssignment(LoadOfThis, LoadOfSrc, ClassDecl, BaseClassDecl,
+ Base->getType());
+ }
+
+ for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
+ FieldEnd = ClassDecl->field_end();
+ Field != FieldEnd; ++Field) {
+ QualType FieldType = getContext().getCanonicalType((*Field)->getType());
+ const ConstantArrayType *Array =
+ getContext().getAsConstantArrayType(FieldType);
+ if (Array)
+ FieldType = getContext().getBaseElementType(FieldType);
+
+ if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
+ CXXRecordDecl *FieldClassDecl
+ = cast<CXXRecordDecl>(FieldClassType->getDecl());
+ LValue LHS = EmitLValueForField(LoadOfThis, *Field, false, 0);
+ LValue RHS = EmitLValueForField(LoadOfSrc, *Field, false, 0);
+ if (Array) {
+ const llvm::Type *BasePtr = ConvertType(FieldType);
+ BasePtr = llvm::PointerType::getUnqual(BasePtr);
+ llvm::Value *DestBaseAddrPtr =
+ Builder.CreateBitCast(LHS.getAddress(), BasePtr);
+ llvm::Value *SrcBaseAddrPtr =
+ Builder.CreateBitCast(RHS.getAddress(), BasePtr);
+ EmitClassAggrCopyAssignment(DestBaseAddrPtr, SrcBaseAddrPtr, Array,
+ FieldClassDecl, FieldType);
+ }
+ else
+ EmitClassCopyAssignment(LHS.getAddress(), RHS.getAddress(),
+ 0 /*ClassDecl*/, FieldClassDecl, FieldType);
+ continue;
+ }
+ // Do a built-in assignment of scalar data members.
+ LValue LHS = EmitLValueForField(LoadOfThis, *Field, false, 0);
+ LValue RHS = EmitLValueForField(LoadOfSrc, *Field, false, 0);
+ if (!hasAggregateLLVMType(Field->getType())) {
+ RValue RVRHS = EmitLoadOfLValue(RHS, Field->getType());
+ EmitStoreThroughLValue(RVRHS, LHS, Field->getType());
+ } else if (Field->getType()->isAnyComplexType()) {
+ ComplexPairTy Pair = LoadComplexFromAddr(RHS.getAddress(),
+ RHS.isVolatileQualified());
+ StoreComplexToAddr(Pair, LHS.getAddress(), LHS.isVolatileQualified());
+ } else {
+ EmitAggregateCopy(LHS.getAddress(), RHS.getAddress(), Field->getType());
+ }
+ }
+
+ // return *this;
+ Builder.CreateStore(LoadOfThis, ReturnValue);
+
+ FinishFunction();
+}
+
+static void EmitBaseInitializer(CodeGenFunction &CGF,
+ const CXXRecordDecl *ClassDecl,
+ CXXBaseOrMemberInitializer *BaseInit,
+ CXXCtorType CtorType) {
+ assert(BaseInit->isBaseInitializer() &&
+ "Must have base initializer!");
+
+ llvm::Value *ThisPtr = CGF.LoadCXXThis();
+
+ const Type *BaseType = BaseInit->getBaseClass();
+ CXXRecordDecl *BaseClassDecl =
+ cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl());
+
+ // FIXME: This method of determining whether a base is virtual is ridiculous;
+ // it should be part of BaseInit.
+ bool isBaseVirtual = false;
+ for (CXXRecordDecl::base_class_const_iterator I = ClassDecl->vbases_begin(),
+ E = ClassDecl->vbases_end(); I != E; ++I)
+ if (I->getType()->getAs<RecordType>()->getDecl() == BaseClassDecl) {
+ isBaseVirtual = true;
+ break;
+ }
+
+ // The base constructor doesn't construct virtual bases.
+ if (CtorType == Ctor_Base && isBaseVirtual)
+ return;
+
+ // Compute the offset to the base; we do this directly instead of using
+ // GetAddressOfBaseClass because the class doesn't have a vtable pointer
+ // at this point.
+ // FIXME: This could be refactored back into GetAddressOfBaseClass if it took
+ // an extra parameter for whether the derived class is the complete object
+ // class.
+ const ASTRecordLayout &Layout =
+ CGF.getContext().getASTRecordLayout(ClassDecl);
+ uint64_t Offset;
+ if (isBaseVirtual)
+ Offset = Layout.getVBaseClassOffset(BaseClassDecl);
+ else
+ Offset = Layout.getBaseClassOffset(BaseClassDecl);
+ const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
+ const llvm::Type *BaseClassType = CGF.ConvertType(QualType(BaseType, 0));
+ llvm::Value *V = CGF.Builder.CreateBitCast(ThisPtr, Int8PtrTy);
+ V = CGF.Builder.CreateConstInBoundsGEP1_64(V, Offset/8);
+ V = CGF.Builder.CreateBitCast(V, BaseClassType->getPointerTo());
+
+ // FIXME: This should always use Ctor_Base as the ctor type! (But that
+ // causes crashes in tests.)
+ CGF.EmitCXXConstructorCall(BaseInit->getConstructor(),
+ CtorType, V,
+ BaseInit->const_arg_begin(),
+ BaseInit->const_arg_end());
+}
+
+static void EmitMemberInitializer(CodeGenFunction &CGF,
+ const CXXRecordDecl *ClassDecl,
+ CXXBaseOrMemberInitializer *MemberInit) {
+ assert(MemberInit->isMemberInitializer() &&
+ "Must have member initializer!");
+
+ // non-static data member initializers.
+ FieldDecl *Field = MemberInit->getMember();
+ QualType FieldType = CGF.getContext().getCanonicalType(Field->getType());
+
+ llvm::Value *ThisPtr = CGF.LoadCXXThis();
+ LValue LHS;
+ if (FieldType->isReferenceType()) {
+ // FIXME: This is really ugly; should be refactored somehow
+ unsigned idx = CGF.CGM.getTypes().getLLVMFieldNo(Field);
+ llvm::Value *V = CGF.Builder.CreateStructGEP(ThisPtr, idx, "tmp");
+ assert(!FieldType.getObjCGCAttr() && "fields cannot have GC attrs");
+ LHS = LValue::MakeAddr(V, CGF.MakeQualifiers(FieldType));
+ } else {
+ LHS = CGF.EmitLValueForField(ThisPtr, Field, ClassDecl->isUnion(), 0);
+ }
+
+ // If we are initializing an anonymous union field, drill down to the field.
+ if (MemberInit->getAnonUnionMember()) {
+ Field = MemberInit->getAnonUnionMember();
+ LHS = CGF.EmitLValueForField(LHS.getAddress(), Field,
+ /*IsUnion=*/true, 0);
+ FieldType = Field->getType();
+ }
+
+ // If the field is an array, branch based on the element type.
+ const ConstantArrayType *Array =
+ CGF.getContext().getAsConstantArrayType(FieldType);
+ if (Array)
+ FieldType = CGF.getContext().getBaseElementType(FieldType);
+
+ // We lose the constructor for anonymous union members, so handle them
+ // explicitly.
+ // FIXME: This is somwhat ugly.
+ if (MemberInit->getAnonUnionMember() && FieldType->getAs<RecordType>()) {
+ if (MemberInit->getNumArgs())
+ CGF.EmitAggExpr(*MemberInit->arg_begin(), LHS.getAddress(),
+ LHS.isVolatileQualified());
+ else
+ CGF.EmitAggregateClear(LHS.getAddress(), Field->getType());
+ return;
+ }
+
+ if (FieldType->getAs<RecordType>()) {
+ assert(MemberInit->getConstructor() &&
+ "EmitCtorPrologue - no constructor to initialize member");
+ if (Array) {
+ const llvm::Type *BasePtr = CGF.ConvertType(FieldType);
+ BasePtr = llvm::PointerType::getUnqual(BasePtr);
+ llvm::Value *BaseAddrPtr =
+ CGF.Builder.CreateBitCast(LHS.getAddress(), BasePtr);
+ CGF.EmitCXXAggrConstructorCall(MemberInit->getConstructor(),
+ Array, BaseAddrPtr,
+ MemberInit->const_arg_begin(),
+ MemberInit->const_arg_end());
+ }
+ else
+ CGF.EmitCXXConstructorCall(MemberInit->getConstructor(),
+ Ctor_Complete, LHS.getAddress(),
+ MemberInit->const_arg_begin(),
+ MemberInit->const_arg_end());
+ return;
+ }
+
+ assert(MemberInit->getNumArgs() == 1 && "Initializer count must be 1 only");
+ Expr *RhsExpr = *MemberInit->arg_begin();
+ RValue RHS;
+ if (FieldType->isReferenceType()) {
+ RHS = CGF.EmitReferenceBindingToExpr(RhsExpr, FieldType,
+ /*IsInitializer=*/true);
+ CGF.EmitStoreThroughLValue(RHS, LHS, FieldType);
+ } else if (Array) {
+ CGF.EmitMemSetToZero(LHS.getAddress(), Field->getType());
+ } else if (!CGF.hasAggregateLLVMType(RhsExpr->getType())) {
+ RHS = RValue::get(CGF.EmitScalarExpr(RhsExpr, true));
+ CGF.EmitStoreThroughLValue(RHS, LHS, FieldType);
+ } else if (RhsExpr->getType()->isAnyComplexType()) {
+ CGF.EmitComplexExprIntoAddr(RhsExpr, LHS.getAddress(),
+ LHS.isVolatileQualified());
+ } else {
+ // Handle member function pointers; other aggregates shouldn't get this far.
+ CGF.EmitAggExpr(RhsExpr, LHS.getAddress(), LHS.isVolatileQualified());
+ }
+}
+
+/// EmitCtorPrologue - This routine generates necessary code to initialize
+/// base classes and non-static data members belonging to this constructor.
+/// FIXME: This needs to take a CXXCtorType.
+void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD,
+ CXXCtorType CtorType) {
+ const CXXRecordDecl *ClassDecl = CD->getParent();
+
+ // FIXME: Add vbase initialization
+
+ for (CXXConstructorDecl::init_const_iterator B = CD->init_begin(),
+ E = CD->init_end();
+ B != E; ++B) {
+ CXXBaseOrMemberInitializer *Member = (*B);
+
+ assert(LiveTemporaries.empty() &&
+ "Should not have any live temporaries at initializer start!");
+
+ if (Member->isBaseInitializer())
+ EmitBaseInitializer(*this, ClassDecl, Member, CtorType);
+ else
+ EmitMemberInitializer(*this, ClassDecl, Member);
+
+ // Pop any live temporaries that the initializers might have pushed.
+ while (!LiveTemporaries.empty())
+ PopCXXTemporary();
+ }
+
+ InitializeVtablePtrs(ClassDecl);
+}
+
+/// EmitDtorEpilogue - Emit all code that comes at the end of class's
+/// destructor. This is to call destructors on members and base classes
+/// in reverse order of their construction.
+/// FIXME: This needs to take a CXXDtorType.
+void CodeGenFunction::EmitDtorEpilogue(const CXXDestructorDecl *DD,
+ CXXDtorType DtorType) {
+ assert(!DD->isTrivial() &&
+ "Should not emit dtor epilogue for trivial dtor!");
+
+ const CXXRecordDecl *ClassDecl = DD->getParent();
+
+ // Collect the fields.
+ llvm::SmallVector<const FieldDecl *, 16> FieldDecls;
+ for (CXXRecordDecl::field_iterator I = ClassDecl->field_begin(),
+ E = ClassDecl->field_end(); I != E; ++I) {
+ const FieldDecl *Field = *I;
+
+ QualType FieldType = getContext().getCanonicalType(Field->getType());
+ FieldType = getContext().getBaseElementType(FieldType);
+
+ const RecordType *RT = FieldType->getAs<RecordType>();
+ if (!RT)
+ continue;
+
+ CXXRecordDecl *FieldClassDecl = cast<CXXRecordDecl>(RT->getDecl());
+ if (FieldClassDecl->hasTrivialDestructor())
+ continue;
+
+ FieldDecls.push_back(Field);
+ }
+
+ // Now destroy the fields.
+ for (size_t i = FieldDecls.size(); i > 0; --i) {
+ const FieldDecl *Field = FieldDecls[i - 1];
+
+ QualType FieldType = Field->getType();
+ const ConstantArrayType *Array =
+ getContext().getAsConstantArrayType(FieldType);
+ if (Array)
+ FieldType = getContext().getBaseElementType(FieldType);
+
+ const RecordType *RT = FieldType->getAs<RecordType>();
+ CXXRecordDecl *FieldClassDecl = cast<CXXRecordDecl>(RT->getDecl());
+
+ llvm::Value *ThisPtr = LoadCXXThis();
+
+ LValue LHS = EmitLValueForField(ThisPtr, Field,
+ /*isUnion=*/false,
+ // FIXME: Qualifiers?
+ /*CVRQualifiers=*/0);
+ if (Array) {
+ const llvm::Type *BasePtr = ConvertType(FieldType);
+ BasePtr = llvm::PointerType::getUnqual(BasePtr);
+ llvm::Value *BaseAddrPtr =
+ Builder.CreateBitCast(LHS.getAddress(), BasePtr);
+ EmitCXXAggrDestructorCall(FieldClassDecl->getDestructor(getContext()),
+ Array, BaseAddrPtr);
+ } else
+ EmitCXXDestructorCall(FieldClassDecl->getDestructor(getContext()),
+ Dtor_Complete, LHS.getAddress());
+ }
+
+ // Destroy non-virtual bases.
+ for (CXXRecordDecl::reverse_base_class_const_iterator I =
+ ClassDecl->bases_rbegin(), E = ClassDecl->bases_rend(); I != E; ++I) {
+ const CXXBaseSpecifier &Base = *I;
+
+ // Ignore virtual bases.
+ if (Base.isVirtual())
+ continue;
+
+ CXXRecordDecl *BaseClassDecl
+ = cast<CXXRecordDecl>(Base.getType()->getAs<RecordType>()->getDecl());
+
+ // Ignore trivial destructors.
+ if (BaseClassDecl->hasTrivialDestructor())
+ continue;
+ const CXXDestructorDecl *D = BaseClassDecl->getDestructor(getContext());
+
+ llvm::Value *V = GetAddressOfBaseClass(LoadCXXThis(),
+ ClassDecl, BaseClassDecl,
+ /*NullCheckValue=*/false);
+ EmitCXXDestructorCall(D, Dtor_Base, V);
+ }
+
+ // If we're emitting a base destructor, we don't want to emit calls to the
+ // virtual bases.
+ if (DtorType == Dtor_Base)
+ return;
+
+ // Handle virtual bases.
+ for (CXXRecordDecl::reverse_base_class_const_iterator I =
+ ClassDecl->vbases_rbegin(), E = ClassDecl->vbases_rend(); I != E; ++I) {
+ const CXXBaseSpecifier &Base = *I;
+ CXXRecordDecl *BaseClassDecl
+ = cast<CXXRecordDecl>(Base.getType()->getAs<RecordType>()->getDecl());
+
+ // Ignore trivial destructors.
+ if (BaseClassDecl->hasTrivialDestructor())
+ continue;
+ const CXXDestructorDecl *D = BaseClassDecl->getDestructor(getContext());
+ llvm::Value *V = GetAddressOfBaseClass(LoadCXXThis(),
+ ClassDecl, BaseClassDecl,
+ /*NullCheckValue=*/false);
+ EmitCXXDestructorCall(D, Dtor_Base, V);
+ }
+
+ // If we have a deleting destructor, emit a call to the delete operator.
+ if (DtorType == Dtor_Deleting) {
+ assert(DD->getOperatorDelete() &&
+ "operator delete missing - EmitDtorEpilogue");
+ EmitDeleteCall(DD->getOperatorDelete(), LoadCXXThis(),
+ getContext().getTagDeclType(ClassDecl));
+ }
+}
+
+void CodeGenFunction::SynthesizeDefaultDestructor(const CXXDestructorDecl *Dtor,
+ CXXDtorType DtorType,
+ llvm::Function *Fn,
+ const FunctionArgList &Args) {
+ assert(!Dtor->getParent()->hasUserDeclaredDestructor() &&
+ "SynthesizeDefaultDestructor - destructor has user declaration");
+
+ StartFunction(GlobalDecl(Dtor, DtorType), Dtor->getResultType(), Fn, Args,
+ SourceLocation());
+
+ EmitDtorEpilogue(Dtor, DtorType);
+ FinishFunction();
+}
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 2238c89f8357..19695c87817e 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -123,8 +123,6 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) {
CLANG_VENDOR
#endif
"clang " CLANG_VERSION_STRING;
- bool isOptimized = LO.Optimize;
- const char *Flags = ""; // FIXME: Encode command line options.
// Figure out which version of the ObjC runtime we have.
unsigned RuntimeVers = 0;
@@ -132,11 +130,9 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) {
RuntimeVers = LO.ObjCNonFragileABI ? 2 : 1;
// Create new compile unit.
- return Unit = DebugFactory.CreateCompileUnit(LangTag,
- AbsFileName.getLast(),
- AbsFileName.getDirname(),
- Producer, isMain,
- isOptimized, Flags, RuntimeVers);
+ return Unit = DebugFactory.CreateCompileUnit(
+ LangTag, AbsFileName.getLast(), AbsFileName.getDirname(), Producer, isMain,
+ LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers);
}
/// CreateType - Get the Basic type from the cache or create a new
@@ -834,27 +830,43 @@ llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty,
0, 0, 0, llvm::DIType(), Elements);
}
-static QualType CanonicalizeTypeForDebugInfo(QualType T) {
- switch (T->getTypeClass()) {
- default:
- return T;
- case Type::TemplateSpecialization:
- return cast<TemplateSpecializationType>(T)->desugar();
- case Type::TypeOfExpr: {
- TypeOfExprType *Ty = cast<TypeOfExprType>(T);
- return CanonicalizeTypeForDebugInfo(Ty->getUnderlyingExpr()->getType());
- }
- case Type::TypeOf:
- return cast<TypeOfType>(T)->getUnderlyingType();
- case Type::Decltype:
- return cast<DecltypeType>(T)->getUnderlyingType();
- case Type::QualifiedName:
- return cast<QualifiedNameType>(T)->getNamedType();
- case Type::SubstTemplateTypeParm:
- return cast<SubstTemplateTypeParmType>(T)->getReplacementType();
- case Type::Elaborated:
- return cast<ElaboratedType>(T)->getUnderlyingType();
- }
+static QualType UnwrapTypeForDebugInfo(QualType T) {
+ do {
+ QualType LastT = T;
+ switch (T->getTypeClass()) {
+ default:
+ return T;
+ case Type::TemplateSpecialization:
+ T = cast<TemplateSpecializationType>(T)->desugar();
+ break;
+ case Type::TypeOfExpr: {
+ TypeOfExprType *Ty = cast<TypeOfExprType>(T);
+ T = Ty->getUnderlyingExpr()->getType();
+ break;
+ }
+ case Type::TypeOf:
+ T = cast<TypeOfType>(T)->getUnderlyingType();
+ break;
+ case Type::Decltype:
+ T = cast<DecltypeType>(T)->getUnderlyingType();
+ break;
+ case Type::QualifiedName:
+ T = cast<QualifiedNameType>(T)->getNamedType();
+ break;
+ case Type::SubstTemplateTypeParm:
+ T = cast<SubstTemplateTypeParmType>(T)->getReplacementType();
+ break;
+ case Type::Elaborated:
+ T = cast<ElaboratedType>(T)->getUnderlyingType();
+ break;
+ }
+
+ assert(T != LastT && "Type unwrapping failed to unwrap!");
+ if (T == LastT)
+ return T;
+ } while (true);
+
+ return T;
}
/// getOrCreateType - Get the type from the cache or create a new
@@ -864,8 +876,8 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty,
if (Ty.isNull())
return llvm::DIType();
- // Canonicalize the type.
- Ty = CanonicalizeTypeForDebugInfo(Ty);
+ // Unwrap the type as needed for debug information.
+ Ty = UnwrapTypeForDebugInfo(Ty);
// Check for existing entry.
std::map<void *, llvm::WeakVH>::iterator it =
@@ -891,6 +903,8 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty,
if (Ty.hasLocalQualifiers())
return CreateQualifiedType(Ty, Unit);
+ const char *Diag = 0;
+
// Work out details of type.
switch (Ty->getTypeClass()) {
#define TYPE(Class, Base)
@@ -903,11 +917,8 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty,
// FIXME: Handle these.
case Type::ExtVector:
case Type::Vector:
- case Type::FixedWidthInt:
- return llvm::DIType();
- default:
- assert(false && "Unhandled type class!");
return llvm::DIType();
+
case Type::ObjCObjectPointer:
return CreateType(cast<ObjCObjectPointerType>(Ty), Unit);
case Type::ObjCInterface:
@@ -934,7 +945,29 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty,
case Type::MemberPointer:
return CreateType(cast<MemberPointerType>(Ty), Unit);
+
+ case Type::TemplateSpecialization:
+ case Type::Elaborated:
+ case Type::QualifiedName:
+ case Type::SubstTemplateTypeParm:
+ case Type::TypeOfExpr:
+ case Type::TypeOf:
+ case Type::Decltype:
+ llvm_unreachable("type should have been unwrapped!");
+ return llvm::DIType();
+
+ case Type::RValueReference:
+ // FIXME: Implement!
+ Diag = "rvalue references";
+ break;
}
+
+ assert(Diag && "Fall through without a diagnostic?");
+ unsigned DiagID = CGM.getDiags().getCustomDiagID(Diagnostic::Error,
+ "debug information for %0 is not yet supported");
+ CGM.getDiags().Report(FullSourceLoc(), DiagID)
+ << Diag;
+ return llvm::DIType();
}
/// EmitFunctionStart - Constructs the debug code for entering a function -
@@ -1067,7 +1100,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag,
EltTys.push_back(FieldTy);
FieldOffset += FieldSize;
- FType = CGM.getContext().getFixedWidthIntType(32, true); // Int32Ty;
+ FType = CGM.getContext().IntTy;
FieldTy = CGDebugInfo::getOrCreateType(FType, Unit);
FieldSize = CGM.getContext().getTypeSize(FType);
FieldAlign = CGM.getContext().getTypeAlign(FType);
@@ -1078,7 +1111,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag,
EltTys.push_back(FieldTy);
FieldOffset += FieldSize;
- FType = CGM.getContext().getFixedWidthIntType(32, true); // Int32Ty;
+ FType = CGM.getContext().IntTy;
FieldTy = CGDebugInfo::getOrCreateType(FType, Unit);
FieldSize = CGM.getContext().getTypeSize(FType);
FieldAlign = CGM.getContext().getTypeAlign(FType);
@@ -1182,9 +1215,9 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag,
llvm::DIScope DS(RegionStack.back());
llvm::DILocation DO(NULL);
- llvm::DILocation DL =
- DebugFactory.CreateLocation(Line, Column, DS, DO);
- Builder.SetDebugLocation(Call, DL.getNode());
+ llvm::DILocation DL = DebugFactory.CreateLocation(Line, Column, DS, DO);
+
+ Call->setMetadata("dbg", DL.getNode());
}
/// EmitDeclare - Emit local variable declaration debug info.
@@ -1244,7 +1277,7 @@ void CGDebugInfo::EmitDeclare(const BlockDeclRefExpr *BDRE, unsigned Tag,
EltTys.push_back(FieldTy);
FieldOffset += FieldSize;
- FType = CGM.getContext().getFixedWidthIntType(32, true); // Int32Ty;
+ FType = CGM.getContext().IntTy;
FieldTy = CGDebugInfo::getOrCreateType(FType, Unit);
FieldSize = CGM.getContext().getTypeSize(FType);
FieldAlign = CGM.getContext().getTypeAlign(FType);
@@ -1255,7 +1288,7 @@ void CGDebugInfo::EmitDeclare(const BlockDeclRefExpr *BDRE, unsigned Tag,
EltTys.push_back(FieldTy);
FieldOffset += FieldSize;
- FType = CGM.getContext().getFixedWidthIntType(32, true); // Int32Ty;
+ FType = CGM.getContext().IntTy;
FieldTy = CGDebugInfo::getOrCreateType(FType, Unit);
FieldSize = CGM.getContext().getTypeSize(FType);
FieldAlign = CGM.getContext().getTypeAlign(FType);
@@ -1385,7 +1418,8 @@ void CGDebugInfo::EmitDeclare(const BlockDeclRefExpr *BDRE, unsigned Tag,
llvm::DILocation DO(NULL);
llvm::DILocation DL =
DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
- Builder.SetDebugLocation(Call, DL.getNode());
+
+ Call->setMetadata("dbg", DL.getNode());
}
void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *Decl,
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 14ee90d46936..602cc9efc7a0 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -15,6 +15,7 @@
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "clang/AST/ASTContext.h"
+#include "clang/AST/CharUnits.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/Basic/SourceManager.h"
@@ -471,7 +472,8 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
const llvm::Type *IntPtr =
llvm::IntegerType::get(VMContext, LLVMPointerWidth);
llvm::Value *SizeVal =
- llvm::ConstantInt::get(IntPtr, getContext().getTypeSizeInBytes(Ty));
+ llvm::ConstantInt::get(IntPtr,
+ getContext().getTypeSizeInChars(Ty).getRaw());
const llvm::Type *BP = llvm::Type::getInt8PtrTy(VMContext);
if (Loc->getType() != BP)
@@ -641,7 +643,7 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
Args.push_back(std::make_pair(RValue::get(Builder.CreateBitCast(DeclPtr,
ConvertType(ArgTy))),
getContext().getPointerType(D.getType())));
- EmitCall(Info, F, Args);
+ EmitCall(Info, F, ReturnValueSlot(), Args);
}
if (Exceptions) {
EHCleanupBlock Cleanup(*this);
@@ -650,7 +652,7 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
Args.push_back(std::make_pair(RValue::get(Builder.CreateBitCast(DeclPtr,
ConvertType(ArgTy))),
getContext().getPointerType(D.getType())));
- EmitCall(Info, F, Args);
+ EmitCall(Info, F, ReturnValueSlot(), Args);
}
}
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index b15b2e9b3b0f..bd0461fd2808 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -149,21 +149,39 @@ static void CopyObject(CodeGenFunction &CGF, const Expr *E,
CGF.EmitAggExpr(E, This, false);
} else if (CXXConstructorDecl *CopyCtor
= RD->getCopyConstructor(CGF.getContext(), 0)) {
- llvm::BasicBlock *PrevLandingPad = CGF.getInvokeDest();
+ llvm::Value *CondPtr = 0;
if (CGF.Exceptions) {
CodeGenFunction::EHCleanupBlock Cleanup(CGF);
llvm::Constant *FreeExceptionFn = getFreeExceptionFn(CGF);
+ llvm::BasicBlock *CondBlock = CGF.createBasicBlock("cond.free");
+ llvm::BasicBlock *Cont = CGF.createBasicBlock("cont");
+ CondPtr = CGF.CreateTempAlloca(llvm::Type::getInt1Ty(CGF.getLLVMContext()),
+ "doEHfree");
+
+ CGF.Builder.CreateCondBr(CGF.Builder.CreateLoad(CondPtr),
+ CondBlock, Cont);
+ CGF.EmitBlock(CondBlock);
+
// Load the exception pointer.
llvm::Value *ExceptionPtr = CGF.Builder.CreateLoad(ExceptionPtrPtr);
CGF.Builder.CreateCall(FreeExceptionFn, ExceptionPtr);
+
+ CGF.EmitBlock(Cont);
}
+ if (CondPtr)
+ CGF.Builder.CreateStore(llvm::ConstantInt::getTrue(CGF.getLLVMContext()),
+ CondPtr);
+
llvm::Value *Src = CGF.EmitLValue(E).getAddress();
- CGF.setInvokeDest(PrevLandingPad);
+
+ if (CondPtr)
+ CGF.Builder.CreateStore(llvm::ConstantInt::getFalse(CGF.getLLVMContext()),
+ CondPtr);
llvm::BasicBlock *TerminateHandler = CGF.getTerminateHandler();
- PrevLandingPad = CGF.getInvokeDest();
+ llvm::BasicBlock *PrevLandingPad = CGF.getInvokeDest();
CGF.setInvokeDest(TerminateHandler);
// Stolen from EmitClassAggrMemberwiseCopy
@@ -179,7 +197,7 @@ static void CopyObject(CodeGenFunction &CGF, const Expr *E,
QualType ResultType =
CopyCtor->getType()->getAs<FunctionType>()->getResultType();
CGF.EmitCall(CGF.CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
- Callee, CallArgs, CopyCtor);
+ Callee, ReturnValueSlot(), CallArgs, CopyCtor);
CGF.setInvokeDest(PrevLandingPad);
} else
llvm_unreachable("uncopyable object");
@@ -189,14 +207,22 @@ static void CopyObject(CodeGenFunction &CGF, const Expr *E,
// CopyObject - Utility to copy an object. Calls copy constructor as necessary.
// N is casted to the right type.
static void CopyObject(CodeGenFunction &CGF, QualType ObjectType,
- bool WasPointer, llvm::Value *E, llvm::Value *N) {
+ bool WasPointer, bool WasPointerReference,
+ llvm::Value *E, llvm::Value *N) {
// Store the throw exception in the exception object.
if (WasPointer || !CGF.hasAggregateLLVMType(ObjectType)) {
llvm::Value *Value = E;
if (!WasPointer)
Value = CGF.Builder.CreateLoad(Value);
const llvm::Type *ValuePtrTy = Value->getType()->getPointerTo(0);
- CGF.Builder.CreateStore(Value, CGF.Builder.CreateBitCast(N, ValuePtrTy));
+ if (WasPointerReference) {
+ llvm::Value *Tmp = CGF.CreateTempAlloca(Value->getType(), "catch.param");
+ CGF.Builder.CreateStore(Value, Tmp);
+ Value = Tmp;
+ ValuePtrTy = Value->getType()->getPointerTo(0);
+ }
+ N = CGF.Builder.CreateBitCast(N, ValuePtrTy);
+ CGF.Builder.CreateStore(Value, N);
} else {
const llvm::Type *Ty = CGF.ConvertType(ObjectType)->getPointerTo(0);
const CXXRecordDecl *RD;
@@ -221,7 +247,7 @@ static void CopyObject(CodeGenFunction &CGF, QualType ObjectType,
QualType ResultType =
CopyCtor->getType()->getAs<FunctionType>()->getResultType();
CGF.EmitCall(CGF.CGM.getTypes().getFunctionInfo(ResultType, CallArgs),
- Callee, CallArgs, CopyCtor);
+ Callee, ReturnValueSlot(), CallArgs, CopyCtor);
} else
llvm_unreachable("uncopyable object");
}
@@ -264,7 +290,7 @@ void CodeGenFunction::EmitCXXThrowExpr(const CXXThrowExpr *E) {
// Now throw the exception.
const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(getLLVMContext());
- llvm::Constant *TypeInfo = CGM.GenerateRTTI(ThrowType);
+ llvm::Constant *TypeInfo = CGM.GetAddrOfRTTIDescriptor(ThrowType);
llvm::Constant *Dtor = llvm::Constant::getNullValue(Int8PtrTy);
if (getInvokeDest()) {
@@ -347,8 +373,9 @@ void CodeGenFunction::EmitStartEHSpec(const Decl *D) {
for (unsigned i = 0; i < Proto->getNumExceptions(); ++i) {
QualType Ty = Proto->getExceptionType(i);
- llvm::Value *EHType
- = CGM.GenerateRTTI(Ty.getNonReferenceType());
+ QualType ExceptType
+ = Ty.getNonReferenceType().getUnqualifiedType();
+ llvm::Value *EHType = CGM.GetAddrOfRTTIDescriptor(ExceptType);
SelectorArgs.push_back(EHType);
}
if (Proto->getNumExceptions())
@@ -487,9 +514,12 @@ void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) {
const CXXCatchStmt *C = S.getHandler(i);
VarDecl *CatchParam = C->getExceptionDecl();
if (CatchParam) {
- llvm::Value *EHType
- = CGM.GenerateRTTI(C->getCaughtType().getNonReferenceType());
- SelectorArgs.push_back(EHType);
+ // C++ [except.handle]p3 indicates that top-level cv-qualifiers
+ // are ignored.
+ QualType CaughtType = C->getCaughtType().getNonReferenceType();
+ llvm::Value *EHTypeInfo
+ = CGM.GetAddrOfRTTIDescriptor(CaughtType.getUnqualifiedType());
+ SelectorArgs.push_back(EHTypeInfo);
} else {
// null indicates catch all
SelectorArgs.push_back(Null);
@@ -541,7 +571,12 @@ void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) {
QualType CatchType = CatchParam->getType().getNonReferenceType();
setInvokeDest(TerminateHandler);
bool WasPointer = true;
- if (!CatchType.getTypePtr()->isPointerType()) {
+ bool WasPointerReference = false;
+ CatchType = CGM.getContext().getCanonicalType(CatchType);
+ if (CatchType.getTypePtr()->isPointerType()) {
+ if (isa<ReferenceType>(CatchParam->getType()))
+ WasPointerReference = true;
+ } else {
if (!isa<ReferenceType>(CatchParam->getType()))
WasPointer = false;
CatchType = getContext().getPointerType(CatchType);
@@ -552,7 +587,8 @@ void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) {
// cleanup doesn't start until after the ctor completes, use a decl
// init?
CopyObject(*this, CatchParam->getType().getNonReferenceType(),
- WasPointer, ExcObject, GetAddrOfLocalVar(CatchParam));
+ WasPointer, WasPointerReference, ExcObject,
+ GetAddrOfLocalVar(CatchParam));
setInvokeDest(MatchHandler);
}
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index e6bbfa8063fa..ab451cf512e8 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -97,13 +97,15 @@ RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E,
bool IsInitializer) {
bool ShouldDestroyTemporaries = false;
unsigned OldNumLiveTemporaries = 0;
-
- if (const CXXExprWithTemporaries *TE = dyn_cast<CXXExprWithTemporaries>(E)) {
- ShouldDestroyTemporaries = TE->shouldDestroyTemporaries();
+ if (const CXXDefaultArgExpr *DAE = dyn_cast<CXXDefaultArgExpr>(E))
+ E = DAE->getExpr();
+
+ if (const CXXExprWithTemporaries *TE = dyn_cast<CXXExprWithTemporaries>(E)) {
+ ShouldDestroyTemporaries = true;
+
// Keep track of the current cleanup stack depth.
- if (ShouldDestroyTemporaries)
- OldNumLiveTemporaries = LiveTemporaries.size();
+ OldNumLiveTemporaries = LiveTemporaries.size();
E = TE->getSubExpr();
}
@@ -209,6 +211,34 @@ unsigned CodeGenFunction::getAccessedFieldNo(unsigned Idx,
return cast<llvm::ConstantInt>(Elts->getOperand(Idx))->getZExtValue();
}
+void CodeGenFunction::EmitCheck(llvm::Value *Address, unsigned Size) {
+ if (!CatchUndefined)
+ return;
+
+ const llvm::IntegerType *Size_tTy
+ = llvm::IntegerType::get(VMContext, LLVMPointerWidth);
+ Address = Builder.CreateBitCast(Address, PtrToInt8Ty);
+
+ const llvm::Type *ResType[] = {
+ Size_tTy
+ };
+ llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::objectsize, ResType, 1);
+ const llvm::IntegerType *IntTy = cast<llvm::IntegerType>(
+ CGM.getTypes().ConvertType(CGM.getContext().IntTy));
+ // In time, people may want to control this and use a 1 here.
+ llvm::Value *Arg = llvm::ConstantInt::get(IntTy, 0);
+ llvm::Value *C = Builder.CreateCall2(F, Address, Arg);
+ llvm::BasicBlock *Cont = createBasicBlock();
+ llvm::BasicBlock *Check = createBasicBlock();
+ llvm::Value *NegativeOne = llvm::ConstantInt::get(Size_tTy, -1ULL);
+ Builder.CreateCondBr(Builder.CreateICmpEQ(C, NegativeOne), Cont, Check);
+
+ EmitBlock(Check);
+ Builder.CreateCondBr(Builder.CreateICmpUGE(C,
+ llvm::ConstantInt::get(Size_tTy, Size)),
+ Cont, getTrapBB());
+ EmitBlock(Cont);
+}
//===----------------------------------------------------------------------===//
// LValue Expression Emission
@@ -246,6 +276,13 @@ LValue CodeGenFunction::EmitUnsupportedLValue(const Expr *E,
MakeQualifiers(E->getType()));
}
+LValue CodeGenFunction::EmitCheckedLValue(const Expr *E) {
+ LValue LV = EmitLValue(E);
+ if (!isa<DeclRefExpr>(E) && !LV.isBitfield() && LV.isSimple())
+ EmitCheck(LV.getAddress(), getContext().getTypeSize(E->getType()) / 8);
+ return LV;
+}
+
/// EmitLValue - Emit code to compute a designator that specifies the location
/// of the expression.
///
@@ -1072,8 +1109,9 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) {
llvm::IntegerType::get(VMContext, LLVMPointerWidth),
IdxSigned, "idxprom");
+ // FIXME: As llvm implements the object size checking, this can come out.
if (CatchUndefined) {
- if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E->getBase())) {
+ if (const ImplicitCastExpr *ICE=dyn_cast<ImplicitCastExpr>(E->getBase())) {
if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(ICE->getSubExpr())) {
if (ICE->getCastKind() == CastExpr::CK_ArrayToPointerDecay) {
if (const ConstantArrayType *CAT
@@ -1141,7 +1179,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) {
static
llvm::Constant *GenerateConstantVector(llvm::LLVMContext &VMContext,
llvm::SmallVector<unsigned, 4> &Elts) {
- llvm::SmallVector<llvm::Constant *, 4> CElts;
+ llvm::SmallVector<llvm::Constant*, 4> CElts;
for (unsigned i = 0, e = Elts.size(); i != e; ++i)
CElts.push_back(llvm::ConstantInt::get(
@@ -1152,21 +1190,37 @@ llvm::Constant *GenerateConstantVector(llvm::LLVMContext &VMContext,
LValue CodeGenFunction::
EmitExtVectorElementExpr(const ExtVectorElementExpr *E) {
+ const llvm::Type *Int32Ty = llvm::Type::getInt32Ty(VMContext);
+
// Emit the base vector as an l-value.
LValue Base;
// ExtVectorElementExpr's base can either be a vector or pointer to vector.
- if (!E->isArrow()) {
- assert(E->getBase()->getType()->isVectorType());
- Base = EmitLValue(E->getBase());
- } else {
- const PointerType *PT = E->getBase()->getType()->getAs<PointerType>();
+ if (E->isArrow()) {
+ // If it is a pointer to a vector, emit the address and form an lvalue with
+ // it.
llvm::Value *Ptr = EmitScalarExpr(E->getBase());
+ const PointerType *PT = E->getBase()->getType()->getAs<PointerType>();
Qualifiers Quals = MakeQualifiers(PT->getPointeeType());
Quals.removeObjCGCAttr();
Base = LValue::MakeAddr(Ptr, Quals);
+ } else if (E->getBase()->isLvalue(getContext()) == Expr::LV_Valid) {
+ // Otherwise, if the base is an lvalue ( as in the case of foo.x.x),
+ // emit the base as an lvalue.
+ assert(E->getBase()->getType()->isVectorType());
+ Base = EmitLValue(E->getBase());
+ } else {
+ // Otherwise, the base is a normal rvalue (as in (V+V).x), emit it as such.
+ const VectorType *VT = E->getBase()->getType()->getAs<VectorType>();
+ assert(VT && "Result must be a vector");
+ llvm::Value *Vec = EmitScalarExpr(E->getBase());
+
+ // Store the vector to memory (because LValue wants an address).
+ llvm::Value *VecMem =CreateTempAlloca(ConvertType(E->getBase()->getType()));
+ Builder.CreateStore(Vec, VecMem);
+ Base = LValue::MakeAddr(VecMem, Qualifiers());
}
-
+
// Encode the element access list into a vector of unsigned indices.
llvm::SmallVector<unsigned, 4> Indices;
E->getEncodedElementAccess(Indices);
@@ -1181,7 +1235,6 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) {
llvm::Constant *BaseElts = Base.getExtVectorElts();
llvm::SmallVector<llvm::Constant *, 4> CElts;
- const llvm::Type *Int32Ty = llvm::Type::getInt32Ty(VMContext);
for (unsigned i = 0, e = Indices.size(); i != e; ++i) {
if (isa<llvm::ConstantAggregateZero>(BaseElts))
CElts.push_back(llvm::ConstantInt::get(Int32Ty, 0));
@@ -1325,12 +1378,20 @@ LValue CodeGenFunction::EmitCompoundLiteralLValue(const CompoundLiteralExpr* E){
LValue
CodeGenFunction::EmitConditionalOperatorLValue(const ConditionalOperator* E) {
if (E->isLvalue(getContext()) == Expr::LV_Valid) {
+ if (int Cond = ConstantFoldsToSimpleInteger(E->getCond())) {
+ Expr *Live = Cond == 1 ? E->getLHS() : E->getRHS();
+ if (Live)
+ return EmitLValue(Live);
+ }
+
+ if (!E->getLHS())
+ return EmitUnsupportedLValue(E, "conditional operator with missing LHS");
+
llvm::BasicBlock *LHSBlock = createBasicBlock("cond.true");
llvm::BasicBlock *RHSBlock = createBasicBlock("cond.false");
llvm::BasicBlock *ContBlock = createBasicBlock("cond.end");
- llvm::Value *Cond = EvaluateExprAsBool(E->getCond());
- Builder.CreateCondBr(Cond, LHSBlock, RHSBlock);
+ EmitBranchOnBoolExpr(E->getCond(), LHSBlock, RHSBlock);
EmitBlock(LHSBlock);
@@ -1390,6 +1451,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
case CastExpr::CK_NoOp:
case CastExpr::CK_ConstructorConversion:
case CastExpr::CK_UserDefinedConversion:
+ case CastExpr::CK_AnyPointerToObjCPointerCast:
return EmitLValue(E->getSubExpr());
case CastExpr::CK_DerivedToBase: {
@@ -1464,13 +1526,14 @@ LValue CodeGenFunction::EmitNullInitializationLValue(
//===--------------------------------------------------------------------===//
-RValue CodeGenFunction::EmitCallExpr(const CallExpr *E) {
+RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
+ ReturnValueSlot ReturnValue) {
// Builtins never have block type.
if (E->getCallee()->getType()->isBlockPointerType())
- return EmitBlockCallExpr(E);
+ return EmitBlockCallExpr(E, ReturnValue);
if (const CXXMemberCallExpr *CE = dyn_cast<CXXMemberCallExpr>(E))
- return EmitCXXMemberCallExpr(CE);
+ return EmitCXXMemberCallExpr(CE, ReturnValue);
const Decl *TargetDecl = 0;
if (const ImplicitCastExpr *CE = dyn_cast<ImplicitCastExpr>(E->getCallee())) {
@@ -1484,7 +1547,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E) {
if (const CXXOperatorCallExpr *CE = dyn_cast<CXXOperatorCallExpr>(E))
if (const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(TargetDecl))
- return EmitCXXOperatorMemberCallExpr(CE, MD);
+ return EmitCXXOperatorMemberCallExpr(CE, MD, ReturnValue);
if (isa<CXXPseudoDestructorExpr>(E->getCallee()->IgnoreParens())) {
// C++ [expr.pseudo]p1:
@@ -1497,7 +1560,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E) {
}
llvm::Value *Callee = EmitScalarExpr(E->getCallee());
- return EmitCall(Callee, E->getCallee()->getType(),
+ return EmitCall(E->getCallee()->getType(), Callee, ReturnValue,
E->arg_begin(), E->arg_end(), TargetDecl);
}
@@ -1658,7 +1721,8 @@ LValue CodeGenFunction::EmitPointerToDataMemberLValue(const FieldDecl *Field) {
return LValue::MakeAddr(V, MakeQualifiers(Field->getType()));
}
-RValue CodeGenFunction::EmitCall(llvm::Value *Callee, QualType CalleeType,
+RValue CodeGenFunction::EmitCall(QualType CalleeType, llvm::Value *Callee,
+ ReturnValueSlot ReturnValue,
CallExpr::const_arg_iterator ArgBeg,
CallExpr::const_arg_iterator ArgEnd,
const Decl *TargetDecl) {
@@ -1683,7 +1747,7 @@ RValue CodeGenFunction::EmitCall(llvm::Value *Callee, QualType CalleeType,
CallingConvention = F->getCallingConv();
return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args,
CallingConvention),
- Callee, Args, TargetDecl);
+ Callee, ReturnValue, Args, TargetDecl);
}
LValue CodeGenFunction::
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index 2c122ebe13dd..b95fd799010b 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -106,6 +106,7 @@ public:
void VisitConditionalOperator(const ConditionalOperator *CO);
void VisitChooseExpr(const ChooseExpr *CE);
void VisitInitListExpr(InitListExpr *E);
+ void VisitImplicitValueInitExpr(ImplicitValueInitExpr *E);
void VisitCXXDefaultArgExpr(CXXDefaultArgExpr *DAE) {
Visit(DAE->getExpr());
}
@@ -271,6 +272,13 @@ void AggExprEmitter::VisitCallExpr(const CallExpr *E) {
return;
}
+ // If the struct doesn't require GC, we can just pass the destination
+ // directly to EmitCall.
+ if (!RequiresGCollection) {
+ CGF.EmitCallExpr(E, ReturnValueSlot(DestPtr, VolatileDest));
+ return;
+ }
+
RValue RV = CGF.EmitCallExpr(E);
EmitFinalDestCopy(E, RV);
}
@@ -388,12 +396,16 @@ void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) {
}
void AggExprEmitter::VisitConditionalOperator(const ConditionalOperator *E) {
+ if (!E->getLHS()) {
+ CGF.ErrorUnsupported(E, "conditional operator with missing LHS");
+ return;
+ }
+
llvm::BasicBlock *LHSBlock = CGF.createBasicBlock("cond.true");
llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("cond.false");
llvm::BasicBlock *ContBlock = CGF.createBasicBlock("cond.end");
- llvm::Value *Cond = CGF.EvaluateExprAsBool(E->getCond());
- Builder.CreateCondBr(Cond, LHSBlock, RHSBlock);
+ CGF.EmitBranchOnBoolExpr(E->getCond(), LHSBlock, RHSBlock);
CGF.StartConditionalBranch();
CGF.EmitBlock(LHSBlock);
@@ -457,16 +469,45 @@ AggExprEmitter::VisitCXXConstructExpr(const CXXConstructExpr *E) {
Val = CGF.CreateTempAlloca(CGF.ConvertTypeForMem(E->getType()), "tmp");
}
+ if (E->requiresZeroInitialization())
+ EmitNullInitializationToLValue(LValue::MakeAddr(Val,
+ // FIXME: Qualifiers()?
+ E->getType().getQualifiers()),
+ E->getType());
+
CGF.EmitCXXConstructExpr(Val, E);
}
void AggExprEmitter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
- CGF.EmitCXXExprWithTemporaries(E, DestPtr, VolatileDest, IsInitializer);
+ llvm::Value *Val = DestPtr;
+
+ if (!Val) {
+ // Create a temporary variable.
+ Val = CGF.CreateTempAlloca(CGF.ConvertTypeForMem(E->getType()), "tmp");
+ }
+ CGF.EmitCXXExprWithTemporaries(E, Val, VolatileDest, IsInitializer);
}
void AggExprEmitter::VisitCXXZeroInitValueExpr(CXXZeroInitValueExpr *E) {
- LValue lvalue = LValue::MakeAddr(DestPtr, Qualifiers());
- EmitNullInitializationToLValue(lvalue, E->getType());
+ llvm::Value *Val = DestPtr;
+
+ if (!Val) {
+ // Create a temporary variable.
+ Val = CGF.CreateTempAlloca(CGF.ConvertTypeForMem(E->getType()), "tmp");
+ }
+ LValue LV = LValue::MakeAddr(Val, Qualifiers());
+ EmitNullInitializationToLValue(LV, E->getType());
+}
+
+void AggExprEmitter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
+ llvm::Value *Val = DestPtr;
+
+ if (!Val) {
+ // Create a temporary variable.
+ Val = CGF.CreateTempAlloca(CGF.ConvertTypeForMem(E->getType()), "tmp");
+ }
+ LValue LV = LValue::MakeAddr(Val, Qualifiers());
+ EmitNullInitializationToLValue(LV, E->getType());
}
void AggExprEmitter::EmitInitializationToLValue(Expr* E, LValue LV) {
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp
index 150f11ebf575..79923221961f 100644
--- a/lib/CodeGen/CGExprCXX.cpp
+++ b/lib/CodeGen/CGExprCXX.cpp
@@ -78,7 +78,6 @@ static uint64_t CalculateCookiePadding(ASTContext &Ctx, const CXXNewExpr *E) {
}
return CalculateCookiePadding(Ctx, E->getAllocatedType());
- QualType T = E->getAllocatedType();
}
static llvm::Value *EmitCXXNewAllocSize(CodeGenFunction &CGF,
@@ -212,7 +211,7 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) {
// Emit the call to new.
RValue RV =
EmitCall(CGM.getTypes().getFunctionInfo(NewFTy->getResultType(), NewArgs),
- CGM.GetAddrOfFunction(NewFD), NewArgs, NewFD);
+ CGM.GetAddrOfFunction(NewFD), ReturnValueSlot(), NewArgs, NewFD);
// If an allocation function is declared with an empty exception specification
// it returns null to indicate failure to allocate storage. [expr.new]p13.
@@ -354,7 +353,7 @@ void CodeGenFunction::EmitDeleteCall(const FunctionDecl *DeleteFD,
// Emit the call to delete.
EmitCall(CGM.getTypes().getFunctionInfo(DeleteFTy->getResultType(),
DeleteArgs),
- CGM.GetAddrOfFunction(DeleteFD),
+ CGM.GetAddrOfFunction(DeleteFD), ReturnValueSlot(),
DeleteArgs, DeleteFD);
}
@@ -406,7 +405,7 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) {
/*isVariadic=*/false);
llvm::Value *Callee = BuildVirtualCall(Dtor, Dtor_Deleting, Ptr, Ty);
- EmitCXXMemberCall(Dtor, Callee, Ptr, 0, 0);
+ EmitCXXMemberCall(Dtor, Callee, ReturnValueSlot(), Ptr, 0, 0);
// The dtor took care of deleting the object.
ShouldCallDelete = false;
@@ -426,9 +425,12 @@ llvm::Value * CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) {
QualType Ty = E->getType();
const llvm::Type *LTy = ConvertType(Ty)->getPointerTo();
- if (E->isTypeOperand())
- return Builder.CreateBitCast(CGM.GetAddrOfRTTI(E->getTypeOperand()), LTy);
-
+ if (E->isTypeOperand()) {
+ llvm::Constant *TypeInfo =
+ CGM.GetAddrOfRTTIDescriptor(E->getTypeOperand());
+ return Builder.CreateBitCast(TypeInfo, LTy);
+ }
+
Expr *subE = E->getExprOperand();
Ty = subE->getType();
CanQualType CanTy = CGM.getContext().getCanonicalType(Ty);
@@ -468,24 +470,23 @@ llvm::Value * CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) {
V = Builder.CreateConstInBoundsGEP1_64(V, -1ULL);
V = Builder.CreateLoad(V);
return V;
- }
- return Builder.CreateBitCast(CGM.GenerateRTTI(RD), LTy);
+ }
}
- return Builder.CreateBitCast(CGM.GenerateRTTI(Ty), LTy);
+ return Builder.CreateBitCast(CGM.GetAddrOfRTTIDescriptor(Ty), LTy);
}
llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V,
const CXXDynamicCastExpr *DCE) {
- QualType CastTy = DCE->getTypeAsWritten();
- QualType InnerType = CastTy->getPointeeType();
- QualType ArgTy = DCE->getSubExpr()->getType();
- const llvm::Type *LArgTy = ConvertType(ArgTy);
+ QualType SrcTy = DCE->getSubExpr()->getType();
+ QualType DestTy = DCE->getTypeAsWritten();
+ QualType InnerType = DestTy->getPointeeType();
+
const llvm::Type *LTy = ConvertType(DCE->getType());
bool CanBeZero = false;
bool ToVoid = false;
bool ThrowOnBad = false;
- if (CastTy->isPointerType()) {
+ if (DestTy->isPointerType()) {
// FIXME: if PointerType->hasAttr<NonNullAttr>(), we don't set this
CanBeZero = true;
if (InnerType->isVoidType())
@@ -495,14 +496,13 @@ llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V,
ThrowOnBad = true;
}
- CXXRecordDecl *SrcTy;
- QualType Ty = ArgTy;
- if (ArgTy.getTypePtr()->isPointerType()
- || ArgTy.getTypePtr()->isReferenceType())
- Ty = Ty.getTypePtr()->getPointeeType();
- CanQualType CanTy = CGM.getContext().getCanonicalType(Ty);
- Ty = CanTy.getUnqualifiedType();
- SrcTy = cast<CXXRecordDecl>(Ty->getAs<RecordType>()->getDecl());
+ if (SrcTy->isPointerType() || SrcTy->isReferenceType())
+ SrcTy = SrcTy->getPointeeType();
+ SrcTy = SrcTy.getUnqualifiedType();
+
+ if (DestTy->isPointerType() || DestTy->isReferenceType())
+ DestTy = DestTy->getPointeeType();
+ DestTy = DestTy.getUnqualifiedType();
llvm::BasicBlock *ContBlock = createBasicBlock();
llvm::BasicBlock *NullBlock = 0;
@@ -510,15 +510,13 @@ llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V,
if (CanBeZero) {
NonZeroBlock = createBasicBlock();
NullBlock = createBasicBlock();
- llvm::Value *Zero = llvm::Constant::getNullValue(LArgTy);
- Builder.CreateCondBr(Builder.CreateICmpNE(V, Zero),
- NonZeroBlock, NullBlock);
+ Builder.CreateCondBr(Builder.CreateIsNotNull(V), NonZeroBlock, NullBlock);
EmitBlock(NonZeroBlock);
}
llvm::BasicBlock *BadCastBlock = 0;
- const llvm::Type *PtrDiffTy = ConvertType(getContext().getSizeType());
+ const llvm::Type *PtrDiffTy = ConvertType(getContext().getPointerDiffType());
// See if this is a dynamic_cast(void*)
if (ToVoid) {
@@ -542,27 +540,27 @@ llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V,
ArgTys.push_back(PtrToInt8Ty);
ArgTys.push_back(PtrDiffTy);
FTy = llvm::FunctionType::get(ResultType, ArgTys, false);
- CXXRecordDecl *DstTy;
- Ty = CastTy.getTypePtr()->getPointeeType();
- CanTy = CGM.getContext().getCanonicalType(Ty);
- Ty = CanTy.getUnqualifiedType();
- DstTy = cast<CXXRecordDecl>(Ty->getAs<RecordType>()->getDecl());
// FIXME: Calculate better hint.
llvm::Value *hint = llvm::ConstantInt::get(PtrDiffTy, -1ULL);
- llvm::Value *SrcArg = CGM.GenerateRTTIRef(SrcTy);
- llvm::Value *DstArg = CGM.GenerateRTTIRef(DstTy);
+
+ assert(SrcTy->isRecordType() && "Src type must be record type!");
+ assert(DestTy->isRecordType() && "Dest type must be record type!");
+
+ llvm::Value *SrcArg
+ = CGM.GetAddrOfRTTIDescriptor(SrcTy.getUnqualifiedType());
+ llvm::Value *DestArg
+ = CGM.GetAddrOfRTTIDescriptor(DestTy.getUnqualifiedType());
+
V = Builder.CreateBitCast(V, PtrToInt8Ty);
V = Builder.CreateCall4(CGM.CreateRuntimeFunction(FTy, "__dynamic_cast"),
- V, SrcArg, DstArg, hint);
+ V, SrcArg, DestArg, hint);
V = Builder.CreateBitCast(V, LTy);
if (ThrowOnBad) {
BadCastBlock = createBasicBlock();
- llvm::Value *Zero = llvm::Constant::getNullValue(LTy);
- Builder.CreateCondBr(Builder.CreateICmpNE(V, Zero),
- ContBlock, BadCastBlock);
+ Builder.CreateCondBr(Builder.CreateIsNotNull(V), ContBlock, BadCastBlock);
EmitBlock(BadCastBlock);
/// Call __cxa_bad_cast
ResultType = llvm::Type::getVoidTy(VMContext);
diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp
index 7fa8ffbd5515..be2239ffb616 100644
--- a/lib/CodeGen/CGExprComplex.cpp
+++ b/lib/CodeGen/CGExprComplex.cpp
@@ -626,6 +626,14 @@ ComplexPairTy ComplexExprEmitter::VisitBinComma(const BinaryOperator *E) {
ComplexPairTy ComplexExprEmitter::
VisitConditionalOperator(const ConditionalOperator *E) {
+ if (!E->getLHS()) {
+ CGF.ErrorUnsupported(E, "conditional operator with missing LHS");
+ const llvm::Type *EltTy =
+ CGF.ConvertType(E->getType()->getAs<ComplexType>()->getElementType());
+ llvm::Value *U = llvm::UndefValue::get(EltTy);
+ return ComplexPairTy(U, U);
+ }
+
TestAndClearIgnoreReal();
TestAndClearIgnoreImag();
TestAndClearIgnoreRealAssign();
@@ -634,8 +642,7 @@ VisitConditionalOperator(const ConditionalOperator *E) {
llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("cond.false");
llvm::BasicBlock *ContBlock = CGF.createBasicBlock("cond.end");
- llvm::Value *Cond = CGF.EvaluateExprAsBool(E->getCond());
- Builder.CreateCondBr(Cond, LHSBlock, RHSBlock);
+ CGF.EmitBranchOnBoolExpr(E->getCond(), LHSBlock, RHSBlock);
CGF.EmitBlock(LHSBlock);
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 2f31c051a78d..93646d6d3af9 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -69,6 +69,7 @@ public:
const llvm::Type *ConvertType(QualType T) { return CGF.ConvertType(T); }
LValue EmitLValue(const Expr *E) { return CGF.EmitLValue(E); }
+ LValue EmitCheckedLValue(const Expr *E) { return CGF.EmitCheckedLValue(E); }
Value *EmitLoadOfLValue(LValue LV, QualType T) {
return CGF.EmitLoadOfLValue(LV, T).getScalarVal();
@@ -78,7 +79,7 @@ public:
/// value l-value, this method emits the address of the l-value, then loads
/// and returns the result.
Value *EmitLoadOfLValue(const Expr *E) {
- return EmitLoadOfLValue(EmitLValue(E), E->getType());
+ return EmitLoadOfLValue(EmitCheckedLValue(E), E->getType());
}
/// EmitConversionToBool - Convert the specified expression value to a
@@ -327,16 +328,16 @@ public:
Value *VisitBin ## OP ## Assign(const CompoundAssignOperator *E) { \
return EmitCompoundAssign(E, &ScalarExprEmitter::Emit ## OP); \
}
- HANDLEBINOP(Mul);
- HANDLEBINOP(Div);
- HANDLEBINOP(Rem);
- HANDLEBINOP(Add);
- HANDLEBINOP(Sub);
- HANDLEBINOP(Shl);
- HANDLEBINOP(Shr);
- HANDLEBINOP(And);
- HANDLEBINOP(Xor);
- HANDLEBINOP(Or);
+ HANDLEBINOP(Mul)
+ HANDLEBINOP(Div)
+ HANDLEBINOP(Rem)
+ HANDLEBINOP(Add)
+ HANDLEBINOP(Sub)
+ HANDLEBINOP(Shl)
+ HANDLEBINOP(Shr)
+ HANDLEBINOP(And)
+ HANDLEBINOP(Xor)
+ HANDLEBINOP(Or)
#undef HANDLEBINOP
// Comparisons.
@@ -346,12 +347,12 @@ public:
Value *VisitBin##CODE(const BinaryOperator *E) { \
return EmitCompare(E, llvm::ICmpInst::UI, llvm::ICmpInst::SI, \
llvm::FCmpInst::FP); }
- VISITCOMP(LT, ICMP_ULT, ICMP_SLT, FCMP_OLT);
- VISITCOMP(GT, ICMP_UGT, ICMP_SGT, FCMP_OGT);
- VISITCOMP(LE, ICMP_ULE, ICMP_SLE, FCMP_OLE);
- VISITCOMP(GE, ICMP_UGE, ICMP_SGE, FCMP_OGE);
- VISITCOMP(EQ, ICMP_EQ , ICMP_EQ , FCMP_OEQ);
- VISITCOMP(NE, ICMP_NE , ICMP_NE , FCMP_UNE);
+ VISITCOMP(LT, ICMP_ULT, ICMP_SLT, FCMP_OLT)
+ VISITCOMP(GT, ICMP_UGT, ICMP_SGT, FCMP_OGT)
+ VISITCOMP(LE, ICMP_ULE, ICMP_SLE, FCMP_OLE)
+ VISITCOMP(GE, ICMP_UGE, ICMP_SGE, FCMP_OGE)
+ VISITCOMP(EQ, ICMP_EQ , ICMP_EQ , FCMP_OEQ)
+ VISITCOMP(NE, ICMP_NE , ICMP_NE , FCMP_UNE)
#undef VISITCOMP
Value *VisitBinAssign (const BinaryOperator *E);
@@ -815,6 +816,7 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
return Builder.CreateBitCast(Src, ConvertType(DestTy));
}
case CastExpr::CK_NoOp:
+ case CastExpr::CK_UserDefinedConversion:
return Visit(const_cast<Expr*>(E));
case CastExpr::CK_BaseToDerived: {
@@ -902,7 +904,6 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
return Src;
}
- case CastExpr::CK_UserDefinedConversion:
case CastExpr::CK_ConstructorConversion:
assert(0 && "Should be unreachable!");
break;
@@ -1198,7 +1199,7 @@ BinOpInfo ScalarExprEmitter::EmitBinOps(const BinaryOperator *E) {
Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E,
Value *(ScalarExprEmitter::*Func)(const BinOpInfo &)) {
bool Ignore = TestAndClearIgnoreResultAssign();
- QualType LHSTy = E->getLHS()->getType(), RHSTy = E->getRHS()->getType();
+ QualType LHSTy = E->getLHS()->getType();
BinOpInfo OpInfo;
@@ -1217,7 +1218,7 @@ Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E,
OpInfo.Ty = E->getComputationResultType();
OpInfo.E = E;
// Load/convert the LHS.
- LValue LHSLV = EmitLValue(E->getLHS());
+ LValue LHSLV = EmitCheckedLValue(E->getLHS());
OpInfo.LHS = EmitLoadOfLValue(LHSLV, LHSTy);
OpInfo.LHS = EmitScalarConversion(OpInfo.LHS, LHSTy,
E->getComputationLHSType());
@@ -1654,7 +1655,7 @@ Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) {
// __block variables need to have the rhs evaluated first, plus this should
// improve codegen just a little.
Value *RHS = Visit(E->getRHS());
- LValue LHS = EmitLValue(E->getLHS());
+ LValue LHS = EmitCheckedLValue(E->getLHS());
// Store the value into the LHS. Bit-fields are handled specially
// because the result is altered by the store, i.e., [C99 6.5.16p1]
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index 2fe3f5b1b443..ac391d99a150 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -190,7 +190,7 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP,
// FIXME: We shouldn't need to get the function info here, the
// runtime already should have computed it to build the function.
RValue RV = EmitCall(Types.getFunctionInfo(PD->getType(), Args),
- GetPropertyFn, Args);
+ GetPropertyFn, ReturnValueSlot(), Args);
// We need to fix the type here. Ivars with copy & retain are
// always objects so we don't need to worry about complex or
// aggregates.
@@ -277,8 +277,8 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP,
getContext().BoolTy));
// FIXME: We shouldn't need to get the function info here, the runtime
// already should have computed it to build the function.
- EmitCall(Types.getFunctionInfo(getContext().VoidTy, Args),
- SetPropertyFn, Args);
+ EmitCall(Types.getFunctionInfo(getContext().VoidTy, Args), SetPropertyFn,
+ ReturnValueSlot(), Args);
} else {
// FIXME: Find a clean way to avoid AST node creation.
SourceLocation Loc = PD->getLocation();
@@ -553,7 +553,7 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
// FIXME: We shouldn't need to get the function info here, the runtime already
// should have computed it to build the function.
EmitCall(CGM.getTypes().getFunctionInfo(getContext().VoidTy, Args2),
- EnumerationMutationFn, Args2);
+ EnumerationMutationFn, ReturnValueSlot(), Args2);
EmitBlock(WasNotMutated);
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index be772c7fa311..95f67ae36a1e 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -450,7 +450,7 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF,
llvm::Value *imp = CGF.Builder.CreateCall(lookupFunction, lookupArgs,
lookupArgs+2);
- return CGF.EmitCall(FnInfo, imp, ActualArgs);
+ return CGF.EmitCall(FnInfo, imp, ReturnValueSlot(), ActualArgs);
}
/// Generate code for a message send expression.
@@ -536,7 +536,7 @@ CGObjCGNU::GenerateMessageSend(CodeGen::CodeGenFunction &CGF,
imp = Builder.CreateCall2(lookupFunction, Receiver, cmd);
}
- return CGF.EmitCall(FnInfo, imp, ActualArgs);
+ return CGF.EmitCall(FnInfo, imp, ReturnValueSlot(), ActualArgs);
}
/// Generates a MethodList. Used in construction of a objc_class and
@@ -1607,7 +1607,7 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
Params.push_back(PtrTy);
llvm::Value *RethrowFn =
CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::getVoidTy(VMContext),
- Params, false), "_Unwind_Resume_or_Rethrow");
+ Params, false), "objc_exception_throw");
bool isTry = isa<ObjCAtTryStmt>(S);
llvm::BasicBlock *TryBlock = CGF.createBasicBlock("try");
@@ -1618,7 +1618,7 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
llvm::BasicBlock *FinallyRethrow = CGF.createBasicBlock("finally.throw");
llvm::BasicBlock *FinallyEnd = CGF.createBasicBlock("finally.end");
- // GNU runtime does not currently support @synchronized()
+ // @synchronized()
if (!isTry) {
std::vector<const llvm::Type*> Args(1, IdTy);
llvm::FunctionType *FTy =
@@ -1770,7 +1770,13 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
ESelArgs.clear();
ESelArgs.push_back(Exc);
ESelArgs.push_back(Personality);
- ESelArgs.push_back(llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), 0));
+ // If there is a @catch or @finally clause in outside of this one then we
+ // need to make sure that we catch and rethrow it.
+ if (PrevLandingPad) {
+ ESelArgs.push_back(NULLPtr);
+ } else {
+ ESelArgs.push_back(llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), 0));
+ }
CGF.Builder.CreateCall(llvm_eh_selector, ESelArgs.begin(), ESelArgs.end(),
"selector");
CGF.Builder.CreateCall(llvm_eh_typeid_for,
@@ -1811,11 +1817,23 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
CGF.EmitBranch(FinallyEnd);
CGF.EmitBlock(FinallyRethrow);
- CGF.Builder.CreateCall(RethrowFn, CGF.Builder.CreateLoad(RethrowPtr));
- CGF.Builder.CreateUnreachable();
- CGF.EmitBlock(FinallyEnd);
+ llvm::Value *ExceptionObject = CGF.Builder.CreateLoad(RethrowPtr);
+ llvm::BasicBlock *UnwindBB = CGF.getInvokeDest();
+ if (!UnwindBB) {
+ CGF.Builder.CreateCall(RethrowFn, ExceptionObject);
+ // Exception always thrown, next instruction is never reached.
+ CGF.Builder.CreateUnreachable();
+ } else {
+ // If there is a @catch block outside this scope, we invoke instead of
+ // calling because we may return to this function. This is very slow, but
+ // some people still do it. It would be nice to add an optimised path for
+ // this.
+ CGF.Builder.CreateInvoke(RethrowFn, UnwindBB, UnwindBB, &ExceptionObject,
+ &ExceptionObject+1);
+ }
+ CGF.EmitBlock(FinallyEnd);
}
void CGObjCGNU::EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index fb920f0b09ee..727746fbbce7 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -1581,7 +1581,7 @@ CGObjCCommonMac::EmitLegacyMessageSend(CodeGen::CodeGenFunction &CGF,
assert(Fn && "EmitLegacyMessageSend - unknown API");
Fn = llvm::ConstantExpr::getBitCast(Fn,
llvm::PointerType::getUnqual(FTy));
- return CGF.EmitCall(FnInfo, Fn, ActualArgs);
+ return CGF.EmitCall(FnInfo, Fn, ReturnValueSlot(), ActualArgs);
}
llvm::Value *CGObjCMac::GenerateProtocolRef(CGBuilderTy &Builder,
@@ -3351,7 +3351,6 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout(
SkipScanIvars.push_back(SkScan);
}
- bool BytesSkipped = false;
if (!SkipIvars.empty()) {
unsigned int LastIndex = SkipIvars.size()-1;
int LastByteSkipped =
@@ -3360,9 +3359,8 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout(
int LastByteScanned =
IvarsInfo[LastIndex].ivar_bytepos +
IvarsInfo[LastIndex].ivar_size * WordSize;
- BytesSkipped = (LastByteSkipped > LastByteScanned);
// Compute number of bytes to skip at the tail end of the last ivar scanned.
- if (BytesSkipped) {
+ if (LastByteSkipped > LastByteScanned) {
unsigned int TotalWords = (LastByteSkipped + (WordSize -1)) / WordSize;
SKIP_SCAN SkScan;
SkScan.skip = TotalWords - (LastByteScanned/WordSize);
@@ -3393,8 +3391,6 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout(
unsigned int skip_big = SkipScanIvars[i].skip / 0xf;
unsigned int scan_big = SkipScanIvars[i].scan / 0xf;
- if (skip_small > 0 || skip_big > 0)
- BytesSkipped = true;
// first skip big.
for (unsigned int ix = 0; ix < skip_big; ix++)
BitMap += (unsigned char)(0xf0);
@@ -5169,7 +5165,7 @@ CodeGen::RValue CGObjCNonFragileABIMac::EmitMessageSend(
const llvm::FunctionType *FTy = Types.GetFunctionType(FnInfo1, true);
Callee = CGF.Builder.CreateBitCast(Callee,
llvm::PointerType::getUnqual(FTy));
- return CGF.EmitCall(FnInfo1, Callee, ActualArgs);
+ return CGF.EmitCall(FnInfo1, Callee, ReturnValueSlot(), ActualArgs);
}
/// Generate code for a message send expression in the nonfragile abi.
diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp
index 02de00e3d7da..db6c5075ede4 100644
--- a/lib/CodeGen/CGRTTI.cpp
+++ b/lib/CodeGen/CGRTTI.cpp
@@ -21,76 +21,48 @@ namespace {
class RTTIBuilder {
CodeGenModule &CGM; // Per-module state.
llvm::LLVMContext &VMContext;
+
const llvm::Type *Int8PtrTy;
- llvm::SmallSet<const CXXRecordDecl *, 16> SeenVBase;
- llvm::SmallSet<const CXXRecordDecl *, 32> SeenBase;
-
- // Type info flags.
- enum {
- /// TI_Const - Type has const qualifier.
- TI_Const = 0x1,
-
- /// TI_Volatile - Type has volatile qualifier.
- TI_Volatile = 0x2,
-
- /// TI_Restrict - Type has restrict qualifier.
- TI_Restrict = 0x4,
-
- /// TI_Incomplete - Type is incomplete.
- TI_Incomplete = 0x8,
+
+ /// Fields - The fields of the RTTI descriptor currently being built.
+ llvm::SmallVector<llvm::Constant *, 16> Fields;
- /// TI_ContainingClassIncomplete - Containing class is incomplete.
- /// (in pointer to member).
- TI_ContainingClassIncomplete = 0x10
- };
+ /// GetAddrOfExternalRTTIDescriptor - Returns the constant for the RTTI
+ /// descriptor of the given type.
+ llvm::Constant *GetAddrOfExternalRTTIDescriptor(QualType Ty);
+
+ /// BuildVtablePointer - Build the vtable pointer for the given type.
+ void BuildVtablePointer(const Type *Ty);
+
+ /// BuildSIClassTypeInfo - Build an abi::__si_class_type_info, used for single
+ /// inheritance, according to the Itanium C++ ABI, 2.9.5p6b.
+ void BuildSIClassTypeInfo(const CXXRecordDecl *RD);
+
+ /// BuildVMIClassTypeInfo - Build an abi::__vmi_class_type_info, used for
+ /// classes with bases that do not satisfy the abi::__si_class_type_info
+ /// constraints, according ti the Itanium C++ ABI, 2.9.5p5c.
+ void BuildVMIClassTypeInfo(const CXXRecordDecl *RD);
+
+ /// BuildPointerTypeInfo - Build an abi::__pointer_type_info struct, used
+ /// for pointer types.
+ void BuildPointerTypeInfo(const PointerType *Ty);
+
+ /// BuildPointerToMemberTypeInfo - Build an abi::__pointer_to_member_type_info
+ /// struct, used for member pointer types.
+ void BuildPointerToMemberTypeInfo(const MemberPointerType *Ty);
public:
RTTIBuilder(CodeGenModule &cgm)
: CGM(cgm), VMContext(cgm.getModule().getContext()),
Int8PtrTy(llvm::Type::getInt8PtrTy(VMContext)) { }
- /// BuildVtableRef - Build a reference to a vtable.
- llvm::Constant *BuildVtableRef(const char *Name) {
- // Build a descriptor for Name
- llvm::Constant *GV = CGM.getModule().getGlobalVariable(Name);
- if (GV)
- GV = llvm::ConstantExpr::getBitCast(GV,
- llvm::PointerType::get(Int8PtrTy, 0));
- else {
- llvm::GlobalVariable::LinkageTypes linktype;
- linktype = llvm::GlobalValue::ExternalLinkage;
- GV = new llvm::GlobalVariable(CGM.getModule(), Int8PtrTy,
- true, linktype, 0, Name);
- }
- llvm::Constant *C;
- C = llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext), 2);
- C = llvm::ConstantExpr::getInBoundsGetElementPtr(GV, &C, 1);
- return llvm::ConstantExpr::getBitCast(C, Int8PtrTy);
- }
-
- // FIXME: This should be removed, and clients should pass in the linkage
- // directly instead.
- static inline llvm::GlobalVariable::LinkageTypes
- GetLinkageFromExternFlag(bool Extern) {
- if (Extern)
- return llvm::GlobalValue::WeakODRLinkage;
-
- return llvm::GlobalValue::InternalLinkage;
- }
-
- // FIXME: This should be removed, and clients should pass in the linkage
- // directly instead.
- llvm::Constant *BuildName(QualType Ty, bool Hidden, bool Extern) {
- return BuildName(Ty, Hidden, GetLinkageFromExternFlag(Extern));
- }
-
llvm::Constant *BuildName(QualType Ty, bool Hidden,
llvm::GlobalVariable::LinkageTypes Linkage) {
llvm::SmallString<256> OutName;
CGM.getMangleContext().mangleCXXRTTIName(Ty, OutName);
llvm::StringRef Name = OutName.str();
- llvm::GlobalVariable *OGV = CGM.getModule().getGlobalVariable(Name);
+ llvm::GlobalVariable *OGV = CGM.getModule().getNamedGlobal(Name);
if (OGV && !OGV->isDeclaration())
return llvm::ConstantExpr::getBitCast(OGV, Int8PtrTy);
@@ -109,397 +81,789 @@ public:
if (Hidden)
GV->setVisibility(llvm::GlobalVariable::HiddenVisibility);
return llvm::ConstantExpr::getBitCast(GV, Int8PtrTy);
- };
-
- /// - BuildFlags - Build a psABI __flags value for __vmi_class_type_info.
- llvm::Constant *BuildFlags(int f) {
- return llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), f);
}
- /// BuildBaseCount - Build a psABI __base_count value for
- /// __vmi_class_type_info.
- llvm::Constant *BuildBaseCount(unsigned c) {
- return llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), c);
+ // FIXME: unify with DecideExtern
+ bool DecideHidden(QualType Ty) {
+ // For this type, see if all components are never hidden.
+ if (const MemberPointerType *MPT = Ty->getAs<MemberPointerType>())
+ return (DecideHidden(MPT->getPointeeType())
+ && DecideHidden(QualType(MPT->getClass(), 0)));
+ if (const PointerType *PT = Ty->getAs<PointerType>())
+ return DecideHidden(PT->getPointeeType());
+ if (const FunctionType *FT = Ty->getAs<FunctionType>()) {
+ if (DecideHidden(FT->getResultType()) == false)
+ return false;
+ if (const FunctionProtoType *FPT = Ty->getAs<FunctionProtoType>()) {
+ for (unsigned i = 0; i <FPT->getNumArgs(); ++i)
+ if (DecideHidden(FPT->getArgType(i)) == false)
+ return false;
+ for (unsigned i = 0; i <FPT->getNumExceptions(); ++i)
+ if (DecideHidden(FPT->getExceptionType(i)) == false)
+ return false;
+ return true;
+ }
+ }
+ if (const RecordType *RT = Ty->getAs<RecordType>())
+ if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl()))
+ return CGM.getDeclVisibilityMode(RD) == LangOptions::Hidden;
+ return false;
}
+
+ // Pointer type info flags.
+ enum {
+ /// PTI_Const - Type has const qualifier.
+ PTI_Const = 0x1,
+
+ /// PTI_Volatile - Type has volatile qualifier.
+ PTI_Volatile = 0x2,
+
+ /// PTI_Restrict - Type has restrict qualifier.
+ PTI_Restrict = 0x4,
+
+ /// PTI_Incomplete - Type is incomplete.
+ PTI_Incomplete = 0x8,
+
+ /// PTI_ContainingClassIncomplete - Containing class is incomplete.
+ /// (in pointer to member).
+ PTI_ContainingClassIncomplete = 0x10
+ };
+
+ // VMI type info flags.
+ enum {
+ /// VMI_NonDiamondRepeat - Class has non-diamond repeated inheritance.
+ VMI_NonDiamondRepeat = 0x1,
+
+ /// VMI_DiamondShaped - Class is diamond shaped.
+ VMI_DiamondShaped = 0x2
+ };
+
+ // Base class type info flags.
+ enum {
+ /// BCTI_Virtual - Base class is virtual.
+ BCTI_Virtual = 0x1,
+
+ /// BCTI_Public - Base class is public.
+ BCTI_Public = 0x2
+ };
+
+ /// BuildTypeInfo - Build the RTTI type info struct for the given type.
+ llvm::Constant *BuildTypeInfo(QualType Ty);
+};
+}
- llvm::Constant *BuildTypeRef(QualType Ty) {
- llvm::Constant *C;
-
- llvm::SmallString<256> OutName;
- CGM.getMangleContext().mangleCXXRTTI(Ty, OutName);
- llvm::StringRef Name = OutName.str();
-
- C = CGM.getModule().getGlobalVariable(Name);
- if (C)
- return llvm::ConstantExpr::getBitCast(C, Int8PtrTy);
-
- llvm::GlobalVariable::LinkageTypes linktype;
- linktype = llvm::GlobalValue::ExternalLinkage;;
+llvm::Constant *RTTIBuilder::GetAddrOfExternalRTTIDescriptor(QualType Ty) {
+ // Mangle the RTTI name.
+ llvm::SmallString<256> OutName;
+ CGM.getMangleContext().mangleCXXRTTI(Ty, OutName);
+ llvm::StringRef Name = OutName.str();
- C = new llvm::GlobalVariable(CGM.getModule(), Int8PtrTy, true, linktype,
- 0, Name);
- return llvm::ConstantExpr::getBitCast(C, Int8PtrTy);
+ // Look for an existing global.
+ llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(Name);
+
+ if (!GV) {
+ // Create a new global variable.
+ GV = new llvm::GlobalVariable(CGM.getModule(), Int8PtrTy, /*Constant=*/true,
+ llvm::GlobalValue::ExternalLinkage, 0, Name);
}
+
+ return llvm::ConstantExpr::getBitCast(GV, Int8PtrTy);
+}
- llvm::Constant *Buildclass_type_infoRef(const CXXRecordDecl *RD) {
- return BuildTypeRef(CGM.getContext().getTagDeclType(RD));
- }
+/// TypeInfoIsInStandardLibrary - Given a builtin type, returns whether the type
+/// info for that type is defined in the standard library.
+static bool TypeInfoIsInStandardLibrary(const BuiltinType *Ty) {
+ // Itanium C++ ABI 2.9.2:
+ // Basic type information (e.g. for "int", "bool", etc.) will be kept in
+ // the run-time support library. Specifically, the run-time support
+ // library should contain type_info objects for the types X, X* and
+ // X const*, for every X in: void, bool, wchar_t, char, unsigned char,
+ // signed char, short, unsigned short, int, unsigned int, long,
+ // unsigned long, long long, unsigned long long, float, double, long double,
+ // char16_t, char32_t, and the IEEE 754r decimal and half-precision
+ // floating point types.
+ switch (Ty->getKind()) {
+ case BuiltinType::Void:
+ case BuiltinType::Bool:
+ case BuiltinType::WChar:
+ case BuiltinType::Char_U:
+ case BuiltinType::Char_S:
+ case BuiltinType::UChar:
+ case BuiltinType::SChar:
+ case BuiltinType::Short:
+ case BuiltinType::UShort:
+ case BuiltinType::Int:
+ case BuiltinType::UInt:
+ case BuiltinType::Long:
+ case BuiltinType::ULong:
+ case BuiltinType::LongLong:
+ case BuiltinType::ULongLong:
+ case BuiltinType::Float:
+ case BuiltinType::Double:
+ case BuiltinType::LongDouble:
+ case BuiltinType::Char16:
+ case BuiltinType::Char32:
+ case BuiltinType::Int128:
+ case BuiltinType::UInt128:
+ return true;
+
+ case BuiltinType::Overload:
+ case BuiltinType::Dependent:
+ case BuiltinType::UndeducedAuto:
+ assert(false && "Should not see this type here!");
+
+ case BuiltinType::NullPtr:
+ assert(false && "FIXME: nullptr_t is not handled!");
- /// CalculateFlags - Calculate the flags for the __vmi_class_type_info
- /// datastructure. 1 for non-diamond repeated inheritance, 2 for a dimond
- /// shaped class.
- int CalculateFlags(const CXXRecordDecl*RD) {
- int flags = 0;
- if (SeenBase.count(RD))
- flags |= 1;
- else
- SeenBase.insert(RD);
- for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
- e = RD->bases_end(); i != e; ++i) {
- const CXXRecordDecl *Base =
- cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
- if (i->isVirtual()) {
- if (SeenVBase.count(Base))
- flags |= 2;
- else
- SeenVBase.insert(Base);
- }
- flags |= CalculateFlags(Base);
- }
- return flags;
+ case BuiltinType::ObjCId:
+ case BuiltinType::ObjCClass:
+ case BuiltinType::ObjCSel:
+ assert(false && "FIXME: Objective-C types are unsupported!");
}
+
+ // Silent gcc.
+ return false;
+}
- bool SimpleInheritance(const CXXRecordDecl *RD) {
- if (RD->getNumBases() != 1)
- return false;
- CXXRecordDecl::base_class_const_iterator i = RD->bases_begin();
- if (i->isVirtual())
- return false;
- if (i->getAccessSpecifier() != AS_public)
- return false;
+static bool TypeInfoIsInStandardLibrary(const PointerType *PointerTy) {
+ QualType PointeeTy = PointerTy->getPointeeType();
+ const BuiltinType *BuiltinTy = dyn_cast<BuiltinType>(PointeeTy);
+ if (!BuiltinTy)
+ return false;
+
+ // Check the qualifiers.
+ Qualifiers Quals = PointeeTy.getQualifiers();
+ Quals.removeConst();
+
+ if (!Quals.empty())
+ return false;
+
+ return TypeInfoIsInStandardLibrary(BuiltinTy);
+}
- const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
- const CXXRecordDecl *Base =
- cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
- if (Layout.getBaseClassOffset(Base) != 0)
+/// ShouldUseExternalRTTIDescriptor - Returns whether the type information for
+/// the given type exists somewhere else, and that we should not emit the typ
+/// information in this translation unit.
+bool ShouldUseExternalRTTIDescriptor(QualType Ty) {
+ // Type info for builtin types is defined in the standard library.
+ if (const BuiltinType *BuiltinTy = dyn_cast<BuiltinType>(Ty))
+ return TypeInfoIsInStandardLibrary(BuiltinTy);
+
+ // Type info for some pointer types to builtin types is defined in the
+ // standard library.
+ if (const PointerType *PointerTy = dyn_cast<PointerType>(Ty))
+ return TypeInfoIsInStandardLibrary(PointerTy);
+
+ if (const RecordType *RecordTy = dyn_cast<RecordType>(Ty)) {
+ const CXXRecordDecl *RD = cast<CXXRecordDecl>(RecordTy->getDecl());
+ if (!RD->isDynamicClass())
return false;
- return true;
- }
- llvm::Constant *finish(llvm::Constant *const *Values, unsigned NumValues,
- llvm::GlobalVariable *GV,
- llvm::StringRef Name, bool Hidden,
- llvm::GlobalVariable::LinkageTypes Linkage) {
- llvm::Constant *C =
- llvm::ConstantStruct::get(VMContext, Values, NumValues, /*Packed=*/false);
-
- llvm::GlobalVariable *OGV = GV;
- GV = new llvm::GlobalVariable(CGM.getModule(), C->getType(), true, Linkage,
- C, Name);
- if (OGV) {
- GV->takeName(OGV);
- llvm::Constant *NewPtr = llvm::ConstantExpr::getBitCast(GV,
- OGV->getType());
- OGV->replaceAllUsesWith(NewPtr);
- OGV->eraseFromParent();
+ // Get the key function.
+ const CXXMethodDecl *KeyFunction = RD->getASTContext().getKeyFunction(RD);
+ if (KeyFunction && !KeyFunction->getBody()) {
+ // The class has a key function, but it is not defined in this translation
+ // unit, so we should use the external descriptor for it.
+ return true;
}
- if (Hidden)
- GV->setVisibility(llvm::GlobalVariable::HiddenVisibility);
- return llvm::ConstantExpr::getBitCast(GV, Int8PtrTy);
}
+
+ return false;
+}
+/// IsIncompleteClassType - Returns whether the given record type is incomplete.
+static bool IsIncompleteClassType(const RecordType *RecordTy) {
+ return !RecordTy->getDecl()->isDefinition();
+}
+
+/// ContainsIncompleteClassType - Returns whether the given type contains an
+/// incomplete class type. This is true if
+///
+/// * The given type is an incomplete class type.
+/// * The given type is a pointer type whose pointee type contains an
+/// incomplete class type.
+/// * The given type is a member pointer type whose class is an incomplete
+/// class type.
+/// * The given type is a member pointer type whoise pointee type contains an
+/// incomplete class type.
+/// is an indirect or direct pointer to an incomplete class type.
+static bool ContainsIncompleteClassType(QualType Ty) {
+ if (const RecordType *RecordTy = dyn_cast<RecordType>(Ty)) {
+ if (IsIncompleteClassType(RecordTy))
+ return true;
+ }
+
+ if (const PointerType *PointerTy = dyn_cast<PointerType>(Ty))
+ return ContainsIncompleteClassType(PointerTy->getPointeeType());
+
+ if (const MemberPointerType *MemberPointerTy =
+ dyn_cast<MemberPointerType>(Ty)) {
+ // Check if the class type is incomplete.
+ const RecordType *ClassType = cast<RecordType>(MemberPointerTy->getClass());
+ if (IsIncompleteClassType(ClassType))
+ return true;
+
+ return ContainsIncompleteClassType(MemberPointerTy->getPointeeType());
+ }
+
+ return false;
+}
- llvm::Constant *
- Buildclass_type_info(const CXXRecordDecl *RD,
- llvm::GlobalVariable::LinkageTypes Linkage) {
- std::vector<llvm::Constant *> info;
- assert(info.empty() && "Info vector must be empty!");
+/// getTypeInfoLinkage - Return the linkage that the type info and type info
+/// name constants should have for the given type.
+static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(QualType Ty) {
+ // Itanium C++ ABI 2.9.5p7:
+ // In addition, it and all of the intermediate abi::__pointer_type_info
+ // structs in the chain down to the abi::__class_type_info for the
+ // incomplete class type must be prevented from resolving to the
+ // corresponding type_info structs for the complete class type, possibly
+ // by making them local static objects. Finally, a dummy class RTTI is
+ // generated for the incomplete type that will not resolve to the final
+ // complete class RTTI (because the latter need not exist), possibly by
+ // making it a local static object.
+ if (ContainsIncompleteClassType(Ty))
+ return llvm::GlobalValue::InternalLinkage;
+
+ switch (Ty->getTypeClass()) {
+ default:
+ // FIXME: We need to add code to handle all types.
+ assert(false && "Unhandled type!");
+ break;
+
+ case Type::Pointer: {
+ const PointerType *PointerTy = cast<PointerType>(Ty);
+
+ // If the pointee type has internal linkage, then the pointer type needs to
+ // have it as well.
+ if (getTypeInfoLinkage(PointerTy->getPointeeType()) ==
+ llvm::GlobalVariable::InternalLinkage)
+ return llvm::GlobalVariable::InternalLinkage;
- llvm::Constant *C;
+ return llvm::GlobalVariable::WeakODRLinkage;
+ }
- llvm::SmallString<256> OutName;
- CGM.getMangleContext().mangleCXXRTTI(CGM.getContext().getTagDeclType(RD),
- OutName);
- llvm::StringRef Name = OutName.str();
+ case Type::Enum: {
+ const EnumType *EnumTy = cast<EnumType>(Ty);
+ const EnumDecl *ED = EnumTy->getDecl();
+
+ // If we're in an anonymous namespace, then we always want internal linkage.
+ if (ED->isInAnonymousNamespace() || !ED->hasLinkage())
+ return llvm::GlobalVariable::InternalLinkage;
+
+ return llvm::GlobalValue::WeakODRLinkage;
+ }
- llvm::GlobalVariable *GV;
- GV = CGM.getModule().getGlobalVariable(Name);
- if (GV && !GV->isDeclaration())
- return llvm::ConstantExpr::getBitCast(GV, Int8PtrTy);
+ case Type::Record: {
+ const RecordType *RecordTy = cast<RecordType>(Ty);
+ const CXXRecordDecl *RD = cast<CXXRecordDecl>(RecordTy->getDecl());
// If we're in an anonymous namespace, then we always want internal linkage.
if (RD->isInAnonymousNamespace() || !RD->hasLinkage())
- Linkage = llvm::GlobalVariable::InternalLinkage;
+ return llvm::GlobalVariable::InternalLinkage;
- bool Hidden = CGM.getDeclVisibilityMode(RD) == LangOptions::Hidden;
-
- bool simple = false;
- if (RD->getNumBases() == 0)
- C = BuildVtableRef("_ZTVN10__cxxabiv117__class_type_infoE");
- else if (SimpleInheritance(RD)) {
- simple = true;
- C = BuildVtableRef("_ZTVN10__cxxabiv120__si_class_type_infoE");
- } else
- C = BuildVtableRef("_ZTVN10__cxxabiv121__vmi_class_type_infoE");
- info.push_back(C);
- info.push_back(BuildName(CGM.getContext().getTagDeclType(RD), Hidden,
- Linkage));
-
- // If we have no bases, there are no more fields.
- if (RD->getNumBases()) {
- if (!simple) {
- info.push_back(BuildFlags(CalculateFlags(RD)));
- info.push_back(BuildBaseCount(RD->getNumBases()));
- }
-
- const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
- for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
- e = RD->bases_end(); i != e; ++i) {
- const CXXRecordDecl *Base =
- cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
- info.push_back(CGM.GetAddrOfRTTI(Base));
- if (simple)
- break;
- int64_t offset;
- if (!i->isVirtual())
- offset = Layout.getBaseClassOffset(Base)/8;
- else
- offset = CGM.getVtableInfo().getVirtualBaseOffsetIndex(RD, Base);
- offset <<= 8;
- // Now set the flags.
- offset += i->isVirtual() ? 1 : 0;;
- offset += i->getAccessSpecifier() == AS_public ? 2 : 0;
- const llvm::Type *LongTy =
- CGM.getTypes().ConvertType(CGM.getContext().LongTy);
- C = llvm::ConstantInt::get(LongTy, offset);
- info.push_back(C);
- }
+ if (!RD->isDynamicClass())
+ return llvm::GlobalValue::WeakODRLinkage;
+
+ // Get the key function.
+ const CXXMethodDecl *KeyFunction = RD->getASTContext().getKeyFunction(RD);
+ if (!KeyFunction) {
+ // There is no key function, the RTTI descriptor is emitted with weak_odr
+ // linkage.
+ return llvm::GlobalValue::WeakODRLinkage;
}
- return finish(&info[0], info.size(), GV, Name, Hidden, Linkage);
- }
+ // If the key function is defined, but inlined, then the RTTI descriptor is
+ // emitted with weak_odr linkage.
+ const FunctionDecl* KeyFunctionDefinition;
+ KeyFunction->getBody(KeyFunctionDefinition);
- /// - BuildFlags - Build a __flags value for __pbase_type_info.
- llvm::Constant *BuildInt(unsigned n) {
- return llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), n);
+ if (KeyFunctionDefinition->isInlined())
+ return llvm::GlobalValue::WeakODRLinkage;
+
+ // Otherwise, the RTTI descriptor is emitted with external linkage.
+ return llvm::GlobalValue::ExternalLinkage;
}
- bool DecideExtern(QualType Ty) {
- // For this type, see if all components are never in an anonymous namespace.
- if (const MemberPointerType *MPT = Ty->getAs<MemberPointerType>())
- return (DecideExtern(MPT->getPointeeType())
- && DecideExtern(QualType(MPT->getClass(), 0)));
- if (const PointerType *PT = Ty->getAs<PointerType>())
- return DecideExtern(PT->getPointeeType());
- if (const RecordType *RT = Ty->getAs<RecordType>())
- if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl()))
- return !RD->isInAnonymousNamespace() && RD->hasLinkage();
- return true;
- }
+ case Type::Vector:
+ case Type::ExtVector:
+ case Type::Builtin:
+ return llvm::GlobalValue::WeakODRLinkage;
- bool DecideHidden(QualType Ty) {
- // For this type, see if all components are never hidden.
- if (const MemberPointerType *MPT = Ty->getAs<MemberPointerType>())
- return (DecideHidden(MPT->getPointeeType())
- && DecideHidden(QualType(MPT->getClass(), 0)));
- if (const PointerType *PT = Ty->getAs<PointerType>())
- return DecideHidden(PT->getPointeeType());
- if (const RecordType *RT = Ty->getAs<RecordType>())
- if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl()))
- return CGM.getDeclVisibilityMode(RD) == LangOptions::Hidden;
- return false;
- }
+ case Type::FunctionProto: {
+ const FunctionProtoType *FPT = cast<FunctionProtoType>(Ty);
- llvm::Constant *BuildPointerType(QualType Ty) {
- std::vector<llvm::Constant *> info;
- assert(info.empty() && "Info vector must be empty!");
+ // Check the return type.
+ if (getTypeInfoLinkage(FPT->getResultType()) ==
+ llvm::GlobalValue::InternalLinkage)
+ return llvm::GlobalValue::InternalLinkage;
+
+ // Check the parameter types.
+ for (unsigned i = 0; i != FPT->getNumArgs(); ++i) {
+ if (getTypeInfoLinkage(FPT->getArgType(i)) ==
+ llvm::GlobalValue::InternalLinkage)
+ return llvm::GlobalValue::InternalLinkage;
+ }
- llvm::Constant *C;
+ return llvm::GlobalValue::WeakODRLinkage;
+ }
+
+ case Type::ConstantArray:
+ case Type::IncompleteArray: {
+ const ArrayType *AT = cast<ArrayType>(Ty);
+
+ // Check the element type.
+ if (getTypeInfoLinkage(AT->getElementType()) ==
+ llvm::GlobalValue::InternalLinkage)
+ return llvm::GlobalValue::InternalLinkage;
+ }
- llvm::SmallString<256> OutName;
- CGM.getMangleContext().mangleCXXRTTI(Ty, OutName);
- llvm::StringRef Name = OutName.str();
+ }
- llvm::GlobalVariable *GV;
- GV = CGM.getModule().getGlobalVariable(Name);
- if (GV && !GV->isDeclaration())
- return llvm::ConstantExpr::getBitCast(GV, Int8PtrTy);
+ return llvm::GlobalValue::WeakODRLinkage;
+}
- bool Extern = DecideExtern(Ty);
- bool Hidden = DecideHidden(Ty);
+// CanUseSingleInheritance - Return whether the given record decl has a "single,
+// public, non-virtual base at offset zero (i.e. the derived class is dynamic
+// iff the base is)", according to Itanium C++ ABI, 2.95p6b.
+static bool CanUseSingleInheritance(const CXXRecordDecl *RD) {
+ // Check the number of bases.
+ if (RD->getNumBases() != 1)
+ return false;
+
+ // Get the base.
+ CXXRecordDecl::base_class_const_iterator Base = RD->bases_begin();
+
+ // Check that the base is not virtual.
+ if (Base->isVirtual())
+ return false;
+
+ // Check that the base is public.
+ if (Base->getAccessSpecifier() != AS_public)
+ return false;
+
+ // Check that the class is dynamic iff the base is.
+ const CXXRecordDecl *BaseDecl =
+ cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+ if (!BaseDecl->isEmpty() &&
+ BaseDecl->isDynamicClass() != RD->isDynamicClass())
+ return false;
+
+ return true;
+}
- const MemberPointerType *PtrMemTy = dyn_cast<MemberPointerType>(Ty);
- QualType PointeeTy;
-
- if (PtrMemTy)
- PointeeTy = PtrMemTy->getPointeeType();
- else
- PointeeTy = Ty->getPointeeType();
-
- if (PtrMemTy)
- C = BuildVtableRef("_ZTVN10__cxxabiv129__pointer_to_member_type_infoE");
- else
- C = BuildVtableRef("_ZTVN10__cxxabiv119__pointer_type_infoE");
-
- info.push_back(C);
- info.push_back(BuildName(Ty, Hidden, Extern));
- Qualifiers Q = PointeeTy.getQualifiers();
-
- PointeeTy =
- CGM.getContext().getCanonicalType(PointeeTy).getUnqualifiedType();
-
- unsigned Flags = 0;
- if (Q.hasConst())
- Flags |= TI_Const;
- if (Q.hasVolatile())
- Flags |= TI_Volatile;
- if (Q.hasRestrict())
- Flags |= TI_Restrict;
+void RTTIBuilder::BuildVtablePointer(const Type *Ty) {
+ const char *VtableName;
+
+ switch (Ty->getTypeClass()) {
+ default: assert(0 && "Unhandled type!");
+
+ // GCC treats vector types as fundamental types.
+ case Type::Vector:
+ case Type::ExtVector:
+ // abi::__fundamental_type_info.
+ VtableName = "_ZTVN10__cxxabiv123__fundamental_type_infoE";
+ break;
+
+ case Type::ConstantArray:
+ case Type::IncompleteArray:
+ // abi::__array_type_info.
+ VtableName = "_ZTVN10__cxxabiv117__array_type_infoE";
+ break;
+
+ case Type::FunctionNoProto:
+ case Type::FunctionProto:
+ // abi::__function_type_info.
+ VtableName = "_ZTVN10__cxxabiv120__function_type_infoE";
+ break;
+
+ case Type::Enum:
+ // abi::__enum_type_info.
+ VtableName = "_ZTVN10__cxxabiv116__enum_type_infoE";
+ break;
+
+ case Type::Record: {
+ const CXXRecordDecl *RD =
+ cast<CXXRecordDecl>(cast<RecordType>(Ty)->getDecl());
- if (Ty->isIncompleteType())
- Flags |= TI_Incomplete;
-
- if (PtrMemTy && PtrMemTy->getClass()->isIncompleteType())
- Flags |= TI_ContainingClassIncomplete;
+ if (!RD->getNumBases()) {
+ // abi::__class_type_info.
+ VtableName = "_ZTVN10__cxxabiv117__class_type_infoE";
+ } else if (CanUseSingleInheritance(RD)) {
+ // abi::__si_class_type_info.
+ VtableName = "_ZTVN10__cxxabiv120__si_class_type_infoE";
+ } else {
+ // abi::__vmi_class_type_info.
+ VtableName = "_ZTVN10__cxxabiv121__vmi_class_type_infoE";
+ }
- info.push_back(BuildInt(Flags));
- info.push_back(BuildInt(0));
- info.push_back(BuildType(PointeeTy));
+ break;
+ }
- if (PtrMemTy)
- info.push_back(BuildType(QualType(PtrMemTy->getClass(), 0)));
+ case Type::Pointer:
+ // abi::__pointer_type_info.
+ VtableName = "_ZTVN10__cxxabiv119__pointer_type_infoE";
+ break;
- // We always generate these as hidden, only the name isn't hidden.
- return finish(&info[0], info.size(), GV, Name, /*Hidden=*/true,
- GetLinkageFromExternFlag(Extern));
+ case Type::MemberPointer:
+ // abi::__pointer_to_member_type_info.
+ VtableName = "_ZTVN10__cxxabiv129__pointer_to_member_type_infoE";
+ break;
}
- llvm::Constant *BuildSimpleType(QualType Ty, const char *vtbl) {
- llvm::SmallString<256> OutName;
- CGM.getMangleContext().mangleCXXRTTI(Ty, OutName);
- llvm::StringRef Name = OutName.str();
+ llvm::Constant *Vtable =
+ CGM.getModule().getOrInsertGlobal(VtableName, Int8PtrTy);
+
+ const llvm::Type *PtrDiffTy =
+ CGM.getTypes().ConvertType(CGM.getContext().getPointerDiffType());
+
+ // The vtable address point is 2.
+ llvm::Constant *Two = llvm::ConstantInt::get(PtrDiffTy, 2);
+ Vtable = llvm::ConstantExpr::getInBoundsGetElementPtr(Vtable, &Two, 1);
+ Vtable = llvm::ConstantExpr::getBitCast(Vtable, Int8PtrTy);
- llvm::GlobalVariable *GV;
- GV = CGM.getModule().getGlobalVariable(Name);
- if (GV && !GV->isDeclaration())
- return llvm::ConstantExpr::getBitCast(GV, Int8PtrTy);
+ Fields.push_back(Vtable);
+}
- bool Extern = DecideExtern(Ty);
- bool Hidden = DecideHidden(Ty);
+llvm::Constant *RTTIBuilder::BuildTypeInfo(QualType Ty) {
+ // We want to operate on the canonical type.
+ Ty = CGM.getContext().getCanonicalType(Ty);
- llvm::Constant *Info[] = {
- BuildVtableRef(vtbl), BuildName(Ty, Hidden, Extern)
- };
+ // Check if we've already emitted an RTTI descriptor for this type.
+ llvm::SmallString<256> OutName;
+ CGM.getMangleContext().mangleCXXRTTI(Ty, OutName);
+ llvm::StringRef Name = OutName.str();
+
+ llvm::GlobalVariable *OldGV = CGM.getModule().getNamedGlobal(Name);
+ if (OldGV && !OldGV->isDeclaration())
+ return llvm::ConstantExpr::getBitCast(OldGV, Int8PtrTy);
+
+ // Check if there is already an external RTTI descriptor for this type.
+ if (ShouldUseExternalRTTIDescriptor(Ty))
+ return GetAddrOfExternalRTTIDescriptor(Ty);
+
+ llvm::GlobalVariable::LinkageTypes Linkage = getTypeInfoLinkage(Ty);
+
+ // Add the vtable pointer.
+ BuildVtablePointer(cast<Type>(Ty));
+
+ // And the name.
+ Fields.push_back(BuildName(Ty, DecideHidden(Ty), Linkage));
+
+ switch (Ty->getTypeClass()) {
+ default: assert(false && "Unhandled type class!");
+ case Type::Builtin:
+ assert(false && "Builtin type info must be in the standard library!");
+ break;
+
+ // GCC treats vector types as fundamental types.
+ case Type::Vector:
+ case Type::ExtVector:
+ // Itanium C++ ABI 2.9.5p4:
+ // abi::__fundamental_type_info adds no data members to std::type_info.
+ break;
+
+ case Type::ConstantArray:
+ case Type::IncompleteArray:
+ // Itanium C++ ABI 2.9.5p5:
+ // abi::__array_type_info adds no data members to std::type_info.
+ break;
+
+ case Type::FunctionNoProto:
+ case Type::FunctionProto:
+ // Itanium C++ ABI 2.9.5p5:
+ // abi::__function_type_info adds no data members to std::type_info.
+ break;
+
+ case Type::Enum:
+ // Itanium C++ ABI 2.9.5p5:
+ // abi::__enum_type_info adds no data members to std::type_info.
+ break;
+
+ case Type::Record: {
+ const CXXRecordDecl *RD =
+ cast<CXXRecordDecl>(cast<RecordType>(Ty)->getDecl());
+ if (!RD->getNumBases()) {
+ // We don't need to emit any fields.
+ break;
+ }
- // We always generate these as hidden, only the name isn't hidden.
- return finish(&Info[0], llvm::array_lengthof(Info), GV, Name,
- /*Hidden=*/true, GetLinkageFromExternFlag(Extern));
+ if (CanUseSingleInheritance(RD))
+ BuildSIClassTypeInfo(RD);
+ else
+ BuildVMIClassTypeInfo(RD);
+
+ break;
+ }
+
+ case Type::Pointer:
+ BuildPointerTypeInfo(cast<PointerType>(Ty));
+ break;
+
+ case Type::MemberPointer:
+ BuildPointerToMemberTypeInfo(cast<MemberPointerType>(Ty));
+ break;
}
- /// BuildType - Builds the type info for the given type.
- llvm::Constant *BuildType(QualType Ty) {
- const clang::Type &Type
- = *CGM.getContext().getCanonicalType(Ty).getTypePtr();
+ llvm::Constant *Init =
+ llvm::ConstantStruct::get(VMContext, &Fields[0], Fields.size(),
+ /*Packed=*/false);
- if (const RecordType *RT = Ty.getTypePtr()->getAs<RecordType>())
- if (const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl()))
- return BuildClassTypeInfo(RD);
+ llvm::GlobalVariable *GV =
+ new llvm::GlobalVariable(CGM.getModule(), Init->getType(),
+ /*Constant=*/true, Linkage, Init, Name);
+
+ // If there's already an old global variable, replace it with the new one.
+ if (OldGV) {
+ GV->takeName(OldGV);
+ llvm::Constant *NewPtr =
+ llvm::ConstantExpr::getBitCast(GV, OldGV->getType());
+ OldGV->replaceAllUsesWith(NewPtr);
+ OldGV->eraseFromParent();
+ }
+
+ return llvm::ConstantExpr::getBitCast(GV, Int8PtrTy);
+}
- switch (Type.getTypeClass()) {
- default: {
- assert(0 && "typeid expression");
- return llvm::Constant::getNullValue(Int8PtrTy);
- }
+/// ComputeQualifierFlags - Compute the pointer type info flags from the
+/// given qualifier.
+static unsigned ComputeQualifierFlags(Qualifiers Quals) {
+ unsigned Flags = 0;
- case Type::Builtin: {
- // We expect all type_info objects for builtin types to be in the library.
- return BuildTypeRef(Ty);
- }
+ if (Quals.hasConst())
+ Flags |= RTTIBuilder::PTI_Const;
+ if (Quals.hasVolatile())
+ Flags |= RTTIBuilder::PTI_Volatile;
+ if (Quals.hasRestrict())
+ Flags |= RTTIBuilder::PTI_Restrict;
+
+ return Flags;
+}
- case Type::Pointer: {
- QualType PTy = Ty->getPointeeType();
- Qualifiers Q = PTy.getQualifiers();
- Q.removeConst();
- // T* and const T* for all builtin types T are expected in the library.
- if (isa<BuiltinType>(PTy) && Q.empty())
- return BuildTypeRef(Ty);
+/// BuildSIClassTypeInfo - Build an abi::__si_class_type_info, used for single
+/// inheritance, according to the Itanium C++ ABI, 2.95p6b.
+void RTTIBuilder::BuildSIClassTypeInfo(const CXXRecordDecl *RD) {
+ // Itanium C++ ABI 2.9.5p6b:
+ // It adds to abi::__class_type_info a single member pointing to the
+ // type_info structure for the base type,
+ llvm::Constant *BaseTypeInfo =
+ RTTIBuilder(CGM).BuildTypeInfo(RD->bases_begin()->getType());
+ Fields.push_back(BaseTypeInfo);
+}
+
+/// SeenBases - Contains virtual and non-virtual bases seen when traversing
+/// a class hierarchy.
+struct SeenBases {
+ llvm::SmallPtrSet<const CXXRecordDecl *, 16> NonVirtualBases;
+ llvm::SmallPtrSet<const CXXRecordDecl *, 16> VirtualBases;
+};
- return BuildPointerType(Ty);
+/// ComputeVMIClassTypeInfoFlags - Compute the value of the flags member in
+/// abi::__vmi_class_type_info.
+///
+static unsigned ComputeVMIClassTypeInfoFlags(const CXXBaseSpecifier *Base,
+ SeenBases &Bases) {
+
+ unsigned Flags = 0;
+
+ const CXXRecordDecl *BaseDecl =
+ cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+
+ if (Base->isVirtual()) {
+ if (Bases.VirtualBases.count(BaseDecl)) {
+ // If this virtual base has been seen before, then the class is diamond
+ // shaped.
+ Flags |= RTTIBuilder::VMI_DiamondShaped;
+ } else {
+ if (Bases.NonVirtualBases.count(BaseDecl))
+ Flags |= RTTIBuilder::VMI_NonDiamondRepeat;
+
+ // Mark the virtual base as seen.
+ Bases.VirtualBases.insert(BaseDecl);
}
- case Type::MemberPointer:
- return BuildPointerType(Ty);
- case Type::FunctionProto:
- case Type::FunctionNoProto:
- return BuildSimpleType(Ty, "_ZTVN10__cxxabiv120__function_type_infoE");
- case Type::ConstantArray:
- case Type::IncompleteArray:
- case Type::VariableArray:
- case Type::Vector:
- case Type::ExtVector:
- return BuildSimpleType(Ty, "_ZTVN10__cxxabiv117__array_type_infoE");
- case Type::Enum:
- return BuildSimpleType(Ty, "_ZTVN10__cxxabiv116__enum_type_infoE");
+ } else {
+ if (Bases.NonVirtualBases.count(BaseDecl)) {
+ // If this non-virtual base has been seen before, then the class has non-
+ // diamond shaped repeated inheritance.
+ Flags |= RTTIBuilder::VMI_NonDiamondRepeat;
+ } else {
+ if (Bases.VirtualBases.count(BaseDecl))
+ Flags |= RTTIBuilder::VMI_NonDiamondRepeat;
+
+ // Mark the non-virtual base as seen.
+ Bases.NonVirtualBases.insert(BaseDecl);
}
}
+
+ // Walk all bases.
+ for (CXXRecordDecl::base_class_const_iterator I = BaseDecl->bases_begin(),
+ E = BaseDecl->bases_end(); I != E; ++I)
+ Flags |= ComputeVMIClassTypeInfoFlags(I, Bases);
- /// BuildClassTypeInfo - Builds the class type info (or a reference to it)
- /// for the given record decl.
- llvm::Constant *BuildClassTypeInfo(const CXXRecordDecl *RD) {
- const CXXMethodDecl *KeyFunction = 0;
+ return Flags;
+}
- if (RD->isDynamicClass())
- KeyFunction = CGM.getContext().getKeyFunction(RD);
+static unsigned ComputeVMIClassTypeInfoFlags(const CXXRecordDecl *RD) {
+ unsigned Flags = 0;
+ SeenBases Bases;
+
+ // Walk all bases.
+ for (CXXRecordDecl::base_class_const_iterator I = RD->bases_begin(),
+ E = RD->bases_end(); I != E; ++I)
+ Flags |= ComputeVMIClassTypeInfoFlags(I, Bases);
+
+ return Flags;
+}
+
+/// BuildVMIClassTypeInfo - Build an abi::__vmi_class_type_info, used for
+/// classes with bases that do not satisfy the abi::__si_class_type_info
+/// constraints, according ti the Itanium C++ ABI, 2.9.5p5c.
+void RTTIBuilder::BuildVMIClassTypeInfo(const CXXRecordDecl *RD) {
+ const llvm::Type *UnsignedIntLTy =
+ CGM.getTypes().ConvertType(CGM.getContext().UnsignedIntTy);
+
+ // Itanium C++ ABI 2.9.5p6c:
+ // __flags is a word with flags describing details about the class
+ // structure, which may be referenced by using the __flags_masks
+ // enumeration. These flags refer to both direct and indirect bases.
+ unsigned Flags = ComputeVMIClassTypeInfoFlags(RD);
+ Fields.push_back(llvm::ConstantInt::get(UnsignedIntLTy, Flags));
+
+ // Itanium C++ ABI 2.9.5p6c:
+ // __base_count is a word with the number of direct proper base class
+ // descriptions that follow.
+ Fields.push_back(llvm::ConstantInt::get(UnsignedIntLTy, RD->getNumBases()));
+
+ if (!RD->getNumBases())
+ return;
+
+ const llvm::Type *LongLTy =
+ CGM.getTypes().ConvertType(CGM.getContext().LongTy);
+
+ // Now add the base class descriptions.
+
+ // Itanium C++ ABI 2.9.5p6c:
+ // __base_info[] is an array of base class descriptions -- one for every
+ // direct proper base. Each description is of the type:
+ //
+ // struct abi::__base_class_type_info {
+ // public:
+ // const __class_type_info *__base_type;
+ // long __offset_flags;
+ //
+ // enum __offset_flags_masks {
+ // __virtual_mask = 0x1,
+ // __public_mask = 0x2,
+ // __offset_shift = 8
+ // };
+ // };
+ for (CXXRecordDecl::base_class_const_iterator I = RD->bases_begin(),
+ E = RD->bases_end(); I != E; ++I) {
+ const CXXBaseSpecifier *Base = I;
+
+ // The __base_type member points to the RTTI for the base type.
+ Fields.push_back(RTTIBuilder(CGM).BuildTypeInfo(Base->getType()));
+
+ const CXXRecordDecl *BaseDecl =
+ cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+
+ int64_t OffsetFlags = 0;
- if (KeyFunction) {
- // If the key function is defined in this translation unit, then the RTTI
- // related constants should also be emitted here, with external linkage.
- if (KeyFunction->getBody())
- return Buildclass_type_info(RD, llvm::GlobalValue::ExternalLinkage);
-
- // Otherwise, we just want a reference to the type info.
- return Buildclass_type_infoRef(RD);
- }
+ // All but the lower 8 bits of __offset_flags are a signed offset.
+ // For a non-virtual base, this is the offset in the object of the base
+ // subobject. For a virtual base, this is the offset in the virtual table of
+ // the virtual base offset for the virtual base referenced (negative).
+ if (Base->isVirtual())
+ OffsetFlags = CGM.getVtableInfo().getVirtualBaseOffsetIndex(RD, BaseDecl);
+ else {
+ const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
+ OffsetFlags = Layout.getBaseClassOffset(BaseDecl) / 8;
+ };
+
+ OffsetFlags <<= 8;
- // If there is no key function (or if the record doesn't have any virtual
- // member functions or virtual bases), emit the type info with weak_odr
- // linkage.
- return Buildclass_type_info(RD, llvm::GlobalValue::WeakODRLinkage);
+ // The low-order byte of __offset_flags contains flags, as given by the
+ // masks from the enumeration __offset_flags_masks.
+ if (Base->isVirtual())
+ OffsetFlags |= BCTI_Virtual;
+ if (Base->getAccessSpecifier() == AS_public)
+ OffsetFlags |= BCTI_Public;
+
+ Fields.push_back(llvm::ConstantInt::get(LongLTy, OffsetFlags));
}
-};
}
-llvm::Constant *CodeGenModule::GetAddrOfRTTI(const CXXRecordDecl *RD) {
- if (!getContext().getLangOptions().RTTI) {
- const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(VMContext);
- return llvm::Constant::getNullValue(Int8PtrTy);
- }
+/// BuildPointerTypeInfo - Build an abi::__pointer_type_info struct,
+/// used for pointer types.
+void RTTIBuilder::BuildPointerTypeInfo(const PointerType *Ty) {
+ QualType PointeeTy = Ty->getPointeeType();
- return RTTIBuilder(*this).BuildClassTypeInfo(RD);
-}
-
-llvm::Constant *CodeGenModule::GetAddrOfRTTI(QualType Ty) {
- if (!getContext().getLangOptions().RTTI) {
- const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(VMContext);
- return llvm::Constant::getNullValue(Int8PtrTy);
- }
+ // Itanium C++ ABI 2.9.5p7:
+ // __flags is a flag word describing the cv-qualification and other
+ // attributes of the type pointed to
+ unsigned Flags = ComputeQualifierFlags(PointeeTy.getQualifiers());
+
+ // Itanium C++ ABI 2.9.5p7:
+ // When the abi::__pbase_type_info is for a direct or indirect pointer to an
+ // incomplete class type, the incomplete target type flag is set.
+ if (ContainsIncompleteClassType(PointeeTy))
+ Flags |= PTI_Incomplete;
+
+ const llvm::Type *UnsignedIntLTy =
+ CGM.getTypes().ConvertType(CGM.getContext().UnsignedIntTy);
+ Fields.push_back(llvm::ConstantInt::get(UnsignedIntLTy, Flags));
- return RTTIBuilder(*this).BuildType(Ty);
+ // Itanium C++ ABI 2.9.5p7:
+ // __pointee is a pointer to the std::type_info derivation for the
+ // unqualified type being pointed to.
+ llvm::Constant *PointeeTypeInfo =
+ RTTIBuilder(CGM).BuildTypeInfo(PointeeTy.getUnqualifiedType());
+ Fields.push_back(PointeeTypeInfo);
}
-llvm::Constant *CodeGenModule::GenerateRTTIRef(const CXXRecordDecl *RD) {
- RTTIBuilder b(*this);
+/// BuildPointerToMemberTypeInfo - Build an abi::__pointer_to_member_type_info
+/// struct, used for member pointer types.
+void RTTIBuilder::BuildPointerToMemberTypeInfo(const MemberPointerType *Ty) {
+ QualType PointeeTy = Ty->getPointeeType();
+
+ // Itanium C++ ABI 2.9.5p7:
+ // __flags is a flag word describing the cv-qualification and other
+ // attributes of the type pointed to.
+ unsigned Flags = ComputeQualifierFlags(PointeeTy.getQualifiers());
- return b.Buildclass_type_infoRef(RD);
-}
+ const RecordType *ClassType = cast<RecordType>(Ty->getClass());
-llvm::Constant *CodeGenModule::GenerateRTTI(const CXXRecordDecl *RD) {
- RTTIBuilder b(*this);
+ // Itanium C++ ABI 2.9.5p7:
+ // When the abi::__pbase_type_info is for a direct or indirect pointer to an
+ // incomplete class type, the incomplete target type flag is set.
+ if (ContainsIncompleteClassType(PointeeTy))
+ Flags |= PTI_Incomplete;
- return b.Buildclass_type_info(RD, llvm::GlobalValue::ExternalLinkage);
+ if (IsIncompleteClassType(ClassType))
+ Flags |= PTI_ContainingClassIncomplete;
+
+ const llvm::Type *UnsignedIntLTy =
+ CGM.getTypes().ConvertType(CGM.getContext().UnsignedIntTy);
+ Fields.push_back(llvm::ConstantInt::get(UnsignedIntLTy, Flags));
+
+ // Itanium C++ ABI 2.9.5p7:
+ // __pointee is a pointer to the std::type_info derivation for the
+ // unqualified type being pointed to.
+ llvm::Constant *PointeeTypeInfo =
+ RTTIBuilder(CGM).BuildTypeInfo(PointeeTy.getUnqualifiedType());
+ Fields.push_back(PointeeTypeInfo);
+
+ // Itanium C++ ABI 2.9.5p9:
+ // __context is a pointer to an abi::__class_type_info corresponding to the
+ // class type containing the member pointed to
+ // (e.g., the "A" in "int A::*").
+ Fields.push_back(RTTIBuilder(CGM).BuildTypeInfo(QualType(ClassType, 0)));
}
-llvm::Constant *CodeGenModule::GenerateRTTI(QualType Ty) {
- RTTIBuilder b(*this);
-
- return b.BuildType(Ty);
+llvm::Constant *CodeGenModule::GetAddrOfRTTIDescriptor(QualType Ty) {
+ if (!getContext().getLangOptions().RTTI) {
+ const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(VMContext);
+ return llvm::Constant::getNullValue(Int8PtrTy);
+ }
+
+ return RTTIBuilder(*this).BuildTypeInfo(Ty);
}
diff --git a/lib/CodeGen/CGRecordLayoutBuilder.cpp b/lib/CodeGen/CGRecordLayoutBuilder.cpp
index 31784eda5a6b..9f90ec5ff6e0 100644
--- a/lib/CodeGen/CGRecordLayoutBuilder.cpp
+++ b/lib/CodeGen/CGRecordLayoutBuilder.cpp
@@ -216,12 +216,28 @@ void CGRecordLayoutBuilder::LayoutUnion(const RecordDecl *D) {
AppendPadding(Layout.getSize() / 8, Align);
}
+void CGRecordLayoutBuilder::LayoutBases(const CXXRecordDecl *RD,
+ const ASTRecordLayout &Layout) {
+ // Check if we need to add a vtable pointer.
+ if (RD->isDynamicClass() && !Layout.getPrimaryBase()) {
+ const llvm::Type *Int8PtrTy =
+ llvm::Type::getInt8PtrTy(Types.getLLVMContext());
+
+ assert(NextFieldOffsetInBytes == 0 &&
+ "Vtable pointer must come first!");
+ AppendField(NextFieldOffsetInBytes, Int8PtrTy->getPointerTo());
+ }
+}
+
bool CGRecordLayoutBuilder::LayoutFields(const RecordDecl *D) {
assert(!D->isUnion() && "Can't call LayoutFields on a union!");
assert(Alignment && "Did not set alignment!");
const ASTRecordLayout &Layout = Types.getContext().getASTRecordLayout(D);
+ if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D))
+ LayoutBases(RD, Layout);
+
unsigned FieldNo = 0;
for (RecordDecl::field_iterator Field = D->field_begin(),
diff --git a/lib/CodeGen/CGRecordLayoutBuilder.h b/lib/CodeGen/CGRecordLayoutBuilder.h
index 4ebf4e88decb..cf84053e1907 100644
--- a/lib/CodeGen/CGRecordLayoutBuilder.h
+++ b/lib/CodeGen/CGRecordLayoutBuilder.h
@@ -23,6 +23,8 @@ namespace llvm {
}
namespace clang {
+ class ASTRecordLayout;
+ class CXXRecordDecl;
class FieldDecl;
class RecordDecl;
@@ -90,6 +92,9 @@ class CGRecordLayoutBuilder {
/// Returns false if the operation failed because the struct is not packed.
bool LayoutFields(const RecordDecl *D);
+ /// LayoutBases - layout the bases and vtable pointer of a record decl.
+ void LayoutBases(const CXXRecordDecl *RD, const ASTRecordLayout &Layout);
+
/// LayoutField - layout a single field. Returns false if the operation failed
/// because the current struct is not packed.
bool LayoutField(const FieldDecl *D, uint64_t FieldOffset);
diff --git a/lib/CodeGen/CGTemporaries.cpp b/lib/CodeGen/CGTemporaries.cpp
index 5cfc7efade42..bed843966e62 100644
--- a/lib/CodeGen/CGTemporaries.cpp
+++ b/lib/CodeGen/CGTemporaries.cpp
@@ -17,6 +17,10 @@ using namespace CodeGen;
void CodeGenFunction::PushCXXTemporary(const CXXTemporary *Temporary,
llvm::Value *Ptr) {
+ assert((LiveTemporaries.empty() ||
+ LiveTemporaries.back().ThisPtr != Ptr ||
+ ConditionalBranchLevel) &&
+ "Pushed the same temporary twice; AST is likely wrong");
llvm::BasicBlock *DtorBlock = createBasicBlock("temp.dtor");
llvm::Value *CondPtr = 0;
@@ -41,6 +45,33 @@ void CodeGenFunction::PushCXXTemporary(const CXXTemporary *Temporary,
CondPtr));
PushCleanupBlock(DtorBlock);
+
+ if (Exceptions) {
+ const CXXLiveTemporaryInfo& Info = LiveTemporaries.back();
+ llvm::BasicBlock *CondEnd = 0;
+
+ EHCleanupBlock Cleanup(*this);
+
+ // If this is a conditional temporary, we need to check the condition
+ // boolean and only call the destructor if it's true.
+ if (Info.CondPtr) {
+ llvm::BasicBlock *CondBlock = createBasicBlock("cond.dtor.call");
+ CondEnd = createBasicBlock("cond.dtor.end");
+
+ llvm::Value *Cond = Builder.CreateLoad(Info.CondPtr);
+ Builder.CreateCondBr(Cond, CondBlock, CondEnd);
+ EmitBlock(CondBlock);
+ }
+
+ EmitCXXDestructorCall(Info.Temporary->getDestructor(),
+ Dtor_Complete, Info.ThisPtr);
+
+ if (CondEnd) {
+ // Reset the condition. to false.
+ Builder.CreateStore(llvm::ConstantInt::getFalse(VMContext), Info.CondPtr);
+ EmitBlock(CondEnd);
+ }
+ }
}
void CodeGenFunction::PopCXXTemporary() {
@@ -92,12 +123,6 @@ CodeGenFunction::EmitCXXExprWithTemporaries(const CXXExprWithTemporaries *E,
llvm::Value *AggLoc,
bool IsAggLocVolatile,
bool IsInitializer) {
- // If we shouldn't destroy the temporaries, just emit the
- // child expression.
- if (!E->shouldDestroyTemporaries())
- return EmitAnyExpr(E->getSubExpr(), AggLoc, IsAggLocVolatile,
- /*IgnoreResult=*/false, IsInitializer);
-
// Keep track of the current cleanup stack depth.
size_t CleanupStackDepth = CleanupEntries.size();
(void) CleanupStackDepth;
@@ -119,11 +144,6 @@ CodeGenFunction::EmitCXXExprWithTemporaries(const CXXExprWithTemporaries *E,
LValue CodeGenFunction::EmitCXXExprWithTemporariesLValue(
const CXXExprWithTemporaries *E) {
- // If we shouldn't destroy the temporaries, just emit the
- // child expression.
- if (!E->shouldDestroyTemporaries())
- return EmitLValue(E->getSubExpr());
-
// Keep track of the current cleanup stack depth.
size_t CleanupStackDepth = CleanupEntries.size();
(void) CleanupStackDepth;
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index 5283ed9366c3..7930f7186da5 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -202,8 +202,10 @@ public:
Extern(!l->isInAnonymousNamespace()),
LLVMPointerWidth(cgm.getContext().Target.getPointerWidth(0)) {
Ptr8Ty = llvm::PointerType::get(llvm::Type::getInt8Ty(VMContext), 0);
- if (BuildVtable)
- rtti = CGM.GetAddrOfRTTI(MostDerivedClass);
+ if (BuildVtable) {
+ QualType ClassType = CGM.getContext().getTagDeclType(MostDerivedClass);
+ rtti = CGM.GetAddrOfRTTIDescriptor(ClassType);
+ }
}
// getVtableComponents - Returns a reference to the vtable components.
@@ -481,13 +483,13 @@ public:
}
- Index_t FinishGenerateVtable(const CXXRecordDecl *RD,
- const ASTRecordLayout &Layout,
- const CXXRecordDecl *PrimaryBase,
- bool PrimaryBaseWasVirtual,
- bool MorallyVirtual, int64_t Offset,
- bool ForVirtualBase, int64_t CurrentVBaseOffset,
- Path_t *Path) {
+ void FinishGenerateVtable(const CXXRecordDecl *RD,
+ const ASTRecordLayout &Layout,
+ const CXXRecordDecl *PrimaryBase,
+ bool PrimaryBaseWasVirtual,
+ bool MorallyVirtual, int64_t Offset,
+ bool ForVirtualBase, int64_t CurrentVBaseOffset,
+ Path_t *Path) {
bool alloc = false;
if (Path == 0) {
alloc = true;
@@ -535,7 +537,6 @@ public:
if (alloc) {
delete Path;
}
- return AddressPoint;
}
void Primaries(const CXXRecordDecl *RD, bool MorallyVirtual, int64_t Offset,
@@ -600,19 +601,19 @@ public:
}
}
- int64_t GenerateVtableForBase(const CXXRecordDecl *RD, int64_t Offset = 0,
- bool MorallyVirtual = false,
- bool ForVirtualBase = false,
- int CurrentVBaseOffset = 0,
- Path_t *Path = 0) {
+ void GenerateVtableForBase(const CXXRecordDecl *RD, int64_t Offset = 0,
+ bool MorallyVirtual = false,
+ bool ForVirtualBase = false,
+ int CurrentVBaseOffset = 0,
+ Path_t *Path = 0) {
if (!RD->isDynamicClass())
- return 0;
+ return;
// Construction vtable don't need parts that have no virtual bases and
// aren't morally virtual.
if ((LayoutClass != MostDerivedClass) &&
RD->getNumVBases() == 0 && !MorallyVirtual)
- return 0;
+ return;
const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
@@ -631,9 +632,9 @@ public:
if (Path)
OverrideMethods(Path, MorallyVirtual, Offset, CurrentVBaseOffset);
- return FinishGenerateVtable(RD, Layout, PrimaryBase, PrimaryBaseWasVirtual,
- MorallyVirtual, Offset, ForVirtualBase,
- CurrentVBaseOffset, Path);
+ FinishGenerateVtable(RD, Layout, PrimaryBase, PrimaryBaseWasVirtual,
+ MorallyVirtual, Offset, ForVirtualBase,
+ CurrentVBaseOffset, Path);
}
void GenerateVtableForVBases(const CXXRecordDecl *RD,
@@ -751,10 +752,10 @@ TypeConversionRequiresAdjustment(ASTContext &Ctx,
}
const CXXRecordDecl *DerivedDecl =
- cast<CXXRecordDecl>(cast<RecordType>(CanDerivedType)->getDecl());
+ cast<CXXRecordDecl>(cast<RecordType>(CanDerivedType)->getDecl());
const CXXRecordDecl *BaseDecl =
- cast<CXXRecordDecl>(cast<RecordType>(CanBaseType)->getDecl());
+ cast<CXXRecordDecl>(cast<RecordType>(CanBaseType)->getDecl());
return TypeConversionRequiresAdjustment(Ctx, DerivedDecl, BaseDecl);
}
@@ -1156,22 +1157,13 @@ CGVtableInfo::GenerateVtable(llvm::GlobalVariable::LinkageTypes Linkage,
CGM.getMangleContext().mangleCXXVtable(RD, OutName);
llvm::StringRef Name = OutName.str();
- int64_t AddressPoint;
-
llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name);
- if (GV && CGM.AddressPoints[LayoutClass] && !GV->isDeclaration()) {
- AddressPoint=(*(*(CGM.AddressPoints[LayoutClass]))[RD])[std::make_pair(RD,
- Offset)];
- // FIXME: We can never have 0 address point. Do this for now so gepping
- // retains the same structure. Later, we'll just assert.
- if (AddressPoint == 0)
- AddressPoint = 1;
- } else {
+ if (GV == 0 || CGM.AddressPoints[LayoutClass] == 0 || GV->isDeclaration()) {
VtableBuilder b(RD, LayoutClass, Offset, CGM, GenerateDefinition);
D1(printf("vtable %s\n", RD->getNameAsCString()));
// First comes the vtables for all the non-virtual bases...
- AddressPoint = b.GenerateVtableForBase(RD, Offset);
+ b.GenerateVtableForBase(RD, Offset);
// then the vtables for all the virtual bases.
b.GenerateVtableForVBases(RD, Offset);
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 28df9e4d7861..f904f043caa4 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -331,7 +331,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD,
if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(FD)) {
// FIXME: For C++0x, we want to look for implicit *definitions* of
// these special member functions, rather than implicit *declarations*.
- if (CD->isCopyConstructor(getContext())) {
+ if (CD->isCopyConstructor()) {
assert(!ClassDecl->hasUserDeclaredCopyConstructor() &&
"Cannot synthesize a non-implicit copy constructor");
SynthesizeCXXCopyConstructor(CD, GD.getCtorType(), Fn, Args);
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index 12e636c89702..273ddcac7976 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -515,6 +515,12 @@ public:
void InitializeVtablePtrs(const CXXRecordDecl *ClassDecl);
+ void InitializeVtablePtrsRecursive(const CXXRecordDecl *ClassDecl,
+ llvm::Constant *Vtable,
+ CodeGenModule::AddrSubMap_t& AddressPoints,
+ llvm::Value *ThisPtr,
+ uint64_t Offset);
+
void SynthesizeCXXCopyConstructor(const CXXConstructorDecl *Ctor,
CXXCtorType Type,
llvm::Function *Fn,
@@ -807,6 +813,8 @@ public:
llvm::Value* EmitCXXTypeidExpr(const CXXTypeidExpr *E);
llvm::Value *EmitDynamicCast(llvm::Value *V, const CXXDynamicCastExpr *DCE);
+ void EmitCheck(llvm::Value *, unsigned Size);
+
//===--------------------------------------------------------------------===//
// Declaration Emission
//===--------------------------------------------------------------------===//
@@ -921,6 +929,12 @@ public:
///
LValue EmitLValue(const Expr *E);
+ /// EmitCheckedLValue - Same as EmitLValue but additionally we generate
+ /// checking code to guard against undefined behavior. This is only
+ /// suitable when we know that the address will be used to access the
+ /// object.
+ LValue EmitCheckedLValue(const Expr *E);
+
/// EmitLoadOfScalar - Load a scalar value from an address, taking
/// care to appropriately convert from the memory representation to
/// the LLVM value representation.
@@ -1022,14 +1036,17 @@ public:
/// used to set attributes on the call (noreturn, etc.).
RValue EmitCall(const CGFunctionInfo &FnInfo,
llvm::Value *Callee,
+ ReturnValueSlot ReturnValue,
const CallArgList &Args,
const Decl *TargetDecl = 0);
- RValue EmitCall(llvm::Value *Callee, QualType FnType,
+ RValue EmitCall(QualType FnType, llvm::Value *Callee,
+ ReturnValueSlot ReturnValue,
CallExpr::const_arg_iterator ArgBeg,
CallExpr::const_arg_iterator ArgEnd,
const Decl *TargetDecl = 0);
- RValue EmitCallExpr(const CallExpr *E);
+ RValue EmitCallExpr(const CallExpr *E,
+ ReturnValueSlot ReturnValue = ReturnValueSlot());
llvm::Value *BuildVirtualCall(const CXXMethodDecl *MD, llvm::Value *This,
const llvm::Type *Ty);
@@ -1038,20 +1055,24 @@ public:
RValue EmitCXXMemberCall(const CXXMethodDecl *MD,
llvm::Value *Callee,
+ ReturnValueSlot ReturnValue,
llvm::Value *This,
CallExpr::const_arg_iterator ArgBeg,
CallExpr::const_arg_iterator ArgEnd);
- RValue EmitCXXMemberCallExpr(const CXXMemberCallExpr *E);
- RValue EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E);
+ RValue EmitCXXMemberCallExpr(const CXXMemberCallExpr *E,
+ ReturnValueSlot ReturnValue);
+ RValue EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E,
+ ReturnValueSlot ReturnValue);
RValue EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
- const CXXMethodDecl *MD);
+ const CXXMethodDecl *MD,
+ ReturnValueSlot ReturnValue);
RValue EmitBuiltinExpr(const FunctionDecl *FD,
unsigned BuiltinID, const CallExpr *E);
- RValue EmitBlockCallExpr(const CallExpr *E);
+ RValue EmitBlockCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue);
/// EmitTargetBuiltinExpr - Emit the given builtin call. Returns 0 if the call
/// is unhandled by the current target.
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 761f34309bd6..d497471e4597 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -30,6 +30,7 @@
#include "llvm/CallingConv.h"
#include "llvm/Module.h"
#include "llvm/Intrinsics.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/ErrorHandling.h"
using namespace clang;
@@ -546,7 +547,7 @@ bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) {
// static, static inline, always_inline, and extern inline functions can
// always be deferred. Normal inline functions can be deferred in C99/C++.
if (Linkage == GVA_Internal || Linkage == GVA_C99Inline ||
- Linkage == GVA_CXXInline)
+ Linkage == GVA_CXXInline || Linkage == GVA_TemplateInstantiation)
return true;
return false;
}
@@ -1089,9 +1090,8 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old,
CI->replaceAllUsesWith(NewCall);
// Copy any custom metadata attached with CI.
- llvm::MetadataContext &TheMetadata = CI->getContext().getMetadata();
- TheMetadata.copyMD(CI, NewCall);
-
+ if (llvm::MDNode *DbgNode = CI->getMetadata("dbg"))
+ NewCall->setMetadata("dbg", DbgNode);
CI->eraseFromParent();
}
}
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index cc7ec9c30160..939c66ca3147 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -212,24 +212,10 @@ public:
llvm::Constant *GetAddrOfFunction(GlobalDecl GD,
const llvm::Type *Ty = 0);
- /// GetAddrOfRTTI - Get the address of the RTTI structure for the given type.
- llvm::Constant *GetAddrOfRTTI(QualType Ty);
+ /// GetAddrOfRTTIDescriptor - Get the address of the RTTI descriptor
+ /// for the given type.
+ llvm::Constant *GetAddrOfRTTIDescriptor(QualType Ty);
- /// GetAddrOfRTTI - Get the address of the RTTI structure for the given record
- /// decl.
- llvm::Constant *GetAddrOfRTTI(const CXXRecordDecl *RD);
-
- /// GenerateRTTI - Generate the rtti information for the given type.
- llvm::Constant *GenerateRTTI(const CXXRecordDecl *RD);
-
- /// GenerateRTTIRef - Generate a reference to the rtti information for the
- /// given type.
- llvm::Constant *GenerateRTTIRef(const CXXRecordDecl *RD);
-
- /// GenerateRTTI - Generate the rtti information for the given
- /// non-class type.
- llvm::Constant *GenerateRTTI(QualType Ty);
-
llvm::Constant *GetAddrOfThunk(GlobalDecl GD,
const ThunkAdjustment &ThisAdjustment);
llvm::Constant *GetAddrOfCovariantThunk(GlobalDecl GD,
@@ -247,8 +233,8 @@ public:
const CovariantThunkAdjustment &Adjustment);
typedef std::pair<const CXXRecordDecl *, uint64_t> CtorVtable_t;
- typedef llvm::DenseMap<const CXXRecordDecl *,
- llvm::DenseMap<CtorVtable_t, int64_t>*> AddrMap_t;
+ typedef llvm::DenseMap<CtorVtable_t, int64_t> AddrSubMap_t;
+ typedef llvm::DenseMap<const CXXRecordDecl *, AddrSubMap_t *> AddrMap_t;
llvm::DenseMap<const CXXRecordDecl *, AddrMap_t*> AddressPoints;
/// GetCXXBaseClassOffset - Returns the offset from a derived class to its
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index cd3575c132ce..cd34e0c064ef 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -199,7 +199,6 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
case Type::Builtin: {
switch (cast<BuiltinType>(Ty).getKind()) {
- default: assert(0 && "Unknown builtin type!");
case BuiltinType::Void:
case BuiltinType::ObjCId:
case BuiltinType::ObjCClass:
@@ -245,12 +244,16 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
case BuiltinType::UInt128:
case BuiltinType::Int128:
return llvm::IntegerType::get(getLLVMContext(), 128);
+
+ case BuiltinType::Overload:
+ case BuiltinType::Dependent:
+ case BuiltinType::UndeducedAuto:
+ assert(0 && "Unexpected builtin type!");
+ break;
}
+ assert(0 && "Unknown builtin type!");
break;
}
- case Type::FixedWidthInt:
- return llvm::IntegerType::get(getLLVMContext(),
- cast<FixedWidthIntType>(T)->getWidth());
case Type::Complex: {
const llvm::Type *EltTy =
ConvertTypeRecursive(cast<ComplexType>(Ty).getElementType());
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 90cc89445e46..10fd1f57f6be 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -125,8 +125,8 @@ private:
void mangleTemplateArgs(const TemplateArgument *TemplateArgs,
unsigned NumTemplateArgs);
- void mangleTemplateArgumentList(const TemplateArgumentList &L);
- void mangleTemplateArgument(const TemplateArgument &A);
+ void mangleTemplateArgs(const TemplateArgumentList &L);
+ void mangleTemplateArg(const TemplateArgument &A);
void mangleTemplateParameter(unsigned Index);
};
@@ -321,7 +321,7 @@ void CXXNameMangler::mangleName(const NamedDecl *ND) {
const TemplateArgumentList *TemplateArgs = 0;
if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
mangleUnscopedTemplateName(TD);
- mangleTemplateArgumentList(*TemplateArgs);
+ mangleTemplateArgs(*TemplateArgs);
return;
}
@@ -480,10 +480,17 @@ void CXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND) {
mangleType(Context.getASTContext().getCanonicalType(Name.getCXXNameType()));
break;
- case DeclarationName::CXXOperatorName:
- mangleOperatorName(Name.getCXXOverloadedOperator(),
- cast<FunctionDecl>(ND)->getNumParams());
+ case DeclarationName::CXXOperatorName: {
+ unsigned Arity = cast<FunctionDecl>(ND)->getNumParams();
+
+ // If we have a C++ member function, we need to include the 'this' pointer.
+ // FIXME: This does not make sense for operators that are static, but their
+ // names stay the same regardless of the arity (operator new for instance).
+ if (isa<CXXMethodDecl>(ND))
+ Arity++;
+ mangleOperatorName(Name.getCXXOverloadedOperator(), Arity);
break;
+ }
case DeclarationName::CXXLiteralOperatorName:
// FIXME: This mangling is not yet official.
@@ -517,7 +524,7 @@ void CXXNameMangler::mangleNestedName(const NamedDecl *ND,
const TemplateArgumentList *TemplateArgs = 0;
if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
mangleTemplatePrefix(TD);
- mangleTemplateArgumentList(*TemplateArgs);
+ mangleTemplateArgs(*TemplateArgs);
} else {
manglePrefix(DC);
mangleUnqualifiedName(ND);
@@ -573,7 +580,7 @@ void CXXNameMangler::manglePrefix(const DeclContext *DC) {
const TemplateArgumentList *TemplateArgs = 0;
if (const TemplateDecl *TD = isTemplate(cast<NamedDecl>(DC), TemplateArgs)) {
mangleTemplatePrefix(TD);
- mangleTemplateArgumentList(*TemplateArgs);
+ mangleTemplateArgs(*TemplateArgs);
} else {
manglePrefix(DC->getParent());
mangleUnqualifiedName(cast<NamedDecl>(DC));
@@ -611,16 +618,24 @@ CXXNameMangler::mangleOperatorName(OverloadedOperatorKind OO, unsigned Arity) {
case OO_Array_Delete: Out << "da"; break;
// ::= ps # + (unary)
// ::= pl # +
- case OO_Plus: Out << (Arity == 1? "ps" : "pl"); break;
+ case OO_Plus:
+ assert((Arity == 1 || Arity == 2) && "Invalid arity!");
+ Out << (Arity == 1? "ps" : "pl"); break;
// ::= ng # - (unary)
// ::= mi # -
- case OO_Minus: Out << (Arity == 1? "ng" : "mi"); break;
+ case OO_Minus:
+ assert((Arity == 1 || Arity == 2) && "Invalid arity!");
+ Out << (Arity == 1? "ng" : "mi"); break;
// ::= ad # & (unary)
// ::= an # &
- case OO_Amp: Out << (Arity == 1? "ad" : "an"); break;
+ case OO_Amp:
+ assert((Arity == 1 || Arity == 2) && "Invalid arity!");
+ Out << (Arity == 1? "ad" : "an"); break;
// ::= de # * (unary)
// ::= ml # *
- case OO_Star: Out << (Arity == 1? "de" : "ml"); break;
+ case OO_Star:
+ assert((Arity == 1 || Arity == 2) && "Invalid arity!");
+ Out << (Arity == 1? "de" : "ml"); break;
// ::= co # ~
case OO_Tilde: Out << "co"; break;
// ::= dv # /
@@ -975,11 +990,8 @@ void CXXNameMangler::mangleType(const ObjCInterfaceType *T) {
}
void CXXNameMangler::mangleType(const BlockPointerType *T) {
- assert(false && "can't mangle block pointer types yet");
-}
-
-void CXXNameMangler::mangleType(const FixedWidthIntType *T) {
- assert(false && "can't mangle arbitary-precision integer type yet");
+ Out << "U13block_pointer";
+ mangleType(T->getPointeeType());
}
void CXXNameMangler::mangleType(const TemplateSpecializationType *T) {
@@ -1078,6 +1090,16 @@ void CXXNameMangler::mangleExpression(const Expr *E) {
break;
}
+ case Expr::CXXOperatorCallExprClass: {
+ const CXXOperatorCallExpr *CE = cast<CXXOperatorCallExpr>(E);
+ unsigned NumArgs = CE->getNumArgs();
+ mangleOperatorName(CE->getOperator(), /*Arity=*/NumArgs);
+ // Mangle the arguments.
+ for (unsigned i = 0; i != NumArgs; ++i)
+ mangleExpression(CE->getArg(i));
+ break;
+ }
+
case Expr::ParenExprClass:
mangleExpression(cast<ParenExpr>(E)->getSubExpr());
break;
@@ -1161,11 +1183,11 @@ void CXXNameMangler::mangleCXXDtorType(CXXDtorType T) {
}
}
-void CXXNameMangler::mangleTemplateArgumentList(const TemplateArgumentList &L) {
+void CXXNameMangler::mangleTemplateArgs(const TemplateArgumentList &L) {
// <template-args> ::= I <template-arg>+ E
Out << "I";
for (unsigned i = 0, e = L.size(); i != e; ++i)
- mangleTemplateArgument(L[i]);
+ mangleTemplateArg(L[i]);
Out << "E";
}
@@ -1174,11 +1196,11 @@ void CXXNameMangler::mangleTemplateArgs(const TemplateArgument *TemplateArgs,
// <template-args> ::= I <template-arg>+ E
Out << "I";
for (unsigned i = 0; i != NumTemplateArgs; ++i)
- mangleTemplateArgument(TemplateArgs[i]);
+ mangleTemplateArg(TemplateArgs[i]);
Out << "E";
}
-void CXXNameMangler::mangleTemplateArgument(const TemplateArgument &A) {
+void CXXNameMangler::mangleTemplateArg(const TemplateArgument &A) {
// <template-arg> ::= <type> # type or template
// ::= X <expression> E # expression
// ::= <expr-primary> # simple expressions
@@ -1190,6 +1212,9 @@ void CXXNameMangler::mangleTemplateArgument(const TemplateArgument &A) {
case TemplateArgument::Type:
mangleType(A.getAsType());
break;
+ case TemplateArgument::Template:
+ mangleName(A.getAsTemplate().getAsTemplateDecl());
+ break;
case TemplateArgument::Expression:
Out << 'X';
mangleExpression(A.getAsExpr());
@@ -1558,6 +1583,7 @@ void MangleContext::mangleCXXCtorVtable(const CXXRecordDecl *RD, int64_t Offset,
void MangleContext::mangleCXXRTTI(QualType Ty,
llvm::SmallVectorImpl<char> &Res) {
// <special-name> ::= TI <type> # typeinfo structure
+ assert(!Ty.hasQualifiers() && "RTTI info cannot have top-level qualifiers");
CXXNameMangler Mangler(*this, Res);
Mangler.getStream() << "_ZTI";
Mangler.mangleType(Ty);
diff --git a/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp
index 017059df80fa..1e1edc1c482f 100644
--- a/lib/CodeGen/ModuleBuilder.cpp
+++ b/lib/CodeGen/ModuleBuilder.cpp
@@ -81,7 +81,7 @@ namespace {
if (Builder)
Builder->Release();
- };
+ }
virtual void CompleteTentativeDefinition(VarDecl *D) {
if (Diags.hasErrorOccurred())
diff --git a/lib/CodeGen/TargetABIInfo.cpp b/lib/CodeGen/TargetABIInfo.cpp
index 7be1eadfd9a2..863a297cc6a5 100644
--- a/lib/CodeGen/TargetABIInfo.cpp
+++ b/lib/CodeGen/TargetABIInfo.cpp
@@ -805,6 +805,10 @@ void X86_64ABIInfo::classify(QualType Ty,
if (Lo == Memory || Hi == Memory)
break;
}
+
+ // If this record has no fields but isn't empty, classify as INTEGER.
+ if (RD->field_empty() && Size)
+ Current = Integer;
}
// Classify the fields one at a time, merging the results.
diff --git a/lib/Driver/CC1Options.cpp b/lib/Driver/CC1Options.cpp
index 13f84c07df50..0e98bb9c113b 100644
--- a/lib/Driver/CC1Options.cpp
+++ b/lib/Driver/CC1Options.cpp
@@ -15,7 +15,7 @@ using namespace clang::driver;
using namespace clang::driver::options;
using namespace clang::driver::cc1options;
-static OptTable::Info CC1InfoTable[] = {
+static const OptTable::Info CC1InfoTable[] = {
#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
HELPTEXT, METAVAR) \
{ NAME, HELPTEXT, METAVAR, Option::KIND##Class, FLAGS, PARAM, \
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index dbe7bd9b682d..ab4bd49dd653 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -711,6 +711,11 @@ void Driver::BuildActions(const ArgList &Args, ActionList &Actions) const {
// Add a link action if necessary.
if (!LinkerInputs.empty())
Actions.push_back(new LinkJobAction(LinkerInputs, types::TY_Image));
+
+ // If we are linking, claim any options which are obviously only used for
+ // compilation.
+ if (FinalPhase == phases::Link)
+ Args.ClaimAllArgs(options::OPT_CompileOnly_Group);
}
Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase,
@@ -734,6 +739,10 @@ Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase,
case phases::Precompile:
return new PrecompileJobAction(Input, types::TY_PCH);
case phases::Compile: {
+ bool HasO4 = false;
+ if (const Arg *A = Args.getLastArg(options::OPT_O_Group))
+ HasO4 = A->getOption().matches(options::OPT_O4);
+
if (Args.hasArg(options::OPT_fsyntax_only)) {
return new CompileJobAction(Input, types::TY_Nothing);
} else if (Args.hasArg(options::OPT__analyze, options::OPT__analyze_auto)) {
@@ -741,8 +750,7 @@ Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase,
} else if (Args.hasArg(options::OPT_emit_ast)) {
return new CompileJobAction(Input, types::TY_AST);
} else if (Args.hasArg(options::OPT_emit_llvm) ||
- Args.hasArg(options::OPT_flto) ||
- Args.hasArg(options::OPT_O4)) {
+ Args.hasArg(options::OPT_flto) || HasO4) {
types::ID Output =
Args.hasArg(options::OPT_S) ? types::TY_LLVMAsm : types::TY_LLVMBC;
return new CompileJobAction(Input, Output);
@@ -768,10 +776,8 @@ void Driver::BuildJobs(Compilation &C) const {
UsePipes = false;
// -save-temps inhibits pipes.
- if (SaveTemps && UsePipes) {
+ if (SaveTemps && UsePipes)
Diag(clang::diag::warn_drv_pipe_ignored_with_save_temps);
- UsePipes = true;
- }
Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o);
@@ -906,14 +912,12 @@ void Driver::BuildJobsForAction(Compilation &C,
// See if we should use an integrated preprocessor. We do so when we have
// exactly one input, since this is the only use case we care about
// (irrelevant since we don't support combine yet).
- bool UseIntegratedCPP = false;
const ActionList *Inputs = &A->getInputs();
if (Inputs->size() == 1 && isa<PreprocessJobAction>(*Inputs->begin())) {
if (!C.getArgs().hasArg(options::OPT_no_integrated_cpp) &&
!C.getArgs().hasArg(options::OPT_traditional_cpp) &&
!C.getArgs().hasArg(options::OPT_save_temps) &&
T.hasIntegratedCPP()) {
- UseIntegratedCPP = true;
Inputs = &(*Inputs)[0]->getInputs();
}
}
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index abe9c8178a63..9b6264aedef1 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -22,6 +22,10 @@ ToolChain::ToolChain(const HostInfo &_Host, const llvm::Triple &_Triple)
ToolChain::~ToolChain() {
}
+const Driver &ToolChain::getDriver() const {
+ return Host.getDriver();
+}
+
std::string ToolChain::GetFilePath(const Compilation &C,
const char *Name) const {
return Host.getDriver().GetFilePath(Name, *this);
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 420573dea2a8..cc3febfd5b21 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -88,7 +88,7 @@ DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple,
std::string Path;
if (getArchName() == "x86_64") {
- Path = getHost().getDriver().Dir;
+ Path = getDriver().Dir;
Path += "/../lib/gcc/";
Path += ToolChainDir;
Path += "/x86_64";
@@ -100,7 +100,7 @@ DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple,
getFilePaths().push_back(Path);
}
- Path = getHost().getDriver().Dir;
+ Path = getDriver().Dir;
Path += "/../lib/gcc/";
Path += ToolChainDir;
getFilePaths().push_back(Path);
@@ -109,7 +109,7 @@ DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple,
Path += ToolChainDir;
getFilePaths().push_back(Path);
- Path = getHost().getDriver().Dir;
+ Path = getDriver().Dir;
Path += "/../libexec/gcc/";
Path += ToolChainDir;
getProgramPaths().push_back(Path);
@@ -118,11 +118,11 @@ DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple,
Path += ToolChainDir;
getProgramPaths().push_back(Path);
- Path = getHost().getDriver().Dir;
+ Path = getDriver().Dir;
Path += "/../libexec";
getProgramPaths().push_back(Path);
- getProgramPaths().push_back(getHost().getDriver().Dir);
+ getProgramPaths().push_back(getDriver().Dir);
}
Darwin::~Darwin() {
@@ -134,7 +134,7 @@ Darwin::~Darwin() {
Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA) const {
Action::ActionClass Key;
- if (getHost().getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
+ if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
Key = Action::AnalyzeJobClass;
else
Key = JA.getKind();
@@ -238,12 +238,12 @@ DarwinClang::DarwinClang(const HostInfo &Host, const llvm::Triple& Triple,
// Add the relative libexec dir (for clang-cc).
//
// FIXME: We should sink clang-cc into libexec/clang/<version>/.
- std::string Path = getHost().getDriver().Dir;
+ std::string Path = getDriver().Dir;
Path += "/../libexec";
getProgramPaths().push_back(Path);
// We expect 'as', 'ld', etc. to be adjacent to our install dir.
- getProgramPaths().push_back(getHost().getDriver().Dir);
+ getProgramPaths().push_back(getDriver().Dir);
}
void DarwinClang::AddLinkSearchPathArgs(const ArgList &Args,
@@ -264,7 +264,7 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
// cares. This is useful in situations where someone wants to statically link
// something like libstdc++, and needs its runtime support routines.
if (const Arg *A = Args.getLastArg(options::OPT_static_libgcc)) {
- getHost().getDriver().Diag(clang::diag::err_drv_unsupported_opt)
+ getDriver().Diag(clang::diag::err_drv_unsupported_opt)
<< A->getAsString(Args);
return;
}
@@ -284,7 +284,7 @@ void Darwin::getMacosxVersionMin(const ArgList &Args,
if (!Driver::GetReleaseVersion(A->getValue(Args), Res[0], Res[1], Res[2],
HadExtra) ||
HadExtra) {
- const Driver &D = getHost().getDriver();
+ const Driver &D = getDriver();
D.Diag(clang::diag::err_drv_invalid_version_number)
<< A->getAsString(Args);
}
@@ -295,7 +295,7 @@ void Darwin::getMacosxVersionMin(const ArgList &Args,
DerivedArgList *Darwin::TranslateArgs(InputArgList &Args,
const char *BoundArch) const {
DerivedArgList *DAL = new DerivedArgList(Args, false);
- const OptTable &Opts = getHost().getDriver().getOpts();
+ const OptTable &Opts = getDriver().getOpts();
// FIXME: We really want to get out of the tool chain level argument
// translation business, as it makes the driver functionality much
@@ -309,7 +309,7 @@ DerivedArgList *Darwin::TranslateArgs(InputArgList &Args,
Arg *iPhoneVersion =
Args.getLastArgNoClaim(options::OPT_miphoneos_version_min_EQ);
if (OSXVersion && iPhoneVersion) {
- getHost().getDriver().Diag(clang::diag::err_drv_argument_not_allowed_with)
+ getDriver().Diag(clang::diag::err_drv_argument_not_allowed_with)
<< OSXVersion->getAsString(Args)
<< iPhoneVersion->getAsString(Args);
} else if (!OSXVersion && !iPhoneVersion) {
@@ -355,7 +355,7 @@ DerivedArgList *Darwin::TranslateArgs(InputArgList &Args,
// like -O4 are going to slip through.
if (!XarchArg || Index > Prev + 1 ||
XarchArg->getOption().isDriverOption()) {
- getHost().getDriver().Diag(clang::diag::err_drv_invalid_Xarch_argument)
+ getDriver().Diag(clang::diag::err_drv_invalid_Xarch_argument)
<< A->getAsString(Args);
continue;
}
@@ -526,6 +526,12 @@ bool Darwin::IsUnwindTablesDefault() const {
return getArchName() == "x86_64";
}
+bool Darwin::UseDwarfDebugFlags() const {
+ if (const char *S = ::getenv("RC_DEBUG_OPTIONS"))
+ return S[0] != '\0';
+ return false;
+}
+
const char *Darwin::GetDefaultRelocationModel() const {
return "pic";
}
@@ -542,11 +548,11 @@ const char *Darwin::GetForcedPicModel() const {
Generic_GCC::Generic_GCC(const HostInfo &Host, const llvm::Triple& Triple)
: ToolChain(Host, Triple) {
- std::string Path(getHost().getDriver().Dir);
+ std::string Path(getDriver().Dir);
Path += "/../libexec";
getProgramPaths().push_back(Path);
- getProgramPaths().push_back(getHost().getDriver().Dir);
+ getProgramPaths().push_back(getDriver().Dir);
}
Generic_GCC::~Generic_GCC() {
@@ -559,7 +565,7 @@ Generic_GCC::~Generic_GCC() {
Tool &Generic_GCC::SelectTool(const Compilation &C,
const JobAction &JA) const {
Action::ActionClass Key;
- if (getHost().getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
+ if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
Key = Action::AnalyzeJobClass;
else
Key = JA.getKind();
@@ -620,13 +626,13 @@ DerivedArgList *Generic_GCC::TranslateArgs(InputArgList &Args,
OpenBSD::OpenBSD(const HostInfo &Host, const llvm::Triple& Triple)
: Generic_GCC(Host, Triple) {
- getFilePaths().push_back(getHost().getDriver().Dir + "/../lib");
+ getFilePaths().push_back(getDriver().Dir + "/../lib");
getFilePaths().push_back("/usr/lib");
}
Tool &OpenBSD::SelectTool(const Compilation &C, const JobAction &JA) const {
Action::ActionClass Key;
- if (getHost().getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
+ if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
Key = Action::AnalyzeJobClass;
else
Key = JA.getKind();
@@ -651,17 +657,17 @@ Tool &OpenBSD::SelectTool(const Compilation &C, const JobAction &JA) const {
FreeBSD::FreeBSD(const HostInfo &Host, const llvm::Triple& Triple, bool Lib32)
: Generic_GCC(Host, Triple) {
if (Lib32) {
- getFilePaths().push_back(getHost().getDriver().Dir + "/../lib32");
+ getFilePaths().push_back(getDriver().Dir + "/../lib32");
getFilePaths().push_back("/usr/lib32");
} else {
- getFilePaths().push_back(getHost().getDriver().Dir + "/../lib");
+ getFilePaths().push_back(getDriver().Dir + "/../lib");
getFilePaths().push_back("/usr/lib");
}
}
Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA) const {
Action::ActionClass Key;
- if (getHost().getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
+ if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
Key = Action::AnalyzeJobClass;
else
Key = JA.getKind();
@@ -687,13 +693,13 @@ AuroraUX::AuroraUX(const HostInfo &Host, const llvm::Triple& Triple)
: Generic_GCC(Host, Triple) {
// Path mangling to find libexec
- std::string Path(getHost().getDriver().Dir);
+ std::string Path(getDriver().Dir);
Path += "/../libexec";
getProgramPaths().push_back(Path);
- getProgramPaths().push_back(getHost().getDriver().Dir);
+ getProgramPaths().push_back(getDriver().Dir);
- getFilePaths().push_back(getHost().getDriver().Dir + "/../lib");
+ getFilePaths().push_back(getDriver().Dir + "/../lib");
getFilePaths().push_back("/usr/lib");
getFilePaths().push_back("/usr/sfw/lib");
getFilePaths().push_back("/opt/gcc4/lib");
@@ -703,7 +709,7 @@ AuroraUX::AuroraUX(const HostInfo &Host, const llvm::Triple& Triple)
Tool &AuroraUX::SelectTool(const Compilation &C, const JobAction &JA) const {
Action::ActionClass Key;
- if (getHost().getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
+ if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
Key = Action::AnalyzeJobClass;
else
Key = JA.getKind();
@@ -728,7 +734,7 @@ Tool &AuroraUX::SelectTool(const Compilation &C, const JobAction &JA) const {
Linux::Linux(const HostInfo &Host, const llvm::Triple& Triple)
: Generic_GCC(Host, Triple) {
- getFilePaths().push_back(getHost().getDriver().Dir + "/../lib/clang/1.0/");
+ getFilePaths().push_back(getDriver().Dir + "/../lib/clang/1.0/");
getFilePaths().push_back("/lib/");
getFilePaths().push_back("/usr/lib/");
@@ -755,20 +761,20 @@ DragonFly::DragonFly(const HostInfo &Host, const llvm::Triple& Triple)
: Generic_GCC(Host, Triple) {
// Path mangling to find libexec
- std::string Path(getHost().getDriver().Dir);
+ std::string Path(getDriver().Dir);
Path += "/../libexec";
getProgramPaths().push_back(Path);
- getProgramPaths().push_back(getHost().getDriver().Dir);
+ getProgramPaths().push_back(getDriver().Dir);
- getFilePaths().push_back(getHost().getDriver().Dir + "/../lib");
+ getFilePaths().push_back(getDriver().Dir + "/../lib");
getFilePaths().push_back("/usr/lib");
getFilePaths().push_back("/usr/lib/gcc41");
}
Tool &DragonFly::SelectTool(const Compilation &C, const JobAction &JA) const {
Action::ActionClass Key;
- if (getHost().getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
+ if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
Key = Action::AnalyzeJobClass;
else
Key = JA.getKind();
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index fcd96f1e5c8c..be36344f0cca 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -154,6 +154,8 @@ public:
virtual const char *GetDefaultRelocationModel() const;
virtual const char *GetForcedPicModel() const;
+ virtual bool UseDwarfDebugFlags() const;
+
/// }
};
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 70597ab91396..8f0af21335c1 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -230,7 +230,7 @@ static const char *getARMTargetCPU(const ArgList &Args) {
if (MArch == "armv5e" || MArch == "armv5te")
return "arm1026ejs";
if (MArch == "armv5tej")
- return "arm926ejs";
+ return "arm926ej-s";
if (MArch == "armv6" || MArch == "armv6k")
return "arm1136jf-s";
if (MArch == "armv6j")
@@ -338,7 +338,7 @@ static bool isSignedCharDefault(const llvm::Triple &Triple) {
void Clang::AddARMTargetArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
// Select the ABI to use.
//
@@ -367,7 +367,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
CmdArgs.push_back(ABIName);
// Set the CPU based on -march= and -mcpu=.
- CmdArgs.push_back("-mcpu");
+ CmdArgs.push_back("-target-cpu");
CmdArgs.push_back(getARMTargetCPU(Args));
// Select the float ABI as determined by -msoft-float, -mhard-float, and
@@ -432,6 +432,53 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
CmdArgs.push_back("-mfloat-abi");
CmdArgs.push_back("hard");
}
+
+ // Set appropriate target features for floating point mode.
+ //
+ // FIXME: Note, this is a hack, the LLVM backend doesn't actually use these
+ // yet (it uses the -mfloat-abi and -msoft-float options above), and it is
+ // stripped out by the ARM target.
+
+ // Use software floating point operations?
+ if (FloatABI == "soft") {
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("+soft-float");
+ }
+
+ // Use software floating point argument passing?
+ if (FloatABI != "hard") {
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("+soft-float-abi");
+ }
+
+ // Honor -mfpu=.
+ //
+ // FIXME: Centralize feature selection, defaulting shouldn't be also in the
+ // frontend target.
+ if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ)) {
+ llvm::StringRef FPU = A->getValue(Args);
+
+ // Set the target features based on the FPU.
+ if (FPU == "fpa" || FPU == "fpe2" || FPU == "fpe3" || FPU == "maverick") {
+ // Disable any default FPU support.
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("-vfp2");
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("-vfp3");
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("-neon");
+ } else if (FPU == "vfp") {
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("+vfp2");
+ } else if (FPU == "vfp3") {
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("+vfp3");
+ } else if (FPU == "neon") {
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("+neon");
+ } else
+ D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args);
+ }
}
void Clang::AddX86TargetArgs(const ArgList &Args,
@@ -480,7 +527,7 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
}
if (CPUName) {
- CmdArgs.push_back("-mcpu");
+ CmdArgs.push_back("-target-cpu");
CmdArgs.push_back(CPUName);
}
@@ -589,7 +636,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
assert(Inputs.size() == 1 && "Unable to handle multiple inputs.");
@@ -945,6 +992,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (!Args.hasFlag(options::OPT_fbuiltin, options::OPT_fno_builtin))
CmdArgs.push_back("-fno-builtin");
+ if (!Args.hasFlag(options::OPT_fassume_sane_operator_new,
+ options::OPT_fno_assume_sane_operator_new))
+ CmdArgs.push_back("-fno-assume-sane-operator-new");
+
// -fblocks=0 is default.
if (Args.hasFlag(options::OPT_fblocks, options::OPT_fno_blocks,
getToolChain().IsBlocksDefault())) {
@@ -1039,9 +1090,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Arg *A = Args.getLastArg(options::OPT_fdollars_in_identifiers,
options::OPT_fno_dollars_in_identifiers)) {
if (A->getOption().matches(options::OPT_fdollars_in_identifiers))
- CmdArgs.push_back("-fdollars-in-identifiers=1");
+ CmdArgs.push_back("-fdollars-in-identifiers");
else
- CmdArgs.push_back("-fdollars-in-identifiers=0");
+ CmdArgs.push_back("-fno-dollars-in-identifiers");
}
// -funit-at-a-time is default, and we don't support -fno-unit-at-a-time for
@@ -1105,6 +1156,20 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "clang"));
+
+ // Optionally embed the -cc1 level arguments into the debug info, for build
+ // analysis.
+ if (getToolChain().UseDwarfDebugFlags()) {
+ llvm::SmallString<256> Flags;
+ Flags += Exec;
+ for (unsigned i = 0, e = CmdArgs.size(); i != e; ++i) {
+ Flags += " ";
+ Flags += CmdArgs[i];
+ }
+ CmdArgs.push_back("-dwarf-debug-flags");
+ CmdArgs.push_back(Args.MakeArgString(Flags.str()));
+ }
+
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
// Explicitly warn that these options are unsupported, even though
@@ -1135,7 +1200,7 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
for (ArgList::const_iterator
@@ -1155,7 +1220,7 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
// If using a driver driver, force the arch.
const std::string &Arch = getToolChain().getArchName();
- if (getToolChain().getHost().useDriverDriver()) {
+ if (getToolChain().getTriple().getOS() == llvm::Triple::Darwin) {
CmdArgs.push_back("-arch");
// FIXME: Remove these special cases.
@@ -1223,8 +1288,7 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
II.getInputArg().render(Args, CmdArgs);
}
- const char *GCCName =
- getToolChain().getHost().getDriver().CCCGenericGCCName.c_str();
+ const char *GCCName = getToolChain().getDriver().CCCGenericGCCName.c_str();
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, GCCName));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
@@ -1304,7 +1368,7 @@ darwin::CC1::getDependencyFileName(const ArgList &Args,
void darwin::CC1::AddCC1Args(const ArgList &Args,
ArgStringList &CmdArgs) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
CheckCodeGenerationOptions(D, Args);
@@ -1333,7 +1397,7 @@ void darwin::CC1::AddCC1Args(const ArgList &Args,
void darwin::CC1::AddCC1OptionsArgs(const ArgList &Args, ArgStringList &CmdArgs,
const InputInfoList &Inputs,
const ArgStringList &OutputArgs) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
// Derived from cc1_options spec.
if (Args.hasArg(options::OPT_fast) ||
@@ -1481,7 +1545,7 @@ void darwin::CC1::AddCPPOptionsArgs(const ArgList &Args, ArgStringList &CmdArgs,
void darwin::CC1::AddCPPUniqueOptionsArgs(const ArgList &Args,
ArgStringList &CmdArgs,
const InputInfoList &Inputs) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
CheckPreprocessingOptions(D, Args);
@@ -1624,7 +1688,7 @@ void darwin::Compile::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
assert(Inputs.size() == 1 && "Unexpected number of inputs!");
@@ -1873,7 +1937,7 @@ void darwin::DarwinTool::AddDarwinSubArch(const ArgList &Args,
void darwin::Link::AddLinkArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
// Derived from the "link" spec.
Args.AddAllArgs(CmdArgs, options::OPT_static);
@@ -2159,7 +2223,7 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
!Args.hasArg(options::OPT_nodefaultlibs)) {
// FIXME: g++ is more complicated here, it tries to put -lstdc++
// before -lm, for example.
- if (getToolChain().getHost().getDriver().CCCIsCXX)
+ if (getToolChain().getDriver().CCCIsCXX)
CmdArgs.push_back("-lstdc++");
// link_ssp spec is empty.
@@ -2273,7 +2337,7 @@ void auroraux::Link::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
if ((!Args.hasArg(options::OPT_nostdlib)) &&
@@ -2404,7 +2468,7 @@ void openbsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
if ((!Args.hasArg(options::OPT_nostdlib)) &&
@@ -2539,7 +2603,7 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
if (Args.hasArg(options::OPT_static)) {
@@ -2691,7 +2755,7 @@ void dragonfly::Link::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const Driver &D = getToolChain().getHost().getDriver();
+ const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
if (Args.hasArg(options::OPT_static)) {
diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h
index 6729da8370a5..8f7da52c3119 100644
--- a/lib/Driver/Tools.h
+++ b/lib/Driver/Tools.h
@@ -137,7 +137,7 @@ namespace darwin {
}
public:
- DarwinTool(const char *Name, const ToolChain &TC) : Tool(Name, TC) {};
+ DarwinTool(const char *Name, const ToolChain &TC) : Tool(Name, TC) {}
};
class VISIBILITY_HIDDEN CC1 : public DarwinTool {
diff --git a/lib/Frontend/AnalysisConsumer.cpp b/lib/Frontend/AnalysisConsumer.cpp
index a74bbc24ee10..6824d8f4eb40 100644
--- a/lib/Frontend/AnalysisConsumer.cpp
+++ b/lib/Frontend/AnalysisConsumer.cpp
@@ -14,10 +14,10 @@
#include "clang/Frontend/AnalysisConsumer.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/ParentMap.h"
#include "clang/Analysis/Analyses/LiveVariables.h"
-#include "clang/Analysis/Analyses/LiveVariables.h"
#include "clang/Analysis/CFG.h"
#include "clang/Analysis/LocalCheckers.h"
#include "clang/Analysis/ManagerRegistry.h"
@@ -228,6 +228,19 @@ void AnalysisConsumer::HandleTopLevelSingleDecl(Decl *D) {
break;
}
+ case Decl::CXXMethod: {
+ CXXMethodDecl *CXXMD = cast<CXXMethodDecl>(D);
+
+ if (Opts.AnalyzeSpecificFunction.size() > 0 &&
+ Opts.AnalyzeSpecificFunction != CXXMD->getName())
+ return;
+
+ Stmt *Body = CXXMD->getBody();
+ if (Body)
+ HandleCode(CXXMD, Body, FunctionActions);
+ break;
+ }
+
default:
break;
}
@@ -240,7 +253,7 @@ void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) {
if (!TranslationUnitActions.empty()) {
// Find the entry function definition (if any).
FunctionDecl *FD = 0;
-
+ // Must specify an entry function.
if (!Opts.AnalyzeSpecificFunction.empty()) {
for (DeclContext::decl_iterator I=TU->decls_begin(), E=TU->decls_end();
I != E; ++I) {
@@ -253,9 +266,11 @@ void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) {
}
}
- for (Actions::iterator I = TranslationUnitActions.begin(),
- E = TranslationUnitActions.end(); I != E; ++I)
- (*I)(*this, *Mgr, FD);
+ if (FD) {
+ for (Actions::iterator I = TranslationUnitActions.begin(),
+ E = TranslationUnitActions.end(); I != E; ++I)
+ (*I)(*this, *Mgr, FD);
+ }
}
if (!ObjCImplementationActions.empty()) {
@@ -358,7 +373,7 @@ static void ActionGRExprEngine(AnalysisConsumer &C, AnalysisManager& mgr,
if (C.Opts.EnableExperimentalChecks)
RegisterExperimentalChecks(Eng);
- Eng.setTransferFunctions(tf);
+ Eng.setTransferFunctionsAndCheckers(tf);
// Set the graph auditor.
llvm::OwningPtr<ExplodedNode::Auditor> Auditor;
@@ -475,8 +490,36 @@ static void ActionWarnSizeofPointer(AnalysisConsumer &C, AnalysisManager &mgr,
static void ActionInlineCall(AnalysisConsumer &C, AnalysisManager &mgr,
Decl *D) {
+ // FIXME: This is largely copy of ActionGRExprEngine. Needs cleanup.
+ // Display progress.
+ C.DisplayFunction(D);
+
+ GRExprEngine Eng(mgr);
+
+ if (C.Opts.EnableExperimentalInternalChecks)
+ RegisterExperimentalInternalChecks(Eng);
- ActionGRExprEngine(C, mgr, D, CreateCallInliner(mgr.getASTContext()));
+ RegisterAppleChecks(Eng, *D);
+
+ if (C.Opts.EnableExperimentalChecks)
+ RegisterExperimentalChecks(Eng);
+
+ // Make a fake transfer function. The GRTransferFunc interface will be
+ // removed.
+ Eng.setTransferFunctionsAndCheckers(new GRTransferFuncs());
+
+ // Register call inliner as the last checker.
+ RegisterCallInliner(Eng);
+
+ // Execute the worklist algorithm.
+ Eng.ExecuteWorkList(mgr.getStackFrame(D));
+
+ // Visualize the exploded graph.
+ if (mgr.shouldVisualizeGraphviz())
+ Eng.ViewGraph(mgr.shouldTrimGraph());
+
+ // Display warnings.
+ Eng.getBugReporter().FlushReports();
}
//===----------------------------------------------------------------------===//
diff --git a/lib/Frontend/CMakeLists.txt b/lib/Frontend/CMakeLists.txt
index 03123d303f0c..58aaa43aab8f 100644
--- a/lib/Frontend/CMakeLists.txt
+++ b/lib/Frontend/CMakeLists.txt
@@ -31,7 +31,6 @@ add_clang_library(clangFrontend
PlistDiagnostics.cpp
PrintParserCallbacks.cpp
PrintPreprocessedOutput.cpp
- RewriteBlocks.cpp
RewriteMacros.cpp
RewriteObjC.cpp
RewriteTest.cpp
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 7a3388ffbb97..63f66fa54487 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -122,6 +122,10 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts,
Res.push_back("-disable-llvm-optzns");
if (Opts.DisableRedZone)
Res.push_back("-disable-red-zone");
+ if (!Opts.DwarfDebugFlags.empty()) {
+ Res.push_back("-dwarf-debug-flags");
+ Res.push_back(Opts.DwarfDebugFlags);
+ }
if (!Opts.MergeAllConstants)
Res.push_back("-fno-merge-all-constants");
if (Opts.NoCommon)
@@ -276,7 +280,6 @@ static const char *getActionName(frontend::ActionKind Kind) {
case frontend::ParseSyntaxOnly: return "-fsyntax-only";
case frontend::PrintDeclContext: return "-print-decl-contexts";
case frontend::PrintPreprocessedInput: return "-E";
- case frontend::RewriteBlocks: return "-rewrite-blocks";
case frontend::RewriteMacros: return "-rewrite-macros";
case frontend::RewriteObjC: return "-rewrite-objc";
case frontend::RewriteTest: return "-rewrite-test";
@@ -440,7 +443,7 @@ static void LangOptsToArgs(const LangOptions &Opts,
if (Opts.DollarIdents)
Res.push_back("-fdollars-in-identifiers");
if (Opts.Microsoft)
- Res.push_back("-fms-extensions=1");
+ Res.push_back("-fms-extensions");
if (Opts.ObjCNonFragileABI)
Res.push_back("-fobjc-nonfragile-abi");
// NoInline is implicit.
@@ -466,6 +469,8 @@ static void LangOptsToArgs(const LangOptions &Opts,
Res.push_back("-ffreestanding");
if (Opts.NoBuiltin)
Res.push_back("-fno-builtin");
+ if (!Opts.AssumeSaneOperatorNew)
+ Res.push_back("-fno-assume-sane-operator-new");
if (Opts.ThreadsafeStatics)
llvm::llvm_report_error("FIXME: Not yet implemented!");
if (Opts.POSIXThreads)
@@ -593,7 +598,7 @@ static void TargetOptsToArgs(const TargetOptions &Opts,
Res.push_back("-triple");
Res.push_back(Opts.Triple);
if (!Opts.CPU.empty()) {
- Res.push_back("-mcpu");
+ Res.push_back("-target-cpu");
Res.push_back(Opts.CPU);
}
if (!Opts.ABI.empty()) {
@@ -747,6 +752,7 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
Opts.DebugInfo = Args.hasArg(OPT_g);
Opts.DisableLLVMOpts = Args.hasArg(OPT_disable_llvm_optzns);
Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
+ Opts.DwarfDebugFlags = getLastArgValue(Args, OPT_dwarf_debug_flags);
Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants);
Opts.NoCommon = Args.hasArg(OPT_fno_common);
Opts.NoImplicitFloat = Args.hasArg(OPT_no_implicit_float);
@@ -851,8 +857,6 @@ ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, Diagnostic &Diags) {
Opts.ProgramAction = frontend::PrintDeclContext; break;
case OPT_E:
Opts.ProgramAction = frontend::PrintPreprocessedInput; break;
- case OPT_rewrite_blocks:
- Opts.ProgramAction = frontend::RewriteBlocks; break;
case OPT_rewrite_macros:
Opts.ProgramAction = frontend::RewriteMacros; break;
case OPT_rewrite_objc:
@@ -1124,10 +1128,9 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args,
if (Args.hasArg(OPT_trigraphs))
Opts.Trigraphs = 1;
- Opts.DollarIdents = !Opts.AsmPreprocessor;
- if (Args.hasArg(OPT_fdollars_in_identifiers))
- Opts.DollarIdents = 1;
-
+ Opts.DollarIdents = Args.hasFlag(OPT_fdollars_in_identifiers,
+ OPT_fno_dollars_in_identifiers,
+ !Opts.AsmPreprocessor);
Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings);
Opts.Microsoft = Args.hasArg(OPT_fms_extensions);
Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
@@ -1140,6 +1143,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.ShortWChar = Args.hasArg(OPT_fshort_wchar);
Opts.Freestanding = Args.hasArg(OPT_ffreestanding);
Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;
+ Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new);
Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
Opts.AccessControl = Args.hasArg(OPT_faccess_control);
Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
@@ -1245,7 +1249,7 @@ static void ParsePreprocessorOutputArgs(PreprocessorOutputOptions &Opts,
static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args) {
using namespace cc1options;
Opts.ABI = getLastArgValue(Args, OPT_target_abi);
- Opts.CPU = getLastArgValue(Args, OPT_mcpu);
+ Opts.CPU = getLastArgValue(Args, OPT_target_cpu);
Opts.Triple = getLastArgValue(Args, OPT_triple);
Opts.Features = getAllArgValues(Args, OPT_target_feature);
diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp
index e3c313a42299..4c647fda2b6d 100644
--- a/lib/Frontend/FrontendActions.cpp
+++ b/lib/Frontend/FrontendActions.cpp
@@ -154,11 +154,6 @@ ASTConsumer *RewriteObjCAction::CreateASTConsumer(CompilerInstance &CI,
return 0;
}
-ASTConsumer *RewriteBlocksAction::CreateASTConsumer(CompilerInstance &CI,
- llvm::StringRef InFile) {
- return CreateBlockRewriter(InFile, CI.getDiagnostics(), CI.getLangOpts());
-}
-
ASTConsumer *SyntaxOnlyAction::CreateASTConsumer(CompilerInstance &CI,
llvm::StringRef InFile) {
return new ASTConsumer();
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
index b4ea2576c3e6..95551252002a 100644
--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -478,6 +478,14 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(const llvm::Triple &tripl
"i686-apple-darwin8", "", "", triple);
break;
case llvm::Triple::Linux:
+ // Exherbo (2009-10-26)
+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
+ "x86_64-pc-linux-gnu", "32", "", triple);
+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
+ "i686-pc-linux-gnu", "", "", triple);
+ // Debian sid
+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
+ "x86_64-linux-gnu", "32", "", triple);
// Ubuntu 7.10 - Gutsy Gibbon
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.3",
"i486-linux-gnu", "", "", triple);
@@ -543,11 +551,6 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(const llvm::Triple &tripl
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4",
"i686-pc-linux-gnu", "", "", triple);
- // Exherbo (2009-10-26)
- AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
- "x86_64-pc-linux-gnu", "32", "", triple);
- AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
- "i686-pc-linux-gnu", "", "", triple);
break;
case llvm::Triple::FreeBSD:
// DragonFly
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 48ef2ac31aba..d8fd791b1905 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -1761,11 +1761,6 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) {
return Context->getQualifiedType(Base, Quals);
}
- case pch::TYPE_FIXED_WIDTH_INT: {
- assert(Record.size() == 2 && "Incorrect encoding of fixed-width int type");
- return Context->getFixedWidthIntType(Record[0], Record[1]);
- }
-
case pch::TYPE_COMPLEX: {
assert(Record.size() == 1 && "Incorrect encoding of complex type");
QualType ElemType = GetType(Record[0]);
@@ -1854,17 +1849,18 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) {
}
case pch::TYPE_FUNCTION_NO_PROTO: {
- if (Record.size() != 1) {
+ if (Record.size() != 2) {
Error("incorrect encoding of no-proto function type");
return QualType();
}
QualType ResultType = GetType(Record[0]);
- return Context->getFunctionNoProtoType(ResultType);
+ return Context->getFunctionNoProtoType(ResultType, Record[1]);
}
case pch::TYPE_FUNCTION_PROTO: {
QualType ResultType = GetType(Record[0]);
- unsigned Idx = 1;
+ bool NoReturn = Record[1];
+ unsigned Idx = 2;
unsigned NumParams = Record[Idx++];
llvm::SmallVector<QualType, 16> ParamTypes;
for (unsigned I = 0; I != NumParams; ++I)
@@ -1880,7 +1876,7 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) {
return Context->getFunctionType(ResultType, ParamTypes.data(), NumParams,
isVariadic, Quals, hasExceptionSpec,
hasAnyExceptionSpec, NumExceptions,
- Exceptions.data());
+ Exceptions.data(), NoReturn);
}
case pch::TYPE_UNRESOLVED_USING:
@@ -1986,9 +1982,6 @@ void TypeLocReader::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) {
void TypeLocReader::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) {
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
}
-void TypeLocReader::VisitFixedWidthIntTypeLoc(FixedWidthIntTypeLoc TL) {
- TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
-}
void TypeLocReader::VisitComplexTypeLoc(ComplexTypeLoc TL) {
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
}
diff --git a/lib/Frontend/PCHReaderStmt.cpp b/lib/Frontend/PCHReaderStmt.cpp
index f28e61e1ecdc..ba82d2601026 100644
--- a/lib/Frontend/PCHReaderStmt.cpp
+++ b/lib/Frontend/PCHReaderStmt.cpp
@@ -858,7 +858,9 @@ unsigned PCHStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
unsigned PCHStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
VisitExpr(E);
E->setConstructor(cast<CXXConstructorDecl>(Reader.GetDecl(Record[Idx++])));
+ E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
E->setElidable(Record[Idx++]);
+ E->setRequiresZeroInitialization(Record[Idx++]);
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
E->setArg(I, cast<Expr>(StmtStack[StmtStack.size() - N + I]));
return E->getNumArgs();
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index 681c1ff32cb0..2875f0930c42 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -69,12 +69,6 @@ void PCHTypeWriter::VisitBuiltinType(const BuiltinType *T) {
assert(false && "Built-in types are never serialized");
}
-void PCHTypeWriter::VisitFixedWidthIntType(const FixedWidthIntType *T) {
- Record.push_back(T->getWidth());
- Record.push_back(T->isSigned());
- Code = pch::TYPE_FIXED_WIDTH_INT;
-}
-
void PCHTypeWriter::VisitComplexType(const ComplexType *T) {
Writer.AddTypeRef(T->getElementType(), Record);
Code = pch::TYPE_COMPLEX;
@@ -144,6 +138,7 @@ void PCHTypeWriter::VisitExtVectorType(const ExtVectorType *T) {
void PCHTypeWriter::VisitFunctionType(const FunctionType *T) {
Writer.AddTypeRef(T->getResultType(), Record);
+ Record.push_back(T->getNoReturnAttr());
}
void PCHTypeWriter::VisitFunctionNoProtoType(const FunctionNoProtoType *T) {
@@ -282,9 +277,6 @@ void TypeLocWriter::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) {
void TypeLocWriter::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) {
Writer.AddSourceLocation(TL.getNameLoc(), Record);
}
-void TypeLocWriter::VisitFixedWidthIntTypeLoc(FixedWidthIntTypeLoc TL) {
- Writer.AddSourceLocation(TL.getNameLoc(), Record);
-}
void TypeLocWriter::VisitComplexTypeLoc(ComplexTypeLoc TL) {
Writer.AddSourceLocation(TL.getNameLoc(), Record);
}
@@ -558,7 +550,6 @@ void PCHWriter::WriteBlockInfoBlock() {
// Decls and Types block.
BLOCK(DECLTYPES_BLOCK);
RECORD(TYPE_EXT_QUAL);
- RECORD(TYPE_FIXED_WIDTH_INT);
RECORD(TYPE_COMPLEX);
RECORD(TYPE_POINTER);
RECORD(TYPE_BLOCK_POINTER);
@@ -1645,10 +1636,10 @@ public:
II->hasMacroDefinition() &&
!PP.getMacroInfo(const_cast<IdentifierInfo *>(II))->isBuiltinMacro();
Bits = (uint32_t)II->getObjCOrBuiltinID();
- Bits = (Bits << 1) | hasMacroDefinition;
- Bits = (Bits << 1) | II->isExtensionToken();
- Bits = (Bits << 1) | II->isPoisoned();
- Bits = (Bits << 1) | II->isCPlusPlusOperatorKeyword();
+ Bits = (Bits << 1) | unsigned(hasMacroDefinition);
+ Bits = (Bits << 1) | unsigned(II->isExtensionToken());
+ Bits = (Bits << 1) | unsigned(II->isPoisoned());
+ Bits = (Bits << 1) | unsigned(II->isCPlusPlusOperatorKeyword());
clang::io::Emit16(Out, Bits);
if (hasMacroDefinition)
diff --git a/lib/Frontend/PCHWriterStmt.cpp b/lib/Frontend/PCHWriterStmt.cpp
index 22f7ad66d9d1..abf4eaa0f8aa 100644
--- a/lib/Frontend/PCHWriterStmt.cpp
+++ b/lib/Frontend/PCHWriterStmt.cpp
@@ -785,7 +785,9 @@ void PCHStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
void PCHStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
VisitExpr(E);
Writer.AddDeclRef(E->getConstructor(), Record);
+ Writer.AddSourceLocation(E->getLocation(), Record);
Record.push_back(E->isElidable());
+ Record.push_back(E->requiresZeroInitialization());
Record.push_back(E->getNumArgs());
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
Writer.WriteSubStmt(E->getArg(I));
diff --git a/lib/Frontend/RewriteBlocks.cpp b/lib/Frontend/RewriteBlocks.cpp
deleted file mode 100644
index 25e7fc423849..000000000000
--- a/lib/Frontend/RewriteBlocks.cpp
+++ /dev/null
@@ -1,1152 +0,0 @@
-//===--- RewriteBlocks.cpp ----------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Hacks and fun related to the closure rewriter.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Frontend/ASTConsumers.h"
-#include "clang/Rewrite/Rewriter.h"
-#include "clang/AST/AST.h"
-#include "clang/AST/ASTConsumer.h"
-#include "clang/Basic/SourceManager.h"
-#include "clang/Basic/IdentifierTable.h"
-#include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/LangOptions.h"
-#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/SmallPtrSet.h"
-
-using namespace clang;
-using llvm::utostr;
-
-namespace {
-
-class RewriteBlocks : public ASTConsumer {
- Rewriter Rewrite;
- Diagnostic &Diags;
- const LangOptions &LangOpts;
- unsigned RewriteFailedDiag;
-
- ASTContext *Context;
- SourceManager *SM;
- FileID MainFileID;
- const char *MainFileStart, *MainFileEnd;
-
- // Block expressions.
- llvm::SmallVector<BlockExpr *, 32> Blocks;
- llvm::SmallVector<BlockDeclRefExpr *, 32> BlockDeclRefs;
- llvm::DenseMap<BlockDeclRefExpr *, CallExpr *> BlockCallExprs;
-
- // Block related declarations.
- llvm::SmallPtrSet<ValueDecl *, 8> BlockByCopyDecls;
- llvm::SmallPtrSet<ValueDecl *, 8> BlockByRefDecls;
- llvm::SmallPtrSet<ValueDecl *, 8> ImportedBlockDecls;
-
- llvm::DenseMap<BlockExpr *, std::string> RewrittenBlockExprs;
-
- // The function/method we are rewriting.
- FunctionDecl *CurFunctionDef;
- ObjCMethodDecl *CurMethodDef;
-
- bool IsHeader;
-
- std::string Preamble;
-public:
- RewriteBlocks(std::string inFile, Diagnostic &D,
- const LangOptions &LOpts);
- ~RewriteBlocks() {
- // Get the buffer corresponding to MainFileID.
- // If we haven't changed it, then we are done.
- if (const RewriteBuffer *RewriteBuf =
- Rewrite.getRewriteBufferFor(MainFileID)) {
- std::string S(RewriteBuf->begin(), RewriteBuf->end());
- printf("%s\n", S.c_str());
- } else {
- printf("No changes\n");
- }
- }
-
- void Initialize(ASTContext &context);
-
- void InsertText(SourceLocation Loc, const char *StrData, unsigned StrLen);
- void ReplaceText(SourceLocation Start, unsigned OrigLength,
- const char *NewStr, unsigned NewLength);
-
- // Top Level Driver code.
- virtual void HandleTopLevelDecl(DeclGroupRef D) {
- for (DeclGroupRef::iterator I = D.begin(), E = D.end(); I != E; ++I)
- HandleTopLevelSingleDecl(*I);
- }
- void HandleTopLevelSingleDecl(Decl *D);
- void HandleDeclInMainFile(Decl *D);
-
- // Top level
- Stmt *RewriteFunctionBody(Stmt *S);
- void InsertBlockLiteralsWithinFunction(FunctionDecl *FD);
- void InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD);
-
- // Block specific rewrite rules.
- std::string SynthesizeBlockInitExpr(BlockExpr *Exp, VarDecl *VD=0);
-
- void RewriteBlockCall(CallExpr *Exp);
- void RewriteBlockPointerDecl(NamedDecl *VD);
- void RewriteBlockDeclRefExpr(BlockDeclRefExpr *VD);
- void RewriteBlockPointerFunctionArgs(FunctionDecl *FD);
-
- std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
- const char *funcName, std::string Tag);
- std::string SynthesizeBlockFunc(BlockExpr *CE, int i,
- const char *funcName, std::string Tag);
- std::string SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
- bool hasCopyDisposeHelpers);
- std::string SynthesizeBlockCall(CallExpr *Exp);
- void SynthesizeBlockLiterals(SourceLocation FunLocStart,
- const char *FunName);
-
- void CollectBlockDeclRefInfo(BlockExpr *Exp);
- void GetBlockCallExprs(Stmt *S);
- void GetBlockDeclRefExprs(Stmt *S);
-
- // We avoid calling Type::isBlockPointerType(), since it operates on the
- // canonical type. We only care if the top-level type is a closure pointer.
- bool isBlockPointerType(QualType T) { return isa<BlockPointerType>(T); }
-
- // FIXME: This predicate seems like it would be useful to add to ASTContext.
- bool isObjCType(QualType T) {
- if (!LangOpts.ObjC1 && !LangOpts.ObjC2)
- return false;
-
- QualType OCT = Context->getCanonicalType(T).getUnqualifiedType();
-
- if (OCT == Context->getCanonicalType(Context->getObjCIdType()) ||
- OCT == Context->getCanonicalType(Context->getObjCClassType()))
- return true;
-
- if (const PointerType *PT = OCT->getAs<PointerType>()) {
- if (isa<ObjCInterfaceType>(PT->getPointeeType()) ||
- PT->getPointeeType()->isObjCQualifiedIdType())
- return true;
- }
- return false;
- }
- // ObjC rewrite methods.
- void RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl);
- void RewriteCategoryDecl(ObjCCategoryDecl *CatDecl);
- void RewriteProtocolDecl(ObjCProtocolDecl *PDecl);
- void RewriteMethodDecl(ObjCMethodDecl *MDecl);
-
- void RewriteFunctionProtoType(QualType funcType, NamedDecl *D);
- void CheckFunctionPointerDecl(QualType dType, NamedDecl *ND);
- void RewriteCastExpr(CastExpr *CE);
-
- bool PointerTypeTakesAnyBlockArguments(QualType QT);
- void GetExtentOfArgList(const char *Name, const char *&LParen, const char *&RParen);
-};
-
-}
-
-static bool IsHeaderFile(const std::string &Filename) {
- std::string::size_type DotPos = Filename.rfind('.');
-
- if (DotPos == std::string::npos) {
- // no file extension
- return false;
- }
-
- std::string Ext = std::string(Filename.begin()+DotPos+1, Filename.end());
- // C header: .h
- // C++ header: .hh or .H;
- return Ext == "h" || Ext == "hh" || Ext == "H";
-}
-
-RewriteBlocks::RewriteBlocks(std::string inFile,
- Diagnostic &D, const LangOptions &LOpts) :
- Diags(D), LangOpts(LOpts) {
- IsHeader = IsHeaderFile(inFile);
- CurFunctionDef = 0;
- CurMethodDef = 0;
- RewriteFailedDiag = Diags.getCustomDiagID(Diagnostic::Warning,
- "rewriting failed");
-}
-
-ASTConsumer *clang::CreateBlockRewriter(const std::string& InFile,
- Diagnostic &Diags,
- const LangOptions &LangOpts) {
- return new RewriteBlocks(InFile, Diags, LangOpts);
-}
-
-void RewriteBlocks::Initialize(ASTContext &context) {
- Context = &context;
- SM = &Context->getSourceManager();
-
- // Get the ID and start/end of the main file.
- MainFileID = SM->getMainFileID();
- const llvm::MemoryBuffer *MainBuf = SM->getBuffer(MainFileID);
- MainFileStart = MainBuf->getBufferStart();
- MainFileEnd = MainBuf->getBufferEnd();
-
- Rewrite.setSourceMgr(Context->getSourceManager(), LangOpts);
-
- if (IsHeader)
- Preamble = "#pragma once\n";
- Preamble += "#ifndef BLOCK_IMPL\n";
- Preamble += "#define BLOCK_IMPL\n";
- Preamble += "struct __block_impl {\n";
- Preamble += " void *isa;\n";
- Preamble += " int Flags;\n";
- Preamble += " int Size;\n";
- Preamble += " void *FuncPtr;\n";
- Preamble += "};\n";
- Preamble += "enum {\n";
- Preamble += " BLOCK_HAS_COPY_DISPOSE = (1<<25),\n";
- Preamble += " BLOCK_IS_GLOBAL = (1<<28)\n";
- Preamble += "};\n";
- if (LangOpts.Microsoft)
- Preamble += "#define __OBJC_RW_EXTERN extern \"C\" __declspec(dllimport)\n";
- else
- Preamble += "#define __OBJC_RW_EXTERN extern\n";
- Preamble += "// Runtime copy/destroy helper functions\n";
- Preamble += "__OBJC_RW_EXTERN void _Block_copy_assign(void *, void *);\n";
- Preamble += "__OBJC_RW_EXTERN void _Block_byref_assign_copy(void *, void *);\n";
- Preamble += "__OBJC_RW_EXTERN void _Block_destroy(void *);\n";
- Preamble += "__OBJC_RW_EXTERN void _Block_byref_release(void *);\n";
- Preamble += "__OBJC_RW_EXTERN void *_NSConcreteGlobalBlock;\n";
- Preamble += "__OBJC_RW_EXTERN void *_NSConcreteStackBlock;\n";
- Preamble += "#endif\n";
-
- InsertText(SM->getLocForStartOfFile(MainFileID),
- Preamble.c_str(), Preamble.size());
-}
-
-void RewriteBlocks::InsertText(SourceLocation Loc, const char *StrData,
- unsigned StrLen) {
- if (!Rewrite.InsertText(Loc, StrData, StrLen))
- return;
- Diags.Report(Context->getFullLoc(Loc), RewriteFailedDiag);
-}
-
-void RewriteBlocks::ReplaceText(SourceLocation Start, unsigned OrigLength,
- const char *NewStr, unsigned NewLength) {
- if (!Rewrite.ReplaceText(Start, OrigLength,
- llvm::StringRef(NewStr, NewLength)))
- return;
- Diags.Report(Context->getFullLoc(Start), RewriteFailedDiag);
-}
-
-void RewriteBlocks::RewriteMethodDecl(ObjCMethodDecl *Method) {
- bool haveBlockPtrs = false;
- for (ObjCMethodDecl::param_iterator I = Method->param_begin(),
- E = Method->param_end(); I != E; ++I)
- if (isBlockPointerType((*I)->getType()))
- haveBlockPtrs = true;
-
- if (!haveBlockPtrs)
- return;
-
- // Do a fuzzy rewrite.
- // We have 1 or more arguments that have closure pointers.
- SourceLocation Loc = Method->getLocStart();
- SourceLocation LocEnd = Method->getLocEnd();
- const char *startBuf = SM->getCharacterData(Loc);
- const char *endBuf = SM->getCharacterData(LocEnd);
-
- const char *methodPtr = startBuf;
- std::string Tag = "struct __block_impl *";
-
- while (*methodPtr++ && (methodPtr != endBuf)) {
- switch (*methodPtr) {
- case ':':
- methodPtr++;
- if (*methodPtr == '(') {
- const char *scanType = ++methodPtr;
- bool foundBlockPointer = false;
- unsigned parenCount = 1;
-
- while (parenCount) {
- switch (*scanType) {
- case '(':
- parenCount++;
- break;
- case ')':
- parenCount--;
- break;
- case '^':
- foundBlockPointer = true;
- break;
- }
- scanType++;
- }
- if (foundBlockPointer) {
- // advance the location to startArgList.
- Loc = Loc.getFileLocWithOffset(methodPtr-startBuf);
- assert((Loc.isValid()) && "Invalid Loc");
- ReplaceText(Loc, scanType-methodPtr-1, Tag.c_str(), Tag.size());
-
- // Advance startBuf. Since the underlying buffer has changed,
- // it's very important to advance startBuf (so we can correctly
- // compute a relative Loc the next time around).
- startBuf = methodPtr;
- }
- // Advance the method ptr to the end of the type.
- methodPtr = scanType;
- }
- break;
- }
- }
- return;
-}
-
-void RewriteBlocks::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) {
- for (ObjCInterfaceDecl::instmeth_iterator
- I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end();
- I != E; ++I)
- RewriteMethodDecl(*I);
- for (ObjCInterfaceDecl::classmeth_iterator
- I = ClassDecl->classmeth_begin(), E = ClassDecl->classmeth_end();
- I != E; ++I)
- RewriteMethodDecl(*I);
-}
-
-void RewriteBlocks::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) {
- for (ObjCCategoryDecl::instmeth_iterator
- I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end();
- I != E; ++I)
- RewriteMethodDecl(*I);
- for (ObjCCategoryDecl::classmeth_iterator
- I = CatDecl->classmeth_begin(), E = CatDecl->classmeth_end();
- I != E; ++I)
- RewriteMethodDecl(*I);
-}
-
-void RewriteBlocks::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) {
- for (ObjCProtocolDecl::instmeth_iterator
- I = PDecl->instmeth_begin(), E = PDecl->instmeth_end();
- I != E; ++I)
- RewriteMethodDecl(*I);
- for (ObjCProtocolDecl::classmeth_iterator
- I = PDecl->classmeth_begin(), E = PDecl->classmeth_end();
- I != E; ++I)
- RewriteMethodDecl(*I);
-}
-
-//===----------------------------------------------------------------------===//
-// Top Level Driver Code
-//===----------------------------------------------------------------------===//
-
-void RewriteBlocks::HandleTopLevelSingleDecl(Decl *D) {
- // Two cases: either the decl could be in the main file, or it could be in a
- // #included file. If the former, rewrite it now. If the later, check to see
- // if we rewrote the #include/#import.
- SourceLocation Loc = D->getLocation();
- Loc = SM->getInstantiationLoc(Loc);
-
- // If this is for a builtin, ignore it.
- if (Loc.isInvalid()) return;
-
- if (ObjCInterfaceDecl *MD = dyn_cast<ObjCInterfaceDecl>(D))
- RewriteInterfaceDecl(MD);
- else if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(D))
- RewriteCategoryDecl(CD);
- else if (ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(D))
- RewriteProtocolDecl(PD);
-
- // If we have a decl in the main file, see if we should rewrite it.
- if (SM->isFromMainFile(Loc))
- HandleDeclInMainFile(D);
- return;
-}
-
-std::string RewriteBlocks::SynthesizeBlockFunc(BlockExpr *CE, int i,
- const char *funcName,
- std::string Tag) {
- const FunctionType *AFT = CE->getFunctionType();
- QualType RT = AFT->getResultType();
- std::string StructRef = "struct " + Tag;
- std::string S = "static " + RT.getAsString() + " __" +
- funcName + "_" + "block_func_" + utostr(i);
-
- BlockDecl *BD = CE->getBlockDecl();
-
- if (isa<FunctionNoProtoType>(AFT)) {
- S += "()";
- } else if (BD->param_empty()) {
- S += "(" + StructRef + " *__cself)";
- } else {
- const FunctionProtoType *FT = cast<FunctionProtoType>(AFT);
- assert(FT && "SynthesizeBlockFunc: No function proto");
- S += '(';
- // first add the implicit argument.
- S += StructRef + " *__cself, ";
- std::string ParamStr;
- for (BlockDecl::param_iterator AI = BD->param_begin(),
- E = BD->param_end(); AI != E; ++AI) {
- if (AI != BD->param_begin()) S += ", ";
- ParamStr = (*AI)->getNameAsString();
- (*AI)->getType().getAsStringInternal(ParamStr, Context->PrintingPolicy);
- S += ParamStr;
- }
- if (FT->isVariadic()) {
- if (!BD->param_empty()) S += ", ";
- S += "...";
- }
- S += ')';
- }
- S += " {\n";
-
- // Create local declarations to avoid rewriting all closure decl ref exprs.
- // First, emit a declaration for all "by ref" decls.
- for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
- E = BlockByRefDecls.end(); I != E; ++I) {
- S += " ";
- std::string Name = (*I)->getNameAsString();
- Context->getPointerType((*I)->getType()).getAsStringInternal(Name,
- Context->PrintingPolicy);
- S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n";
- }
- // Next, emit a declaration for all "by copy" declarations.
- for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
- E = BlockByCopyDecls.end(); I != E; ++I) {
- S += " ";
- std::string Name = (*I)->getNameAsString();
- // Handle nested closure invocation. For example:
- //
- // void (^myImportedClosure)(void);
- // myImportedClosure = ^(void) { setGlobalInt(x + y); };
- //
- // void (^anotherClosure)(void);
- // anotherClosure = ^(void) {
- // myImportedClosure(); // import and invoke the closure
- // };
- //
- if (isBlockPointerType((*I)->getType()))
- S += "struct __block_impl *";
- else
- (*I)->getType().getAsStringInternal(Name, Context->PrintingPolicy);
- S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by copy\n";
- }
- std::string RewrittenStr = RewrittenBlockExprs[CE];
- const char *cstr = RewrittenStr.c_str();
- while (*cstr++ != '{') ;
- S += cstr;
- S += "\n";
- return S;
-}
-
-std::string RewriteBlocks::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
- const char *funcName,
- std::string Tag) {
- std::string StructRef = "struct " + Tag;
- std::string S = "static void __";
-
- S += funcName;
- S += "_block_copy_" + utostr(i);
- S += "(" + StructRef;
- S += "*dst, " + StructRef;
- S += "*src) {";
- for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
- E = ImportedBlockDecls.end(); I != E; ++I) {
- S += "_Block_copy_assign(&dst->";
- S += (*I)->getNameAsString();
- S += ", src->";
- S += (*I)->getNameAsString();
- S += ");}";
- }
- S += "\nstatic void __";
- S += funcName;
- S += "_block_dispose_" + utostr(i);
- S += "(" + StructRef;
- S += "*src) {";
- for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
- E = ImportedBlockDecls.end(); I != E; ++I) {
- S += "_Block_destroy(src->";
- S += (*I)->getNameAsString();
- S += ");";
- }
- S += "}\n";
- return S;
-}
-
-std::string RewriteBlocks::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
- bool hasCopyDisposeHelpers) {
- std::string S = "struct " + Tag;
- std::string Constructor = " " + Tag;
-
- S += " {\n struct __block_impl impl;\n";
-
- if (hasCopyDisposeHelpers)
- S += " void *copy;\n void *dispose;\n";
-
- Constructor += "(void *fp";
-
- if (hasCopyDisposeHelpers)
- Constructor += ", void *copyHelp, void *disposeHelp";
-
- if (BlockDeclRefs.size()) {
- // Output all "by copy" declarations.
- for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
- E = BlockByCopyDecls.end(); I != E; ++I) {
- S += " ";
- std::string FieldName = (*I)->getNameAsString();
- std::string ArgName = "_" + FieldName;
- // Handle nested closure invocation. For example:
- //
- // void (^myImportedBlock)(void);
- // myImportedBlock = ^(void) { setGlobalInt(x + y); };
- //
- // void (^anotherBlock)(void);
- // anotherBlock = ^(void) {
- // myImportedBlock(); // import and invoke the closure
- // };
- //
- if (isBlockPointerType((*I)->getType())) {
- S += "struct __block_impl *";
- Constructor += ", void *" + ArgName;
- } else {
- (*I)->getType().getAsStringInternal(FieldName, Context->PrintingPolicy);
- (*I)->getType().getAsStringInternal(ArgName, Context->PrintingPolicy);
- Constructor += ", " + ArgName;
- }
- S += FieldName + ";\n";
- }
- // Output all "by ref" declarations.
- for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
- E = BlockByRefDecls.end(); I != E; ++I) {
- S += " ";
- std::string FieldName = (*I)->getNameAsString();
- std::string ArgName = "_" + FieldName;
- // Handle nested closure invocation. For example:
- //
- // void (^myImportedBlock)(void);
- // myImportedBlock = ^(void) { setGlobalInt(x + y); };
- //
- // void (^anotherBlock)(void);
- // anotherBlock = ^(void) {
- // myImportedBlock(); // import and invoke the closure
- // };
- //
- if (isBlockPointerType((*I)->getType())) {
- S += "struct __block_impl *";
- Constructor += ", void *" + ArgName;
- } else {
- Context->getPointerType((*I)->getType()).getAsStringInternal(FieldName,
- Context->PrintingPolicy);
- Context->getPointerType((*I)->getType()).getAsStringInternal(ArgName,
- Context->PrintingPolicy);
- Constructor += ", " + ArgName;
- }
- S += FieldName + "; // by ref\n";
- }
- // Finish writing the constructor.
- // FIXME: handle NSConcreteGlobalBlock.
- Constructor += ", int flags=0) {\n";
- Constructor += " impl.isa = 0/*&_NSConcreteStackBlock*/;\n impl.Size = sizeof(";
- Constructor += Tag + ");\n impl.Flags = flags;\n impl.FuncPtr = fp;\n";
-
- if (hasCopyDisposeHelpers)
- Constructor += " copy = copyHelp;\n dispose = disposeHelp;\n";
-
- // Initialize all "by copy" arguments.
- for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
- E = BlockByCopyDecls.end(); I != E; ++I) {
- std::string Name = (*I)->getNameAsString();
- Constructor += " ";
- if (isBlockPointerType((*I)->getType()))
- Constructor += Name + " = (struct __block_impl *)_";
- else
- Constructor += Name + " = _";
- Constructor += Name + ";\n";
- }
- // Initialize all "by ref" arguments.
- for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
- E = BlockByRefDecls.end(); I != E; ++I) {
- std::string Name = (*I)->getNameAsString();
- Constructor += " ";
- if (isBlockPointerType((*I)->getType()))
- Constructor += Name + " = (struct __block_impl *)_";
- else
- Constructor += Name + " = _";
- Constructor += Name + ";\n";
- }
- } else {
- // Finish writing the constructor.
- // FIXME: handle NSConcreteGlobalBlock.
- Constructor += ", int flags=0) {\n";
- Constructor += " impl.isa = 0/*&_NSConcreteStackBlock*/;\n impl.Size = sizeof(";
- Constructor += Tag + ");\n impl.Flags = flags;\n impl.FuncPtr = fp;\n";
- if (hasCopyDisposeHelpers)
- Constructor += " copy = copyHelp;\n dispose = disposeHelp;\n";
- }
- Constructor += " ";
- Constructor += "}\n";
- S += Constructor;
- S += "};\n";
- return S;
-}
-
-void RewriteBlocks::SynthesizeBlockLiterals(SourceLocation FunLocStart,
- const char *FunName) {
- // Insert closures that were part of the function.
- for (unsigned i = 0; i < Blocks.size(); i++) {
-
- CollectBlockDeclRefInfo(Blocks[i]);
-
- std::string Tag = "__" + std::string(FunName) + "_block_impl_" + utostr(i);
-
- std::string CI = SynthesizeBlockImpl(Blocks[i], Tag,
- ImportedBlockDecls.size() > 0);
-
- InsertText(FunLocStart, CI.c_str(), CI.size());
-
- std::string CF = SynthesizeBlockFunc(Blocks[i], i, FunName, Tag);
-
- InsertText(FunLocStart, CF.c_str(), CF.size());
-
- if (ImportedBlockDecls.size()) {
- std::string HF = SynthesizeBlockHelperFuncs(Blocks[i], i, FunName, Tag);
- InsertText(FunLocStart, HF.c_str(), HF.size());
- }
-
- BlockDeclRefs.clear();
- BlockByRefDecls.clear();
- BlockByCopyDecls.clear();
- BlockCallExprs.clear();
- ImportedBlockDecls.clear();
- }
- Blocks.clear();
- RewrittenBlockExprs.clear();
-}
-
-void RewriteBlocks::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) {
- SourceLocation FunLocStart = FD->getTypeSpecStartLoc();
- const char *FuncName = FD->getNameAsCString();
-
- SynthesizeBlockLiterals(FunLocStart, FuncName);
-}
-
-void RewriteBlocks::InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD) {
- SourceLocation FunLocStart = MD->getLocStart();
- std::string FuncName = MD->getSelector().getAsString();
- // Convert colons to underscores.
- std::string::size_type loc = 0;
- while ((loc = FuncName.find(":", loc)) != std::string::npos)
- FuncName.replace(loc, 1, "_");
-
- SynthesizeBlockLiterals(FunLocStart, FuncName.c_str());
-}
-
-void RewriteBlocks::GetBlockDeclRefExprs(Stmt *S) {
- for (Stmt::child_iterator CI = S->child_begin(), E = S->child_end();
- CI != E; ++CI)
- if (*CI) {
- if (BlockExpr *CBE = dyn_cast<BlockExpr>(*CI))
- GetBlockDeclRefExprs(CBE->getBody());
- else
- GetBlockDeclRefExprs(*CI);
- }
- // Handle specific things.
- if (BlockDeclRefExpr *CDRE = dyn_cast<BlockDeclRefExpr>(S))
- // FIXME: Handle enums.
- if (!isa<FunctionDecl>(CDRE->getDecl()))
- BlockDeclRefs.push_back(CDRE);
- return;
-}
-
-void RewriteBlocks::GetBlockCallExprs(Stmt *S) {
- for (Stmt::child_iterator CI = S->child_begin(), E = S->child_end();
- CI != E; ++CI)
- if (*CI) {
- if (BlockExpr *CBE = dyn_cast<BlockExpr>(*CI))
- GetBlockCallExprs(CBE->getBody());
- else
- GetBlockCallExprs(*CI);
- }
-
- if (CallExpr *CE = dyn_cast<CallExpr>(S)) {
- if (CE->getCallee()->getType()->isBlockPointerType()) {
- BlockCallExprs[dyn_cast<BlockDeclRefExpr>(CE->getCallee())] = CE;
- }
- }
- return;
-}
-
-std::string RewriteBlocks::SynthesizeBlockCall(CallExpr *Exp) {
- // Navigate to relevant type information.
- const char *closureName = 0;
- const BlockPointerType *CPT = 0;
-
- if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Exp->getCallee())) {
- closureName = DRE->getDecl()->getNameAsCString();
- CPT = DRE->getType()->getAs<BlockPointerType>();
- } else if (BlockDeclRefExpr *CDRE = dyn_cast<BlockDeclRefExpr>(Exp->getCallee())) {
- closureName = CDRE->getDecl()->getNameAsCString();
- CPT = CDRE->getType()->getAs<BlockPointerType>();
- } else if (MemberExpr *MExpr = dyn_cast<MemberExpr>(Exp->getCallee())) {
- closureName = MExpr->getMemberDecl()->getNameAsCString();
- CPT = MExpr->getType()->getAs<BlockPointerType>();
- } else {
- assert(1 && "RewriteBlockClass: Bad type");
- }
- assert(CPT && "RewriteBlockClass: Bad type");
- const FunctionType *FT = CPT->getPointeeType()->getAs<FunctionType>();
- assert(FT && "RewriteBlockClass: Bad type");
- const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FT);
- // FTP will be null for closures that don't take arguments.
-
- // Build a closure call - start with a paren expr to enforce precedence.
- std::string BlockCall = "(";
-
- // Synthesize the cast.
- BlockCall += "(" + Exp->getType().getAsString() + "(*)";
- BlockCall += "(struct __block_impl *";
- if (FTP) {
- for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
- E = FTP->arg_type_end(); I && (I != E); ++I)
- BlockCall += ", " + (*I).getAsString();
- }
- BlockCall += "))"; // close the argument list and paren expression.
-
- // Invoke the closure. We need to cast it since the declaration type is
- // bogus (it's a function pointer type)
- BlockCall += "((struct __block_impl *)";
- std::string closureExprBufStr;
- llvm::raw_string_ostream closureExprBuf(closureExprBufStr);
- Exp->getCallee()->printPretty(closureExprBuf, *Context, 0,
- PrintingPolicy(LangOpts));
- BlockCall += closureExprBuf.str();
- BlockCall += ")->FuncPtr)";
-
- // Add the arguments.
- BlockCall += "((struct __block_impl *)";
- BlockCall += closureExprBuf.str();
- for (CallExpr::arg_iterator I = Exp->arg_begin(),
- E = Exp->arg_end(); I != E; ++I) {
- std::string syncExprBufS;
- llvm::raw_string_ostream Buf(syncExprBufS);
- (*I)->printPretty(Buf, *Context, 0, PrintingPolicy(LangOpts));
- BlockCall += ", " + Buf.str();
- }
- return BlockCall;
-}
-
-void RewriteBlocks::RewriteBlockCall(CallExpr *Exp) {
- std::string BlockCall = SynthesizeBlockCall(Exp);
-
- const char *startBuf = SM->getCharacterData(Exp->getLocStart());
- const char *endBuf = SM->getCharacterData(Exp->getLocEnd());
-
- ReplaceText(Exp->getLocStart(), endBuf-startBuf,
- BlockCall.c_str(), BlockCall.size());
-}
-
-void RewriteBlocks::RewriteBlockDeclRefExpr(BlockDeclRefExpr *BDRE) {
- // FIXME: Add more elaborate code generation required by the ABI.
- InsertText(BDRE->getLocStart(), "*", 1);
-}
-
-void RewriteBlocks::RewriteCastExpr(CastExpr *CE) {
- SourceLocation LocStart = CE->getLocStart();
- SourceLocation LocEnd = CE->getLocEnd();
-
- if (!Rewriter::isRewritable(LocStart) || !Rewriter::isRewritable(LocEnd))
- return;
-
- const char *startBuf = SM->getCharacterData(LocStart);
- const char *endBuf = SM->getCharacterData(LocEnd);
-
- // advance the location to startArgList.
- const char *argPtr = startBuf;
-
- while (*argPtr++ && (argPtr < endBuf)) {
- switch (*argPtr) {
- case '^':
- // Replace the '^' with '*'.
- LocStart = LocStart.getFileLocWithOffset(argPtr-startBuf);
- ReplaceText(LocStart, 1, "*", 1);
- break;
- }
- }
- return;
-}
-
-void RewriteBlocks::RewriteBlockPointerFunctionArgs(FunctionDecl *FD) {
- SourceLocation DeclLoc = FD->getLocation();
- unsigned parenCount = 0;
-
- // We have 1 or more arguments that have closure pointers.
- const char *startBuf = SM->getCharacterData(DeclLoc);
- const char *startArgList = strchr(startBuf, '(');
-
- assert((*startArgList == '(') && "Rewriter fuzzy parser confused");
-
- parenCount++;
- // advance the location to startArgList.
- DeclLoc = DeclLoc.getFileLocWithOffset(startArgList-startBuf);
- assert((DeclLoc.isValid()) && "Invalid DeclLoc");
-
- const char *argPtr = startArgList;
-
- while (*argPtr++ && parenCount) {
- switch (*argPtr) {
- case '^':
- // Replace the '^' with '*'.
- DeclLoc = DeclLoc.getFileLocWithOffset(argPtr-startArgList);
- ReplaceText(DeclLoc, 1, "*", 1);
- break;
- case '(':
- parenCount++;
- break;
- case ')':
- parenCount--;
- break;
- }
- }
- return;
-}
-
-bool RewriteBlocks::PointerTypeTakesAnyBlockArguments(QualType QT) {
- const FunctionProtoType *FTP;
- const PointerType *PT = QT->getAs<PointerType>();
- if (PT) {
- FTP = PT->getPointeeType()->getAs<FunctionProtoType>();
- } else {
- const BlockPointerType *BPT = QT->getAs<BlockPointerType>();
- assert(BPT && "BlockPointerTypeTakeAnyBlockArguments(): not a block pointer type");
- FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
- }
- if (FTP) {
- for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(),
- E = FTP->arg_type_end(); I != E; ++I)
- if (isBlockPointerType(*I))
- return true;
- }
- return false;
-}
-
-void RewriteBlocks::GetExtentOfArgList(const char *Name,
- const char *&LParen, const char *&RParen) {
- const char *argPtr = strchr(Name, '(');
- assert((*argPtr == '(') && "Rewriter fuzzy parser confused");
-
- LParen = argPtr; // output the start.
- argPtr++; // skip past the left paren.
- unsigned parenCount = 1;
-
- while (*argPtr && parenCount) {
- switch (*argPtr) {
- case '(': parenCount++; break;
- case ')': parenCount--; break;
- default: break;
- }
- if (parenCount) argPtr++;
- }
- assert((*argPtr == ')') && "Rewriter fuzzy parser confused");
- RParen = argPtr; // output the end
-}
-
-void RewriteBlocks::RewriteBlockPointerDecl(NamedDecl *ND) {
- if (FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
- RewriteBlockPointerFunctionArgs(FD);
- return;
- }
- // Handle Variables and Typedefs.
- SourceLocation DeclLoc = ND->getLocation();
- QualType DeclT;
- if (VarDecl *VD = dyn_cast<VarDecl>(ND))
- DeclT = VD->getType();
- else if (TypedefDecl *TDD = dyn_cast<TypedefDecl>(ND))
- DeclT = TDD->getUnderlyingType();
- else if (FieldDecl *FD = dyn_cast<FieldDecl>(ND))
- DeclT = FD->getType();
- else
- assert(0 && "RewriteBlockPointerDecl(): Decl type not yet handled");
-
- const char *startBuf = SM->getCharacterData(DeclLoc);
- const char *endBuf = startBuf;
- // scan backward (from the decl location) for the end of the previous decl.
- while (*startBuf != '^' && *startBuf != ';' && startBuf != MainFileStart)
- startBuf--;
-
- // *startBuf != '^' if we are dealing with a pointer to function that
- // may take block argument types (which will be handled below).
- if (*startBuf == '^') {
- // Replace the '^' with '*', computing a negative offset.
- DeclLoc = DeclLoc.getFileLocWithOffset(startBuf-endBuf);
- ReplaceText(DeclLoc, 1, "*", 1);
- }
- if (PointerTypeTakesAnyBlockArguments(DeclT)) {
- // Replace the '^' with '*' for arguments.
- DeclLoc = ND->getLocation();
- startBuf = SM->getCharacterData(DeclLoc);
- const char *argListBegin, *argListEnd;
- GetExtentOfArgList(startBuf, argListBegin, argListEnd);
- while (argListBegin < argListEnd) {
- if (*argListBegin == '^') {
- SourceLocation CaretLoc = DeclLoc.getFileLocWithOffset(argListBegin-startBuf);
- ReplaceText(CaretLoc, 1, "*", 1);
- }
- argListBegin++;
- }
- }
- return;
-}
-
-void RewriteBlocks::CollectBlockDeclRefInfo(BlockExpr *Exp) {
- // Add initializers for any closure decl refs.
- GetBlockDeclRefExprs(Exp->getBody());
- if (BlockDeclRefs.size()) {
- // Unique all "by copy" declarations.
- for (unsigned i = 0; i < BlockDeclRefs.size(); i++)
- if (!BlockDeclRefs[i]->isByRef())
- BlockByCopyDecls.insert(BlockDeclRefs[i]->getDecl());
- // Unique all "by ref" declarations.
- for (unsigned i = 0; i < BlockDeclRefs.size(); i++)
- if (BlockDeclRefs[i]->isByRef()) {
- BlockByRefDecls.insert(BlockDeclRefs[i]->getDecl());
- }
- // Find any imported blocks...they will need special attention.
- for (unsigned i = 0; i < BlockDeclRefs.size(); i++)
- if (isBlockPointerType(BlockDeclRefs[i]->getType())) {
- GetBlockCallExprs(Blocks[i]);
- ImportedBlockDecls.insert(BlockDeclRefs[i]->getDecl());
- }
- }
-}
-
-std::string RewriteBlocks::SynthesizeBlockInitExpr(BlockExpr *Exp, VarDecl *VD) {
- Blocks.push_back(Exp);
-
- CollectBlockDeclRefInfo(Exp);
- std::string FuncName;
-
- if (CurFunctionDef)
- FuncName = std::string(CurFunctionDef->getNameAsString());
- else if (CurMethodDef) {
- FuncName = CurMethodDef->getSelector().getAsString();
- // Convert colons to underscores.
- std::string::size_type loc = 0;
- while ((loc = FuncName.find(":", loc)) != std::string::npos)
- FuncName.replace(loc, 1, "_");
- } else if (VD)
- FuncName = std::string(VD->getNameAsString());
-
- std::string BlockNumber = utostr(Blocks.size()-1);
-
- std::string Tag = "__" + FuncName + "_block_impl_" + BlockNumber;
- std::string Func = "__" + FuncName + "_block_func_" + BlockNumber;
-
- std::string FunkTypeStr;
-
- // Get a pointer to the function type so we can cast appropriately.
- Context->getPointerType(QualType(Exp->getFunctionType(),0))
- .getAsStringInternal(FunkTypeStr, Context->PrintingPolicy);
-
- // Rewrite the closure block with a compound literal. The first cast is
- // to prevent warnings from the C compiler.
- std::string Init = "(" + FunkTypeStr;
-
- Init += ")&" + Tag;
-
- // Initialize the block function.
- Init += "((void*)" + Func;
-
- if (ImportedBlockDecls.size()) {
- std::string Buf = "__" + FuncName + "_block_copy_" + BlockNumber;
- Init += ",(void*)" + Buf;
- Buf = "__" + FuncName + "_block_dispose_" + BlockNumber;
- Init += ",(void*)" + Buf;
- }
- // Add initializers for any closure decl refs.
- if (BlockDeclRefs.size()) {
- // Output all "by copy" declarations.
- for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
- E = BlockByCopyDecls.end(); I != E; ++I) {
- Init += ",";
- if (isObjCType((*I)->getType())) {
- Init += "[[";
- Init += (*I)->getNameAsString();
- Init += " retain] autorelease]";
- } else if (isBlockPointerType((*I)->getType())) {
- Init += "(void *)";
- Init += (*I)->getNameAsString();
- } else {
- Init += (*I)->getNameAsString();
- }
- }
- // Output all "by ref" declarations.
- for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
- E = BlockByRefDecls.end(); I != E; ++I) {
- Init += ",&";
- Init += (*I)->getNameAsString();
- }
- }
- Init += ")";
- BlockDeclRefs.clear();
- BlockByRefDecls.clear();
- BlockByCopyDecls.clear();
- ImportedBlockDecls.clear();
-
- return Init;
-}
-
-//===----------------------------------------------------------------------===//
-// Function Body / Expression rewriting
-//===----------------------------------------------------------------------===//
-
-Stmt *RewriteBlocks::RewriteFunctionBody(Stmt *S) {
- // Start by rewriting all children.
- for (Stmt::child_iterator CI = S->child_begin(), E = S->child_end();
- CI != E; ++CI)
- if (*CI) {
- if (BlockExpr *CBE = dyn_cast<BlockExpr>(*CI)) {
- RewriteFunctionBody(CBE->getBody());
-
- // We've just rewritten the block body in place.
- // Now we snarf the rewritten text and stash it away for later use.
- std::string S = Rewrite.getRewritenText(CBE->getSourceRange());
- RewrittenBlockExprs[CBE] = S;
- std::string Init = SynthesizeBlockInitExpr(CBE);
- // Do the rewrite, using S.size() which contains the rewritten size.
- ReplaceText(CBE->getLocStart(), S.size(), Init.c_str(), Init.size());
- } else {
- RewriteFunctionBody(*CI);
- }
- }
- // Handle specific things.
- if (CallExpr *CE = dyn_cast<CallExpr>(S)) {
- if (CE->getCallee()->getType()->isBlockPointerType())
- RewriteBlockCall(CE);
- }
- if (CastExpr *CE = dyn_cast<CastExpr>(S)) {
- RewriteCastExpr(CE);
- }
- if (DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
- for (DeclStmt::decl_iterator DI = DS->decl_begin(), DE = DS->decl_end();
- DI != DE; ++DI) {
-
- Decl *SD = *DI;
- if (ValueDecl *ND = dyn_cast<ValueDecl>(SD)) {
- if (isBlockPointerType(ND->getType()))
- RewriteBlockPointerDecl(ND);
- else if (ND->getType()->isFunctionPointerType())
- CheckFunctionPointerDecl(ND->getType(), ND);
- }
- if (TypedefDecl *TD = dyn_cast<TypedefDecl>(SD)) {
- if (isBlockPointerType(TD->getUnderlyingType()))
- RewriteBlockPointerDecl(TD);
- else if (TD->getUnderlyingType()->isFunctionPointerType())
- CheckFunctionPointerDecl(TD->getUnderlyingType(), TD);
- }
- }
- }
- // Handle specific things.
- if (BlockDeclRefExpr *BDRE = dyn_cast<BlockDeclRefExpr>(S)) {
- if (BDRE->isByRef())
- RewriteBlockDeclRefExpr(BDRE);
- }
- // Return this stmt unmodified.
- return S;
-}
-
-void RewriteBlocks::RewriteFunctionProtoType(QualType funcType, NamedDecl *D) {
- if (FunctionProtoType *fproto = dyn_cast<FunctionProtoType>(funcType)) {
- for (FunctionProtoType::arg_type_iterator I = fproto->arg_type_begin(),
- E = fproto->arg_type_end(); I && (I != E); ++I)
- if (isBlockPointerType(*I)) {
- // All the args are checked/rewritten. Don't call twice!
- RewriteBlockPointerDecl(D);
- break;
- }
- }
-}
-
-void RewriteBlocks::CheckFunctionPointerDecl(QualType funcType, NamedDecl *ND) {
- const PointerType *PT = funcType->getAs<PointerType>();
- if (PT && PointerTypeTakesAnyBlockArguments(funcType))
- RewriteFunctionProtoType(PT->getPointeeType(), ND);
-}
-
-/// HandleDeclInMainFile - This is called for each top-level decl defined in the
-/// main file of the input.
-void RewriteBlocks::HandleDeclInMainFile(Decl *D) {
- if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
- // Since function prototypes don't have ParmDecl's, we check the function
- // prototype. This enables us to rewrite function declarations and
- // definitions using the same code.
- RewriteFunctionProtoType(FD->getType(), FD);
-
- // FIXME: Handle CXXTryStmt
- if (CompoundStmt *Body = FD->getCompoundBody()) {
- CurFunctionDef = FD;
- FD->setBody(cast_or_null<CompoundStmt>(RewriteFunctionBody(Body)));
- // This synthesizes and inserts the block "impl" struct, invoke function,
- // and any copy/dispose helper functions.
- InsertBlockLiteralsWithinFunction(FD);
- CurFunctionDef = 0;
- }
- return;
- }
- if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
- RewriteMethodDecl(MD);
- if (Stmt *Body = MD->getBody()) {
- CurMethodDef = MD;
- RewriteFunctionBody(Body);
- InsertBlockLiteralsWithinMethod(MD);
- CurMethodDef = 0;
- }
- }
- if (VarDecl *VD = dyn_cast<VarDecl>(D)) {
- if (isBlockPointerType(VD->getType())) {
- RewriteBlockPointerDecl(VD);
- if (VD->getInit()) {
- if (BlockExpr *CBE = dyn_cast<BlockExpr>(VD->getInit())) {
- RewriteFunctionBody(CBE->getBody());
-
- // We've just rewritten the block body in place.
- // Now we snarf the rewritten text and stash it away for later use.
- std::string S = Rewrite.getRewritenText(CBE->getSourceRange());
- RewrittenBlockExprs[CBE] = S;
- std::string Init = SynthesizeBlockInitExpr(CBE, VD);
- // Do the rewrite, using S.size() which contains the rewritten size.
- ReplaceText(CBE->getLocStart(), S.size(), Init.c_str(), Init.size());
- SynthesizeBlockLiterals(VD->getTypeSpecStartLoc(),
- VD->getNameAsCString());
- } else if (CastExpr *CE = dyn_cast<CastExpr>(VD->getInit())) {
- RewriteCastExpr(CE);
- }
- }
- } else if (VD->getType()->isFunctionPointerType()) {
- CheckFunctionPointerDecl(VD->getType(), VD);
- if (VD->getInit()) {
- if (CastExpr *CE = dyn_cast<CastExpr>(VD->getInit())) {
- RewriteCastExpr(CE);
- }
- }
- }
- return;
- }
- if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
- if (isBlockPointerType(TD->getUnderlyingType()))
- RewriteBlockPointerDecl(TD);
- else if (TD->getUnderlyingType()->isFunctionPointerType())
- CheckFunctionPointerDecl(TD->getUnderlyingType(), TD);
- return;
- }
- if (RecordDecl *RD = dyn_cast<RecordDecl>(D)) {
- if (RD->isDefinition()) {
- for (RecordDecl::field_iterator i = RD->field_begin(),
- e = RD->field_end(); i != e; ++i) {
- FieldDecl *FD = *i;
- if (isBlockPointerType(FD->getType()))
- RewriteBlockPointerDecl(FD);
- }
- }
- return;
- }
-}
diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp
index df85c13cea78..c3474728a6ed 100644
--- a/lib/Frontend/RewriteObjC.cpp
+++ b/lib/Frontend/RewriteObjC.cpp
@@ -30,6 +30,28 @@ using llvm::utostr;
namespace {
class RewriteObjC : public ASTConsumer {
+ enum {
+ BLOCK_FIELD_IS_OBJECT = 3, /* id, NSObject, __attribute__((NSObject)),
+ block, ... */
+ BLOCK_FIELD_IS_BLOCK = 7, /* a block variable */
+ BLOCK_FIELD_IS_BYREF = 8, /* the on stack structure holding the
+ __block variable */
+ BLOCK_FIELD_IS_WEAK = 16, /* declared __weak, only used in byref copy
+ helpers */
+ BLOCK_BYREF_CALLER = 128, /* called from __block (byref) copy/dispose
+ support routines */
+ BLOCK_BYREF_CURRENT_MAX = 256
+ };
+
+ enum {
+ BLOCK_NEEDS_FREE = (1 << 24),
+ BLOCK_HAS_COPY_DISPOSE = (1 << 25),
+ BLOCK_HAS_CXX_OBJ = (1 << 26),
+ BLOCK_IS_GC = (1 << 27),
+ BLOCK_IS_GLOBAL = (1 << 28),
+ BLOCK_HAS_DESCRIPTOR = (1 << 29)
+ };
+
Rewriter Rewrite;
Diagnostic &Diags;
const LangOptions &LangOpts;
@@ -324,6 +346,7 @@ namespace {
// Block specific rewrite rules.
void RewriteBlockCall(CallExpr *Exp);
void RewriteBlockPointerDecl(NamedDecl *VD);
+ void RewriteByRefVar(VarDecl *VD);
Stmt *RewriteBlockDeclRefExpr(BlockDeclRefExpr *VD);
void RewriteBlockPointerFunctionArgs(FunctionDecl *FD);
@@ -337,7 +360,7 @@ namespace {
std::string ImplTag,
int i, const char *funcName,
unsigned hasCopy);
- Stmt *SynthesizeBlockCall(CallExpr *Exp);
+ Stmt *SynthesizeBlockCall(CallExpr *Exp, const Expr* BlockExp);
void SynthesizeBlockLiterals(SourceLocation FunLocStart,
const char *FunName);
void RewriteRecordBody(RecordDecl *RD);
@@ -565,8 +588,8 @@ void RewriteObjC::Initialize(ASTContext &context) {
Preamble += "extern \"C\" __declspec(dllexport) void *_NSConcreteGlobalBlock[32];\n";
Preamble += "extern \"C\" __declspec(dllexport) void *_NSConcreteStackBlock[32];\n";
Preamble += "#else\n";
- Preamble += "__OBJC_RW_DLLIMPORT void _Block_object_assign(void *, const void *, const int);\n";
- Preamble += "__OBJC_RW_DLLIMPORT void _Block_object_dispose(const void *, const int);\n";
+ Preamble += "__OBJC_RW_DLLIMPORT \"C\" void _Block_object_assign(void *, const void *, const int);\n";
+ Preamble += "__OBJC_RW_DLLIMPORT \"C\" void _Block_object_dispose(const void *, const int);\n";
Preamble += "__OBJC_RW_DLLIMPORT void *_NSConcreteGlobalBlock[32];\n";
Preamble += "__OBJC_RW_DLLIMPORT void *_NSConcreteStackBlock[32];\n";
Preamble += "#endif\n";
@@ -576,6 +599,8 @@ void RewriteObjC::Initialize(ASTContext &context) {
Preamble += "#undef __OBJC_RW_STATICIMPORT\n";
Preamble += "#define __attribute__(X)\n";
}
+ else
+ Preamble += "#define __block\n";
}
@@ -3731,8 +3756,8 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i,
E = BlockByRefDecls.end(); I != E; ++I) {
S += " ";
std::string Name = (*I)->getNameAsString();
- Context->getPointerType((*I)->getType()).getAsStringInternal(Name,
- Context->PrintingPolicy);
+ std::string TypeString = "struct __Block_byref_" + Name + " *";
+ Name = TypeString + Name;
S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n";
}
// Next, emit a declaration for all "by copy" declarations.
@@ -3781,8 +3806,13 @@ std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
S += (*I)->getNameAsString();
S += ", (void*)src->";
S += (*I)->getNameAsString();
- S += ", 3/*BLOCK_FIELD_IS_OBJECT*/);}";
+ if (BlockByRefDecls.count((*I)))
+ S += ", " + utostr(BLOCK_FIELD_IS_BYREF) + "/*BLOCK_FIELD_IS_BYREF*/);";
+ else
+ S += ", " + utostr(BLOCK_FIELD_IS_OBJECT) + "/*BLOCK_FIELD_IS_OBJECT*/);";
}
+ S += "}\n";
+
S += "\nstatic void __";
S += funcName;
S += "_block_dispose_" + utostr(i);
@@ -3792,7 +3822,10 @@ std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
E = ImportedBlockDecls.end(); I != E; ++I) {
S += "_Block_object_dispose((void*)src->";
S += (*I)->getNameAsString();
- S += ", 3/*BLOCK_FIELD_IS_OBJECT*/);";
+ if (BlockByRefDecls.count((*I)))
+ S += ", " + utostr(BLOCK_FIELD_IS_BYREF) + "/*BLOCK_FIELD_IS_BYREF*/);";
+ else
+ S += ", " + utostr(BLOCK_FIELD_IS_OBJECT) + "/*BLOCK_FIELD_IS_OBJECT*/);";
}
S += "}\n";
return S;
@@ -3858,10 +3891,10 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
S += "struct __block_impl *";
Constructor += ", void *" + ArgName;
} else {
- Context->getPointerType((*I)->getType()).getAsStringInternal(FieldName,
- Context->PrintingPolicy);
- Context->getPointerType((*I)->getType()).getAsStringInternal(ArgName,
- Context->PrintingPolicy);
+ std::string TypeString = "struct __Block_byref_" + FieldName;
+ TypeString += " *";
+ FieldName = TypeString + FieldName;
+ ArgName = TypeString + ArgName;
Constructor += ", " + ArgName;
}
S += FieldName + "; // by ref\n";
@@ -3896,7 +3929,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
Constructor += Name + " = (struct __block_impl *)_";
else
Constructor += Name + " = _";
- Constructor += Name + ";\n";
+ Constructor += Name + "->__forwarding;\n";
}
} else {
// Finish writing the constructor.
@@ -3924,7 +3957,12 @@ std::string RewriteObjC::SynthesizeBlockDescriptor(std::string DescTag,
S += " {\n unsigned long reserved;\n";
S += " unsigned long Block_size;\n";
if (hasCopy) {
- S += " void *copy;\n void *dispose;\n";
+ S += " void (*copy)(struct ";
+ S += ImplTag; S += "*, struct ";
+ S += ImplTag; S += "*);\n";
+
+ S += " void (*dispose)(struct ";
+ S += ImplTag; S += "*);\n";
}
S += "} ";
@@ -4030,20 +4068,38 @@ void RewriteObjC::GetBlockCallExprs(Stmt *S) {
return;
}
-Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp) {
+Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) {
// Navigate to relevant type information.
- const char *closureName = 0;
const BlockPointerType *CPT = 0;
- if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Exp->getCallee())) {
- closureName = DRE->getDecl()->getNameAsCString();
+ if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(BlockExp)) {
CPT = DRE->getType()->getAs<BlockPointerType>();
- } else if (BlockDeclRefExpr *CDRE = dyn_cast<BlockDeclRefExpr>(Exp->getCallee())) {
- closureName = CDRE->getDecl()->getNameAsCString();
+ } else if (const BlockDeclRefExpr *CDRE =
+ dyn_cast<BlockDeclRefExpr>(BlockExp)) {
CPT = CDRE->getType()->getAs<BlockPointerType>();
- } else if (MemberExpr *MExpr = dyn_cast<MemberExpr>(Exp->getCallee())) {
- closureName = MExpr->getMemberDecl()->getNameAsCString();
+ } else if (const MemberExpr *MExpr = dyn_cast<MemberExpr>(BlockExp)) {
CPT = MExpr->getType()->getAs<BlockPointerType>();
+ }
+ else if (const ParenExpr *PRE = dyn_cast<ParenExpr>(BlockExp)) {
+ return SynthesizeBlockCall(Exp, PRE->getSubExpr());
+ }
+ else if (const ImplicitCastExpr *IEXPR = dyn_cast<ImplicitCastExpr>(BlockExp))
+ CPT = IEXPR->getType()->getAs<BlockPointerType>();
+ else if (const ConditionalOperator *CEXPR =
+ dyn_cast<ConditionalOperator>(BlockExp)) {
+ Expr *LHSExp = CEXPR->getLHS();
+ Stmt *LHSStmt = SynthesizeBlockCall(Exp, LHSExp);
+ Expr *RHSExp = CEXPR->getRHS();
+ Stmt *RHSStmt = SynthesizeBlockCall(Exp, RHSExp);
+ Expr *CONDExp = CEXPR->getCond();
+ ConditionalOperator *CondExpr =
+ new (Context) ConditionalOperator(CONDExp,
+ SourceLocation(), cast<Expr>(LHSStmt),
+ SourceLocation(), cast<Expr>(RHSStmt),
+ Exp->getType());
+ return CondExpr;
+ } else if (const ObjCIvarRefExpr *IRE = dyn_cast<ObjCIvarRefExpr>(BlockExp)) {
+ CPT = IRE->getType()->getAs<BlockPointerType>();
} else {
assert(1 && "RewriteBlockClass: Bad type");
}
@@ -4083,7 +4139,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp) {
CastExpr *BlkCast = new (Context) CStyleCastExpr(PtrBlock,
CastExpr::CK_Unknown,
- Exp->getCallee(),
+ const_cast<Expr*>(BlockExp),
PtrBlock, SourceLocation(),
SourceLocation());
// Don't forget the parens to enforce the proper binding.
@@ -4119,7 +4175,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp) {
}
void RewriteObjC::RewriteBlockCall(CallExpr *Exp) {
- Stmt *BlockCall = SynthesizeBlockCall(Exp);
+ Stmt *BlockCall = SynthesizeBlockCall(Exp, Exp->getCallee());
ReplaceStmt(Exp, BlockCall);
}
@@ -4137,12 +4193,27 @@ void RewriteObjC::RewriteBlockCall(CallExpr *Exp) {
// };
//}
Stmt *RewriteObjC::RewriteBlockDeclRefExpr(BlockDeclRefExpr *BDRE) {
- // FIXME: Add more elaborate code generation required by the ABI.
- Expr *DerefExpr = new (Context) UnaryOperator(BDRE, UnaryOperator::Deref,
- Context->getPointerType(BDRE->getType()),
- SourceLocation());
+ // Rewrite the byref variable into BYREFVAR->__forwarding->BYREFVAR
+ // for each BDRE where BYREFVAR is name of the variable.
+ FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(),
+ &Context->Idents.get("__forwarding"),
+ Context->VoidPtrTy, 0,
+ /*BitWidth=*/0, /*Mutable=*/true);
+ MemberExpr *ME = new (Context) MemberExpr(BDRE, true, FD, SourceLocation(),
+ FD->getType());
+ const char *Name = BDRE->getDecl()->getNameAsCString();
+ FD = FieldDecl::Create(*Context, 0, SourceLocation(),
+ &Context->Idents.get(Name),
+ Context->VoidPtrTy, 0,
+ /*BitWidth=*/0, /*Mutable=*/true);
+ ME = new (Context) MemberExpr(ME, true, FD, SourceLocation(),
+ BDRE->getType());
+
+
+
// Need parens to enforce precedence.
- ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), DerefExpr);
+ ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
+ ME);
ReplaceStmt(BDRE, PE);
return PE;
}
@@ -4298,6 +4369,94 @@ void RewriteObjC::RewriteBlockPointerDecl(NamedDecl *ND) {
return;
}
+/// RewriteByRefVar - For each __block typex ND variable this routine transforms
+/// the declaration into:
+/// struct __Block_byref_ND {
+/// void *__isa; // NULL for everything except __weak pointers
+/// struct __Block_byref_ND *__forwarding;
+/// int32_t __flags;
+/// int32_t __size;
+/// void *__ByrefKeepFuncPtr; // Only if variable is __block ObjC object
+/// void *__ByrefDestroyFuncPtr; // Only if variable is __block ObjC object
+/// typex ND;
+/// };
+///
+/// It then replaces declaration of ND variable with:
+/// struct __Block_byref_ND ND = {__isa=0B, __forwarding=&ND, __flags=some_flag,
+/// __size=sizeof(struct __Block_byref_ND),
+/// ND=initializer-if-any};
+///
+///
+void RewriteObjC::RewriteByRefVar(VarDecl *ND) {
+ SourceLocation DeclLoc = ND->getTypeSpecStartLoc();
+ const char *startBuf = SM->getCharacterData(DeclLoc);
+ SourceLocation X = ND->getLocEnd();
+ X = SM->getInstantiationLoc(X);
+ const char *endBuf = SM->getCharacterData(X);
+ std::string Name(ND->getNameAsString());
+ std::string ByrefType = "struct __Block_byref_";
+ ByrefType += Name;
+ ByrefType += " {\n";
+ ByrefType += " void *__isa;\n";
+ ByrefType += " struct __Block_byref_" + Name + " *__forwarding;\n";
+ ByrefType += " int __flags;\n";
+ ByrefType += " int __size;\n";
+ // FIXME. Add void *__ByrefKeepFuncPtr; void *__ByrefDestroyFuncPtr;
+ // if needed.
+ ND->getType().getAsStringInternal(Name, Context->PrintingPolicy);
+ ByrefType += " " + Name + ";\n";
+ ByrefType += "};\n";
+ // Insert this type in global scope. It is needed by helper function.
+ assert(CurFunctionDef && "RewriteByRefVar - CurFunctionDef is null");
+ SourceLocation FunLocStart = CurFunctionDef->getTypeSpecStartLoc();
+ InsertText(FunLocStart, ByrefType.c_str(), ByrefType.size());
+
+ // struct __Block_byref_ND ND =
+ // {0, &ND, some_flag, __size=sizeof(struct __Block_byref_ND),
+ // initializer-if-any};
+ bool hasInit = (ND->getInit() != 0);
+ Name = ND->getNameAsString();
+ ByrefType = "struct __Block_byref_" + Name;
+ if (!hasInit) {
+ ByrefType += " " + Name + " = ";
+ ByrefType += "{0, &" + Name + ", ";
+ // FIXME. Compute the flag.
+ ByrefType += "0, ";
+ ByrefType += "sizeof(struct __Block_byref_" + Name + ")";
+ ByrefType += "};\n";
+ ReplaceText(DeclLoc, endBuf-startBuf+Name.size(),
+ ByrefType.c_str(), ByrefType.size());
+ }
+ else {
+ SourceLocation startLoc = ND->getInit()->getLocStart();
+ ByrefType += " " + Name;
+ ReplaceText(DeclLoc, endBuf-startBuf,
+ ByrefType.c_str(), ByrefType.size());
+ ByrefType = " = {0, &" + Name + ", ";
+ // FIXME. Compute the flag.
+ ByrefType += "0, ";
+ ByrefType += "sizeof(struct __Block_byref_" + Name + "), ";
+ InsertText(startLoc, ByrefType.c_str(), ByrefType.size());
+
+ // Complete the newly synthesized compound expression by inserting a right
+ // curly brace before the end of the declaration.
+ // FIXME: This approach avoids rewriting the initializer expression. It
+ // also assumes there is only one declarator. For example, the following
+ // isn't currently supported by this routine (in general):
+ //
+ // double __block BYREFVAR = 1.34, BYREFVAR2 = 1.37;
+ //
+ const char *startBuf = SM->getCharacterData(startLoc);
+ const char *semiBuf = strchr(startBuf, ';');
+ assert((*semiBuf == ';') && "RewriteByRefVar: can't find ';'");
+ SourceLocation semiLoc =
+ startLoc.getFileLocWithOffset(semiBuf-startBuf);
+
+ InsertText(semiLoc, "}", 1);
+ }
+ return;
+}
+
void RewriteObjC::CollectBlockDeclRefInfo(BlockExpr *Exp) {
// Add initializers for any closure decl refs.
GetBlockDeclRefExprs(Exp->getBody());
@@ -4313,7 +4472,9 @@ void RewriteObjC::CollectBlockDeclRefInfo(BlockExpr *Exp) {
}
// Find any imported blocks...they will need special attention.
for (unsigned i = 0; i < BlockDeclRefs.size(); i++)
- if (BlockDeclRefs[i]->getType()->isBlockPointerType()) {
+ if (BlockDeclRefs[i]->isByRef() ||
+ BlockDeclRefs[i]->getType()->isObjCObjectPointerType() ||
+ BlockDeclRefs[i]->getType()->isBlockPointerType()) {
GetBlockCallExprs(BlockDeclRefs[i]);
ImportedBlockDecls.insert(BlockDeclRefs[i]->getDecl());
}
@@ -4422,16 +4583,14 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp) {
InitExprs.push_back(Exp);
}
}
- if (ImportedBlockDecls.size()) { // generate "1<<25" to indicate we have helper functions.
+ if (ImportedBlockDecls.size()) {
+ // generate BLOCK_HAS_COPY_DISPOSE(have helper funcs) | BLOCK_HAS_DESCRIPTOR
+ int flag = (BLOCK_HAS_COPY_DISPOSE | BLOCK_HAS_DESCRIPTOR);
unsigned IntSize =
static_cast<unsigned>(Context->getTypeSize(Context->IntTy));
- BinaryOperator *Exp = new (Context) BinaryOperator(
- new (Context) IntegerLiteral(llvm::APInt(IntSize, 1),
- Context->IntTy,SourceLocation()),
- new (Context) IntegerLiteral(llvm::APInt(IntSize, 25),
- Context->IntTy, SourceLocation()),
- BinaryOperator::Shl, Context->IntTy, SourceLocation());
- InitExprs.push_back(Exp);
+ Expr *FlagExp = new (Context) IntegerLiteral(llvm::APInt(IntSize, flag),
+ Context->IntTy, SourceLocation());
+ InitExprs.push_back(FlagExp);
}
NewRep = new (Context) CallExpr(*Context, DRE, &InitExprs[0], InitExprs.size(),
FType, SourceLocation());
@@ -4479,7 +4638,8 @@ Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) {
Stmts.push_back(S);
else if (isa<ObjCForCollectionStmt>(S)) {
Stmts.push_back(S);
- ObjCBcLabelNo.push_back(++BcLabelCount);
+ ++BcLabelCount;
+ ObjCBcLabelNo.push_back(BcLabelCount);
}
SourceRange OrigStmtRange = S->getSourceRange();
@@ -4640,6 +4800,9 @@ Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) {
RewriteBlockPointerDecl(ND);
else if (ND->getType()->isFunctionPointerType())
CheckFunctionPointerDecl(ND->getType(), ND);
+ if (VarDecl *VD = dyn_cast<VarDecl>(SD))
+ if (VD->hasAttr<BlocksAttr>())
+ RewriteByRefVar(VD);
}
if (TypedefDecl *TD = dyn_cast<TypedefDecl>(SD)) {
if (isTopLevelBlockPointerType(TD->getUnderlyingType()))
@@ -4668,7 +4831,7 @@ Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) {
}
if (CallExpr *CE = dyn_cast<CallExpr>(S)) {
if (CE->getCallee()->getType()->isBlockPointerType()) {
- Stmt *BlockCall = SynthesizeBlockCall(CE);
+ Stmt *BlockCall = SynthesizeBlockCall(CE, CE->getCallee());
ReplaceStmt(S, BlockCall);
return BlockCall;
}
diff --git a/lib/Frontend/Warnings.cpp b/lib/Frontend/Warnings.cpp
index ff44c9051663..4bf507d48dca 100644
--- a/lib/Frontend/Warnings.cpp
+++ b/lib/Frontend/Warnings.cpp
@@ -13,12 +13,12 @@
//
// This file is responsible for handling all warning options. This includes
// a number of -Wfoo options and their variants, which are driven by TableGen-
-// generated data, and the special cases -pedantic, -pedantic-errors, -w and
-// -Werror.
+// generated data, and the special cases -pedantic, -pedantic-errors, -w,
+// -Werror and -Wfatal-errors.
//
// Each warning option controls any number of actual warnings.
// Given a warning option 'foo', the following are valid:
-// -Wfoo, -Wno-foo, -Werror=foo
+// -Wfoo, -Wno-foo, -Werror=foo, -Wfatal-errors=foo
//
#include "clang/Frontend/Utils.h"
#include "clang/Basic/Diagnostic.h"
@@ -26,7 +26,6 @@
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Frontend/DiagnosticOptions.h"
#include "clang/Frontend/FrontendDiagnostic.h"
-#include <cstdio>
#include <cstring>
#include <utility>
#include <algorithm>
@@ -47,8 +46,6 @@ bool clang::ProcessWarningOptions(Diagnostic &Diags,
else
Diags.setExtensionHandlingBehavior(Diagnostic::Ext_Ignore);
- // FIXME: -Wfatal-errors / -Wfatal-errors=foo
-
for (unsigned i = 0, e = Opts.Warnings.size(); i != e; ++i) {
const std::string &Opt = Opts.Warnings[i];
const char *OptStart = &Opt[0];
@@ -81,8 +78,8 @@ bool clang::ProcessWarningOptions(Diagnostic &Diags,
if (OptEnd-OptStart != 5) { // Specifier must be present.
if ((OptStart[5] != '=' && OptStart[5] != '-') ||
OptEnd-OptStart == 6) {
- fprintf(stderr, "warning: unknown -Werror warning specifier: -W%s\n",
- Opt.c_str());
+ Diags.Report(diag::warn_unknown_warning_specifier)
+ << "-Werror" << ("-W" + Opt);
continue;
}
Specifier = OptStart+6;
@@ -98,6 +95,30 @@ bool clang::ProcessWarningOptions(Diagnostic &Diags,
OptStart = Specifier;
}
+ // -Wfatal-errors is yet another special case.
+ if (OptEnd-OptStart >= 12 && memcmp(OptStart, "fatal-errors", 12) == 0) {
+ const char* Specifier = 0;
+ if (OptEnd-OptStart != 12) {
+ if ((OptStart[12] != '=' && OptStart[12] != '-') ||
+ OptEnd-OptStart == 13) {
+ Diags.Report(diag::warn_unknown_warning_specifier)
+ << "-Wfatal-errors" << ("-W" + Opt);
+ continue;
+ }
+ Specifier = OptStart + 13;
+ }
+
+ if (Specifier == 0) {
+ Diags.setErrorsAsFatal(isPositive);
+ continue;
+ }
+
+ // -Wfatal-errors=foo maps foo to Fatal, -Wno-fatal-errors=foo
+ // maps it to Error.
+ Mapping = isPositive ? diag::MAP_FATAL : diag::MAP_ERROR_NO_WFATAL;
+ OptStart = Specifier;
+ }
+
if (Diags.setDiagnosticGroupMapping(OptStart, Mapping))
Diags.Report(diag::warn_unknown_warning_option) << ("-W" + Opt);
}
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index a91e40435cb0..d5a46433c36a 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -33,7 +33,7 @@
#include <cctype>
using namespace clang;
-static void InitCharacterInfo(LangOptions);
+static void InitCharacterInfo();
//===----------------------------------------------------------------------===//
// Token Class Implementation
@@ -59,7 +59,7 @@ tok::ObjCKeywordKind Token::getObjCKeywordID() const {
void Lexer::InitLexer(const char *BufStart, const char *BufPtr,
const char *BufEnd) {
- InitCharacterInfo(Features);
+ InitCharacterInfo();
BufferStart = BufStart;
BufferPtr = BufPtr;
@@ -254,7 +254,7 @@ enum {
// Statically initialize CharInfo table based on ASCII character set
// Reference: FreeBSD 7.2 /usr/share/misc/ascii
-static unsigned char CharInfo[256] =
+static const unsigned char CharInfo[256] =
{
// 0 NUL 1 SOH 2 STX 3 ETX
// 4 EOT 5 ENQ 6 ACK 7 BEL
@@ -322,7 +322,7 @@ static unsigned char CharInfo[256] =
0 , 0 , 0 , 0
};
-static void InitCharacterInfo(LangOptions Features) {
+static void InitCharacterInfo() {
static bool isInited = false;
if (isInited) return;
// check the statically-initialized CharInfo table
@@ -341,10 +341,6 @@ static void InitCharacterInfo(LangOptions Features) {
for (unsigned i = '0'; i <= '9'; ++i)
assert(CHAR_NUMBER == CharInfo[i]);
- if (Features.Microsoft)
- // Hack to treat DOS & CP/M EOF (^Z) as horizontal whitespace.
- CharInfo[26/*sub*/] = CHAR_HORZ_WS;
-
isInited = true;
}
@@ -1549,6 +1545,22 @@ LexNextToken:
return; // KeepWhitespaceMode
goto LexNextToken; // GCC isn't tail call eliminating.
+
+ case 26: // DOS & CP/M EOF: "^Z".
+ // If we're in Microsoft extensions mode, treat this as end of file.
+ if (Features.Microsoft) {
+ // Read the PP instance variable into an automatic variable, because
+ // LexEndOfFile will often delete 'this'.
+ Preprocessor *PPCache = PP;
+ if (LexEndOfFile(Result, CurPtr-1)) // Retreat back into the file.
+ return; // Got a token to return.
+ assert(PPCache && "Raw buffer::LexEndOfFile should return a token");
+ return PPCache->Lex(Result);
+ }
+ // If Microsoft extensions are disabled, this is just random garbage.
+ Kind = tok::unknown;
+ break;
+
case '\n':
case '\r':
// If we are inside a preprocessor directive and we see the end of line,
@@ -1599,7 +1611,7 @@ LexNextToken:
goto SkipHorizontalWhitespace;
}
goto LexNextToken; // GCC isn't tail call eliminating.
-
+
// C99 6.4.4.1: Integer Constants.
// C99 6.4.4.2: Floating Constants.
case '0': case '1': case '2': case '3': case '4':
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp
index ab669422b277..9aaa82d6263c 100644
--- a/lib/Lex/LiteralSupport.cpp
+++ b/lib/Lex/LiteralSupport.cpp
@@ -610,28 +610,14 @@ bool NumericLiteralParser::GetIntegerValue(llvm::APInt &Val) {
return OverflowOccurred;
}
-llvm::APFloat NumericLiteralParser::
-GetFloatValue(const llvm::fltSemantics &Format, bool* isExact) {
+llvm::APFloat::opStatus
+NumericLiteralParser::GetFloatValue(llvm::APFloat &Result) {
using llvm::APFloat;
using llvm::StringRef;
- llvm::SmallVector<char,256> floatChars;
unsigned n = std::min(SuffixBegin - ThisTokBegin, ThisTokEnd - ThisTokBegin);
- for (unsigned i = 0; i != n; ++i)
- floatChars.push_back(ThisTokBegin[i]);
-
- floatChars.push_back('\0');
-
- APFloat V (Format, APFloat::fcZero, false);
- APFloat::opStatus status;
-
- status = V.convertFromString(StringRef(&floatChars[0], n),
- APFloat::rmNearestTiesToEven);
-
- if (isExact)
- *isExact = status == APFloat::opOK;
-
- return V;
+ return Result.convertFromString(StringRef(ThisTokBegin, n),
+ APFloat::rmNearestTiesToEven);
}
diff --git a/lib/Lex/MacroArgs.cpp b/lib/Lex/MacroArgs.cpp
index 376cce8eb321..2f1a34c83297 100644
--- a/lib/Lex/MacroArgs.cpp
+++ b/lib/Lex/MacroArgs.cpp
@@ -24,12 +24,37 @@ MacroArgs *MacroArgs::create(const MacroInfo *MI,
Preprocessor &PP) {
assert(MI->isFunctionLike() &&
"Can't have args for an object-like macro!");
-
- // Allocate memory for the MacroArgs object with the lexer tokens at the end.
- MacroArgs *Result = (MacroArgs*)malloc(sizeof(MacroArgs) +
- NumToks*sizeof(Token));
- // Construct the macroargs object.
- new (Result) MacroArgs(NumToks, VarargsElided);
+ MacroArgs **ResultEnt = 0;
+ unsigned ClosestMatch = ~0U;
+
+ // See if we have an entry with a big enough argument list to reuse on the
+ // free list. If so, reuse it.
+ for (MacroArgs **Entry = &PP.MacroArgCache; *Entry;
+ Entry = &(*Entry)->ArgCache)
+ if ((*Entry)->NumUnexpArgTokens >= NumToks &&
+ (*Entry)->NumUnexpArgTokens < ClosestMatch) {
+ ResultEnt = Entry;
+
+ // If we have an exact match, use it.
+ if ((*Entry)->NumUnexpArgTokens == NumToks)
+ break;
+ // Otherwise, use the best fit.
+ ClosestMatch = (*Entry)->NumUnexpArgTokens;
+ }
+
+ MacroArgs *Result;
+ if (ResultEnt == 0) {
+ // Allocate memory for a MacroArgs object with the lexer tokens at the end.
+ Result = (MacroArgs*)malloc(sizeof(MacroArgs) + NumToks*sizeof(Token));
+ // Construct the MacroArgs object.
+ new (Result) MacroArgs(NumToks, VarargsElided);
+ } else {
+ Result = *ResultEnt;
+ // Unlink this node from the preprocessors singly linked list.
+ *ResultEnt = Result->ArgCache;
+ Result->NumUnexpArgTokens = NumToks;
+ Result->VarargsElided = VarargsElided;
+ }
// Copy the actual unexpanded tokens to immediately after the result ptr.
if (NumToks)
@@ -42,10 +67,16 @@ MacroArgs *MacroArgs::create(const MacroInfo *MI,
/// destroy - Destroy and deallocate the memory for this object.
///
void MacroArgs::destroy(Preprocessor &PP) {
- // Run the dtor to deallocate the vectors.
- this->~MacroArgs();
- // Release the memory for the object.
- free(this);
+ StringifiedArgs.clear();
+
+ // Don't clear PreExpArgTokens, just clear the entries. Clearing the entries
+ // would deallocate the element vectors.
+ for (unsigned i = 0, e = PreExpArgTokens.size(); i != e; ++i)
+ PreExpArgTokens[i].clear();
+
+ // Add this to the preprocessor's free list.
+ ArgCache = PP.MacroArgCache;
+ PP.MacroArgCache = this;
}
/// deallocate - This should only be called by the Preprocessor when managing
@@ -110,13 +141,14 @@ bool MacroArgs::ArgNeedsPreexpansion(const Token *ArgTok,
/// getPreExpArgument - Return the pre-expanded form of the specified
/// argument.
const std::vector<Token> &
-MacroArgs::getPreExpArgument(unsigned Arg, Preprocessor &PP) {
- assert(Arg < NumUnexpArgTokens && "Invalid argument number!");
+MacroArgs::getPreExpArgument(unsigned Arg, const MacroInfo *MI,
+ Preprocessor &PP) {
+ assert(Arg < MI->getNumArgs() && "Invalid argument number!");
// If we have already computed this, return it.
- if (PreExpArgTokens.empty())
- PreExpArgTokens.resize(NumUnexpArgTokens);
-
+ if (PreExpArgTokens.size() < MI->getNumArgs())
+ PreExpArgTokens.resize(MI->getNumArgs());
+
std::vector<Token> &Result = PreExpArgTokens[Arg];
if (!Result.empty()) return Result;
@@ -156,7 +188,7 @@ Token MacroArgs::StringifyArgument(const Token *ArgToks,
Preprocessor &PP, bool Charify) {
Token Tok;
Tok.startToken();
- Tok.setKind(tok::string_literal);
+ Tok.setKind(Charify ? tok::char_constant : tok::string_literal);
const Token *ArgTokStart = ArgToks;
diff --git a/lib/Lex/MacroArgs.h b/lib/Lex/MacroArgs.h
index fa040c7a4d6f..6ff4856b4e1c 100644
--- a/lib/Lex/MacroArgs.h
+++ b/lib/Lex/MacroArgs.h
@@ -82,7 +82,7 @@ public:
/// getPreExpArgument - Return the pre-expanded form of the specified
/// argument.
const std::vector<Token> &
- getPreExpArgument(unsigned Arg, Preprocessor &PP);
+ getPreExpArgument(unsigned Arg, const MacroInfo *MI, Preprocessor &PP);
/// getStringifiedArgument - Compute, cache, and return the specified argument
/// that has been 'stringified' as required by the # operator.
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp
index f5c60eb49438..9e3d283d8886 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/lib/Lex/PPDirectives.cpp
@@ -220,32 +220,28 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc,
// Get the identifier name without trigraphs or embedded newlines. Note
// that we can't use Tok.getIdentifierInfo() because its lookup is disabled
// when skipping.
- // TODO: could do this with zero copies in the no-clean case by using
- // strncmp below.
- char Directive[20];
- unsigned IdLen;
+ char DirectiveBuf[20];
+ llvm::StringRef Directive;
if (!Tok.needsCleaning() && Tok.getLength() < 20) {
- IdLen = Tok.getLength();
- memcpy(Directive, RawCharData, IdLen);
- Directive[IdLen] = 0;
+ Directive = llvm::StringRef(RawCharData, Tok.getLength());
} else {
std::string DirectiveStr = getSpelling(Tok);
- IdLen = DirectiveStr.size();
+ unsigned IdLen = DirectiveStr.size();
if (IdLen >= 20) {
CurPPLexer->ParsingPreprocessorDirective = false;
// Restore comment saving mode.
if (CurLexer) CurLexer->SetCommentRetentionState(KeepComments);
continue;
}
- memcpy(Directive, &DirectiveStr[0], IdLen);
- Directive[IdLen] = 0;
- FirstChar = Directive[0];
+ memcpy(DirectiveBuf, &DirectiveStr[0], IdLen);
+ Directive = llvm::StringRef(DirectiveBuf, IdLen);
}
- if (FirstChar == 'i' && Directive[1] == 'f') {
- if ((IdLen == 2) || // "if"
- (IdLen == 5 && !strcmp(Directive+2, "def")) || // "ifdef"
- (IdLen == 6 && !strcmp(Directive+2, "ndef"))) { // "ifndef"
+ if (Directive.startswith("if")) {
+ llvm::StringRef Sub = Directive.substr(2);
+ if (Sub.empty() || // "if"
+ Sub == "def" || // "ifdef"
+ Sub == "ndef") { // "ifndef"
// We know the entire #if/#ifdef/#ifndef block will be skipped, don't
// bother parsing the condition.
DiscardUntilEndOfDirective();
@@ -253,8 +249,9 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc,
/*foundnonskip*/false,
/*fnddelse*/false);
}
- } else if (FirstChar == 'e') {
- if (IdLen == 5 && !strcmp(Directive+1, "ndif")) { // "endif"
+ } else if (Directive[0] == 'e') {
+ llvm::StringRef Sub = Directive.substr(1);
+ if (Sub == "ndif") { // "endif"
CheckEndOfDirective("endif");
PPConditionalInfo CondInfo;
CondInfo.WasSkipping = true; // Silence bogus warning.
@@ -265,7 +262,7 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc,
// If we popped the outermost skipping block, we're done skipping!
if (!CondInfo.WasSkipping)
break;
- } else if (IdLen == 4 && !strcmp(Directive+1, "lse")) { // "else".
+ } else if (Sub == "lse") { // "else".
// #else directive in a skipping conditional. If not in some other
// skipping conditional, and if #else hasn't already been seen, enter it
// as a non-skipping conditional.
@@ -284,7 +281,7 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc,
CondInfo.FoundNonSkip = true;
break;
}
- } else if (IdLen == 4 && !strcmp(Directive+1, "lif")) { // "elif".
+ } else if (Sub == "lif") { // "elif".
PPConditionalInfo &CondInfo = CurPPLexer->peekConditionalLevel();
bool ShouldEnter;
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index d4e441b2f183..81966cb2b918 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -446,19 +446,10 @@ void Preprocessor::EnterMainSourceFile() {
if (const FileEntry *FE = SourceMgr.getFileEntryForID(MainFileID))
HeaderInfo.IncrementIncludeCount(FE);
- std::vector<char> PrologFile;
- PrologFile.reserve(4080);
-
- // FIXME: Don't make a copy.
- PrologFile.insert(PrologFile.end(), Predefines.begin(), Predefines.end());
-
- // Memory buffer must end with a null byte!
- PrologFile.push_back(0);
-
- // Now that we have emitted the predefined macros, #includes, etc into
- // PrologFile, preprocess it to populate the initial preprocessor state.
+ // Preprocess Predefines to populate the initial preprocessor state.
llvm::MemoryBuffer *SB =
- llvm::MemoryBuffer::getMemBufferCopy(&PrologFile.front(),&PrologFile.back(),
+ llvm::MemoryBuffer::getMemBufferCopy(Predefines.data(),
+ Predefines.data() + Predefines.size(),
"<built-in>");
assert(SB && "Cannot fail to create predefined source buffer");
FileID FID = SourceMgr.createFileIDForMemBuffer(SB);
diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp
index a40bb62db46d..5d95eb39c89e 100644
--- a/lib/Lex/TokenLexer.cpp
+++ b/lib/Lex/TokenLexer.cpp
@@ -175,7 +175,7 @@ void TokenLexer::ExpandFunctionArguments() {
// avoids some work in common cases.
const Token *ArgTok = ActualArgs->getUnexpArgument(ArgNo);
if (ActualArgs->ArgNeedsPreexpansion(ArgTok, PP))
- ResultArgToks = &ActualArgs->getPreExpArgument(ArgNo, PP)[0];
+ ResultArgToks = &ActualArgs->getPreExpArgument(ArgNo, Macro, PP)[0];
else
ResultArgToks = ArgTok; // Use non-preexpanded tokens.
@@ -414,7 +414,7 @@ bool TokenLexer::PasteTokens(Token &Tok) {
ResultTokTmp.startToken();
// Claim that the tmp token is a string_literal so that we can get the
- // character pointer back from CreateString.
+ // character pointer back from CreateString in getLiteralData().
ResultTokTmp.setKind(tok::string_literal);
PP.CreateString(&Buffer[0], Buffer.size(), ResultTokTmp);
SourceLocation ResultTokLoc = ResultTokTmp.getLocation();
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp
index b9314d242442..f1e639c2957d 100644
--- a/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/lib/Parse/ParseCXXInlineMethods.cpp
@@ -95,9 +95,12 @@ void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
if (HasTemplateScope)
Actions.ActOnReenterTemplateScope(CurScope, Class.TagOrTemplate);
+ // The current scope is still active if we're the top-level class.
+ // Otherwise we'll need to push and enter a new scope.
bool HasClassScope = !Class.TopLevelClass;
- ParseScope ClassScope(this, Scope::ClassScope|Scope::DeclScope,
- HasClassScope);
+ ParseScope ClassScope(this, Scope::ClassScope|Scope::DeclScope, HasClassScope);
+ if (HasClassScope)
+ Actions.ActOnStartDelayedMemberDeclarations(CurScope, Class.TagOrTemplate);
for (; !Class.MethodDecls.empty(); Class.MethodDecls.pop_front()) {
LateParsedMethodDeclaration &LM = Class.MethodDecls.front();
@@ -148,6 +151,9 @@ void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
for (unsigned I = 0, N = Class.NestedClasses.size(); I != N; ++I)
ParseLexedMethodDeclarations(*Class.NestedClasses[I]);
+
+ if (HasClassScope)
+ Actions.ActOnFinishDelayedMemberDeclarations(CurScope, Class.TagOrTemplate);
}
/// ParseLexedMethodDefs - We finished parsing the member specification of a top
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 5dd78f7b547c..f429ac991d83 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -550,13 +550,17 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
SourceLocation DelLoc = ConsumeToken();
Actions.SetDeclDeleted(ThisDecl, DelLoc);
} else {
- if (getLang().CPlusPlus)
+ if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
+ EnterScope(0);
Actions.ActOnCXXEnterDeclInitializer(CurScope, ThisDecl);
+ }
OwningExprResult Init(ParseInitializer());
- if (getLang().CPlusPlus)
+ if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
Actions.ActOnCXXExitDeclInitializer(CurScope, ThisDecl);
+ ExitScope();
+ }
if (Init.isInvalid()) {
SkipUntil(tok::semi, true, true);
@@ -570,14 +574,30 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
ExprVector Exprs(Actions);
CommaLocsTy CommaLocs;
+ if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
+ EnterScope(0);
+ Actions.ActOnCXXEnterDeclInitializer(CurScope, ThisDecl);
+ }
+
if (ParseExpressionList(Exprs, CommaLocs)) {
SkipUntil(tok::r_paren);
+
+ if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
+ Actions.ActOnCXXExitDeclInitializer(CurScope, ThisDecl);
+ ExitScope();
+ }
} else {
// Match the ')'.
SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
assert(!Exprs.empty() && Exprs.size()-1 == CommaLocs.size() &&
"Unexpected number of commas!");
+
+ if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
+ Actions.ActOnCXXExitDeclInitializer(CurScope, ThisDecl);
+ ExitScope();
+ }
+
Actions.AddCXXDirectInitializerToDecl(ThisDecl, LParenLoc,
move_arg(Exprs),
CommaLocs.data(), RParenLoc);
@@ -2349,7 +2369,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
if (ParseUnqualifiedId(D.getCXXScopeSpec(),
/*EnteringContext=*/true,
/*AllowDestructorName=*/true,
- /*AllowConstructorName=*/!D.getDeclSpec().hasTypeSpecifier(),
+ /*AllowConstructorName=*/!D.getDeclSpec().hasTypeSpecifier(),
/*ObjectType=*/0,
D.getName())) {
D.SetIdentifier(0, Tok.getLocation());
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index d4d19a0b0765..265d0f3e849f 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -852,20 +852,14 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
SS, Name, StartLoc, NameLoc);
}
- // Parse the optional base clause (C++ only).
- if (getLang().CPlusPlus && Tok.is(tok::colon))
- ParseBaseClause(TagOrTempResult.get());
-
// If there is a body, parse it and inform the actions module.
- if (Tok.is(tok::l_brace))
+ if (TUK == Action::TUK_Definition) {
+ assert(Tok.is(tok::l_brace) ||
+ (getLang().CPlusPlus && Tok.is(tok::colon)));
if (getLang().CPlusPlus)
ParseCXXMemberSpecification(StartLoc, TagType, TagOrTempResult.get());
else
ParseStructUnionBody(StartLoc, TagType, TagOrTempResult.get());
- else if (TUK == Action::TUK_Definition) {
- // FIXME: Complain that we have a base-specifier list but no
- // definition.
- Diag(Tok, diag::err_expected_lbrace);
}
void *Result;
@@ -1364,8 +1358,6 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
PP.getSourceManager(),
"parsing struct/union/class body");
- SourceLocation LBraceLoc = ConsumeBrace();
-
// Determine whether this is a top-level (non-nested) class.
bool TopLevelClass = ClassStack.empty() ||
CurScope->isInCXXInlineMethodScope();
@@ -1378,11 +1370,27 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
if (TagDecl)
Actions.ActOnTagStartDefinition(CurScope, TagDecl);
- else {
+
+ if (Tok.is(tok::colon)) {
+ ParseBaseClause(TagDecl);
+
+ if (!Tok.is(tok::l_brace)) {
+ Diag(Tok, diag::err_expected_lbrace_after_base_specifiers);
+ return;
+ }
+ }
+
+ assert(Tok.is(tok::l_brace));
+
+ SourceLocation LBraceLoc = ConsumeBrace();
+
+ if (!TagDecl) {
SkipUntil(tok::r_brace, false, false);
return;
}
+ Actions.ActOnStartCXXMemberDeclarations(CurScope, TagDecl, LBraceLoc);
+
// C++ 11p3: Members of a class defined with the keyword class are private
// by default. Members of a class defined with the keywords struct or union
// are public by default.
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 2c53847f8ed0..9904a2ca85dc 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1589,7 +1589,7 @@ Parser::OwningStmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
// Otherwise, eat the semicolon.
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
- return Actions.ActOnExprStmt(Actions.FullExpr(Res));
+ return Actions.ActOnExprStmt(Actions.MakeFullExpr(Res));
}
Parser::OwningExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index a2ac64655502..9085b8713dfd 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -131,7 +131,7 @@ Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
}
// Otherwise, eat the semicolon.
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
- return Actions.ActOnExprStmt(Actions.FullExpr(Expr));
+ return Actions.ActOnExprStmt(Actions.MakeFullExpr(Expr));
}
case tok::kw_case: // C99 6.8.1: labeled-statement
@@ -494,7 +494,7 @@ Parser::OwningStmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
// Eat the semicolon at the end of stmt and convert the expr into a
// statement.
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
- R = Actions.ActOnExprStmt(Actions.FullExpr(Res));
+ R = Actions.ActOnExprStmt(Actions.MakeFullExpr(Res));
}
}
@@ -593,7 +593,7 @@ Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) {
if (ParseParenExprOrCondition(CondExp, CondVar))
return StmtError();
- FullExprArg FullCondExp(Actions.FullExpr(CondExp));
+ FullExprArg FullCondExp(Actions.MakeFullExpr(CondExp));
// C99 6.8.4p3 - In C99, the body of the if statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do this
@@ -720,7 +720,7 @@ Parser::OwningStmtResult Parser::ParseSwitchStatement(AttributeList *Attr) {
if (ParseParenExprOrCondition(Cond, CondVar))
return StmtError();
- FullExprArg FullCond(Actions.FullExpr(Cond));
+ FullExprArg FullCond(Actions.MakeFullExpr(Cond));
OwningStmtResult Switch = Actions.ActOnStartOfSwitchStmt(FullCond, CondVar);
@@ -801,7 +801,7 @@ Parser::OwningStmtResult Parser::ParseWhileStatement(AttributeList *Attr) {
if (ParseParenExprOrCondition(Cond, CondVar))
return StmtError();
- FullExprArg FullCond(Actions.FullExpr(Cond));
+ FullExprArg FullCond(Actions.MakeFullExpr(Cond));
// C99 6.8.5p5 - In C99, the body of the if statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do this
@@ -993,7 +993,7 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
// Turn the expression into a stmt.
if (!Value.isInvalid())
- FirstPart = Actions.ActOnExprStmt(Actions.FullExpr(Value));
+ FirstPart = Actions.ActOnExprStmt(Actions.MakeFullExpr(Value));
if (Tok.is(tok::semi)) {
ConsumeToken();
@@ -1060,8 +1060,8 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
if (!ForEach)
return Actions.ActOnForStmt(ForLoc, LParenLoc, move(FirstPart),
- Actions.FullExpr(SecondPart), SecondVar,
- Actions.FullExpr(ThirdPart), RParenLoc,
+ Actions.MakeFullExpr(SecondPart), SecondVar,
+ Actions.MakeFullExpr(ThirdPart), RParenLoc,
move(Body));
return Actions.ActOnObjCForCollectionStmt(ForLoc, LParenLoc,
@@ -1232,7 +1232,6 @@ Parser::OwningStmtResult Parser::ParseAsmStatement(bool &msAsm) {
// Remember if this was a volatile asm.
bool isVolatile = DS.getTypeQualifiers() & DeclSpec::TQ_volatile;
- bool isSimple = false;
if (Tok.isNot(tok::l_paren)) {
Diag(Tok, diag::err_expected_lparen_after) << "asm";
SkipUntil(tok::r_paren);
@@ -1249,53 +1248,73 @@ Parser::OwningStmtResult Parser::ParseAsmStatement(bool &msAsm) {
ExprVector Exprs(Actions);
ExprVector Clobbers(Actions);
- unsigned NumInputs = 0, NumOutputs = 0;
-
- SourceLocation RParenLoc;
if (Tok.is(tok::r_paren)) {
- // We have a simple asm expression
- isSimple = true;
-
- RParenLoc = ConsumeParen();
- } else {
- // Parse Outputs, if present.
- if (ParseAsmOperandsOpt(Names, Constraints, Exprs))
- return StmtError();
-
- NumOutputs = Names.size();
+ // We have a simple asm expression like 'asm("foo")'.
+ SourceLocation RParenLoc = ConsumeParen();
+ return Actions.ActOnAsmStmt(AsmLoc, /*isSimple*/ true, isVolatile,
+ /*NumOutputs*/ 0, /*NumInputs*/ 0, 0,
+ move_arg(Constraints), move_arg(Exprs),
+ move(AsmString), move_arg(Clobbers),
+ RParenLoc);
+ }
- // Parse Inputs, if present.
- if (ParseAsmOperandsOpt(Names, Constraints, Exprs))
- return StmtError();
+ // Parse Outputs, if present.
+ bool AteExtraColon = false;
+ if (Tok.is(tok::colon) || Tok.is(tok::coloncolon)) {
+ // In C++ mode, parse "::" like ": :".
+ AteExtraColon = Tok.is(tok::coloncolon);
+ ConsumeToken();
+
+ if (!AteExtraColon &&
+ ParseAsmOperandsOpt(Names, Constraints, Exprs))
+ return StmtError();
+ }
+
+ unsigned NumOutputs = Names.size();
+
+ // Parse Inputs, if present.
+ if (AteExtraColon ||
+ Tok.is(tok::colon) || Tok.is(tok::coloncolon)) {
+ // In C++ mode, parse "::" like ": :".
+ if (AteExtraColon)
+ AteExtraColon = false;
+ else {
+ AteExtraColon = Tok.is(tok::coloncolon);
+ ConsumeToken();
+ }
+
+ if (!AteExtraColon &&
+ ParseAsmOperandsOpt(Names, Constraints, Exprs))
+ return StmtError();
+ }
- assert(Names.size() == Constraints.size() &&
- Constraints.size() == Exprs.size()
- && "Input operand size mismatch!");
+ assert(Names.size() == Constraints.size() &&
+ Constraints.size() == Exprs.size() &&
+ "Input operand size mismatch!");
- NumInputs = Names.size() - NumOutputs;
+ unsigned NumInputs = Names.size() - NumOutputs;
- // Parse the clobbers, if present.
- if (Tok.is(tok::colon)) {
+ // Parse the clobbers, if present.
+ if (AteExtraColon || Tok.is(tok::colon)) {
+ if (!AteExtraColon)
ConsumeToken();
- // Parse the asm-string list for clobbers.
- while (1) {
- OwningExprResult Clobber(ParseAsmStringLiteral());
+ // Parse the asm-string list for clobbers.
+ while (1) {
+ OwningExprResult Clobber(ParseAsmStringLiteral());
- if (Clobber.isInvalid())
- break;
+ if (Clobber.isInvalid())
+ break;
- Clobbers.push_back(Clobber.release());
+ Clobbers.push_back(Clobber.release());
- if (Tok.isNot(tok::comma)) break;
- ConsumeToken();
- }
+ if (Tok.isNot(tok::comma)) break;
+ ConsumeToken();
}
-
- RParenLoc = MatchRHSPunctuation(tok::r_paren, Loc);
}
- return Actions.ActOnAsmStmt(AsmLoc, isSimple, isVolatile,
+ SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, Loc);
+ return Actions.ActOnAsmStmt(AsmLoc, false, isVolatile,
NumOutputs, NumInputs, Names.data(),
move_arg(Constraints), move_arg(Exprs),
move(AsmString), move_arg(Clobbers),
@@ -1303,8 +1322,7 @@ Parser::OwningStmtResult Parser::ParseAsmStatement(bool &msAsm) {
}
/// ParseAsmOperands - Parse the asm-operands production as used by
-/// asm-statement. We also parse a leading ':' token. If the leading colon is
-/// not present, we do not parse anything.
+/// asm-statement, assuming the leading ':' token was eaten.
///
/// [GNU] asm-operands:
/// asm-operand
@@ -1319,10 +1337,6 @@ Parser::OwningStmtResult Parser::ParseAsmStatement(bool &msAsm) {
bool Parser::ParseAsmOperandsOpt(llvm::SmallVectorImpl<std::string> &Names,
llvm::SmallVectorImpl<ExprTy*> &Constraints,
llvm::SmallVectorImpl<ExprTy*> &Exprs) {
- // Only do anything if this operand is present.
- if (Tok.isNot(tok::colon)) return false;
- ConsumeToken();
-
// 'asm-operands' isn't present?
if (!isTokenStringLiteral() && Tok.isNot(tok::l_square))
return false;
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index cc28541b01fe..8b8af99ec6d7 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -643,8 +643,10 @@ Parser::ParseTemplateIdAfterTemplateName(TemplateTy Template,
}
}
- if (Tok.isNot(tok::greater) && Tok.isNot(tok::greatergreater))
+ if (Tok.isNot(tok::greater) && Tok.isNot(tok::greatergreater)) {
+ Diag(Tok.getLocation(), diag::err_expected_greater);
return true;
+ }
// Determine the location of the '>' or '>>'. Only consume this
// token if the caller asked us to.
@@ -989,7 +991,7 @@ Parser::ParseTemplateArgumentList(TemplateArgList &TemplateArgs) {
ConsumeToken();
}
- return Tok.isNot(tok::greater) && Tok.isNot(tok::greatergreater);
+ return false;
}
/// \brief Parse a C++ explicit template instantiation
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index dabd065a979a..51c56706bb59 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -680,10 +680,11 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
// Otherwise, not a typename.
return TPResult::False();
- case tok::coloncolon: // ::foo::bar
- if (NextToken().is(tok::kw_new) || // ::new
- NextToken().is(tok::kw_delete)) // ::delete
- return TPResult::False();
+ case tok::coloncolon: { // ::foo::bar
+ const Token &Next = NextToken();
+ if (Next.is(tok::kw_new) || // ::new
+ Next.is(tok::kw_delete)) // ::delete
+ return TPResult::False();
// Annotate typenames and C++ scope specifiers. If we get one, just
// recurse to handle whatever we get.
@@ -691,7 +692,8 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
return isCXXDeclarationSpecifier();
// Otherwise, not a typename.
return TPResult::False();
-
+ }
+
// decl-specifier:
// storage-class-specifier
// type-specifier
@@ -699,7 +701,6 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
// 'friend'
// 'typedef'
// 'constexpr'
-
case tok::kw_friend:
case tok::kw_typedef:
case tok::kw_constexpr:
@@ -750,6 +751,12 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
case tok::kw___forceinline:
return TPResult::True();
+ case tok::annot_cxxscope: // foo::bar or ::foo::bar, but already parsed
+ // We've already annotated a scope; try to annotate a type.
+ if (!(TryAnnotateTypeOrScopeToken() && Tok.is(tok::annot_typename)))
+ return TPResult::False();
+ // If that succeeded, fallthrough into the generic simple-type-id case.
+
// The ambiguity resides in a simple-type-specifier/typename-specifier
// followed by a '('. The '(' could either be the start of:
//
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index a864e7c24cba..52c0153bfad8 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -880,7 +880,7 @@ Parser::OwningExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) {
/// as the current tokens, so only call it in contexts where these are invalid.
bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) {
assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon)
- || Tok.is(tok::kw_typename)) &&
+ || Tok.is(tok::kw_typename) || Tok.is(tok::annot_cxxscope)) &&
"Cannot be a type or scope token!");
if (Tok.is(tok::kw_typename)) {
@@ -935,6 +935,9 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) {
return true;
}
+ // Remembers whether the token was originally a scope annotation.
+ bool wasScopeAnnotation = Tok.is(tok::annot_cxxscope);
+
CXXScopeSpec SS;
if (getLang().CPlusPlus)
ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, EnteringContext);
@@ -1017,9 +1020,11 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) {
Tok.setAnnotationValue(SS.getScopeRep());
Tok.setAnnotationRange(SS.getRange());
- // In case the tokens were cached, have Preprocessor replace them with the
- // annotation token.
- PP.AnnotateCachedTokens(Tok);
+ // In case the tokens were cached, have Preprocessor replace them
+ // with the annotation token. We don't need to do this if we've
+ // just reverted back to the state we were in before being called.
+ if (!wasScopeAnnotation)
+ PP.AnnotateCachedTokens(Tok);
return true;
}
diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp
index d8ed8949cb5d..b9b85dfb8084 100644
--- a/lib/Sema/CodeCompleteConsumer.cpp
+++ b/lib/Sema/CodeCompleteConsumer.cpp
@@ -37,6 +37,7 @@ CodeCompletionString::Chunk::Chunk(ChunkKind Kind, llvm::StringRef Text)
case CK_Text:
case CK_Placeholder:
case CK_Informative:
+ case CK_ResultType:
case CK_CurrentParameter: {
char *New = new char [Text.size() + 1];
std::memcpy(New, Text.data(), Text.size());
@@ -112,6 +113,11 @@ CodeCompletionString::Chunk::CreateInformative(StringRef Informative) {
}
CodeCompletionString::Chunk
+CodeCompletionString::Chunk::CreateResultType(StringRef ResultType) {
+ return Chunk(CK_ResultType, ResultType);
+}
+
+CodeCompletionString::Chunk
CodeCompletionString::Chunk::CreateCurrentParameter(
StringRef CurrentParameter) {
return Chunk(CK_CurrentParameter, CurrentParameter);
@@ -123,6 +129,7 @@ CodeCompletionString::Chunk CodeCompletionString::Chunk::Clone() const {
case CK_Text:
case CK_Placeholder:
case CK_Informative:
+ case CK_ResultType:
case CK_CurrentParameter:
case CK_LeftParen:
case CK_RightParen:
@@ -156,6 +163,7 @@ CodeCompletionString::Chunk::Destroy() {
case CK_Text:
case CK_Placeholder:
case CK_Informative:
+ case CK_ResultType:
case CK_CurrentParameter:
delete [] Text;
break;
@@ -186,7 +194,12 @@ std::string CodeCompletionString::getAsString() const {
switch (C->Kind) {
case CK_Optional: OS << "{#" << C->Optional->getAsString() << "#}"; break;
case CK_Placeholder: OS << "<#" << C->Text << "#>"; break;
- case CK_Informative: OS << "[#" << C->Text << "#]"; break;
+
+ case CK_Informative:
+ case CK_ResultType:
+ OS << "[#" << C->Text << "#]";
+ break;
+
case CK_CurrentParameter: OS << "<#" << C->Text << "#>"; break;
default: OS << C->Text; break;
}
@@ -236,6 +249,7 @@ void CodeCompletionString::Serialize(llvm::raw_ostream &OS) const {
case CK_Text:
case CK_Placeholder:
case CK_Informative:
+ case CK_ResultType:
case CK_CurrentParameter: {
const char *Text = C->Text;
unsigned StrLen = strlen(Text);
@@ -286,6 +300,7 @@ CodeCompletionString *CodeCompletionString::Deserialize(const char *&Str,
case CK_Text:
case CK_Placeholder:
case CK_Informative:
+ case CK_ResultType:
case CK_CurrentParameter: {
unsigned StrLen;
if (ReadUnsigned(Str, StrEnd, StrLen) || (Str + StrLen > StrEnd))
diff --git a/lib/Sema/Lookup.h b/lib/Sema/Lookup.h
index 78f79eac2ba1..c5eecdac48e8 100644
--- a/lib/Sema/Lookup.h
+++ b/lib/Sema/Lookup.h
@@ -121,6 +121,8 @@ public:
typedef llvm::SmallVector<NamedDecl*, 4> DeclsTy;
typedef DeclsTy::const_iterator iterator;
+ typedef bool (*ResultFilter)(NamedDecl*, unsigned IDNS);
+
LookupResult(Sema &SemaRef, DeclarationName Name, SourceLocation NameLoc,
Sema::LookupNameKind LookupKind,
Sema::RedeclarationKind Redecl = Sema::NotForRedeclaration)
@@ -130,11 +132,14 @@ public:
Name(Name),
NameLoc(NameLoc),
LookupKind(LookupKind),
+ IsAcceptableFn(0),
IDNS(0),
Redecl(Redecl != Sema::NotForRedeclaration),
HideTags(true),
Diagnose(Redecl == Sema::NotForRedeclaration)
- {}
+ {
+ configure();
+ }
/// Creates a temporary lookup result, initializing its core data
/// using the information from another result. Diagnostics are always
@@ -146,6 +151,7 @@ public:
Name(Other.Name),
NameLoc(Other.NameLoc),
LookupKind(Other.LookupKind),
+ IsAcceptableFn(Other.IsAcceptableFn),
IDNS(Other.IDNS),
Redecl(Other.Redecl),
HideTags(Other.HideTags),
@@ -162,6 +168,11 @@ public:
return Name;
}
+ /// \brief Sets the name to look up.
+ void setLookupName(DeclarationName Name) {
+ this->Name = Name;
+ }
+
/// Gets the kind of lookup to perform.
Sema::LookupNameKind getLookupKind() const {
return LookupKind;
@@ -178,17 +189,6 @@ public:
HideTags = Hide;
}
- /// The identifier namespace of this lookup. This information is
- /// private to the lookup routines.
- unsigned getIdentifierNamespace() const {
- assert(IDNS);
- return IDNS;
- }
-
- void setIdentifierNamespace(unsigned NS) {
- IDNS = NS;
- }
-
bool isAmbiguous() const {
return getResultKind() == Ambiguous;
}
@@ -231,7 +231,19 @@ public:
return Paths;
}
- /// \brief Add a declaration to these results.
+ /// \brief Tests whether the given declaration is acceptable.
+ bool isAcceptableDecl(NamedDecl *D) const {
+ assert(IsAcceptableFn);
+ return IsAcceptableFn(D, IDNS);
+ }
+
+ /// \brief Returns the identifier namespace mask for this lookup.
+ unsigned getIdentifierNamespace() const {
+ return IDNS;
+ }
+
+ /// \brief Add a declaration to these results. Does not test the
+ /// acceptance criteria.
void addDecl(NamedDecl *D) {
Decls.push_back(D);
ResultKind = Found;
@@ -334,6 +346,7 @@ public:
void clear(Sema::LookupNameKind Kind) {
clear();
LookupKind = Kind;
+ configure();
}
void print(llvm::raw_ostream &);
@@ -362,6 +375,10 @@ public:
return NameLoc;
}
+ /// \brief Get the Sema object that this lookup result is searching
+ /// with.
+ Sema &getSema() const { return SemaRef; }
+
/// A class for iterating through a result set and possibly
/// filtering out results. The results returned are possibly
/// sugared.
@@ -438,6 +455,7 @@ private:
}
void addDeclsFromBasePaths(const CXXBasePaths &P);
+ void configure();
// Sanity checks.
void sanity() const {
@@ -476,7 +494,9 @@ private:
SourceLocation NameLoc;
SourceRange NameContextRange;
Sema::LookupNameKind LookupKind;
- unsigned IDNS; // ill-defined until set by lookup
+ ResultFilter IsAcceptableFn; // set by configure()
+ unsigned IDNS; // set by configure()
+
bool Redecl;
/// \brief True if tag declarations should be hidden if non-tags
@@ -486,6 +506,26 @@ private:
bool Diagnose;
};
+ /// \brief Consumes visible declarations found when searching for
+ /// all visible names within a given scope or context.
+ ///
+ /// This abstract class is meant to be subclassed by clients of \c
+ /// Sema::LookupVisibleDecls(), each of which should override the \c
+ /// FoundDecl() function to process declarations as they are found.
+ class VisibleDeclConsumer {
+ public:
+ /// \brief Destroys the visible declaration consumer.
+ virtual ~VisibleDeclConsumer();
+
+ /// \brief Invoked each time \p Sema::LookupVisibleDecls() finds a
+ /// declaration visible from the current scope or context.
+ ///
+ /// \param ND the declaration found.
+ ///
+ /// \param Hiding a declaration that hides the declaration \p ND,
+ /// or NULL if no such declaration exists.
+ virtual void FoundDecl(NamedDecl *ND, NamedDecl *Hiding) = 0;
+ };
}
#endif
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index ef6147420bed..40ad90a129e7 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -350,7 +350,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
: LangOpts(pp.getLangOptions()), PP(pp), Context(ctxt), Consumer(consumer),
Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()),
ExternalSource(0), CodeCompleter(CodeCompleter), CurContext(0),
- PreDeclaratorDC(0), CurBlock(0), PackContext(0), ParsingDeclDepth(0),
+ CurBlock(0), PackContext(0), ParsingDeclDepth(0),
IdResolver(pp.getLangOptions()), StdNamespace(0), StdBadAlloc(0),
GlobalNewDeleteDeclared(false),
CompleteTranslationUnit(CompleteTranslationUnit),
@@ -389,12 +389,6 @@ static bool getIntProperties(ASTContext &C, const Type *T,
return true;
}
- if (const FixedWidthIntType *FWIT = dyn_cast<FixedWidthIntType>(T)) {
- BitWidth = FWIT->getWidth();
- Signed = FWIT->isSigned();
- return true;
- }
-
return false;
}
@@ -655,8 +649,7 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T) {
}
// If the target is integral, always warn.
- if ((TargetBT && TargetBT->isInteger()) ||
- isa<FixedWidthIntType>(Target))
+ if ((TargetBT && TargetBT->isInteger()))
// TODO: don't warn for integer values?
return DiagnoseImpCast(S, E, T, diag::warn_impcast_float_integer);
@@ -815,7 +808,7 @@ void Sema::ActOnEndOfTranslationUnit() {
//===----------------------------------------------------------------------===//
DeclContext *Sema::getFunctionLevelDeclContext() {
- DeclContext *DC = PreDeclaratorDC ? PreDeclaratorDC : CurContext;
+ DeclContext *DC = CurContext;
while (isa<BlockDecl>(DC))
DC = DC->getParent();
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index ada8aa157a40..4cecee46e468 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -24,6 +24,7 @@
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
+#include "clang/AST/FullExpr.h"
#include "clang/Parse/Action.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "llvm/ADT/SmallVector.h"
@@ -57,6 +58,7 @@ namespace clang {
class DesignatedInitExpr;
class CallExpr;
class DeclRefExpr;
+ class UnresolvedLookupExpr;
class VarDecl;
class ParmVarDecl;
class TypedefDecl;
@@ -98,7 +100,8 @@ namespace clang {
class InitializedEntity;
class InitializationKind;
class InitializationSequence;
-
+ class VisibleDeclConsumer;
+
/// BlockSemaInfo - When a block is being parsed, this contains information
/// about the block. It is pointed to from Sema::CurBlock.
struct BlockSemaInfo {
@@ -190,10 +193,6 @@ public:
/// CurContext - This is the current declaration context of parsing.
DeclContext *CurContext;
- /// PreDeclaratorDC - Keeps the declaration context before switching to the
- /// context of a declarator's nested-name-specifier.
- DeclContext *PreDeclaratorDC;
-
/// CurBlock - If inside of a block definition, this contains a pointer to
/// the active block object that represents it.
BlockSemaInfo *CurBlock;
@@ -611,10 +610,6 @@ public:
const LookupResult &Previous,
Scope *S);
void DiagnoseFunctionSpecifiers(Declarator& D);
- bool CheckRedeclaration(DeclContext *DC,
- DeclarationName Name,
- SourceLocation NameLoc,
- unsigned Diagnostic);
NamedDecl* ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC,
QualType R, TypeSourceInfo *TInfo,
LookupResult &Previous, bool &Redeclaration);
@@ -763,6 +758,12 @@ public:
/// struct, or union).
virtual void ActOnTagStartDefinition(Scope *S, DeclPtrTy TagDecl);
+ /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
+ /// C++ record definition's base-specifiers clause and are starting its
+ /// member declarations.
+ virtual void ActOnStartCXXMemberDeclarations(Scope *S, DeclPtrTy TagDecl,
+ SourceLocation LBraceLoc);
+
/// ActOnTagFinishDefinition - Invoked once we have finished parsing
/// the definition of a tag (enumeration, class, struct, or union).
virtual void ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagDecl,
@@ -841,6 +842,18 @@ public:
void MergeVarDecl(VarDecl *New, LookupResult &OldDecls);
bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old);
+ // AssignmentAction - This is used by all the assignment diagnostic functions
+ // to represent what is actually causing the operation
+ enum AssignmentAction {
+ AA_Assigning,
+ AA_Passing,
+ AA_Returning,
+ AA_Converting,
+ AA_Initializing,
+ AA_Sending,
+ AA_Casting
+ };
+
/// C++ Overloading.
enum OverloadKind {
/// This is a legitimate overload: the existing declarations are
@@ -917,9 +930,13 @@ public:
TryCopyInitialization(Expr* From, QualType ToType,
bool SuppressUserConversions, bool ForceRValue,
bool InOverloadResolution);
+
bool PerformCopyInitialization(Expr *&From, QualType ToType,
- const char *Flavor, bool Elidable = false);
+ AssignmentAction Action, bool Elidable = false);
+ OwningExprResult PerformCopyInitialization(const InitializedEntity &Entity,
+ SourceLocation EqualLoc,
+ OwningExprResult Init);
ImplicitConversionSequence
TryObjectArgumentInitialization(QualType FromType, CXXMethodDecl *Method,
CXXRecordDecl *ActingContext);
@@ -1020,27 +1037,23 @@ public:
FunctionDecl *ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
bool Complain);
+ FunctionDecl *ResolveSingleFunctionTemplateSpecialization(Expr *From);
+
Expr *FixOverloadedFunctionReference(Expr *E, FunctionDecl *Fn);
OwningExprResult FixOverloadedFunctionReference(OwningExprResult,
FunctionDecl *Fn);
- void AddOverloadedCallCandidates(llvm::SmallVectorImpl<NamedDecl*>& Callees,
- DeclarationName &UnqualifiedName,
- bool ArgumentDependentLookup,
- const TemplateArgumentListInfo *ExplicitTemplateArgs,
+ void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
Expr **Args, unsigned NumArgs,
OverloadCandidateSet &CandidateSet,
bool PartialOverloading = false);
- FunctionDecl *ResolveOverloadedCallFn(Expr *Fn,
- llvm::SmallVectorImpl<NamedDecl*> &Fns,
- DeclarationName UnqualifiedName,
- const TemplateArgumentListInfo *ExplicitTemplateArgs,
- SourceLocation LParenLoc,
- Expr **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
- SourceLocation RParenLoc,
- bool ArgumentDependentLookup);
+ OwningExprResult BuildOverloadedCallExpr(Expr *Fn,
+ UnresolvedLookupExpr *ULE,
+ SourceLocation LParenLoc,
+ Expr **Args, unsigned NumArgs,
+ SourceLocation *CommaLocs,
+ SourceLocation RParenLoc);
OwningExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc,
unsigned Opc,
@@ -1133,7 +1146,7 @@ public:
// members.
LookupOperatorName,
/// Look up of a name that precedes the '::' scope resolution
- /// operator in C++. This lookup completely ignores operator,
+ /// operator in C++. This lookup completely ignores operator, object,
/// function, and enumerator names (C++ [basic.lookup.qual]p1).
LookupNestedNameSpecifierName,
/// Look up a namespace name within a C++ using directive or
@@ -1164,36 +1177,6 @@ private:
bool CppLookupName(LookupResult &R, Scope *S);
public:
- /// Determines whether D is a suitable lookup result according to the
- /// lookup criteria.
- static bool isAcceptableLookupResult(NamedDecl *D, LookupNameKind NameKind,
- unsigned IDNS) {
- switch (NameKind) {
- case Sema::LookupOrdinaryName:
- case Sema::LookupTagName:
- case Sema::LookupMemberName:
- case Sema::LookupRedeclarationWithLinkage: // FIXME: check linkage, scoping
- case Sema::LookupUsingDeclName:
- case Sema::LookupObjCProtocolName:
- case Sema::LookupObjCImplementationName:
- return D->isInIdentifierNamespace(IDNS);
-
- case Sema::LookupOperatorName:
- return D->isInIdentifierNamespace(IDNS) &&
- !D->getDeclContext()->isRecord();
-
- case Sema::LookupNestedNameSpecifierName:
- return isa<TypedefDecl>(D) || D->isInIdentifierNamespace(Decl::IDNS_Tag);
-
- case Sema::LookupNamespaceName:
- return isa<NamespaceDecl>(D) || isa<NamespaceAliasDecl>(D);
- }
-
- assert(false &&
- "isAcceptableLookupResult always returns before this point");
- return false;
- }
-
/// \brief Look up a name, looking for a single declaration. Return
/// null if the results were absent, ambiguous, or overloaded.
///
@@ -1215,11 +1198,20 @@ public:
void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S,
QualType T1, QualType T2,
FunctionSet &Functions);
-
+
void ArgumentDependentLookup(DeclarationName Name, bool Operator,
Expr **Args, unsigned NumArgs,
FunctionSet &Functions);
+ void LookupVisibleDecls(Scope *S, LookupNameKind Kind,
+ VisibleDeclConsumer &Consumer);
+ void LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind,
+ VisibleDeclConsumer &Consumer);
+
+ bool CorrectTypo(LookupResult &R, Scope *S, const CXXScopeSpec *SS,
+ DeclContext *MemberContext = 0,
+ bool EnteringContext = false);
+
void FindAssociatedClassesAndNamespaces(Expr **Args, unsigned NumArgs,
AssociatedNamespaceSet &AssociatedNamespaces,
AssociatedClassSet &AssociatedClasses);
@@ -1455,7 +1447,8 @@ public:
virtual void PopExpressionEvaluationContext();
void MarkDeclarationReferenced(SourceLocation Loc, Decl *D);
-
+ bool DiagRuntimeBehavior(SourceLocation Loc, const PartialDiagnostic &PD);
+
// Primary Expressions.
virtual SourceRange getExprRange(ExprTy *E) const;
@@ -1465,6 +1458,8 @@ public:
bool HasTrailingLParen,
bool IsAddressOfOperand);
+ bool DiagnoseEmptyLookup(Scope *S, const CXXScopeSpec &SS, LookupResult &R);
+
OwningExprResult LookupInObjCMethod(LookupResult &R,
Scope *S,
IdentifierInfo *II);
@@ -1485,6 +1480,9 @@ public:
FieldDecl *Field,
Expr *BaseObjectExpr = 0,
SourceLocation OpLoc = SourceLocation());
+ OwningExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS,
+ LookupResult &R,
+ const TemplateArgumentListInfo *TemplateArgs);
OwningExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS,
LookupResult &R,
const TemplateArgumentListInfo *TemplateArgs,
@@ -1611,16 +1609,6 @@ public:
Expr **Args, unsigned NumArgs,
SourceLocation RParenLoc);
- void DeconstructCallFunction(Expr *FnExpr,
- llvm::SmallVectorImpl<NamedDecl*>& Fns,
- DeclarationName &Name,
- NestedNameSpecifier *&Qualifier,
- SourceRange &QualifierRange,
- bool &ArgumentDependentLookup,
- bool &Overloaded,
- bool &HasExplicitTemplateArgs,
- TemplateArgumentListInfo &ExplicitTemplateArgs);
-
/// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
/// This provides the location of the left/right parens and a list of comma
/// locations.
@@ -1812,7 +1800,8 @@ public:
OwningExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc,
QualType DeclInitType,
CXXConstructorDecl *Constructor,
- MultiExprArg Exprs);
+ MultiExprArg Exprs,
+ bool RequiresZeroInit = false);
// FIXME: Can re remove this and have the above BuildCXXConstructExpr check if
// the constructor can be elidable?
@@ -1820,7 +1809,8 @@ public:
QualType DeclInitType,
CXXConstructorDecl *Constructor,
bool Elidable,
- MultiExprArg Exprs);
+ MultiExprArg Exprs,
+ bool RequiresZeroInit = false);
OwningExprResult BuildCXXTemporaryObjectExpr(CXXConstructorDecl *Cons,
QualType writtenTy,
@@ -1972,7 +1962,8 @@ public:
bool AllowMissing, FunctionDecl *&Operator);
void DeclareGlobalNewDelete();
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return,
- QualType Argument);
+ QualType Argument,
+ bool addMallocAttr = false);
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD,
DeclarationName Name, FunctionDecl* &Operator);
@@ -2003,9 +1994,10 @@ public:
/// MaybeCreateCXXExprWithTemporaries - If the list of temporaries is
/// non-empty, will create a new CXXExprWithTemporaries expression.
/// Otherwise, just returs the passed in expression.
- Expr *MaybeCreateCXXExprWithTemporaries(Expr *SubExpr,
- bool ShouldDestroyTemporaries);
-
+ Expr *MaybeCreateCXXExprWithTemporaries(Expr *SubExpr);
+ OwningExprResult MaybeCreateCXXExprWithTemporaries(OwningExprResult SubExpr);
+ FullExpr CreateFullExpr(Expr *SubExpr);
+
virtual OwningExprResult ActOnFinishFullExpr(ExprArg Expr);
bool RequireCompleteDeclContext(const CXXScopeSpec &SS);
@@ -2216,11 +2208,15 @@ public:
SourceLocation RBrac);
virtual void ActOnReenterTemplateScope(Scope *S, DeclPtrTy Template);
+ virtual void ActOnStartDelayedMemberDeclarations(Scope *S,
+ DeclPtrTy Record);
virtual void ActOnStartDelayedCXXMethodDeclaration(Scope *S,
DeclPtrTy Method);
virtual void ActOnDelayedCXXMethodParameter(Scope *S, DeclPtrTy Param);
virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S,
DeclPtrTy Method);
+ virtual void ActOnFinishDelayedMemberDeclarations(Scope *S,
+ DeclPtrTy Record);
virtual DeclPtrTy ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
ExprArg AssertExpr,
@@ -2681,7 +2677,10 @@ public:
TDK_TooFewArguments,
/// \brief The explicitly-specified template arguments were not valid
/// template arguments for the given template.
- TDK_InvalidExplicitArguments
+ TDK_InvalidExplicitArguments,
+ /// \brief The arguments included an overloaded function name that could
+ /// not be resolved to a suitable function.
+ TDK_FailedOverloadResolution
};
/// \brief Provides information about an attempted template argument
@@ -2795,6 +2794,12 @@ public:
CXXConversionDecl *&Specialization,
TemplateDeductionInfo &Info);
+ TemplateDeductionResult
+ DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
+ const TemplateArgumentListInfo *ExplicitTemplateArgs,
+ FunctionDecl *&Specialization,
+ TemplateDeductionInfo &Info);
+
FunctionTemplateDecl *getMoreSpecializedTemplate(FunctionTemplateDecl *FT1,
FunctionTemplateDecl *FT2,
TemplatePartialOrderingContext TPOC);
@@ -3555,14 +3560,14 @@ public:
/// represent it in the AST.
Incompatible
};
-
+
/// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the
/// assignment conversion type specified by ConvTy. This returns true if the
/// conversion was invalid or false if the conversion was accepted.
bool DiagnoseAssignmentResult(AssignConvertType ConvTy,
SourceLocation Loc,
QualType DstType, QualType SrcType,
- Expr *SrcExpr, const char *Flavor);
+ Expr *SrcExpr, AssignmentAction Action);
/// CheckAssignmentConstraints - Perform type checking for assignment,
/// argument passing, variable initialization, and function return values.
@@ -3597,25 +3602,24 @@ public:
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType);
bool PerformImplicitConversion(Expr *&From, QualType ToType,
- const char *Flavor,
+ AssignmentAction Action,
bool AllowExplicit = false,
bool Elidable = false);
bool PerformImplicitConversion(Expr *&From, QualType ToType,
- const char *Flavor,
+ AssignmentAction Action,
bool AllowExplicit,
bool Elidable,
ImplicitConversionSequence& ICS);
bool PerformImplicitConversion(Expr *&From, QualType ToType,
const ImplicitConversionSequence& ICS,
- const char *Flavor,
+ AssignmentAction Action,
bool IgnoreBaseAccess = false);
bool PerformImplicitConversion(Expr *&From, QualType ToType,
const StandardConversionSequence& SCS,
- const char *Flavor, bool IgnoreBaseAccess);
+ AssignmentAction Action, bool IgnoreBaseAccess);
bool BuildCXXDerivedToBaseExpr(Expr *&From, CastExpr::CastKind CastKind,
- const ImplicitConversionSequence& ICS,
- const char *Flavor);
+ const ImplicitConversionSequence& ICS);
/// the following "Check" methods will return a valid/converted QualType
/// or a null QualType (indicating an error diagnostic was issued).
@@ -3675,15 +3679,10 @@ public:
SourceLocation CmpLoc);
/// type checking declaration initializers (C99 6.7.8)
-
- bool CheckInitializerTypes(Expr *&simpleInit_or_initList, QualType &declType,
- SourceLocation InitLoc,DeclarationName InitEntity,
- bool DirectInit);
- bool CheckInitList(InitListExpr *&InitList, QualType &DeclType);
+ bool CheckInitList(const InitializedEntity &Entity,
+ InitListExpr *&InitList, QualType &DeclType);
bool CheckForConstantInitializer(Expr *e, QualType t);
- bool CheckValueInitialization(QualType Type, SourceLocation Loc);
-
// type checking C++ declaration initializers (C++ [dcl.init]).
/// ReferenceCompareResult - Expresses the result of comparing two
diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp
index 21f83a560d7c..b7cc37b6c9a7 100644
--- a/lib/Sema/SemaAccess.cpp
+++ b/lib/Sema/SemaAccess.cpp
@@ -37,6 +37,8 @@ bool Sema::SetMemberAccessSpecifier(NamedDecl *MemberDecl,
<< MemberDecl << LexicalAS;
Diag(PrevMemberDecl->getLocation(), diag::note_previous_access_declaration)
<< PrevMemberDecl << PrevMemberDecl->getAccess();
+
+ MemberDecl->setAccess(LexicalAS);
return true;
}
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp
index 814af9080d84..800c544d3364 100644
--- a/lib/Sema/SemaCXXCast.cpp
+++ b/lib/Sema/SemaCXXCast.cpp
@@ -899,7 +899,7 @@ TryStaticImplicitCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
// The conversion is possible, so commit to it.
Kind = CastExpr::CK_NoOp;
msg = 0;
- return Self.PerformImplicitConversion(SrcExpr, DestType, ICS, "casting",
+ return Self.PerformImplicitConversion(SrcExpr, DestType, ICS, Sema::AA_Casting,
/*IgnoreBaseAccess*/CStyle) ?
TC_Failed : TC_Success;
}
@@ -959,8 +959,9 @@ static TryCastResult TryConstCast(Sema &Self, Expr *SrcExpr, QualType DestType,
// as must be the final pointee type.
while (SrcType != DestType &&
Self.UnwrapSimilarPointerTypes(SrcType, DestType)) {
- SrcType = SrcType.getUnqualifiedType();
- DestType = DestType.getUnqualifiedType();
+ Qualifiers Quals;
+ SrcType = Self.Context.getUnqualifiedArrayType(SrcType, Quals);
+ DestType = Self.Context.getUnqualifiedArrayType(DestType, Quals);
}
// Since we're dealing in canonical types, the remainder must be the same.
@@ -975,8 +976,6 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
const SourceRange &OpRange,
unsigned &msg,
CastExpr::CastKind &Kind) {
- QualType OrigDestType = DestType, OrigSrcType = SrcExpr->getType();
-
DestType = Self.Context.getCanonicalType(DestType);
QualType SrcType = SrcExpr->getType();
if (const ReferenceType *DestTypeTmp = DestType->getAs<ReferenceType>()) {
@@ -1053,8 +1052,11 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
return TC_NotApplicable;
// If both types have the same size, we can successfully cast.
- if (Self.Context.getTypeSize(SrcType) == Self.Context.getTypeSize(DestType))
+ if (Self.Context.getTypeSize(SrcType)
+ == Self.Context.getTypeSize(DestType)) {
+ Kind = CastExpr::CK_BitCast;
return TC_Success;
+ }
if (destIsScalar)
msg = diag::err_bad_cxx_cast_vector_to_scalar_different_size;
@@ -1083,6 +1085,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
// to the same type. However, the behavior of compilers is pretty consistent
// on this point: allow same-type conversion if the involved types are
// pointers, disallow otherwise.
+ Kind = CastExpr::CK_NoOp;
return TC_Success;
}
diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp
index 039691f122f9..82d58eab1aad 100644
--- a/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/lib/Sema/SemaCXXScopeSpec.cpp
@@ -329,7 +329,7 @@ NamedDecl *Sema::FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS) {
/// This routine differs only slightly from ActOnCXXNestedNameSpecifier, in
/// that it contains an extra parameter \p ScopeLookupResult, which provides
/// the result of name lookup within the scope of the nested-name-specifier
-/// that was computed at template definitino time.
+/// that was computed at template definition time.
///
/// If ErrorRecoveryLookup is true, then this call is used to improve error
/// recovery. This means that it should not emit diagnostics, it should
@@ -428,6 +428,28 @@ Sema::CXXScopeTy *Sema::BuildCXXNestedNameSpecifier(Scope *S,
}
// FIXME: Deal with ambiguities cleanly.
+
+ if (Found.empty() && !ErrorRecoveryLookup) {
+ // We haven't found anything, and we're not recovering from a
+ // different kind of error, so look for typos.
+ DeclarationName Name = Found.getLookupName();
+ if (CorrectTypo(Found, S, &SS, LookupCtx, EnteringContext) &&
+ Found.isSingleResult() &&
+ isAcceptableNestedNameSpecifier(Found.getAsSingle<NamedDecl>())) {
+ if (LookupCtx)
+ Diag(Found.getNameLoc(), diag::err_no_member_suggest)
+ << Name << LookupCtx << Found.getLookupName() << SS.getRange()
+ << CodeModificationHint::CreateReplacement(Found.getNameLoc(),
+ Found.getLookupName().getAsString());
+ else
+ Diag(Found.getNameLoc(), diag::err_undeclared_var_use_suggest)
+ << Name << Found.getLookupName()
+ << CodeModificationHint::CreateReplacement(Found.getNameLoc(),
+ Found.getLookupName().getAsString());
+ } else
+ Found.clear();
+ }
+
NamedDecl *SD = Found.getAsSingle<NamedDecl>();
if (isAcceptableNestedNameSpecifier(SD)) {
if (!ObjectType.isNull() && !ObjectTypeSearchedInScope) {
@@ -605,15 +627,18 @@ bool Sema::ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
/// The 'SS' should be a non-empty valid CXXScopeSpec.
bool Sema::ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
- if (DeclContext *DC = computeDeclContext(SS, true)) {
- // Before we enter a declarator's context, we need to make sure that
- // it is a complete declaration context.
- if (!DC->isDependentContext() && RequireCompleteDeclContext(SS))
- return true;
-
- EnterDeclaratorContext(S, DC);
- }
-
+
+ if (SS.isInvalid()) return true;
+
+ DeclContext *DC = computeDeclContext(SS, true);
+ if (!DC) return true;
+
+ // Before we enter a declarator's context, we need to make sure that
+ // it is a complete declaration context.
+ if (!DC->isDependentContext() && RequireCompleteDeclContext(SS))
+ return true;
+
+ EnterDeclaratorContext(S, DC);
return false;
}
@@ -626,6 +651,7 @@ void Sema::ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
if (SS.isInvalid())
return;
- if (computeDeclContext(SS, true))
- ExitDeclaratorContext(S);
+ assert(!SS.isInvalid() && computeDeclContext(SS, true) &&
+ "exiting declarator scope we never really entered");
+ ExitDeclaratorContext(S);
}
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 28de5005f8a8..f10fa07d8607 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -747,6 +747,7 @@ bool Sema::SemaBuiltinEHReturnDataRegNo(CallExpr *TheCall) {
/// SemaBuiltinObjectSize - Handle __builtin_object_size(void *ptr,
/// int type). This simply type checks that type is one of the defined
/// constants (0-3).
+// For compatability check 0-3, llvm only handles 0 and 2.
bool Sema::SemaBuiltinObjectSize(CallExpr *TheCall) {
Expr *Arg = TheCall->getArg(1);
if (Arg->isTypeDependent())
@@ -800,7 +801,7 @@ bool Sema::SemaCheckStringLiteral(const Expr *E, const CallExpr *TheCall,
switch (E->getStmtClass()) {
case Stmt::ConditionalOperatorClass: {
const ConditionalOperator *C = cast<ConditionalOperator>(E);
- return SemaCheckStringLiteral(C->getLHS(), TheCall,
+ return SemaCheckStringLiteral(C->getTrueExpr(), TheCall,
HasVAListArg, format_idx, firstDataArg)
&& SemaCheckStringLiteral(C->getRHS(), TheCall,
HasVAListArg, format_idx, firstDataArg);
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index 4ce9330fc142..ef82a941b5a5 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -829,6 +829,39 @@ static void AddTypeSpecifierResults(const LangOptions &LangOpts, unsigned Rank,
}
}
+/// \brief If the given declaration has an associated type, add it as a result
+/// type chunk.
+static void AddResultTypeChunk(ASTContext &Context,
+ NamedDecl *ND,
+ CodeCompletionString *Result) {
+ if (!ND)
+ return;
+
+ // Determine the type of the declaration (if it has a type).
+ QualType T;
+ if (FunctionDecl *Function = dyn_cast<FunctionDecl>(ND))
+ T = Function->getResultType();
+ else if (ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(ND))
+ T = Method->getResultType();
+ else if (FunctionTemplateDecl *FunTmpl = dyn_cast<FunctionTemplateDecl>(ND))
+ T = FunTmpl->getTemplatedDecl()->getResultType();
+ else if (EnumConstantDecl *Enumerator = dyn_cast<EnumConstantDecl>(ND))
+ T = Context.getTypeDeclType(cast<TypeDecl>(Enumerator->getDeclContext()));
+ else if (isa<UnresolvedUsingValueDecl>(ND)) {
+ /* Do nothing: ignore unresolved using declarations*/
+ } else if (ValueDecl *Value = dyn_cast<ValueDecl>(ND))
+ T = Value->getType();
+ else if (ObjCPropertyDecl *Property = dyn_cast<ObjCPropertyDecl>(ND))
+ T = Property->getType();
+
+ if (T.isNull() || Context.hasSameType(T, Context.DependentTy))
+ return;
+
+ std::string TypeStr;
+ T.getAsStringInternal(TypeStr, Context.PrintingPolicy);
+ Result->AddResultTypeChunk(TypeStr);
+}
+
/// \brief Add function parameter chunks to the given code completion string.
static void AddFunctionParameterChunks(ASTContext &Context,
FunctionDecl *Function,
@@ -1042,6 +1075,8 @@ CodeCompleteConsumer::Result::CreateCodeCompletionString(Sema &S) {
return Result;
}
+ AddResultTypeChunk(S.Context, ND, Result);
+
if (FunctionDecl *Function = dyn_cast<FunctionDecl>(ND)) {
AddQualifierToCompletionString(Result, Qualifier, QualifierIsInformative,
S.Context);
@@ -1170,6 +1205,13 @@ CodeCompleteConsumer::Result::CreateCodeCompletionString(Sema &S) {
Result->AddPlaceholderChunk(Arg);
}
+ if (Method->isVariadic()) {
+ if (AllParametersAreInformative)
+ Result->AddInformativeChunk(", ...");
+ else
+ Result->AddPlaceholderChunk(", ...");
+ }
+
return Result;
}
@@ -1189,6 +1231,7 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString(
CodeCompletionString *Result = new CodeCompletionString;
FunctionDecl *FDecl = getFunction();
+ AddResultTypeChunk(S.Context, FDecl, Result);
const FunctionProtoType *Proto
= dyn_cast<FunctionProtoType>(getFunctionType());
if (!FDecl && !Proto) {
@@ -1706,33 +1749,24 @@ void Sema::CodeCompleteCall(Scope *S, ExprTy *FnIn,
CodeCompleteOrdinaryName(S);
return;
}
-
- llvm::SmallVector<NamedDecl*,8> Fns;
- DeclarationName UnqualifiedName;
- NestedNameSpecifier *Qualifier;
- SourceRange QualifierRange;
- bool ArgumentDependentLookup;
- bool Overloaded;
- bool HasExplicitTemplateArgs;
- TemplateArgumentListInfo ExplicitTemplateArgs;
-
- DeconstructCallFunction(Fn, Fns, UnqualifiedName, Qualifier, QualifierRange,
- ArgumentDependentLookup, Overloaded,
- HasExplicitTemplateArgs, ExplicitTemplateArgs);
-
+ // Build an overload candidate set based on the functions we find.
+ OverloadCandidateSet CandidateSet;
+
// FIXME: What if we're calling something that isn't a function declaration?
// FIXME: What if we're calling a pseudo-destructor?
// FIXME: What if we're calling a member function?
- // Build an overload candidate set based on the functions we find.
- OverloadCandidateSet CandidateSet;
- AddOverloadedCallCandidates(Fns, UnqualifiedName,
- ArgumentDependentLookup,
- (HasExplicitTemplateArgs ? &ExplicitTemplateArgs : 0),
- Args, NumArgs,
- CandidateSet,
- /*PartialOverloading=*/true);
+ Expr *NakedFn = Fn->IgnoreParenCasts();
+ if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(NakedFn))
+ AddOverloadedCallCandidates(ULE, Args, NumArgs, CandidateSet,
+ /*PartialOverloading=*/ true);
+ else if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(NakedFn)) {
+ FunctionDecl *FDecl = dyn_cast<FunctionDecl>(DRE->getDecl());
+ if (FDecl)
+ AddOverloadCandidate(FDecl, Args, NumArgs, CandidateSet,
+ false, false, /*PartialOverloading*/ true);
+ }
// Sort the overload candidate set by placing the best overloads first.
std::stable_sort(CandidateSet.begin(), CandidateSet.end(),
@@ -2419,7 +2453,6 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver,
typedef CodeCompleteConsumer::Result Result;
Expr *RecExpr = static_cast<Expr *>(Receiver);
- QualType RecType = RecExpr->getType();
// If necessary, apply function/array conversion to the receiver.
// C99 6.7.5.3p[7,8].
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 14d2377784d5..2253f093df09 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -35,6 +35,7 @@
#include "clang/Lex/HeaderSearch.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/Triple.h"
#include <algorithm>
#include <cstring>
#include <functional>
@@ -106,8 +107,12 @@ Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
if (!LookupCtx->isDependentContext() && RequireCompleteDeclContext(*SS))
return 0;
}
-
- LookupResult Result(*this, &II, NameLoc, LookupOrdinaryName);
+
+ // FIXME: LookupNestedNameSpecifierName isn't the right kind of
+ // lookup for class-names.
+ LookupNameKind Kind = isClassName ? LookupNestedNameSpecifierName :
+ LookupOrdinaryName;
+ LookupResult Result(*this, &II, NameLoc, Kind);
if (LookupCtx) {
// Perform "qualified" name lookup into the declaration context we
// computed, which is either the type of the base of a member access
@@ -250,10 +255,41 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II,
// We don't have anything to suggest (yet).
SuggestedType = 0;
+ // There may have been a typo in the name of the type. Look up typo
+ // results, in case we have something that we can suggest.
+ LookupResult Lookup(*this, &II, IILoc, LookupOrdinaryName,
+ NotForRedeclaration);
+
+ // FIXME: It would be nice if we could correct for typos in built-in
+ // names, such as "itn" for "int".
+
+ if (CorrectTypo(Lookup, S, SS) && Lookup.isSingleResult()) {
+ NamedDecl *Result = Lookup.getAsSingle<NamedDecl>();
+ if ((isa<TypeDecl>(Result) || isa<ObjCInterfaceDecl>(Result)) &&
+ !Result->isInvalidDecl()) {
+ // We found a similarly-named type or interface; suggest that.
+ if (!SS || !SS->isSet())
+ Diag(IILoc, diag::err_unknown_typename_suggest)
+ << &II << Lookup.getLookupName()
+ << CodeModificationHint::CreateReplacement(SourceRange(IILoc),
+ Result->getNameAsString());
+ else if (DeclContext *DC = computeDeclContext(*SS, false))
+ Diag(IILoc, diag::err_unknown_nested_typename_suggest)
+ << &II << DC << Lookup.getLookupName() << SS->getRange()
+ << CodeModificationHint::CreateReplacement(SourceRange(IILoc),
+ Result->getNameAsString());
+ else
+ llvm_unreachable("could not have corrected a typo here");
+
+ SuggestedType = getTypeName(*Result->getIdentifier(), IILoc, S, SS);
+ return true;
+ }
+ }
+
// FIXME: Should we move the logic that tries to recover from a missing tag
// (struct, union, enum) from Parser::ParseImplicitInt here, instead?
- if (!SS)
+ if (!SS || (!SS->isSet() && !SS->isInvalid()))
Diag(IILoc, diag::err_unknown_typename) << &II;
else if (DeclContext *DC = computeDeclContext(*SS, false))
Diag(IILoc, diag::err_typename_nested_not_found)
@@ -321,23 +357,47 @@ void Sema::PopDeclContext() {
/// EnterDeclaratorContext - Used when we must lookup names in the context
/// of a declarator's nested name specifier.
+///
void Sema::EnterDeclaratorContext(Scope *S, DeclContext *DC) {
- assert(PreDeclaratorDC == 0 && "Previous declarator context not popped?");
- PreDeclaratorDC = static_cast<DeclContext*>(S->getEntity());
+ // C++0x [basic.lookup.unqual]p13:
+ // A name used in the definition of a static data member of class
+ // X (after the qualified-id of the static member) is looked up as
+ // if the name was used in a member function of X.
+ // C++0x [basic.lookup.unqual]p14:
+ // If a variable member of a namespace is defined outside of the
+ // scope of its namespace then any name used in the definition of
+ // the variable member (after the declarator-id) is looked up as
+ // if the definition of the variable member occurred in its
+ // namespace.
+ // Both of these imply that we should push a scope whose context
+ // is the semantic context of the declaration. We can't use
+ // PushDeclContext here because that context is not necessarily
+ // lexically contained in the current context. Fortunately,
+ // the containing scope should have the appropriate information.
+
+ assert(!S->getEntity() && "scope already has entity");
+
+#ifndef NDEBUG
+ Scope *Ancestor = S->getParent();
+ while (!Ancestor->getEntity()) Ancestor = Ancestor->getParent();
+ assert(Ancestor->getEntity() == CurContext && "ancestor context mismatch");
+#endif
+
CurContext = DC;
- assert(CurContext && "No context?");
- S->setEntity(CurContext);
+ S->setEntity(DC);
}
void Sema::ExitDeclaratorContext(Scope *S) {
- S->setEntity(PreDeclaratorDC);
- PreDeclaratorDC = 0;
+ assert(S->getEntity() == CurContext && "Context imbalance!");
- // Reset CurContext to the nearest enclosing context.
- while (!S->getEntity() && S->getParent())
- S = S->getParent();
- CurContext = static_cast<DeclContext*>(S->getEntity());
- assert(CurContext && "No context?");
+ // Switch back to the lexical context. The safety of this is
+ // enforced by an assert in EnterDeclaratorContext.
+ Scope *Ancestor = S->getParent();
+ while (!Ancestor->getEntity()) Ancestor = Ancestor->getParent();
+ CurContext = (DeclContext*) Ancestor->getEntity();
+
+ // We don't need to do anything with the scope, which is going to
+ // disappear.
}
/// \brief Determine whether we allow overloading of the function
@@ -667,9 +727,8 @@ void Sema::MergeTypeDefDecl(TypedefDecl *New, LookupResult &OldDecls) {
}
// Verify the old decl was also a type.
- TypeDecl *Old = 0;
- if (!OldDecls.isSingleResult() ||
- !(Old = dyn_cast<TypeDecl>(OldDecls.getFoundDecl()))) {
+ TypeDecl *Old = OldDecls.getAsSingle<TypeDecl>();
+ if (!Old) {
Diag(New->getLocation(), diag::err_redefinition_different_kind)
<< New->getDeclName();
@@ -704,6 +763,13 @@ void Sema::MergeTypeDefDecl(TypedefDecl *New, LookupResult &OldDecls) {
return New->setInvalidDecl();
}
+ // The types match. Link up the redeclaration chain if the old
+ // declaration was a typedef.
+ // FIXME: this is a potential source of wierdness if the type
+ // spellings don't match exactly.
+ if (isa<TypedefDecl>(Old))
+ New->setPreviousDeclaration(cast<TypedefDecl>(Old));
+
if (getLangOptions().Microsoft)
return;
@@ -772,7 +838,7 @@ static Sema::CXXSpecialMember getSpecialMember(ASTContext &Ctx,
if (const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(MD)) {
if (Ctor->isDefaultConstructor())
return Sema::CXXDefaultConstructor;
- if (Ctor->isCopyConstructor(Ctx))
+ if (Ctor->isCopyConstructor())
return Sema::CXXCopyConstructor;
}
@@ -901,7 +967,9 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) {
// (C++98 8.3.5p3):
// All declarations for a function shall agree exactly in both the
// return type and the parameter-type-list.
- if (OldQType == NewQType)
+ // attributes should be ignored when comparing.
+ if (Context.getNoReturnType(OldQType, false) ==
+ Context.getNoReturnType(NewQType, false))
return MergeCompatibleFunctionDecls(New, Old);
// Fall through for conflicting redeclarations and redefinitions.
@@ -1253,11 +1321,6 @@ Sema::ControlFlowKind Sema::CheckFallThrough(Stmt *Root) {
HasFakeEdge = true;
continue;
}
- if (isa<AsmStmt>(S)) {
- HasFakeEdge = true;
- HasLiveReturn = true;
- continue;
- }
bool NoReturnEdge = false;
if (CallExpr *C = dyn_cast<CallExpr>(S)) {
Expr *CEE = C->getCallee()->IgnoreParenCasts();
@@ -1445,7 +1508,6 @@ bool Sema::CheckParmsForFunctionDef(FunctionDecl *FD) {
Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
// FIXME: Error on auto/register at file scope
// FIXME: Error on inline/virtual/explicit
- // FIXME: Error on invalid restrict
// FIXME: Warn on useless __thread
// FIXME: Warn on useless const/volatile
// FIXME: Warn on useless static/extern/typedef/private_extern/mutable
@@ -1467,6 +1529,15 @@ Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
Tag = dyn_cast<TagDecl>(TagD);
}
+ if (unsigned TypeQuals = DS.getTypeQualifiers()) {
+ // Enforce C99 6.7.3p2: "Types other than pointer types derived from object
+ // or incomplete types shall not be restrict-qualified."
+ if (TypeQuals & DeclSpec::TQ_restrict)
+ Diag(DS.getRestrictSpecLoc(),
+ diag::err_typecheck_invalid_restrict_not_pointer_noarg)
+ << DS.getSourceRange();
+ }
+
if (DS.isFriendSpecified()) {
// If we're dealing with a class template decl, assume that the
// template routines are handling it.
@@ -1516,29 +1587,27 @@ Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
return DeclPtrTy::make(Tag);
}
-/// We are trying to introduce the given name into the given context;
+/// We are trying to inject an anonymous member into the given scope;
/// check if there's an existing declaration that can't be overloaded.
///
/// \return true if this is a forbidden redeclaration
-bool Sema::CheckRedeclaration(DeclContext *DC,
- DeclarationName Name,
- SourceLocation NameLoc,
- unsigned diagnostic) {
- LookupResult R(*this, Name, NameLoc, LookupOrdinaryName,
- ForRedeclaration);
- LookupQualifiedName(R, DC);
-
- if (R.empty()) return false;
-
- if (R.getResultKind() == LookupResult::Found &&
- isa<TagDecl>(R.getFoundDecl()))
+static bool CheckAnonMemberRedeclaration(Sema &SemaRef,
+ Scope *S,
+ DeclarationName Name,
+ SourceLocation NameLoc,
+ unsigned diagnostic) {
+ LookupResult R(SemaRef, Name, NameLoc, Sema::LookupMemberName,
+ Sema::ForRedeclaration);
+ if (!SemaRef.LookupName(R, S)) return false;
+
+ if (R.getAsSingle<TagDecl>())
return false;
// Pick a representative declaration.
- NamedDecl *PrevDecl = (*R.begin())->getUnderlyingDecl();
+ NamedDecl *PrevDecl = R.getRepresentativeDecl()->getUnderlyingDecl();
- Diag(NameLoc, diagnostic) << Name;
- Diag(PrevDecl->getLocation(), diag::note_previous_declaration);
+ SemaRef.Diag(NameLoc, diagnostic) << Name;
+ SemaRef.Diag(PrevDecl->getLocation(), diag::note_previous_declaration);
return true;
}
@@ -1570,8 +1639,8 @@ bool Sema::InjectAnonymousStructOrUnionMembers(Scope *S, DeclContext *Owner,
FEnd = AnonRecord->field_end();
F != FEnd; ++F) {
if ((*F)->getDeclName()) {
- if (CheckRedeclaration(Owner, (*F)->getDeclName(),
- (*F)->getLocation(), diagKind)) {
+ if (CheckAnonMemberRedeclaration(*this, S, (*F)->getDeclName(),
+ (*F)->getLocation(), diagKind)) {
// C++ [class.union]p2:
// The names of the members of an anonymous union shall be
// distinct from the names of any other entity in the
@@ -1889,9 +1958,12 @@ Sema::HandleDeclarator(Scope *S, Declarator &D,
if (DeclContext *DC = computeDeclContext(D.getCXXScopeSpec(), true)) {
// FIXME: Preserve type source info.
QualType T = GetTypeFromParser(DS.getTypeRep());
- EnterDeclaratorContext(S, DC);
+
+ DeclContext *SavedContext = CurContext;
+ CurContext = DC;
T = RebuildTypeInCurrentInstantiation(T, D.getIdentifierLoc(), Name);
- ExitDeclaratorContext(S);
+ CurContext = SavedContext;
+
if (T.isNull())
return DeclPtrTy();
DS.UpdateTypeRep(T.getAsOpaquePtr());
@@ -3364,7 +3436,16 @@ void Sema::CheckMain(FunctionDecl* FD) {
unsigned nparams = FTP->getNumArgs();
assert(FD->getNumParams() == nparams);
- if (nparams > 3) {
+ bool HasExtraParameters = (nparams > 3);
+
+ // Darwin passes an undocumented fourth argument of type char**. If
+ // other platforms start sprouting these, the logic below will start
+ // getting shifty.
+ if (nparams == 4 &&
+ Context.Target.getTriple().getOS() == llvm::Triple::Darwin)
+ HasExtraParameters = false;
+
+ if (HasExtraParameters) {
Diag(FD->getLocation(), diag::err_main_surplus_args) << nparams;
FD->setInvalidDecl(true);
nparams = 3;
@@ -3375,7 +3456,7 @@ void Sema::CheckMain(FunctionDecl* FD) {
QualType CharPP =
Context.getPointerType(Context.getPointerType(Context.CharTy));
- QualType Expected[] = { Context.IntTy, CharPP, CharPP };
+ QualType Expected[] = { Context.IntTy, CharPP, CharPP, CharPP };
for (unsigned i = 0; i < nparams; ++i) {
QualType AT = FTP->getArgType(i);
@@ -3504,6 +3585,18 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
Expr *Init = init.takeAs<Expr>();
assert(Init && "missing initializer");
+ // Capture the variable that is being initialized and the style of
+ // initialization.
+ InitializedEntity Entity = InitializedEntity::InitializeVariable(VDecl);
+
+ // FIXME: Poor source location information.
+ InitializationKind Kind
+ = DirectInit? InitializationKind::CreateDirect(VDecl->getLocation(),
+ Init->getLocStart(),
+ Init->getLocEnd())
+ : InitializationKind::CreateCopy(VDecl->getLocation(),
+ Init->getLocStart());
+
// Get the decls type and save a reference for later, since
// CheckInitializerTypes may change it.
QualType DclT = VDecl->getType(), SavT = DclT;
@@ -3512,37 +3605,16 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
Diag(VDecl->getLocation(), diag::err_block_extern_cant_init);
VDecl->setInvalidDecl();
} else if (!VDecl->isInvalidDecl()) {
- if (VDecl->getType()->isReferenceType()
- || isa<InitListExpr>(Init)) {
- InitializedEntity Entity
- = InitializedEntity::InitializeVariable(VDecl);
-
- // FIXME: Poor source location information.
- InitializationKind Kind
- = DirectInit? InitializationKind::CreateDirect(VDecl->getLocation(),
- SourceLocation(),
- SourceLocation())
- : InitializationKind::CreateCopy(VDecl->getLocation(),
- SourceLocation());
- InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1);
- if (InitSeq) {
- OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
- MultiExprArg(*this, (void**)&Init, 1),
- &DclT);
- if (Result.isInvalid()) {
- VDecl->setInvalidDecl();
- return;
- }
-
- Init = Result.takeAs<Expr>();
- } else {
- InitSeq.Diagnose(*this, Entity, Kind, &Init, 1);
- VDecl->setInvalidDecl();
- return;
- }
- } else if (CheckInitializerTypes(Init, DclT, VDecl->getLocation(),
- VDecl->getDeclName(), DirectInit))
+ InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1);
+ OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
+ MultiExprArg(*this, (void**)&Init, 1),
+ &DclT);
+ if (Result.isInvalid()) {
VDecl->setInvalidDecl();
+ return;
+ }
+
+ Init = Result.takeAs<Expr>();
// C++ 3.6.2p2, allow dynamic initialization of static initializers.
// Don't check invalid declarations to avoid emitting useless diagnostics.
@@ -3601,10 +3673,18 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
} else if (VDecl->isFileVarDecl()) {
if (VDecl->getStorageClass() == VarDecl::Extern)
Diag(VDecl->getLocation(), diag::warn_extern_init);
- if (!VDecl->isInvalidDecl())
- if (CheckInitializerTypes(Init, DclT, VDecl->getLocation(),
- VDecl->getDeclName(), DirectInit))
+ if (!VDecl->isInvalidDecl()) {
+ InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1);
+ OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
+ MultiExprArg(*this, (void**)&Init, 1),
+ &DclT);
+ if (Result.isInvalid()) {
VDecl->setInvalidDecl();
+ return;
+ }
+
+ Init = Result.takeAs<Expr>();
+ }
// C++ 3.6.2p2, allow dynamic initialization of static initializers.
// Don't check invalid declarations to avoid emitting useless diagnostics.
@@ -3622,8 +3702,7 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
Init->setType(DclT);
}
- Init = MaybeCreateCXXExprWithTemporaries(Init,
- /*ShouldDestroyTemporaries=*/true);
+ Init = MaybeCreateCXXExprWithTemporaries(Init);
// Attach the initializer to the decl.
VDecl->setInit(Context, Init);
@@ -3635,6 +3714,15 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
assert(Deleted && "Unrecorded tentative definition?"); Deleted=Deleted;
}
+ if (getLangOptions().CPlusPlus) {
+ // Make sure we mark the destructor as used if necessary.
+ QualType InitType = VDecl->getType();
+ if (const ArrayType *Array = Context.getAsArrayType(InitType))
+ InitType = Context.getBaseElementType(Array);
+ if (InitType->isRecordType())
+ FinalizeVarWithDestructor(VDecl, InitType);
+ }
+
return;
}
@@ -3722,28 +3810,19 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl,
InitType->isRecordType() && !InitType->isDependentType()) {
if (!RequireCompleteType(Var->getLocation(), InitType,
diag::err_invalid_incomplete_type_use)) {
- ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this);
-
- CXXConstructorDecl *Constructor
- = PerformInitializationByConstructor(InitType,
- MultiExprArg(*this, 0, 0),
- Var->getLocation(),
- SourceRange(Var->getLocation(),
- Var->getLocation()),
- Var->getDeclName(),
- InitializationKind::CreateDefault(Var->getLocation()),
- ConstructorArgs);
-
- // FIXME: Location info for the variable initialization?
- if (!Constructor)
+ InitializedEntity Entity
+ = InitializedEntity::InitializeVariable(Var);
+ InitializationKind Kind
+ = InitializationKind::CreateDefault(Var->getLocation());
+
+ InitializationSequence InitSeq(*this, Entity, Kind, 0, 0);
+ OwningExprResult Init = InitSeq.Perform(*this, Entity, Kind,
+ MultiExprArg(*this, 0, 0));
+ if (Init.isInvalid())
Var->setInvalidDecl();
else {
- // FIXME: Cope with initialization of arrays
- if (!Constructor->isTrivial() &&
- InitializeVarWithConstructor(Var, Constructor,
- move_arg(ConstructorArgs)))
- Var->setInvalidDecl();
-
+ Var->setInit(Context,
+ MaybeCreateCXXExprWithTemporaries(Init.takeAs<Expr>()));
FinalizeVarWithDestructor(Var, InitType);
}
} else {
@@ -4382,6 +4461,10 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) {
if (Context.BuiltinInfo.isNoReturn(BuiltinID))
FD->addAttr(::new (Context) NoReturnAttr());
+ if (Context.BuiltinInfo.isNoThrow(BuiltinID))
+ FD->addAttr(::new (Context) NoThrowAttr());
+ if (Context.BuiltinInfo.isConst(BuiltinID))
+ FD->addAttr(::new (Context) ConstAttr());
}
IdentifierInfo *Name = FD->getIdentifier();
@@ -4939,31 +5022,36 @@ void Sema::ActOnTagStartDefinition(Scope *S, DeclPtrTy TagD) {
// Enter the tag context.
PushDeclContext(S, Tag);
+}
- if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(Tag)) {
- FieldCollector->StartClass();
-
- if (Record->getIdentifier()) {
- // C++ [class]p2:
- // [...] The class-name is also inserted into the scope of the
- // class itself; this is known as the injected-class-name. For
- // purposes of access checking, the injected-class-name is treated
- // as if it were a public member name.
- CXXRecordDecl *InjectedClassName
- = CXXRecordDecl::Create(Context, Record->getTagKind(),
- CurContext, Record->getLocation(),
- Record->getIdentifier(),
- Record->getTagKeywordLoc(),
- Record);
- InjectedClassName->setImplicit();
- InjectedClassName->setAccess(AS_public);
- if (ClassTemplateDecl *Template = Record->getDescribedClassTemplate())
- InjectedClassName->setDescribedClassTemplate(Template);
- PushOnScopeChains(InjectedClassName, S);
- assert(InjectedClassName->isInjectedClassName() &&
- "Broken injected-class-name");
- }
- }
+void Sema::ActOnStartCXXMemberDeclarations(Scope *S, DeclPtrTy TagD,
+ SourceLocation LBraceLoc) {
+ AdjustDeclIfTemplate(TagD);
+ CXXRecordDecl *Record = cast<CXXRecordDecl>(TagD.getAs<Decl>());
+
+ FieldCollector->StartClass();
+
+ if (!Record->getIdentifier())
+ return;
+
+ // C++ [class]p2:
+ // [...] The class-name is also inserted into the scope of the
+ // class itself; this is known as the injected-class-name. For
+ // purposes of access checking, the injected-class-name is treated
+ // as if it were a public member name.
+ CXXRecordDecl *InjectedClassName
+ = CXXRecordDecl::Create(Context, Record->getTagKind(),
+ CurContext, Record->getLocation(),
+ Record->getIdentifier(),
+ Record->getTagKeywordLoc(),
+ Record);
+ InjectedClassName->setImplicit();
+ InjectedClassName->setAccess(AS_public);
+ if (ClassTemplateDecl *Template = Record->getDescribedClassTemplate())
+ InjectedClassName->setDescribedClassTemplate(Template);
+ PushOnScopeChains(InjectedClassName, S);
+ assert(InjectedClassName->isInjectedClassName() &&
+ "Broken injected-class-name");
}
void Sema::ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagD,
@@ -5808,7 +5896,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
const llvm::APSInt &InitVal = ECD->getInitVal();
assert(InitVal.getBitWidth() >= IntWidth &&
"Should have promoted value to int");
- if (InitVal.getBitWidth() > IntWidth) {
+ if (!getLangOptions().CPlusPlus && InitVal.getBitWidth() > IntWidth) {
llvm::APSInt V(InitVal);
V.trunc(IntWidth);
V.extend(InitVal.getBitWidth());
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 84ee2073382f..094e5b56e558 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -47,7 +47,7 @@ static const FunctionType *getFunctionType(const Decl *d,
// FIXME: We should provide an abstraction around a method or function
// to provide the following bits of information.
-/// isFunctionOrMethod - Return true if the given decl has function
+/// isFunction - Return true if the given decl has function
/// type (function or function-typed variable).
static bool isFunction(const Decl *d) {
return getFunctionType(d, false) != NULL;
@@ -730,15 +730,19 @@ static void HandleWarnUnusedResult(Decl *D, const AttributeList &Attr, Sema &S)
return;
}
- // TODO: could also be applied to methods?
- FunctionDecl *Fn = dyn_cast<FunctionDecl>(D);
- if (!Fn) {
+ if (!isFunctionOrMethod(D)) {
S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
<< Attr.getName() << 0 /*function*/;
return;
}
- Fn->addAttr(::new (S.Context) WarnUnusedResultAttr());
+ if (getFunctionType(D)->getResultType()->isVoidType()) {
+ S.Diag(Attr.getLoc(), diag::warn_attribute_void_function)
+ << Attr.getName();
+ return;
+ }
+
+ D->addAttr(::new (S.Context) WarnUnusedResultAttr());
}
static void HandleWeakAttr(Decl *D, const AttributeList &Attr, Sema &S) {
@@ -1610,7 +1614,10 @@ static void HandleModeAttr(Decl *D, const AttributeList &Attr, Sema &S) {
S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name;
return;
}
- NewTy = S.Context.getFixedWidthIntType(128, OldTy->isSignedIntegerType());
+ if (OldTy->isSignedIntegerType())
+ NewTy = S.Context.Int128Ty;
+ else
+ NewTy = S.Context.UnsignedInt128Ty;
break;
}
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 228a716ca483..204d7764682b 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -109,8 +109,6 @@ namespace {
bool
Sema::SetParamDefaultArgument(ParmVarDecl *Param, ExprArg DefaultArg,
SourceLocation EqualLoc) {
- QualType ParamType = Param->getType();
-
if (RequireCompleteType(Param->getLocation(), Param->getType(),
diag::err_typecheck_decl_incomplete_type)) {
Param->setInvalidDecl();
@@ -125,11 +123,17 @@ Sema::SetParamDefaultArgument(ParmVarDecl *Param, ExprArg DefaultArg,
// the same semantic constraints as the initializer expression in
// a declaration of a variable of the parameter type, using the
// copy-initialization semantics (8.5).
- if (CheckInitializerTypes(Arg, ParamType, EqualLoc,
- Param->getDeclName(), /*DirectInit=*/false))
+ InitializedEntity Entity = InitializedEntity::InitializeParameter(Param);
+ InitializationKind Kind = InitializationKind::CreateCopy(Param->getLocation(),
+ EqualLoc);
+ InitializationSequence InitSeq(*this, Entity, Kind, &Arg, 1);
+ OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
+ MultiExprArg(*this, (void**)&Arg, 1));
+ if (Result.isInvalid())
return true;
+ Arg = Result.takeAs<Expr>();
- Arg = MaybeCreateCXXExprWithTemporaries(Arg, /*DestroyTemps=*/false);
+ Arg = MaybeCreateCXXExprWithTemporaries(Arg);
// Okay: add the default argument to the parameter
Param->setDefaultArg(Arg);
@@ -152,7 +156,6 @@ Sema::ActOnParamDefaultArgument(DeclPtrTy param, SourceLocation EqualLoc,
UnparsedDefaultArgLocs.erase(Param);
ExprOwningPtr<Expr> DefaultArg(this, defarg.takeAs<Expr>());
- QualType ParamType = Param->getType();
// Default arguments are only permitted in C++
if (!getLangOptions().CPlusPlus) {
@@ -945,6 +948,51 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
return DeclPtrTy::make(Member);
}
+/// \brief Find the direct and/or virtual base specifiers that
+/// correspond to the given base type, for use in base initialization
+/// within a constructor.
+static bool FindBaseInitializer(Sema &SemaRef,
+ CXXRecordDecl *ClassDecl,
+ QualType BaseType,
+ const CXXBaseSpecifier *&DirectBaseSpec,
+ const CXXBaseSpecifier *&VirtualBaseSpec) {
+ // First, check for a direct base class.
+ DirectBaseSpec = 0;
+ for (CXXRecordDecl::base_class_const_iterator Base
+ = ClassDecl->bases_begin();
+ Base != ClassDecl->bases_end(); ++Base) {
+ if (SemaRef.Context.hasSameUnqualifiedType(BaseType, Base->getType())) {
+ // We found a direct base of this type. That's what we're
+ // initializing.
+ DirectBaseSpec = &*Base;
+ break;
+ }
+ }
+
+ // Check for a virtual base class.
+ // FIXME: We might be able to short-circuit this if we know in advance that
+ // there are no virtual bases.
+ VirtualBaseSpec = 0;
+ if (!DirectBaseSpec || !DirectBaseSpec->isVirtual()) {
+ // We haven't found a base yet; search the class hierarchy for a
+ // virtual base class.
+ CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true,
+ /*DetectVirtual=*/false);
+ if (SemaRef.IsDerivedFrom(SemaRef.Context.getTypeDeclType(ClassDecl),
+ BaseType, Paths)) {
+ for (CXXBasePaths::paths_iterator Path = Paths.begin();
+ Path != Paths.end(); ++Path) {
+ if (Path->back().Base->isVirtual()) {
+ VirtualBaseSpec = Path->back().Base;
+ break;
+ }
+ }
+ }
+ }
+
+ return DirectBaseSpec || VirtualBaseSpec;
+}
+
/// ActOnMemInitializer - Handle a C++ member initializer.
Sema::MemInitResult
Sema::ActOnMemInitializer(DeclPtrTy ConstructorD,
@@ -1000,16 +1048,69 @@ Sema::ActOnMemInitializer(DeclPtrTy ConstructorD,
}
// It didn't name a member, so see if it names a class.
QualType BaseType;
-
TypeSourceInfo *TInfo = 0;
- if (TemplateTypeTy)
+
+ if (TemplateTypeTy) {
BaseType = GetTypeFromParser(TemplateTypeTy, &TInfo);
- else
- BaseType = QualType::getFromOpaquePtr(getTypeName(*MemberOrBase, IdLoc,
- S, &SS));
- if (BaseType.isNull())
- return Diag(IdLoc, diag::err_mem_init_not_member_or_class)
- << MemberOrBase << SourceRange(IdLoc, RParenLoc);
+ } else {
+ LookupResult R(*this, MemberOrBase, IdLoc, LookupOrdinaryName);
+ LookupParsedName(R, S, &SS);
+
+ TypeDecl *TyD = R.getAsSingle<TypeDecl>();
+ if (!TyD) {
+ if (R.isAmbiguous()) return true;
+
+ // If no results were found, try to correct typos.
+ if (R.empty() &&
+ CorrectTypo(R, S, &SS, ClassDecl) && R.isSingleResult()) {
+ if (FieldDecl *Member = R.getAsSingle<FieldDecl>()) {
+ if (Member->getDeclContext()->getLookupContext()->Equals(ClassDecl)) {
+ // We have found a non-static data member with a similar
+ // name to what was typed; complain and initialize that
+ // member.
+ Diag(R.getNameLoc(), diag::err_mem_init_not_member_or_class_suggest)
+ << MemberOrBase << true << R.getLookupName()
+ << CodeModificationHint::CreateReplacement(R.getNameLoc(),
+ R.getLookupName().getAsString());
+
+ return BuildMemberInitializer(Member, (Expr**)Args, NumArgs, IdLoc,
+ LParenLoc, RParenLoc);
+ }
+ } else if (TypeDecl *Type = R.getAsSingle<TypeDecl>()) {
+ const CXXBaseSpecifier *DirectBaseSpec;
+ const CXXBaseSpecifier *VirtualBaseSpec;
+ if (FindBaseInitializer(*this, ClassDecl,
+ Context.getTypeDeclType(Type),
+ DirectBaseSpec, VirtualBaseSpec)) {
+ // We have found a direct or virtual base class with a
+ // similar name to what was typed; complain and initialize
+ // that base class.
+ Diag(R.getNameLoc(), diag::err_mem_init_not_member_or_class_suggest)
+ << MemberOrBase << false << R.getLookupName()
+ << CodeModificationHint::CreateReplacement(R.getNameLoc(),
+ R.getLookupName().getAsString());
+
+ TyD = Type;
+ }
+ }
+ }
+
+ if (!TyD) {
+ Diag(IdLoc, diag::err_mem_init_not_member_or_class)
+ << MemberOrBase << SourceRange(IdLoc, RParenLoc);
+ return true;
+ }
+ }
+
+ BaseType = Context.getTypeDeclType(TyD);
+ if (SS.isSet()) {
+ NestedNameSpecifier *Qualifier =
+ static_cast<NestedNameSpecifier*>(SS.getScopeRep());
+
+ // FIXME: preserve source range information
+ BaseType = Context.getQualifiedNameType(Qualifier, BaseType);
+ }
+ }
if (!TInfo)
TInfo = Context.getTrivialTypeSourceInfo(BaseType, IdLoc);
@@ -1095,14 +1196,13 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args,
QualType FieldType = Member->getType();
if (const ArrayType *Array = Context.getAsArrayType(FieldType))
FieldType = Array->getElementType();
+ ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this);
if (FieldType->isDependentType()) {
// Can't check init for dependent type.
} else if (FieldType->isRecordType()) {
// Member is a record (struct/union/class), so pass the initializer
// arguments down to the record's constructor.
if (!HasDependentArg) {
- ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this);
-
C = PerformInitializationByConstructor(FieldType,
MultiExprArg(*this,
(void**)Args,
@@ -1137,7 +1237,8 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args,
}
else
NewExp = (Expr*)Args[0];
- if (PerformCopyInitialization(NewExp, FieldType, "passing"))
+ if (!Member->isInvalidDecl() &&
+ PerformCopyInitialization(NewExp, FieldType, AA_Passing))
return true;
Args[0] = NewExp;
}
@@ -1174,37 +1275,11 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
// mem-initializer-list can initialize a base class using any
// name that denotes that base class type.
- // First, check for a direct base class.
+ // Check for direct and virtual base classes.
const CXXBaseSpecifier *DirectBaseSpec = 0;
- for (CXXRecordDecl::base_class_const_iterator Base =
- ClassDecl->bases_begin(); Base != ClassDecl->bases_end(); ++Base) {
- if (Context.hasSameUnqualifiedType(BaseType, Base->getType())) {
- // We found a direct base of this type. That's what we're
- // initializing.
- DirectBaseSpec = &*Base;
- break;
- }
- }
-
- // Check for a virtual base class.
- // FIXME: We might be able to short-circuit this if we know in advance that
- // there are no virtual bases.
const CXXBaseSpecifier *VirtualBaseSpec = 0;
- if (!DirectBaseSpec || !DirectBaseSpec->isVirtual()) {
- // We haven't found a base yet; search the class hierarchy for a
- // virtual base class.
- CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true,
- /*DetectVirtual=*/false);
- if (IsDerivedFrom(Context.getTypeDeclType(ClassDecl), BaseType, Paths)) {
- for (CXXBasePaths::paths_iterator Path = Paths.begin();
- Path != Paths.end(); ++Path) {
- if (Path->back().Base->isVirtual()) {
- VirtualBaseSpec = Path->back().Base;
- break;
- }
- }
- }
- }
+ FindBaseInitializer(*this, ClassDecl, BaseType, DirectBaseSpec,
+ VirtualBaseSpec);
// C++ [base.class.init]p2:
// If a mem-initializer-id is ambiguous because it designates both
@@ -1224,10 +1299,10 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
}
CXXConstructorDecl *C = 0;
+ ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this);
if (!BaseType->isDependentType() && !HasDependentArg) {
DeclarationName Name = Context.DeclarationNames.getCXXConstructorName(
Context.getCanonicalType(BaseType).getUnqualifiedType());
- ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this);
C = PerformInitializationByConstructor(BaseType,
MultiExprArg(*this,
@@ -1977,6 +2052,12 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) {
if (!Record || Record->isInvalidDecl())
return;
+ if (!Record->isDependentType())
+ AddImplicitlyDeclaredMembersToClass(Record);
+
+ if (Record->isInvalidDecl())
+ return;
+
if (!Record->isAbstract()) {
// Collect all the pure virtual methods and see if this is an abstract
// class after all.
@@ -1987,9 +2068,6 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) {
if (Record->isAbstract())
(void)AbstractClassUsageDiagnoser(*this, Record);
-
- if (!Record->isDependentType() && !Record->isInvalidDecl())
- AddImplicitlyDeclaredMembersToClass(Record);
}
void Sema::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
@@ -2261,6 +2339,18 @@ void Sema::ActOnReenterTemplateScope(Scope *S, DeclPtrTy TemplateD) {
}
}
+void Sema::ActOnStartDelayedMemberDeclarations(Scope *S, DeclPtrTy RecordD) {
+ if (!RecordD) return;
+ AdjustDeclIfTemplate(RecordD);
+ CXXRecordDecl *Record = cast<CXXRecordDecl>(RecordD.getAs<Decl>());
+ PushDeclContext(S, Record);
+}
+
+void Sema::ActOnFinishDelayedMemberDeclarations(Scope *S, DeclPtrTy RecordD) {
+ if (!RecordD) return;
+ PopDeclContext();
+}
+
/// ActOnStartDelayedCXXMethodDeclaration - We have completed
/// parsing a top-level (non-nested) C++ class, and we are now
/// parsing those parts of the given Method declaration that could
@@ -2270,18 +2360,6 @@ void Sema::ActOnReenterTemplateScope(Scope *S, DeclPtrTy TemplateD) {
/// name. However, it should not bring the parameters into scope;
/// that will be performed by ActOnDelayedCXXMethodParameter.
void Sema::ActOnStartDelayedCXXMethodDeclaration(Scope *S, DeclPtrTy MethodD) {
- if (!MethodD)
- return;
-
- AdjustDeclIfTemplate(MethodD);
-
- CXXScopeSpec SS;
- FunctionDecl *Method = cast<FunctionDecl>(MethodD.getAs<Decl>());
- QualType ClassTy
- = Context.getTypeDeclType(cast<RecordDecl>(Method->getDeclContext()));
- SS.setScopeRep(
- NestedNameSpecifier::Create(Context, 0, false, ClassTy.getTypePtr()));
- ActOnCXXEnterDeclaratorScope(S, SS);
}
/// ActOnDelayedCXXMethodParameter - We've already started a delayed
@@ -2318,12 +2396,6 @@ void Sema::ActOnFinishDelayedCXXMethodDeclaration(Scope *S, DeclPtrTy MethodD) {
AdjustDeclIfTemplate(MethodD);
FunctionDecl *Method = cast<FunctionDecl>(MethodD.getAs<Decl>());
- CXXScopeSpec SS;
- QualType ClassTy
- = Context.getTypeDeclType(cast<RecordDecl>(Method->getDeclContext()));
- SS.setScopeRep(
- NestedNameSpecifier::Create(Context, 0, false, ClassTy.getTypePtr()));
- ActOnCXXExitDeclaratorScope(S, SS);
// Now that we have our default arguments, check the constructor
// again. It could produce additional diagnostics or affect whether
@@ -2746,6 +2818,28 @@ Sema::DeclPtrTy Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
PushOnScopeChains(Namespc, DeclRegionScope);
} else {
// Anonymous namespaces.
+ assert(Namespc->isAnonymousNamespace());
+ CurContext->addDecl(Namespc);
+
+ // Link the anonymous namespace into its parent.
+ NamespaceDecl *PrevDecl;
+ DeclContext *Parent = CurContext->getLookupContext();
+ if (TranslationUnitDecl *TU = dyn_cast<TranslationUnitDecl>(Parent)) {
+ PrevDecl = TU->getAnonymousNamespace();
+ TU->setAnonymousNamespace(Namespc);
+ } else {
+ NamespaceDecl *ND = cast<NamespaceDecl>(Parent);
+ PrevDecl = ND->getAnonymousNamespace();
+ ND->setAnonymousNamespace(Namespc);
+ }
+
+ // Link the anonymous namespace with its previous declaration.
+ if (PrevDecl) {
+ assert(PrevDecl->isAnonymousNamespace());
+ assert(!PrevDecl->getNextNamespace());
+ Namespc->setOriginalNamespace(PrevDecl->getOriginalNamespace());
+ PrevDecl->setNextNamespace(Namespc);
+ }
// C++ [namespace.unnamed]p1. An unnamed-namespace-definition
// behaves as if it were replaced by
@@ -2763,20 +2857,19 @@ Sema::DeclPtrTy Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
// declarations semantically contained within an anonymous
// namespace internal linkage.
- assert(Namespc->isAnonymousNamespace());
- CurContext->addDecl(Namespc);
-
- UsingDirectiveDecl* UD
- = UsingDirectiveDecl::Create(Context, CurContext,
- /* 'using' */ LBrace,
- /* 'namespace' */ SourceLocation(),
- /* qualifier */ SourceRange(),
- /* NNS */ NULL,
- /* identifier */ SourceLocation(),
- Namespc,
- /* Ancestor */ CurContext);
- UD->setImplicit();
- CurContext->addDecl(UD);
+ if (!PrevDecl) {
+ UsingDirectiveDecl* UD
+ = UsingDirectiveDecl::Create(Context, CurContext,
+ /* 'using' */ LBrace,
+ /* 'namespace' */ SourceLocation(),
+ /* qualifier */ SourceRange(),
+ /* NNS */ NULL,
+ /* identifier */ SourceLocation(),
+ Namespc,
+ /* Ancestor */ CurContext);
+ UD->setImplicit();
+ CurContext->addDecl(UD);
+ }
}
// Although we could have an invalid decl (i.e. the namespace name is a
@@ -3696,7 +3789,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
CXXConstructorDecl *CopyConstructor,
unsigned TypeQuals) {
assert((CopyConstructor->isImplicit() &&
- CopyConstructor->isCopyConstructor(Context, TypeQuals) &&
+ CopyConstructor->isCopyConstructor(TypeQuals) &&
!CopyConstructor->isUsed()) &&
"DefineImplicitCopyConstructor - call it for implicit copy ctor");
@@ -3736,7 +3829,8 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
Sema::OwningExprResult
Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
CXXConstructorDecl *Constructor,
- MultiExprArg ExprArgs) {
+ MultiExprArg ExprArgs,
+ bool RequiresZeroInit) {
bool Elidable = false;
// C++ [class.copy]p15:
@@ -3747,8 +3841,13 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
// all, even if the class copy constructor or destructor have side effects.
// FIXME: Is this enough?
- if (Constructor->isCopyConstructor(Context)) {
+ if (Constructor->isCopyConstructor()) {
Expr *E = ((Expr **)ExprArgs.get())[0];
+ if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E))
+ if (ICE->getCastKind() == CastExpr::CK_NoOp)
+ E = ICE->getSubExpr();
+ if (CXXFunctionalCastExpr *FCE = dyn_cast<CXXFunctionalCastExpr>(E))
+ E = FCE->getSubExpr();
while (CXXBindTemporaryExpr *BE = dyn_cast<CXXBindTemporaryExpr>(E))
E = BE->getSubExpr();
if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E))
@@ -3759,10 +3858,12 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
Elidable = !CE->getCallReturnType()->isReferenceType();
else if (isa<CXXTemporaryObjectExpr>(E))
Elidable = true;
+ else if (isa<CXXConstructExpr>(E))
+ Elidable = true;
}
return BuildCXXConstructExpr(ConstructLoc, DeclInitType, Constructor,
- Elidable, move(ExprArgs));
+ Elidable, move(ExprArgs), RequiresZeroInit);
}
/// BuildCXXConstructExpr - Creates a complete call to a constructor,
@@ -3770,13 +3871,15 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
Sema::OwningExprResult
Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
CXXConstructorDecl *Constructor, bool Elidable,
- MultiExprArg ExprArgs) {
+ MultiExprArg ExprArgs,
+ bool RequiresZeroInit) {
unsigned NumExprs = ExprArgs.size();
Expr **Exprs = (Expr **)ExprArgs.release();
MarkDeclarationReferenced(ConstructLoc, Constructor);
- return Owned(CXXConstructExpr::Create(Context, DeclInitType, Constructor,
- Elidable, Exprs, NumExprs));
+ return Owned(CXXConstructExpr::Create(Context, DeclInitType, ConstructLoc,
+ Constructor, Elidable, Exprs, NumExprs,
+ RequiresZeroInit));
}
Sema::OwningExprResult
@@ -3806,7 +3909,7 @@ bool Sema::InitializeVarWithConstructor(VarDecl *VD,
Expr *Temp = TempResult.takeAs<Expr>();
MarkDeclarationReferenced(VD->getLocation(), Constructor);
- Temp = MaybeCreateCXXExprWithTemporaries(Temp, /*DestroyTemps=*/true);
+ Temp = MaybeCreateCXXExprWithTemporaries(Temp);
VD->setInit(Context, Temp);
return false;
@@ -3829,8 +3932,7 @@ void Sema::AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
MultiExprArg Exprs,
SourceLocation *CommaLocs,
SourceLocation RParenLoc) {
- unsigned NumExprs = Exprs.size();
- assert(NumExprs != 0 && Exprs.get() && "missing expressions");
+ assert(Exprs.size() != 0 && Exprs.get() && "missing expressions");
Decl *RealDecl = Dcl.getAs<Decl>();
// If there is no declaration, there was an error parsing it. Just ignore
@@ -3881,53 +3983,50 @@ void Sema::AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
if (const ArrayType *Array = Context.getAsArrayType(DeclInitType))
DeclInitType = Context.getBaseElementType(Array);
- // FIXME: This isn't the right place to complete the type.
if (RequireCompleteType(VDecl->getLocation(), VDecl->getType(),
diag::err_typecheck_decl_incomplete_type)) {
VDecl->setInvalidDecl();
return;
}
- if (VDecl->getType()->isRecordType()) {
- ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this);
-
- CXXConstructorDecl *Constructor
- = PerformInitializationByConstructor(DeclInitType,
- move(Exprs),
- VDecl->getLocation(),
- SourceRange(VDecl->getLocation(),
- RParenLoc),
- VDecl->getDeclName(),
- InitializationKind::CreateDirect(VDecl->getLocation(),
- LParenLoc,
- RParenLoc),
- ConstructorArgs);
- if (!Constructor)
- RealDecl->setInvalidDecl();
- else {
- VDecl->setCXXDirectInitializer(true);
- if (InitializeVarWithConstructor(VDecl, Constructor,
- move_arg(ConstructorArgs)))
- RealDecl->setInvalidDecl();
- FinalizeVarWithDestructor(VDecl, DeclInitType);
- }
+ // The variable can not have an abstract class type.
+ if (RequireNonAbstractType(VDecl->getLocation(), VDecl->getType(),
+ diag::err_abstract_type_in_decl,
+ AbstractVariableType))
+ VDecl->setInvalidDecl();
+
+ const VarDecl *Def = 0;
+ if (VDecl->getDefinition(Def)) {
+ Diag(VDecl->getLocation(), diag::err_redefinition)
+ << VDecl->getDeclName();
+ Diag(Def->getLocation(), diag::note_previous_definition);
+ VDecl->setInvalidDecl();
return;
}
-
- if (NumExprs > 1) {
- Diag(CommaLocs[0], diag::err_builtin_direct_init_more_than_one_arg)
- << SourceRange(VDecl->getLocation(), RParenLoc);
- RealDecl->setInvalidDecl();
+
+ // Capture the variable that is being initialized and the style of
+ // initialization.
+ InitializedEntity Entity = InitializedEntity::InitializeVariable(VDecl);
+
+ // FIXME: Poor source location information.
+ InitializationKind Kind
+ = InitializationKind::CreateDirect(VDecl->getLocation(),
+ LParenLoc, RParenLoc);
+
+ InitializationSequence InitSeq(*this, Entity, Kind,
+ (Expr**)Exprs.get(), Exprs.size());
+ OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, move(Exprs));
+ if (Result.isInvalid()) {
+ VDecl->setInvalidDecl();
return;
}
-
- // Let clients know that initialization was done with a direct initializer.
+
+ Result = MaybeCreateCXXExprWithTemporaries(move(Result));
+ VDecl->setInit(Context, Result.takeAs<Expr>());
VDecl->setCXXDirectInitializer(true);
- assert(NumExprs == 1 && "Expected 1 expression");
- // Set the init expression, handles conversions.
- AddInitializerToDecl(Dcl, ExprArg(*this, Exprs.release()[0]),
- /*DirectInit=*/true);
+ if (VDecl->getType()->getAs<RecordType>())
+ FinalizeVarWithDestructor(VDecl, DeclInitType);
}
/// \brief Add the applicable constructor candidates for an initialization
@@ -4164,7 +4263,7 @@ Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor,
/// type, and the first type (T1) is the pointee type of the reference
/// type being initialized.
Sema::ReferenceCompareResult
-Sema::CompareReferenceRelationship(SourceLocation Loc,
+Sema::CompareReferenceRelationship(SourceLocation Loc,
QualType OrigT1, QualType OrigT2,
bool& DerivedToBase) {
assert(!OrigT1->isReferenceType() &&
@@ -4173,8 +4272,9 @@ Sema::CompareReferenceRelationship(SourceLocation Loc,
QualType T1 = Context.getCanonicalType(OrigT1);
QualType T2 = Context.getCanonicalType(OrigT2);
- QualType UnqualT1 = T1.getLocalUnqualifiedType();
- QualType UnqualT2 = T2.getLocalUnqualifiedType();
+ Qualifiers T1Quals, T2Quals;
+ QualType UnqualT1 = Context.getUnqualifiedArrayType(T1, T1Quals);
+ QualType UnqualT2 = Context.getUnqualifiedArrayType(T2, T2Quals);
// C++ [dcl.init.ref]p4:
// Given types "cv1 T1" and "cv2 T2," "cv1 T1" is
@@ -4192,6 +4292,13 @@ Sema::CompareReferenceRelationship(SourceLocation Loc,
// At this point, we know that T1 and T2 are reference-related (at
// least).
+ // If the type is an array type, promote the element qualifiers to the type
+ // for comparison.
+ if (isa<ArrayType>(T1) && T1Quals)
+ T1 = Context.getQualifiedType(UnqualT1, T1Quals);
+ if (isa<ArrayType>(T2) && T2Quals)
+ T2 = Context.getQualifiedType(UnqualT2, T2Quals);
+
// C++ [dcl.init.ref]p4:
// "cv1 T1" is reference-compatible with "cv2 T2" if T1 is
// reference-related to T2 and cv1 is the same cv-qualification
@@ -4199,7 +4306,7 @@ Sema::CompareReferenceRelationship(SourceLocation Loc,
// overload resolution, cases for which cv1 is greater
// cv-qualification than cv2 are identified as
// reference-compatible with added qualification (see 13.3.3.2).
- if (T1.getCVRQualifiers() == T2.getCVRQualifiers())
+ if (T1Quals.getCVRQualifiers() == T2Quals.getCVRQualifiers())
return Ref_Compatible;
else if (T1.isMoreQualifiedThan(T2))
return Ref_Compatible_With_Added_Qualification;
@@ -4462,7 +4569,7 @@ Sema::CheckReferenceInit(Expr *&Init, QualType DeclType,
if (!isRValRef && T1.getCVRQualifiers() != Qualifiers::Const) {
if (!ICS)
Diag(DeclLoc, diag::err_not_reference_to_const_init)
- << T1 << (InitLvalue != Expr::LV_Valid? "temporary" : "value")
+ << T1 << int(InitLvalue != Expr::LV_Valid)
<< T2 << Init->getSourceRange();
return true;
}
@@ -4528,7 +4635,7 @@ Sema::CheckReferenceInit(Expr *&Init, QualType DeclType,
// initialization fails.
if (!ICS)
Diag(DeclLoc, diag::err_reference_init_drops_quals)
- << T1 << (InitLvalue != Expr::LV_Valid? "temporary" : "value")
+ << T1 << int(InitLvalue != Expr::LV_Valid)
<< T2 << Init->getSourceRange();
return true;
}
@@ -4542,7 +4649,7 @@ Sema::CheckReferenceInit(Expr *&Init, QualType DeclType,
(T1->isRecordType() || T2->isRecordType())) {
if (!ICS)
Diag(DeclLoc, diag::err_typecheck_convert_incompatible)
- << DeclType << Init->getType() << "initializing" << Init->getSourceRange();
+ << DeclType << Init->getType() << AA_Initializing << Init->getSourceRange();
return true;
}
@@ -4576,7 +4683,7 @@ Sema::CheckReferenceInit(Expr *&Init, QualType DeclType,
return ICS->ConversionKind == ImplicitConversionSequence::BadConversion;
} else {
ImplicitConversionSequence Conversions;
- bool badConversion = PerformImplicitConversion(Init, T1, "initializing",
+ bool badConversion = PerformImplicitConversion(Init, T1, AA_Initializing,
false, false,
Conversions);
if (badConversion) {
@@ -4664,7 +4771,7 @@ CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
<< FnDecl->getDeclName() << ExpectedFirstParamType;
// Check that the first parameter type is what we expect.
- if (SemaRef.Context.getCanonicalType(FirstParamType) !=
+ if (SemaRef.Context.getCanonicalType(FirstParamType).getUnqualifiedType() !=
ExpectedFirstParamType)
return SemaRef.Diag(FnDecl->getLocation(), InvalidParamTypeDiag)
<< FnDecl->getDeclName() << ExpectedFirstParamType;
@@ -5154,13 +5261,10 @@ Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
// C++98 [class.friend]p1: A friend of a class is a function
// or class that is not a member of the class . . .
- // But that's a silly restriction which nobody implements for
- // inner classes, and C++0x removes it anyway, so we only report
- // this (as a warning) if we're being pedantic.
- if (!getLangOptions().CPlusPlus0x)
- if (const RecordType *RT = T->getAs<RecordType>())
- if (RT->getDecl()->getDeclContext() == CurContext)
- Diag(DS.getFriendSpecLoc(), diag::ext_friend_inner_class);
+ // This is fixed in DR77, which just barely didn't make the C++03
+ // deadline. It's also a very silly restriction that seriously
+ // affects inner classes and which nobody else seems to implement;
+ // thus we never diagnose it, not even in -pedantic.
Decl *D;
if (TempParams.size())
@@ -5341,6 +5445,9 @@ Sema::ActOnFriendFunctionDecl(Scope *S,
FrD->setAccess(AS_public);
CurContext->addDecl(FrD);
+ if (D.getName().getKind() == UnqualifiedId::IK_TemplateId)
+ FrD->setSpecialization(true);
+
return DeclPtrTy::make(ND);
}
@@ -5421,6 +5528,18 @@ bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New,
return true;
}
+ // C++ [class.virtual]p6:
+ // If the return type of D::f differs from the return type of B::f, the
+ // class type in the return type of D::f shall be complete at the point of
+ // declaration of D::f or shall be the class type D.
+ if (const RecordType *RT = NewClassTy->getAs<RecordType>()) {
+ if (!RT->isBeingDefined() &&
+ RequireCompleteType(New->getLocation(), NewClassTy,
+ PDiag(diag::err_covariant_return_incomplete)
+ << New->getDeclName()))
+ return true;
+ }
+
if (!Context.hasSameUnqualifiedType(NewClassTy, OldClassTy)) {
// Check if the new class derives from the old class.
if (!IsDerivedFrom(NewClassTy, OldClassTy)) {
@@ -5497,50 +5616,32 @@ bool Sema::CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange) {
return true;
}
-/// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
-/// initializer for the declaration 'Dcl'.
+/// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse
+/// an initializer for the out-of-line declaration 'Dcl'. The scope
+/// is a fresh scope pushed for just this purpose.
+///
/// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
/// static data member of class X, names should be looked up in the scope of
/// class X.
void Sema::ActOnCXXEnterDeclInitializer(Scope *S, DeclPtrTy Dcl) {
- AdjustDeclIfTemplate(Dcl);
-
- Decl *D = Dcl.getAs<Decl>();
// If there is no declaration, there was an error parsing it.
- if (D == 0)
- return;
-
- // Check whether it is a declaration with a nested name specifier like
- // int foo::bar;
- if (!D->isOutOfLine())
- return;
-
- // C++ [basic.lookup.unqual]p13
- //
- // A name used in the definition of a static data member of class X
- // (after the qualified-id of the static member) is looked up as if the name
- // was used in a member function of X.
+ Decl *D = Dcl.getAs<Decl>();
+ if (D == 0) return;
- // Change current context into the context of the initializing declaration.
+ // We should only get called for declarations with scope specifiers, like:
+ // int foo::bar;
+ assert(D->isOutOfLine());
EnterDeclaratorContext(S, D->getDeclContext());
}
/// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
-/// initializer for the declaration 'Dcl'.
+/// initializer for the out-of-line declaration 'Dcl'.
void Sema::ActOnCXXExitDeclInitializer(Scope *S, DeclPtrTy Dcl) {
- AdjustDeclIfTemplate(Dcl);
-
- Decl *D = Dcl.getAs<Decl>();
// If there is no declaration, there was an error parsing it.
- if (D == 0)
- return;
-
- // Check whether it is a declaration with a nested name specifier like
- // int foo::bar;
- if (!D->isOutOfLine())
- return;
+ Decl *D = Dcl.getAs<Decl>();
+ if (D == 0) return;
- assert(S->getEntity() == D->getDeclContext() && "Context imbalance!");
+ assert(D->isOutOfLine());
ExitDeclaratorContext(S);
}
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index a768e1bdf781..beadb588f3e9 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1950,6 +1950,10 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
!(Attributes & ObjCDeclSpec::DQ_PR_retain) &&
!(Attributes & ObjCDeclSpec::DQ_PR_copy)));
QualType T = GetTypeForDeclarator(FD.D, S);
+ if (T->isReferenceType()) {
+ Diag(AtLoc, diag::error_reference_property);
+ return DeclPtrTy();
+ }
Decl *ClassDecl = ClassCategory.getAs<Decl>();
ObjCInterfaceDecl *CCPrimary = 0; // continuation class's primary class
// May modify Attributes.
@@ -2028,7 +2032,14 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC,
FD.D.getIdentifierLoc(),
FD.D.getIdentifier(), T);
- DC->addDecl(PDecl);
+ DeclContext::lookup_result Found = DC->lookup(PDecl->getDeclName());
+ if (Found.first != Found.second && isa<ObjCPropertyDecl>(*Found.first)) {
+ Diag(PDecl->getLocation(), diag::err_duplicate_property);
+ Diag((*Found.first)->getLocation(), diag::note_property_declare);
+ PDecl->setInvalidDecl();
+ }
+ else
+ DC->addDecl(PDecl);
if (T->isArrayType() || T->isFunctionType()) {
Diag(AtLoc, diag::err_property_type) << T;
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 358f4456bb0c..7bf04d88cd59 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "Sema.h"
+#include "SemaInit.h"
#include "Lookup.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
@@ -258,44 +259,17 @@ void Sema::DefaultArgumentPromotion(Expr *&Expr) {
bool Sema::DefaultVariadicArgumentPromotion(Expr *&Expr, VariadicCallType CT) {
DefaultArgumentPromotion(Expr);
- if (Expr->getType()->isObjCInterfaceType()) {
- switch (ExprEvalContexts.back().Context ) {
- case Unevaluated:
- // The argument will never be evaluated, so don't complain.
- break;
-
- case PotentiallyEvaluated:
- Diag(Expr->getLocStart(),
- diag::err_cannot_pass_objc_interface_to_vararg)
- << Expr->getType() << CT;
- return true;
-
- case PotentiallyPotentiallyEvaluated:
- ExprEvalContexts.back().addDiagnostic(Expr->getLocStart(),
- PDiag(diag::err_cannot_pass_objc_interface_to_vararg)
- << Expr->getType() << CT);
- break;
- }
- }
-
- if (!Expr->getType()->isPODType()) {
- switch (ExprEvalContexts.back().Context ) {
- case Unevaluated:
- // The argument will never be evaluated, so don't complain.
- break;
-
- case PotentiallyEvaluated:
- Diag(Expr->getLocStart(), diag::warn_cannot_pass_non_pod_arg_to_vararg)
- << Expr->getType() << CT;
- break;
+ if (Expr->getType()->isObjCInterfaceType() &&
+ DiagRuntimeBehavior(Expr->getLocStart(),
+ PDiag(diag::err_cannot_pass_objc_interface_to_vararg)
+ << Expr->getType() << CT))
+ return true;
- case PotentiallyPotentiallyEvaluated:
- ExprEvalContexts.back().addDiagnostic(Expr->getLocStart(),
- PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
- << Expr->getType() << CT);
- break;
- }
- }
+ if (!Expr->getType()->isPODType() &&
+ DiagRuntimeBehavior(Expr->getLocStart(),
+ PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
+ << Expr->getType() << CT))
+ return true;
return false;
}
@@ -590,7 +564,7 @@ Sema::BuildAnonymousStructUnionMemberReference(SourceLocation Loc,
== Context.getCanonicalType(ThisType)) ||
IsDerivedFrom(ThisType, AnonFieldType)) {
// Our base object expression is "this".
- BaseObjectExpr = new (Context) CXXThisExpr(SourceLocation(),
+ BaseObjectExpr = new (Context) CXXThisExpr(Loc,
MD->getThisType(Context));
BaseObjectIsPointer = true;
}
@@ -761,23 +735,9 @@ static bool IsProvablyNotDerivedFrom(Sema &SemaRef,
return true;
}
-/// Determines if this a C++ class member.
-static bool IsClassMember(NamedDecl *D) {
- DeclContext *DC = D->getDeclContext();
-
- // C++0x [class.mem]p1:
- // The enumerators of an unscoped enumeration defined in
- // the class are members of the class.
- // FIXME: support C++0x scoped enumerations.
- if (isa<EnumDecl>(DC))
- DC = DC->getParent();
-
- return DC->isRecord();
-}
-
/// Determines if this is an instance member of a class.
static bool IsInstanceMember(NamedDecl *D) {
- assert(IsClassMember(D) &&
+ assert(D->isCXXClassMember() &&
"checking whether non-member is instance member");
if (isa<FieldDecl>(D)) return true;
@@ -839,7 +799,7 @@ enum IMAKind {
/// not be caught until template-instantiation.
static IMAKind ClassifyImplicitMemberAccess(Sema &SemaRef,
const LookupResult &R) {
- assert(!R.empty() && IsClassMember(*R.begin()));
+ assert(!R.empty() && (*R.begin())->isCXXClassMember());
bool isStaticContext =
(!isa<CXXMethodDecl>(SemaRef.CurContext) ||
@@ -916,6 +876,112 @@ static void DiagnoseInstanceReference(Sema &SemaRef,
SemaRef.Diag(Loc, diag::err_member_call_without_object) << Range;
}
+/// Diagnose an empty lookup.
+///
+/// \return false if new lookup candidates were found
+bool Sema::DiagnoseEmptyLookup(Scope *S, const CXXScopeSpec &SS,
+ LookupResult &R) {
+ DeclarationName Name = R.getLookupName();
+
+ unsigned diagnostic = diag::err_undeclared_var_use;
+ unsigned diagnostic_suggest = diag::err_undeclared_var_use_suggest;
+ if (Name.getNameKind() == DeclarationName::CXXOperatorName ||
+ Name.getNameKind() == DeclarationName::CXXLiteralOperatorName ||
+ Name.getNameKind() == DeclarationName::CXXConversionFunctionName) {
+ diagnostic = diag::err_undeclared_use;
+ diagnostic_suggest = diag::err_undeclared_use_suggest;
+ }
+
+ // If the original lookup was an unqualified lookup, fake an
+ // unqualified lookup. This is useful when (for example) the
+ // original lookup would not have found something because it was a
+ // dependent name.
+ for (DeclContext *DC = SS.isEmpty()? CurContext : 0;
+ DC; DC = DC->getParent()) {
+ if (isa<CXXRecordDecl>(DC)) {
+ LookupQualifiedName(R, DC);
+
+ if (!R.empty()) {
+ // Don't give errors about ambiguities in this lookup.
+ R.suppressDiagnostics();
+
+ CXXMethodDecl *CurMethod = dyn_cast<CXXMethodDecl>(CurContext);
+ bool isInstance = CurMethod &&
+ CurMethod->isInstance() &&
+ DC == CurMethod->getParent();
+
+ // Give a code modification hint to insert 'this->'.
+ // TODO: fixit for inserting 'Base<T>::' in the other cases.
+ // Actually quite difficult!
+ if (isInstance)
+ Diag(R.getNameLoc(), diagnostic) << Name
+ << CodeModificationHint::CreateInsertion(R.getNameLoc(),
+ "this->");
+ else
+ Diag(R.getNameLoc(), diagnostic) << Name;
+
+ // Do we really want to note all of these?
+ for (LookupResult::iterator I = R.begin(), E = R.end(); I != E; ++I)
+ Diag((*I)->getLocation(), diag::note_dependent_var_use);
+
+ // Tell the callee to try to recover.
+ return false;
+ }
+ }
+ }
+
+ // We didn't find anything, so try to correct for a typo.
+ if (S && CorrectTypo(R, S, &SS)) {
+ if (isa<ValueDecl>(*R.begin()) || isa<FunctionTemplateDecl>(*R.begin())) {
+ if (SS.isEmpty())
+ Diag(R.getNameLoc(), diagnostic_suggest) << Name << R.getLookupName()
+ << CodeModificationHint::CreateReplacement(R.getNameLoc(),
+ R.getLookupName().getAsString());
+ else
+ Diag(R.getNameLoc(), diag::err_no_member_suggest)
+ << Name << computeDeclContext(SS, false) << R.getLookupName()
+ << SS.getRange()
+ << CodeModificationHint::CreateReplacement(R.getNameLoc(),
+ R.getLookupName().getAsString());
+
+ // Tell the callee to try to recover.
+ return false;
+ }
+
+ if (isa<TypeDecl>(*R.begin()) || isa<ObjCInterfaceDecl>(*R.begin())) {
+ // FIXME: If we ended up with a typo for a type name or
+ // Objective-C class name, we're in trouble because the parser
+ // is in the wrong place to recover. Suggest the typo
+ // correction, but don't make it a fix-it since we're not going
+ // to recover well anyway.
+ if (SS.isEmpty())
+ Diag(R.getNameLoc(), diagnostic_suggest) << Name << R.getLookupName();
+ else
+ Diag(R.getNameLoc(), diag::err_no_member_suggest)
+ << Name << computeDeclContext(SS, false) << R.getLookupName()
+ << SS.getRange();
+
+ // Don't try to recover; it won't work.
+ return true;
+ }
+
+ R.clear();
+ }
+
+ // Emit a special diagnostic for failed member lookups.
+ // FIXME: computing the declaration context might fail here (?)
+ if (!SS.isEmpty()) {
+ Diag(R.getNameLoc(), diag::err_no_member)
+ << Name << computeDeclContext(SS, false)
+ << SS.getRange();
+ return true;
+ }
+
+ // Give up, we can't recover.
+ Diag(R.getNameLoc(), diagnostic) << Name;
+ return true;
+}
+
Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
const CXXScopeSpec &SS,
UnqualifiedId &Id,
@@ -988,17 +1054,11 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
// If this name wasn't predeclared and if this is not a function
// call, diagnose the problem.
if (R.empty()) {
- if (!SS.isEmpty())
- return ExprError(Diag(NameLoc, diag::err_no_member)
- << Name << computeDeclContext(SS, false)
- << SS.getRange());
- else if (Name.getNameKind() == DeclarationName::CXXOperatorName ||
- Name.getNameKind() == DeclarationName::CXXLiteralOperatorName ||
- Name.getNameKind() == DeclarationName::CXXConversionFunctionName)
- return ExprError(Diag(NameLoc, diag::err_undeclared_use)
- << Name);
- else
- return ExprError(Diag(NameLoc, diag::err_undeclared_var_use) << Name);
+ if (DiagnoseEmptyLookup(S, SS, R))
+ return ExprError();
+
+ assert(!R.empty() &&
+ "DiagnoseEmptyLookup returned false but added no results");
}
}
@@ -1051,35 +1111,10 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
// class member access expression.
// But note that &SomeClass::foo is grammatically distinct, even
// though we don't parse it that way.
- if (!R.empty() && IsClassMember(*R.begin())) {
+ if (!R.empty() && (*R.begin())->isCXXClassMember()) {
bool isAbstractMemberPointer = (isAddressOfOperand && !SS.isEmpty());
-
- if (!isAbstractMemberPointer) {
- switch (ClassifyImplicitMemberAccess(*this, R)) {
- case IMA_Instance:
- return BuildImplicitMemberExpr(SS, R, TemplateArgs, true);
-
- case IMA_AnonymousMember:
- assert(R.isSingleResult());
- return BuildAnonymousStructUnionMemberReference(R.getNameLoc(),
- R.getAsSingle<FieldDecl>());
-
- case IMA_Mixed:
- case IMA_Mixed_Unrelated:
- case IMA_Unresolved:
- return BuildImplicitMemberExpr(SS, R, TemplateArgs, false);
-
- case IMA_Static:
- case IMA_Mixed_StaticContext:
- case IMA_Unresolved_StaticContext:
- break;
-
- case IMA_Error_StaticContext:
- case IMA_Error_Unrelated:
- DiagnoseInstanceReference(*this, SS, R);
- return ExprError();
- }
- }
+ if (!isAbstractMemberPointer)
+ return BuildPossibleImplicitMemberExpr(SS, R, TemplateArgs);
}
if (TemplateArgs)
@@ -1088,6 +1123,42 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
return BuildDeclarationNameExpr(SS, R, ADL);
}
+/// Builds an expression which might be an implicit member expression.
+Sema::OwningExprResult
+Sema::BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS,
+ LookupResult &R,
+ const TemplateArgumentListInfo *TemplateArgs) {
+ switch (ClassifyImplicitMemberAccess(*this, R)) {
+ case IMA_Instance:
+ return BuildImplicitMemberExpr(SS, R, TemplateArgs, true);
+
+ case IMA_AnonymousMember:
+ assert(R.isSingleResult());
+ return BuildAnonymousStructUnionMemberReference(R.getNameLoc(),
+ R.getAsSingle<FieldDecl>());
+
+ case IMA_Mixed:
+ case IMA_Mixed_Unrelated:
+ case IMA_Unresolved:
+ return BuildImplicitMemberExpr(SS, R, TemplateArgs, false);
+
+ case IMA_Static:
+ case IMA_Mixed_StaticContext:
+ case IMA_Unresolved_StaticContext:
+ if (TemplateArgs)
+ return BuildTemplateIdExpr(SS, R, false, *TemplateArgs);
+ return BuildDeclarationNameExpr(SS, R, false);
+
+ case IMA_Error_StaticContext:
+ case IMA_Error_Unrelated:
+ DiagnoseInstanceReference(*this, SS, R);
+ return ExprError();
+ }
+
+ llvm_unreachable("unexpected instance member access kind");
+ return ExprError();
+}
+
/// BuildQualifiedDeclarationNameExpr - Build a C++ qualified
/// declaration name, generally during template instantiation.
/// There's a large number of things which don't need to be done along
@@ -1315,7 +1386,7 @@ bool Sema::UseArgumentDependentLookup(const CXXScopeSpec &SS,
// -- a declaration of a class member
// Since using decls preserve this property, we check this on the
// original decl.
- if (IsClassMember(D))
+ if (D->isCXXClassMember())
return false;
// C++0x [basic.lookup.argdep]p3:
@@ -1408,7 +1479,6 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
assert(D && "Cannot refer to a NULL declaration");
assert(!isa<FunctionTemplateDecl>(D) &&
"Cannot refer unambiguously to a function template");
- DeclarationName Name = D->getDeclName();
if (CheckDeclInExpr(*this, Loc, D))
return ExprError();
@@ -1427,7 +1497,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
if (!VD) {
Diag(Loc, diag::err_ref_non_value)
<< D << SS.getRange();
- Diag(D->getLocation(), diag::note_previous_declaration);
+ Diag(D->getLocation(), diag::note_declared_at);
return ExprError();
}
@@ -1515,11 +1585,17 @@ Sema::OwningExprResult Sema::ActOnCharacterConstant(const Token &Tok) {
if (Literal.hadError())
return ExprError();
- QualType type = getLangOptions().CPlusPlus ? Context.CharTy : Context.IntTy;
+ QualType Ty;
+ if (!getLangOptions().CPlusPlus)
+ Ty = Context.IntTy; // 'x' and L'x' -> int in C.
+ else if (Literal.isWide())
+ Ty = Context.WCharTy; // L'x' -> wchar_t in C++.
+ else
+ Ty = Context.CharTy; // 'x' -> char in C++
return Owned(new (Context) CharacterLiteral(Literal.getValue(),
Literal.isWide(),
- type, Tok.getLocation()));
+ Ty, Tok.getLocation()));
}
Action::OwningExprResult Sema::ActOnNumericConstant(const Token &Tok) {
@@ -1558,9 +1634,31 @@ Action::OwningExprResult Sema::ActOnNumericConstant(const Token &Tok) {
const llvm::fltSemantics &Format = Context.getFloatTypeSemantics(Ty);
- // isExact will be set by GetFloatValue().
- bool isExact = false;
- llvm::APFloat Val = Literal.GetFloatValue(Format, &isExact);
+ using llvm::APFloat;
+ APFloat Val(Format);
+
+ APFloat::opStatus result = Literal.GetFloatValue(Val);
+
+ // Overflow is always an error, but underflow is only an error if
+ // we underflowed to zero (APFloat reports denormals as underflow).
+ if ((result & APFloat::opOverflow) ||
+ ((result & APFloat::opUnderflow) && Val.isZero())) {
+ unsigned diagnostic;
+ llvm::SmallVector<char, 20> buffer;
+ if (result & APFloat::opOverflow) {
+ diagnostic = diag::err_float_overflow;
+ APFloat::getLargest(Format).toString(buffer);
+ } else {
+ diagnostic = diag::err_float_underflow;
+ APFloat::getSmallest(Format).toString(buffer);
+ }
+
+ Diag(Tok.getLocation(), diagnostic)
+ << Ty
+ << llvm::StringRef(buffer.data(), buffer.size());
+ }
+
+ bool isExact = (result == APFloat::opOK);
Res = new (Context) FloatingLiteral(Val, isExact, Ty, Tok.getLocation());
} else if (!Literal.isIntegerLiteral()) {
@@ -1698,9 +1796,8 @@ bool Sema::CheckSizeOfAlignOfOperand(QualType exprType,
}
if (RequireCompleteType(OpLoc, exprType,
- isSizeof ? diag::err_sizeof_incomplete_type :
- PDiag(diag::err_alignof_incomplete_type)
- << ExprRange))
+ PDiag(diag::err_sizeof_alignof_incomplete_type)
+ << int(!isSizeof) << ExprRange))
return true;
// Reject sizeof(interface) and sizeof(interface<proto>) in 64-bit mode.
@@ -2054,20 +2151,12 @@ CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
}
}
- // If this is a halving swizzle, verify that the base type has an even
- // number of elements.
- if (HalvingSwizzle && (vecType->getNumElements() & 1U)) {
- Diag(OpLoc, diag::err_ext_vector_component_requires_even)
- << baseType << SourceRange(CompLoc);
- return QualType();
- }
-
// The component accessor looks fine - now we need to compute the actual type.
// The vector type is implied by the component accessor. For example,
// vec4.b is a float, vec4.xy is a vec2, vec4.rgb is a vec3, etc.
// vec4.s0 is a float, vec4.s23 is a vec3, etc.
// vec4.hi, vec4.lo, vec4.e, and vec4.o all return vec2.
- unsigned CompSize = HalvingSwizzle ? vecType->getNumElements() / 2
+ unsigned CompSize = HalvingSwizzle ? (vecType->getNumElements() + 1) / 2
: CompName->getLength();
if (HexSwizzle)
CompSize--;
@@ -2277,6 +2366,23 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
// The record definition is complete, now look up the member.
SemaRef.LookupQualifiedName(R, DC);
+ if (!R.empty())
+ return false;
+
+ // We didn't find anything with the given name, so try to correct
+ // for typos.
+ DeclarationName Name = R.getLookupName();
+ if (SemaRef.CorrectTypo(R, 0, &SS, DC) &&
+ (isa<ValueDecl>(*R.begin()) || isa<FunctionTemplateDecl>(*R.begin()))) {
+ SemaRef.Diag(R.getNameLoc(), diag::err_no_member_suggest)
+ << Name << DC << R.getLookupName() << SS.getRange()
+ << CodeModificationHint::CreateReplacement(R.getNameLoc(),
+ R.getLookupName().getAsString());
+ return false;
+ } else {
+ R.clear();
+ }
+
return false;
}
@@ -2372,6 +2478,7 @@ Sema::BuildMemberReferenceExpr(ExprArg Base, QualType BaseExprType,
// result.
if (R.isOverloadedResult() || R.isUnresolvableResult()) {
bool Dependent =
+ BaseExprType->isDependentType() ||
R.isUnresolvableResult() ||
UnresolvedLookupExpr::ComputeDependence(R.begin(), R.end(), TemplateArgs);
@@ -3059,28 +3166,36 @@ Sema::OwningExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
if (Result.isInvalid())
return ExprError();
- if (SetParamDefaultArgument(Param, move(Result),
- /*FIXME:EqualLoc*/
- UninstExpr->getSourceRange().getBegin()))
+ // Check the expression as an initializer for the parameter.
+ InitializedEntity Entity
+ = InitializedEntity::InitializeParameter(Param);
+ InitializationKind Kind
+ = InitializationKind::CreateCopy(Param->getLocation(),
+ /*FIXME:EqualLoc*/UninstExpr->getSourceRange().getBegin());
+ Expr *ResultE = Result.takeAs<Expr>();
+
+ InitializationSequence InitSeq(*this, Entity, Kind, &ResultE, 1);
+ Result = InitSeq.Perform(*this, Entity, Kind,
+ MultiExprArg(*this, (void**)&ResultE, 1));
+ if (Result.isInvalid())
return ExprError();
+
+ // Build the default argument expression.
+ return Owned(CXXDefaultArgExpr::Create(Context, CallLoc, Param,
+ Result.takeAs<Expr>()));
}
- Expr *DefaultExpr = Param->getDefaultArg();
-
// If the default expression creates temporaries, we need to
// push them to the current stack of expression temporaries so they'll
// be properly destroyed.
- if (CXXExprWithTemporaries *E
- = dyn_cast_or_null<CXXExprWithTemporaries>(DefaultExpr)) {
- assert(!E->shouldDestroyTemporaries() &&
- "Can't destroy temporaries in a default argument expr!");
- for (unsigned I = 0, N = E->getNumTemporaries(); I != N; ++I)
- ExprTemporaries.push_back(E->getTemporary(I));
- }
+ // FIXME: We should really be rebuilding the default argument with new
+ // bound temporaries; see the comment in PR5810.
+ for (unsigned i = 0, e = Param->getNumDefaultArgTemporaries(); i != e; ++i)
+ ExprTemporaries.push_back(Param->getDefaultArgTemporary(i));
}
// We already type-checked the argument, so we know it works.
- return Owned(CXXDefaultArgExpr::Create(Context, Param));
+ return Owned(CXXDefaultArgExpr::Create(Context, CallLoc, Param));
}
/// ConvertArgumentsForCall - Converts the arguments specified in
@@ -3169,12 +3284,22 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc,
<< Arg->getSourceRange()))
return true;
- // Pass the argument.
- if (PerformCopyInitialization(Arg, ProtoArgType, "passing"))
- return true;
+ // Pass the argument
+ ParmVarDecl *Param = 0;
+ if (FDecl && i < FDecl->getNumParams())
+ Param = FDecl->getParamDecl(i);
+
- if (!ProtoArgType->isReferenceType())
- Arg = MaybeBindToTemporary(Arg).takeAs<Expr>();
+ InitializedEntity Entity =
+ Param? InitializedEntity::InitializeParameter(Param)
+ : InitializedEntity::InitializeParameter(ProtoArgType);
+ OwningExprResult ArgE = PerformCopyInitialization(Entity,
+ SourceLocation(),
+ Owned(Arg));
+ if (ArgE.isInvalid())
+ return true;
+
+ Arg = ArgE.takeAs<Expr>();
} else {
ParmVarDecl *Param = FDecl->getParamDecl(i);
@@ -3200,64 +3325,6 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc,
return Invalid;
}
-/// \brief "Deconstruct" the function argument of a call expression to find
-/// the underlying declaration (if any), the name of the called function,
-/// whether argument-dependent lookup is available, whether it has explicit
-/// template arguments, etc.
-void Sema::DeconstructCallFunction(Expr *FnExpr,
- llvm::SmallVectorImpl<NamedDecl*> &Fns,
- DeclarationName &Name,
- NestedNameSpecifier *&Qualifier,
- SourceRange &QualifierRange,
- bool &ArgumentDependentLookup,
- bool &Overloaded,
- bool &HasExplicitTemplateArguments,
- TemplateArgumentListInfo &ExplicitTemplateArgs) {
- // Set defaults for all of the output parameters.
- Name = DeclarationName();
- Qualifier = 0;
- QualifierRange = SourceRange();
- ArgumentDependentLookup = false;
- Overloaded = false;
- HasExplicitTemplateArguments = false;
-
- // If we're directly calling a function, get the appropriate declaration.
- // Also, in C++, keep track of whether we should perform argument-dependent
- // lookup and whether there were any explicitly-specified template arguments.
- while (true) {
- if (ImplicitCastExpr *IcExpr = dyn_cast<ImplicitCastExpr>(FnExpr))
- FnExpr = IcExpr->getSubExpr();
- else if (ParenExpr *PExpr = dyn_cast<ParenExpr>(FnExpr)) {
- FnExpr = PExpr->getSubExpr();
- } else if (isa<UnaryOperator>(FnExpr) &&
- cast<UnaryOperator>(FnExpr)->getOpcode()
- == UnaryOperator::AddrOf) {
- FnExpr = cast<UnaryOperator>(FnExpr)->getSubExpr();
- } else if (DeclRefExpr *DRExpr = dyn_cast<DeclRefExpr>(FnExpr)) {
- Fns.push_back(cast<NamedDecl>(DRExpr->getDecl()));
- ArgumentDependentLookup = false;
- if ((Qualifier = DRExpr->getQualifier()))
- QualifierRange = DRExpr->getQualifierRange();
- break;
- } else if (UnresolvedLookupExpr *UnresLookup
- = dyn_cast<UnresolvedLookupExpr>(FnExpr)) {
- Name = UnresLookup->getName();
- Fns.append(UnresLookup->decls_begin(), UnresLookup->decls_end());
- ArgumentDependentLookup = UnresLookup->requiresADL();
- Overloaded = UnresLookup->isOverloaded();
- if ((Qualifier = UnresLookup->getQualifier()))
- QualifierRange = UnresLookup->getQualifierRange();
- if (UnresLookup->hasExplicitTemplateArgs()) {
- HasExplicitTemplateArguments = true;
- UnresLookup->copyTemplateArgumentsInto(ExplicitTemplateArgs);
- }
- break;
- } else {
- break;
- }
- }
-}
-
/// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
/// This provides the location of the left/right parens and a list of comma
/// locations.
@@ -3372,72 +3439,23 @@ Sema::ActOnCallExpr(Scope *S, ExprArg fn, SourceLocation LParenLoc,
// If we're directly calling a function, get the appropriate declaration.
// Also, in C++, keep track of whether we should perform argument-dependent
// lookup and whether there were any explicitly-specified template arguments.
- llvm::SmallVector<NamedDecl*,8> Fns;
- DeclarationName UnqualifiedName;
- bool Overloaded;
- bool ADL;
- bool HasExplicitTemplateArgs = 0;
- TemplateArgumentListInfo ExplicitTemplateArgs;
- NestedNameSpecifier *Qualifier = 0;
- SourceRange QualifierRange;
- DeconstructCallFunction(Fn, Fns, UnqualifiedName, Qualifier, QualifierRange,
- ADL, Overloaded, HasExplicitTemplateArgs,
- ExplicitTemplateArgs);
-
- NamedDecl *NDecl; // the specific declaration we're calling, if applicable
- FunctionDecl *FDecl; // same, if it's known to be a function
-
- if (Overloaded || ADL) {
-#ifndef NDEBUG
- if (ADL) {
- // To do ADL, we must have found an unqualified name.
- assert(UnqualifiedName && "found no unqualified name for ADL");
-
- // We don't perform ADL for implicit declarations of builtins.
- // Verify that this was correctly set up.
- if (Fns.size() == 1 && (FDecl = dyn_cast<FunctionDecl>(Fns[0])) &&
- FDecl->getBuiltinID() && FDecl->isImplicit())
- assert(0 && "performing ADL for builtin");
-
- // We don't perform ADL in C.
- assert(getLangOptions().CPlusPlus && "ADL enabled in C");
- }
-
- if (Overloaded) {
- // To be overloaded, we must either have multiple functions or
- // at least one function template (which is effectively an
- // infinite set of functions).
- assert((Fns.size() > 1 ||
- (Fns.size() == 1 &&
- isa<FunctionTemplateDecl>(Fns[0]->getUnderlyingDecl())))
- && "unrecognized overload situation");
- }
-#endif
-
- FDecl = ResolveOverloadedCallFn(Fn, Fns, UnqualifiedName,
- (HasExplicitTemplateArgs ? &ExplicitTemplateArgs : 0),
- LParenLoc, Args, NumArgs, CommaLocs,
- RParenLoc, ADL);
- if (!FDecl)
- return ExprError();
-
- Fn = FixOverloadedFunctionReference(Fn, FDecl);
- NDecl = FDecl;
- } else {
- assert(Fns.size() <= 1 && "overloaded without Overloaded flag");
- if (Fns.empty())
- NDecl = 0;
- else {
- NDecl = Fns[0];
- }
+ Expr *NakedFn = Fn->IgnoreParens();
+ if (isa<UnresolvedLookupExpr>(NakedFn)) {
+ UnresolvedLookupExpr *ULE = cast<UnresolvedLookupExpr>(NakedFn);
+ return BuildOverloadedCallExpr(Fn, ULE, LParenLoc, Args, NumArgs,
+ CommaLocs, RParenLoc);
}
+ NamedDecl *NDecl = 0;
+ if (isa<DeclRefExpr>(NakedFn))
+ NDecl = cast<DeclRefExpr>(NakedFn)->getDecl();
+
return BuildResolvedCallExpr(Fn, NDecl, LParenLoc, Args, NumArgs, RParenLoc);
}
-/// BuildCallExpr - Build a call to a resolved expression, i.e. an
-/// expression not of \p OverloadTy. The expression should
+/// BuildResolvedCallExpr - Build a call to a resolved expression,
+/// i.e. an expression not of \p OverloadTy. The expression should
/// unary-convert to an expression of function-pointer or
/// block-pointer type.
///
@@ -3547,8 +3565,9 @@ Action::OwningExprResult
Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, TypeTy *Ty,
SourceLocation RParenLoc, ExprArg InitExpr) {
assert((Ty != 0) && "ActOnCompoundLiteral(): missing type");
- //FIXME: Preserve type source info.
- QualType literalType = GetTypeFromParser(Ty);
+
+ QualType literalType = GetTypeFromParser(Ty);
+
// FIXME: put back this assert when initializers are worked out.
//assert((InitExpr != 0) && "ActOnCompoundLiteral(): missing expression");
Expr *literalExpr = static_cast<Expr*>(InitExpr.get());
@@ -3564,16 +3583,29 @@ Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, TypeTy *Ty,
literalExpr->getSourceRange().getEnd())))
return ExprError();
- if (CheckInitializerTypes(literalExpr, literalType, LParenLoc,
- DeclarationName(), /*FIXME:DirectInit=*/false))
+ InitializedEntity Entity
+ = InitializedEntity::InitializeTemporary(literalType);
+ InitializationKind Kind
+ = InitializationKind::CreateCast(SourceRange(LParenLoc, RParenLoc),
+ /*IsCStyleCast=*/true);
+ InitializationSequence InitSeq(*this, Entity, Kind, &literalExpr, 1);
+ OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
+ MultiExprArg(*this, (void**)&literalExpr, 1),
+ &literalType);
+ if (Result.isInvalid())
return ExprError();
+ InitExpr.release();
+ literalExpr = static_cast<Expr*>(Result.get());
bool isFileScope = getCurFunctionOrMethodDecl() == 0;
if (isFileScope) { // 6.5.2.5p3
if (CheckForConstantInitializer(literalExpr, literalType))
return ExprError();
}
- InitExpr.release();
+
+ Result.release();
+
+ // FIXME: Store the TInfo to preserve type information better.
return Owned(new (Context) CompoundLiteralExpr(LParenLoc, literalType,
literalExpr, isFileScope));
}
@@ -3600,7 +3632,9 @@ static CastExpr::CastKind getScalarCastKind(ASTContext &Context,
if (SrcTy->hasPointerRepresentation()) {
if (DestTy->hasPointerRepresentation())
- return CastExpr::CK_BitCast;
+ return DestTy->isObjCObjectPointerType() ?
+ CastExpr::CK_AnyPointerToObjCPointerCast :
+ CastExpr::CK_BitCast;
if (DestTy->isIntegerType())
return CastExpr::CK_PointerToIntegral;
}
@@ -4632,7 +4666,7 @@ Sema::CheckSingleAssignmentConstraints(QualType lhsType, Expr *&rExpr) {
// expression is implicitly converted (C++ 4) to the
// cv-unqualified type of the left operand.
if (PerformImplicitConversion(rExpr, lhsType.getUnqualifiedType(),
- "assigning"))
+ AA_Assigning))
return Incompatible;
return Compatible;
}
@@ -5226,7 +5260,18 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
if (getLangOptions().CPlusPlus) {
if (LCanPointeeTy == RCanPointeeTy)
return ResultTy;
-
+ if (!isRelational &&
+ (LCanPointeeTy->isVoidType() || RCanPointeeTy->isVoidType())) {
+ // Valid unless comparison between non-null pointer and function pointer
+ // This is a gcc extension compatibility comparison.
+ if ((LCanPointeeTy->isFunctionType() || RCanPointeeTy->isFunctionType())
+ && !LHSIsNull && !RHSIsNull) {
+ Diag(Loc, diag::ext_typecheck_comparison_of_fptr_to_void)
+ << lType << rType << lex->getSourceRange() << rex->getSourceRange();
+ ImpCastExprToType(rex, lType, CastExpr::CK_BitCast);
+ return ResultTy;
+ }
+ }
// C++ [expr.rel]p2:
// [...] Pointer conversions (4.10) and qualification
// conversions (4.4) are performed on pointer operands (or on
@@ -5503,7 +5548,7 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14]
return InvalidOperands(Loc, lex, rex);
if (PerformImplicitConversion(lex, Context.BoolTy, LHS,
- "passing", /*IgnoreBaseAccess=*/false))
+ AA_Passing, /*IgnoreBaseAccess=*/false))
return InvalidOperands(Loc, lex, rex);
StandardConversionSequence RHS;
@@ -5512,7 +5557,7 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14]
return InvalidOperands(Loc, lex, rex);
if (PerformImplicitConversion(rex, Context.BoolTy, RHS,
- "passing", /*IgnoreBaseAccess=*/false))
+ AA_Passing, /*IgnoreBaseAccess=*/false))
return InvalidOperands(Loc, lex, rex);
// C++ [expr.log.and]p2
@@ -5587,6 +5632,9 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) {
case Expr::MLV_NoSetterProperty:
Diag = diag::error_nosetter_property_assignment;
break;
+ case Expr::MLV_SubObjCPropertySetting:
+ Diag = diag::error_no_subobject_property_setting;
+ break;
}
SourceRange Assign;
@@ -5651,7 +5699,7 @@ QualType Sema::CheckAssignmentOperands(Expr *LHS, Expr *&RHS,
}
if (DiagnoseAssignmentResult(ConvTy, Loc, LHSType, RHSType,
- RHS, "assigning"))
+ RHS, AA_Assigning))
return QualType();
// C99 6.5.16p3: The type of an assignment expression is the type of the
@@ -5734,7 +5782,7 @@ QualType Sema::CheckIncrementDecrementOperand(Expr *Op, SourceLocation OpLoc,
<< ResType << Op->getSourceRange();
} else {
Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement)
- << ResType << Op->getSourceRange();
+ << ResType << int(isInc) << Op->getSourceRange();
return QualType();
}
// At this point, we know we have a real, complex or pointer type.
@@ -6478,28 +6526,12 @@ Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
// Get the decl corresponding to this.
RecordDecl *RD = RC->getDecl();
if (CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(RD)) {
- if (!CRD->isPOD() && !DidWarnAboutNonPOD) {
- switch (ExprEvalContexts.back().Context ) {
- case Unevaluated:
- // The argument will never be evaluated, so don't complain.
- break;
-
- case PotentiallyEvaluated:
- ExprError(Diag(BuiltinLoc, diag::warn_offsetof_non_pod_type)
- << SourceRange(CompPtr[0].LocStart, OC.LocEnd)
- << Res->getType());
- DidWarnAboutNonPOD = true;
- break;
-
- case PotentiallyPotentiallyEvaluated:
- ExprEvalContexts.back().addDiagnostic(BuiltinLoc,
- PDiag(diag::warn_offsetof_non_pod_type)
- << SourceRange(CompPtr[0].LocStart, OC.LocEnd)
- << Res->getType());
- DidWarnAboutNonPOD = true;
- break;
- }
- }
+ if (!CRD->isPOD() && !DidWarnAboutNonPOD &&
+ DiagRuntimeBehavior(BuiltinLoc,
+ PDiag(diag::warn_offsetof_non_pod_type)
+ << SourceRange(CompPtr[0].LocStart, OC.LocEnd)
+ << Res->getType()))
+ DidWarnAboutNonPOD = true;
}
LookupResult R(*this, OC.U.IdentInfo, OC.LocStart, LookupMemberName);
@@ -6847,7 +6879,7 @@ MakeObjCStringLiteralCodeModificationHint(Sema& SemaRef,
bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
SourceLocation Loc,
QualType DstType, QualType SrcType,
- Expr *SrcExpr, const char *Flavor) {
+ Expr *SrcExpr, AssignmentAction Action) {
// Decode the result (notice that AST's are still created for extensions).
bool isInvalid = false;
unsigned DiagKind;
@@ -6910,7 +6942,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
break;
}
- Diag(Loc, DiagKind) << DstType << SrcType << Flavor
+ Diag(Loc, DiagKind) << DstType << SrcType << Action
<< SrcExpr->getSourceRange() << Hint;
return isInvalid;
}
@@ -7053,7 +7085,7 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) {
if (!Constructor->isUsed())
DefineImplicitDefaultConstructor(Loc, Constructor);
} else if (Constructor->isImplicit() &&
- Constructor->isCopyConstructor(Context, TypeQuals)) {
+ Constructor->isCopyConstructor(TypeQuals)) {
if (!Constructor->isUsed())
DefineImplicitCopyConstructor(Loc, Constructor, TypeQuals);
}
@@ -7120,6 +7152,41 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) {
}
}
+/// \brief Emit a diagnostic that describes an effect on the run-time behavior
+/// of the program being compiled.
+///
+/// This routine emits the given diagnostic when the code currently being
+/// type-checked is "potentially evaluated", meaning that there is a
+/// possibility that the code will actually be executable. Code in sizeof()
+/// expressions, code used only during overload resolution, etc., are not
+/// potentially evaluated. This routine will suppress such diagnostics or,
+/// in the absolutely nutty case of potentially potentially evaluated
+/// expressions (C++ typeid), queue the diagnostic to potentially emit it
+/// later.
+///
+/// This routine should be used for all diagnostics that describe the run-time
+/// behavior of a program, such as passing a non-POD value through an ellipsis.
+/// Failure to do so will likely result in spurious diagnostics or failures
+/// during overload resolution or within sizeof/alignof/typeof/typeid.
+bool Sema::DiagRuntimeBehavior(SourceLocation Loc,
+ const PartialDiagnostic &PD) {
+ switch (ExprEvalContexts.back().Context ) {
+ case Unevaluated:
+ // The argument will never be evaluated, so don't complain.
+ break;
+
+ case PotentiallyEvaluated:
+ Diag(Loc, PD);
+ return true;
+
+ case PotentiallyPotentiallyEvaluated:
+ ExprEvalContexts.back().addDiagnostic(Loc, PD);
+ break;
+ }
+
+ return false;
+}
+
bool Sema::CheckCallReturnType(QualType ReturnType, SourceLocation Loc,
CallExpr *CE, FunctionDecl *FD) {
if (ReturnType->isVoidType() || !ReturnType->isIncompleteType())
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 6d991b6a7c6b..5f723f92146d 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -31,9 +31,29 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,
if (!StdNamespace)
return ExprError(Diag(OpLoc, diag::err_need_header_before_typeid));
- if (isType)
+ if (isType) {
+ // C++ [expr.typeid]p4:
+ // The top-level cv-qualifiers of the lvalue expression or the type-id
+ // that is the operand of typeid are always ignored.
// FIXME: Preserve type source info.
- TyOrExpr = GetTypeFromParser(TyOrExpr).getAsOpaquePtr();
+ // FIXME: Preserve the type before we stripped the cv-qualifiers?
+ QualType T = GetTypeFromParser(TyOrExpr);
+ if (T.isNull())
+ return ExprError();
+
+ // C++ [expr.typeid]p4:
+ // If the type of the type-id is a class type or a reference to a class
+ // type, the class shall be completely-defined.
+ QualType CheckT = T;
+ if (const ReferenceType *RefType = CheckT->getAs<ReferenceType>())
+ CheckT = RefType->getPointeeType();
+
+ if (CheckT->getAs<RecordType>() &&
+ RequireCompleteType(OpLoc, CheckT, diag::err_incomplete_typeid))
+ return ExprError();
+
+ TyOrExpr = T.getUnqualifiedType().getAsOpaquePtr();
+ }
IdentifierInfo *TypeInfoII = &PP.getIdentifierTable().get("type_info");
LookupResult R(*this, TypeInfoII, SourceLocation(), LookupTagName);
@@ -45,21 +65,36 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,
QualType TypeInfoType = Context.getTypeDeclType(TypeInfoRecordDecl);
if (!isType) {
- // C++0x [expr.typeid]p3:
- // When typeid is applied to an expression other than an lvalue of a
- // polymorphic class type [...] [the] expression is an unevaluated
- // operand.
-
- // FIXME: if the type of the expression is a class type, the class
- // shall be completely defined.
bool isUnevaluatedOperand = true;
Expr *E = static_cast<Expr *>(TyOrExpr);
- if (E && !E->isTypeDependent() && E->isLvalue(Context) == Expr::LV_Valid) {
+ if (E && !E->isTypeDependent()) {
QualType T = E->getType();
if (const RecordType *RecordT = T->getAs<RecordType>()) {
CXXRecordDecl *RecordD = cast<CXXRecordDecl>(RecordT->getDecl());
- if (RecordD->isPolymorphic())
+ // C++ [expr.typeid]p3:
+ // When typeid is applied to an expression other than an lvalue of a
+ // polymorphic class type [...] [the] expression is an unevaluated
+ // operand. [...]
+ if (RecordD->isPolymorphic() && E->isLvalue(Context) == Expr::LV_Valid)
isUnevaluatedOperand = false;
+ else {
+ // C++ [expr.typeid]p3:
+ // [...] If the type of the expression is a class type, the class
+ // shall be completely-defined.
+ if (RequireCompleteType(OpLoc, T, diag::err_incomplete_typeid))
+ return ExprError();
+ }
+ }
+
+ // C++ [expr.typeid]p4:
+ // [...] If the type of the type-id is a reference to a possibly
+ // cv-qualified type, the result of the typeid expression refers to a
+ // std::type_info object representing the cv-unqualified referenced
+ // type.
+ if (T.hasQualifiers()) {
+ ImpCastExprToType(E, T.getUnqualifiedType(), CastExpr::CK_NoOp,
+ E->isLvalue(Context));
+ TyOrExpr = E;
}
}
@@ -102,8 +137,15 @@ Sema::ActOnCXXThrow(SourceLocation OpLoc, ExprArg E) {
/// CheckCXXThrowOperand - Validate the operand of a throw.
bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E) {
// C++ [except.throw]p3:
- // [...] adjusting the type from "array of T" or "function returning T"
- // to "pointer to T" or "pointer to function returning T", [...]
+ // A throw-expression initializes a temporary object, called the exception
+ // object, the type of which is determined by removing any top-level
+ // cv-qualifiers from the static type of the operand of throw and adjusting
+ // the type from "array of T" or "function returning T" to "pointer to T"
+ // or "pointer to function returning T", [...]
+ if (E->getType().hasQualifiers())
+ ImpCastExprToType(E, E->getType().getUnqualifiedType(), CastExpr::CK_NoOp,
+ E->isLvalue(Context) == Expr::LV_Valid);
+
DefaultFunctionArrayConversion(E);
// If the type of the exception would be an incomplete type or a pointer
@@ -425,74 +467,61 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
bool Init = ConstructorLParen.isValid();
// --- Choosing a constructor ---
- // C++ 5.3.4p15
- // 1) If T is a POD and there's no initializer (ConstructorLParen is invalid)
- // the object is not initialized. If the object, or any part of it, is
- // const-qualified, it's an error.
- // 2) If T is a POD and there's an empty initializer, the object is value-
- // initialized.
- // 3) If T is a POD and there's one initializer argument, the object is copy-
- // constructed.
- // 4) If T is a POD and there's more initializer arguments, it's an error.
- // 5) If T is not a POD, the initializer arguments are used as constructor
- // arguments.
- //
- // Or by the C++0x formulation:
- // 1) If there's no initializer, the object is default-initialized according
- // to C++0x rules.
- // 2) Otherwise, the object is direct-initialized.
CXXConstructorDecl *Constructor = 0;
Expr **ConsArgs = (Expr**)ConstructorArgs.get();
- const RecordType *RT;
unsigned NumConsArgs = ConstructorArgs.size();
ASTOwningVector<&ActionBase::DeleteExpr> ConvertedConstructorArgs(*this);
- if (AllocType->isDependentType() ||
- Expr::hasAnyTypeDependentArguments(ConsArgs, NumConsArgs)) {
- // Skip all the checks.
- } else if ((RT = AllocType->getAs<RecordType>()) &&
- !AllocType->isAggregateType()) {
- InitializationKind InitKind = InitializationKind::CreateDefault(TypeLoc);
- if (NumConsArgs > 0)
- InitKind = InitializationKind::CreateDirect(TypeLoc,
- PlacementLParen,
- PlacementRParen);
- Constructor = PerformInitializationByConstructor(
- AllocType, move(ConstructorArgs),
- TypeLoc,
- SourceRange(TypeLoc, ConstructorRParen),
- RT->getDecl()->getDeclName(),
- InitKind,
- ConvertedConstructorArgs);
- if (!Constructor)
+ if (!AllocType->isDependentType() &&
+ !Expr::hasAnyTypeDependentArguments(ConsArgs, NumConsArgs)) {
+ // C++0x [expr.new]p15:
+ // A new-expression that creates an object of type T initializes that
+ // object as follows:
+ InitializationKind Kind
+ // - If the new-initializer is omitted, the object is default-
+ // initialized (8.5); if no initialization is performed,
+ // the object has indeterminate value
+ = !Init? InitializationKind::CreateDefault(TypeLoc)
+ // - Otherwise, the new-initializer is interpreted according to the
+ // initialization rules of 8.5 for direct-initialization.
+ : InitializationKind::CreateDirect(TypeLoc,
+ ConstructorLParen,
+ ConstructorRParen);
+
+ InitializedEntity Entity
+ = InitializedEntity::InitializeNew(StartLoc, AllocType);
+ InitializationSequence InitSeq(*this, Entity, Kind, ConsArgs, NumConsArgs);
+ OwningExprResult FullInit = InitSeq.Perform(*this, Entity, Kind,
+ move(ConstructorArgs));
+ if (FullInit.isInvalid())
return ExprError();
-
- // Take the converted constructor arguments and use them for the new
- // expression.
- NumConsArgs = ConvertedConstructorArgs.size();
- ConsArgs = (Expr **)ConvertedConstructorArgs.take();
- } else {
- if (!Init) {
- // FIXME: Check that no subpart is const.
- if (AllocType.isConstQualified())
- return ExprError(Diag(StartLoc, diag::err_new_uninitialized_const)
- << TypeRange);
- } else if (NumConsArgs == 0) {
- // Object is value-initialized. Do nothing.
- } else if (NumConsArgs == 1) {
- // Object is direct-initialized.
- // FIXME: What DeclarationName do we pass in here?
- if (CheckInitializerTypes(ConsArgs[0], AllocType, StartLoc,
- DeclarationName() /*AllocType.getAsString()*/,
- /*DirectInit=*/true))
- return ExprError();
+
+ // FullInit is our initializer; walk through it to determine if it's a
+ // constructor call, which CXXNewExpr handles directly.
+ if (Expr *FullInitExpr = (Expr *)FullInit.get()) {
+ if (CXXBindTemporaryExpr *Binder
+ = dyn_cast<CXXBindTemporaryExpr>(FullInitExpr))
+ FullInitExpr = Binder->getSubExpr();
+ if (CXXConstructExpr *Construct
+ = dyn_cast<CXXConstructExpr>(FullInitExpr)) {
+ Constructor = Construct->getConstructor();
+ for (CXXConstructExpr::arg_iterator A = Construct->arg_begin(),
+ AEnd = Construct->arg_end();
+ A != AEnd; ++A)
+ ConvertedConstructorArgs.push_back(A->Retain());
+ } else {
+ // Take the converted initializer.
+ ConvertedConstructorArgs.push_back(FullInit.release());
+ }
} else {
- return ExprError(Diag(StartLoc,
- diag::err_builtin_direct_init_more_than_one_arg)
- << SourceRange(ConstructorLParen, ConstructorRParen));
+ // No initialization required.
}
+
+ // Take the converted arguments and use them for the new expression.
+ NumConsArgs = ConvertedConstructorArgs.size();
+ ConsArgs = (Expr **)ConvertedConstructorArgs.take();
}
-
+
// FIXME: Also check that the destructor is accessible. (C++ 5.3.4p16)
PlacementArgs.release();
@@ -631,10 +660,9 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
// Whatch out for variadic allocator function.
unsigned NumArgsInFnDecl = FnDecl->getNumParams();
for (unsigned i = 0; (i < NumArgs && i < NumArgsInFnDecl); ++i) {
- // FIXME: Passing word to diagnostic.
if (PerformCopyInitialization(Args[i],
FnDecl->getParamDecl(i)->getType(),
- "passing"))
+ AA_Passing))
return true;
}
Operator = FnDecl;
@@ -720,13 +748,14 @@ void Sema::DeclareGlobalNewDelete() {
QualType VoidPtr = Context.getPointerType(Context.VoidTy);
QualType SizeT = Context.getSizeType();
+ bool AssumeSaneOperatorNew = getLangOptions().AssumeSaneOperatorNew;
DeclareGlobalAllocationFunction(
Context.DeclarationNames.getCXXOperatorName(OO_New),
- VoidPtr, SizeT);
+ VoidPtr, SizeT, AssumeSaneOperatorNew);
DeclareGlobalAllocationFunction(
Context.DeclarationNames.getCXXOperatorName(OO_Array_New),
- VoidPtr, SizeT);
+ VoidPtr, SizeT, AssumeSaneOperatorNew);
DeclareGlobalAllocationFunction(
Context.DeclarationNames.getCXXOperatorName(OO_Delete),
Context.VoidTy, VoidPtr);
@@ -738,7 +767,8 @@ void Sema::DeclareGlobalNewDelete() {
/// DeclareGlobalAllocationFunction - Declares a single implicit global
/// allocation function if it doesn't already exist.
void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
- QualType Return, QualType Argument) {
+ QualType Return, QualType Argument,
+ bool AddMallocAttr) {
DeclContext *GlobalCtx = Context.getTranslationUnitDecl();
// Check if this function is already declared.
@@ -749,7 +779,8 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
// FIXME: Do we need to check for default arguments here?
FunctionDecl *Func = cast<FunctionDecl>(*Alloc);
if (Func->getNumParams() == 1 &&
- Context.getCanonicalType(Func->getParamDecl(0)->getType())==Argument)
+ Context.getCanonicalType(
+ Func->getParamDecl(0)->getType().getUnqualifiedType()) == Argument)
return;
}
}
@@ -771,6 +802,10 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
FunctionDecl::Create(Context, GlobalCtx, SourceLocation(), Name,
FnType, /*TInfo=*/0, FunctionDecl::None, false, true);
Alloc->setImplicit();
+
+ if (AddMallocAttr)
+ Alloc->addAttr(::new (Context) MallocAttr());
+
ParmVarDecl *Param = ParmVarDecl::Create(Context, Alloc, SourceLocation(),
0, Argument, /*TInfo=*/0,
VarDecl::None, 0);
@@ -876,7 +911,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
Operand.release();
if (!PerformImplicitConversion(Ex,
ObjectPtrConversions.front()->getConversionType(),
- "converting")) {
+ AA_Converting)) {
Operand = Owned(Ex);
Type = Ex->getType();
}
@@ -1027,16 +1062,16 @@ Sema::IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType) {
/// resolution works differently in that case.
bool
Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
- const char *Flavor, bool AllowExplicit,
+ AssignmentAction Action, bool AllowExplicit,
bool Elidable) {
ImplicitConversionSequence ICS;
- return PerformImplicitConversion(From, ToType, Flavor, AllowExplicit,
+ return PerformImplicitConversion(From, ToType, Action, AllowExplicit,
Elidable, ICS);
}
bool
Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
- const char *Flavor, bool AllowExplicit,
+ AssignmentAction Action, bool AllowExplicit,
bool Elidable,
ImplicitConversionSequence& ICS) {
ICS.ConversionKind = ImplicitConversionSequence::BadConversion;
@@ -1054,7 +1089,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
/*ForceRValue=*/false,
/*InOverloadResolution=*/false);
}
- return PerformImplicitConversion(From, ToType, ICS, Flavor);
+ return PerformImplicitConversion(From, ToType, ICS, Action);
}
/// BuildCXXDerivedToBaseExpr - This routine generates the suitable AST
@@ -1062,8 +1097,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
/// necessary information is passed in ICS.
bool
Sema::BuildCXXDerivedToBaseExpr(Expr *&From, CastExpr::CastKind CastKind,
- const ImplicitConversionSequence& ICS,
- const char *Flavor) {
+ const ImplicitConversionSequence& ICS) {
QualType BaseType =
QualType::getFromOpaquePtr(ICS.UserDefined.After.ToTypePtr);
// Must do additional defined to base conversion.
@@ -1095,15 +1129,15 @@ Sema::BuildCXXDerivedToBaseExpr(Expr *&From, CastExpr::CastKind CastKind,
/// expression From to the type ToType using the pre-computed implicit
/// conversion sequence ICS. Returns true if there was an error, false
/// otherwise. The expression From is replaced with the converted
-/// expression. Flavor is the kind of conversion we're performing,
+/// expression. Action is the kind of conversion we're performing,
/// used in the error message.
bool
Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
const ImplicitConversionSequence &ICS,
- const char* Flavor, bool IgnoreBaseAccess) {
+ AssignmentAction Action, bool IgnoreBaseAccess) {
switch (ICS.ConversionKind) {
case ImplicitConversionSequence::StandardConversion:
- if (PerformImplicitConversion(From, ToType, ICS.Standard, Flavor,
+ if (PerformImplicitConversion(From, ToType, ICS.Standard, Action,
IgnoreBaseAccess))
return true;
break;
@@ -1136,7 +1170,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
// Whatch out for elipsis conversion.
if (!ICS.UserDefined.EllipsisConversion) {
if (PerformImplicitConversion(From, BeforeToType,
- ICS.UserDefined.Before, "converting",
+ ICS.UserDefined.Before, AA_Converting,
IgnoreBaseAccess))
return true;
}
@@ -1156,7 +1190,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
// there's some nasty stuff involving MaybeBindToTemporary going on here.
if (ICS.UserDefined.After.Second == ICK_Derived_To_Base &&
ICS.UserDefined.After.CopyConstructor) {
- return BuildCXXDerivedToBaseExpr(From, CastKind, ICS, Flavor);
+ return BuildCXXDerivedToBaseExpr(From, CastKind, ICS);
}
if (ICS.UserDefined.After.CopyConstructor) {
@@ -1167,7 +1201,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
}
return PerformImplicitConversion(From, ToType, ICS.UserDefined.After,
- "converting", IgnoreBaseAccess);
+ AA_Converting, IgnoreBaseAccess);
}
case ImplicitConversionSequence::EllipsisConversion:
@@ -1191,7 +1225,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
bool
Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
const StandardConversionSequence& SCS,
- const char *Flavor, bool IgnoreBaseAccess) {
+ AssignmentAction Action, bool IgnoreBaseAccess) {
// Overall FIXME: we are recomputing too many types here and doing far too
// much extra work. What this means is that we need to keep track of more
// information that is computed when we try the implicit conversion initially,
@@ -1323,7 +1357,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
// Diagnose incompatible Objective-C conversions
Diag(From->getSourceRange().getBegin(),
diag::ext_typecheck_convert_incompatible_pointer)
- << From->getType() << ToType << Flavor
+ << From->getType() << ToType << Action
<< From->getSourceRange();
}
@@ -1595,9 +1629,9 @@ static bool FindConditionalOverload(Sema &Self, Expr *&LHS, Expr *&RHS,
case OR_Success:
// We found a match. Perform the conversions on the arguments and move on.
if (Self.PerformImplicitConversion(LHS, Best->BuiltinTypes.ParamTypes[0],
- Best->Conversions[0], "converting") ||
+ Best->Conversions[0], Sema::AA_Converting) ||
Self.PerformImplicitConversion(RHS, Best->BuiltinTypes.ParamTypes[1],
- Best->Conversions[1], "converting"))
+ Best->Conversions[1], Sema::AA_Converting))
break;
return false;
@@ -1655,7 +1689,7 @@ static bool ConvertForConditional(Sema &Self, Expr *&E,
/*AllowExplicit=*/false,
/*ForceRValue=*/false);
}
- if (Self.PerformImplicitConversion(E, TargetType(ICS), ICS, "converting"))
+ if (Self.PerformImplicitConversion(E, TargetType(ICS), ICS, Sema::AA_Converting))
return true;
return false;
}
@@ -1879,9 +1913,9 @@ QualType Sema::CXXCheckConditionalOperands(Expr *&Cond, Expr *&LHS, Expr *&RHS,
LPointee = Context.getQualifiedType(LPointee, MergedQuals);
QualType Common
= Context.getMemberPointerType(LPointee, MoreDerived.getTypePtr());
- if (PerformImplicitConversion(LHS, Common, "converting"))
+ if (PerformImplicitConversion(LHS, Common, Sema::AA_Converting))
return QualType();
- if (PerformImplicitConversion(RHS, Common, "converting"))
+ if (PerformImplicitConversion(RHS, Common, Sema::AA_Converting))
return QualType();
return Common;
}
@@ -2046,13 +2080,13 @@ QualType Sema::FindCompositePointerType(Expr *&E1, Expr *&E2) {
&& E2ToC2.ConversionKind !=
ImplicitConversionSequence::BadConversion;
if (ToC1Viable && !ToC2Viable) {
- if (!PerformImplicitConversion(E1, Composite1, E1ToC1, "converting") &&
- !PerformImplicitConversion(E2, Composite1, E2ToC1, "converting"))
+ if (!PerformImplicitConversion(E1, Composite1, E1ToC1, Sema::AA_Converting) &&
+ !PerformImplicitConversion(E2, Composite1, E2ToC1, Sema::AA_Converting))
return Composite1;
}
if (ToC2Viable && !ToC1Viable) {
- if (!PerformImplicitConversion(E1, Composite2, E1ToC2, "converting") &&
- !PerformImplicitConversion(E2, Composite2, E2ToC2, "converting"))
+ if (!PerformImplicitConversion(E1, Composite2, E1ToC2, Sema::AA_Converting) &&
+ !PerformImplicitConversion(E2, Composite2, E2ToC2, Sema::AA_Converting))
return Composite2;
}
return QualType();
@@ -2062,6 +2096,8 @@ Sema::OwningExprResult Sema::MaybeBindToTemporary(Expr *E) {
if (!Context.getLangOptions().CPlusPlus)
return Owned(E);
+ assert(!isa<CXXBindTemporaryExpr>(E) && "Double-bound temporary?");
+
const RecordType *RT = E->getType()->getAs<RecordType>();
if (!RT)
return Owned(E);
@@ -2089,8 +2125,7 @@ Sema::OwningExprResult Sema::MaybeBindToTemporary(Expr *E) {
return Owned(CXXBindTemporaryExpr::Create(Context, Temp, E));
}
-Expr *Sema::MaybeCreateCXXExprWithTemporaries(Expr *SubExpr,
- bool ShouldDestroyTemps) {
+Expr *Sema::MaybeCreateCXXExprWithTemporaries(Expr *SubExpr) {
assert(SubExpr && "sub expression can't be null!");
unsigned FirstTemporary = ExprEvalContexts.back().NumTemporaries;
@@ -2100,8 +2135,31 @@ Expr *Sema::MaybeCreateCXXExprWithTemporaries(Expr *SubExpr,
Expr *E = CXXExprWithTemporaries::Create(Context, SubExpr,
&ExprTemporaries[FirstTemporary],
- ExprTemporaries.size() - FirstTemporary,
- ShouldDestroyTemps);
+ ExprTemporaries.size() - FirstTemporary);
+ ExprTemporaries.erase(ExprTemporaries.begin() + FirstTemporary,
+ ExprTemporaries.end());
+
+ return E;
+}
+
+Sema::OwningExprResult
+Sema::MaybeCreateCXXExprWithTemporaries(OwningExprResult SubExpr) {
+ if (SubExpr.isInvalid())
+ return ExprError();
+
+ return Owned(MaybeCreateCXXExprWithTemporaries(SubExpr.takeAs<Expr>()));
+}
+
+FullExpr Sema::CreateFullExpr(Expr *SubExpr) {
+ unsigned FirstTemporary = ExprEvalContexts.back().NumTemporaries;
+ assert(ExprTemporaries.size() >= FirstTemporary);
+
+ unsigned NumTemporaries = ExprTemporaries.size() - FirstTemporary;
+ CXXTemporary **Temporaries =
+ NumTemporaries == 0 ? 0 : &ExprTemporaries[FirstTemporary];
+
+ FullExpr E = FullExpr::Create(Context, SubExpr, Temporaries, NumTemporaries);
+
ExprTemporaries.erase(ExprTemporaries.begin() + FirstTemporary,
ExprTemporaries.end());
@@ -2243,9 +2301,7 @@ Sema::OwningExprResult Sema::BuildCXXCastArgument(SourceLocation CastLoc,
Sema::OwningExprResult Sema::ActOnFinishFullExpr(ExprArg Arg) {
Expr *FullExpr = Arg.takeAs<Expr>();
if (FullExpr)
- FullExpr = MaybeCreateCXXExprWithTemporaries(FullExpr,
- /*ShouldDestroyTemps=*/true);
-
+ FullExpr = MaybeCreateCXXExprWithTemporaries(FullExpr);
return Owned(FullExpr);
}
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index b78c10b0dd80..2e31e4764536 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -205,7 +205,7 @@ bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs,
IsError |=
DiagnoseAssignmentResult(Result, argExpr->getLocStart(), lhsType, rhsType,
- argExpr, "sending");
+ argExpr, AA_Sending);
}
// Promote additional arguments to variadic methods.
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 45184650eb7e..3ef51561ffe2 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -16,11 +16,13 @@
//===----------------------------------------------------------------------===//
#include "SemaInit.h"
+#include "Lookup.h"
#include "Sema.h"
#include "clang/Parse/Designator.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
+#include "clang/AST/TypeLoc.h"
#include "llvm/Support/ErrorHandling.h"
#include <map>
using namespace clang;
@@ -73,7 +75,7 @@ static bool CheckSingleInitializer(Expr *&Init, QualType DeclType,
if (S.getLangOptions().CPlusPlus) {
// FIXME: I dislike this error message. A lot.
if (S.PerformImplicitConversion(Init, DeclType,
- "initializing", DirectInit)) {
+ Sema::AA_Initializing, DirectInit)) {
ImplicitConversionSequence ICS;
OverloadCandidateSet CandidateSet;
if (S.IsUserDefinedConversion(Init, DeclType, ICS.UserDefined,
@@ -81,7 +83,7 @@ static bool CheckSingleInitializer(Expr *&Init, QualType DeclType,
true, false, false) != OR_Ambiguous)
return S.Diag(Init->getSourceRange().getBegin(),
diag::err_typecheck_convert_incompatible)
- << DeclType << Init->getType() << "initializing"
+ << DeclType << Init->getType() << Sema::AA_Initializing
<< Init->getSourceRange();
S.Diag(Init->getSourceRange().getBegin(),
diag::err_typecheck_convert_ambiguous)
@@ -95,7 +97,7 @@ static bool CheckSingleInitializer(Expr *&Init, QualType DeclType,
Sema::AssignConvertType ConvTy =
S.CheckSingleAssignmentConstraints(DeclType, Init);
return S.DiagnoseAssignmentResult(ConvTy, Init->getLocStart(), DeclType,
- InitType, Init, "initializing");
+ InitType, Init, Sema::AA_Initializing);
}
static void CheckStringInit(Expr *Str, QualType &DeclT, Sema &S) {
@@ -134,172 +136,6 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, Sema &S) {
Str->setType(DeclT);
}
-bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
- SourceLocation InitLoc,
- DeclarationName InitEntity, bool DirectInit) {
- if (DeclType->isDependentType() ||
- Init->isTypeDependent() || Init->isValueDependent()) {
- // We have either a dependent type or a type- or value-dependent
- // initializer, so we don't perform any additional checking at
- // this point.
-
- // If the declaration is a non-dependent, incomplete array type
- // that has an initializer, then its type will be completed once
- // the initializer is instantiated.
- if (!DeclType->isDependentType()) {
- if (const IncompleteArrayType *ArrayT
- = Context.getAsIncompleteArrayType(DeclType)) {
- if (InitListExpr *ILE = dyn_cast<InitListExpr>(Init)) {
- if (!ILE->isTypeDependent()) {
- // Compute the constant array type from the length of the
- // initializer list.
- // FIXME: This will be wrong if there are designated
- // initializations. Good thing they don't exist in C++!
- llvm::APInt NumElements(Context.getTypeSize(Context.getSizeType()),
- ILE->getNumInits());
- llvm::APInt Zero(Context.getTypeSize(Context.getSizeType()), 0);
- if (NumElements == Zero) {
- // Sizing an array implicitly to zero is not allowed by ISO C,
- // but is supported by GNU.
- Diag(ILE->getLocStart(), diag::ext_typecheck_zero_array_size);
- }
-
- DeclType = Context.getConstantArrayType(ArrayT->getElementType(),
- NumElements,
- ArrayT->getSizeModifier(),
- ArrayT->getIndexTypeCVRQualifiers());
- return false;
- }
- }
-
- // Make the array type-dependent by making it dependently-sized.
- DeclType = Context.getDependentSizedArrayType(ArrayT->getElementType(),
- /*NumElts=*/0,
- ArrayT->getSizeModifier(),
- ArrayT->getIndexTypeCVRQualifiers(),
- SourceRange());
- }
- }
-
- return false;
- }
-
- // C++ [dcl.init.ref]p1:
- // A variable declared to be a T& or T&&, that is "reference to type T"
- // (8.3.2), shall be initialized by an object, or function, of
- // type T or by an object that can be converted into a T.
- if (DeclType->isReferenceType())
- return CheckReferenceInit(Init, DeclType, InitLoc,
- /*SuppressUserConversions=*/false,
- /*AllowExplicit=*/DirectInit,
- /*ForceRValue=*/false);
-
- // C99 6.7.8p3: The type of the entity to be initialized shall be an array
- // of unknown size ("[]") or an object type that is not a variable array type.
- if (const VariableArrayType *VAT = Context.getAsVariableArrayType(DeclType))
- return Diag(InitLoc, diag::err_variable_object_no_init)
- << VAT->getSizeExpr()->getSourceRange();
-
- InitListExpr *InitList = dyn_cast<InitListExpr>(Init);
- if (!InitList) {
- // FIXME: Handle wide strings
- if (Expr *Str = IsStringInit(Init, DeclType, Context)) {
- CheckStringInit(Str, DeclType, *this);
- return false;
- }
-
- // C++ [dcl.init]p14:
- // -- If the destination type is a (possibly cv-qualified) class
- // type:
- if (getLangOptions().CPlusPlus && DeclType->isRecordType()) {
- QualType DeclTypeC = Context.getCanonicalType(DeclType);
- QualType InitTypeC = Context.getCanonicalType(Init->getType());
-
- // -- If the initialization is direct-initialization, or if it is
- // copy-initialization where the cv-unqualified version of the
- // source type is the same class as, or a derived class of, the
- // class of the destination, constructors are considered.
- if ((DeclTypeC.getLocalUnqualifiedType()
- == InitTypeC.getLocalUnqualifiedType()) ||
- IsDerivedFrom(InitTypeC, DeclTypeC)) {
- const CXXRecordDecl *RD =
- cast<CXXRecordDecl>(DeclType->getAs<RecordType>()->getDecl());
-
- // No need to make a CXXConstructExpr if both the ctor and dtor are
- // trivial.
- if (RD->hasTrivialConstructor() && RD->hasTrivialDestructor())
- return false;
-
- ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this);
-
- // FIXME: Poor location information
- InitializationKind InitKind
- = InitializationKind::CreateCopy(Init->getLocStart(),
- SourceLocation());
- if (DirectInit)
- InitKind = InitializationKind::CreateDirect(Init->getLocStart(),
- SourceLocation(),
- SourceLocation());
- CXXConstructorDecl *Constructor
- = PerformInitializationByConstructor(DeclType,
- MultiExprArg(*this,
- (void **)&Init, 1),
- InitLoc, Init->getSourceRange(),
- InitEntity, InitKind,
- ConstructorArgs);
- if (!Constructor)
- return true;
-
- OwningExprResult InitResult =
- BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
- DeclType, Constructor,
- move_arg(ConstructorArgs));
- if (InitResult.isInvalid())
- return true;
-
- Init = InitResult.takeAs<Expr>();
- return false;
- }
-
- // -- Otherwise (i.e., for the remaining copy-initialization
- // cases), user-defined conversion sequences that can
- // convert from the source type to the destination type or
- // (when a conversion function is used) to a derived class
- // thereof are enumerated as described in 13.3.1.4, and the
- // best one is chosen through overload resolution
- // (13.3). If the conversion cannot be done or is
- // ambiguous, the initialization is ill-formed. The
- // function selected is called with the initializer
- // expression as its argument; if the function is a
- // constructor, the call initializes a temporary of the
- // destination type.
- // FIXME: We're pretending to do copy elision here; return to this when we
- // have ASTs for such things.
- if (!PerformImplicitConversion(Init, DeclType, "initializing"))
- return false;
-
- if (InitEntity)
- return Diag(InitLoc, diag::err_cannot_initialize_decl)
- << InitEntity << (int)(Init->isLvalue(Context) == Expr::LV_Valid)
- << Init->getType() << Init->getSourceRange();
- return Diag(InitLoc, diag::err_cannot_initialize_decl_noname)
- << DeclType << (int)(Init->isLvalue(Context) == Expr::LV_Valid)
- << Init->getType() << Init->getSourceRange();
- }
-
- // C99 6.7.8p16.
- if (DeclType->isArrayType())
- return Diag(Init->getLocStart(), diag::err_array_init_list_required)
- << Init->getSourceRange();
-
- return CheckSingleInitializer(Init, DeclType, DirectInit, *this);
- }
-
- bool hadError = CheckInitList(InitList, DeclType);
- Init = InitList;
- return hadError;
-}
-
//===----------------------------------------------------------------------===//
// Semantic checking for initializer lists.
//===----------------------------------------------------------------------===//
@@ -399,9 +235,14 @@ class InitListChecker {
int numArrayElements(QualType DeclType);
int numStructUnionElements(QualType DeclType);
- void FillInValueInitializations(InitListExpr *ILE);
+ void FillInValueInitForField(unsigned Init, FieldDecl *Field,
+ const InitializedEntity &ParentEntity,
+ InitListExpr *ILE, bool &RequiresSecondPass);
+ void FillInValueInitializations(const InitializedEntity &Entity,
+ InitListExpr *ILE, bool &RequiresSecondPass);
public:
- InitListChecker(Sema &S, InitListExpr *IL, QualType &T);
+ InitListChecker(Sema &S, const InitializedEntity &Entity,
+ InitListExpr *IL, QualType &T);
bool HadError() { return hadError; }
// @brief Retrieves the fully-structured initializer list used for
@@ -410,10 +251,75 @@ public:
};
} // end anonymous namespace
+void InitListChecker::FillInValueInitForField(unsigned Init, FieldDecl *Field,
+ const InitializedEntity &ParentEntity,
+ InitListExpr *ILE,
+ bool &RequiresSecondPass) {
+ SourceLocation Loc = ILE->getSourceRange().getBegin();
+ unsigned NumInits = ILE->getNumInits();
+ InitializedEntity MemberEntity
+ = InitializedEntity::InitializeMember(Field, &ParentEntity);
+ if (Init >= NumInits || !ILE->getInit(Init)) {
+ // FIXME: We probably don't need to handle references
+ // specially here, since value-initialization of references is
+ // handled in InitializationSequence.
+ if (Field->getType()->isReferenceType()) {
+ // C++ [dcl.init.aggr]p9:
+ // If an incomplete or empty initializer-list leaves a
+ // member of reference type uninitialized, the program is
+ // ill-formed.
+ SemaRef.Diag(Loc, diag::err_init_reference_member_uninitialized)
+ << Field->getType()
+ << ILE->getSyntacticForm()->getSourceRange();
+ SemaRef.Diag(Field->getLocation(),
+ diag::note_uninit_reference_member);
+ hadError = true;
+ return;
+ }
+
+ InitializationKind Kind = InitializationKind::CreateValue(Loc, Loc, Loc,
+ true);
+ InitializationSequence InitSeq(SemaRef, MemberEntity, Kind, 0, 0);
+ if (!InitSeq) {
+ InitSeq.Diagnose(SemaRef, MemberEntity, Kind, 0, 0);
+ hadError = true;
+ return;
+ }
+
+ Sema::OwningExprResult MemberInit
+ = InitSeq.Perform(SemaRef, MemberEntity, Kind,
+ Sema::MultiExprArg(SemaRef, 0, 0));
+ if (MemberInit.isInvalid()) {
+ hadError = true;
+ return;
+ }
+
+ if (hadError) {
+ // Do nothing
+ } else if (Init < NumInits) {
+ ILE->setInit(Init, MemberInit.takeAs<Expr>());
+ } else if (InitSeq.getKind()
+ == InitializationSequence::ConstructorInitialization) {
+ // Value-initialization requires a constructor call, so
+ // extend the initializer list to include the constructor
+ // call and make a note that we'll need to take another pass
+ // through the initializer list.
+ ILE->updateInit(Init, MemberInit.takeAs<Expr>());
+ RequiresSecondPass = true;
+ }
+ } else if (InitListExpr *InnerILE
+ = dyn_cast<InitListExpr>(ILE->getInit(Init)))
+ FillInValueInitializations(MemberEntity, InnerILE,
+ RequiresSecondPass);
+}
+
/// Recursively replaces NULL values within the given initializer list
/// with expressions that perform value-initialization of the
/// appropriate type.
-void InitListChecker::FillInValueInitializations(InitListExpr *ILE) {
+void
+InitListChecker::FillInValueInitializations(const InitializedEntity &Entity,
+ InitListExpr *ILE,
+ bool &RequiresSecondPass) {
assert((ILE->getType() != SemaRef.Context.VoidTy) &&
"Should not have void type");
SourceLocation Loc = ILE->getSourceRange().getBegin();
@@ -421,46 +327,32 @@ void InitListChecker::FillInValueInitializations(InitListExpr *ILE) {
Loc = ILE->getSyntacticForm()->getSourceRange().getBegin();
if (const RecordType *RType = ILE->getType()->getAs<RecordType>()) {
- unsigned Init = 0, NumInits = ILE->getNumInits();
- for (RecordDecl::field_iterator
- Field = RType->getDecl()->field_begin(),
- FieldEnd = RType->getDecl()->field_end();
- Field != FieldEnd; ++Field) {
- if (Field->isUnnamedBitfield())
- continue;
-
- if (Init >= NumInits || !ILE->getInit(Init)) {
- if (Field->getType()->isReferenceType()) {
- // C++ [dcl.init.aggr]p9:
- // If an incomplete or empty initializer-list leaves a
- // member of reference type uninitialized, the program is
- // ill-formed.
- SemaRef.Diag(Loc, diag::err_init_reference_member_uninitialized)
- << Field->getType()
- << ILE->getSyntacticForm()->getSourceRange();
- SemaRef.Diag(Field->getLocation(),
- diag::note_uninit_reference_member);
- hadError = true;
+ if (RType->getDecl()->isUnion() &&
+ ILE->getInitializedFieldInUnion())
+ FillInValueInitForField(0, ILE->getInitializedFieldInUnion(),
+ Entity, ILE, RequiresSecondPass);
+ else {
+ unsigned Init = 0;
+ for (RecordDecl::field_iterator
+ Field = RType->getDecl()->field_begin(),
+ FieldEnd = RType->getDecl()->field_end();
+ Field != FieldEnd; ++Field) {
+ if (Field->isUnnamedBitfield())
+ continue;
+
+ if (hadError)
return;
- } else if (SemaRef.CheckValueInitialization(Field->getType(), Loc)) {
- hadError = true;
+
+ FillInValueInitForField(Init, *Field, Entity, ILE, RequiresSecondPass);
+ if (hadError)
return;
- }
- // FIXME: If value-initialization involves calling a constructor, should
- // we make that call explicit in the representation (even when it means
- // extending the initializer list)?
- if (Init < NumInits && !hadError)
- ILE->setInit(Init,
- new (SemaRef.Context) ImplicitValueInitExpr(Field->getType()));
- } else if (InitListExpr *InnerILE
- = dyn_cast<InitListExpr>(ILE->getInit(Init)))
- FillInValueInitializations(InnerILE);
- ++Init;
+ ++Init;
- // Only look at the first initialization of a union.
- if (RType->getDecl()->isUnion())
- break;
+ // Only look at the first initialization of a union.
+ if (RType->getDecl()->isUnion())
+ break;
+ }
}
return;
@@ -468,39 +360,71 @@ void InitListChecker::FillInValueInitializations(InitListExpr *ILE) {
QualType ElementType;
+ InitializedEntity ElementEntity = Entity;
unsigned NumInits = ILE->getNumInits();
unsigned NumElements = NumInits;
if (const ArrayType *AType = SemaRef.Context.getAsArrayType(ILE->getType())) {
ElementType = AType->getElementType();
if (const ConstantArrayType *CAType = dyn_cast<ConstantArrayType>(AType))
NumElements = CAType->getSize().getZExtValue();
+ ElementEntity = InitializedEntity::InitializeElement(SemaRef.Context,
+ 0, Entity);
} else if (const VectorType *VType = ILE->getType()->getAs<VectorType>()) {
ElementType = VType->getElementType();
NumElements = VType->getNumElements();
+ ElementEntity = InitializedEntity::InitializeElement(SemaRef.Context,
+ 0, Entity);
} else
ElementType = ILE->getType();
+
for (unsigned Init = 0; Init != NumElements; ++Init) {
+ if (hadError)
+ return;
+
+ if (ElementEntity.getKind() == InitializedEntity::EK_ArrayOrVectorElement)
+ ElementEntity.setElementIndex(Init);
+
if (Init >= NumInits || !ILE->getInit(Init)) {
- if (SemaRef.CheckValueInitialization(ElementType, Loc)) {
+ InitializationKind Kind = InitializationKind::CreateValue(Loc, Loc, Loc,
+ true);
+ InitializationSequence InitSeq(SemaRef, ElementEntity, Kind, 0, 0);
+ if (!InitSeq) {
+ InitSeq.Diagnose(SemaRef, ElementEntity, Kind, 0, 0);
hadError = true;
return;
}
- // FIXME: If value-initialization involves calling a constructor, should
- // we make that call explicit in the representation (even when it means
- // extending the initializer list)?
- if (Init < NumInits && !hadError)
- ILE->setInit(Init,
- new (SemaRef.Context) ImplicitValueInitExpr(ElementType));
+ Sema::OwningExprResult ElementInit
+ = InitSeq.Perform(SemaRef, ElementEntity, Kind,
+ Sema::MultiExprArg(SemaRef, 0, 0));
+ if (ElementInit.isInvalid()) {
+ hadError = true;
+ return;
+ }
+
+ if (hadError) {
+ // Do nothing
+ } else if (Init < NumInits) {
+ ILE->setInit(Init, ElementInit.takeAs<Expr>());
+ } else if (InitSeq.getKind()
+ == InitializationSequence::ConstructorInitialization) {
+ // Value-initialization requires a constructor call, so
+ // extend the initializer list to include the constructor
+ // call and make a note that we'll need to take another pass
+ // through the initializer list.
+ ILE->updateInit(Init, ElementInit.takeAs<Expr>());
+ RequiresSecondPass = true;
+ }
} else if (InitListExpr *InnerILE
- = dyn_cast<InitListExpr>(ILE->getInit(Init)))
- FillInValueInitializations(InnerILE);
+ = dyn_cast<InitListExpr>(ILE->getInit(Init)))
+ FillInValueInitializations(ElementEntity, InnerILE, RequiresSecondPass);
}
}
-InitListChecker::InitListChecker(Sema &S, InitListExpr *IL, QualType &T)
+InitListChecker::InitListChecker(Sema &S, const InitializedEntity &Entity,
+ InitListExpr *IL, QualType &T)
: SemaRef(S) {
hadError = false;
@@ -511,8 +435,13 @@ InitListChecker::InitListChecker(Sema &S, InitListExpr *IL, QualType &T)
CheckExplicitInitList(IL, T, newIndex, FullyStructuredList, newStructuredIndex,
/*TopLevelObject=*/true);
- if (!hadError)
- FillInValueInitializations(FullyStructuredList);
+ if (!hadError) {
+ bool RequiresSecondPass = false;
+ FillInValueInitializations(Entity, FullyStructuredList, RequiresSecondPass);
+ if (RequiresSecondPass && !hadError)
+ FillInValueInitializations(Entity, FullyStructuredList,
+ RequiresSecondPass);
+ }
}
int InitListChecker::numArrayElements(QualType DeclType) {
@@ -743,7 +672,7 @@ void InitListChecker::CheckSubElementType(InitListExpr *IList,
if (ICS.ConversionKind != ImplicitConversionSequence::BadConversion) {
if (SemaRef.PerformImplicitConversion(expr, ElemType, ICS,
- "initializing"))
+ Sema::AA_Initializing))
hadError = true;
UpdateStructuredListElement(StructuredList, StructuredIndex, expr);
++Index;
@@ -783,7 +712,7 @@ void InitListChecker::CheckSubElementType(InitListExpr *IList,
} else {
// We cannot initialize this element, so let
// PerformCopyInitialization produce the appropriate diagnostic.
- SemaRef.PerformCopyInitialization(expr, ElemType, "initializing");
+ SemaRef.PerformCopyInitialization(expr, ElemType, Sema::AA_Initializing);
hadError = true;
++Index;
++StructuredIndex;
@@ -1358,22 +1287,33 @@ InitListChecker::CheckDesignatedInitializer(InitListExpr *IList,
// may find nothing, or may find a member of an anonymous
// struct/union.
DeclContext::lookup_result Lookup = RT->getDecl()->lookup(FieldName);
+ FieldDecl *ReplacementField = 0;
if (Lookup.first == Lookup.second) {
- // Name lookup didn't find anything.
- SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_unknown)
- << FieldName << CurrentObjectType;
- ++Index;
- return true;
- } else if (!KnownField && isa<FieldDecl>(*Lookup.first) &&
- cast<RecordDecl>((*Lookup.first)->getDeclContext())
- ->isAnonymousStructOrUnion()) {
- // Handle an field designator that refers to a member of an
- // anonymous struct or union.
- ExpandAnonymousFieldDesignator(SemaRef, DIE, DesigIdx,
- cast<FieldDecl>(*Lookup.first),
- Field, FieldIndex);
- D = DIE->getDesignator(DesigIdx);
- } else {
+ // Name lookup didn't find anything. Determine whether this
+ // was a typo for another field name.
+ LookupResult R(SemaRef, FieldName, D->getFieldLoc(),
+ Sema::LookupMemberName);
+ if (SemaRef.CorrectTypo(R, /*Scope=*/0, /*SS=*/0, RT->getDecl()) &&
+ (ReplacementField = R.getAsSingle<FieldDecl>()) &&
+ ReplacementField->getDeclContext()->getLookupContext()
+ ->Equals(RT->getDecl())) {
+ SemaRef.Diag(D->getFieldLoc(),
+ diag::err_field_designator_unknown_suggest)
+ << FieldName << CurrentObjectType << R.getLookupName()
+ << CodeModificationHint::CreateReplacement(D->getFieldLoc(),
+ R.getLookupName().getAsString());
+ } else {
+ SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_unknown)
+ << FieldName << CurrentObjectType;
+ ++Index;
+ return true;
+ }
+ } else if (!KnownField) {
+ // Determine whether we found a field at all.
+ ReplacementField = dyn_cast<FieldDecl>(*Lookup.first);
+ }
+
+ if (!ReplacementField) {
// Name lookup found something, but it wasn't a field.
SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_nonfield)
<< FieldName;
@@ -1382,6 +1322,32 @@ InitListChecker::CheckDesignatedInitializer(InitListExpr *IList,
++Index;
return true;
}
+
+ if (!KnownField &&
+ cast<RecordDecl>((ReplacementField)->getDeclContext())
+ ->isAnonymousStructOrUnion()) {
+ // Handle an field designator that refers to a member of an
+ // anonymous struct or union.
+ ExpandAnonymousFieldDesignator(SemaRef, DIE, DesigIdx,
+ ReplacementField,
+ Field, FieldIndex);
+ D = DIE->getDesignator(DesigIdx);
+ } else if (!KnownField) {
+ // The replacement field comes from typo correction; find it
+ // in the list of fields.
+ FieldIndex = 0;
+ Field = RT->getDecl()->field_begin();
+ for (; Field != FieldEnd; ++Field) {
+ if (Field->isUnnamedBitfield())
+ continue;
+
+ if (ReplacementField == *Field ||
+ Field->getIdentifier() == ReplacementField->getIdentifier())
+ break;
+
+ ++FieldIndex;
+ }
+ }
} else if (!KnownField &&
cast<RecordDecl>((*Field)->getDeclContext())
->isAnonymousStructOrUnion()) {
@@ -1844,101 +1810,27 @@ Sema::OwningExprResult Sema::ActOnDesignatedInitializer(Designation &Desig,
return Owned(DIE);
}
-bool Sema::CheckInitList(InitListExpr *&InitList, QualType &DeclType) {
- InitListChecker CheckInitList(*this, InitList, DeclType);
+bool Sema::CheckInitList(const InitializedEntity &Entity,
+ InitListExpr *&InitList, QualType &DeclType) {
+ InitListChecker CheckInitList(*this, Entity, InitList, DeclType);
if (!CheckInitList.HadError())
InitList = CheckInitList.getFullyStructuredList();
return CheckInitList.HadError();
}
-/// \brief Diagnose any semantic errors with value-initialization of
-/// the given type.
-///
-/// Value-initialization effectively zero-initializes any types
-/// without user-declared constructors, and calls the default
-/// constructor for a for any type that has a user-declared
-/// constructor (C++ [dcl.init]p5). Value-initialization can fail when
-/// a type with a user-declared constructor does not have an
-/// accessible, non-deleted default constructor. In C, everything can
-/// be value-initialized, which corresponds to C's notion of
-/// initializing objects with static storage duration when no
-/// initializer is provided for that object.
-///
-/// \returns true if there was an error, false otherwise.
-bool Sema::CheckValueInitialization(QualType Type, SourceLocation Loc) {
- // C++ [dcl.init]p5:
- //
- // To value-initialize an object of type T means:
-
- // -- if T is an array type, then each element is value-initialized;
- if (const ArrayType *AT = Context.getAsArrayType(Type))
- return CheckValueInitialization(AT->getElementType(), Loc);
-
- if (const RecordType *RT = Type->getAs<RecordType>()) {
- if (CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
- // -- if T is a class type (clause 9) with a user-declared
- // constructor (12.1), then the default constructor for T is
- // called (and the initialization is ill-formed if T has no
- // accessible default constructor);
- if (ClassDecl->hasUserDeclaredConstructor()) {
- ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this);
-
- // FIXME: Poor location information
- CXXConstructorDecl *Constructor
- = PerformInitializationByConstructor(Type,
- MultiExprArg(*this, 0, 0),
- Loc, SourceRange(Loc),
- DeclarationName(),
- InitializationKind::CreateValue(Loc, Loc, Loc),
- ConstructorArgs);
- if (!Constructor)
- return true;
-
- OwningExprResult Init
- = BuildCXXConstructExpr(Loc, Type, Constructor,
- move_arg(ConstructorArgs));
- if (Init.isInvalid())
- return true;
-
- // FIXME: Actually perform the value-initialization!
- return false;
- }
- }
- }
-
- if (Type->isReferenceType()) {
- // C++ [dcl.init]p5:
- // [...] A program that calls for default-initialization or
- // value-initialization of an entity of reference type is
- // ill-formed. [...]
- // FIXME: Once we have code that goes through this path, add an actual
- // diagnostic :)
- }
-
- return false;
-}
-
//===----------------------------------------------------------------------===//
// Initialization entity
//===----------------------------------------------------------------------===//
-void InitializedEntity::InitDeclLoc() {
- assert((Kind == EK_Variable || Kind == EK_Parameter || Kind == EK_Member) &&
- "InitDeclLoc cannot be used with non-declaration entities.");
-
- if (TypeSourceInfo *DI = VariableOrMember->getTypeSourceInfo()) {
- TL = DI->getTypeLoc();
- return;
- }
-
- // FIXME: Once we've gone through the effort to create the fake
- // TypeSourceInfo, should we cache it in the declaration?
- // (If not, we "leak" it).
- TypeSourceInfo *DI = VariableOrMember->getASTContext()
- .CreateTypeSourceInfo(VariableOrMember->getType());
- DI->getTypeLoc().initialize(VariableOrMember->getLocation());
- TL = DI->getTypeLoc();
+InitializedEntity::InitializedEntity(ASTContext &Context, unsigned Index,
+ const InitializedEntity &Parent)
+ : Kind(EK_ArrayOrVectorElement), Parent(&Parent), Index(Index)
+{
+ if (const ArrayType *AT = Context.getAsArrayType(Parent.getType()))
+ Type = AT->getElementType();
+ else
+ Type = Parent.getType()->getAs<VectorType>()->getElementType();
}
InitializedEntity InitializedEntity::InitializeBase(ASTContext &Context,
@@ -1947,13 +1839,54 @@ InitializedEntity InitializedEntity::InitializeBase(ASTContext &Context,
InitializedEntity Result;
Result.Kind = EK_Base;
Result.Base = Base;
- // FIXME: CXXBaseSpecifier should store a TypeLoc.
- TypeSourceInfo *DI = Context.CreateTypeSourceInfo(Base->getType());
- DI->getTypeLoc().initialize(Base->getSourceRange().getBegin());
- Result.TL = DI->getTypeLoc();
+ Result.Type = Base->getType();
return Result;
}
+DeclarationName InitializedEntity::getName() const {
+ switch (getKind()) {
+ case EK_Parameter:
+ if (!VariableOrMember)
+ return DeclarationName();
+ // Fall through
+
+ case EK_Variable:
+ case EK_Member:
+ return VariableOrMember->getDeclName();
+
+ case EK_Result:
+ case EK_Exception:
+ case EK_New:
+ case EK_Temporary:
+ case EK_Base:
+ case EK_ArrayOrVectorElement:
+ return DeclarationName();
+ }
+
+ // Silence GCC warning
+ return DeclarationName();
+}
+
+DeclaratorDecl *InitializedEntity::getDecl() const {
+ switch (getKind()) {
+ case EK_Variable:
+ case EK_Parameter:
+ case EK_Member:
+ return VariableOrMember;
+
+ case EK_Result:
+ case EK_Exception:
+ case EK_New:
+ case EK_Temporary:
+ case EK_Base:
+ case EK_ArrayOrVectorElement:
+ return 0;
+ }
+
+ // Silence GCC warning
+ return 0;
+}
+
//===----------------------------------------------------------------------===//
// Initialization sequence
//===----------------------------------------------------------------------===//
@@ -1971,6 +1904,8 @@ void InitializationSequence::Step::Destroy() {
case SK_ListInitialization:
case SK_ConstructorInitialization:
case SK_ZeroInitialization:
+ case SK_CAssignment:
+ case SK_StringInit:
break;
case SK_ConversionSequence:
@@ -2056,6 +1991,20 @@ void InitializationSequence::AddZeroInitializationStep(QualType T) {
Steps.push_back(S);
}
+void InitializationSequence::AddCAssignmentStep(QualType T) {
+ Step S;
+ S.Kind = SK_CAssignment;
+ S.Type = T;
+ Steps.push_back(S);
+}
+
+void InitializationSequence::AddStringInitStep(QualType T) {
+ Step S;
+ S.Kind = SK_StringInit;
+ S.Type = T;
+ Steps.push_back(S);
+}
+
void InitializationSequence::SetOverloadFailure(FailureKind Failure,
OverloadingResult Result) {
SequenceKind = FailedSequence;
@@ -2081,7 +2030,7 @@ static void TryListInitialization(Sema &S,
// force us to perform more checking here.
Sequence.setSequenceKind(InitializationSequence::ListInitialization);
- QualType DestType = Entity.getType().getType();
+ QualType DestType = Entity.getType();
// C++ [dcl.init]p13:
// If T is a scalar type, then a declaration of the form
@@ -2125,7 +2074,7 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S,
Expr *Initializer,
bool AllowRValues,
InitializationSequence &Sequence) {
- QualType DestType = Entity.getType().getType();
+ QualType DestType = Entity.getType();
QualType cv1T1 = DestType->getAs<ReferenceType>()->getPointeeType();
QualType T1 = cv1T1.getUnqualifiedType();
QualType cv2T2 = Initializer->getType();
@@ -2273,7 +2222,7 @@ static void TryReferenceInitialization(Sema &S,
InitializationSequence &Sequence) {
Sequence.setSequenceKind(InitializationSequence::ReferenceBinding);
- QualType DestType = Entity.getType().getType();
+ QualType DestType = Entity.getType();
QualType cv1T1 = DestType->getAs<ReferenceType>()->getPointeeType();
QualType T1 = cv1T1.getUnqualifiedType();
QualType cv2T2 = Initializer->getType();
@@ -2437,7 +2386,12 @@ static void TryReferenceInitialization(Sema &S,
// this into an overloading ambiguity diagnostic. However, we need
// to keep that set as an OverloadCandidateSet rather than as some
// other kind of set.
- Sequence.SetFailed(InitializationSequence::FK_ReferenceInitFailed);
+ if (ConvOvlResult && !Sequence.getFailedCandidateSet().empty())
+ Sequence.SetOverloadFailure(
+ InitializationSequence::FK_ReferenceInitOverloadFailed,
+ ConvOvlResult);
+ else
+ Sequence.SetFailed(InitializationSequence::FK_ReferenceInitFailed);
return;
}
@@ -2463,7 +2417,8 @@ static void TryStringLiteralInitialization(Sema &S,
const InitializationKind &Kind,
Expr *Initializer,
InitializationSequence &Sequence) {
- // FIXME: Implement!
+ Sequence.setSequenceKind(InitializationSequence::StringInit);
+ Sequence.AddStringInitStep(Entity.getType());
}
/// \brief Attempt initialization by constructor (C++ [dcl.init]), which
@@ -2475,7 +2430,10 @@ static void TryConstructorInitialization(Sema &S,
Expr **Args, unsigned NumArgs,
QualType DestType,
InitializationSequence &Sequence) {
- Sequence.setSequenceKind(InitializationSequence::ConstructorInitialization);
+ if (Kind.getKind() == InitializationKind::IK_Copy)
+ Sequence.setSequenceKind(InitializationSequence::UserDefinedConversion);
+ else
+ Sequence.setSequenceKind(InitializationSequence::ConstructorInitialization);
// Build the candidate set directly in the initialization sequence
// structure, so that it will persist if we fail.
@@ -2512,7 +2470,7 @@ static void TryConstructorInitialization(Sema &S,
Constructor = cast<CXXConstructorDecl>(*Con);
if (!Constructor->isInvalidDecl() &&
- Constructor->isConvertingConstructor(AllowExplicit)) {
+ (AllowExplicit || !Constructor->isExplicit())) {
if (ConstructorTmpl)
S.AddTemplateOverloadCandidate(ConstructorTmpl, /*ExplicitArgs*/ 0,
Args, NumArgs, CandidateSet);
@@ -2535,9 +2493,13 @@ static void TryConstructorInitialization(Sema &S,
// Add the constructor initialization step. Any cv-qualification conversion is
// subsumed by the initialization.
- Sequence.AddConstructorInitializationStep(
+ if (Kind.getKind() == InitializationKind::IK_Copy) {
+ Sequence.AddUserConversionStep(Best->Function, DestType);
+ } else {
+ Sequence.AddConstructorInitializationStep(
cast<CXXConstructorDecl>(Best->Function),
- DestType);
+ DestType);
+ }
}
/// \brief Attempt value initialization (C++ [dcl.init]p7).
@@ -2548,7 +2510,7 @@ static void TryValueInitialization(Sema &S,
// C++ [dcl.init]p5:
//
// To value-initialize an object of type T means:
- QualType T = Entity.getType().getType();
+ QualType T = Entity.getType();
// -- if T is an array type, then each element is value-initialized;
while (const ArrayType *AT = S.Context.getAsArrayType(T))
@@ -2566,15 +2528,58 @@ static void TryValueInitialization(Sema &S,
if (ClassDecl->hasUserDeclaredConstructor())
return TryConstructorInitialization(S, Entity, Kind, 0, 0, T, Sequence);
- // FIXME: non-union class type w/ non-trivial default constructor gets
- // zero-initialized, then constructor gets called.
+ // -- if T is a (possibly cv-qualified) non-union class type
+ // without a user-provided constructor, then the object is
+ // zero-initialized and, if T’s implicitly-declared default
+ // constructor is non-trivial, that constructor is called.
+ if ((ClassDecl->getTagKind() == TagDecl::TK_class ||
+ ClassDecl->getTagKind() == TagDecl::TK_struct) &&
+ !ClassDecl->hasTrivialConstructor()) {
+ Sequence.AddZeroInitializationStep(Entity.getType());
+ return TryConstructorInitialization(S, Entity, Kind, 0, 0, T, Sequence);
+ }
}
}
- Sequence.AddZeroInitializationStep(Entity.getType().getType());
+ Sequence.AddZeroInitializationStep(Entity.getType());
Sequence.setSequenceKind(InitializationSequence::ZeroInitialization);
}
+/// \brief Attempt default initialization (C++ [dcl.init]p6).
+static void TryDefaultInitialization(Sema &S,
+ const InitializedEntity &Entity,
+ const InitializationKind &Kind,
+ InitializationSequence &Sequence) {
+ assert(Kind.getKind() == InitializationKind::IK_Default);
+
+ // C++ [dcl.init]p6:
+ // To default-initialize an object of type T means:
+ // - if T is an array type, each element is default-initialized;
+ QualType DestType = Entity.getType();
+ while (const ArrayType *Array = S.Context.getAsArrayType(DestType))
+ DestType = Array->getElementType();
+
+ // - if T is a (possibly cv-qualified) class type (Clause 9), the default
+ // constructor for T is called (and the initialization is ill-formed if
+ // T has no accessible default constructor);
+ if (DestType->isRecordType()) {
+ // FIXME: If a program calls for the default initialization of an object of
+ // a const-qualified type T, T shall be a class type with a user-provided
+ // default constructor.
+ return TryConstructorInitialization(S, Entity, Kind, 0, 0, DestType,
+ Sequence);
+ }
+
+ // - otherwise, no initialization is performed.
+ Sequence.setSequenceKind(InitializationSequence::NoInitialization);
+
+ // If a program calls for the default initialization of an object of
+ // a const-qualified type T, T shall be a class type with a user-provided
+ // default constructor.
+ if (DestType.isConstQualified())
+ Sequence.SetFailed(InitializationSequence::FK_DefaultInitOfConst);
+}
+
/// \brief Attempt a user-defined conversion between two types (C++ [dcl.init]),
/// which enumerates all conversion functions and performs overload resolution
/// to select the best.
@@ -2585,7 +2590,7 @@ static void TryUserDefinedConversion(Sema &S,
InitializationSequence &Sequence) {
Sequence.setSequenceKind(InitializationSequence::UserDefinedConversion);
- QualType DestType = Entity.getType().getType();
+ QualType DestType = Entity.getType();
assert(!DestType->isReferenceType() && "References are handled elsewhere");
QualType SourceType = Initializer->getType();
assert((DestType->isRecordType() || SourceType->isRecordType()) &&
@@ -2632,43 +2637,49 @@ static void TryUserDefinedConversion(Sema &S,
}
}
}
-
+
+ SourceLocation DeclLoc = Initializer->getLocStart();
+
if (const RecordType *SourceRecordType = SourceType->getAs<RecordType>()) {
// The type we're converting from is a class type, enumerate its conversion
// functions.
- CXXRecordDecl *SourceRecordDecl
- = cast<CXXRecordDecl>(SourceRecordType->getDecl());
-
- const UnresolvedSet *Conversions
- = SourceRecordDecl->getVisibleConversionFunctions();
- for (UnresolvedSet::iterator I = Conversions->begin(),
- E = Conversions->end();
- I != E; ++I) {
- NamedDecl *D = *I;
- CXXRecordDecl *ActingDC = cast<CXXRecordDecl>(D->getDeclContext());
- if (isa<UsingShadowDecl>(D))
- D = cast<UsingShadowDecl>(D)->getTargetDecl();
-
- FunctionTemplateDecl *ConvTemplate = dyn_cast<FunctionTemplateDecl>(D);
- CXXConversionDecl *Conv;
- if (ConvTemplate)
- Conv = cast<CXXConversionDecl>(ConvTemplate->getTemplatedDecl());
- else
- Conv = cast<CXXConversionDecl>(*I);
+
+ // We can only enumerate the conversion functions for a complete type; if
+ // the type isn't complete, simply skip this step.
+ if (!S.RequireCompleteType(DeclLoc, SourceType, 0)) {
+ CXXRecordDecl *SourceRecordDecl
+ = cast<CXXRecordDecl>(SourceRecordType->getDecl());
- if (AllowExplicit || !Conv->isExplicit()) {
+ const UnresolvedSet *Conversions
+ = SourceRecordDecl->getVisibleConversionFunctions();
+ for (UnresolvedSet::iterator I = Conversions->begin(),
+ E = Conversions->end();
+ I != E; ++I) {
+ NamedDecl *D = *I;
+ CXXRecordDecl *ActingDC = cast<CXXRecordDecl>(D->getDeclContext());
+ if (isa<UsingShadowDecl>(D))
+ D = cast<UsingShadowDecl>(D)->getTargetDecl();
+
+ FunctionTemplateDecl *ConvTemplate = dyn_cast<FunctionTemplateDecl>(D);
+ CXXConversionDecl *Conv;
if (ConvTemplate)
- S.AddTemplateConversionCandidate(ConvTemplate, ActingDC, Initializer,
- DestType, CandidateSet);
+ Conv = cast<CXXConversionDecl>(ConvTemplate->getTemplatedDecl());
else
- S.AddConversionCandidate(Conv, ActingDC, Initializer, DestType,
- CandidateSet);
+ Conv = cast<CXXConversionDecl>(*I);
+
+ if (AllowExplicit || !Conv->isExplicit()) {
+ if (ConvTemplate)
+ S.AddTemplateConversionCandidate(ConvTemplate, ActingDC,
+ Initializer, DestType,
+ CandidateSet);
+ else
+ S.AddConversionCandidate(Conv, ActingDC, Initializer, DestType,
+ CandidateSet);
+ }
}
}
}
- SourceLocation DeclLoc = Initializer->getLocStart();
-
// Perform overload resolution. If it fails, return the failed result.
OverloadCandidateSet::iterator Best;
if (OverloadingResult Result
@@ -2711,7 +2722,7 @@ static void TryImplicitConversion(Sema &S,
Expr *Initializer,
InitializationSequence &Sequence) {
ImplicitConversionSequence ICS
- = S.TryImplicitConversion(Initializer, Entity.getType().getType(),
+ = S.TryImplicitConversion(Initializer, Entity.getType(),
/*SuppressUserConversions=*/true,
/*AllowExplicit=*/false,
/*ForceRValue=*/false,
@@ -2723,7 +2734,7 @@ static void TryImplicitConversion(Sema &S,
return;
}
- Sequence.AddConversionSequenceStep(ICS, Entity.getType().getType());
+ Sequence.AddConversionSequenceStep(ICS, Entity.getType());
}
InitializationSequence::InitializationSequence(Sema &S,
@@ -2739,7 +2750,7 @@ InitializationSequence::InitializationSequence(Sema &S,
// type is the type of the initializer expression. The source type is not
// defined when the initializer is a braced-init-list or when it is a
// parenthesized list of expressions.
- QualType DestType = Entity.getType().getType();
+ QualType DestType = Entity.getType();
if (DestType->isDependentType() ||
Expr::hasAnyTypeDependentArguments(Args, NumArgs)) {
@@ -2749,7 +2760,7 @@ InitializationSequence::InitializationSequence(Sema &S,
QualType SourceType;
Expr *Initializer = 0;
- if (Kind.getKind() == InitializationKind::IK_Copy) {
+ if (NumArgs == 1) {
Initializer = Args[0];
if (!isa<InitListExpr>(Initializer))
SourceType = Initializer->getType();
@@ -2785,11 +2796,18 @@ InitializationSequence::InitializationSequence(Sema &S,
}
// - If the initializer is (), the object is value-initialized.
- if (Kind.getKind() == InitializationKind::IK_Value) {
+ if (Kind.getKind() == InitializationKind::IK_Value ||
+ (Kind.getKind() == InitializationKind::IK_Direct && NumArgs == 0)) {
TryValueInitialization(S, Entity, Kind, *this);
return;
}
+ // Handle default initialization.
+ if (Kind.getKind() == InitializationKind::IK_Default){
+ TryDefaultInitialization(S, Entity, Kind, *this);
+ return;
+ }
+
// - Otherwise, if the destination type is an array, the program is
// ill-formed.
if (const ArrayType *AT = Context.getAsArrayType(DestType)) {
@@ -2800,6 +2818,13 @@ InitializationSequence::InitializationSequence(Sema &S,
return;
}
+
+ // Handle initialization in C
+ if (!S.getLangOptions().CPlusPlus) {
+ setSequenceKind(CAssignment);
+ AddCAssignmentStep(DestType);
+ return;
+ }
// - If the destination type is a (possibly cv-qualified) class type:
if (DestType->isRecordType()) {
@@ -2812,7 +2837,7 @@ InitializationSequence::InitializationSequence(Sema &S,
(Context.hasSameUnqualifiedType(SourceType, DestType) ||
S.IsDerivedFrom(SourceType, DestType))))
TryConstructorInitialization(S, Entity, Kind, Args, NumArgs,
- Entity.getType().getType(), *this);
+ Entity.getType(), *this);
// - Otherwise (i.e., for the remaining copy-initialization cases),
// user-defined conversion sequences that can convert from the source
// type to the destination type or (when a conversion function is
@@ -2824,9 +2849,15 @@ InitializationSequence::InitializationSequence(Sema &S,
return;
}
+ if (NumArgs > 1) {
+ SetFailed(FK_TooManyInitsForScalar);
+ return;
+ }
+ assert(NumArgs == 1 && "Zero-argument case handled above");
+
// - Otherwise, if the source type is a (possibly cv-qualified) class
// type, conversion functions are considered.
- if (SourceType->isRecordType()) {
+ if (!SourceType.isNull() && SourceType->isRecordType()) {
TryUserDefinedConversion(S, Entity, Kind, Initializer, *this);
return;
}
@@ -2836,6 +2867,7 @@ InitializationSequence::InitializationSequence(Sema &S,
// conversions (Clause 4) will be used, if necessary, to convert the
// initializer expression to the cv-unqualified version of the
// destination type; no user-defined conversions are considered.
+ setSequenceKind(StandardConversion);
TryImplicitConversion(S, Entity, Kind, Initializer, *this);
}
@@ -2849,6 +2881,158 @@ InitializationSequence::~InitializationSequence() {
//===----------------------------------------------------------------------===//
// Perform initialization
//===----------------------------------------------------------------------===//
+static Sema::AssignmentAction
+getAssignmentAction(const InitializedEntity &Entity) {
+ switch(Entity.getKind()) {
+ case InitializedEntity::EK_Variable:
+ case InitializedEntity::EK_New:
+ return Sema::AA_Initializing;
+
+ case InitializedEntity::EK_Parameter:
+ // FIXME: Can we tell when we're sending vs. passing?
+ return Sema::AA_Passing;
+
+ case InitializedEntity::EK_Result:
+ return Sema::AA_Returning;
+
+ case InitializedEntity::EK_Exception:
+ case InitializedEntity::EK_Base:
+ llvm_unreachable("No assignment action for C++-specific initialization");
+ break;
+
+ case InitializedEntity::EK_Temporary:
+ // FIXME: Can we tell apart casting vs. converting?
+ return Sema::AA_Casting;
+
+ case InitializedEntity::EK_Member:
+ case InitializedEntity::EK_ArrayOrVectorElement:
+ return Sema::AA_Initializing;
+ }
+
+ return Sema::AA_Converting;
+}
+
+static bool shouldBindAsTemporary(const InitializedEntity &Entity,
+ bool IsCopy) {
+ switch (Entity.getKind()) {
+ case InitializedEntity::EK_Result:
+ case InitializedEntity::EK_Exception:
+ return !IsCopy;
+
+ case InitializedEntity::EK_New:
+ case InitializedEntity::EK_Variable:
+ case InitializedEntity::EK_Base:
+ case InitializedEntity::EK_Member:
+ case InitializedEntity::EK_ArrayOrVectorElement:
+ return false;
+
+ case InitializedEntity::EK_Parameter:
+ case InitializedEntity::EK_Temporary:
+ return true;
+ }
+
+ llvm_unreachable("missed an InitializedEntity kind?");
+}
+
+/// \brief If we need to perform an additional copy of the initialized object
+/// for this kind of entity (e.g., the result of a function or an object being
+/// thrown), make the copy.
+static Sema::OwningExprResult CopyIfRequiredForEntity(Sema &S,
+ const InitializedEntity &Entity,
+ const InitializationKind &Kind,
+ Sema::OwningExprResult CurInit) {
+ SourceLocation Loc;
+
+ switch (Entity.getKind()) {
+ case InitializedEntity::EK_Result:
+ if (Entity.getType()->isReferenceType())
+ return move(CurInit);
+ Loc = Entity.getReturnLoc();
+ break;
+
+ case InitializedEntity::EK_Exception:
+ Loc = Entity.getThrowLoc();
+ break;
+
+ case InitializedEntity::EK_Variable:
+ if (Entity.getType()->isReferenceType() ||
+ Kind.getKind() != InitializationKind::IK_Copy)
+ return move(CurInit);
+ Loc = Entity.getDecl()->getLocation();
+ break;
+
+ case InitializedEntity::EK_Parameter:
+ // FIXME: Do we need this initialization for a parameter?
+ return move(CurInit);
+
+ case InitializedEntity::EK_New:
+ case InitializedEntity::EK_Temporary:
+ case InitializedEntity::EK_Base:
+ case InitializedEntity::EK_Member:
+ case InitializedEntity::EK_ArrayOrVectorElement:
+ // We don't need to copy for any of these initialized entities.
+ return move(CurInit);
+ }
+
+ Expr *CurInitExpr = (Expr *)CurInit.get();
+ CXXRecordDecl *Class = 0;
+ if (const RecordType *Record = CurInitExpr->getType()->getAs<RecordType>())
+ Class = cast<CXXRecordDecl>(Record->getDecl());
+ if (!Class)
+ return move(CurInit);
+
+ // Perform overload resolution using the class's copy constructors.
+ DeclarationName ConstructorName
+ = S.Context.DeclarationNames.getCXXConstructorName(
+ S.Context.getCanonicalType(S.Context.getTypeDeclType(Class)));
+ DeclContext::lookup_iterator Con, ConEnd;
+ OverloadCandidateSet CandidateSet;
+ for (llvm::tie(Con, ConEnd) = Class->lookup(ConstructorName);
+ Con != ConEnd; ++Con) {
+ // Find the constructor (which may be a template).
+ CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(*Con);
+ if (!Constructor || Constructor->isInvalidDecl() ||
+ !Constructor->isCopyConstructor())
+ continue;
+
+ S.AddOverloadCandidate(Constructor, &CurInitExpr, 1, CandidateSet);
+ }
+
+ OverloadCandidateSet::iterator Best;
+ switch (S.BestViableFunction(CandidateSet, Loc, Best)) {
+ case OR_Success:
+ break;
+
+ case OR_No_Viable_Function:
+ S.Diag(Loc, diag::err_temp_copy_no_viable)
+ << (int)Entity.getKind() << CurInitExpr->getType()
+ << CurInitExpr->getSourceRange();
+ S.PrintOverloadCandidates(CandidateSet, false);
+ return S.ExprError();
+
+ case OR_Ambiguous:
+ S.Diag(Loc, diag::err_temp_copy_ambiguous)
+ << (int)Entity.getKind() << CurInitExpr->getType()
+ << CurInitExpr->getSourceRange();
+ S.PrintOverloadCandidates(CandidateSet, true);
+ return S.ExprError();
+
+ case OR_Deleted:
+ S.Diag(Loc, diag::err_temp_copy_deleted)
+ << (int)Entity.getKind() << CurInitExpr->getType()
+ << CurInitExpr->getSourceRange();
+ S.Diag(Best->Function->getLocation(), diag::note_unavailable_here)
+ << Best->Function->isDeleted();
+ return S.ExprError();
+ }
+
+ CurInit.release();
+ return S.BuildCXXConstructExpr(Loc, CurInitExpr->getType(),
+ cast<CXXConstructorDecl>(Best->Function),
+ /*Elidable=*/true,
+ Sema::MultiExprArg(S,
+ (void**)&CurInitExpr, 1));
+}
Action::OwningExprResult
InitializationSequence::Perform(Sema &S,
@@ -2866,9 +3050,9 @@ InitializationSequence::Perform(Sema &S,
// If the declaration is a non-dependent, incomplete array type
// that has an initializer, then its type will be completed once
// the initializer is instantiated.
- if (ResultType && !Entity.getType().getType()->isDependentType() &&
+ if (ResultType && !Entity.getType()->isDependentType() &&
Args.size() == 1) {
- QualType DeclType = Entity.getType().getType();
+ QualType DeclType = Entity.getType();
if (const IncompleteArrayType *ArrayT
= S.Context.getAsIncompleteArrayType(DeclType)) {
// FIXME: We don't currently have the ability to accurately
@@ -2880,11 +3064,15 @@ InitializationSequence::Perform(Sema &S,
// bound.
if (isa<InitListExpr>((Expr *)Args.get()[0])) {
SourceRange Brackets;
+
// Scavange the location of the brackets from the entity, if we can.
- if (isa<IncompleteArrayTypeLoc>(Entity.getType())) {
- IncompleteArrayTypeLoc ArrayLoc
- = cast<IncompleteArrayTypeLoc>(Entity.getType());
- Brackets = ArrayLoc.getBracketsRange();
+ if (DeclaratorDecl *DD = Entity.getDecl()) {
+ if (TypeSourceInfo *TInfo = DD->getTypeSourceInfo()) {
+ TypeLoc TL = TInfo->getTypeLoc();
+ if (IncompleteArrayTypeLoc *ArrayLoc
+ = dyn_cast<IncompleteArrayTypeLoc>(&TL))
+ Brackets = ArrayLoc->getBracketsRange();
+ }
}
*ResultType
@@ -2898,7 +3086,7 @@ InitializationSequence::Perform(Sema &S,
}
}
- if (Kind.getKind() == InitializationKind::IK_Copy)
+ if (Kind.getKind() == InitializationKind::IK_Copy || Kind.isExplicitCast())
return Sema::OwningExprResult(S, Args.release()[0]);
unsigned NumArgs = Args.size();
@@ -2909,34 +3097,58 @@ InitializationSequence::Perform(Sema &S,
SourceLocation()));
}
- QualType DestType = Entity.getType().getType().getNonReferenceType();
+ if (SequenceKind == NoInitialization)
+ return S.Owned((Expr *)0);
+
+ QualType DestType = Entity.getType().getNonReferenceType();
+ // FIXME: Ugly hack around the fact that Entity.getType() is not
+ // the same as Entity.getDecl()->getType() in cases involving type merging,
+ // and we want latter when it makes sense.
if (ResultType)
- *ResultType = Entity.getType().getType();
-
- Sema::OwningExprResult CurInit(S);
- // For copy initialization and any other initialization forms that
- // only have a single initializer, we start with the (only)
- // initializer we have.
- // FIXME: DPG is not happy about this. There's confusion regarding whether
- // we're supposed to start the conversion from the solitary initializer or
- // from the set of arguments.
- if (Kind.getKind() == InitializationKind::IK_Copy ||
- SequenceKind != ConstructorInitialization) {
+ *ResultType = Entity.getDecl() ? Entity.getDecl()->getType() :
+ Entity.getType();
+
+ Sema::OwningExprResult CurInit = S.Owned((Expr *)0);
+
+ assert(!Steps.empty() && "Cannot have an empty initialization sequence");
+
+ // For initialization steps that start with a single initializer,
+ // grab the only argument out the Args and place it into the "current"
+ // initializer.
+ switch (Steps.front().Kind) {
+ case SK_ResolveAddressOfOverloadedFunction:
+ case SK_CastDerivedToBaseRValue:
+ case SK_CastDerivedToBaseLValue:
+ case SK_BindReference:
+ case SK_BindReferenceToTemporary:
+ case SK_UserConversion:
+ case SK_QualificationConversionLValue:
+ case SK_QualificationConversionRValue:
+ case SK_ConversionSequence:
+ case SK_ListInitialization:
+ case SK_CAssignment:
+ case SK_StringInit:
assert(Args.size() == 1);
- CurInit = Sema::OwningExprResult(S, Args.release()[0]);
+ CurInit = Sema::OwningExprResult(S, ((Expr **)(Args.get()))[0]->Retain());
if (CurInit.isInvalid())
return S.ExprError();
+ break;
+
+ case SK_ConstructorInitialization:
+ case SK_ZeroInitialization:
+ break;
}
// Walk through the computed steps for the initialization sequence,
// performing the specified conversions along the way.
+ bool ConstructorInitRequiresZeroInit = false;
for (step_iterator Step = step_begin(), StepEnd = step_end();
Step != StepEnd; ++Step) {
if (CurInit.isInvalid())
return S.ExprError();
Expr *CurInitExpr = (Expr *)CurInit.get();
- QualType SourceType = CurInitExpr->getType();
+ QualType SourceType = CurInitExpr? CurInitExpr->getType() : QualType();
switch (Step->Kind) {
case SK_ResolveAddressOfOverloadedFunction:
@@ -2969,7 +3181,7 @@ InitializationSequence::Perform(Sema &S,
if (FieldDecl *BitField = CurInitExpr->getBitField()) {
// References cannot bind to bit fields (C++ [dcl.init.ref]p5).
S.Diag(Kind.getLocation(), diag::err_reference_bind_to_bitfield)
- << Entity.getType().getType().isVolatileQualified()
+ << Entity.getType().isVolatileQualified()
<< BitField->getDeclName()
<< CurInitExpr->getSourceRange();
S.Diag(BitField->getLocation(), diag::note_bitfield_decl);
@@ -2996,6 +3208,7 @@ InitializationSequence::Perform(Sema &S,
// We have a user-defined conversion that invokes either a constructor
// or a conversion function.
CastExpr::CastKind CastKind = CastExpr::CK_Unknown;
+ bool IsCopy = false;
if (CXXConstructorDecl *Constructor
= dyn_cast<CXXConstructorDecl>(Step->Function)) {
// Build a call to the selected constructor.
@@ -3019,10 +3232,14 @@ InitializationSequence::Perform(Sema &S,
return S.ExprError();
CastKind = CastExpr::CK_ConstructorConversion;
+ QualType Class = S.Context.getTypeDeclType(Constructor->getParent());
+ if (S.Context.hasSameUnqualifiedType(SourceType, Class) ||
+ S.IsDerivedFrom(SourceType, Class))
+ IsCopy = true;
} else {
// Build a call to the conversion function.
CXXConversionDecl *Conversion = cast<CXXConversionDecl>(Step->Function);
-
+
// FIXME: Should we move this initialization into a separate
// derived-to-base conversion? I believe the answer is "no", because
// we don't want to turn off access control here for c-style casts.
@@ -3041,12 +3258,17 @@ InitializationSequence::Perform(Sema &S,
CastKind = CastExpr::CK_UserDefinedConversion;
}
- CurInit = S.MaybeBindToTemporary(CurInit.takeAs<Expr>());
+ if (shouldBindAsTemporary(Entity, IsCopy))
+ CurInit = S.MaybeBindToTemporary(CurInit.takeAs<Expr>());
+
CurInitExpr = CurInit.takeAs<Expr>();
CurInit = S.Owned(new (S.Context) ImplicitCastExpr(CurInitExpr->getType(),
CastKind,
CurInitExpr,
- false));
+ false));
+
+ if (!IsCopy)
+ CurInit = CopyIfRequiredForEntity(S, Entity, Kind, move(CurInit));
break;
}
@@ -3061,7 +3283,7 @@ InitializationSequence::Perform(Sema &S,
break;
case SK_ConversionSequence:
- if (S.PerformImplicitConversion(CurInitExpr, Step->Type, "converting",
+ if (S.PerformImplicitConversion(CurInitExpr, Step->Type, Sema::AA_Converting,
false, false, *Step->ICS))
return S.ExprError();
@@ -3072,7 +3294,7 @@ InitializationSequence::Perform(Sema &S,
case SK_ListInitialization: {
InitListExpr *InitList = cast<InitListExpr>(CurInitExpr);
QualType Ty = Step->Type;
- if (S.CheckInitList(InitList, ResultType? *ResultType : Ty))
+ if (S.CheckInitList(Entity, InitList, ResultType? *ResultType : Ty))
return S.ExprError();
CurInit.release();
@@ -3095,22 +3317,68 @@ InitializationSequence::Perform(Sema &S,
return S.ExprError();
// Build the an expression that constructs a temporary.
- CurInit = S.BuildCXXConstructExpr(Loc, Step->Type, Constructor,
- move_arg(ConstructorArgs));
+ CurInit = S.BuildCXXConstructExpr(Loc, Entity.getType(),
+ Constructor,
+ move_arg(ConstructorArgs),
+ ConstructorInitRequiresZeroInit);
if (CurInit.isInvalid())
return S.ExprError();
-
- CurInit = S.MaybeBindToTemporary(CurInit.takeAs<Expr>());
+
+ bool Elidable
+ = cast<CXXConstructExpr>((Expr *)CurInit.get())->isElidable();
+ if (shouldBindAsTemporary(Entity, Elidable))
+ CurInit = S.MaybeBindToTemporary(CurInit.takeAs<Expr>());
+
+ if (!Elidable)
+ CurInit = CopyIfRequiredForEntity(S, Entity, Kind, move(CurInit));
break;
}
case SK_ZeroInitialization: {
- if (Kind.getKind() == InitializationKind::IK_Value)
+ step_iterator NextStep = Step;
+ ++NextStep;
+ if (NextStep != StepEnd &&
+ NextStep->Kind == SK_ConstructorInitialization) {
+ // The need for zero-initialization is recorded directly into
+ // the call to the object's constructor within the next step.
+ ConstructorInitRequiresZeroInit = true;
+ } else if (Kind.getKind() == InitializationKind::IK_Value &&
+ S.getLangOptions().CPlusPlus &&
+ !Kind.isImplicitValueInit()) {
CurInit = S.Owned(new (S.Context) CXXZeroInitValueExpr(Step->Type,
Kind.getRange().getBegin(),
Kind.getRange().getEnd()));
- else
+ } else {
CurInit = S.Owned(new (S.Context) ImplicitValueInitExpr(Step->Type));
+ }
+ break;
+ }
+
+ case SK_CAssignment: {
+ QualType SourceType = CurInitExpr->getType();
+ Sema::AssignConvertType ConvTy =
+ S.CheckSingleAssignmentConstraints(Step->Type, CurInitExpr);
+
+ // If this is a call, allow conversion to a transparent union.
+ if (ConvTy != Sema::Compatible &&
+ Entity.getKind() == InitializedEntity::EK_Parameter &&
+ S.CheckTransparentUnionArgumentConstraints(Step->Type, CurInitExpr)
+ == Sema::Compatible)
+ ConvTy = Sema::Compatible;
+
+ if (S.DiagnoseAssignmentResult(ConvTy, Kind.getLocation(),
+ Step->Type, SourceType,
+ CurInitExpr, getAssignmentAction(Entity)))
+ return S.ExprError();
+
+ CurInit.release();
+ CurInit = S.Owned(CurInitExpr);
+ break;
+ }
+
+ case SK_StringInit: {
+ QualType Ty = Step->Type;
+ CheckStringInit(CurInitExpr, ResultType ? *ResultType : Ty, S);
break;
}
}
@@ -3129,7 +3397,7 @@ bool InitializationSequence::Diagnose(Sema &S,
if (SequenceKind != FailedSequence)
return false;
- QualType DestType = Entity.getType().getType();
+ QualType DestType = Entity.getType();
switch (Failure) {
case FK_TooManyInitsForReference:
S.Diag(Kind.getLocation(), diag::err_reference_has_multiple_inits)
@@ -3152,9 +3420,15 @@ bool InitializationSequence::Diagnose(Sema &S,
case FK_UserConversionOverloadFailed:
switch (FailedOverloadResult) {
case OR_Ambiguous:
- S.Diag(Kind.getLocation(), diag::err_typecheck_ambiguous_condition)
- << Args[0]->getType() << DestType.getNonReferenceType()
- << Args[0]->getSourceRange();
+ if (Failure == FK_UserConversionOverloadFailed)
+ S.Diag(Kind.getLocation(), diag::err_typecheck_ambiguous_condition)
+ << Args[0]->getType() << DestType
+ << Args[0]->getSourceRange();
+ else
+ S.Diag(Kind.getLocation(), diag::err_ref_init_ambiguous)
+ << DestType << Args[0]->getType()
+ << Args[0]->getSourceRange();
+
S.PrintOverloadCandidates(FailedCandidateSet, true);
break;
@@ -3220,7 +3494,8 @@ bool InitializationSequence::Diagnose(Sema &S,
break;
case FK_ConversionFailed:
- S.Diag(Kind.getLocation(), diag::err_cannot_initialize_decl_noname)
+ S.Diag(Kind.getLocation(), diag::err_init_conversion_failed)
+ << (int)Entity.getKind()
<< DestType
<< (Args[0]->isLvalue(S.Context) == Expr::LV_Valid)
<< Args[0]->getType()
@@ -3228,12 +3503,16 @@ bool InitializationSequence::Diagnose(Sema &S,
break;
case FK_TooManyInitsForScalar: {
- InitListExpr *InitList = cast<InitListExpr>(Args[0]);
+ SourceRange R;
+
+ if (InitListExpr *InitList = dyn_cast<InitListExpr>(Args[0]))
+ R = SourceRange(InitList->getInit(1)->getLocStart(),
+ InitList->getLocEnd());
+ else
+ R = SourceRange(Args[0]->getLocStart(), Args[NumArgs - 1]->getLocEnd());
S.Diag(Kind.getLocation(), diag::err_excess_initializers)
- << /*scalar=*/2
- << SourceRange(InitList->getInit(1)->getLocStart(),
- InitList->getLocEnd());
+ << /*scalar=*/2 << R;
break;
}
@@ -3290,7 +3569,36 @@ bool InitializationSequence::Diagnose(Sema &S,
}
break;
}
+
+ case FK_DefaultInitOfConst:
+ S.Diag(Kind.getLocation(), diag::err_default_init_const)
+ << DestType;
+ break;
}
return true;
}
+
+//===----------------------------------------------------------------------===//
+// Initialization helper functions
+//===----------------------------------------------------------------------===//
+Sema::OwningExprResult
+Sema::PerformCopyInitialization(const InitializedEntity &Entity,
+ SourceLocation EqualLoc,
+ OwningExprResult Init) {
+ if (Init.isInvalid())
+ return ExprError();
+
+ Expr *InitE = (Expr *)Init.get();
+ assert(InitE && "No initialization expression?");
+
+ if (EqualLoc.isInvalid())
+ EqualLoc = InitE->getLocStart();
+
+ InitializationKind Kind = InitializationKind::CreateCopy(InitE->getLocStart(),
+ EqualLoc);
+ InitializationSequence Seq(*this, Entity, Kind, &InitE, 1);
+ Init.release();
+ return Seq.Perform(*this, Entity, Kind,
+ MultiExprArg(*this, (void**)&InitE, 1));
+}
diff --git a/lib/Sema/SemaInit.h b/lib/Sema/SemaInit.h
index 2d4b01f26b0d..5eb819a69176 100644
--- a/lib/Sema/SemaInit.h
+++ b/lib/Sema/SemaInit.h
@@ -14,7 +14,7 @@
#define LLVM_CLANG_SEMA_INIT_H
#include "SemaOverload.h"
-#include "clang/AST/TypeLoc.h"
+#include "clang/AST/Type.h"
#include "clang/Parse/Action.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/PointerIntPair.h"
@@ -47,72 +47,79 @@ public:
/// \brief The entity being initialized is an exception object that
/// is being thrown.
EK_Exception,
+ /// \brief The entity being initialized is an object (or array of
+ /// objects) allocated via new.
+ EK_New,
/// \brief The entity being initialized is a temporary object.
EK_Temporary,
/// \brief The entity being initialized is a base member subobject.
EK_Base,
/// \brief The entity being initialized is a non-static data member
/// subobject.
- EK_Member
+ EK_Member,
+ /// \brief The entity being initialized is an element of an array
+ /// or vector.
+ EK_ArrayOrVectorElement
};
private:
/// \brief The kind of entity being initialized.
EntityKind Kind;
- /// \brief The type of the object or reference being initialized along with
- /// its location information.
- TypeLoc TL;
+ /// \brief If non-NULL, the parent entity in which this
+ /// initialization occurs.
+ const InitializedEntity *Parent;
+
+ /// \brief The type of the object or reference being initialized.
+ QualType Type;
union {
/// \brief When Kind == EK_Variable, EK_Parameter, or EK_Member,
/// the VarDecl, ParmVarDecl, or FieldDecl, respectively.
DeclaratorDecl *VariableOrMember;
- /// \brief When Kind == EK_Result or EK_Exception, the location of the
- /// 'return' or 'throw' keyword, respectively. When Kind == EK_Temporary,
- /// the location where the temporary is being created.
+ /// \brief When Kind == EK_Result, EK_Exception, or EK_New, the
+ /// location of the 'return', 'throw', or 'new' keyword,
+ /// respectively. When Kind == EK_Temporary, the location where
+ /// the temporary is being created.
unsigned Location;
/// \brief When Kind == EK_Base, the base specifier that provides the
/// base class.
CXXBaseSpecifier *Base;
+
+ /// \brief When Kind = EK_ArrayOrVectorElement, the index of the
+ /// array or vector element being initialized.
+ unsigned Index;
};
InitializedEntity() { }
/// \brief Create the initialization entity for a variable.
InitializedEntity(VarDecl *Var)
- : Kind(EK_Variable),
- VariableOrMember(reinterpret_cast<DeclaratorDecl*>(Var))
- {
- InitDeclLoc();
- }
+ : Kind(EK_Variable), Parent(0), Type(Var->getType()),
+ VariableOrMember(reinterpret_cast<DeclaratorDecl*>(Var)) { }
/// \brief Create the initialization entity for a parameter.
InitializedEntity(ParmVarDecl *Parm)
- : Kind(EK_Parameter),
- VariableOrMember(reinterpret_cast<DeclaratorDecl*>(Parm))
- {
- InitDeclLoc();
- }
+ : Kind(EK_Parameter), Parent(0), Type(Parm->getType().getUnqualifiedType()),
+ VariableOrMember(reinterpret_cast<DeclaratorDecl*>(Parm)) { }
- /// \brief Create the initialization entity for the result of a function,
- /// throwing an object, or performing an explicit cast.
- InitializedEntity(EntityKind Kind, SourceLocation Loc, TypeLoc TL)
- : Kind(Kind), TL(TL), Location(Loc.getRawEncoding()) { }
+ /// \brief Create the initialization entity for the result of a
+ /// function, throwing an object, performing an explicit cast, or
+ /// initializing a parameter for which there is no declaration.
+ InitializedEntity(EntityKind Kind, SourceLocation Loc, QualType Type)
+ : Kind(Kind), Parent(0), Type(Type), Location(Loc.getRawEncoding()) { }
/// \brief Create the initialization entity for a member subobject.
- InitializedEntity(FieldDecl *Member)
- : Kind(EK_Member),
- VariableOrMember(reinterpret_cast<DeclaratorDecl*>(Member))
- {
- InitDeclLoc();
- }
-
- /// \brief Initialize type-location information from a declaration.
- void InitDeclLoc();
+ InitializedEntity(FieldDecl *Member, const InitializedEntity *Parent)
+ : Kind(EK_Member), Parent(Parent), Type(Member->getType()),
+ VariableOrMember(reinterpret_cast<DeclaratorDecl*>(Member)) { }
+ /// \brief Create the initialization entity for an array element.
+ InitializedEntity(ASTContext &Context, unsigned Index,
+ const InitializedEntity &Parent);
+
public:
/// \brief Create the initialization entity for a variable.
static InitializedEntity InitializeVariable(VarDecl *Var) {
@@ -124,38 +131,69 @@ public:
return InitializedEntity(Parm);
}
+ /// \brief Create the initialization entity for a parameter that is
+ /// only known by its type.
+ static InitializedEntity InitializeParameter(QualType Type) {
+ return InitializedEntity(EK_Parameter, SourceLocation(), Type);
+ }
+
/// \brief Create the initialization entity for the result of a function.
static InitializedEntity InitializeResult(SourceLocation ReturnLoc,
- TypeLoc TL) {
- return InitializedEntity(EK_Result, ReturnLoc, TL);
+ QualType Type) {
+ return InitializedEntity(EK_Result, ReturnLoc, Type);
}
/// \brief Create the initialization entity for an exception object.
static InitializedEntity InitializeException(SourceLocation ThrowLoc,
- TypeLoc TL) {
- return InitializedEntity(EK_Exception, ThrowLoc, TL);
+ QualType Type) {
+ return InitializedEntity(EK_Exception, ThrowLoc, Type);
+ }
+
+ /// \brief Create the initialization entity for an object allocated via new.
+ static InitializedEntity InitializeNew(SourceLocation NewLoc, QualType Type) {
+ return InitializedEntity(EK_New, NewLoc, Type);
}
/// \brief Create the initialization entity for a temporary.
- static InitializedEntity InitializeTemporary(EntityKind Kind, TypeLoc TL) {
- return InitializedEntity(Kind, SourceLocation(), TL);
+ static InitializedEntity InitializeTemporary(QualType Type) {
+ return InitializedEntity(EK_Temporary, SourceLocation(), Type);
}
/// \brief Create the initialization entity for a base class subobject.
static InitializedEntity InitializeBase(ASTContext &Context,
CXXBaseSpecifier *Base);
- /// \brief Create the initialize entity for a member subobject.
- static InitializedEntity InitializeMember(FieldDecl *Member) {
- return InitializedEntity(Member);
+ /// \brief Create the initialization entity for a member subobject.
+ static InitializedEntity InitializeMember(FieldDecl *Member,
+ const InitializedEntity *Parent = 0) {
+ return InitializedEntity(Member, Parent);
}
+ /// \brief Create the initialization entity for an array element.
+ static InitializedEntity InitializeElement(ASTContext &Context,
+ unsigned Index,
+ const InitializedEntity &Parent) {
+ return InitializedEntity(Context, Index, Parent);
+ }
+
/// \brief Determine the kind of initialization.
EntityKind getKind() const { return Kind; }
+ /// \brief Retrieve the parent of the entity being initialized, when
+ /// the initialization itself is occuring within the context of a
+ /// larger initialization.
+ const InitializedEntity *getParent() const { return Parent; }
+
/// \brief Retrieve type being initialized.
- TypeLoc getType() const { return TL; }
+ QualType getType() const { return Type; }
+ /// \brief Retrieve the name of the entity being initialized.
+ DeclarationName getName() const;
+
+ /// \brief Retrieve the variable, parameter, or field being
+ /// initialized.
+ DeclaratorDecl *getDecl() const;
+
/// \brief Determine the location of the 'return' keyword when initializing
/// the result of a function call.
SourceLocation getReturnLoc() const {
@@ -169,6 +207,13 @@ public:
assert(getKind() == EK_Exception && "No 'throw' location!");
return SourceLocation::getFromRawEncoding(Location);
}
+
+ /// \brief If this is already the initializer for an array or vector
+ /// element, sets the element index.
+ void setElementIndex(unsigned Index) {
+ assert(getKind() == EK_ArrayOrVectorElement);
+ this->Index = Index;
+ }
};
/// \brief Describes the kind of initialization being performed, along with
@@ -191,6 +236,7 @@ private:
SIK_Copy = IK_Copy, ///< Copy initialization
SIK_Default = IK_Default, ///< Default initialization
SIK_Value = IK_Value, ///< Value initialization
+ SIK_ImplicitValue, ///< Implicit value initialization
SIK_DirectCast, ///< Direct initialization due to a cast
/// \brief Direct initialization due to a C-style or functional cast.
SIK_DirectCStyleOrFunctionalCast
@@ -242,15 +288,19 @@ public:
/// \brief Create a value initialization.
static InitializationKind CreateValue(SourceLocation InitLoc,
SourceLocation LParenLoc,
- SourceLocation RParenLoc) {
- return InitializationKind(SIK_Value, InitLoc, LParenLoc, RParenLoc);
+ SourceLocation RParenLoc,
+ bool isImplicit = false) {
+ return InitializationKind(isImplicit? SIK_ImplicitValue : SIK_Value,
+ InitLoc, LParenLoc, RParenLoc);
}
/// \brief Determine the initialization kind.
InitKind getKind() const {
- if (Kind > SIK_Value)
+ if (Kind > SIK_ImplicitValue)
return IK_Direct;
-
+ if (Kind == SIK_ImplicitValue)
+ return IK_Value;
+
return (InitKind)Kind;
}
@@ -263,7 +313,12 @@ public:
bool isCStyleOrFunctionalCast() const {
return Kind == SIK_DirectCStyleOrFunctionalCast;
}
-
+
+ /// \brief Determine whether this initialization is an implicit
+ /// value-initialization, e.g., as occurs during aggregate
+ /// initialization.
+ bool isImplicitValueInit() const { return Kind == SIK_ImplicitValue; }
+
/// \brief Retrieve the location at which initialization is occurring.
SourceLocation getLocation() const { return Locations[0]; }
@@ -319,7 +374,19 @@ public:
ListInitialization,
/// \brief Zero-initialization.
- ZeroInitialization
+ ZeroInitialization,
+
+ /// \brief No initialization required.
+ NoInitialization,
+
+ /// \brief Standard conversion sequence.
+ StandardConversion,
+
+ /// \brief C conversion sequence.
+ CAssignment,
+
+ /// \brief String initialization
+ StringInit
};
/// \brief Describes the kind of a particular step in an initialization
@@ -350,7 +417,11 @@ public:
/// \brief Perform initialization via a constructor.
SK_ConstructorInitialization,
/// \brief Zero-initialize the object
- SK_ZeroInitialization
+ SK_ZeroInitialization,
+ /// \brief C assignment
+ SK_CAssignment,
+ /// \brief Initialization by string
+ SK_StringInit
};
/// \brief A single step in the initialization sequence.
@@ -420,7 +491,9 @@ public:
/// \brief Overloading for a user-defined conversion failed.
FK_UserConversionOverloadFailed,
/// \brief Overloaded for initialization by constructor failed.
- FK_ConstructorOverloadFailed
+ FK_ConstructorOverloadFailed,
+ /// \brief Default-initialization of a 'const' object.
+ FK_DefaultInitOfConst
};
private:
@@ -551,6 +624,16 @@ public:
/// \brief Add a zero-initialization step.
void AddZeroInitializationStep(QualType T);
+ /// \brief Add a C assignment step.
+ //
+ // FIXME: It isn't clear whether this should ever be needed;
+ // ideally, we would handle everything needed in C in the common
+ // path. However, that isn't the case yet.
+ void AddCAssignmentStep(QualType T);
+
+ /// \brief Add a string init step.
+ void AddStringInitStep(QualType T);
+
/// \brief Note that this initialization sequence failed.
void SetFailed(FailureKind Failure) {
SequenceKind = FailedSequence;
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index 724e2fc1e4f5..1419ceb4b660 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -27,6 +27,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/ErrorHandling.h"
+#include <list>
#include <set>
#include <vector>
#include <iterator>
@@ -192,23 +193,83 @@ namespace {
};
}
+static bool IsAcceptableIDNS(NamedDecl *D, unsigned IDNS) {
+ return D->isInIdentifierNamespace(IDNS);
+}
+
+static bool IsAcceptableOperatorName(NamedDecl *D, unsigned IDNS) {
+ return D->isInIdentifierNamespace(IDNS) &&
+ !D->getDeclContext()->isRecord();
+}
+
+static bool IsAcceptableNestedNameSpecifierName(NamedDecl *D, unsigned IDNS) {
+ // This lookup ignores everything that isn't a type.
+
+ // This is a fast check for the far most common case.
+ if (D->isInIdentifierNamespace(Decl::IDNS_Tag))
+ return true;
+
+ if (isa<UsingShadowDecl>(D))
+ D = cast<UsingShadowDecl>(D)->getTargetDecl();
+
+ return isa<TypeDecl>(D);
+}
+
+static bool IsAcceptableNamespaceName(NamedDecl *D, unsigned IDNS) {
+ // We don't need to look through using decls here because
+ // using decls aren't allowed to name namespaces.
+
+ return isa<NamespaceDecl>(D) || isa<NamespaceAliasDecl>(D);
+}
+
+/// Gets the default result filter for the given lookup.
+static inline
+LookupResult::ResultFilter getResultFilter(Sema::LookupNameKind NameKind) {
+ switch (NameKind) {
+ case Sema::LookupOrdinaryName:
+ case Sema::LookupTagName:
+ case Sema::LookupMemberName:
+ case Sema::LookupRedeclarationWithLinkage: // FIXME: check linkage, scoping
+ case Sema::LookupUsingDeclName:
+ case Sema::LookupObjCProtocolName:
+ case Sema::LookupObjCImplementationName:
+ return &IsAcceptableIDNS;
+
+ case Sema::LookupOperatorName:
+ return &IsAcceptableOperatorName;
+
+ case Sema::LookupNestedNameSpecifierName:
+ return &IsAcceptableNestedNameSpecifierName;
+
+ case Sema::LookupNamespaceName:
+ return &IsAcceptableNamespaceName;
+ }
+
+ llvm_unreachable("unkknown lookup kind");
+ return 0;
+}
+
// Retrieve the set of identifier namespaces that correspond to a
// specific kind of name lookup.
-inline unsigned
-getIdentifierNamespacesFromLookupNameKind(Sema::LookupNameKind NameKind,
- bool CPlusPlus) {
+static inline unsigned getIDNS(Sema::LookupNameKind NameKind,
+ bool CPlusPlus,
+ bool Redeclaration) {
unsigned IDNS = 0;
switch (NameKind) {
case Sema::LookupOrdinaryName:
case Sema::LookupOperatorName:
case Sema::LookupRedeclarationWithLinkage:
IDNS = Decl::IDNS_Ordinary;
- if (CPlusPlus)
+ if (CPlusPlus) {
IDNS |= Decl::IDNS_Tag | Decl::IDNS_Member;
+ if (Redeclaration) IDNS |= Decl::IDNS_TagFriend | Decl::IDNS_OrdinaryFriend;
+ }
break;
case Sema::LookupTagName:
IDNS = Decl::IDNS_Tag;
+ if (CPlusPlus && Redeclaration)
+ IDNS |= Decl::IDNS_TagFriend;
break;
case Sema::LookupMemberName:
@@ -238,6 +299,13 @@ getIdentifierNamespacesFromLookupNameKind(Sema::LookupNameKind NameKind,
return IDNS;
}
+void LookupResult::configure() {
+ IDNS = getIDNS(LookupKind,
+ SemaRef.getLangOptions().CPlusPlus,
+ isForRedeclaration());
+ IsAcceptableFn = getResultFilter(LookupKind);
+}
+
// Necessary because CXXBasePaths is not complete in Sema.h
void LookupResult::deletePaths(CXXBasePaths *Paths) {
delete Paths;
@@ -377,8 +445,7 @@ static bool LookupDirect(LookupResult &R, const DeclContext *DC) {
DeclContext::lookup_const_iterator I, E;
for (llvm::tie(I, E) = DC->lookup(R.getLookupName()); I != E; ++I)
- if (Sema::isAcceptableLookupResult(*I, R.getLookupKind(),
- R.getIdentifierNamespace()))
+ if (R.isAcceptableDecl(*I))
R.addDecl(*I), Found = true;
return Found;
@@ -424,19 +491,7 @@ static DeclContext *findOuterContext(Scope *S) {
}
bool Sema::CppLookupName(LookupResult &R, Scope *S) {
- assert(getLangOptions().CPlusPlus &&
- "Can perform only C++ lookup");
- LookupNameKind NameKind = R.getLookupKind();
- unsigned IDNS
- = getIdentifierNamespacesFromLookupNameKind(NameKind, /*CPlusPlus*/ true);
-
- // If we're testing for redeclarations, also look in the friend namespaces.
- if (R.isForRedeclaration()) {
- if (IDNS & Decl::IDNS_Tag) IDNS |= Decl::IDNS_TagFriend;
- if (IDNS & Decl::IDNS_Ordinary) IDNS |= Decl::IDNS_OrdinaryFriend;
- }
-
- R.setIdentifierNamespace(IDNS);
+ assert(getLangOptions().CPlusPlus && "Can perform only C++ lookup");
DeclarationName Name = R.getLookupName();
@@ -467,7 +522,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
// Check whether the IdResolver has anything in this scope.
bool Found = false;
for (; I != IEnd && S->isDeclScope(DeclPtrTy::make(*I)); ++I) {
- if (isAcceptableLookupResult(*I, NameKind, IDNS)) {
+ if (R.isAcceptableDecl(*I)) {
Found = true;
R.addDecl(*I);
}
@@ -531,7 +586,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
// Check whether the IdResolver has anything in this scope.
bool Found = false;
for (; I != IEnd && S->isDeclScope(DeclPtrTy::make(*I)); ++I) {
- if (isAcceptableLookupResult(*I, NameKind, IDNS)) {
+ if (R.isAcceptableDecl(*I)) {
// We found something. Look for anything else in our scope
// with this same name and in an acceptable identifier
// namespace, so that we can construct an overload set if we
@@ -597,47 +652,18 @@ bool Sema::LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation) {
if (!getLangOptions().CPlusPlus) {
// Unqualified name lookup in C/Objective-C is purely lexical, so
// search in the declarations attached to the name.
- unsigned IDNS = 0;
- switch (NameKind) {
- case Sema::LookupOrdinaryName:
- IDNS = Decl::IDNS_Ordinary;
- break;
- case Sema::LookupTagName:
- IDNS = Decl::IDNS_Tag;
- break;
-
- case Sema::LookupMemberName:
- IDNS = Decl::IDNS_Member;
- break;
-
- case Sema::LookupOperatorName:
- case Sema::LookupNestedNameSpecifierName:
- case Sema::LookupNamespaceName:
- case Sema::LookupUsingDeclName:
- assert(false && "C does not perform these kinds of name lookup");
- break;
-
- case Sema::LookupRedeclarationWithLinkage:
+ if (NameKind == Sema::LookupRedeclarationWithLinkage) {
// Find the nearest non-transparent declaration scope.
while (!(S->getFlags() & Scope::DeclScope) ||
(S->getEntity() &&
static_cast<DeclContext *>(S->getEntity())
->isTransparentContext()))
S = S->getParent();
- IDNS = Decl::IDNS_Ordinary;
- break;
-
- case Sema::LookupObjCProtocolName:
- IDNS = Decl::IDNS_ObjCProtocol;
- break;
-
- case Sema::LookupObjCImplementationName:
- IDNS = Decl::IDNS_ObjCImplementation;
- break;
-
}
+ unsigned IDNS = R.getIdentifierNamespace();
+
// Scan up the scope chain looking for a decl that matches this
// identifier that is in the appropriate namespace. This search
// should not take long, as shadowing of names is uncommon, and
@@ -864,17 +890,6 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx) {
if (!R.getLookupName())
return false;
- // If we're performing qualified name lookup (e.g., lookup into a
- // struct), find fields as part of ordinary name lookup.
- LookupNameKind NameKind = R.getLookupKind();
- unsigned IDNS
- = getIdentifierNamespacesFromLookupNameKind(NameKind,
- getLangOptions().CPlusPlus);
- if (NameKind == LookupOrdinaryName)
- IDNS |= Decl::IDNS_Member;
-
- R.setIdentifierNamespace(IDNS);
-
// Make sure that the declaration context is complete.
assert((!isa<TagDecl>(LookupCtx) ||
LookupCtx->isDependentContext() ||
@@ -1514,15 +1529,12 @@ Sema::FindAssociatedClassesAndNamespaces(Expr **Args, unsigned NumArgs,
for (llvm::SmallVectorImpl<NamedDecl*>::iterator I = Functions.begin(),
E = Functions.end(); I != E; ++I) {
- FunctionDecl *FDecl = dyn_cast<FunctionDecl>(*I);
- if (!FDecl)
- FDecl = cast<FunctionTemplateDecl>(*I)->getTemplatedDecl();
+ // Look through any using declarations to find the underlying function.
+ NamedDecl *Fn = (*I)->getUnderlyingDecl();
- // Add the namespace in which this function was defined. Note
- // that, if this is a member function, we do *not* consider the
- // enclosing namespace of its class.
- DeclContext *Ctx = FDecl->getDeclContext();
- CollectNamespace(AssociatedNamespaces, Ctx);
+ FunctionDecl *FDecl = dyn_cast<FunctionDecl>(Fn);
+ if (!FDecl)
+ FDecl = cast<FunctionTemplateDecl>(Fn)->getTemplatedDecl();
// Add the classes and namespaces associated with the parameter
// types and return type of this function.
@@ -1693,3 +1705,509 @@ void Sema::ArgumentDependentLookup(DeclarationName Name, bool Operator,
}
}
}
+
+//----------------------------------------------------------------------------
+// Search for all visible declarations.
+//----------------------------------------------------------------------------
+VisibleDeclConsumer::~VisibleDeclConsumer() { }
+
+namespace {
+
+class ShadowContextRAII;
+
+class VisibleDeclsRecord {
+public:
+ /// \brief An entry in the shadow map, which is optimized to store a
+ /// single declaration (the common case) but can also store a list
+ /// of declarations.
+ class ShadowMapEntry {
+ typedef llvm::SmallVector<NamedDecl *, 4> DeclVector;
+
+ /// \brief Contains either the solitary NamedDecl * or a vector
+ /// of declarations.
+ llvm::PointerUnion<NamedDecl *, DeclVector*> DeclOrVector;
+
+ public:
+ ShadowMapEntry() : DeclOrVector() { }
+
+ void Add(NamedDecl *ND);
+ void Destroy();
+
+ // Iteration.
+ typedef NamedDecl **iterator;
+ iterator begin();
+ iterator end();
+ };
+
+private:
+ /// \brief A mapping from declaration names to the declarations that have
+ /// this name within a particular scope.
+ typedef llvm::DenseMap<DeclarationName, ShadowMapEntry> ShadowMap;
+
+ /// \brief A list of shadow maps, which is used to model name hiding.
+ std::list<ShadowMap> ShadowMaps;
+
+ /// \brief The declaration contexts we have already visited.
+ llvm::SmallPtrSet<DeclContext *, 8> VisitedContexts;
+
+ friend class ShadowContextRAII;
+
+public:
+ /// \brief Determine whether we have already visited this context
+ /// (and, if not, note that we are going to visit that context now).
+ bool visitedContext(DeclContext *Ctx) {
+ return !VisitedContexts.insert(Ctx);
+ }
+
+ /// \brief Determine whether the given declaration is hidden in the
+ /// current scope.
+ ///
+ /// \returns the declaration that hides the given declaration, or
+ /// NULL if no such declaration exists.
+ NamedDecl *checkHidden(NamedDecl *ND);
+
+ /// \brief Add a declaration to the current shadow map.
+ void add(NamedDecl *ND) { ShadowMaps.back()[ND->getDeclName()].Add(ND); }
+};
+
+/// \brief RAII object that records when we've entered a shadow context.
+class ShadowContextRAII {
+ VisibleDeclsRecord &Visible;
+
+ typedef VisibleDeclsRecord::ShadowMap ShadowMap;
+
+public:
+ ShadowContextRAII(VisibleDeclsRecord &Visible) : Visible(Visible) {
+ Visible.ShadowMaps.push_back(ShadowMap());
+ }
+
+ ~ShadowContextRAII() {
+ for (ShadowMap::iterator E = Visible.ShadowMaps.back().begin(),
+ EEnd = Visible.ShadowMaps.back().end();
+ E != EEnd;
+ ++E)
+ E->second.Destroy();
+
+ Visible.ShadowMaps.pop_back();
+ }
+};
+
+} // end anonymous namespace
+
+void VisibleDeclsRecord::ShadowMapEntry::Add(NamedDecl *ND) {
+ if (DeclOrVector.isNull()) {
+ // 0 - > 1 elements: just set the single element information.
+ DeclOrVector = ND;
+ return;
+ }
+
+ if (NamedDecl *PrevND = DeclOrVector.dyn_cast<NamedDecl *>()) {
+ // 1 -> 2 elements: create the vector of results and push in the
+ // existing declaration.
+ DeclVector *Vec = new DeclVector;
+ Vec->push_back(PrevND);
+ DeclOrVector = Vec;
+ }
+
+ // Add the new element to the end of the vector.
+ DeclOrVector.get<DeclVector*>()->push_back(ND);
+}
+
+void VisibleDeclsRecord::ShadowMapEntry::Destroy() {
+ if (DeclVector *Vec = DeclOrVector.dyn_cast<DeclVector *>()) {
+ delete Vec;
+ DeclOrVector = ((NamedDecl *)0);
+ }
+}
+
+VisibleDeclsRecord::ShadowMapEntry::iterator
+VisibleDeclsRecord::ShadowMapEntry::begin() {
+ if (DeclOrVector.isNull())
+ return 0;
+
+ if (DeclOrVector.dyn_cast<NamedDecl *>())
+ return &reinterpret_cast<NamedDecl*&>(DeclOrVector);
+
+ return DeclOrVector.get<DeclVector *>()->begin();
+}
+
+VisibleDeclsRecord::ShadowMapEntry::iterator
+VisibleDeclsRecord::ShadowMapEntry::end() {
+ if (DeclOrVector.isNull())
+ return 0;
+
+ if (DeclOrVector.dyn_cast<NamedDecl *>())
+ return &reinterpret_cast<NamedDecl*&>(DeclOrVector) + 1;
+
+ return DeclOrVector.get<DeclVector *>()->end();
+}
+
+NamedDecl *VisibleDeclsRecord::checkHidden(NamedDecl *ND) {
+ unsigned IDNS = ND->getIdentifierNamespace();
+ std::list<ShadowMap>::reverse_iterator SM = ShadowMaps.rbegin();
+ for (std::list<ShadowMap>::reverse_iterator SMEnd = ShadowMaps.rend();
+ SM != SMEnd; ++SM) {
+ ShadowMap::iterator Pos = SM->find(ND->getDeclName());
+ if (Pos == SM->end())
+ continue;
+
+ for (ShadowMapEntry::iterator I = Pos->second.begin(),
+ IEnd = Pos->second.end();
+ I != IEnd; ++I) {
+ // A tag declaration does not hide a non-tag declaration.
+ if ((*I)->getIdentifierNamespace() == Decl::IDNS_Tag &&
+ (IDNS & (Decl::IDNS_Member | Decl::IDNS_Ordinary |
+ Decl::IDNS_ObjCProtocol)))
+ continue;
+
+ // Protocols are in distinct namespaces from everything else.
+ if ((((*I)->getIdentifierNamespace() & Decl::IDNS_ObjCProtocol)
+ || (IDNS & Decl::IDNS_ObjCProtocol)) &&
+ (*I)->getIdentifierNamespace() != IDNS)
+ continue;
+
+ // We've found a declaration that hides this one.
+ return *I;
+ }
+ }
+
+ return 0;
+}
+
+static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result,
+ bool QualifiedNameLookup,
+ VisibleDeclConsumer &Consumer,
+ VisibleDeclsRecord &Visited) {
+ // Make sure we don't visit the same context twice.
+ if (Visited.visitedContext(Ctx->getPrimaryContext()))
+ return;
+
+ // Enumerate all of the results in this context.
+ for (DeclContext *CurCtx = Ctx->getPrimaryContext(); CurCtx;
+ CurCtx = CurCtx->getNextContext()) {
+ for (DeclContext::decl_iterator D = CurCtx->decls_begin(),
+ DEnd = CurCtx->decls_end();
+ D != DEnd; ++D) {
+ if (NamedDecl *ND = dyn_cast<NamedDecl>(*D))
+ if (Result.isAcceptableDecl(ND)) {
+ Consumer.FoundDecl(ND, Visited.checkHidden(ND));
+ Visited.add(ND);
+ }
+
+ // Visit transparent contexts inside this context.
+ if (DeclContext *InnerCtx = dyn_cast<DeclContext>(*D)) {
+ if (InnerCtx->isTransparentContext())
+ LookupVisibleDecls(InnerCtx, Result, QualifiedNameLookup,
+ Consumer, Visited);
+ }
+ }
+ }
+
+ // Traverse using directives for qualified name lookup.
+ if (QualifiedNameLookup) {
+ ShadowContextRAII Shadow(Visited);
+ DeclContext::udir_iterator I, E;
+ for (llvm::tie(I, E) = Ctx->getUsingDirectives(); I != E; ++I) {
+ LookupVisibleDecls((*I)->getNominatedNamespace(), Result,
+ QualifiedNameLookup, Consumer, Visited);
+ }
+ }
+
+ // Traverse the contexts of inherited classes.
+ if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(Ctx)) {
+ for (CXXRecordDecl::base_class_iterator B = Record->bases_begin(),
+ BEnd = Record->bases_end();
+ B != BEnd; ++B) {
+ QualType BaseType = B->getType();
+
+ // Don't look into dependent bases, because name lookup can't look
+ // there anyway.
+ if (BaseType->isDependentType())
+ continue;
+
+ const RecordType *Record = BaseType->getAs<RecordType>();
+ if (!Record)
+ continue;
+
+ // FIXME: It would be nice to be able to determine whether referencing
+ // a particular member would be ambiguous. For example, given
+ //
+ // struct A { int member; };
+ // struct B { int member; };
+ // struct C : A, B { };
+ //
+ // void f(C *c) { c->### }
+ //
+ // accessing 'member' would result in an ambiguity. However, we
+ // could be smart enough to qualify the member with the base
+ // class, e.g.,
+ //
+ // c->B::member
+ //
+ // or
+ //
+ // c->A::member
+
+ // Find results in this base class (and its bases).
+ ShadowContextRAII Shadow(Visited);
+ LookupVisibleDecls(Record->getDecl(), Result, QualifiedNameLookup,
+ Consumer, Visited);
+ }
+ }
+
+ // FIXME: Look into base classes in Objective-C!
+}
+
+static void LookupVisibleDecls(Scope *S, LookupResult &Result,
+ UnqualUsingDirectiveSet &UDirs,
+ VisibleDeclConsumer &Consumer,
+ VisibleDeclsRecord &Visited) {
+ if (!S)
+ return;
+
+ DeclContext *Entity = 0;
+ if (S->getEntity() &&
+ !((DeclContext *)S->getEntity())->isFunctionOrMethod()) {
+ // Look into this scope's declaration context, along with any of its
+ // parent lookup contexts (e.g., enclosing classes), up to the point
+ // where we hit the context stored in the next outer scope.
+ Entity = (DeclContext *)S->getEntity();
+ DeclContext *OuterCtx = findOuterContext(S);
+
+ for (DeclContext *Ctx = Entity; Ctx && Ctx->getPrimaryContext() != OuterCtx;
+ Ctx = Ctx->getLookupParent()) {
+ if (Ctx->isFunctionOrMethod())
+ continue;
+
+ LookupVisibleDecls(Ctx, Result, /*QualifiedNameLookup=*/false,
+ Consumer, Visited);
+ }
+ } else if (!S->getParent()) {
+ // Look into the translation unit scope. We walk through the translation
+ // unit's declaration context, because the Scope itself won't have all of
+ // the declarations if we loaded a precompiled header.
+ // FIXME: We would like the translation unit's Scope object to point to the
+ // translation unit, so we don't need this special "if" branch. However,
+ // doing so would force the normal C++ name-lookup code to look into the
+ // translation unit decl when the IdentifierInfo chains would suffice.
+ // Once we fix that problem (which is part of a more general "don't look
+ // in DeclContexts unless we have to" optimization), we can eliminate the
+ // TranslationUnit parameter entirely.
+ Entity = Result.getSema().Context.getTranslationUnitDecl();
+ LookupVisibleDecls(Entity, Result, /*QualifiedNameLookup=*/false,
+ Consumer, Visited);
+ } else {
+ // Walk through the declarations in this Scope.
+ for (Scope::decl_iterator D = S->decl_begin(), DEnd = S->decl_end();
+ D != DEnd; ++D) {
+ if (NamedDecl *ND = dyn_cast<NamedDecl>((Decl *)((*D).get())))
+ if (Result.isAcceptableDecl(ND)) {
+ Consumer.FoundDecl(ND, Visited.checkHidden(ND));
+ Visited.add(ND);
+ }
+ }
+ }
+
+ if (Entity) {
+ // Lookup visible declarations in any namespaces found by using
+ // directives.
+ UnqualUsingDirectiveSet::const_iterator UI, UEnd;
+ llvm::tie(UI, UEnd) = UDirs.getNamespacesFor(Entity);
+ for (; UI != UEnd; ++UI)
+ LookupVisibleDecls(const_cast<DeclContext *>(UI->getNominatedNamespace()),
+ Result, /*QualifiedNameLookup=*/false, Consumer,
+ Visited);
+ }
+
+ // Lookup names in the parent scope.
+ ShadowContextRAII Shadow(Visited);
+ LookupVisibleDecls(S->getParent(), Result, UDirs, Consumer, Visited);
+}
+
+void Sema::LookupVisibleDecls(Scope *S, LookupNameKind Kind,
+ VisibleDeclConsumer &Consumer) {
+ // Determine the set of using directives available during
+ // unqualified name lookup.
+ Scope *Initial = S;
+ UnqualUsingDirectiveSet UDirs;
+ if (getLangOptions().CPlusPlus) {
+ // Find the first namespace or translation-unit scope.
+ while (S && !isNamespaceOrTranslationUnitScope(S))
+ S = S->getParent();
+
+ UDirs.visitScopeChain(Initial, S);
+ }
+ UDirs.done();
+
+ // Look for visible declarations.
+ LookupResult Result(*this, DeclarationName(), SourceLocation(), Kind);
+ VisibleDeclsRecord Visited;
+ ShadowContextRAII Shadow(Visited);
+ ::LookupVisibleDecls(Initial, Result, UDirs, Consumer, Visited);
+}
+
+void Sema::LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind,
+ VisibleDeclConsumer &Consumer) {
+ LookupResult Result(*this, DeclarationName(), SourceLocation(), Kind);
+ VisibleDeclsRecord Visited;
+ ShadowContextRAII Shadow(Visited);
+ ::LookupVisibleDecls(Ctx, Result, /*QualifiedNameLookup=*/true, Consumer,
+ Visited);
+}
+
+//----------------------------------------------------------------------------
+// Typo correction
+//----------------------------------------------------------------------------
+
+namespace {
+class TypoCorrectionConsumer : public VisibleDeclConsumer {
+ /// \brief The name written that is a typo in the source.
+ llvm::StringRef Typo;
+
+ /// \brief The results found that have the smallest edit distance
+ /// found (so far) with the typo name.
+ llvm::SmallVector<NamedDecl *, 4> BestResults;
+
+ /// \brief The best edit distance found so far.
+ unsigned BestEditDistance;
+
+public:
+ explicit TypoCorrectionConsumer(IdentifierInfo *Typo)
+ : Typo(Typo->getName()) { }
+
+ virtual void FoundDecl(NamedDecl *ND, NamedDecl *Hiding);
+
+ typedef llvm::SmallVector<NamedDecl *, 4>::const_iterator iterator;
+ iterator begin() const { return BestResults.begin(); }
+ iterator end() const { return BestResults.end(); }
+ bool empty() const { return BestResults.empty(); }
+
+ unsigned getBestEditDistance() const { return BestEditDistance; }
+};
+
+}
+
+void TypoCorrectionConsumer::FoundDecl(NamedDecl *ND, NamedDecl *Hiding) {
+ // Don't consider hidden names for typo correction.
+ if (Hiding)
+ return;
+
+ // Only consider entities with identifiers for names, ignoring
+ // special names (constructors, overloaded operators, selectors,
+ // etc.).
+ IdentifierInfo *Name = ND->getIdentifier();
+ if (!Name)
+ return;
+
+ // Compute the edit distance between the typo and the name of this
+ // entity. If this edit distance is not worse than the best edit
+ // distance we've seen so far, add it to the list of results.
+ unsigned ED = Typo.edit_distance(Name->getName());
+ if (!BestResults.empty()) {
+ if (ED < BestEditDistance) {
+ // This result is better than any we've seen before; clear out
+ // the previous results.
+ BestResults.clear();
+ BestEditDistance = ED;
+ } else if (ED > BestEditDistance) {
+ // This result is worse than the best results we've seen so far;
+ // ignore it.
+ return;
+ }
+ } else
+ BestEditDistance = ED;
+
+ BestResults.push_back(ND);
+}
+
+/// \brief Try to "correct" a typo in the source code by finding
+/// visible declarations whose names are similar to the name that was
+/// present in the source code.
+///
+/// \param Res the \c LookupResult structure that contains the name
+/// that was present in the source code along with the name-lookup
+/// criteria used to search for the name. On success, this structure
+/// will contain the results of name lookup.
+///
+/// \param S the scope in which name lookup occurs.
+///
+/// \param SS the nested-name-specifier that precedes the name we're
+/// looking for, if present.
+///
+/// \param MemberContext if non-NULL, the context in which to look for
+/// a member access expression.
+///
+/// \param EnteringContext whether we're entering the context described by
+/// the nested-name-specifier SS.
+///
+/// \returns true if the typo was corrected, in which case the \p Res
+/// structure will contain the results of name lookup for the
+/// corrected name. Otherwise, returns false.
+bool Sema::CorrectTypo(LookupResult &Res, Scope *S, const CXXScopeSpec *SS,
+ DeclContext *MemberContext, bool EnteringContext) {
+ // We only attempt to correct typos for identifiers.
+ IdentifierInfo *Typo = Res.getLookupName().getAsIdentifierInfo();
+ if (!Typo)
+ return false;
+
+ // If the scope specifier itself was invalid, don't try to correct
+ // typos.
+ if (SS && SS->isInvalid())
+ return false;
+
+ // Never try to correct typos during template deduction or
+ // instantiation.
+ if (!ActiveTemplateInstantiations.empty())
+ return false;
+
+ TypoCorrectionConsumer Consumer(Typo);
+ if (MemberContext)
+ LookupVisibleDecls(MemberContext, Res.getLookupKind(), Consumer);
+ else if (SS && SS->isSet()) {
+ DeclContext *DC = computeDeclContext(*SS, EnteringContext);
+ if (!DC)
+ return false;
+
+ LookupVisibleDecls(DC, Res.getLookupKind(), Consumer);
+ } else {
+ LookupVisibleDecls(S, Res.getLookupKind(), Consumer);
+ }
+
+ if (Consumer.empty())
+ return false;
+
+ // Only allow a single, closest name in the result set (it's okay to
+ // have overloads of that name, though).
+ TypoCorrectionConsumer::iterator I = Consumer.begin();
+ DeclarationName BestName = (*I)->getDeclName();
+ ++I;
+ for(TypoCorrectionConsumer::iterator IEnd = Consumer.end(); I != IEnd; ++I) {
+ if (BestName != (*I)->getDeclName())
+ return false;
+ }
+
+ // BestName is the closest viable name to what the user
+ // typed. However, to make sure that we don't pick something that's
+ // way off, make sure that the user typed at least 3 characters for
+ // each correction.
+ unsigned ED = Consumer.getBestEditDistance();
+ if (ED == 0 || (BestName.getAsIdentifierInfo()->getName().size() / ED) < 3)
+ return false;
+
+ // Perform name lookup again with the name we chose, and declare
+ // success if we found something that was not ambiguous.
+ Res.clear();
+ Res.setLookupName(BestName);
+ if (MemberContext)
+ LookupQualifiedName(Res, MemberContext);
+ else
+ LookupParsedName(Res, S, SS, /*AllowBuiltinCreation=*/false,
+ EnteringContext);
+
+ if (Res.isAmbiguous()) {
+ Res.suppressDiagnostics();
+ return false;
+ }
+
+ return Res.getResultKind() != LookupResult::NotFound;
+}
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 561cfdb52e0b..589208173669 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -13,6 +13,7 @@
#include "Sema.h"
#include "Lookup.h"
+#include "SemaInit.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/AST/ASTContext.h"
@@ -88,7 +89,7 @@ ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind) {
/// GetImplicitConversionName - Return the name of this kind of
/// implicit conversion.
const char* GetImplicitConversionName(ImplicitConversionKind Kind) {
- static const char* Name[(int)ICK_Num_Conversion_Kinds] = {
+ static const char* const Name[(int)ICK_Num_Conversion_Kinds] = {
"No conversion",
"Lvalue-to-rvalue",
"Array-to-pointer",
@@ -451,7 +452,8 @@ Sema::TryImplicitConversion(Expr* From, QualType ToType,
QualType FromCanon
= Context.getCanonicalType(From->getType().getUnqualifiedType());
QualType ToCanon = Context.getCanonicalType(ToType).getUnqualifiedType();
- if (FromCanon == ToCanon || IsDerivedFrom(FromCanon, ToCanon)) {
+ if (Constructor->isCopyConstructor() &&
+ (FromCanon == ToCanon || IsDerivedFrom(FromCanon, ToCanon))) {
// Turn this into a "standard" conversion sequence, so that it
// gets ranked with standard conversion sequences.
ICS.ConversionKind = ImplicitConversionSequence::StandardConversion;
@@ -915,6 +917,25 @@ BuildSimilarlyQualifiedPointerType(const PointerType *FromPtr,
Quals));
}
+/// BuildSimilarlyQualifiedObjCObjectPointerType - In a pointer conversion from
+/// the FromType, which is an objective-c pointer, to ToType, which may or may
+/// not have the right set of qualifiers.
+static QualType
+BuildSimilarlyQualifiedObjCObjectPointerType(QualType FromType,
+ QualType ToType,
+ ASTContext &Context) {
+ QualType CanonFromType = Context.getCanonicalType(FromType);
+ QualType CanonToType = Context.getCanonicalType(ToType);
+ Qualifiers Quals = CanonFromType.getQualifiers();
+
+ // Exact qualifier match -> return the pointer type we're converting to.
+ if (CanonToType.getLocalQualifiers() == Quals)
+ return ToType;
+
+ // Just build a canonical type that has the right qualifiers.
+ return Context.getQualifiedType(CanonToType.getLocalUnqualifiedType(), Quals);
+}
+
static bool isNullPointerConstantForConversion(Expr *Expr,
bool InOverloadResolution,
ASTContext &Context) {
@@ -992,13 +1013,20 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
return true;
}
- // Beyond this point, both types need to be pointers.
+ // Beyond this point, both types need to be pointers
+ // , including objective-c pointers.
+ QualType ToPointeeType = ToTypePtr->getPointeeType();
+ if (FromType->isObjCObjectPointerType() && ToPointeeType->isVoidType()) {
+ ConvertedType = BuildSimilarlyQualifiedObjCObjectPointerType(FromType,
+ ToType, Context);
+ return true;
+
+ }
const PointerType *FromTypePtr = FromType->getAs<PointerType>();
if (!FromTypePtr)
return false;
QualType FromPointeeType = FromTypePtr->getPointeeType();
- QualType ToPointeeType = ToTypePtr->getPointeeType();
// An rvalue of type "pointer to cv T," where T is an object type,
// can be converted to an rvalue of type "pointer to cv void" (C++
@@ -1774,7 +1802,16 @@ Sema::CompareStandardConversionSequences(const StandardConversionSequence& SCS1,
QualType T2 = QualType::getFromOpaquePtr(SCS2.ToTypePtr);
T1 = Context.getCanonicalType(T1);
T2 = Context.getCanonicalType(T2);
- if (Context.hasSameUnqualifiedType(T1, T2)) {
+ Qualifiers T1Quals, T2Quals;
+ QualType UnqualT1 = Context.getUnqualifiedArrayType(T1, T1Quals);
+ QualType UnqualT2 = Context.getUnqualifiedArrayType(T2, T2Quals);
+ if (UnqualT1 == UnqualT2) {
+ // If the type is an array type, promote the element qualifiers to the type
+ // for comparison.
+ if (isa<ArrayType>(T1) && T1Quals)
+ T1 = Context.getQualifiedType(UnqualT1, T1Quals);
+ if (isa<ArrayType>(T2) && T2Quals)
+ T2 = Context.getQualifiedType(UnqualT2, T2Quals);
if (T2.isMoreQualifiedThan(T1))
return ImplicitConversionSequence::Better;
else if (T1.isMoreQualifiedThan(T2))
@@ -1807,12 +1844,22 @@ Sema::CompareQualificationConversions(const StandardConversionSequence& SCS1,
QualType T2 = QualType::getFromOpaquePtr(SCS2.ToTypePtr);
T1 = Context.getCanonicalType(T1);
T2 = Context.getCanonicalType(T2);
+ Qualifiers T1Quals, T2Quals;
+ QualType UnqualT1 = Context.getUnqualifiedArrayType(T1, T1Quals);
+ QualType UnqualT2 = Context.getUnqualifiedArrayType(T2, T2Quals);
// If the types are the same, we won't learn anything by unwrapped
// them.
- if (Context.hasSameUnqualifiedType(T1, T2))
+ if (UnqualT1 == UnqualT2)
return ImplicitConversionSequence::Indistinguishable;
+ // If the type is an array type, promote the element qualifiers to the type
+ // for comparison.
+ if (isa<ArrayType>(T1) && T1Quals)
+ T1 = Context.getQualifiedType(UnqualT1, T1Quals);
+ if (isa<ArrayType>(T2) && T2Quals)
+ T2 = Context.getQualifiedType(UnqualT2, T2Quals);
+
ImplicitConversionSequence::CompareKind Result
= ImplicitConversionSequence::Indistinguishable;
while (UnwrapSimilarPointerTypes(T1, T2)) {
@@ -2080,7 +2127,7 @@ Sema::TryCopyInitialization(Expr *From, QualType ToType,
/// be true when the copy may be elided (C++ 12.8p15). Overload resolution works
/// differently in C++0x for this case.
bool Sema::PerformCopyInitialization(Expr *&From, QualType ToType,
- const char* Flavor, bool Elidable) {
+ AssignmentAction Action, bool Elidable) {
if (!getLangOptions().CPlusPlus) {
// In C, argument passing is the same as performing an assignment.
QualType FromType = From->getType();
@@ -2092,7 +2139,7 @@ bool Sema::PerformCopyInitialization(Expr *&From, QualType ToType,
ConvTy = Compatible;
return DiagnoseAssignmentResult(ConvTy, From->getLocStart(), ToType,
- FromType, From, Flavor);
+ FromType, From, Action);
}
if (ToType->isReferenceType())
@@ -2102,13 +2149,13 @@ bool Sema::PerformCopyInitialization(Expr *&From, QualType ToType,
/*AllowExplicit=*/false,
/*ForceRValue=*/false);
- if (!PerformImplicitConversion(From, ToType, Flavor,
+ if (!PerformImplicitConversion(From, ToType, Action,
/*AllowExplicit=*/false, Elidable))
return false;
if (!DiagnoseMultipleUserDefinedConversion(From, ToType))
return Diag(From->getSourceRange().getBegin(),
diag::err_typecheck_convert_incompatible)
- << ToType << From->getType() << Flavor << From->getSourceRange();
+ << ToType << From->getType() << Action << From->getSourceRange();
return true;
}
@@ -2229,7 +2276,7 @@ ImplicitConversionSequence Sema::TryContextuallyConvertToBool(Expr *From) {
/// of the expression From to bool (C++0x [conv]p3).
bool Sema::PerformContextuallyConvertToBool(Expr *&From) {
ImplicitConversionSequence ICS = TryContextuallyConvertToBool(From);
- if (!PerformImplicitConversion(From, Context.BoolTy, ICS, "converting"))
+ if (!PerformImplicitConversion(From, Context.BoolTy, ICS, AA_Converting))
return false;
if (!DiagnoseMultipleUserDefinedConversion(From, Context.BoolTy))
@@ -2622,7 +2669,14 @@ Sema::AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate,
Args, NumArgs, Specialization, Info)) {
// FIXME: Record what happened with template argument deduction, so
// that we can give the user a beautiful diagnostic.
- (void)Result;
+ (void) Result;
+
+ CandidateSet.push_back(OverloadCandidate());
+ OverloadCandidate &Candidate = CandidateSet.back();
+ Candidate.Function = FunctionTemplate->getTemplatedDecl();
+ Candidate.Viable = false;
+ Candidate.IsSurrogate = false;
+ Candidate.IgnoreObjectArgument = false;
return;
}
@@ -4430,6 +4484,9 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
bool FoundNonTemplateFunction = false;
for (llvm::SmallVectorImpl<NamedDecl*>::iterator I = Fns.begin(),
E = Fns.end(); I != E; ++I) {
+ // Look through any using declarations to find the underlying function.
+ NamedDecl *Fn = (*I)->getUnderlyingDecl();
+
// C++ [over.over]p3:
// Non-member functions and static member functions match
// targets of type "pointer-to-function" or "reference-to-function."
@@ -4438,7 +4495,7 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
// Note that according to DR 247, the containing class does not matter.
if (FunctionTemplateDecl *FunctionTemplate
- = dyn_cast<FunctionTemplateDecl>(*I)) {
+ = dyn_cast<FunctionTemplateDecl>(Fn)) {
if (CXXMethodDecl *Method
= dyn_cast<CXXMethodDecl>(FunctionTemplate->getTemplatedDecl())) {
// Skip non-static function templates when converting to pointer, and
@@ -4475,7 +4532,7 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
continue;
}
- if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(*I)) {
+ if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Fn)) {
// Skip non-static functions when converting to pointer, and static
// when converting to member pointer.
if (Method->isStatic() == IsMember)
@@ -4487,7 +4544,7 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
} else if (IsMember)
continue;
- if (FunctionDecl *FunDecl = dyn_cast<FunctionDecl>(*I)) {
+ if (FunctionDecl *FunDecl = dyn_cast<FunctionDecl>(Fn)) {
QualType ResultTy;
if (Context.hasSameUnqualifiedType(FunctionType, FunDecl->getType()) ||
IsNoReturnConversion(Context, FunDecl->getType(), FunctionType,
@@ -4558,6 +4615,93 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
return 0;
}
+/// \brief Given an expression that refers to an overloaded function, try to
+/// resolve that overloaded function expression down to a single function.
+///
+/// This routine can only resolve template-ids that refer to a single function
+/// template, where that template-id refers to a single template whose template
+/// arguments are either provided by the template-id or have defaults,
+/// as described in C++0x [temp.arg.explicit]p3.
+FunctionDecl *Sema::ResolveSingleFunctionTemplateSpecialization(Expr *From) {
+ // C++ [over.over]p1:
+ // [...] [Note: any redundant set of parentheses surrounding the
+ // overloaded function name is ignored (5.1). ]
+ Expr *OvlExpr = From->IgnoreParens();
+
+ // C++ [over.over]p1:
+ // [...] The overloaded function name can be preceded by the &
+ // operator.
+ if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(OvlExpr)) {
+ if (UnOp->getOpcode() == UnaryOperator::AddrOf)
+ OvlExpr = UnOp->getSubExpr()->IgnoreParens();
+ }
+
+ bool HasExplicitTemplateArgs = false;
+ TemplateArgumentListInfo ExplicitTemplateArgs;
+
+ llvm::SmallVector<NamedDecl*,8> Fns;
+
+ // Look into the overloaded expression.
+ if (UnresolvedLookupExpr *UL
+ = dyn_cast<UnresolvedLookupExpr>(OvlExpr)) {
+ Fns.append(UL->decls_begin(), UL->decls_end());
+ if (UL->hasExplicitTemplateArgs()) {
+ HasExplicitTemplateArgs = true;
+ UL->copyTemplateArgumentsInto(ExplicitTemplateArgs);
+ }
+ } else if (UnresolvedMemberExpr *ME
+ = dyn_cast<UnresolvedMemberExpr>(OvlExpr)) {
+ Fns.append(ME->decls_begin(), ME->decls_end());
+ if (ME->hasExplicitTemplateArgs()) {
+ HasExplicitTemplateArgs = true;
+ ME->copyTemplateArgumentsInto(ExplicitTemplateArgs);
+ }
+ }
+
+ // If we didn't actually find any template-ids, we're done.
+ if (Fns.empty() || !HasExplicitTemplateArgs)
+ return 0;
+
+ // Look through all of the overloaded functions, searching for one
+ // whose type matches exactly.
+ FunctionDecl *Matched = 0;
+ for (llvm::SmallVectorImpl<NamedDecl*>::iterator I = Fns.begin(),
+ E = Fns.end(); I != E; ++I) {
+ // C++0x [temp.arg.explicit]p3:
+ // [...] In contexts where deduction is done and fails, or in contexts
+ // where deduction is not done, if a template argument list is
+ // specified and it, along with any default template arguments,
+ // identifies a single function template specialization, then the
+ // template-id is an lvalue for the function template specialization.
+ FunctionTemplateDecl *FunctionTemplate = cast<FunctionTemplateDecl>(*I);
+
+ // C++ [over.over]p2:
+ // If the name is a function template, template argument deduction is
+ // done (14.8.2.2), and if the argument deduction succeeds, the
+ // resulting template argument list is used to generate a single
+ // function template specialization, which is added to the set of
+ // overloaded functions considered.
+ // FIXME: We don't really want to build the specialization here, do we?
+ FunctionDecl *Specialization = 0;
+ TemplateDeductionInfo Info(Context);
+ if (TemplateDeductionResult Result
+ = DeduceTemplateArguments(FunctionTemplate, &ExplicitTemplateArgs,
+ Specialization, Info)) {
+ // FIXME: make a note of the failed deduction for diagnostics.
+ (void)Result;
+ continue;
+ }
+
+ // Multiple matches; we can't resolve to a single declaration.
+ if (Matched)
+ return 0;
+
+ Matched = Specialization;
+ }
+
+ return Matched;
+}
+
/// \brief Add a single candidate to the overload set.
static void AddOverloadedCallCandidate(Sema &S,
NamedDecl *Callee,
@@ -4589,10 +4733,7 @@ static void AddOverloadedCallCandidate(Sema &S,
/// \brief Add the overload candidates named by callee and/or found by argument
/// dependent lookup to the given overload set.
-void Sema::AddOverloadedCallCandidates(llvm::SmallVectorImpl<NamedDecl*> &Fns,
- DeclarationName &UnqualifiedName,
- bool ArgumentDependentLookup,
- const TemplateArgumentListInfo *ExplicitTemplateArgs,
+void Sema::AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
Expr **Args, unsigned NumArgs,
OverloadCandidateSet &CandidateSet,
bool PartialOverloading) {
@@ -4615,28 +4756,99 @@ void Sema::AddOverloadedCallCandidates(llvm::SmallVectorImpl<NamedDecl*> &Fns,
//
// then Y is empty.
- if (ArgumentDependentLookup) {
- for (unsigned I = 0; I < Fns.size(); ++I) {
- assert(!Fns[I]->getDeclContext()->isRecord());
- assert(isa<UsingShadowDecl>(Fns[I]) ||
- !Fns[I]->getDeclContext()->isFunctionOrMethod());
- assert(Fns[I]->getUnderlyingDecl()->isFunctionOrFunctionTemplate());
+ if (ULE->requiresADL()) {
+ for (UnresolvedLookupExpr::decls_iterator I = ULE->decls_begin(),
+ E = ULE->decls_end(); I != E; ++I) {
+ assert(!(*I)->getDeclContext()->isRecord());
+ assert(isa<UsingShadowDecl>(*I) ||
+ !(*I)->getDeclContext()->isFunctionOrMethod());
+ assert((*I)->getUnderlyingDecl()->isFunctionOrFunctionTemplate());
}
}
#endif
- for (llvm::SmallVectorImpl<NamedDecl*>::iterator I = Fns.begin(),
- E = Fns.end(); I != E; ++I)
+ // It would be nice to avoid this copy.
+ TemplateArgumentListInfo TABuffer;
+ const TemplateArgumentListInfo *ExplicitTemplateArgs = 0;
+ if (ULE->hasExplicitTemplateArgs()) {
+ ULE->copyTemplateArgumentsInto(TABuffer);
+ ExplicitTemplateArgs = &TABuffer;
+ }
+
+ for (UnresolvedLookupExpr::decls_iterator I = ULE->decls_begin(),
+ E = ULE->decls_end(); I != E; ++I)
AddOverloadedCallCandidate(*this, *I, ExplicitTemplateArgs,
Args, NumArgs, CandidateSet,
PartialOverloading);
- if (ArgumentDependentLookup)
- AddArgumentDependentLookupCandidates(UnqualifiedName, Args, NumArgs,
+ if (ULE->requiresADL())
+ AddArgumentDependentLookupCandidates(ULE->getName(), Args, NumArgs,
ExplicitTemplateArgs,
CandidateSet,
PartialOverloading);
}
+
+static Sema::OwningExprResult Destroy(Sema &SemaRef, Expr *Fn,
+ Expr **Args, unsigned NumArgs) {
+ Fn->Destroy(SemaRef.Context);
+ for (unsigned Arg = 0; Arg < NumArgs; ++Arg)
+ Args[Arg]->Destroy(SemaRef.Context);
+ return SemaRef.ExprError();
+}
+
+/// Attempts to recover from a call where no functions were found.
+///
+/// Returns true if new candidates were found.
+static Sema::OwningExprResult
+BuildRecoveryCallExpr(Sema &SemaRef, Expr *Fn,
+ UnresolvedLookupExpr *ULE,
+ SourceLocation LParenLoc,
+ Expr **Args, unsigned NumArgs,
+ SourceLocation *CommaLocs,
+ SourceLocation RParenLoc) {
+
+ CXXScopeSpec SS;
+ if (ULE->getQualifier()) {
+ SS.setScopeRep(ULE->getQualifier());
+ SS.setRange(ULE->getQualifierRange());
+ }
+
+ TemplateArgumentListInfo TABuffer;
+ const TemplateArgumentListInfo *ExplicitTemplateArgs = 0;
+ if (ULE->hasExplicitTemplateArgs()) {
+ ULE->copyTemplateArgumentsInto(TABuffer);
+ ExplicitTemplateArgs = &TABuffer;
+ }
+
+ LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
+ Sema::LookupOrdinaryName);
+ if (SemaRef.DiagnoseEmptyLookup(/*Scope=*/0, SS, R))
+ return Destroy(SemaRef, Fn, Args, NumArgs);
+
+ assert(!R.empty() && "lookup results empty despite recovery");
+
+ // Build an implicit member call if appropriate. Just drop the
+ // casts and such from the call, we don't really care.
+ Sema::OwningExprResult NewFn = SemaRef.ExprError();
+ if ((*R.begin())->isCXXClassMember())
+ NewFn = SemaRef.BuildPossibleImplicitMemberExpr(SS, R, ExplicitTemplateArgs);
+ else if (ExplicitTemplateArgs)
+ NewFn = SemaRef.BuildTemplateIdExpr(SS, R, false, *ExplicitTemplateArgs);
+ else
+ NewFn = SemaRef.BuildDeclarationNameExpr(SS, R, false);
+
+ if (NewFn.isInvalid())
+ return Destroy(SemaRef, Fn, Args, NumArgs);
+
+ Fn->Destroy(SemaRef.Context);
+
+ // This shouldn't cause an infinite loop because we're giving it
+ // an expression with non-empty lookup results, which should never
+ // end up here.
+ return SemaRef.ActOnCallExpr(/*Scope*/ 0, move(NewFn), LParenLoc,
+ Sema::MultiExprArg(SemaRef, (void**) Args, NumArgs),
+ CommaLocs, RParenLoc);
+}
/// ResolveOverloadedCallFn - Given the call expression that calls Fn
/// (which eventually refers to the declaration Func) and the call
@@ -4645,44 +4857,68 @@ void Sema::AddOverloadedCallCandidates(llvm::SmallVectorImpl<NamedDecl*> &Fns,
/// the function declaration produced by overload
/// resolution. Otherwise, emits diagnostics, deletes all of the
/// arguments and Fn, and returns NULL.
-FunctionDecl *Sema::ResolveOverloadedCallFn(Expr *Fn,
- llvm::SmallVectorImpl<NamedDecl*> &Fns,
- DeclarationName UnqualifiedName,
- const TemplateArgumentListInfo *ExplicitTemplateArgs,
- SourceLocation LParenLoc,
- Expr **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
- SourceLocation RParenLoc,
- bool ArgumentDependentLookup) {
+Sema::OwningExprResult
+Sema::BuildOverloadedCallExpr(Expr *Fn, UnresolvedLookupExpr *ULE,
+ SourceLocation LParenLoc,
+ Expr **Args, unsigned NumArgs,
+ SourceLocation *CommaLocs,
+ SourceLocation RParenLoc) {
+#ifndef NDEBUG
+ if (ULE->requiresADL()) {
+ // To do ADL, we must have found an unqualified name.
+ assert(!ULE->getQualifier() && "qualified name with ADL");
+
+ // We don't perform ADL for implicit declarations of builtins.
+ // Verify that this was correctly set up.
+ FunctionDecl *F;
+ if (ULE->decls_begin() + 1 == ULE->decls_end() &&
+ (F = dyn_cast<FunctionDecl>(*ULE->decls_begin())) &&
+ F->getBuiltinID() && F->isImplicit())
+ assert(0 && "performing ADL for builtin");
+
+ // We don't perform ADL in C.
+ assert(getLangOptions().CPlusPlus && "ADL enabled in C");
+ }
+#endif
+
OverloadCandidateSet CandidateSet;
- // Add the functions denoted by Callee to the set of candidate
- // functions.
- AddOverloadedCallCandidates(Fns, UnqualifiedName, ArgumentDependentLookup,
- ExplicitTemplateArgs, Args, NumArgs,
- CandidateSet);
+ // Add the functions denoted by the callee to the set of candidate
+ // functions, including those from argument-dependent lookup.
+ AddOverloadedCallCandidates(ULE, Args, NumArgs, CandidateSet);
+
+ // If we found nothing, try to recover.
+ // AddRecoveryCallCandidates diagnoses the error itself, so we just
+ // bailout out if it fails.
+ if (CandidateSet.empty())
+ return BuildRecoveryCallExpr(*this, Fn, ULE, LParenLoc, Args, NumArgs,
+ CommaLocs, RParenLoc);
+
OverloadCandidateSet::iterator Best;
switch (BestViableFunction(CandidateSet, Fn->getLocStart(), Best)) {
- case OR_Success:
- return Best->Function;
+ case OR_Success: {
+ FunctionDecl *FDecl = Best->Function;
+ Fn = FixOverloadedFunctionReference(Fn, FDecl);
+ return BuildResolvedCallExpr(Fn, FDecl, LParenLoc, Args, NumArgs, RParenLoc);
+ }
case OR_No_Viable_Function:
Diag(Fn->getSourceRange().getBegin(),
diag::err_ovl_no_viable_function_in_call)
- << UnqualifiedName << Fn->getSourceRange();
+ << ULE->getName() << Fn->getSourceRange();
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
break;
case OR_Ambiguous:
Diag(Fn->getSourceRange().getBegin(), diag::err_ovl_ambiguous_call)
- << UnqualifiedName << Fn->getSourceRange();
+ << ULE->getName() << Fn->getSourceRange();
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
break;
case OR_Deleted:
Diag(Fn->getSourceRange().getBegin(), diag::err_ovl_deleted_call)
<< Best->Function->isDeleted()
- << UnqualifiedName
+ << ULE->getName()
<< Fn->getSourceRange();
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
break;
@@ -4693,7 +4929,7 @@ FunctionDecl *Sema::ResolveOverloadedCallFn(Expr *Fn,
Fn->Destroy(Context);
for (unsigned Arg = 0; Arg < NumArgs; ++Arg)
Args[Arg]->Destroy(Context);
- return 0;
+ return ExprError();
}
static bool IsOverloaded(const Sema::FunctionSet &Functions) {
@@ -4787,10 +5023,16 @@ Sema::OwningExprResult Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc,
return ExprError();
} else {
// Convert the arguments.
- if (PerformCopyInitialization(Input,
- FnDecl->getParamDecl(0)->getType(),
- "passing"))
+ OwningExprResult InputInit
+ = PerformCopyInitialization(InitializedEntity::InitializeParameter(
+ FnDecl->getParamDecl(0)),
+ SourceLocation(),
+ move(input));
+ if (InputInit.isInvalid())
return ExprError();
+
+ input = move(InputInit);
+ Input = (Expr *)input.get();
}
// Determine the result type
@@ -4817,7 +5059,7 @@ Sema::OwningExprResult Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc,
// break out so that we will build the appropriate built-in
// operator node.
if (PerformImplicitConversion(Input, Best->BuiltinTypes.ParamTypes[0],
- Best->Conversions[0], "passing"))
+ Best->Conversions[0], AA_Passing))
return ExprError();
break;
@@ -4954,17 +5196,40 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// Convert the arguments.
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FnDecl)) {
- if (PerformObjectArgumentInitialization(Args[0], Method) ||
- PerformCopyInitialization(Args[1], FnDecl->getParamDecl(0)->getType(),
- "passing"))
+ OwningExprResult Arg1
+ = PerformCopyInitialization(
+ InitializedEntity::InitializeParameter(
+ FnDecl->getParamDecl(0)),
+ SourceLocation(),
+ Owned(Args[1]));
+ if (Arg1.isInvalid())
+ return ExprError();
+
+ if (PerformObjectArgumentInitialization(Args[0], Method))
return ExprError();
+
+ Args[1] = RHS = Arg1.takeAs<Expr>();
} else {
// Convert the arguments.
- if (PerformCopyInitialization(Args[0], FnDecl->getParamDecl(0)->getType(),
- "passing") ||
- PerformCopyInitialization(Args[1], FnDecl->getParamDecl(1)->getType(),
- "passing"))
+ OwningExprResult Arg0
+ = PerformCopyInitialization(
+ InitializedEntity::InitializeParameter(
+ FnDecl->getParamDecl(0)),
+ SourceLocation(),
+ Owned(Args[0]));
+ if (Arg0.isInvalid())
+ return ExprError();
+
+ OwningExprResult Arg1
+ = PerformCopyInitialization(
+ InitializedEntity::InitializeParameter(
+ FnDecl->getParamDecl(1)),
+ SourceLocation(),
+ Owned(Args[1]));
+ if (Arg1.isInvalid())
return ExprError();
+ Args[0] = LHS = Arg0.takeAs<Expr>();
+ Args[1] = RHS = Arg1.takeAs<Expr>();
}
// Determine the result type
@@ -4992,9 +5257,9 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// break out so that we will build the appropriate built-in
// operator node.
if (PerformImplicitConversion(Args[0], Best->BuiltinTypes.ParamTypes[0],
- Best->Conversions[0], "passing") ||
+ Best->Conversions[0], AA_Passing) ||
PerformImplicitConversion(Args[1], Best->BuiltinTypes.ParamTypes[1],
- Best->Conversions[1], "passing"))
+ Best->Conversions[1], AA_Passing))
return ExprError();
break;
@@ -5106,7 +5371,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
if (PerformObjectArgumentInitialization(Args[0], Method) ||
PerformCopyInitialization(Args[1],
FnDecl->getParamDecl(0)->getType(),
- "passing"))
+ AA_Passing))
return ExprError();
// Determine the result type
@@ -5136,9 +5401,9 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
// break out so that we will build the appropriate built-in
// operator node.
if (PerformImplicitConversion(Args[0], Best->BuiltinTypes.ParamTypes[0],
- Best->Conversions[0], "passing") ||
+ Best->Conversions[0], AA_Passing) ||
PerformImplicitConversion(Args[1], Best->BuiltinTypes.ParamTypes[1],
- Best->Conversions[1], "passing"))
+ Best->Conversions[1], AA_Passing))
return ExprError();
break;
@@ -5522,7 +5787,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
// Pass the argument.
QualType ProtoArgType = Proto->getArgType(i);
- IsError |= PerformCopyInitialization(Arg, ProtoArgType, "passing");
+ IsError |= PerformCopyInitialization(Arg, ProtoArgType, AA_Passing);
} else {
OwningExprResult DefArg
= BuildCXXDefaultArgExpr(LParenLoc, Method, Method->getParamDecl(i));
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index de67a5f1a75f..b8928c36e7b8 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "Sema.h"
+#include "SemaInit.h"
#include "clang/AST/APValue.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
@@ -95,7 +96,7 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S) {
if (const CallExpr *CE = dyn_cast<CallExpr>(E)) {
// If the callee has attribute pure, const, or warn_unused_result, warn with
// a more specific message to make it clear what is happening.
- if (const FunctionDecl *FD = CE->getDirectCallee()) {
+ if (const Decl *FD = CE->getCalleeDecl()) {
if (FD->getAttr<WarnUnusedResultAttr>()) {
Diag(Loc, diag::warn_unused_call) << R1 << R2 << "warn_unused_result";
return;
@@ -902,7 +903,7 @@ Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc,
AssignConvertType ConvTy =
CheckSingleAssignmentConstraints(Context.VoidPtrTy, E);
if (DiagnoseAssignmentResult(ConvTy, StarLoc, Context.VoidPtrTy, ETy,
- E, "passing"))
+ E, AA_Passing))
return StmtError();
}
return Owned(new (Context) IndirectGotoStmt(GotoLoc, StarLoc, E));
@@ -977,7 +978,6 @@ Sema::ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
if (!FnRetType->isDependentType() && !RetValExp->isTypeDependent()) {
// we have a non-void block with an expression, continue checking
- QualType RetValType = RetValExp->getType();
// C99 6.8.6.4p3(136): The return statement is not an assignment. The
// overlap restriction of subclause 6.5.16.1 does not apply to the case of
@@ -986,7 +986,7 @@ Sema::ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
// In C++ the return statement is handled via a copy initialization.
// the C version of which boils down to CheckSingleAssignmentConstraints.
// FIXME: Leaks RetValExp.
- if (PerformCopyInitialization(RetValExp, FnRetType, "returning"))
+ if (PerformCopyInitialization(RetValExp, FnRetType, AA_Returning))
return StmtError();
if (RetValExp) CheckReturnStackAddr(RetValExp, FnRetType, ReturnLoc);
@@ -1053,7 +1053,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, ExprArg rex) {
<< RetValExp->getSourceRange();
}
- RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp, true);
+ RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp);
}
return Owned(new (Context) ReturnStmt(ReturnLoc, RetValExp));
}
@@ -1092,21 +1092,28 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, ExprArg rex) {
bool Elidable = getLangOptions().CPlusPlus0x ?
IsReturnCopyElidable(Context, FnRetType, RetValExp) :
false;
+ // FIXME: Elidable
+ (void)Elidable;
// In C++ the return statement is handled via a copy initialization.
// the C version of which boils down to CheckSingleAssignmentConstraints.
- // FIXME: Leaks RetValExp on error.
- if (PerformCopyInitialization(RetValExp, FnRetType, "returning", Elidable)){
- // We should still clean up our temporaries, even when we're failing!
- RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp, true);
+ OwningExprResult Res = PerformCopyInitialization(
+ InitializedEntity::InitializeResult(ReturnLoc,
+ FnRetType),
+ SourceLocation(),
+ Owned(RetValExp));
+ if (Res.isInvalid()) {
+ // FIXME: Cleanup temporaries here, anyway?
return StmtError();
}
-
- if (RetValExp) CheckReturnStackAddr(RetValExp, FnRetType, ReturnLoc);
+
+ RetValExp = Res.takeAs<Expr>();
+ if (RetValExp)
+ CheckReturnStackAddr(RetValExp, FnRetType, ReturnLoc);
}
if (RetValExp)
- RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp, true);
+ RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp);
return Owned(new (Context) ReturnStmt(ReturnLoc, RetValExp));
}
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index ac1b1ec0eed0..8c6aa6a7d4a9 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -102,7 +102,8 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
QualType ObjectType = QualType::getFromOpaquePtr(ObjectTypePtr);
- LookupResult R(*this, TName, SourceLocation(), LookupOrdinaryName);
+ LookupResult R(*this, TName, Name.getSourceRange().getBegin(),
+ LookupOrdinaryName);
R.suppressDiagnostics();
LookupTemplateName(R, S, SS, ObjectType, EnteringContext);
if (R.empty())
@@ -202,6 +203,29 @@ void Sema::LookupTemplateName(LookupResult &Found,
assert(!Found.isAmbiguous() &&
"Cannot handle template name-lookup ambiguities");
+ if (Found.empty()) {
+ // If we did not find any names, attempt to correct any typos.
+ DeclarationName Name = Found.getLookupName();
+ if (CorrectTypo(Found, S, &SS, LookupCtx)) {
+ FilterAcceptableTemplateNames(Context, Found);
+ if (!Found.empty() && isa<TemplateDecl>(*Found.begin())) {
+ if (LookupCtx)
+ Diag(Found.getNameLoc(), diag::err_no_member_template_suggest)
+ << Name << LookupCtx << Found.getLookupName() << SS.getRange()
+ << CodeModificationHint::CreateReplacement(Found.getNameLoc(),
+ Found.getLookupName().getAsString());
+ else
+ Diag(Found.getNameLoc(), diag::err_no_template_suggest)
+ << Name << Found.getLookupName()
+ << CodeModificationHint::CreateReplacement(Found.getNameLoc(),
+ Found.getLookupName().getAsString());
+ } else
+ Found.clear();
+ } else {
+ Found.clear();
+ }
+ }
+
FilterAcceptableTemplateNames(Context, Found);
if (Found.empty())
return;
@@ -691,7 +715,27 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
if (Previous.begin() != Previous.end())
PrevDecl = *Previous.begin();
- if (PrevDecl && TUK == TUK_Friend) {
+ // If there is a previous declaration with the same name, check
+ // whether this is a valid redeclaration.
+ ClassTemplateDecl *PrevClassTemplate
+ = dyn_cast_or_null<ClassTemplateDecl>(PrevDecl);
+
+ // We may have found the injected-class-name of a class template,
+ // class template partial specialization, or class template specialization.
+ // In these cases, grab the template that is being defined or specialized.
+ if (!PrevClassTemplate && PrevDecl && isa<CXXRecordDecl>(PrevDecl) &&
+ cast<CXXRecordDecl>(PrevDecl)->isInjectedClassName()) {
+ PrevDecl = cast<CXXRecordDecl>(PrevDecl->getDeclContext());
+ PrevClassTemplate
+ = cast<CXXRecordDecl>(PrevDecl)->getDescribedClassTemplate();
+ if (!PrevClassTemplate && isa<ClassTemplateSpecializationDecl>(PrevDecl)) {
+ PrevClassTemplate
+ = cast<ClassTemplateSpecializationDecl>(PrevDecl)
+ ->getSpecializedTemplate();
+ }
+ }
+
+ if (TUK == TUK_Friend) {
// C++ [namespace.memdef]p3:
// [...] When looking for a prior declaration of a class or a function
// declared as a friend, and when the name of the friend class or
@@ -700,15 +744,16 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
DeclContext *OutermostContext = CurContext;
while (!OutermostContext->isFileContext())
OutermostContext = OutermostContext->getLookupParent();
-
- if (OutermostContext->Equals(PrevDecl->getDeclContext()) ||
- OutermostContext->Encloses(PrevDecl->getDeclContext())) {
+
+ if (PrevDecl &&
+ (OutermostContext->Equals(PrevDecl->getDeclContext()) ||
+ OutermostContext->Encloses(PrevDecl->getDeclContext()))) {
SemanticContext = PrevDecl->getDeclContext();
} else {
// Declarations in outer scopes don't matter. However, the outermost
// context we computed is the semantic context for our new
// declaration.
- PrevDecl = 0;
+ PrevDecl = PrevClassTemplate = 0;
SemanticContext = OutermostContext;
}
@@ -717,30 +762,10 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
// class template to the template in scope, because that would perform
// checking of the template parameter lists that can't be performed
// until the outer context is instantiated.
- PrevDecl = 0;
+ PrevDecl = PrevClassTemplate = 0;
}
} else if (PrevDecl && !isDeclInScope(PrevDecl, SemanticContext, S))
- PrevDecl = 0;
-
- // If there is a previous declaration with the same name, check
- // whether this is a valid redeclaration.
- ClassTemplateDecl *PrevClassTemplate
- = dyn_cast_or_null<ClassTemplateDecl>(PrevDecl);
-
- // We may have found the injected-class-name of a class template,
- // class template partial specialization, or class template specialization.
- // In these cases, grab the template that is being defined or specialized.
- if (!PrevClassTemplate && PrevDecl && isa<CXXRecordDecl>(PrevDecl) &&
- cast<CXXRecordDecl>(PrevDecl)->isInjectedClassName()) {
- PrevDecl = cast<CXXRecordDecl>(PrevDecl->getDeclContext());
- PrevClassTemplate
- = cast<CXXRecordDecl>(PrevDecl)->getDescribedClassTemplate();
- if (!PrevClassTemplate && isa<ClassTemplateSpecializationDecl>(PrevDecl)) {
- PrevClassTemplate
- = cast<ClassTemplateSpecializationDecl>(PrevDecl)
- ->getSpecializedTemplate();
- }
- }
+ PrevDecl = PrevClassTemplate = 0;
if (PrevClassTemplate) {
// Ensure that the template parameter lists are compatible.
@@ -2188,6 +2213,9 @@ bool Sema::CheckTemplateArgument(TemplateTypeParmDecl *Param,
Diag(SR.getBegin(), diag::err_template_arg_unnamed_type) << SR;
Diag(Tag->getDecl()->getLocation(), diag::note_template_unnamed_type_here);
return true;
+ } else if (Context.hasSameUnqualifiedType(Arg, Context.OverloadTy)) {
+ SourceRange SR = ArgInfo->getTypeLoc().getFullSourceRange();
+ return Diag(SR.getBegin(), diag::err_template_arg_overload_type) << SR;
}
return false;
@@ -2484,7 +2512,14 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
// Check that we don't overflow the template parameter type.
unsigned AllowedBits = Context.getTypeSize(IntegerType);
- if (Value.getActiveBits() > AllowedBits) {
+ unsigned RequiredBits;
+ if (IntegerType->isUnsignedIntegerType())
+ RequiredBits = Value.getActiveBits();
+ else if (Value.isUnsigned())
+ RequiredBits = Value.getActiveBits() + 1;
+ else
+ RequiredBits = Value.getMinSignedBits();
+ if (RequiredBits > AllowedBits) {
Diag(Arg->getSourceRange().getBegin(),
diag::err_template_arg_too_large)
<< Value.toString(10) << Param->getType()
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index b4754db7d6b5..21f79963bd89 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -337,58 +337,6 @@ DeduceTemplateArguments(ASTContext &Context,
return Sema::TDK_Success;
}
-/// \brief Returns a completely-unqualified array type, capturing the
-/// qualifiers in Quals.
-///
-/// \param Context the AST context in which the array type was built.
-///
-/// \param T a canonical type that may be an array type.
-///
-/// \param Quals will receive the full set of qualifiers that were
-/// applied to the element type of the array.
-///
-/// \returns if \p T is an array type, the completely unqualified array type
-/// that corresponds to T. Otherwise, returns T.
-static QualType getUnqualifiedArrayType(ASTContext &Context, QualType T,
- Qualifiers &Quals) {
- assert(T.isCanonical() && "Only operates on canonical types");
- if (!isa<ArrayType>(T)) {
- Quals = T.getLocalQualifiers();
- return T.getLocalUnqualifiedType();
- }
-
- assert(!T.hasQualifiers() && "canonical array type has qualifiers!");
-
- if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(T)) {
- QualType Elt = getUnqualifiedArrayType(Context, CAT->getElementType(),
- Quals);
- if (Elt == CAT->getElementType())
- return T;
-
- return Context.getConstantArrayType(Elt, CAT->getSize(),
- CAT->getSizeModifier(), 0);
- }
-
- if (const IncompleteArrayType *IAT = dyn_cast<IncompleteArrayType>(T)) {
- QualType Elt = getUnqualifiedArrayType(Context, IAT->getElementType(),
- Quals);
- if (Elt == IAT->getElementType())
- return T;
-
- return Context.getIncompleteArrayType(Elt, IAT->getSizeModifier(), 0);
- }
-
- const DependentSizedArrayType *DSAT = cast<DependentSizedArrayType>(T);
- QualType Elt = getUnqualifiedArrayType(Context, DSAT->getElementType(),
- Quals);
- if (Elt == DSAT->getElementType())
- return T;
-
- return Context.getDependentSizedArrayType(Elt, DSAT->getSizeExpr()->Retain(),
- DSAT->getSizeModifier(), 0,
- SourceRange());
-}
-
/// \brief Deduce the template arguments by comparing the parameter type and
/// the argument type (C++ [temp.deduct.type]).
///
@@ -427,9 +375,11 @@ DeduceTemplateArguments(ASTContext &Context,
// referred to by the reference) can be more cv-qualified than the
// transformed A.
if (TDF & TDF_ParamWithReferenceType) {
- Qualifiers Quals = Param.getQualifiers();
- Quals.setCVRQualifiers(Quals.getCVRQualifiers() & Arg.getCVRQualifiers());
- Param = Context.getQualifiedType(Param.getUnqualifiedType(), Quals);
+ Qualifiers Quals;
+ QualType UnqualParam = Context.getUnqualifiedArrayType(Param, Quals);
+ Quals.setCVRQualifiers(Quals.getCVRQualifiers() &
+ Arg.getCVRQualifiersThroughArrayTypes());
+ Param = Context.getQualifiedType(UnqualParam, Quals);
}
// If the parameter type is not dependent, there is nothing to deduce.
@@ -459,7 +409,7 @@ DeduceTemplateArguments(ASTContext &Context,
// FIXME: address spaces, ObjC GC qualifiers
if (isa<ArrayType>(Arg)) {
Qualifiers Quals;
- Arg = getUnqualifiedArrayType(Context, Arg, Quals);
+ Arg = Context.getUnqualifiedArrayType(Arg, Quals);
if (Quals) {
Arg = Context.getQualifiedType(Arg, Quals);
RecanonicalizeArg = true;
@@ -476,7 +426,7 @@ DeduceTemplateArguments(ASTContext &Context,
}
assert(TemplateTypeParm->getDepth() == 0 && "Can't deduce with depth > 0");
-
+ assert(Arg != Context.OverloadTy && "Unresolved overloaded function");
QualType DeducedType = Arg;
DeducedType.removeCVRQualifiers(Param.getCVRQualifiers());
if (RecanonicalizeArg)
@@ -1506,15 +1456,39 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
ParamType->getAs<PointerType>()->getPointeeType())))
TDF |= TDF_DerivedClass;
+ // FIXME: C++0x [temp.deduct.call] paragraphs 6-9 deal with function
+ // pointer parameters.
+
+ if (Context.hasSameUnqualifiedType(ArgType, Context.OverloadTy)) {
+ // We know that template argument deduction will fail if the argument is
+ // still an overloaded function. Check whether we can resolve this
+ // argument as a single function template specialization per
+ // C++ [temp.arg.explicit]p3.
+ FunctionDecl *ExplicitSpec
+ = ResolveSingleFunctionTemplateSpecialization(Args[I]);
+ Expr *ResolvedArg = 0;
+ if (ExplicitSpec)
+ ResolvedArg = FixOverloadedFunctionReference(Args[I], ExplicitSpec);
+ if (!ExplicitSpec || !ResolvedArg) {
+ // Template argument deduction fails if we can't resolve the overloaded
+ // function.
+ return TDK_FailedOverloadResolution;
+ }
+
+ // Get the type of the resolved argument.
+ ArgType = ResolvedArg->getType();
+ if (ArgType->isPointerType() || ArgType->isMemberPointerType())
+ TDF |= TDF_IgnoreQualifiers;
+
+ ResolvedArg->Destroy(Context);
+ }
+
if (TemplateDeductionResult Result
= ::DeduceTemplateArguments(Context, TemplateParams,
ParamType, ArgType, Info, Deduced,
TDF))
return Result;
- // FIXME: C++0x [temp.deduct.call] paragraphs 6-9 deal with function
- // pointer parameters.
-
// FIXME: we need to check that the deduced A is the same as A,
// modulo the various allowed differences.
}
@@ -1524,24 +1498,19 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
}
/// \brief Deduce template arguments when taking the address of a function
-/// template (C++ [temp.deduct.funcaddr]) or matching a
+/// template (C++ [temp.deduct.funcaddr]) or matching a specialization to
+/// a template.
///
/// \param FunctionTemplate the function template for which we are performing
/// template argument deduction.
///
-/// \param HasExplicitTemplateArgs whether any template arguments were
-/// explicitly specified.
-///
-/// \param ExplicitTemplateArguments when @p HasExplicitTemplateArgs is true,
-/// the explicitly-specified template arguments.
-///
-/// \param NumExplicitTemplateArguments when @p HasExplicitTemplateArgs is true,
-/// the number of explicitly-specified template arguments in
-/// @p ExplicitTemplateArguments. This value may be zero.
+/// \param ExplicitTemplateArguments the explicitly-specified template
+/// arguments.
///
/// \param ArgFunctionType the function type that will be used as the
/// "argument" type (A) when performing template argument deduction from the
-/// function template's function type.
+/// function template's function type. This type may be NULL, if there is no
+/// argument type to compare against, in C++0x [temp.arg.explicit]p3.
///
/// \param Specialization if template argument deduction was successful,
/// this will be set to the function template specialization produced by
@@ -1578,14 +1547,16 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
// Trap any errors that might occur.
SFINAETrap Trap(*this);
- // Deduce template arguments from the function type.
- Deduced.resize(TemplateParams->size());
- if (TemplateDeductionResult Result
- = ::DeduceTemplateArguments(Context, TemplateParams,
- FunctionType, ArgFunctionType, Info,
- Deduced, 0))
- return Result;
-
+ if (!ArgFunctionType.isNull()) {
+ // Deduce template arguments from the function type.
+ Deduced.resize(TemplateParams->size());
+ if (TemplateDeductionResult Result
+ = ::DeduceTemplateArguments(Context, TemplateParams,
+ FunctionType, ArgFunctionType, Info,
+ Deduced, 0))
+ return Result;
+ }
+
return FinishTemplateArgumentDeduction(FunctionTemplate, Deduced,
Specialization, Info);
}
@@ -1694,6 +1665,32 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
return Result;
}
+/// \brief Deduce template arguments for a function template when there is
+/// nothing to deduce against (C++0x [temp.arg.explicit]p3).
+///
+/// \param FunctionTemplate the function template for which we are performing
+/// template argument deduction.
+///
+/// \param ExplicitTemplateArguments the explicitly-specified template
+/// arguments.
+///
+/// \param Specialization if template argument deduction was successful,
+/// this will be set to the function template specialization produced by
+/// template argument deduction.
+///
+/// \param Info the argument will be updated to provide additional information
+/// about template argument deduction.
+///
+/// \returns the result of template argument deduction.
+Sema::TemplateDeductionResult
+Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
+ const TemplateArgumentListInfo *ExplicitTemplateArgs,
+ FunctionDecl *&Specialization,
+ TemplateDeductionInfo &Info) {
+ return DeduceTemplateArguments(FunctionTemplate, ExplicitTemplateArgs,
+ QualType(), Specialization, Info);
+}
+
/// \brief Stores the result of comparing the qualifiers of two types.
enum DeductionQualifierComparison {
NeitherMoreQualified = 0,
@@ -2354,7 +2351,6 @@ MarkUsedTemplateParameters(Sema &SemaRef, QualType T,
// None of these types have any template parameters in them.
case Type::Builtin:
- case Type::FixedWidthInt:
case Type::VariableArray:
case Type::FunctionNoProto:
case Type::Record:
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index dddb93c87e3f..d974f89bc609 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -554,7 +554,6 @@ namespace {
Sema::OwningExprResult TransformPredefinedExpr(PredefinedExpr *E);
Sema::OwningExprResult TransformDeclRefExpr(DeclRefExpr *E);
-
Sema::OwningExprResult TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E);
/// \brief Transforms a template type parameter type by performing
@@ -785,7 +784,9 @@ Sema::OwningExprResult TemplateInstantiator::TransformCXXDefaultArgExpr(
assert(!cast<FunctionDecl>(E->getParam()->getDeclContext())->
getDescribedFunctionTemplate() &&
"Default arg expressions are never formed in dependent cases.");
- return SemaRef.Owned(E->Retain());
+ return SemaRef.BuildCXXDefaultArgExpr(E->getUsedLocation(),
+ cast<FunctionDecl>(E->getParam()->getDeclContext()),
+ E->getParam());
}
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 8d74bd76ca5c..e909c4f0b9b6 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -145,6 +145,11 @@ Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) {
if (Invalid)
Typedef->setInvalidDecl();
+ if (TypedefDecl *Prev = D->getPreviousDeclaration()) {
+ NamedDecl *InstPrev = SemaRef.FindInstantiatedDecl(Prev, TemplateArgs);
+ Typedef->setPreviousDeclaration(cast<TypedefDecl>(InstPrev));
+ }
+
Owner->addDecl(Typedef);
return Typedef;
@@ -396,7 +401,16 @@ Decl *TemplateDeclInstantiator::VisitFriendDecl(FriendDecl *D) {
// FIXME: We have a problem here, because the nested call to Visit(ND)
// will inject the thing that the friend references into the current
// owner, which is wrong.
- Decl *NewND = Visit(ND);
+ Decl *NewND;
+
+ // Hack to make this work almost well pending a rewrite.
+ if (ND->getDeclContext()->isRecord())
+ NewND = SemaRef.FindInstantiatedDecl(ND, TemplateArgs);
+ else if (D->wasSpecialization()) {
+ // Totally egregious hack to work around PR5866
+ return 0;
+ } else
+ NewND = Visit(ND);
if (!NewND) return 0;
FU = cast<NamedDecl>(NewND);
@@ -645,6 +659,12 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) {
CXXRecordDecl *PrevDecl = 0;
if (D->isInjectedClassName())
PrevDecl = cast<CXXRecordDecl>(Owner);
+ else if (D->getPreviousDeclaration()) {
+ NamedDecl *Prev = SemaRef.FindInstantiatedDecl(D->getPreviousDeclaration(),
+ TemplateArgs);
+ if (!Prev) return 0;
+ PrevDecl = cast<CXXRecordDecl>(Prev);
+ }
CXXRecordDecl *Record
= CXXRecordDecl::Create(SemaRef.Context, D->getTagKind(), Owner,
@@ -675,7 +695,7 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) {
/// 1) instantiating function templates
/// 2) substituting friend declarations
/// FIXME: preserve function definitions in case #2
- Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
+Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
TemplateParameterList *TemplateParams) {
// Check whether there is already a function template specialization for
// this declaration.
@@ -1149,6 +1169,8 @@ Decl *TemplateDeclInstantiator::VisitUsingDecl(UsingDecl *D) {
if (NewUD->isInvalidDecl())
return NewUD;
+ bool isFunctionScope = Owner->isFunctionOrMethod();
+
// Process the shadow decls.
for (UsingDecl::shadow_iterator I = D->shadow_begin(), E = D->shadow_end();
I != E; ++I) {
@@ -1164,6 +1186,9 @@ Decl *TemplateDeclInstantiator::VisitUsingDecl(UsingDecl *D) {
UsingShadowDecl *InstShadow
= SemaRef.BuildUsingShadowDecl(/*Scope*/ 0, NewUD, InstTarget);
SemaRef.Context.setInstantiatedFromUsingShadowDecl(InstShadow, Shadow);
+
+ if (isFunctionScope)
+ SemaRef.CurrentInstantiationScope->InstantiatedLocal(Shadow, InstShadow);
}
return NewUD;
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 37f19f2be4c6..ed30229e9523 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -308,7 +308,11 @@ static QualType ConvertDeclSpecToType(Declarator &TheDeclarator, Sema &TheSema){
Expr *E = static_cast<Expr *>(DS.getTypeRep());
assert(E && "Didn't get an expression for typeof?");
// TypeQuals handled by caller.
- Result = Context.getTypeOfExprType(E);
+ Result = TheSema.BuildTypeofExprType(E);
+ if (Result.isNull()) {
+ Result = Context.IntTy;
+ TheDeclarator.setInvalidType(true);
+ }
break;
}
case DeclSpec::TST_decltype: {
@@ -1826,14 +1830,41 @@ QualType Sema::getQualifiedNameType(const CXXScopeSpec &SS, QualType T) {
}
QualType Sema::BuildTypeofExprType(Expr *E) {
+ if (E->getType() == Context.OverloadTy) {
+ // C++ [temp.arg.explicit]p3 allows us to resolve a template-id to a
+ // function template specialization wherever deduction cannot occur.
+ if (FunctionDecl *Specialization
+ = ResolveSingleFunctionTemplateSpecialization(E)) {
+ E = FixOverloadedFunctionReference(E, Specialization);
+ if (!E)
+ return QualType();
+ } else {
+ Diag(E->getLocStart(),
+ diag::err_cannot_determine_declared_type_of_overloaded_function)
+ << false << E->getSourceRange();
+ return QualType();
+ }
+ }
+
return Context.getTypeOfExprType(E);
}
QualType Sema::BuildDecltypeType(Expr *E) {
if (E->getType() == Context.OverloadTy) {
- Diag(E->getLocStart(),
- diag::err_cannot_determine_declared_type_of_overloaded_function);
- return QualType();
+ // C++ [temp.arg.explicit]p3 allows us to resolve a template-id to a
+ // function template specialization wherever deduction cannot occur.
+ if (FunctionDecl *Specialization
+ = ResolveSingleFunctionTemplateSpecialization(E)) {
+ E = FixOverloadedFunctionReference(E, Specialization);
+ if (!E)
+ return QualType();
+ } else {
+ Diag(E->getLocStart(),
+ diag::err_cannot_determine_declared_type_of_overloaded_function)
+ << true << E->getSourceRange();
+ return QualType();
+ }
}
+
return Context.getDecltypeType(E);
}
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index fd1998734437..208c8851e596 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -956,8 +956,12 @@ public:
// We have a reference to an unnamed field.
assert(!Qualifier && "Can't have an unnamed field with a qualifier!");
+ Expr *BaseExpr = Base.takeAs<Expr>();
+ if (getSema().PerformObjectMemberConversion(BaseExpr, Member))
+ return getSema().ExprError();
+
MemberExpr *ME =
- new (getSema().Context) MemberExpr(Base.takeAs<Expr>(), isArrow,
+ new (getSema().Context) MemberExpr(BaseExpr, isArrow,
Member, MemberLoc,
cast<FieldDecl>(Member)->getType());
return getSema().Owned(ME);
@@ -1358,8 +1362,10 @@ public:
/// By default, builds a new default-argument expression, which does not
/// require any semantic analysis. Subclasses may override this routine to
/// provide different behavior.
- OwningExprResult RebuildCXXDefaultArgExpr(ParmVarDecl *Param) {
- return getSema().Owned(CXXDefaultArgExpr::Create(getSema().Context, Param));
+ OwningExprResult RebuildCXXDefaultArgExpr(SourceLocation Loc,
+ ParmVarDecl *Param) {
+ return getSema().Owned(CXXDefaultArgExpr::Create(getSema().Context, Loc,
+ Param));
}
/// \brief Build a new C++ zero-initialization expression.
@@ -1655,7 +1661,7 @@ Sema::OwningStmtResult TreeTransform<Derived>::TransformStmt(Stmt *S) {
if (E.isInvalid())
return getSema().StmtError();
- return getSema().ActOnExprStmt(getSema().FullExpr(E));
+ return getSema().ActOnExprStmt(getSema().MakeFullExpr(E));
}
}
@@ -2128,13 +2134,6 @@ QualType TreeTransform<Derived>::TransformBuiltinType(TypeLocBuilder &TLB,
}
template<typename Derived>
-QualType
-TreeTransform<Derived>::TransformFixedWidthIntType(TypeLocBuilder &TLB,
- FixedWidthIntTypeLoc T) {
- return TransformTypeSpecType(TLB, T);
-}
-
-template<typename Derived>
QualType TreeTransform<Derived>::TransformComplexType(TypeLocBuilder &TLB,
ComplexTypeLoc T) {
// FIXME: recurse?
@@ -3067,7 +3066,7 @@ TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
return SemaRef.StmtError();
}
- Sema::FullExprArg FullCond(getSema().FullExpr(Cond));
+ Sema::FullExprArg FullCond(getSema().MakeFullExpr(Cond));
// Transform the "then" branch.
OwningStmtResult Then = getDerived().TransformStmt(S->getThen());
@@ -3110,7 +3109,7 @@ TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
return SemaRef.StmtError();
}
- Sema::FullExprArg FullCond(getSema().FullExpr(Cond));
+ Sema::FullExprArg FullCond(getSema().MakeFullExpr(Cond));
// Rebuild the switch statement.
OwningStmtResult Switch = getDerived().RebuildSwitchStmtStart(FullCond,
@@ -3147,7 +3146,7 @@ TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
return SemaRef.StmtError();
}
- Sema::FullExprArg FullCond(getSema().FullExpr(Cond));
+ Sema::FullExprArg FullCond(getSema().MakeFullExpr(Cond));
// Transform the body
OwningStmtResult Body = getDerived().TransformStmt(S->getBody());
@@ -3229,9 +3228,9 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
return SemaRef.Owned(S->Retain());
return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
- move(Init), getSema().FullExpr(Cond),
+ move(Init), getSema().MakeFullExpr(Cond),
ConditionVar,
- getSema().FullExpr(Inc),
+ getSema().MakeFullExpr(Inc),
S->getRParenLoc(), move(Body));
}
@@ -3688,8 +3687,13 @@ TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
Base.get() == E->getBase() &&
Qualifier == E->getQualifier() &&
Member == E->getMemberDecl() &&
- !E->hasExplicitTemplateArgumentList())
+ !E->hasExplicitTemplateArgumentList()) {
+
+ // Mark it referenced in the new context regardless.
+ // FIXME: this is a bit instantiation-specific.
+ SemaRef.MarkDeclarationReferenced(E->getMemberLoc(), Member);
return SemaRef.Owned(E->Retain());
+ }
TemplateArgumentListInfo TransArgs;
if (E->hasExplicitTemplateArgumentList()) {
@@ -4411,7 +4415,7 @@ TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
Param == E->getParam())
return SemaRef.Owned(E->Retain());
- return getDerived().RebuildCXXDefaultArgExpr(Param);
+ return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param);
}
template<typename Derived>
@@ -4476,6 +4480,31 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
!ArgumentChanged)
return SemaRef.Owned(E->Retain());
+ if (!ArraySize.get()) {
+ // If no array size was specified, but the new expression was
+ // instantiated with an array type (e.g., "new T" where T is
+ // instantiated with "int[4]"), extract the outer bound from the
+ // array type as our array size. We do this with constant and
+ // dependently-sized array types.
+ const ArrayType *ArrayT = SemaRef.Context.getAsArrayType(AllocType);
+ if (!ArrayT) {
+ // Do nothing
+ } else if (const ConstantArrayType *ConsArrayT
+ = dyn_cast<ConstantArrayType>(ArrayT)) {
+ ArraySize
+ = SemaRef.Owned(new (SemaRef.Context) IntegerLiteral(
+ ConsArrayT->getSize(),
+ SemaRef.Context.getSizeType(),
+ /*FIXME:*/E->getLocStart()));
+ AllocType = ConsArrayT->getElementType();
+ } else if (const DependentSizedArrayType *DepArrayT
+ = dyn_cast<DependentSizedArrayType>(ArrayT)) {
+ if (DepArrayT->getSizeExpr()) {
+ ArraySize = SemaRef.Owned(DepArrayT->getSizeExpr()->Retain());
+ AllocType = DepArrayT->getElementType();
+ }
+ }
+ }
return getDerived().RebuildCXXNewExpr(E->getLocStart(),
E->isGlobalNew(),
/*FIXME:*/E->getLocStart(),
@@ -4725,38 +4754,24 @@ TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) {
/// \brief Transform a C++ temporary-binding expression.
///
-/// The transformation of a temporary-binding expression always attempts to
-/// bind a new temporary variable to its subexpression, even if the
-/// subexpression itself did not change, because the temporary variable itself
-/// must be unique.
+/// Since CXXBindTemporaryExpr nodes are implicitly generated, we just
+/// transform the subexpression and return that.
template<typename Derived>
Sema::OwningExprResult
TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
- OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
- if (SubExpr.isInvalid())
- return SemaRef.ExprError();
-
- return SemaRef.MaybeBindToTemporary(SubExpr.takeAs<Expr>());
+ return getDerived().TransformExpr(E->getSubExpr());
}
/// \brief Transform a C++ expression that contains temporaries that should
/// be destroyed after the expression is evaluated.
///
-/// The transformation of a full expression always attempts to build a new
-/// CXXExprWithTemporaries expression, even if the
-/// subexpression itself did not change, because it will need to capture the
-/// the new temporary variables introduced in the subexpression.
+/// Since CXXExprWithTemporaries nodes are implicitly generated, we
+/// just transform the subexpression and return that.
template<typename Derived>
Sema::OwningExprResult
TreeTransform<Derived>::TransformCXXExprWithTemporaries(
- CXXExprWithTemporaries *E) {
- OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
- if (SubExpr.isInvalid())
- return SemaRef.ExprError();
-
- return SemaRef.Owned(
- SemaRef.MaybeCreateCXXExprWithTemporaries(SubExpr.takeAs<Expr>(),
- E->shouldDestroyTemporaries()));
+ CXXExprWithTemporaries *E) {
+ return getDerived().TransformExpr(E->getSubExpr());
}
template<typename Derived>
@@ -5233,9 +5248,6 @@ TreeTransform<Derived>::RebuildArrayType(QualType ElementType,
break;
}
- if (SizeType.isNull())
- SizeType = SemaRef.Context.getFixedWidthIntType(Size->getBitWidth(), false);
-
IntegerLiteral ArraySize(*Size, SizeType, /*FIXME*/BracketsRange.getBegin());
return SemaRef.BuildArrayType(ElementType, SizeMod, &ArraySize,
IndexTypeQuals, BracketsRange,
diff --git a/test/Analysis/CFDateGC.m b/test/Analysis/CFDateGC.m
index 3c11465157ae..01cb4a461332 100644
--- a/test/Analysis/CFDateGC.m
+++ b/test/Analysis/CFDateGC.m
@@ -1,8 +1,8 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -disable-free %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -disable-free %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
diff --git a/test/Analysis/CFNumber.c b/test/Analysis/CFNumber.c
index 76d7ebbf15fc..9e6f093c56bf 100644
--- a/test/Analysis/CFNumber.c
+++ b/test/Analysis/CFNumber.c
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
typedef signed long CFIndex;
typedef const struct __CFAllocator * CFAllocatorRef;
diff --git a/test/Analysis/CFRetainRelease_NSAssertionHandler.m b/test/Analysis/CFRetainRelease_NSAssertionHandler.m
index 16f8db21e835..e2d1c88b8f79 100644
--- a/test/Analysis/CFRetainRelease_NSAssertionHandler.m
+++ b/test/Analysis/CFRetainRelease_NSAssertionHandler.m
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=region
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=region
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=region
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=region
typedef struct objc_selector *SEL;
typedef signed char BOOL;
diff --git a/test/Analysis/CGColorSpace.c b/test/Analysis/CGColorSpace.c
index d69f86e9fd4a..7390b5a80117 100644
--- a/test/Analysis/CGColorSpace.c
+++ b/test/Analysis/CGColorSpace.c
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
typedef struct CGColorSpace *CGColorSpaceRef;
extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void);
diff --git a/test/Analysis/CheckNSError.m b/test/Analysis/CheckNSError.m
index ec44b22aa4fc..e3b1be0a5bf4 100644
--- a/test/Analysis/CheckNSError.m
+++ b/test/Analysis/CheckNSError.m
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
typedef signed char BOOL;
diff --git a/test/Analysis/MissingDealloc.m b/test/Analysis/MissingDealloc.m
index cb5339a4cdab..daa6460da81b 100644
--- a/test/Analysis/MissingDealloc.m
+++ b/test/Analysis/MissingDealloc.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-objc-missing-dealloc '-DIBOutlet=__attribute__((iboutlet))' %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -warn-objc-missing-dealloc '-DIBOutlet=__attribute__((iboutlet))' %s -verify
typedef signed char BOOL;
@protocol NSObject
- (BOOL)isEqual:(id)object;
diff --git a/test/Analysis/NSPanel.m b/test/Analysis/NSPanel.m
index c98a685b1f40..b2863e089a80 100644
--- a/test/Analysis/NSPanel.m
+++ b/test/Analysis/NSPanel.m
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
// BEGIN delta-debugging reduced header stuff
diff --git a/test/Analysis/NSString-failed-cases.m b/test/Analysis/NSString-failed-cases.m
index b7f8be07cbcd..2b8242f0d019 100644
--- a/test/Analysis/NSString-failed-cases.m
+++ b/test/Analysis/NSString-failed-cases.m
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
-// RUN: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
// XFAIL: *
//===----------------------------------------------------------------------===//
diff --git a/test/Analysis/NSString.m b/test/Analysis/NSString.m
index d7804dc5f42a..fb44309b1248 100644
--- a/test/Analysis/NSString.m
+++ b/test/Analysis/NSString.m
@@ -1,13 +1,13 @@
-// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
-// RUN: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
// ==-- FIXME: -analyzer-store=basic fails on this file (false negatives). --==
-// NOTWORK: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s &&
-// NOTWORK: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
-// NOTWORK: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
-// NOTWORK: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
+// NOTWORK: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s &&
+// NOTWORK: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
+// NOTWORK: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
+// NOTWORK: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
diff --git a/test/Analysis/NSWindow.m b/test/Analysis/NSWindow.m
index 6d017293cc68..acd3278c474e 100644
--- a/test/Analysis/NSWindow.m
+++ b/test/Analysis/NSWindow.m
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=region -analyzer-constraints=range -verify %s
// These declarations were reduced using Delta-Debugging from Foundation.h
// on Mac OS X. The test cases are below.
diff --git a/test/Analysis/NoReturn.m b/test/Analysis/NoReturn.m
index ad441a3b9b84..9d3de0f89a43 100644
--- a/test/Analysis/NoReturn.m
+++ b/test/Analysis/NoReturn.m
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
#include <stdarg.h>
diff --git a/test/Analysis/ObjCProperties.m b/test/Analysis/ObjCProperties.m
index 89d8f9b297b1..1749d71f359d 100644
--- a/test/Analysis/ObjCProperties.m
+++ b/test/Analysis/ObjCProperties.m
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic %s -verify
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range %s -verify
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic %s -verify
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range %s -verify
// The point of this test cases is to exercise properties in the static
// analyzer
diff --git a/test/Analysis/ObjCRetSigs.m b/test/Analysis/ObjCRetSigs.m
index 416ef1c8eed8..cdc81993b81f 100644
--- a/test/Analysis/ObjCRetSigs.m
+++ b/test/Analysis/ObjCRetSigs.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-objc-methodsigs -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -warn-objc-methodsigs -verify %s
int printf(const char *, ...);
diff --git a/test/Analysis/PR2599.m b/test/Analysis/PR2599.m
index ea71ad2a237b..e866ee6cb270 100644
--- a/test/Analysis/PR2599.m
+++ b/test/Analysis/PR2599.m
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=range -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=range -analyzer-store=region -checker-cfref -fobjc-gc -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=range -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=range -analyzer-store=region -checker-cfref -fobjc-gc -verify %s
typedef const void * CFTypeRef;
typedef const struct __CFString * CFStringRef;
diff --git a/test/Analysis/PR2978.m b/test/Analysis/PR2978.m
index 428997f709c6..a70e34ac7800 100644
--- a/test/Analysis/PR2978.m
+++ b/test/Analysis/PR2978.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-objc-missing-dealloc %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -warn-objc-missing-dealloc %s -verify
// Tests for the checker which checks missing/extra ivar 'release' calls
// in dealloc.
diff --git a/test/Analysis/PR3991.m b/test/Analysis/PR3991.m
index a1d465734df7..38566d5f6c18 100644
--- a/test/Analysis/PR3991.m
+++ b/test/Analysis/PR3991.m
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
//===----------------------------------------------------------------------===//
// Delta-debugging produced forward declarations.
diff --git a/test/Analysis/array-struct.c b/test/Analysis/array-struct.c
index 2a833c48ff13..0354c06c7810 100644
--- a/test/Analysis/array-struct.c
+++ b/test/Analysis/array-struct.c
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
struct s {
int data;
diff --git a/test/Analysis/blocks.m b/test/Analysis/blocks.m
index 50a9d06e8f93..ef43751ce1b8 100644
--- a/test/Analysis/blocks.m
+++ b/test/Analysis/blocks.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -fblocks -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -fblocks -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from Mac OS X headers:
diff --git a/test/Analysis/casts.c b/test/Analysis/casts.c
index 3c6b83b72391..947f63ef48b6 100644
--- a/test/Analysis/casts.c
+++ b/test/Analysis/casts.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
// Test if the 'storage' region gets properly initialized after it is cast to
// 'struct sockaddr *'.
diff --git a/test/Analysis/casts.m b/test/Analysis/casts.m
index fb4252014b01..790f63f244db 100644
--- a/test/Analysis/casts.m
+++ b/test/Analysis/casts.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
// Test function pointer casts. Currently we track function addresses using
// loc::FunctionVal. Because casts can be arbitrary, do we need to model
diff --git a/test/Analysis/cfref_PR2519.c b/test/Analysis/cfref_PR2519.c
index 48f757e51a71..c673736dcd78 100644
--- a/test/Analysis/cfref_PR2519.c
+++ b/test/Analysis/cfref_PR2519.c
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
typedef unsigned char Boolean;
typedef signed long CFIndex;
diff --git a/test/Analysis/cfref_rdar6080742.c b/test/Analysis/cfref_rdar6080742.c
index 27b4c51f96b7..f3027336c4b2 100644
--- a/test/Analysis/cfref_rdar6080742.c
+++ b/test/Analysis/cfref_rdar6080742.c
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
// This test case was reported in <rdar:problem/6080742>.
// It tests path-sensitivity with respect to '!(cfstring != 0)' (negation of inequality).
diff --git a/test/Analysis/complex.c b/test/Analysis/complex.c
index 605255e555ab..2b4f2c41179b 100644
--- a/test/Analysis/complex.c
+++ b/test/Analysis/complex.c
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
#include <stdint.h>
diff --git a/test/Analysis/concrete-address.c b/test/Analysis/concrete-address.c
index fdede4beec70..443e36485307 100644
--- a/test/Analysis/concrete-address.c
+++ b/test/Analysis/concrete-address.c
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
void foo() {
int *p = (int*) 0x10000; // Should not crash here.
diff --git a/test/Analysis/conditional-op-missing-lhs.c b/test/Analysis/conditional-op-missing-lhs.c
index 4b0378579901..7db928438697 100644
--- a/test/Analysis/conditional-op-missing-lhs.c
+++ b/test/Analysis/conditional-op-missing-lhs.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -warn-uninit-values -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -warn-uninit-values -verify %s
void f1()
{
diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c
index a0e889f2daa0..63c9d0d97a44 100644
--- a/test/Analysis/dead-stores.c
+++ b/test/Analysis/dead-stores.c
@@ -1,8 +1,8 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -fblocks -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s
void f1() {
int k, y;
diff --git a/test/Analysis/dead-stores.cpp b/test/Analysis/dead-stores.cpp
index 363cfdd98cc6..9778a11c921a 100644
--- a/test/Analysis/dead-stores.cpp
+++ b/test/Analysis/dead-stores.cpp
@@ -1,15 +1,15 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -verify %s
//===----------------------------------------------------------------------===//
// Basic dead store checking (but in C++ mode).
//===----------------------------------------------------------------------===//
int j;
-void f1() {
+void test1() {
int x = 4;
++x; // expected-warning{{never read}}
@@ -26,14 +26,69 @@ void f1() {
// Dead store checking involving constructors.
//===----------------------------------------------------------------------===//
-class Test1 {
+class Test2 {
int &x;
public:
- Test1(int &y) : x(y) {}
- ~Test1() { ++x; }
+ Test2(int &y) : x(y) {}
+ ~Test2() { ++x; }
};
-int test_ctor_1(int x) {
- { Test1 a(x); } // no-warning
+int test2(int x) {
+ { Test2 a(x); } // no-warning
return x;
}
+
+//===----------------------------------------------------------------------===//
+// Dead store checking involving CXXTemporaryExprs
+//===----------------------------------------------------------------------===//
+
+namespace TestTemp {
+ template<typename _Tp>
+ class pencil {
+ public:
+ ~pencil() throw() {}
+ };
+ template<typename _Tp, typename _Number2> struct _Row_base {
+ _Row_base(const pencil<_Tp>& x) {}
+ };
+ template<typename _Tp, typename _Number2 = TestTemp::pencil<_Tp> >
+ class row : protected _Row_base<_Tp, _Number2> {
+ typedef _Row_base<_Tp, _Number2> _Base;
+ typedef _Number2 pencil_type;
+ public:
+ explicit row(const pencil_type& __a = pencil_type()) : _Base(__a) {}
+ };
+}
+
+void test2_b() {
+ TestTemp::row<const char*> x; // no-warning
+}
+
+//===----------------------------------------------------------------------===//
+// Test references.
+//===----------------------------------------------------------------------===//
+
+void test3_a(int x) {
+ ++x; // expected-warning{{never read}}
+}
+
+void test3_b(int &x) {
+ ++x; // no-warninge
+}
+
+void test3_c(int x) {
+ int &y = x;
+ // Shows the limitation of dead stores tracking. The write is really
+ // dead since the value cannot escape the function.
+ ++y; // no-warning
+}
+
+void test3_d(int &x) {
+ int &y = x;
+ ++y; // no-warning
+}
+
+void test3_e(int &x) {
+ int &y = x;
+}
+
diff --git a/test/Analysis/dead-stores.m b/test/Analysis/dead-stores.m
index 4ad3c0a42da4..d4a20a81fba6 100644
--- a/test/Analysis/dead-stores.m
+++ b/test/Analysis/dead-stores.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
diff --git a/test/Analysis/delegates.m b/test/Analysis/delegates.m
index df97866b8558..876e3a060686 100644
--- a/test/Analysis/delegates.m
+++ b/test/Analysis/delegates.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
//===----------------------------------------------------------------------===//
diff --git a/test/Analysis/elementtype.c b/test/Analysis/elementtype.c
index f3eee2634241..4f79a31912a1 100644
--- a/test/Analysis/elementtype.c
+++ b/test/Analysis/elementtype.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region %s
typedef struct added_obj_st {
int type;
diff --git a/test/Analysis/exercise-ps.c b/test/Analysis/exercise-ps.c
index 13f075de5ea1..27094c8576c5 100644
--- a/test/Analysis/exercise-ps.c
+++ b/test/Analysis/exercise-ps.c
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
//
// Just exercise the analyzer on code that has at one point caused issues
// (i.e., no assertions or crashes).
diff --git a/test/Analysis/fields.c b/test/Analysis/fields.c
index e34191850036..2a71114e39d4 100644
--- a/test/Analysis/fields.c
+++ b/test/Analysis/fields.c
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=basic -verify
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=region -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=basic -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=region -verify
unsigned foo();
typedef struct bf { unsigned x:2; } bf;
diff --git a/test/Analysis/func.c b/test/Analysis/func.c
index 449a4c29ced8..8a951f8dcb5e 100644
--- a/test/Analysis/func.c
+++ b/test/Analysis/func.c
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
void f(void) {
void (*p)(void);
diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c
index 0c5142ba4d3f..4d771eeb4bd3 100644
--- a/test/Analysis/malloc.c
+++ b/test/Analysis/malloc.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t);
void free(void *);
@@ -43,3 +43,11 @@ int *f5() {
q = realloc(q, 20);
return q; // no-warning
}
+
+void f6() {
+ int *p = malloc(10);
+ if (!p)
+ return; // no-warning
+ else
+ free(p);
+}
diff --git a/test/Analysis/misc-ps-64.m b/test/Analysis/misc-ps-64.m
index ec4c3b4c65e9..3f8836bfca4f 100644
--- a/test/Analysis/misc-ps-64.m
+++ b/test/Analysis/misc-ps-64.m
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -fblocks %s
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -fblocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s
// <rdar://problem/6440393> - A bunch of misc. failures involving evaluating
// these expressions and building CFGs. These tests are here to prevent
diff --git a/test/Analysis/misc-ps-basic-store.m b/test/Analysis/misc-ps-basic-store.m
index 6af63f947291..2ae09ad38a59 100644
--- a/test/Analysis/misc-ps-basic-store.m
+++ b/test/Analysis/misc-ps-basic-store.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fblocks %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fblocks %s
//---------------------------------------------------------------------------
// Test case 'checkaccess_union' differs for region store and basic store.
diff --git a/test/Analysis/misc-ps-eager-assume.m b/test/Analysis/misc-ps-eager-assume.m
index e636c21b9490..c23efab416e9 100644
--- a/test/Analysis/misc-ps-eager-assume.m
+++ b/test/Analysis/misc-ps-eager-assume.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s -analyzer-eagerly-assume
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s -analyzer-eagerly-assume
// Delta-reduced header stuff (needed for test cases).
typedef signed char BOOL;
diff --git a/test/Analysis/misc-ps-ranges.m b/test/Analysis/misc-ps-ranges.m
index 92e20d647deb..760b4d743357 100644
--- a/test/Analysis/misc-ps-ranges.m
+++ b/test/Analysis/misc-ps-ranges.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s
// <rdar://problem/6776949>
// main's 'argc' argument is always > 0
diff --git a/test/Analysis/misc-ps-region-store-i386.m b/test/Analysis/misc-ps-region-store-i386.m
index f9df55270b66..bb98668bde73 100644
--- a/test/Analysis/misc-ps-region-store-i386.m
+++ b/test/Analysis/misc-ps-region-store-i386.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks %s
// Here is a case where a pointer is treated as integer, invalidated as an
// integer, and then used again as a pointer. This test just makes sure
diff --git a/test/Analysis/misc-ps-region-store-x86_64.m b/test/Analysis/misc-ps-region-store-x86_64.m
index 01d99f24c68f..3f30327e1886 100644
--- a/test/Analysis/misc-ps-region-store-x86_64.m
+++ b/test/Analysis/misc-ps-region-store-x86_64.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks %s
// Here is a case where a pointer is treated as integer, invalidated as an
// integer, and then used again as a pointer. This test just makes sure
diff --git a/test/Analysis/misc-ps-region-store.cpp b/test/Analysis/misc-ps-region-store.cpp
new file mode 100644
index 000000000000..225abb5aa19a
--- /dev/null
+++ b/test/Analysis/misc-ps-region-store.cpp
@@ -0,0 +1,91 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+
+// Test basic handling of references.
+char &test1_aux();
+char *test1() {
+ return &test1_aux();
+}
+
+// Test test1_aux() evaluates to char &.
+char test1_as_rvalue() {
+ return test1_aux();
+}
+
+// Test passing a value as a reference. The 'const' in test2_aux() adds
+// an ImplicitCastExpr, which is evaluated as an lvalue.
+int test2_aux(const int &n);
+int test2(int n) {
+ return test2_aux(n);
+}
+
+int test2_b_aux(const short &n);
+int test2_b(int n) {
+ return test2_b_aux(n);
+}
+
+// Test getting the lvalue of a derived and converting it to a base. This
+// previously crashed.
+class Test3_Base {};
+class Test3_Derived : public Test3_Base {};
+
+int test3_aux(Test3_Base &x);
+int test3(Test3_Derived x) {
+ return test3_aux(x);
+}
+
+int test_init_in_condition_aux();
+int test_init_in_condition() {
+ if (int x = test_init_in_condition_aux()) { // no-warning
+ return 1;
+ }
+ return 0;
+}
+
+int test_init_in_condition_switch() {
+ switch (int x = test_init_in_condition_aux()) { // no-warning
+ case 1:
+ return 0;
+ case 2:
+ if (x == 2)
+ return 0;
+ else {
+ // Unreachable.
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+ }
+ default:
+ break;
+ }
+ return 0;
+}
+
+int test_init_in_condition_while() {
+ int z = 0;
+ while (int x = ++z) { // no-warning
+ if (x == 2)
+ break;
+ }
+
+ if (z == 2)
+ return 0;
+
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+ return 0;
+}
+
+
+int test_init_in_condition_for() {
+ int z = 0;
+ for (int x = 0; int y = ++z; ++x) {
+ if (x == y) // no-warning
+ break;
+ }
+ if (z == 1)
+ return 0;
+
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+ return 0;
+}
diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m
index e736e0f37cdb..7f29c99a44d7 100644
--- a/test/Analysis/misc-ps-region-store.m
+++ b/test/Analysis/misc-ps-region-store.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -DTEST_64 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
typedef struct objc_selector *SEL;
typedef signed char BOOL;
@@ -23,6 +23,13 @@ extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
@end
extern NSString * const NSConnectionReplyMode;
+#ifdef TEST_64
+typedef long long int64_t;
+typedef int64_t intptr_t;
+#else
+typedef int int32_t;
+typedef int32_t intptr_t;
+#endif
//---------------------------------------------------------------------------
// Test case 'checkaccess_union' differs for region store and basic store.
@@ -636,3 +643,44 @@ void rdar7468209() {
}();
}
+//===----------------------------------------------------------------------===//
+// PR 5857 - Test loading an integer from a byte array that has also been
+// reinterpreted to be loaded as a field.
+//===----------------------------------------------------------------------===//
+
+typedef struct { int x; } TestFieldLoad;
+int pr5857(char *src) {
+ TestFieldLoad *tfl = (TestFieldLoad *) (intptr_t) src;
+ int y = tfl->x;
+ long long *z = (long long *) (intptr_t) src;
+ long long w = 0;
+ int n = 0;
+ for (n = 0; n < y; ++n) {
+ // Previously we crashed analyzing this statement.
+ w = *z++;
+ }
+ return 1;
+}
+
+//===----------------------------------------------------------------------===//
+// PR 4358 - Without field-sensitivity, this code previously triggered
+// a false positive that 'uninit' could be uninitialized at the call
+// to pr4358_aux().
+//===----------------------------------------------------------------------===//
+
+struct pr4358 {
+ int bar;
+ int baz;
+};
+void pr4358_aux(int x);
+void pr4358(struct pr4358 *pnt) {
+ int uninit;
+ if (pnt->bar < 3) {
+ uninit = 1;
+ } else if (pnt->baz > 2) {
+ uninit = 3;
+ } else if (pnt->baz <= 2) {
+ uninit = 2;
+ }
+ pr4358_aux(uninit); // no-warning
+}
diff --git a/test/Analysis/misc-ps-region-store.mm b/test/Analysis/misc-ps-region-store.mm
new file mode 100644
index 000000000000..fd92759012f4
--- /dev/null
+++ b/test/Analysis/misc-ps-region-store.mm
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+
+//===------------------------------------------------------------------------------------------===//
+// This files tests our path-sensitive handling of Objective-c++ files.
+//===------------------------------------------------------------------------------------------===//
+
+// Test basic handling of references.
+char &test1_aux();
+char *test1() {
+ return &test1_aux();
+}
+
+// Test test1_aux() evaluates to char &.
+char test1_as_rvalue() {
+ return test1_aux();
+}
+
+// Test basic handling of references with Objective-C classes.
+@interface Test1
+- (char&) foo;
+@end
+
+char* Test1_harness(Test1 *p) {
+ return &[p foo];
+}
+
+char Test1_harness_b(Test1 *p) {
+ return [p foo];
+}
+
diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m
index c97ef951c5aa..53b9b6f4fa67 100644
--- a/test/Analysis/misc-ps.m
+++ b/test/Analysis/misc-ps.m
@@ -1,8 +1,8 @@
// NOTE: Use '-fobjc-gc' to test the analysis being run twice, and multiple reports are not issued.
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s
typedef struct objc_ivar *Ivar;
typedef struct objc_selector *SEL;
diff --git a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
index 227945620d78..f4f4e5c32431 100644
--- a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
+++ b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin8 %s
-// RUN: clang -cc1 -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin8 %s
-// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin9 %s
-// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin8 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin8 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin9 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
@interface MyClass {}
- (void *)voidPtrM;
diff --git a/test/Analysis/no-exit-cfg.c b/test/Analysis/no-exit-cfg.c
index eb4fc8d41aae..d7800f8f030b 100644
--- a/test/Analysis/no-exit-cfg.c
+++ b/test/Analysis/no-exit-cfg.c
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
// This is a test case for the issue reported in PR 2819:
// http://llvm.org/bugs/show_bug.cgi?id=2819
diff --git a/test/Analysis/no-outofbounds.c b/test/Analysis/no-outofbounds.c
index 8aa194d31b87..dc553ccf2f77 100644
--- a/test/Analysis/no-outofbounds.c
+++ b/test/Analysis/no-outofbounds.c
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -checker-cfref -analyze -analyzer-experimental-internal-checks -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -checker-cfref -analyze -analyzer-experimental-internal-checks -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -checker-cfref -analyze -analyzer-experimental-internal-checks -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -checker-cfref -analyze -analyzer-experimental-internal-checks -analyzer-store=region -verify %s
// XFAIL: *
//===----------------------------------------------------------------------===//
diff --git a/test/Analysis/null-deref-ps-region.c b/test/Analysis/null-deref-ps-region.c
index 8f5fe9fb10c1..dfd76e9dfd86 100644
--- a/test/Analysis/null-deref-ps-region.c
+++ b/test/Analysis/null-deref-ps-region.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -verify %s
// The store for 'a[1]' should not be removed mistakenly. SymbolicRegions may
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c
index 8bfc1f337aa1..6dd50a345298 100644
--- a/test/Analysis/null-deref-ps.c
+++ b/test/Analysis/null-deref-ps.c
@@ -1,7 +1,7 @@
-// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic
-// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic
-// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -analyzer-no-purge-dead -verify %s
-// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -analyzer-no-purge-dead -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s
typedef unsigned uintptr_t;
diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c
index a866ad905b3b..2142e9e1f73b 100644
--- a/test/Analysis/outofbound.c
+++ b/test/Analysis/outofbound.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
char f1() {
char* s = "abcd";
diff --git a/test/Analysis/override-werror.c b/test/Analysis/override-werror.c
index e17361ebe418..a2a8ec6b87e6 100644
--- a/test/Analysis/override-werror.c
+++ b/test/Analysis/override-werror.c
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -Werror %s -analyzer-store=basic -verify
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -Werror %s -analyzer-store=region -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -Werror %s -analyzer-store=basic -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -Werror %s -analyzer-store=region -verify
// This test case illustrates that using '-analyze' overrides the effect of
// -Werror. This allows basic warnings not to interfere with producing
diff --git a/test/Analysis/plist-output.m b/test/Analysis/plist-output.m
index 7f49340b7885..a584de8a47bb 100644
--- a/test/Analysis/plist-output.m
+++ b/test/Analysis/plist-output.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s
void test_null_init(void) {
int *p = 0;
diff --git a/test/Analysis/pr4209.m b/test/Analysis/pr4209.m
index 3a32649ee722..da288e943b4f 100644
--- a/test/Analysis/pr4209.m
+++ b/test/Analysis/pr4209.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
// This test case was crashing due to how CFRefCount.cpp resolved the
// ObjCInterfaceDecl* and ClassName in EvalObjCMessageExpr.
diff --git a/test/Analysis/pr_2542_rdar_6793404.m b/test/Analysis/pr_2542_rdar_6793404.m
index 761448caf952..890fa04540dc 100644
--- a/test/Analysis/pr_2542_rdar_6793404.m
+++ b/test/Analysis/pr_2542_rdar_6793404.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -pedantic -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -pedantic -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -pedantic -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -pedantic -analyzer-store=region -verify %s
// BEGIN delta-debugging reduced header stuff
diff --git a/test/Analysis/pr_4164.c b/test/Analysis/pr_4164.c
index d38f4b3e2de2..b21b1dcf787a 100644
--- a/test/Analysis/pr_4164.c
+++ b/test/Analysis/pr_4164.c
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
// PR 4164: http://llvm.org/bugs/show_bug.cgi?id=4164
//
diff --git a/test/Analysis/ptr-arith.c b/test/Analysis/ptr-arith.c
index 2adbbe211d7f..be504866745d 100644
--- a/test/Analysis/ptr-arith.c
+++ b/test/Analysis/ptr-arith.c
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -triple i686-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -triple i686-apple-darwin9 %s
void f1() {
int a[10];
diff --git a/test/Analysis/rdar-6442306-1.m b/test/Analysis/rdar-6442306-1.m
index 28fa83a3af6e..1eae5d779dd6 100644
--- a/test/Analysis/rdar-6442306-1.m
+++ b/test/Analysis/rdar-6442306-1.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=basic -verify
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=region -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=basic -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=region -verify
typedef int bar_return_t;
typedef struct {
diff --git a/test/Analysis/rdar-6540084.m b/test/Analysis/rdar-6540084.m
index 7940fc637b07..d4c67a1e66bb 100644
--- a/test/Analysis/rdar-6540084.m
+++ b/test/Analysis/rdar-6540084.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s
//
// This test exercises the live variables analysis (LiveVariables.cpp).
// The case originally identified a non-termination bug.
diff --git a/test/Analysis/rdar-6541136-region.c b/test/Analysis/rdar-6541136-region.c
index fbbf40814c9a..9afffcbe6078 100644
--- a/test/Analysis/rdar-6541136-region.c
+++ b/test/Analysis/rdar-6541136-region.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region %s
+// RUN: %clang_cc1 -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region %s
struct tea_cheese { unsigned magic; };
typedef struct tea_cheese kernel_tea_cheese_t;
diff --git a/test/Analysis/rdar-6541136.c b/test/Analysis/rdar-6541136.c
index 18dc3c846002..423fe4b05a24 100644
--- a/test/Analysis/rdar-6541136.c
+++ b/test/Analysis/rdar-6541136.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic %s
+// RUN: %clang_cc1 -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic %s
struct tea_cheese { unsigned magic; };
typedef struct tea_cheese kernel_tea_cheese_t;
diff --git a/test/Analysis/rdar-6562655.m b/test/Analysis/rdar-6562655.m
index 95f876efee50..185649f57268 100644
--- a/test/Analysis/rdar-6562655.m
+++ b/test/Analysis/rdar-6562655.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region -verify %s
//
// This test case mainly checks that the retain/release checker doesn't crash
// on this file.
diff --git a/test/Analysis/rdar-6582778-basic-store.c b/test/Analysis/rdar-6582778-basic-store.c
index e1a06947d04b..a4229f767190 100644
--- a/test/Analysis/rdar-6582778-basic-store.c
+++ b/test/Analysis/rdar-6582778-basic-store.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
typedef const void * CFTypeRef;
typedef double CFTimeInterval;
diff --git a/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m b/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m
index 060a91a49e85..225074ba863c 100644
--- a/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m
+++ b/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s -verify
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s -verify
typedef struct Foo { int x; } Bar;
diff --git a/test/Analysis/rdar-7168531.m b/test/Analysis/rdar-7168531.m
index 683dc745c6c4..8a84b4bc239b 100644
--- a/test/Analysis/rdar-7168531.m
+++ b/test/Analysis/rdar-7168531.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -triple i386-apple-darwin10 -analyzer-store=region
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -triple i386-apple-darwin10 -analyzer-store=basic
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -triple i386-apple-darwin10 -analyzer-store=region
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -triple i386-apple-darwin10 -analyzer-store=basic
// Note that the target triple is important for this test case. It specifies that we use the
// fragile Objective-C ABI.
diff --git a/test/Analysis/refcnt_naming.m b/test/Analysis/refcnt_naming.m
index 417162b6dbf6..66210c312aeb 100644
--- a/test/Analysis/refcnt_naming.m
+++ b/test/Analysis/refcnt_naming.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
typedef const struct __CFString * CFStringRef;
typedef const struct __CFAllocator * CFAllocatorRef;
diff --git a/test/Analysis/region-1.m b/test/Analysis/region-1.m
index 8d332cfb7501..1b95ac4b0c29 100644
--- a/test/Analysis/region-1.m
+++ b/test/Analysis/region-1.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s
//
// This test case simply should not crash. It evaluates the logic of not
// using MemRegion::getRValueType in incorrect places.
diff --git a/test/Analysis/retain-release-basic-store.m b/test/Analysis/retain-release-basic-store.m
index 744032ba77c5..58321bb388dc 100644
--- a/test/Analysis/retain-release-basic-store.m
+++ b/test/Analysis/retain-release-basic-store.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
diff --git a/test/Analysis/retain-release-gc-only.m b/test/Analysis/retain-release-gc-only.m
index 97fa6124484c..fcec46edd259 100644
--- a/test/Analysis/retain-release-gc-only.m
+++ b/test/Analysis/retain-release-gc-only.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -verify -fobjc-gc-only -fblocks %s
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -fobjc-gc-only -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=basic -verify -fobjc-gc-only -fblocks %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=region -fobjc-gc-only -fblocks -verify %s
//===----------------------------------------------------------------------===//
// Header stuff.
diff --git a/test/Analysis/retain-release-region-store.m b/test/Analysis/retain-release-region-store.m
index 2b75ff9ea89b..35dc6e711081 100644
--- a/test/Analysis/retain-release-region-store.m
+++ b/test/Analysis/retain-release-region-store.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=region -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m
index 969249cdeeb3..f5d985ebd448 100644
--- a/test/Analysis/retain-release.m
+++ b/test/Analysis/retain-release.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=basic -fblocks -verify %s
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -fblocks -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=basic -fblocks -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -fblocks -verify %s
#if __has_feature(attribute_ns_returns_retained)
#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
diff --git a/test/Analysis/security-syntax-checks.m b/test/Analysis/security-syntax-checks.m
index c63d58901e46..cfdb030746dc 100644
--- a/test/Analysis/security-syntax-checks.m
+++ b/test/Analysis/security-syntax-checks.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -warn-security-syntactic %s -verify
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -warn-security-syntactic %s -verify
// <rdar://problem/6336718> rule request: floating point used as loop
// condition (FLP30-C, FLP-30-CPP)
@@ -48,6 +48,7 @@ int setuid(uid_t);
int setregid(gid_t, gid_t);
int setreuid(uid_t, uid_t);
extern void check(int);
+void abort(void);
void test_setuid()
{
diff --git a/test/Analysis/sizeofpointer.c b/test/Analysis/sizeofpointer.c
index eace4f873bc2..82fda04114d2 100644
--- a/test/Analysis/sizeofpointer.c
+++ b/test/Analysis/sizeofpointer.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -warn-sizeof-pointer -verify %s
+// RUN: %clang_cc1 -analyze -warn-sizeof-pointer -verify %s
struct s {
};
diff --git a/test/Analysis/stack-addr-ps.c b/test/Analysis/stack-addr-ps.c
index a358165a22de..e58c7804ddba 100644
--- a/test/Analysis/stack-addr-ps.c
+++ b/test/Analysis/stack-addr-ps.c
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -fblocks -verify %s
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=basic -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=region -fblocks -verify %s
int* f1() {
int x = 0;
diff --git a/test/Analysis/uninit-msg-expr.m b/test/Analysis/uninit-msg-expr.m
index 6a2ada536f8a..c8a9e3ccbb22 100644
--- a/test/Analysis/uninit-msg-expr.m
+++ b/test/Analysis/uninit-msg-expr.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=region -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
diff --git a/test/Analysis/uninit-ps-rdar6145427.m b/test/Analysis/uninit-ps-rdar6145427.m
index 594a6f0dcd88..d4e3b31a2382 100644
--- a/test/Analysis/uninit-ps-rdar6145427.m
+++ b/test/Analysis/uninit-ps-rdar6145427.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -verify -analyzer-store=basic -checker-cfref %s
-// RUN: clang -cc1 -analyze -verify -analyzer-store=region -checker-cfref %s
+// RUN: %clang_cc1 -analyze -verify -analyzer-store=basic -checker-cfref %s
+// RUN: %clang_cc1 -analyze -verify -analyzer-store=region -checker-cfref %s
// Delta-Debugging reduced preamble.
typedef signed char BOOL;
diff --git a/test/Analysis/uninit-vals-ps-region.c b/test/Analysis/uninit-vals-ps-region.c
index 5bcf74dcabc8..ce86ad05320a 100644
--- a/test/Analysis/uninit-vals-ps-region.c
+++ b/test/Analysis/uninit-vals-ps-region.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=region -verify %s
struct s {
int data;
diff --git a/test/Analysis/uninit-vals-ps.c b/test/Analysis/uninit-vals-ps.c
index a2824c023396..12287a2df375 100644
--- a/test/Analysis/uninit-vals-ps.c
+++ b/test/Analysis/uninit-vals-ps.c
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=region -verify %s
struct FPRec {
void (*my_func)(int * x);
diff --git a/test/Analysis/uninit-vals.c b/test/Analysis/uninit-vals.c
index c48544e3c555..b0769ba6bce1 100644
--- a/test/Analysis/uninit-vals.c
+++ b/test/Analysis/uninit-vals.c
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -warn-uninit-values -verify %s
+// RUN: %clang_cc1 -analyze -warn-uninit-values -verify %s
int f1() {
int x;
diff --git a/test/Analysis/uninit-vals.m b/test/Analysis/uninit-vals.m
index 43bab9e79134..037e227be668 100644
--- a/test/Analysis/uninit-vals.m
+++ b/test/Analysis/uninit-vals.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=region -verify %s
typedef unsigned int NSUInteger;
diff --git a/test/Analysis/unions-region.m b/test/Analysis/unions-region.m
index 1c48e798808d..7fd1b44f05fa 100644
--- a/test/Analysis/unions-region.m
+++ b/test/Analysis/unions-region.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range %s -verify
+// RUN: %clang_cc1 -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range %s -verify
//===-- unions-region.m ---------------------------------------------------===//
//
diff --git a/test/Analysis/unused-ivars.m b/test/Analysis/unused-ivars.m
index 55c482aa8b3f..2ad886fdb3a1 100644
--- a/test/Analysis/unused-ivars.m
+++ b/test/Analysis/unused-ivars.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fblocks -analyze -warn-objc-unused-ivars %s -verify
+// RUN: %clang_cc1 -fblocks -analyze -warn-objc-unused-ivars %s -verify
//===--- BEGIN: Delta-debugging reduced headers. --------------------------===//
diff --git a/test/CXX/basic/basic.def.odr/p2-typeid.cpp b/test/CXX/basic/basic.def.odr/p2-typeid.cpp
index 881212d74ba4..55debe3ca731 100644
--- a/test/CXX/basic/basic.def.odr/p2-typeid.cpp
+++ b/test/CXX/basic/basic.def.odr/p2-typeid.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++ [basic.def.odr]p2:
// An expression is potentially evaluated unless it [...] is the
diff --git a/test/CXX/basic/basic.link/p9.cpp b/test/CXX/basic/basic.link/p9.cpp
index ecff3eebafec..bd16b02d7bad 100644
--- a/test/CXX/basic/basic.link/p9.cpp
+++ b/test/CXX/basic/basic.link/p9.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// FIXME: This test is woefully incomplete.
namespace N { } // expected-note{{here}}
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp
index e2c76f918336..f650ad517a19 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2-template-id.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace N1 {
struct X { };
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp
index 677df8284a72..ee01416c7b1b 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace N {
struct X { };
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p3.cpp b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p3.cpp
index ae5590cd3c14..c4c2c8d60596 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p3.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// FIXME: embellish
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
index 8f0bed8789fe..b59e6ca320e0 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace A {
class A {
@@ -32,7 +32,7 @@ namespace D {
namespace Test {
void test() {
func(A::A());
- func(B::B()); // expected-error {{ no matching function for call to 'func' }}
+ func(B::B()); // expected-error {{use of undeclared identifier 'func'}}
func(C::C());
A::A() + A::A();
B::B() + B::B();
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.elab/templateid.cpp b/test/CXX/basic/basic.lookup/basic.lookup.elab/templateid.cpp
index cb9d942ba6f6..76b6e2b57465 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.elab/templateid.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.elab/templateid.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// elaborated-type-specifier:
// class-key '::'? nested-name-specifier? 'template'? simple-template-id
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
index 88bc813363fa..7a6210007eb9 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace Ints {
int zero = 0; // expected-note {{candidate found by name lookup is 'Ints::zero'}}
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp
index 7a51a7bb1df0..dc0f8b4af23c 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// This is basically paraphrased from the standard.
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp
index 2c0ce80d8ce6..38eccfa2248b 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace A {
int a;
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p5.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p5.cpp
index 78af521c9103..5045baccb4d0 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p5.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace A {
struct x {}; // expected-note {{candidate found by name lookup is 'A::x'}}
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp b/test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp
index 04aef1e39e40..ab0dc248f3dc 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// When looking up a namespace-name in a using-directive or
// namespace-alias-definition, only namespace names are considered.
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp
index 1b56ecd27d68..a1cf529741b9 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
static const int a = 10;
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp
index aee8acf5c05a..878ff078bc26 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct S {};
S E0;
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp
index afd662360572..58d7ff4d16af 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct S {
static const int f0 = 0;
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp
index 141a5732c1d3..0fa4f650b0bb 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp
@@ -1,11 +1,18 @@
-// RUN: clang-cc -fsyntax-only -verify %s
-// XFAIL: *
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// C++0x [basic.lookup.unqual]p14:
+// If a variable member of a namespace is defined outside of the
+// scope of its namespace then any name used in the definition of
+// the variable member (after the declarator-id) is looked up as if
+// the definition of the variable member occurred in its namespace.
namespace N {
struct S {};
S i;
extern S j;
+ extern S j2;
}
int i = 2;
N::S N::j = i;
+N::S N::j2(i);
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp
index 418059dc74ce..253d15e90178 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// XFAIL: *
class C {
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp
index 7fd1b53c2cb0..20a7ae05a12a 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef int f;
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp
new file mode 100644
index 000000000000..e57954609907
--- /dev/null
+++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR5741
+namespace test0 {
+ struct A {
+ struct B { };
+ struct C;
+ };
+
+ struct A::C : B { };
+}
+
+// Test that successive base specifiers don't screw with each other.
+namespace test1 {
+ struct Opaque1 {};
+ struct Opaque2 {};
+
+ struct A {
+ struct B { B(Opaque1); };
+ };
+ struct B {
+ B(Opaque2);
+ };
+
+ struct C : A, B {
+ // Apparently the base-or-member lookup is actually ambiguous
+ // without this qualification.
+ C() : A(), test1::B(Opaque2()) {}
+ };
+}
+
+// Test that we don't find the injected class name when parsing base
+// specifiers.
+namespace test2 {
+ template <class T> struct bar {}; // expected-note {{template parameter is declared here}}
+ template <class T> struct foo : bar<foo> {}; // expected-error {{template argument for template type parameter must be a type}}
+}
diff --git a/test/CXX/basic/basic.start/basic.start.main/p2a.cpp b/test/CXX/basic/basic.start/basic.start.main/p2a.cpp
index a6a758798949..b8dfbe78b6cc 100644
--- a/test/CXX/basic/basic.start/basic.start.main/p2a.cpp
+++ b/test/CXX/basic/basic.start/basic.start.main/p2a.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef int Int;
typedef char Char;
diff --git a/test/CXX/basic/basic.start/basic.start.main/p2b.cpp b/test/CXX/basic/basic.start/basic.start.main/p2b.cpp
index caecf6060881..785382cd077b 100644
--- a/test/CXX/basic/basic.start/basic.start.main/p2b.cpp
+++ b/test/CXX/basic/basic.start/basic.start.main/p2b.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef int Int;
typedef char Char;
diff --git a/test/CXX/basic/basic.start/basic.start.main/p2c.cpp b/test/CXX/basic/basic.start/basic.start.main/p2c.cpp
index 8587d8cec791..81b08b98758d 100644
--- a/test/CXX/basic/basic.start/basic.start.main/p2c.cpp
+++ b/test/CXX/basic/basic.start/basic.start.main/p2c.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int main() {
}
diff --git a/test/CXX/basic/basic.start/basic.start.main/p2d.cpp b/test/CXX/basic/basic.start/basic.start.main/p2d.cpp
index 777b5ceb743a..bcdbdb260aee 100644
--- a/test/CXX/basic/basic.start/basic.start.main/p2d.cpp
+++ b/test/CXX/basic/basic.start/basic.start.main/p2d.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
static int main() { // expected-error {{'main' is not allowed to be declared static}}
}
diff --git a/test/CXX/basic/basic.start/basic.start.main/p2e.cpp b/test/CXX/basic/basic.start/basic.start.main/p2e.cpp
index 087cf77476ad..954fdbdb645f 100644
--- a/test/CXX/basic/basic.start/basic.start.main/p2e.cpp
+++ b/test/CXX/basic/basic.start/basic.start.main/p2e.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
inline int main() { // expected-error {{'main' is not allowed to be declared inline}}
}
diff --git a/test/CXX/basic/basic.start/basic.start.main/p2f.cpp b/test/CXX/basic/basic.start/basic.start.main/p2f.cpp
index b7845b13e9a4..a3d6a79a4fa0 100644
--- a/test/CXX/basic/basic.start/basic.start.main/p2f.cpp
+++ b/test/CXX/basic/basic.start/basic.start.main/p2f.cpp
@@ -1,7 +1,7 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void // expected-error {{error: 'main' must return 'int'}}
-main( // expected-error {{error: first argument of 'main' should be of type 'int'}}
+main( // expected-error {{error: first parameter of 'main' (argument count) must be of type 'int'}}
float a
) {
}
diff --git a/test/CXX/basic/basic.start/basic.start.main/p2g.cpp b/test/CXX/basic/basic.start/basic.start.main/p2g.cpp
index 4cedcdb91657..e3209fd3ce94 100644
--- a/test/CXX/basic/basic.start/basic.start.main/p2g.cpp
+++ b/test/CXX/basic/basic.start/basic.start.main/p2g.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int main(int argc, const char* const* argv) {
}
diff --git a/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp b/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp
index c752cec634a2..8a62ae84e2af 100644
--- a/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp
+++ b/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stddef.h>
struct A {
diff --git a/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp b/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp
index 04af5bc82ec5..e00e9486f0bf 100644
--- a/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp
+++ b/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
void operator delete(void*);
diff --git a/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-nodef.cpp b/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-nodef.cpp
index ff653d5fef08..6cd587c4de40 100644
--- a/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-nodef.cpp
+++ b/test/CXX/basic/basic.stc/basic.stc.dynamic/p2-nodef.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int *use_new(int N) {
return new int [N];
diff --git a/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp b/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp
index f3499e4286bc..f4860bb9babf 100644
--- a/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp
+++ b/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int *use_new(int N) {
if (N == 1)
return new int;
diff --git a/test/CXX/class.access/class.access.dcl/p1.cpp b/test/CXX/class.access/class.access.dcl/p1.cpp
index 043a9bfb4e0d..5d7905f9da81 100644
--- a/test/CXX/class.access/class.access.dcl/p1.cpp
+++ b/test/CXX/class.access/class.access.dcl/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify
+// RUN: %clang_cc1 -fsyntax-only -verify
// This is just the test for [namespace.udecl]p4 with 'using'
// uniformly stripped out.
diff --git a/test/CXX/class.derived/class.virtual/p12.cpp b/test/CXX/class.derived/class.virtual/p12.cpp
index b5974a021180..208a0d155fe7 100644
--- a/test/CXX/class.derived/class.virtual/p12.cpp
+++ b/test/CXX/class.derived/class.virtual/p12.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -ast-print %s | FileCheck %s
+// RUN: %clang_cc1 -ast-print %s | FileCheck %s
// CHECK: test12_A::foo()
struct test12_A {
diff --git a/test/CXX/class.derived/p2.cpp b/test/CXX/class.derived/p2.cpp
new file mode 100644
index 000000000000..7ef53d36ab7b
--- /dev/null
+++ b/test/CXX/class.derived/p2.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+// "During the lookup for a base class name, non-type names are ignored"
+namespace PR5840 {
+ struct Base {};
+ int Base = 10;
+ struct Derived : Base {};
+}
diff --git a/test/CXX/class/class.friend/p1-ambiguous.cpp b/test/CXX/class/class.friend/p1-ambiguous.cpp
index a02bc5337522..a9dca4fa8ec8 100644
--- a/test/CXX/class/class.friend/p1-ambiguous.cpp
+++ b/test/CXX/class/class.friend/p1-ambiguous.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Make sure that friend declarations don't introduce ambiguous
// declarations.
diff --git a/test/CXX/class/class.friend/p1.cpp b/test/CXX/class/class.friend/p1.cpp
index 7065a7e917fd..886fef5bc4f6 100644
--- a/test/CXX/class/class.friend/p1.cpp
+++ b/test/CXX/class/class.friend/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct Outer {
struct Inner {
diff --git a/test/CXX/class/class.friend/p2.cpp b/test/CXX/class/class.friend/p2.cpp
index 98be2049e756..9fe2b17e5049 100644
--- a/test/CXX/class/class.friend/p2.cpp
+++ b/test/CXX/class/class.friend/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct B0;
diff --git a/test/CXX/class/class.friend/p6.cpp b/test/CXX/class/class.friend/p6.cpp
index 2e8153c6c047..bd4630e2aa9d 100644
--- a/test/CXX/class/class.friend/p6.cpp
+++ b/test/CXX/class/class.friend/p6.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class A {
friend static class B; // expected-error {{'static' is invalid in friend declarations}}
diff --git a/test/CXX/class/class.local/p1.cpp b/test/CXX/class/class.local/p1.cpp
index 8a84f5dbed8a..05ae5c71d15a 100644
--- a/test/CXX/class/class.local/p1.cpp
+++ b/test/CXX/class/class.local/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int x;
void f()
diff --git a/test/CXX/class/class.local/p2.cpp b/test/CXX/class/class.local/p2.cpp
index 854415fe307d..56ff1e53a493 100644
--- a/test/CXX/class/class.local/p2.cpp
+++ b/test/CXX/class/class.local/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -faccess-control
+// RUN: %clang_cc1 -fsyntax-only -verify %s -faccess-control
struct A { };
@@ -7,6 +7,5 @@ void f() {
B b;
- A *a = &b; // expected-error{{conversion from 'struct B' to inaccessible base class 'struct A'}} \
- expected-error{{incompatible type initializing 'struct B *', expected 'struct A *'}}
+ A *a = &b; // expected-error{{conversion from 'struct B' to inaccessible base class 'struct A'}}
}
diff --git a/test/CXX/class/class.local/p3.cpp b/test/CXX/class/class.local/p3.cpp
index 9c625d18c95c..c24d5d8a09a2 100644
--- a/test/CXX/class/class.local/p3.cpp
+++ b/test/CXX/class/class.local/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f1() {
struct X {
diff --git a/test/CXX/class/class.local/p4.cpp b/test/CXX/class/class.local/p4.cpp
index f2432ec97393..d7807440cc9c 100644
--- a/test/CXX/class/class.local/p4.cpp
+++ b/test/CXX/class/class.local/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f() {
struct X {
diff --git a/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp
index b90661deefe6..f5fbf7a08c20 100644
--- a/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp
+++ b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// [class.mfct.non-static]p3:
// When an id-expression (5.1) that is not part of a class member
diff --git a/test/CXX/class/class.nest/p1.cpp b/test/CXX/class/class.nest/p1.cpp
index bbc49f9e95e7..f1f5496d565b 100644
--- a/test/CXX/class/class.nest/p1.cpp
+++ b/test/CXX/class/class.nest/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class Outer {
int x;
diff --git a/test/CXX/class/class.nested.type/p1.cpp b/test/CXX/class/class.nested.type/p1.cpp
index 61ccd281ca93..4a04a448595c 100644
--- a/test/CXX/class/class.nested.type/p1.cpp
+++ b/test/CXX/class/class.nested.type/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class X {
public:
diff --git a/test/CXX/class/class.union/p1.cpp b/test/CXX/class/class.union/p1.cpp
index 9c969c5b7552..87946484ec18 100644
--- a/test/CXX/class/class.union/p1.cpp
+++ b/test/CXX/class/class.union/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void abort() __attribute__((noreturn));
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
index 2ca7165aad48..1f962a98db6e 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
template<typename T> struct X0 { };
struct X1 { };
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp
index dd30d6ad4f98..b4ec585e48e3 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp
@@ -1,7 +1,6 @@
-// RUN: clang-cc -emit-llvm-only -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -verify %s
// This lame little test was ripped straight from the standard.
-
namespace {
int i; // expected-note {{candidate}}
}
@@ -22,3 +21,22 @@ void test2() {
A::i++;
j++;
}
+
+
+// Test that all anonymous namespaces in a translation unit are
+// considered the same context.
+namespace {
+ class Test3 {}; // expected-note {{previous definition}}
+}
+namespace {
+ class Test3 {}; // expected-error {{redefinition of 'Test3'}}
+}
+
+namespace test4 {
+ namespace {
+ class Test4 {}; // expected-note {{previous definition}}
+ }
+ namespace {
+ class Test4 {}; // expected-error {{redefinition of 'Test4'}}
+ }
+}
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
index 9528c4b99cb8..935f5767889f 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// We have to avoid ADL for this test.
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp
index 00d109e67516..1aa163a8d8d7 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -verify %s
+// RUN: %clang -fsyntax-only -verify %s
namespace test0 {
namespace ns0 {
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p11.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p11.cpp
index b4302d5b4b90..63b302265ea0 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p11.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p11.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++03 [namespace.udecl]p11:
// If a function declaration in namespace scope or block scope has
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp
index 4cbe1be056e4..25371c7029b9 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++03 [namespace.udecl]p12:
// When a using-declaration brings names from a base class into a
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp
index 1a05aae3afd6..ec814b1ab97c 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++03 [namespace.udecl]p3:
// For the purpose of overload resolution, the functions which are
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp
index 8257330dcf35..3f3bf4a2eccb 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
// C++0x N2914.
struct B {
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp
index bf314c41b5fb..f2dc64b80742 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++03 [namespace.udecl]p4:
// A using-declaration used as a member-declaration shall refer to a
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p5-cxx0x.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p5-cxx0x.cpp
index 31218c41300f..edaa975a5890 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p5-cxx0x.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p5-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++0x N2914.
struct A {
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p6-cxx0x.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p6-cxx0x.cpp
index f86f8fb57907..c4b8849e58cf 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p6-cxx0x.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p6-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++0x N2914.
namespace A {
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp
index 59137eb8c9d8..78b5a41648a7 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++0x N2914.
struct X {
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
index bf0f330777d1..fd2df010fc9b 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct Opaque0 {};
struct Opaque1 {};
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udir/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udir/p1.cpp
index fbd205833cad..20a19ab04250 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udir/p1.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udir/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// (this actually occurs before paragraph 1)
namespace test0 {
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp
index dabe13a0ff66..99a4f7aec4c8 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
// XFAIL: *
void f0(void) {
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
index 7dc65c77d4a9..15efd72c1457 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
// XFAIL: *
void f0() {
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
index 7a1ba3e389ba..16a09d836d16 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
// XFAIL: *
class A {
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp
index d1251490ac1a..fd86276e8548 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
// XFAIL: *
typedef const int T0;
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp
index 907a91a86ec4..7bfb655db99b 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
struct S; // expected-note {{forward declaration of 'struct S'}}
extern S a;
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
index 6bdea20df6bd..082a32d8caf3 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
void f() {
auto a = a; // expected-error{{variable 'a' declared with 'auto' type cannot appear in its own initializer}}
}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
index fa3101c6736c..e73925479324 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
void f() {
auto a = a; // expected-error{{variable 'a' declared with 'auto' type cannot appear in its own initializer}}
}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
index b9cdb52f11a1..392888e71b45 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class A {}; // expected-note 3 {{previous use is here}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp
index d97f2b83d1a7..19159e159a0c 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
template<typename T, typename U>
struct is_same {
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p3.cpp
index 867b4f03d41f..28f49d083647 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p3.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
typedef struct s { int x; } s;
typedef int I;
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp
index 69e843796ff7..06c6695008e0 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
// XFAIL: *
struct S {
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp
index 4d0319e58dfb..c38bd292efdb 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++98 -pedantic -Werror %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 -pedantic -Werror %s
int a1[] = { 1, 3, 5 };
void f() {
int a2[] = { 1, 3, 5 };
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.list/basic.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.list/basic.cpp
index f62b4250eef0..5ebc22fd8207 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.list/basic.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.list/basic.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f0() {
int &ir = { 17 }; // expected-error{{reference to type 'int' cannot bind to an initializer list}}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/basic.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/basic.cpp
new file mode 100644
index 000000000000..885d11b9c24a
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/basic.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR5787
+class C {
+ public:
+ ~C() {}
+};
+
+template <typename T>
+class E {
+ public:
+ E& Foo(const C&);
+ E& Bar() { return Foo(C()); }
+};
+
+void Test() {
+ E<int> e;
+ e.Bar();
+}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp
index 66fa2d139844..bd08ab5423b0 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
int g(int);
void f() {
int i;
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p3.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p3.cpp
index 54840f52663f..47e215a0a904 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p3.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p3.cpp
@@ -1,3 +1,3 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int& r1; // expected-error{{declaration of reference variable 'r1' requires an initializer}}
extern int& r2;
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
index 5d34345c49fd..7c63a79de1c6 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -ast-dump %s 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s
// CHECK: example0
void example0() {
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
index 5fa1fff8c86e..a0904189161b 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct Base { }; // expected-note{{candidate function}}
struct Derived : Base { }; // expected-note{{candidate function}}
@@ -91,7 +91,7 @@ void bind_lvalue_to_conv_lvalue() {
void bind_lvalue_to_conv_lvalue_ambig(ConvertibleToBothDerivedRef both) {
Derived &dr1 = both;
- Base &br1 = both; // expected-error{{error: conversion from 'struct ConvertibleToBothDerivedRef' to 'struct Base' is ambiguous}}
+ Base &br1 = both; // expected-error{{reference initialization of type 'struct Base &' with initializer of type 'struct ConvertibleToBothDerivedRef' is ambiguous}}
}
struct IntBitfield {
@@ -125,5 +125,5 @@ void bind_const_lvalue_to_class_conv_temporary() {
}
void bind_lvalue_to_conv_rvalue_ambig(ConvertibleToBothDerived both) {
const Derived &dr1 = both;
- const Base &br1 = both; // expected-error{{error: conversion from 'struct ConvertibleToBothDerived' to 'struct Base const' is ambiguous}}
+ const Base &br1 = both; // expected-error{{reference initialization of type 'struct Base const &' with initializer of type 'struct ConvertibleToBothDerived' is ambiguous}}
}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
index 9d855349f295..00e59e0bd792 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
void f() {
int b[5];
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp
index a3c147db5ee2..ac0ec85db060 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
// Simple form
int ar1[10];
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp
index 82f526745dc6..9d26561ca8de 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
virtual void f(int a = 7);
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p2.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p2.cpp
index 143a0caf82b2..0a107eb2b139 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p2.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void point(int = 3, int = 4);
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp
index ea16f641dba0..e9c5e0ca7b69 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void nondecl(int (*f)(int x = 5)) // {expected-error {{default arguments can only be specified}}}
{
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
index 0cb8186cdb6f..b2129b259bb3 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f0(int i, int j, int k = 3);
void f0(int i, int j, int k);
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp
index 894c9b5a877a..7ee052c5f9cb 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp
@@ -1,8 +1,8 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
float global_f;
-void f0(int *ip = &global_f); // expected-error{{incompatible}}
+void f0(int *ip = &global_f); // expected-error{{cannot initialize}}
// Example from C++03 standard
int a = 1;
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp
index ef00e7b70534..00234ac5fd16 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class C {
void f(int i = 3); // expected-note{{here}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp
index 9c1d3a91c9bd..164eb3682f31 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void h()
{
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p8.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p8.cpp
index 574237ee557d..1a08ab733287 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p8.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p8.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class A {
void f(A* p = this) { } // expected-error{{invalid use of 'this'}}
};
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p3.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p3.cpp
index 01fa6ac35548..ad827fb7b314 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p3.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p3.cpp
@@ -1,3 +1,3 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f(int) { } // expected-note {{previous definition is here}}
void f(const int) { } // expected-error {{redefinition of 'f'}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp
index 5f9a5345cf1c..561e26b068f4 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class A {
public:
int& i;
@@ -16,7 +16,7 @@ void f() {
int b;
A a(b);
- int A::*ip = &A::s; // expected-error {{incompatible type initializing 'int *', expected 'int class A::*'}}
+ int A::*ip = &A::s; // expected-error {{cannot initialize a variable of type 'int class A::*' with an rvalue of type 'int *'}}
a.*&A::s = 10; // expected-error{{right hand operand to .* has non pointer-to-member type 'int *'}}
a.*&A::i = 10; // expected-error{{cannot form a pointer-to-member to member 'i' of reference type 'int &'}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp
index 98e1d302a717..17fd71291000 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++ [dcl.ref]p5:
// There shall be no references to references, no arrays of
diff --git a/test/CXX/expr/expr.unary/expr.delete/p5.cpp b/test/CXX/expr/expr.unary/expr.delete/p5.cpp
index 91e77bcb8bf7..4b2b5ae7cbd5 100644
--- a/test/CXX/expr/expr.unary/expr.delete/p5.cpp
+++ b/test/CXX/expr/expr.unary/expr.delete/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
// If the object being deleted has incomplete class type at the point of
// deletion and the complete class has a non-trivial destructor or a
diff --git a/test/CXX/expr/p3.cpp b/test/CXX/expr/p3.cpp
index 40fe052f6342..6b243c26cc31 100644
--- a/test/CXX/expr/p3.cpp
+++ b/test/CXX/expr/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
double operator +(double, double); // expected-error{{overloaded 'operator+' must have at least one parameter of class or enumeration type}}
diff --git a/test/CXX/expr/p8.cpp b/test/CXX/expr/p8.cpp
index 4f02497486c8..cc834d9dc8d8 100644
--- a/test/CXX/expr/p8.cpp
+++ b/test/CXX/expr/p8.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int a0;
const volatile int a1;
diff --git a/test/CXX/expr/p9.cpp b/test/CXX/expr/p9.cpp
index 1eec3cf0b9f9..803b0cc459b2 100644
--- a/test/CXX/expr/p9.cpp
+++ b/test/CXX/expr/p9.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// floating-point overloads
diff --git a/test/CXX/lex/lex.trigraph/p1.cpp b/test/CXX/lex/lex.trigraph/p1.cpp
index 2a9a34b87eed..aacbc55b28fe 100644
--- a/test/CXX/lex/lex.trigraph/p1.cpp
+++ b/test/CXX/lex/lex.trigraph/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -trigraphs -Wtrigraphs -verify %s
+// RUN: %clang_cc1 -fsyntax-only -trigraphs -Wtrigraphs -verify %s
??=pragma // expected-warning {{trigraph converted to '#' character}}
diff --git a/test/CXX/lex/lex.trigraph/p2.cpp b/test/CXX/lex/lex.trigraph/p2.cpp
index 5be2d46b9189..7d11d5bf5d59 100644
--- a/test/CXX/lex/lex.trigraph/p2.cpp
+++ b/test/CXX/lex/lex.trigraph/p2.cpp
@@ -1,3 +1,3 @@
-// RUN: clang-cc -fsyntax-only -trigraphs -Wtrigraphs -verify %s
+// RUN: %clang_cc1 -fsyntax-only -trigraphs -Wtrigraphs -verify %s
??=define arraycheck(a,b) a??(b??) ??!??! b??(a??) // expected-warning {{trigraph converted to '#' character}} expected-warning {{trigraph converted to '[' character}} expected-warning {{trigraph converted to ']' character}} expected-warning {{trigraph converted to '|' character}} expected-warning {{trigraph converted to '|' character}} expected-warning {{trigraph converted to '[' character}} expected-warning {{trigraph converted to ']' character}}
diff --git a/test/CXX/lex/lex.trigraph/p3.cpp b/test/CXX/lex/lex.trigraph/p3.cpp
index f32af49994af..2be03285fe65 100644
--- a/test/CXX/lex/lex.trigraph/p3.cpp
+++ b/test/CXX/lex/lex.trigraph/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -trigraphs -Wtrigraphs -verify %s
+// RUN: %clang_cc1 -fsyntax-only -trigraphs -Wtrigraphs -verify %s
char a[] =
"?? ??\"??#??$??%??&??*??+??,??.??0??1??2??3??4??5??6"
diff --git a/test/CXX/over/over.match/over.match.best/p1.cpp b/test/CXX/over/over.match/over.match.best/p1.cpp
index df5198357d7b..5c315a736052 100644
--- a/test/CXX/over/over.match/over.match.best/p1.cpp
+++ b/test/CXX/over/over.match/over.match.best/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> int &f0(T*, int);
float &f0(void*, int);
diff --git a/test/CXX/over/over.over/p1.cpp b/test/CXX/over/over.over/p1.cpp
index e7f7d18c69e3..10c60da013cb 100644
--- a/test/CXX/over/over.over/p1.cpp
+++ b/test/CXX/over/over.over/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
template<typename T> T f0(T);
int f0(int);
diff --git a/test/CXX/over/over.over/p2.cpp b/test/CXX/over/over.over/p2.cpp
index 9ab026061893..e8840d205e87 100644
--- a/test/CXX/over/over.over/p2.cpp
+++ b/test/CXX/over/over.over/p2.cpp
@@ -1,10 +1,10 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> T f0(T, T);
void test_f0() {
int (*f0a)(int, int) = f0;
int (*f0b)(int, int) = &f0;
- int (*f0c)(int, float) = f0; // expected-error{{incompatible type}}
+ int (*f0c)(int, float) = f0; // expected-error{{cannot initialize}}
// FIXME: poor error message above!
}
diff --git a/test/CXX/over/over.over/p4.cpp b/test/CXX/over/over.over/p4.cpp
index a05dbaebb71d..4189218f6521 100644
--- a/test/CXX/over/over.over/p4.cpp
+++ b/test/CXX/over/over.over/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> T f0(T);
int f0(int); // expected-note{{candidate function}}
@@ -18,6 +18,6 @@ int f0(int);
void test_f0_2() {
using namespace N;
int (*fp0)(int) = f0; // expected-error{{ambiguous}} \
- // expected-error{{initializing}}
+ // expected-error{{cannot initialize}}
float (*fp1)(float) = f0;
}
diff --git a/test/CXX/special/class.dtor/p2.cpp b/test/CXX/special/class.dtor/p2.cpp
index c0e878fed2a5..b05c992f4115 100644
--- a/test/CXX/special/class.dtor/p2.cpp
+++ b/test/CXX/special/class.dtor/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR5548
struct A {~A();};
diff --git a/test/CXX/special/class.free/p1.cpp b/test/CXX/special/class.free/p1.cpp
index bf99a2782bd5..e4fe127f9f57 100644
--- a/test/CXX/special/class.free/p1.cpp
+++ b/test/CXX/special/class.free/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stddef.h>
struct A {
diff --git a/test/CXX/special/class.free/p6.cpp b/test/CXX/special/class.free/p6.cpp
index b082b85d18c4..555d4e9cfa94 100644
--- a/test/CXX/special/class.free/p6.cpp
+++ b/test/CXX/special/class.free/p6.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stddef.h>
struct A {
diff --git a/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp b/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp
index 79d6c54e29f0..a93249e2268d 100644
--- a/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp
+++ b/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Test class template partial specializations of member templates.
template<typename T>
diff --git a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp
index b3b7635106c5..cfa14f996bbe 100644
--- a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp
+++ b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<int I, int J, class T> class X {
static const int value = 0;
};
diff --git a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp
index 47cf8379c319..59253db3c529 100644
--- a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp
+++ b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, int N>
struct A;
diff --git a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp
index 90bb16256c5b..87e21e4af845 100644
--- a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, int N>
struct A;
diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp
index bc4bb5da4011..b65e1d0194b6 100644
--- a/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, typename U>
struct X0 {
diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp
index fd3fb0bc7a7d..4c05c622926d 100644
--- a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp
+++ b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1-retmem.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> struct X1 { };
diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp
index 6c827209ef0e..17645639fb82 100644
--- a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, typename U> // expected-note{{previous template}}
class X0 {
public:
diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp
index a09d0efa297f..f09faa90d5f9 100644
--- a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp
+++ b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Test instantiation of member functions of class templates defined out-of-line
template<typename T, typename U>
struct X0 {
diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/pr5056.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/pr5056.cpp
index 602fd374c2ab..70c9c70a41c0 100644
--- a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/pr5056.cpp
+++ b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/pr5056.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
extern "C" void * malloc(int);
diff --git a/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp b/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp
index 2ddb8eac6c0a..aa53ebc58025 100644
--- a/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp
+++ b/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Test instantiation of static data members declared out-of-line.
@@ -8,13 +8,13 @@ struct X {
};
template<typename T>
- T X<T>::value = 17; // expected-error{{initialize}}
+ T X<T>::value = 17; // expected-error{{no viable conversion}}
struct InitOkay {
InitOkay(int) { }
};
-struct CannotInit { };
+struct CannotInit { }; // expected-note{{candidate function}}
int &returnInt() { return X<int>::value; }
float &returnFloat() { return X<float>::value; }
diff --git a/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp b/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp
index 949a8b0a72c7..3cefeb821e99 100644
--- a/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X0 {
@@ -6,18 +6,18 @@ struct X0 {
};
template<typename T>
-T X0<T>::value = 0; // expected-error{{initialize}}
+T X0<T>::value = 0; // expected-error{{no viable conversion}}
struct X1 {
X1(int);
};
-struct X2 { };
+struct X2 { }; // expected-note{{candidate function}}
int& get_int() { return X0<int>::value; }
X1& get_X1() { return X0<X1>::value; }
-double*& get_double_ptr() { return X0<int*>::value; } // expected-error{{initialized}}
+double*& get_double_ptr() { return X0<int*>::value; } // expected-error{{non-const lvalue reference to type 'double *' cannot bind to a value of unrelated type 'int *'}}
X2& get_X2() {
return X0<X2>::value; // expected-note{{instantiation}}
diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p4.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p4.cpp
index fe42ba41d81e..b2a6219d04e6 100644
--- a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p4.cpp
+++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<class T> struct A { A(); };
template<class T> int &f(T);
diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p5.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p5.cpp
index 27e4426b9082..4d34968d32aa 100644
--- a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p5.cpp
+++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<class T> int &f(T);
template<class T> float &f(T*, int=1);
diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp
index 399dcc4bed76..e9a3eaa79d67 100644
--- a/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp
+++ b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> void f0(T) { } // expected-note{{previous}}
template<class U> void f0(U) { } // expected-error{{redefinition}}
diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp
index de1a883bcd7a..f42b94a727d2 100644
--- a/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp
+++ b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// All of these function templates are distinct.
template<typename T> void f0(T) { }
diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p6.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p6.cpp
index 2571e45c5cde..a668adafcaf5 100644
--- a/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p6.cpp
+++ b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p6.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<int N, int M>
struct A0 {
diff --git a/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/test/CXX/temp/temp.decls/temp.friend/p1.cpp
index fc392da00acf..7a28e70c9ae6 100644
--- a/test/CXX/temp/temp.decls/temp.friend/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.friend/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only %s
+// RUN: %clang_cc1 -emit-llvm-only %s
template <typename T> struct Num {
T value_;
diff --git a/test/CXX/temp/temp.decls/temp.friend/p3.cpp b/test/CXX/temp/temp.decls/temp.friend/p3.cpp
index 4615bebe711f..17d8c85df00c 100644
--- a/test/CXX/temp/temp.decls/temp.friend/p3.cpp
+++ b/test/CXX/temp/temp.decls/temp.friend/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template <class T> class A {
typedef int Member;
diff --git a/test/CXX/temp/temp.decls/temp.friend/p5.cpp b/test/CXX/temp/temp.decls/temp.friend/p5.cpp
index 74895c490623..f23611bd505e 100644
--- a/test/CXX/temp/temp.decls/temp.friend/p5.cpp
+++ b/test/CXX/temp/temp.decls/temp.friend/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template <class T> class A {
class Member {
diff --git a/test/CXX/temp/temp.decls/temp.mem/p1.cpp b/test/CXX/temp/temp.decls/temp.mem/p1.cpp
index 80b18467a364..1b9da84886e7 100644
--- a/test/CXX/temp/temp.decls/temp.mem/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.mem/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template <class T> struct A {
static T cond;
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p1.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p1.cpp
index 088a9e55eb3e..0aef6adad13f 100644
--- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p1.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
template<typename T> struct A { };
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
new file mode 100644
index 000000000000..a8b83d4854e3
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR5811
+template <class F> void Call(F f) { f(1); }
+template <typename T> void f(T);
+void a() { Call(f<int>); }
+
+// Check the conversion of a template-id to a pointer
+template<typename T, T* Address> struct Constant { };
+Constant<void(int), &f<int> > constant0;
+
+template<typename T, T* Address> void constant_func();
+void test_constant_func() {
+ constant_func<void(int), &f<int> >();
+}
+
+
+// Check typeof() on a template-id referring to a single function
+template<typename T, typename U>
+struct is_same {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_same<T, T> {
+ static const bool value = true;
+};
+
+int typeof0[is_same<__typeof__(f<int>), void (int)>::value? 1 : -1];
+int typeof1[is_same<__typeof__(&f<int>), void (*)(int)>::value? 1 : -1];
+
+template <typename T> void g(T);
+template <typename T> void g(T, T);
+
+int typeof2[is_same<__typeof__(g<float>), void (int)>::value? 1 : -1]; // \
+ // expected-error{{cannot determine the type of an overloaded function}} \
+ // FIXME: expected-error{{use of undeclared identifier}}
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
index 01030b2a8a20..2530f128a49d 100644
--- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
-template<class X, class Y, class Z> X f(Y,Z);
+template<class X, class Y, class Z> X f(Y,Z); // expected-note {{candidate function}}
void g() {
f<int,char*,double>("aa",3.0);
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp
index d193fb2ef296..f6121b373e13 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s
+// RUN: %clang_cc1 %s
typedef char one_byte;
struct two_bytes { char data[2]; };
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
index beb6aad2c089..bcfb71c987eb 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> struct A { };
@@ -15,7 +15,7 @@ void test_f1(int *ip, float fv) {
f1(ip, fv);
}
-template<typename T> void f2(T*, T*);
+template<typename T> void f2(T*, T*); // expected-note 2 {{candidate function}}
struct ConvToIntPtr {
operator int*() const;
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp
index 6f27d3636892..c165c4530668 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> struct A { };
// bullet 1
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
index dbe2ff3e18fb..9fefbe1b0368 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> struct A { };
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp
index 7d175781c2d9..5a9ea084fd61 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// FIXME: [temp.deduct.conv]p2 bullets 1 and 2 can't actually happen without
// references?
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp
index 95bd7fe12159..e23e98abe64d 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct AnyPtr {
template<typename T>
operator T*() const;
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
index 50d31fb2f851..4dca820c1929 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
struct AnyT {
template<typename T>
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp
index 86a34500ad41..99a265af394c 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
template<typename T>
T f0(T, int);
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
index 072789c7d579..99ade4bc9974 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template <class T> T* f(int); // #1
template <class T, class U> T& f(U); // #2
diff --git a/test/CXX/temp/temp.param/p10.cpp b/test/CXX/temp/temp.param/p10.cpp
index 56e7f3281eb6..b9dac75beb91 100644
--- a/test/CXX/temp/temp.param/p10.cpp
+++ b/test/CXX/temp/temp.param/p10.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename> struct Y1;
template<typename, int> struct Y2;
diff --git a/test/CXX/temp/temp.param/p11.cpp b/test/CXX/temp/temp.param/p11.cpp
index 9e7fd39c0a46..5af0c4e91b56 100644
--- a/test/CXX/temp/temp.param/p11.cpp
+++ b/test/CXX/temp/temp.param/p11.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename> struct Y1;
template<typename, int> struct Y2;
diff --git a/test/CXX/temp/temp.param/p12.cpp b/test/CXX/temp/temp.param/p12.cpp
index 3864fbeaa11e..7be38790905f 100644
--- a/test/CXX/temp/temp.param/p12.cpp
+++ b/test/CXX/temp/temp.param/p12.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename> struct Y1; // expected-note{{too few template parameters in template template argument}}
template<typename, int> struct Y2;
diff --git a/test/CXX/temp/temp.param/p13.cpp b/test/CXX/temp/temp.param/p13.cpp
index 559b892d0fd2..7e7dbe58a7b5 100644
--- a/test/CXX/temp/temp.param/p13.cpp
+++ b/test/CXX/temp/temp.param/p13.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// The scope of atemplate-parameterextends from its point of
// declaration until the end of its template. In particular, a
diff --git a/test/CXX/temp/temp.param/p14.cpp b/test/CXX/temp/temp.param/p14.cpp
index 150e0ad636be..a6c53c1e64a6 100644
--- a/test/CXX/temp/temp.param/p14.cpp
+++ b/test/CXX/temp/temp.param/p14.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// XFAIL: *
// A template-parameter shall not be used in its own default argument.
diff --git a/test/CXX/temp/temp.param/p15-cxx0x.cpp b/test/CXX/temp/temp.param/p15-cxx0x.cpp
index 57b6ee22410c..0ce669979c11 100644
--- a/test/CXX/temp/temp.param/p15-cxx0x.cpp
+++ b/test/CXX/temp/temp.param/p15-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
template<typename T> struct X;
template<int I> struct Y;
diff --git a/test/CXX/temp/temp.param/p15.cpp b/test/CXX/temp/temp.param/p15.cpp
index 764bb7bae073..13087791a3db 100644
--- a/test/CXX/temp/temp.param/p15.cpp
+++ b/test/CXX/temp/temp.param/p15.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c++98 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s
template<typename T> struct X;
template<int I> struct Y;
diff --git a/test/CXX/temp/temp.param/p2.cpp b/test/CXX/temp/temp.param/p2.cpp
index d40f99b58a29..41868c5c1ac7 100644
--- a/test/CXX/temp/temp.param/p2.cpp
+++ b/test/CXX/temp/temp.param/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// There is no semantic difference between class and typename in a
// template-parameter. typename followed by an unqualified-id names a
diff --git a/test/CXX/temp/temp.param/p3.cpp b/test/CXX/temp/temp.param/p3.cpp
index 6a76fe20b81a..67d648ea97bb 100644
--- a/test/CXX/temp/temp.param/p3.cpp
+++ b/test/CXX/temp/temp.param/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// A type-parameter defines its identifier to be a type-name (if
// declared with class or typename) or template-name (if declared with
@@ -15,7 +15,7 @@ template<template<class T> class Y> struct X1 {
// could be interpreted as either a non-type template-parameter or a
// type-parameter (because its identifier is the name of an already
// existing class) is taken as a type-parameter. For example,
-class T { /* ... */ };
+class T { /* ... */ }; // expected-note{{candidate function}}
int i;
template<class T, T i> struct X2 {
@@ -23,6 +23,6 @@ template<class T, T i> struct X2 {
{
T t1 = i; //template-parameters T and i
::T t2 = ::i; // global namespace members T and i \
- // expected-error{{cannot initialize}}
+ // expected-error{{no viable conversion}}
}
};
diff --git a/test/CXX/temp/temp.param/p4.cpp b/test/CXX/temp/temp.param/p4.cpp
index 3efff1243600..5ec402a45bf5 100644
--- a/test/CXX/temp/temp.param/p4.cpp
+++ b/test/CXX/temp/temp.param/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class X;
// C++ [temp.param]p4
diff --git a/test/CXX/temp/temp.param/p7.cpp b/test/CXX/temp/temp.param/p7.cpp
index ccc869ae0fbe..13f0367764aa 100644
--- a/test/CXX/temp/temp.param/p7.cpp
+++ b/test/CXX/temp/temp.param/p7.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// A non-type template-parameter shall not be declared to have
// floating point, class, or void type.
diff --git a/test/CXX/temp/temp.param/p8.cpp b/test/CXX/temp/temp.param/p8.cpp
index dd4af17d79fa..fed048cad8b6 100644
--- a/test/CXX/temp/temp.param/p8.cpp
+++ b/test/CXX/temp/temp.param/p8.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<int X[10]> struct A;
template<int *X> struct A;
template<int f(float, double)> struct B;
diff --git a/test/CXX/temp/temp.param/p9.cpp b/test/CXX/temp/temp.param/p9.cpp
index d6b740544d02..625477c4e7b6 100644
--- a/test/CXX/temp/temp.param/p9.cpp
+++ b/test/CXX/temp/temp.param/p9.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c++98 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s
// A default template-argument shall not be specified in a function
// template declaration or a function template definition
diff --git a/test/CXX/temp/temp.res/temp.dep.res/temp.point/p1.cpp b/test/CXX/temp/temp.res/temp.dep.res/temp.point/p1.cpp
index a41b46ff5c9b..75580d245cfc 100644
--- a/test/CXX/temp/temp.res/temp.dep.res/temp.point/p1.cpp
+++ b/test/CXX/temp/temp.res/temp.dep.res/temp.point/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// XFAIL: *
// Note: we fail this test because we perform template instantiation
diff --git a/test/CXX/temp/temp.res/temp.dep/p3.cpp b/test/CXX/temp/temp.res/temp.dep/p3.cpp
index d47f0d683514..c41a4c60ee74 100644
--- a/test/CXX/temp/temp.res/temp.dep/p3.cpp
+++ b/test/CXX/temp/temp.res/temp.dep/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A0 {
struct K { };
};
diff --git a/test/CXX/temp/temp.spec/p5.cpp b/test/CXX/temp/temp.spec/p5.cpp
index d5632e7f341d..c37817cc49b8 100644
--- a/test/CXX/temp/temp.spec/p5.cpp
+++ b/test/CXX/temp/temp.spec/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> inline void f(T) { }
template void f(int); // expected-note{{previous explicit instantiation}}
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p1.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p1.cpp
index 239b8aeb04e4..3843c0d2c880 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p1.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// This test creates cases where implicit instantiations of various entities
// would cause a diagnostic, but provides expliict specializations for those
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p10.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p10.cpp
index 61f1710a6b9e..b81c1e7b2c8f 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p10.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p10.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<class T> class X;
template<> class X<int>; // expected-note{{forward}}
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp
index e794e67a5ef3..5fa2f627b009 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<class T> class Array { /* ... */ };
template<class T> void sort(Array<T>& v);
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p13.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p13.cpp
index 63cf9f5e50d1..fb6d1bed1f71 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p13.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p13.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
template<typename T> void f(T);
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p14.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p14.cpp
index a5d5b9e3c41e..121cb8eedf2f 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p14.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p14.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
template<class T> void f(T) { /* ... */ }
template<class T> inline void g(T) { /* ... */ }
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p15.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p15.cpp
index 840f566362ed..6e7f80842ec0 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p15.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p15.cpp
@@ -1,7 +1,7 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct NonDefaultConstructible {
- NonDefaultConstructible(const NonDefaultConstructible&);
+ NonDefaultConstructible(const NonDefaultConstructible&); // expected-note{{candidate function}}
};
template<typename T, typename U>
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p16.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p16.cpp
index ce40afd40225..2f9a3cbf9457 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p16.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p16.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
template<class T> struct A {
void f(T);
template<class X1> void g1(T, X1);
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp
index 06653044c3bb..3b5b5afa8ed9 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<class T1>
class A {
template<class T2> class B {
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp
index a5877d281d74..4d175a886087 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<class T1> class A {
template<class T2> class B {
template<class T3> void mf1(T3);
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p19.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p19.cpp
index 1f38e5a2c17d..1c2ea7ebde71 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p19.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p19.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X {
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
index 64856605a0a7..654f5abb8a54 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// This test creates cases where implicit instantiations of various entities
// would cause a diagnostic, but provides expliict specializations for those
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp
index d270b8167a16..f987c120a2de 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
void f(T);
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p21.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p21.cpp
index 9dae3eb5190b..ab26f407f3f3 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p21.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p21.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X {
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp
index de05a926338c..84841cb60f4d 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace N {
template<class T> class X;
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp
index ad0d50621367..3eaf89689a25 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp
@@ -1,7 +1,7 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
-struct IntHolder { // expected-note{{here}}
- IntHolder(int);
+struct IntHolder { // expected-note{{here}} // expected-note 2{{candidate function}}
+ IntHolder(int); // expected-note 2{{candidate function}}
};
template<typename T, typename U>
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p5.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p5.cpp
index 58682c786f95..512ea47d5a5f 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p5.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct IntHolder {
IntHolder(int);
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p6.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p6.cpp
index e92d3f0a8883..34c3710e04c5 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p6.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p6.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X0 {
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp
index 49481d2e6d7a..d4ce01fd6501 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace N {
template<class T> class X { /* ... */ };
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp b/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
index d7731f17637c..a4caceae4954 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
template<typename T>
struct X {
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp b/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp
index 3938509961b4..70eb69641867 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -triple x86_64-apple-darwin10 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin10 -o - %s | FileCheck %s
template<typename T>
struct X {
static T member1;
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p1.cpp b/test/CXX/temp/temp.spec/temp.explicit/p1.cpp
index 896e30efb886..626bdf181503 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p1.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct C { };
@@ -14,7 +14,7 @@ template struct X0<void>; // expected-note{{instantiation}}
// Explicitly instantiate a function template specialization
template<typename T>
void f0(T t) {
- ++t; // expected-error{{cannot modify}}
+ ++t; // expected-error{{cannot increment}}
}
template void f0(int);
@@ -48,8 +48,8 @@ template void X1<int>::f<>(int&, int*); // expected-note{{instantiation}}
// Explicitly instantiate members of a class template
struct Incomplete; // expected-note{{forward declaration}}
-struct NonDefaultConstructible {
- NonDefaultConstructible(int);
+struct NonDefaultConstructible { // expected-note{{candidate function}}
+ NonDefaultConstructible(int); // expected-note{{candidate function}}
};
template<typename T, typename U>
@@ -68,7 +68,7 @@ struct X2 {
};
template<typename T, typename U>
-T X2<T, U>::static_member1 = 17; // expected-error{{incompatible type}}
+T X2<T, U>::static_member1 = 17; // expected-error{{cannot initialize}}
template<typename T, typename U>
U X2<T, U>::static_member2; // expected-error{{no matching}}
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p10.cpp b/test/CXX/temp/temp.spec/temp.explicit/p10.cpp
index 900b0b309277..290a874296e1 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p10.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p10.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X0 {
@@ -20,7 +20,7 @@ struct X0<T>::Inner {
};
template<typename T>
-T X0<T>::static_var = 1; // expected-error{{incompatible type}}
+T X0<T>::static_var = 1; // expected-error{{cannot initialize}}
extern template struct X0<void*>;
template struct X0<void*>; // expected-note 2{{instantiation}}
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p12.cpp b/test/CXX/temp/temp.spec/temp.explicit/p12.cpp
index fdf4393d4385..912b8e17bb98 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p12.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p12.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
char* p = 0;
template<class T> T g(T x = &p) { return x; }
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p2.cpp b/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
index f3d2c955cb5b..8538d27f09bc 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Example from the standard
template<class T> class Array { void mf() { } };
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp
index 9057971a5bb4..e30f046c2bd1 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// A declaration of a function template shall be in scope at the point of the
// explicit instantiation of the function template.
@@ -8,14 +8,12 @@ template void f0(int); // okay
// A definition of the class or class template containing a member function
// template shall be in scope at the point of the explicit instantiation of
// the member function template.
-struct X0; // expected-note 2{{forward declaration}}
-template<typename> struct X1; // expected-note 5{{declared here}}
+struct X0; // expected-note 3{{forward declaration}}
+template<typename> struct X1; // expected-note 8{{declared here}}
// FIXME: Repeated diagnostics here!
-template void X0::f0<int>(int); // expected-error 2{{incomplete type}} \
- // expected-error{{does not refer}}
-template void X1<int>::f0<int>(int); // expected-error 2{{implicit instantiation of undefined template}} \
- // expected-error{{does not refer}}
+template void X0::f0<int>(int); // expected-error 3{{incomplete type}} // expected-error{{invalid token after top level declarator}}
+template void X1<int>::f0<int>(int); // expected-error 3{{implicit instantiation of undefined template}} // expected-error{{invalid token after top level declarator}}
// A definition of a class template or class member template shall be in scope
// at the point of the explicit instantiation of the class template or class
@@ -35,10 +33,10 @@ template struct X2<int>::Inner<float>; // expected-error{{explicit instantiation
// A definition of a class template shall be in scope at the point of an
// explicit instantiation of a member function or a static data member of the
// class template.
-template void X1<int>::f1(int); // expected-error{{undefined template}} \
+template void X1<int>::f1(int); // expected-error 2{{undefined template}} \
// expected-error{{does not refer}}
-template int X1<int>::member; // expected-error{{undefined template}} \
+template int X1<int>::member; // expected-error 2{{undefined template}} \
// expected-error{{does not refer}}
// A definition of a member class of a class template shall be in scope at the
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p4.cpp b/test/CXX/temp/temp.spec/temp.explicit/p4.cpp
index 04e511b0b2d5..f292b5a93d38 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p4.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> void f0(T); // expected-note{{here}}
template void f0(int); // expected-error{{explicit instantiation of undefined function template}}
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p5.cpp b/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
index a992648d7c48..13fb0492f1a4 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace N {
template<class T> class Y { // expected-note{{explicit instantiation refers here}}
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p6.cpp b/test/CXX/temp/temp.spec/temp.explicit/p6.cpp
index 763d679db7bb..44ce41b6f957 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p6.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p6.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<class T> class Array { /* ... */ };
template<class T> void sort(Array<T>& v) { }
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p7.cpp b/test/CXX/temp/temp.spec/temp.explicit/p7.cpp
index ffd653dbaa4f..b62e0cb9b1cd 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p7.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p7.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X0 {
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p8.cpp b/test/CXX/temp/temp.spec/temp.explicit/p8.cpp
index 9a5bd3245c78..0c5aec3b0bc8 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p8.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p8.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X0 {
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp b/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp
index 59705d8a20e7..e67233c37547 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -std=c++0x -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -std=c++0x -o - %s | FileCheck %s
template<typename T>
struct X0 {
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p9.cpp b/test/CXX/temp/temp.spec/temp.explicit/p9.cpp
index a53113fb969e..ad973bb7c589 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p9.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p9.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
template<typename T>
struct X0 {
diff --git a/test/CodeCompletion/call.cpp b/test/CodeCompletion/call.cpp
index 8c7bf83e2a3a..5467717bbc77 100644
--- a/test/CodeCompletion/call.cpp
+++ b/test/CodeCompletion/call.cpp
@@ -17,11 +17,11 @@ void f();
void test() {
f(Y(), 0, 0);
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: f(struct N::Y y, <#int ZZ#>)
// CHECK-CC1-NEXT: f(int i, <#int j#>, int k)
// CHECK-CC1-NEXT: f(float x, <#float y#>)
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:13 %s -o - | FileCheck -check-prefix=CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:13 %s -o - | FileCheck -check-prefix=CC2 %s
// CHECK-CC2-NOT: f(struct N::Y y, int ZZ)
// CHECK-CC2: f(int i, int j, <#int k#>)
}
diff --git a/test/CodeCompletion/enum-switch-case-qualified.cpp b/test/CodeCompletion/enum-switch-case-qualified.cpp
index 3e8d75d940d7..d441269336fd 100644
--- a/test/CodeCompletion/enum-switch-case-qualified.cpp
+++ b/test/CodeCompletion/enum-switch-case-qualified.cpp
@@ -21,12 +21,12 @@ namespace M {
void test(enum N::C::Color color) {
switch (color) {
case
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:23:8 %s -o - | FileCheck -check-prefix=CC1 %s
- // CHECK-CC1: Blue : 0 : N::C::Blue
- // CHECK-CC1-NEXT: Green : 0 : N::C::Green
- // CHECK-CC1-NEXT: Indigo : 0 : N::C::Indigo
- // CHECK-CC1-NEXT: Orange : 0 : N::C::Orange
- // CHECK-CC1-NEXT: Red : 0 : N::C::Red
- // CHECK-CC1-NEXT: Violet : 0 : N::C::Violet
- // CHECK-CC1: Yellow : 0 : N::C::Yellow
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:8 %s -o - | FileCheck -check-prefix=CC1 %s
+ // CHECK-CC1: Blue : 0 : [#enum M::N::C::Color#]N::C::Blue
+ // CHECK-CC1-NEXT: Green : 0 : [#enum M::N::C::Color#]N::C::Green
+ // CHECK-CC1-NEXT: Indigo : 0 : [#enum M::N::C::Color#]N::C::Indigo
+ // CHECK-CC1-NEXT: Orange : 0 : [#enum M::N::C::Color#]N::C::Orange
+ // CHECK-CC1-NEXT: Red : 0 : [#enum M::N::C::Color#]N::C::Red
+ // CHECK-CC1-NEXT: Violet : 0 : [#enum M::N::C::Color#]N::C::Violet
+ // CHECK-CC1: Yellow : 0 : [#enum M::N::C::Color#]N::C::Yellow
diff --git a/test/CodeCompletion/enum-switch-case.c b/test/CodeCompletion/enum-switch-case.c
index b7a3676170bf..1a7c58fc1e25 100644
--- a/test/CodeCompletion/enum-switch-case.c
+++ b/test/CodeCompletion/enum-switch-case.c
@@ -19,7 +19,7 @@ void test(enum Color color) {
case Green:
break;
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:10 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:10 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: Blue : 0
// CHECK-CC1-NEXT: Green : 0
// CHECK-CC1-NEXT: Indigo : 0
diff --git a/test/CodeCompletion/enum-switch-case.cpp b/test/CodeCompletion/enum-switch-case.cpp
index 3a010a83dee5..ee8facae0dd3 100644
--- a/test/CodeCompletion/enum-switch-case.cpp
+++ b/test/CodeCompletion/enum-switch-case.cpp
@@ -19,10 +19,10 @@ void test(enum N::Color color) {
break;
case
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:21:8 %s -o - | FileCheck -check-prefix=CC1 %s
- // CHECK-CC1: Blue : 0 : N::Blue
- // CHECK-CC1-NEXT: Green : 0 : N::Green
- // CHECK-CC1-NEXT: Indigo : 0 : N::Indigo
- // CHECK-CC1-NEXT: Orange : 0 : N::Orange
- // CHECK-CC1-NEXT: Violet : 0 : N::Violet
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:21:8 %s -o - | FileCheck -check-prefix=CC1 %s
+ // CHECK-CC1: Blue : 0 : [#enum N::Color#]N::Blue
+ // CHECK-CC1-NEXT: Green : 0 : [#enum N::Color#]N::Green
+ // CHECK-CC1-NEXT: Indigo : 0 : [#enum N::Color#]N::Indigo
+ // CHECK-CC1-NEXT: Orange : 0 : [#enum N::Color#]N::Orange
+ // CHECK-CC1-NEXT: Violet : 0 : [#enum N::Color#]N::Violet
diff --git a/test/CodeCompletion/function-templates.cpp b/test/CodeCompletion/function-templates.cpp
index 302b95516f3b..cdbbf75838e1 100644
--- a/test/CodeCompletion/function-templates.cpp
+++ b/test/CodeCompletion/function-templates.cpp
@@ -14,10 +14,10 @@ public:
void f() {
std::sort(1, 2);
Foo().getAs<int>();
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:15:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:15:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: dyn_cast<<#class X#>>(<#Y *Val#>)
// CHECK-CC1: sort(<#RandomAccessIterator first#>, <#RandomAccessIterator last#>
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:16:9 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:16:9 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: getAs<<#typename T#>>()
)
diff --git a/test/CodeCompletion/functions.cpp b/test/CodeCompletion/functions.cpp
index 85292e4d3076..6838de36e846 100644
--- a/test/CodeCompletion/functions.cpp
+++ b/test/CodeCompletion/functions.cpp
@@ -3,6 +3,6 @@ void f(float x, float y...);
void test() {
::
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:5:5 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:5 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: f(<#int i#>{#, <#int j#>{#, <#int k#>#}#})
// CHECK-CC1: f(<#float x#>, <#float y#><#, ...#>)
diff --git a/test/CodeCompletion/macros.c b/test/CodeCompletion/macros.c
index 20d26f2f773a..0ba2f065c4ea 100644
--- a/test/CodeCompletion/macros.c
+++ b/test/CodeCompletion/macros.c
@@ -13,9 +13,9 @@ struct Point {
};
void test(struct Point *p) {
- // RUN: clang-cc -fsyntax-only -code-completion-macros -code-completion-at=%s:17:14 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-macros -code-completion-at=%s:17:14 %s -o - | FileCheck -check-prefix=CC1 %s
switch (p->IDENTITY(color)) {
- // RUN: clang-cc -fsyntax-only -code-completion-macros -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-macros -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC2 %s
case
}
// CC1: color
diff --git a/test/CodeCompletion/member-access.c b/test/CodeCompletion/member-access.c
index c9ac58f295d4..f41c509c8809 100644
--- a/test/CodeCompletion/member-access.c
+++ b/test/CodeCompletion/member-access.c
@@ -6,7 +6,7 @@ struct Point {
void test(struct Point *p) {
p->
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:8:6 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:8:6 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: x
// CHECK-CC1: y
// CHECK-CC1: z
diff --git a/test/CodeCompletion/member-access.cpp b/test/CodeCompletion/member-access.cpp
index d03180b182de..7d1637c2726f 100644
--- a/test/CodeCompletion/member-access.cpp
+++ b/test/CodeCompletion/member-access.cpp
@@ -27,16 +27,16 @@ public:
void test(const Proxy &p) {
p->
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
- // CHECK-CC1: member1 : 0 : [#Base1::#]member1
- // CHECK-CC1: member1 : 0 : [#Base2::#]member1
- // CHECK-CC1: member2 : 0 : [#Base1::#]member2
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // CHECK-CC1: member1 : 0 : [#int#][#Base1::#]member1
+ // CHECK-CC1: member1 : 0 : [#int#][#Base2::#]member1
+ // CHECK-CC1: member2 : 0 : [#float#][#Base1::#]member2
// CHECK-CC1: member3 : 0
// CHECK-CC1: member4 : 0
- // CHECK-CC1: memfun1 : 0 : [#Base3::#]memfun1(<#float#>)
- // CHECK-CC1: memfun1 : 0 : [#Base3::#]memfun1(<#double#>)[# const#]
- // CHECK-CC1: memfun2 : 0 : [#Base3::#]memfun2(<#int#>)
- // CHECK-CC1: memfun3 : 0 : memfun3(<#int#>)
- // CHECK-CC1: memfun1 : 0 (Hidden) : Base2::memfun1(<#int#>)
+ // CHECK-CC1: memfun1 : 0 : [#void#][#Base3::#]memfun1(<#float#>)
+ // CHECK-CC1: memfun1 : 0 : [#void#][#Base3::#]memfun1(<#double#>)[# const#]
+ // CHECK-CC1: memfun2 : 0 : [#void#][#Base3::#]memfun2(<#int#>)
+ // CHECK-CC1: memfun3 : 0 : [#int#]memfun3(<#int#>)
+ // CHECK-CC1: memfun1 : 0 (Hidden) : [#void#]Base2::memfun1(<#int#>)
// CHECK-CC1: Base1 : 3 : Base1::
diff --git a/test/CodeCompletion/namespace-alias.cpp b/test/CodeCompletion/namespace-alias.cpp
index c1f34178c3ec..45116621474c 100644
--- a/test/CodeCompletion/namespace-alias.cpp
+++ b/test/CodeCompletion/namespace-alias.cpp
@@ -11,7 +11,7 @@ namespace N2 {
namespace I1 { }
namespace New =
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:13:18 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:18 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: I1 : 1
// CHECK-CC1: I4 : 1
// CHECK-CC1: I5 : 1
diff --git a/test/CodeCompletion/namespace.cpp b/test/CodeCompletion/namespace.cpp
index ff90b85b5a57..8a421122b0a6 100644
--- a/test/CodeCompletion/namespace.cpp
+++ b/test/CodeCompletion/namespace.cpp
@@ -8,7 +8,7 @@ namespace N2 {
namespace I1 { }
namespace
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:12 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:12 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: I1 : 0
// CHECK-CC1-NEXT: I5 : 0
diff --git a/test/CodeCompletion/nested-name-specifier.cpp b/test/CodeCompletion/nested-name-specifier.cpp
index 8da7c37d95e9..643418accd07 100644
--- a/test/CodeCompletion/nested-name-specifier.cpp
+++ b/test/CodeCompletion/nested-name-specifier.cpp
@@ -10,7 +10,7 @@ namespace N {
}
N::
-// RUN: clang-cc -fsyntax-only -code-completion-at=%s:12:4 %s -o - | FileCheck -check-prefix=CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:12:4 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: A : 0
// CHECK-CC1: B : 0
// CHECK-CC1: M : 0
diff --git a/test/CodeCompletion/objc-message.m b/test/CodeCompletion/objc-message.m
index 58fc4f5d68f2..a1ae271bbead 100644
--- a/test/CodeCompletion/objc-message.m
+++ b/test/CodeCompletion/objc-message.m
@@ -23,13 +23,13 @@ void func() {
Foo *obj = [Foo new];
[obj xx];
}
-// RUN: clang -cc1 -fsyntax-only -code-completion-at=%s:23:19 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:19 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: categoryClassMethod : 0
// CHECK-CC1: classMethod1:withKeyword: : 0
// CHECK-CC1: classMethod2 : 0
// CHECK-CC1: new : 0
// CHECK-CC1: protocolClassMethod : 0
-// RUN: clang -cc1 -fsyntax-only -code-completion-at=%s:24:8 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:24:8 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: categoryInstanceMethod : 0
// CHECK-CC2: instanceMethod1 : 0
// CHECK-CC2: protocolInstanceMethod : 0
diff --git a/test/CodeCompletion/operator.cpp b/test/CodeCompletion/operator.cpp
index 20ba5ba3fbc8..eef7fbd17ba5 100644
--- a/test/CodeCompletion/operator.cpp
+++ b/test/CodeCompletion/operator.cpp
@@ -8,7 +8,7 @@ void f() {
typedef float Float;
operator
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:11 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:11 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: Float : 0
// CHECK-CC1: + : 0
// CHECK-CC1: short : 0
diff --git a/test/CodeCompletion/ordinary-name.c b/test/CodeCompletion/ordinary-name.c
index 680d6dc989c7..7f5a05ff75aa 100644
--- a/test/CodeCompletion/ordinary-name.c
+++ b/test/CodeCompletion/ordinary-name.c
@@ -4,7 +4,7 @@ typedef struct t TYPEDEF;
void foo() {
int y;
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: y : 0
// CHECK-CC1: foo : 2
// CHECK-NOT-CC1: y : 2
diff --git a/test/CodeCompletion/tag.c b/test/CodeCompletion/tag.c
index 6d9c1eabd561..554d38100b6d 100644
--- a/test/CodeCompletion/tag.c
+++ b/test/CodeCompletion/tag.c
@@ -7,6 +7,6 @@ void X();
void test() {
enum X { x };
enum
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:9:7 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:9:7 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: X : 0
// CHECK-CC1: Y : 2
diff --git a/test/CodeCompletion/tag.cpp b/test/CodeCompletion/tag.cpp
index 17c9707db1a3..17fb0140a0c9 100644
--- a/test/CodeCompletion/tag.cpp
+++ b/test/CodeCompletion/tag.cpp
@@ -15,7 +15,7 @@ namespace N {
void test() {
class
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:17:10 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:10 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: Y : 2
// CHECK-CC1: Z : 2
// CHECK-CC1: A : 4
diff --git a/test/CodeCompletion/templates.cpp b/test/CodeCompletion/templates.cpp
index ff5611823d72..32a7b2125fec 100644
--- a/test/CodeCompletion/templates.cpp
+++ b/test/CodeCompletion/templates.cpp
@@ -17,10 +17,10 @@ namespace std {
void f() {
std::vector<int> v;
v.foo();
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:18:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:18:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: allocator<<#typename T#>>
// CHECK-CC1-NEXT: vector<<#typename T#>{#, <#typename Alloc#>#}>
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:5 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:5 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: foo
// CHECK-CC2: in_base
// CHECK-CC2: stop
diff --git a/test/CodeCompletion/truncation.c b/test/CodeCompletion/truncation.c
index 5af3c4b6d6c9..c7706354183d 100644
--- a/test/CodeCompletion/truncation.c
+++ b/test/CodeCompletion/truncation.c
@@ -2,10 +2,10 @@
struct
-// RUN: clang-cc -fsyntax-only -code-completion-at=%s.h:4:8 -o - %s | FileCheck -check-prefix=CC1 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s.h:4:8 -o - %s | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: X : 1
// CHECK-CC1-NEXT: Y : 1
-// RUN: clang-cc -fsyntax-only -code-completion-at=%s:3:8 -o - %s | FileCheck -check-prefix=CC2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:3:8 -o - %s | FileCheck -check-prefix=CC2 %s
// CHECK-CC2: X : 1
// CHECK-CC2: Xa : 1
// CHECK-CC2: Y : 1
diff --git a/test/CodeCompletion/using-namespace.cpp b/test/CodeCompletion/using-namespace.cpp
index 57383d5db427..f8f31d8c1a0d 100644
--- a/test/CodeCompletion/using-namespace.cpp
+++ b/test/CodeCompletion/using-namespace.cpp
@@ -12,7 +12,7 @@ namespace N2 {
void foo() {
using namespace
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:14:20 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:14:20 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: I1 : 2
// CHECK-CC1: I4 : 2
// CHECK-CC1: I5 : 2
diff --git a/test/CodeCompletion/using.cpp b/test/CodeCompletion/using.cpp
index 305afda2e6dd..ba4c9ce507d5 100644
--- a/test/CodeCompletion/using.cpp
+++ b/test/CodeCompletion/using.cpp
@@ -14,7 +14,7 @@ namespace N2 {
int N3;
using
- // RUN: clang-cc -fsyntax-only -code-completion-at=%s:16:10 %s -o - | FileCheck -check-prefix=CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:16:10 %s -o - | FileCheck -check-prefix=CC1 %s
// CHECK-CC1: I1 : 2
// CHECK-CC1: I4 : 2
// CHECK-CC1: I5 : 2
diff --git a/test/CodeGen/2007-11-29-ArraySizeFromInitializer.c b/test/CodeGen/2007-11-29-ArraySizeFromInitializer.c
index 3b158241c68e..a1ec633f02a3 100644
--- a/test/CodeGen/2007-11-29-ArraySizeFromInitializer.c
+++ b/test/CodeGen/2007-11-29-ArraySizeFromInitializer.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
int array[] = {1, 2, 3, 4, 5};
diff --git a/test/CodeGen/2008-02-07-bitfield-bug.c b/test/CodeGen/2008-02-07-bitfield-bug.c
index dc2ebb75d598..73e31e75e979 100644
--- a/test/CodeGen/2008-02-07-bitfield-bug.c
+++ b/test/CodeGen/2008-02-07-bitfield-bug.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
// PR1990
struct test {
diff --git a/test/CodeGen/2008-02-08-bitfield-bug.c b/test/CodeGen/2008-02-08-bitfield-bug.c
index fc69e58ed3cf..1549b7248b81 100644
--- a/test/CodeGen/2008-02-08-bitfield-bug.c
+++ b/test/CodeGen/2008-02-08-bitfield-bug.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
struct test {
unsigned a:1;
diff --git a/test/CodeGen/2008-02-26-inline-asm-bug.c b/test/CodeGen/2008-02-26-inline-asm-bug.c
index a6816f5de8ff..1103e9ba587e 100644
--- a/test/CodeGen/2008-02-26-inline-asm-bug.c
+++ b/test/CodeGen/2008-02-26-inline-asm-bug.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s | grep "\$0,\$1"
+// RUN: %clang_cc1 -emit-llvm < %s | grep "\$0,\$1"
void f() {
int d1, d2;
diff --git a/test/CodeGen/2008-07-17-no-emit-on-error.c b/test/CodeGen/2008-07-17-no-emit-on-error.c
index 6266b504fd04..0452325a790d 100644
--- a/test/CodeGen/2008-07-17-no-emit-on-error.c
+++ b/test/CodeGen/2008-07-17-no-emit-on-error.c
@@ -1,7 +1,7 @@
// RUN: rm -f %t1.bc
-// RUN: clang-cc -DPASS %s -emit-llvm-bc -o %t1.bc
+// RUN: %clang_cc1 -DPASS %s -emit-llvm-bc -o %t1.bc
// RUN: test -f %t1.bc
-// RUN: not clang-cc %s -emit-llvm-bc -o %t1.bc
+// RUN: not %clang_cc1 %s -emit-llvm-bc -o %t1.bc
// RUN: not test -f %t1.bc
void f() {
diff --git a/test/CodeGen/2008-07-21-mixed-var-fn-decl.c b/test/CodeGen/2008-07-21-mixed-var-fn-decl.c
index 59a3f3884951..ac132604399e 100644
--- a/test/CodeGen/2008-07-21-mixed-var-fn-decl.c
+++ b/test/CodeGen/2008-07-21-mixed-var-fn-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
int g0, f0();
int f1(), g1;
diff --git a/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c b/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c
index 4aa28f8eb484..33bd800456f9 100644
--- a/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c
+++ b/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple=i686-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
struct et7 {
float lv7[0];
diff --git a/test/CodeGen/2008-07-22-packed-bitfield-access.c b/test/CodeGen/2008-07-22-packed-bitfield-access.c
index 437a4be156b7..76b942d5ad03 100644
--- a/test/CodeGen/2008-07-22-packed-bitfield-access.c
+++ b/test/CodeGen/2008-07-22-packed-bitfield-access.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
int main () {
struct foo {
diff --git a/test/CodeGen/2008-07-29-override-alias-decl.c b/test/CodeGen/2008-07-29-override-alias-decl.c
index 18e8982832e0..a4bea0e06cd8 100644
--- a/test/CodeGen/2008-07-29-override-alias-decl.c
+++ b/test/CodeGen/2008-07-29-override-alias-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
int x() { return 1; }
diff --git a/test/CodeGen/2008-07-30-implicit-initialization.c b/test/CodeGen/2008-07-30-implicit-initialization.c
index b225a14e6f0a..8c719bb63cc3 100644
--- a/test/CodeGen/2008-07-30-implicit-initialization.c
+++ b/test/CodeGen/2008-07-30-implicit-initialization.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32" %t | count 2
// RUN: grep "ret i32 0" %t | count 2
// <rdar://problem/6113085>
diff --git a/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c b/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c
index 9fce0aedce41..546590eba64c 100644
--- a/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c
+++ b/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-llvm -o - %s
// <rdar://problem/6108358>
/* For posterity, the issue here begins initial "char []" decl for
diff --git a/test/CodeGen/2008-07-31-asm-labels.c b/test/CodeGen/2008-07-31-asm-labels.c
index d2dcc04bf584..130ad6ba46cc 100644
--- a/test/CodeGen/2008-07-31-asm-labels.c
+++ b/test/CodeGen/2008-07-31-asm-labels.c
@@ -1,9 +1,9 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: grep "@pipe()" %t | count 0
// RUN: grep '_thisIsNotAPipe' %t | count 3
// RUN: grep 'g0' %t | count 0
// RUN: grep '_renamed' %t | count 2
-// RUN: clang-cc -DUSE_DEF -emit-llvm -o %t %s
+// RUN: %clang_cc1 -DUSE_DEF -emit-llvm -o %t %s
// RUN: grep "@pipe()" %t | count 0
// RUN: grep '_thisIsNotAPipe' %t | count 3
// <rdr://6116729>
diff --git a/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c b/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c
index 0ce4ba66ca12..de062631f93b 100644
--- a/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c
+++ b/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis | grep "ret i32 1" | count 3
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis | grep "ret i32 1" | count 3
// <rdr://6115726>
int f0() {
diff --git a/test/CodeGen/2008-08-04-void-pointer-arithmetic.c b/test/CodeGen/2008-08-04-void-pointer-arithmetic.c
index bd4d8f8c18e7..dbfc107da5cc 100644
--- a/test/CodeGen/2008-08-04-void-pointer-arithmetic.c
+++ b/test/CodeGen/2008-08-04-void-pointer-arithmetic.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-llvm -o - %s
// <rdar://problem/6122967>
int f0(void *a, void *b) {
diff --git a/test/CodeGen/2008-08-19-cast-of-typedef.c b/test/CodeGen/2008-08-19-cast-of-typedef.c
index 3435384a5829..740f48a8baa3 100644
--- a/test/CodeGen/2008-08-19-cast-of-typedef.c
+++ b/test/CodeGen/2008-08-19-cast-of-typedef.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
typedef short T[4];
struct s {
diff --git a/test/CodeGen/2008-08-25-incompatible-cond-expr.m b/test/CodeGen/2008-08-25-incompatible-cond-expr.m
index fa9b1970f7fd..f285cca094ed 100644
--- a/test/CodeGen/2008-08-25-incompatible-cond-expr.m
+++ b/test/CodeGen/2008-08-25-incompatible-cond-expr.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@protocol P0
@end
diff --git a/test/CodeGen/2008-09-22-bad-switch-type.c b/test/CodeGen/2008-09-22-bad-switch-type.c
index 2526dd9289c8..853e6bd174b6 100644
--- a/test/CodeGen/2008-09-22-bad-switch-type.c
+++ b/test/CodeGen/2008-09-22-bad-switch-type.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// PR2817
void f0(void) {
diff --git a/test/CodeGen/2008-12-02-logical-or-fold.c b/test/CodeGen/2008-12-02-logical-or-fold.c
index d54bf287d2e2..167ad299ce61 100644
--- a/test/CodeGen/2008-12-02-logical-or-fold.c
+++ b/test/CodeGen/2008-12-02-logical-or-fold.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | grep "store i32 1"
+// RUN: %clang_cc1 -emit-llvm -o - %s | grep "store i32 1"
// PR3150
int a() {return 1||1;}
diff --git a/test/CodeGen/2009-01-21-invalid-debug-info.m b/test/CodeGen/2009-01-21-invalid-debug-info.m
index 1c1028b4ea98..af912e2dc54a 100644
--- a/test/CodeGen/2009-01-21-invalid-debug-info.m
+++ b/test/CodeGen/2009-01-21-invalid-debug-info.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -S -g -o %t.s %s
+// RUN: %clang_cc1 -S -g -o %t.s %s
// FIXME: This test case can be removed at some point (since it will
// no longer effectively test anything). The reason it was causing
diff --git a/test/CodeGen/2009-03-22-increment-bitfield.c b/test/CodeGen/2009-03-22-increment-bitfield.c
index f0aaafda60ea..407aea2b77fa 100644
--- a/test/CodeGen/2009-03-22-increment-bitfield.c
+++ b/test/CodeGen/2009-03-22-increment-bitfield.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -O1 < %s | grep "ret i32 0"
+// RUN: %clang_cc1 -emit-llvm -O1 < %s | grep "ret i32 0"
int a(void) {
return ++(struct x {unsigned x : 2;}){3}.x;
diff --git a/test/CodeGen/2009-04-23-dbg.c b/test/CodeGen/2009-04-23-dbg.c
index c6b179126e03..6a8bf01ba86f 100644
--- a/test/CodeGen/2009-04-23-dbg.c
+++ b/test/CodeGen/2009-04-23-dbg.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -g -o %t %s -emit-llvm-bc && llc %t -o %t.s
+// RUN: %clang_cc1 -g -o %t %s -emit-llvm-bc && llc %t -o %t.s
# 1 "a.c"
# 1 "a.c" 1
# 1 "<built-in>" 1
diff --git a/test/CodeGen/2009-05-22-callingconv.c b/test/CodeGen/2009-05-22-callingconv.c
index 8afc656843ea..3e616d9bea46 100644
--- a/test/CodeGen/2009-05-22-callingconv.c
+++ b/test/CodeGen/2009-05-22-callingconv.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - -triple i386-unknown-unknown | grep call | grep x86_stdcallcc
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple i386-unknown-unknown | grep call | grep x86_stdcallcc
void abort(void) __attribute__((__noreturn__));
typedef void re_string_t;
typedef void re_dfa_t;
diff --git a/test/CodeGen/2009-05-28-const-typedef.c b/test/CodeGen/2009-05-28-const-typedef.c
index e46e83b9478c..3464fde68544 100644
--- a/test/CodeGen/2009-05-28-const-typedef.c
+++ b/test/CodeGen/2009-05-28-const-typedef.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o -
+// RUN: %clang_cc1 -emit-llvm %s -o -
// PR4281
typedef struct {
diff --git a/test/CodeGen/2009-06-01-addrofknr.c b/test/CodeGen/2009-06-01-addrofknr.c
index d51a4a47b478..17d6fdf5d89f 100644
--- a/test/CodeGen/2009-06-01-addrofknr.c
+++ b/test/CodeGen/2009-06-01-addrofknr.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -o %t -emit-llvm -verify
+// RUN: %clang_cc1 %s -o %t -emit-llvm -verify
// PR4289
struct funcptr {
diff --git a/test/CodeGen/2009-06-14-anonymous-union-init.c b/test/CodeGen/2009-06-14-anonymous-union-init.c
index 8d1831a4f3ce..8ccd7bc4ec33 100644
--- a/test/CodeGen/2009-06-14-anonymous-union-init.c
+++ b/test/CodeGen/2009-06-14-anonymous-union-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s | grep "zeroinitializer, i16 16877"
+// RUN: %clang_cc1 -emit-llvm < %s | grep "zeroinitializer, i16 16877"
// PR4390
struct sysfs_dirent {
union { struct sysfs_elem_dir {} s_dir; };
diff --git a/test/CodeGen/2009-07-31-DbgDeclare.c b/test/CodeGen/2009-07-31-DbgDeclare.c
index da49afedbc7a..3ccb2630a49c 100644
--- a/test/CodeGen/2009-07-31-DbgDeclare.c
+++ b/test/CodeGen/2009-07-31-DbgDeclare.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -S -g -o %t.s %s
+// RUN: %clang_cc1 -S -g -o %t.s %s
void foo() {
int i = 0;
i = 42;
diff --git a/test/CodeGen/2009-08-14-vararray-crash.c b/test/CodeGen/2009-08-14-vararray-crash.c
index 40e071bd19a0..7f489bcff1fc 100644
--- a/test/CodeGen/2009-08-14-vararray-crash.c
+++ b/test/CodeGen/2009-08-14-vararray-crash.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s
+// RUN: %clang_cc1 -emit-llvm < %s
void sum1(int rb) {
typedef unsigned char imgrow[rb];
diff --git a/test/CodeGen/2009-10-20-GlobalDebug.c b/test/CodeGen/2009-10-20-GlobalDebug.c
index fddc76c14da8..f19ceb1e73c1 100644
--- a/test/CodeGen/2009-10-20-GlobalDebug.c
+++ b/test/CodeGen/2009-10-20-GlobalDebug.c
@@ -1,4 +1,4 @@
-// RUN: clang -ccc-host-triple i386-apple-darwin10 -S -g -dA %s -o - | FileCheck %s
+// RUN: %clang -ccc-host-triple i386-apple-darwin10 -S -g -dA %s -o - | FileCheck %s
int global;
// CHECK: asciz "global" ## DW_AT_name
int main() { return 0;}
diff --git a/test/CodeGen/OpaqueStruct.c b/test/CodeGen/OpaqueStruct.c
index b994c3000246..fe96126c0581 100644
--- a/test/CodeGen/OpaqueStruct.c
+++ b/test/CodeGen/OpaqueStruct.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
typedef struct a b;
b* x;
diff --git a/test/CodeGen/PR2001-bitfield-reload.c b/test/CodeGen/PR2001-bitfield-reload.c
index 4dec65fd5472..d05aef35793e 100644
--- a/test/CodeGen/PR2001-bitfield-reload.c
+++ b/test/CodeGen/PR2001-bitfield-reload.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -O3 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm -o - %s | FileCheck %s
// PR2001
/* Test that the result of the assignment properly uses the value *in
diff --git a/test/CodeGen/PR2413-void-address-cast-error.c b/test/CodeGen/PR2413-void-address-cast-error.c
index 95a4c6d80fc3..3920dfdec247 100644
--- a/test/CodeGen/PR2413-void-address-cast-error.c
+++ b/test/CodeGen/PR2413-void-address-cast-error.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o -
+// RUN: %clang_cc1 -emit-llvm %s -o -
void f()
{
void *addr;
diff --git a/test/CodeGen/PR2643-null-store-to-bitfield.c b/test/CodeGen/PR2643-null-store-to-bitfield.c
index 6a5b0e92f660..d6c2f36aa503 100644
--- a/test/CodeGen/PR2643-null-store-to-bitfield.c
+++ b/test/CodeGen/PR2643-null-store-to-bitfield.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-llvm -o - %s
// PR2643
void foo() {
diff --git a/test/CodeGen/PR2743-reference-missing-static.c b/test/CodeGen/PR2743-reference-missing-static.c
index e152c5258527..f32d6c5f1445 100644
--- a/test/CodeGen/PR2743-reference-missing-static.c
+++ b/test/CodeGen/PR2743-reference-missing-static.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// PR2743
// <rdr://6094512>
diff --git a/test/CodeGen/PR3130-cond-constant.c b/test/CodeGen/PR3130-cond-constant.c
index e488eeb37f67..dbec6509bd25 100644
--- a/test/CodeGen/PR3130-cond-constant.c
+++ b/test/CodeGen/PR3130-cond-constant.c
@@ -1,3 +1,3 @@
-// RUN: clang-cc -emit-llvm %s -o -
+// RUN: %clang_cc1 -emit-llvm %s -o -
int a = 2.0 ? 1 : 2;
diff --git a/test/CodeGen/PR3589-freestanding-libcalls.c b/test/CodeGen/PR3589-freestanding-libcalls.c
index 14608137188e..8b8282fb80b9 100644
--- a/test/CodeGen/PR3589-freestanding-libcalls.c
+++ b/test/CodeGen/PR3589-freestanding-libcalls.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -emit-llvm %s -o - | grep 'declare i32 @printf' | count 1
-// RUN: clang-cc -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 1
-// RUN: clang-cc -ffreestanding -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 0
+// RUN: %clang_cc1 -emit-llvm %s -o - | grep 'declare i32 @printf' | count 1
+// RUN: %clang_cc1 -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 1
+// RUN: %clang_cc1 -ffreestanding -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 0
int printf(const char *, ...);
diff --git a/test/CodeGen/PR3613-static-decl.c b/test/CodeGen/PR3613-static-decl.c
index a9dc74458926..7f6d979492c4 100644
--- a/test/CodeGen/PR3613-static-decl.c
+++ b/test/CodeGen/PR3613-static-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o %t %s
// RUN: grep '@g0 = internal global %.truct.s0 { i32 3 }' %t | count 1
struct s0 {
diff --git a/test/CodeGen/PR3709-int-to-pointer-sign.c b/test/CodeGen/PR3709-int-to-pointer-sign.c
index 24c42f649bbe..f77737e0f770 100644
--- a/test/CodeGen/PR3709-int-to-pointer-sign.c
+++ b/test/CodeGen/PR3709-int-to-pointer-sign.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -O1 -triple=x86_64-gnu-linux | grep "i64 -1"
+// RUN: %clang_cc1 -emit-llvm %s -o - -O1 -triple=x86_64-gnu-linux | grep "i64 -1"
// PR3709
long long a() { return (long long)(int*)-1;}
diff --git a/test/CodeGen/PR4611-bitfield-layout.c b/test/CodeGen/PR4611-bitfield-layout.c
index bc514bf4dfe2..3975ed0c138a 100644
--- a/test/CodeGen/PR4611-bitfield-layout.c
+++ b/test/CodeGen/PR4611-bitfield-layout.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o %t
// RUN: grep "struct.object_entry = type { i8, \[2 x i8\], i8 }" %t
struct object_entry {
diff --git a/test/CodeGen/PR5060-align.c b/test/CodeGen/PR5060-align.c
index 5d864084b012..efd852055398 100644
--- a/test/CodeGen/PR5060-align.c
+++ b/test/CodeGen/PR5060-align.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -verify | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -verify | FileCheck %s
// CHECK: @foo.p = internal global i8 0, align 32
char *foo(void) {
diff --git a/test/CodeGen/address-space-cast.c b/test/CodeGen/address-space-cast.c
index 2fba5ecd7dca..076c2f16fe6f 100644
--- a/test/CodeGen/address-space-cast.c
+++ b/test/CodeGen/address-space-cast.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s
+// RUN: %clang_cc1 -emit-llvm < %s
volatile unsigned char* const __attribute__((address_space(1))) serial_ctrl = 0x02;
diff --git a/test/CodeGen/address-space-compound-literal.c b/test/CodeGen/address-space-compound-literal.c
index 79d19ed6b6ba..37d9c7bc58f5 100644
--- a/test/CodeGen/address-space-compound-literal.c
+++ b/test/CodeGen/address-space-compound-literal.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s | grep "internal addrspace(1) global i32 1"
+// RUN: %clang_cc1 -emit-llvm < %s | grep "internal addrspace(1) global i32 1"
typedef int a __attribute__((address_space(1)));
a* x = &(a){1};
diff --git a/test/CodeGen/address-space-field1.c b/test/CodeGen/address-space-field1.c
index b041cf55d0b0..61d88f9e7565 100644
--- a/test/CodeGen/address-space-field1.c
+++ b/test/CodeGen/address-space-field1.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm < %s -o - | FileCheck %s
// CHECK:%struct.S = type { i32, i32 }
// CHECK:define void @test_addrspace(%struct.S addrspace(1)* %p1, %struct.S addrspace(2)* %p2) nounwind
// CHECK: [[p1addr:%.*]] = alloca %struct.S addrspace(1)* ; <%struct.S addrspace(1)**> [#uses=3]
diff --git a/test/CodeGen/address-space-field2.c b/test/CodeGen/address-space-field2.c
index 5576e55b63fa..198fd22a3a74 100644
--- a/test/CodeGen/address-space-field2.c
+++ b/test/CodeGen/address-space-field2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
// CHECK: addrspace(1)
// CHECK: addrspace(2)
// CHECK: addrspace(1)
diff --git a/test/CodeGen/address-space-field3.c b/test/CodeGen/address-space-field3.c
index 567757fe6670..090f4a104b05 100644
--- a/test/CodeGen/address-space-field3.c
+++ b/test/CodeGen/address-space-field3.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
// CHECK: addrspace(1)
// CHECK: addrspace(2)
// CHECK: addrspace(1)
diff --git a/test/CodeGen/address-space-field4.c b/test/CodeGen/address-space-field4.c
index 31df018206b5..a1906c0c0059 100644
--- a/test/CodeGen/address-space-field4.c
+++ b/test/CodeGen/address-space-field4.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
// CHECK: addrspace(2)
// CHECK: addrspace(3)
// CHECK: addrspace(1)
diff --git a/test/CodeGen/address-space.c b/test/CodeGen/address-space.c
index 8536f161533b..5b5891955714 100644
--- a/test/CodeGen/address-space.c
+++ b/test/CodeGen/address-space.c
@@ -1,8 +1,8 @@
-// RUN: clang-cc -emit-llvm < %s | grep '@foo.*global.*addrspace(1)'
-// RUN: clang-cc -emit-llvm < %s | grep '@ban.*global.*addrspace(1)'
-// RUN: clang-cc -emit-llvm < %s | grep 'load.*addrspace(1)' | count 2
-// RUN: clang-cc -emit-llvm < %s | grep 'load.*addrspace(2).. @A'
-// RUN: clang-cc -emit-llvm < %s | grep 'load.*addrspace(2).. @B'
+// RUN: %clang_cc1 -emit-llvm < %s | grep '@foo.*global.*addrspace(1)'
+// RUN: %clang_cc1 -emit-llvm < %s | grep '@ban.*global.*addrspace(1)'
+// RUN: %clang_cc1 -emit-llvm < %s | grep 'load.*addrspace(1)' | count 2
+// RUN: %clang_cc1 -emit-llvm < %s | grep 'load.*addrspace(2).. @A'
+// RUN: %clang_cc1 -emit-llvm < %s | grep 'load.*addrspace(2).. @B'
int foo __attribute__((address_space(1)));
int ban[10] __attribute__((address_space(1)));
diff --git a/test/CodeGen/alias.c b/test/CodeGen/alias.c
index f8836e6f605f..f2e87a5dafbc 100644
--- a/test/CodeGen/alias.c
+++ b/test/CodeGen/alias.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
// RUN: grep '@g0 = common global i32 0' %t
// RUN: grep '@f1 = alias void ()\* @f0' %t
// RUN: grep '@g1 = alias i32\* @g0' %t
diff --git a/test/CodeGen/align-local.c b/test/CodeGen/align-local.c
index afbe1d5dd0d0..b839ee14a10b 100644
--- a/test/CodeGen/align-local.c
+++ b/test/CodeGen/align-local.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s | grep "align 16" | count 2
+// RUN: %clang_cc1 -emit-llvm < %s | grep "align 16" | count 2
typedef struct __attribute((aligned(16))) {int x[4];} ff;
diff --git a/test/CodeGen/alignof.c b/test/CodeGen/alignof.c
index 71c275018ed5..64d0c0835687 100644
--- a/test/CodeGen/alignof.c
+++ b/test/CodeGen/alignof.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -O1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -O1 -emit-llvm -o %t %s
// RUN: grep 'ret i32 4' %t
enum e0 { E0 };
diff --git a/test/CodeGen/always_inline.c b/test/CodeGen/always_inline.c
index d995ea11be09..c91fd43f2761 100644
--- a/test/CodeGen/always_inline.c
+++ b/test/CodeGen/always_inline.c
@@ -1,7 +1,7 @@
-// RUN: clang -emit-llvm -S -o %t %s
+// RUN: %clang -emit-llvm -S -o %t %s
// RUN: not grep '@f0' %t
// RUN: not grep 'call ' %t
-// RUN: clang -mllvm -disable-llvm-optzns -emit-llvm -S -o %t %s
+// RUN: %clang -mllvm -disable-llvm-optzns -emit-llvm -S -o %t %s
// RUN: grep '@f0' %t | count 2
//static int f0() {
diff --git a/test/CodeGen/arm-arguments.c b/test/CodeGen/arm-arguments.c
index 945c1f2e668d..fb61b0f78497 100644
--- a/test/CodeGen/arm-arguments.c
+++ b/test/CodeGen/arm-arguments.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -triple armv7-apple-darwin9 -target-abi apcs-gnu -emit-llvm -w -o - %s | FileCheck -check-prefix=APCS-GNU %s
-// RUN: clang-cc -triple armv7-apple-darwin9 -target-abi aapcs -emit-llvm -w -o - %s | FileCheck -check-prefix=AAPCS %s
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -target-abi apcs-gnu -emit-llvm -w -o - %s | FileCheck -check-prefix=APCS-GNU %s
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -target-abi aapcs -emit-llvm -w -o - %s | FileCheck -check-prefix=AAPCS %s
// APCS-GNU: define arm_apcscc signext i8 @f0()
// AAPCS: define arm_aapcscc signext i8 @f0()
diff --git a/test/CodeGen/arm_asm_clobber.c b/test/CodeGen/arm_asm_clobber.c
index 05eb2e211f24..a7ca0b5332b0 100644
--- a/test/CodeGen/arm_asm_clobber.c
+++ b/test/CodeGen/arm_asm_clobber.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple armv6-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple armv6-unknown-unknown -emit-llvm -o %t %s
void test0(void) {
asm volatile("mov r0, r0" :: );
diff --git a/test/CodeGen/array.c b/test/CodeGen/array.c
index 294dabfbbb5d..0b401ea8190c 100644
--- a/test/CodeGen/array.c
+++ b/test/CodeGen/array.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
void f() {
int a[2];
diff --git a/test/CodeGen/asm-2.c b/test/CodeGen/asm-2.c
index 72b23b150592..9d73608a4c18 100644
--- a/test/CodeGen/asm-2.c
+++ b/test/CodeGen/asm-2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t -triple i386-pc-linux-gnu -O2
+// RUN: %clang_cc1 -emit-llvm %s -o %t -triple i386-pc-linux-gnu -O2
// RUN: not grep "load" %t
// <rdar://problem/6841383>
diff --git a/test/CodeGen/asm-inout.c b/test/CodeGen/asm-inout.c
index 8ddd2acaf87c..407660927100 100644
--- a/test/CodeGen/asm-inout.c
+++ b/test/CodeGen/asm-inout.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o %t
// RUN: grep "load i8\*\*\* %p.addr" %t | count 1
// XFAIL: *
diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c
index 41951b8ac21f..df593d79fa17 100644
--- a/test/CodeGen/asm.c
+++ b/test/CodeGen/asm.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o %t
void t1(int len) {
__asm__ volatile("" : "=&r"(len), "+&r"(len));
}
diff --git a/test/CodeGen/atomic.c b/test/CodeGen/atomic.c
index 355f7b83231e..ff304f57f01d 100644
--- a/test/CodeGen/atomic.c
+++ b/test/CodeGen/atomic.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - -triple=i686-apple-darwin9 > %t1
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 > %t1
// RUN: grep @llvm.atomic.load.add.i32 %t1 | count 3
// RUN: grep @llvm.atomic.load.sub.i8 %t1 | count 2
// RUN: grep @llvm.atomic.load.min.i32 %t1
diff --git a/test/CodeGen/attr-cleanup.c b/test/CodeGen/attr-cleanup.c
index 9105ededa20c..7c2053d7ac35 100644
--- a/test/CodeGen/attr-cleanup.c
+++ b/test/CodeGen/attr-cleanup.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
// <rdar://problem/6827047>
void f(void* arg);
diff --git a/test/CodeGen/attr-nodebug.c b/test/CodeGen/attr-nodebug.c
index e0c813399fb9..66caa2b38fac 100644
--- a/test/CodeGen/attr-nodebug.c
+++ b/test/CodeGen/attr-nodebug.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -g -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -emit-llvm -o %t %s
// RUN: not grep 'call void @llvm.dbg.func.start' %t
void t1() __attribute__((nodebug));
diff --git a/test/CodeGen/attr-noinline.c b/test/CodeGen/attr-noinline.c
index 719d6eb88fb3..dbca71ff5fb2 100644
--- a/test/CodeGen/attr-noinline.c
+++ b/test/CodeGen/attr-noinline.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -g -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -emit-llvm -o %t %s
// RUN: grep 'noinline' %t
void t1() __attribute__((noinline));
diff --git a/test/CodeGen/attr-used.c b/test/CodeGen/attr-used.c
index 5537ec2f4cef..bc92b9435b32 100644
--- a/test/CodeGen/attr-used.c
+++ b/test/CodeGen/attr-used.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: grep '@llvm.used = .*@g0' %t
// RUN: grep '@llvm.used = .*@f0' %t
// RUN: grep '@llvm.used = .*@f1.l0' %t
diff --git a/test/CodeGen/attributes.c b/test/CodeGen/attributes.c
index 29672c2ecb3d..68bc73daec97 100644
--- a/test/CodeGen/attributes.c
+++ b/test/CodeGen/attributes.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -triple i386-linux-gnu -o %t %s
+// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu -o %t %s
// RUN: FileCheck --input-file=%t %s
// CHECK: @t5 = weak global i32 2
diff --git a/test/CodeGen/bitfield-assign.c b/test/CodeGen/bitfield-assign.c
index 575a9fb766cf..b8ab61339cf6 100644
--- a/test/CodeGen/bitfield-assign.c
+++ b/test/CodeGen/bitfield-assign.c
@@ -4,12 +4,12 @@
/* Check that we get one load for each simple assign and two for the
compound assign (load the old value before the add then load again
to store back). Also check that our g0 pattern is good. */
-// RUN: clang-cc -triple i386-unknown-unknown -O0 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -O0 -emit-llvm -o %t %s
// RUN: grep 'load ' %t | count 5
// RUN: grep "@g0" %t | count 4
// Check that we got the right value.
-// RUN: clang-cc -triple i386-unknown-unknown -O3 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm -o %t %s
// RUN: grep 'load ' %t | count 0
// RUN: grep "@g0" %t | count 0
diff --git a/test/CodeGen/bitfield-init.c b/test/CodeGen/bitfield-init.c
index 7459614a1254..bee4e7d3a059 100644
--- a/test/CodeGen/bitfield-init.c
+++ b/test/CodeGen/bitfield-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
typedef struct { unsigned int i: 1; } c;
const c d = { 1 };
diff --git a/test/CodeGen/bitfield-promote.c b/test/CodeGen/bitfield-promote.c
index 1290a1ecd33b..4c3292c48feb 100644
--- a/test/CodeGen/bitfield-promote.c
+++ b/test/CodeGen/bitfield-promote.c
@@ -1,4 +1,4 @@
-// RUN: clang -O3 -emit-llvm -S -o %t %s
+// RUN: %clang -O3 -emit-llvm -S -o %t %s
// RUN: grep 'ret i64 4294967292' %t | count 2
// RUN: grep 'ret i64 -4' %t | count 1
diff --git a/test/CodeGen/bitfield.c b/test/CodeGen/bitfield.c
index 9cd79d3d5870..dea5e43e0f1c 100644
--- a/test/CodeGen/bitfield.c
+++ b/test/CodeGen/bitfield.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t -O3
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o %t -O3
// RUN: grep "ret i32" %t | count 4
// RUN: grep "ret i32 1" %t | count 4
diff --git a/test/CodeGen/blocks-1.c b/test/CodeGen/blocks-1.c
index ae5a74aab6f0..71b4de8beff5 100644
--- a/test/CodeGen/blocks-1.c
+++ b/test/CodeGen/blocks-1.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t -fblocks
+// RUN: %clang_cc1 %s -emit-llvm -o %t -fblocks
// RUN: grep "_Block_object_dispose" %t | count 17
// RUN: grep "__copy_helper_block_" %t | count 16
// RUN: grep "__destroy_helper_block_" %t | count 16
diff --git a/test/CodeGen/blocks-2.c b/test/CodeGen/blocks-2.c
index c22e882f1b79..4e574dafec52 100644
--- a/test/CodeGen/blocks-2.c
+++ b/test/CodeGen/blocks-2.c
@@ -1,8 +1,8 @@
-// RUN: clang-cc -g %s -emit-llvm -o %t -fblocks
+// RUN: %clang_cc1 -g %s -emit-llvm -o %t -fblocks
// RUN: grep "func.start" %t | count 4
-// RUN: clang-cc -g %s -triple i386-unknown-unknown -emit-llvm -o %t -fblocks -fblock-introspection
+// RUN: %clang_cc1 -g %s -triple i386-unknown-unknown -emit-llvm -o %t -fblocks -fblock-introspection
// RUN: grep "v8@?0i4" %t | count 1
-// RUN: clang-cc -g %s -triple i386-unknown-unknown -emit-llvm -o %t -fblocks
+// RUN: %clang_cc1 -g %s -triple i386-unknown-unknown -emit-llvm -o %t -fblocks
// RUN: grep "v8@?0i4" %t | count 0
// 1 declaration, 1 bar, 1 test_block_dbg and 1 for the block.
// XFAIL: *
diff --git a/test/CodeGen/blocks-aligned-byref-variable.c b/test/CodeGen/blocks-aligned-byref-variable.c
index 61522fd2da77..79ac41dcd5d5 100644
--- a/test/CodeGen/blocks-aligned-byref-variable.c
+++ b/test/CodeGen/blocks-aligned-byref-variable.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -emit-llvm -o - -triple x86_64-apple-darwin10
-// RUN: clang-cc -emit-llvm -o - -triple i386-apple-darwin10
+// RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-apple-darwin10
+// RUN: %clang_cc1 -emit-llvm -o - -triple i386-apple-darwin10
typedef int __attribute__((aligned(32))) ai;
void f() {
diff --git a/test/CodeGen/blocks-seq.c b/test/CodeGen/blocks-seq.c
index 4006b715f464..3557b48053ff 100644
--- a/test/CodeGen/blocks-seq.c
+++ b/test/CodeGen/blocks-seq.c
@@ -1,7 +1,7 @@
// FIXME: We forcibly strip the names so that the test doesn't vary between
// builds with and without asserts. We need a better solution for this.
-// RUN: clang-cc -fblocks -triple x86_64-apple-darwin10 -emit-llvm-bc -o - %s | opt -strip | llvm-dis > %t
+// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -emit-llvm-bc -o - %s | opt -strip | llvm-dis > %t
// RUN: grep '%6 = call i32 (...)\* @rhs()' %t | count 1
// RUN: grep '%7 = getelementptr inbounds %0\* %1, i32 0, i32 1' %t | count 1
// RUN: grep '%8 = load %0\*\* %7' %t | count 1
diff --git a/test/CodeGen/blocks.c b/test/CodeGen/blocks.c
index eddf25c74a83..0ef10c14e009 100644
--- a/test/CodeGen/blocks.c
+++ b/test/CodeGen/blocks.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t -fblocks
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o %t -fblocks
void (^f)(void) = ^{};
// rdar://6768379
diff --git a/test/CodeGen/bool-bitfield.c b/test/CodeGen/bool-bitfield.c
index 50990a47c285..cb2d1dbd024d 100644
--- a/test/CodeGen/bool-bitfield.c
+++ b/test/CodeGen/bool-bitfield.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
// From GCC PR19331
struct SysParams
diff --git a/test/CodeGen/bool-convert.c b/test/CodeGen/bool-convert.c
index 4df81bb82d7c..8bde837ed3ae 100644
--- a/test/CodeGen/bool-convert.c
+++ b/test/CodeGen/bool-convert.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s | grep i1 | count 1
+// RUN: %clang_cc1 -emit-llvm < %s | grep i1 | count 1
// All of these should uses the memory representation of _Bool
struct teststruct1 {_Bool a, b;} test1;
_Bool* test2;
diff --git a/test/CodeGen/bool-init.c b/test/CodeGen/bool-init.c
index 7d331ed07eb0..1a8f127b868f 100644
--- a/test/CodeGen/bool-init.c
+++ b/test/CodeGen/bool-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s | grep i1 | count 1
+// RUN: %clang_cc1 -emit-llvm < %s | grep i1 | count 1
// Check that the type of this global isn't i1
_Bool test = &test;
diff --git a/test/CodeGen/boolassign.c b/test/CodeGen/boolassign.c
index 73aab8db7cb1..8c563194e093 100644
--- a/test/CodeGen/boolassign.c
+++ b/test/CodeGen/boolassign.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
int testBoolAssign(void) {
int ss;
diff --git a/test/CodeGen/builtin-attributes.c b/test/CodeGen/builtin-attributes.c
index 184e9676edaa..944aac3f521f 100644
--- a/test/CodeGen/builtin-attributes.c
+++ b/test/CodeGen/builtin-attributes.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple arm-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple arm-unknown-unknown -emit-llvm -o - %s | FileCheck %s
// CHECK: declare arm_aapcscc i32 @printf(i8*, ...)
void f0() {
diff --git a/test/CodeGen/builtin-count-zeros.c b/test/CodeGen/builtin-count-zeros.c
index ff08bd108357..5a0be2fb867f 100644
--- a/test/CodeGen/builtin-count-zeros.c
+++ b/test/CodeGen/builtin-count-zeros.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | grep 'cttz' | count 2
-// RUN: clang-cc -emit-llvm %s -o - | grep 'ctlz' | count 2
+// RUN: %clang_cc1 -emit-llvm %s -o - | grep 'cttz' | count 2
+// RUN: %clang_cc1 -emit-llvm %s -o - | grep 'ctlz' | count 2
int a(int a) {return __builtin_ctz(a) + __builtin_clz(a);}
diff --git a/test/CodeGen/builtin-memfns.c b/test/CodeGen/builtin-memfns.c
index f1d092502dc2..a7b716b931c7 100644
--- a/test/CodeGen/builtin-memfns.c
+++ b/test/CodeGen/builtin-memfns.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
// RUN: grep '@llvm.memset.i32' %t
// RUN: grep '@llvm.memcpy.i32' %t
// RUN: grep '@llvm.memmove.i32' %t
diff --git a/test/CodeGen/builtin-nanf.c b/test/CodeGen/builtin-nanf.c
index 8f7d2a1e443b..ae37c9dc8077 100644
--- a/test/CodeGen/builtin-nanf.c
+++ b/test/CodeGen/builtin-nanf.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep 'float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000020000000, float 0x7FF8000000000000, float 0x7FF80001E0000000, float 0x7FF8001E00000000, float 0x7FF801E000000000, float 0x7FF81E0000000000, float 0x7FF9E00000000000, float 0x7FFFFFFFE0000000' %t
float n[] = {
diff --git a/test/CodeGen/builtin-rename.c b/test/CodeGen/builtin-rename.c
index d0b5c2472de6..0b71d8880623 100644
--- a/test/CodeGen/builtin-rename.c
+++ b/test/CodeGen/builtin-rename.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | grep 'declare.*printf' | count 1
+// RUN: %clang_cc1 %s -emit-llvm -o - | grep 'declare.*printf' | count 1
// PR3612
int printf(const char *, ...);
diff --git a/test/CodeGen/builtin-stackaddress.c b/test/CodeGen/builtin-stackaddress.c
index d8e58c4f6be7..f13b90eb9ed3 100644
--- a/test/CodeGen/builtin-stackaddress.c
+++ b/test/CodeGen/builtin-stackaddress.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -emit-llvm < %s | grep "llvm.returnaddress"
-// RUN: clang-cc -emit-llvm < %s | grep "llvm.frameaddress"
+// RUN: %clang_cc1 -emit-llvm < %s | grep "llvm.returnaddress"
+// RUN: %clang_cc1 -emit-llvm < %s | grep "llvm.frameaddress"
void* a(unsigned x) {
return __builtin_return_address(0);
}
diff --git a/test/CodeGen/builtin-unwind-init.c b/test/CodeGen/builtin-unwind-init.c
index 56872f7434ee..6fa77667bdf7 100644
--- a/test/CodeGen/builtin-unwind-init.c
+++ b/test/CodeGen/builtin-unwind-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm < %s -o - | FileCheck %s
void a() { __builtin_unwind_init(); }
diff --git a/test/CodeGen/builtinmemcpy.c b/test/CodeGen/builtinmemcpy.c
index d1fdebbe8287..93253c5a8a48 100644
--- a/test/CodeGen/builtinmemcpy.c
+++ b/test/CodeGen/builtinmemcpy.c
@@ -1,3 +1,3 @@
-// RUN: clang-cc -emit-llvm < %s -o - | grep "llvm.memcpy"
+// RUN: %clang_cc1 -emit-llvm < %s -o - | grep "llvm.memcpy"
char* x(char* a, char* b) {return __builtin_memcpy(a, b, 4);}
diff --git a/test/CodeGen/builtins-x86.c b/test/CodeGen/builtins-x86.c
index c82ecde1ff39..2eadd7f884d8 100644
--- a/test/CodeGen/builtins-x86.c
+++ b/test/CodeGen/builtins-x86.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -DUSE_64 -triple x86_64-unknown-unknown -emit-llvm -o %t %s
-// RUN: clang-cc -DUSE_ALL -triple x86_64-unknown-unknown -fsyntax-only -o %t %s
+// RUN: %clang_cc1 -DUSE_64 -triple x86_64-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -DUSE_ALL -triple x86_64-unknown-unknown -fsyntax-only -o %t %s
#ifdef USE_ALL
#define USE_3DNOW
diff --git a/test/CodeGen/builtins.c b/test/CodeGen/builtins.c
index 11bcc14249ac..4fa4785755b9 100644
--- a/test/CodeGen/builtins.c
+++ b/test/CodeGen/builtins.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: not grep __builtin %t
int printf(const char *, ...);
diff --git a/test/CodeGen/builtinshufflevector.c b/test/CodeGen/builtinshufflevector.c
index 9a3ae610282e..f365844c6d43 100644
--- a/test/CodeGen/builtinshufflevector.c
+++ b/test/CodeGen/builtinshufflevector.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s | grep 'shufflevector' | count 1
+// RUN: %clang_cc1 -emit-llvm < %s | grep 'shufflevector' | count 1
typedef int v4si __attribute__ ((vector_size (16)));
v4si a(v4si x, v4si y) {return __builtin_shufflevector(x, y, 3, 2, 5, 7);}
diff --git a/test/CodeGen/c-strings.c b/test/CodeGen/c-strings.c
index 2cf4036cb675..4fbeb7b87e22 100644
--- a/test/CodeGen/c-strings.c
+++ b/test/CodeGen/c-strings.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: grep "hello" %t | count 3
// RUN: grep 'c"hello\\00"' %t | count 2
// RUN: grep 'c"hello\\00\\00\\00"' %t | count 1
diff --git a/test/CodeGen/call-knr-indirect.c b/test/CodeGen/call-knr-indirect.c
index 17be015bffb1..2e923b303cd0 100644
--- a/test/CodeGen/call-knr-indirect.c
+++ b/test/CodeGen/call-knr-indirect.c
@@ -1,4 +1,4 @@
-// RUN: clang %s -O0 -emit-llvm -S -o - | grep 'call.*rb_define_global_function'
+// RUN: %clang %s -O0 -emit-llvm -S -o - | grep 'call.*rb_define_global_function'
// This should call rb_define_global_function, not rb_f_chop.
void rb_define_global_function (const char*,void(*)(),int);
diff --git a/test/CodeGen/cast.c b/test/CodeGen/cast.c
index 6fb2b116d47b..5f340c5bb670 100644
--- a/test/CodeGen/cast.c
+++ b/test/CodeGen/cast.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
extern void go(const void *p);
float v[2] = { 0.0, 1.0 };
diff --git a/test/CodeGen/cfstring.c b/test/CodeGen/cfstring.c
index a78dfdaf6502..1f0977f0398a 100644
--- a/test/CodeGen/cfstring.c
+++ b/test/CodeGen/cfstring.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
#define CFSTR __builtin___CFStringMakeConstantString
void f() {
diff --git a/test/CodeGen/cfstring2.c b/test/CodeGen/cfstring2.c
index ceefeb9e832c..c760f5dcf5eb 100644
--- a/test/CodeGen/cfstring2.c
+++ b/test/CodeGen/cfstring2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
typedef const struct __CFString * CFStringRef;
diff --git a/test/CodeGen/cleanup-stack.c b/test/CodeGen/cleanup-stack.c
index 3954d85de2b0..72a1a6c751a9 100644
--- a/test/CodeGen/cleanup-stack.c
+++ b/test/CodeGen/cleanup-stack.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -O3 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm %s -o %t
// RUN: grep "ret i32 9" %t
struct s0 {
diff --git a/test/CodeGen/complex.c b/test/CodeGen/complex.c
index 6a0d3d628c54..8d9c68d074ef 100644
--- a/test/CodeGen/complex.c
+++ b/test/CodeGen/complex.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s
+// RUN: %clang_cc1 -emit-llvm < %s
int main(void)
{
diff --git a/test/CodeGen/compound-literal.c b/test/CodeGen/compound-literal.c
index ef0436744dae..4b995dbfef2e 100644
--- a/test/CodeGen/compound-literal.c
+++ b/test/CodeGen/compound-literal.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc < %s -emit-llvm
+// RUN: %clang_cc1 < %s -emit-llvm
int* a = &(int){1};
struct s {int a, b, c;} * b = &(struct s) {1, 2, 3};
diff --git a/test/CodeGen/compound-type.c b/test/CodeGen/compound-type.c
index 47eb3a6e57b6..63ba69460c31 100644
--- a/test/CodeGen/compound-type.c
+++ b/test/CodeGen/compound-type.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc < %s -emit-llvm -triple i686-pc-linux-gnu > %t
+// RUN: %clang_cc1 < %s -emit-llvm -triple i686-pc-linux-gnu > %t
// RUN: grep "div i32" %t
// RUN: grep "shl i32" %t
diff --git a/test/CodeGen/compound.c b/test/CodeGen/compound.c
index c54600705330..960b2e8b04b8 100644
--- a/test/CodeGen/compound.c
+++ b/test/CodeGen/compound.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc < %s -emit-llvm
+// RUN: %clang_cc1 < %s -emit-llvm
int A;
long long B;
int C;
diff --git a/test/CodeGen/conditional-gnu-ext.c b/test/CodeGen/conditional-gnu-ext.c
index 1483d8af8592..f4ac81bf5934 100644
--- a/test/CodeGen/conditional-gnu-ext.c
+++ b/test/CodeGen/conditional-gnu-ext.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
// PR1824
int foo(int x, short y) {
diff --git a/test/CodeGen/conditional.c b/test/CodeGen/conditional.c
index f55d59071a2f..d079aafd787a 100644
--- a/test/CodeGen/conditional.c
+++ b/test/CodeGen/conditional.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
float test1(int cond, float a, float b) {
return cond ? a : b;
diff --git a/test/CodeGen/const-init.c b/test/CodeGen/const-init.c
index 5f196ca5a43d..c7a53be02c58 100644
--- a/test/CodeGen/const-init.c
+++ b/test/CodeGen/const-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -ffreestanding -verify -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -ffreestanding -verify -emit-llvm -o - %s | FileCheck %s
#include <stdint.h>
diff --git a/test/CodeGen/const-label-addr.c b/test/CodeGen/const-label-addr.c
index f8c35c676783..9d99f88c8a65 100644
--- a/test/CodeGen/const-label-addr.c
+++ b/test/CodeGen/const-label-addr.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
int a() {
A:;static void* a = &&A;
}
diff --git a/test/CodeGen/constant-comparison.c b/test/CodeGen/constant-comparison.c
index 3089ae48e6e7..371cb179f901 100644
--- a/test/CodeGen/constant-comparison.c
+++ b/test/CodeGen/constant-comparison.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -emit-llvm %s -o - 2>&1 | not grep warning
-// RUN: clang-cc -emit-llvm %s -o - | grep @b | count 1
+// RUN: %clang_cc1 -emit-llvm %s -o - 2>&1 | not grep warning
+// RUN: %clang_cc1 -emit-llvm %s -o - | grep @b | count 1
int a, b;
int *c1 = 1 < 2 ? &a : &b;
diff --git a/test/CodeGen/constructor-attribute.c b/test/CodeGen/constructor-attribute.c
index b715201dc53b..a1f0e604d401 100644
--- a/test/CodeGen/constructor-attribute.c
+++ b/test/CodeGen/constructor-attribute.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: grep -e "global_ctors.*@A" %t
// RUN: grep -e "global_dtors.*@B" %t
// RUN: grep -e "global_ctors.*@C" %t
diff --git a/test/CodeGen/cxx-condition.cpp b/test/CodeGen/cxx-condition.cpp
index 330a17a10a43..5aa0c5e294f1 100644
--- a/test/CodeGen/cxx-condition.cpp
+++ b/test/CodeGen/cxx-condition.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
void f() {
int a;
diff --git a/test/CodeGen/cxx-default-arg.cpp b/test/CodeGen/cxx-default-arg.cpp
index 8391b9ccae19..25b7c10ad10f 100644
--- a/test/CodeGen/cxx-default-arg.cpp
+++ b/test/CodeGen/cxx-default-arg.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
// Note: define CLANG_GENERATE_KNOWN_GOOD and compile to generate code
// that makes all of the defaulted arguments explicit. The resulting
diff --git a/test/CodeGen/cxx-value-init.cpp b/test/CodeGen/cxx-value-init.cpp
index e23869879fbd..6e4cc0388e92 100644
--- a/test/CodeGen/cxx-value-init.cpp
+++ b/test/CodeGen/cxx-value-init.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
enum E {};
int v1 = E();
diff --git a/test/CodeGen/darwin-string-literals.c b/test/CodeGen/darwin-string-literals.c
index 427e9c2e1b20..b665321730f2 100644
--- a/test/CodeGen/darwin-string-literals.c
+++ b/test/CodeGen/darwin-string-literals.c
@@ -1,10 +1,10 @@
-// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix LSB %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix LSB %s
// CHECK-LSB: @.str = private constant [8 x i8] c"string0\00"
// CHECK-LSB: @.str1 = private constant [8 x i8] c"string1\00"
// CHECK-LSB: @.str2 = internal constant [36 x i8] c"h\00e\00l\00l\00o\00 \00\92! \00\03& \00\90! \00w\00o\00r\00l\00d\00\00\00", section "__TEXT,__ustring", align 2
-// RUN: clang-cc -triple powerpc-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix MSB %s
+// RUN: %clang_cc1 -triple powerpc-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix MSB %s
// CHECK-MSB: @.str = private constant [8 x i8] c"string0\00"
// CHECK-MSB: @.str1 = private constant [8 x i8] c"string1\00"
diff --git a/test/CodeGen/debug-info.c b/test/CodeGen/debug-info.c
index d7a54d643937..a84d0b2c6aca 100644
--- a/test/CodeGen/debug-info.c
+++ b/test/CodeGen/debug-info.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -o %t -emit-llvm -g %s
+// RUN: %clang_cc1 -o %t -emit-llvm -g %s
// RUN: FileCheck --input-file=%t %s
// PR3023
diff --git a/test/CodeGen/decl.c b/test/CodeGen/decl.c
index f7a001e47ce4..6d068134b589 100644
--- a/test/CodeGen/decl.c
+++ b/test/CodeGen/decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s
// CHECK: @test1.x = internal constant [12 x i32] [i32 1
// CHECK: @test2.x = internal constant [13 x i32] [i32 1,
diff --git a/test/CodeGen/designated-initializers.c b/test/CodeGen/designated-initializers.c
index cc88cef0dcdf..652238f06d56 100644
--- a/test/CodeGen/designated-initializers.c
+++ b/test/CodeGen/designated-initializers.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o %t
// RUN: grep "{ i8\* null, i32 1024 }" %t
// RUN: grep "i32 0, i32 22" %t
diff --git a/test/CodeGen/dllimport-dllexport.c b/test/CodeGen/dllimport-dllexport.c
index 6e259058b7a1..c7c2420ea77e 100644
--- a/test/CodeGen/dllimport-dllexport.c
+++ b/test/CodeGen/dllimport-dllexport.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s -o %t
+// RUN: %clang_cc1 -emit-llvm < %s -o %t
// RUN: grep 'dllexport' %t | count 1
// RUN: not grep 'dllimport' %t
diff --git a/test/CodeGen/dostmt.c b/test/CodeGen/dostmt.c
index 4fb3dcdee9bc..1a2e02a78e6b 100644
--- a/test/CodeGen/dostmt.c
+++ b/test/CodeGen/dostmt.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
int bar();
int test0() {
diff --git a/test/CodeGen/emit-all-decls.c b/test/CodeGen/emit-all-decls.c
index 3e7927d8ef79..deeb573a385a 100644
--- a/test/CodeGen/emit-all-decls.c
+++ b/test/CodeGen/emit-all-decls.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: not grep "@foo" %t
-// RUN: clang-cc -femit-all-decls -emit-llvm -o %t %s
+// RUN: %clang_cc1 -femit-all-decls -emit-llvm -o %t %s
// RUN: grep "@foo" %t
static void foo() {
diff --git a/test/CodeGen/empty-union-init.c b/test/CodeGen/empty-union-init.c
index 8448b3ded798..a58354b772f3 100644
--- a/test/CodeGen/empty-union-init.c
+++ b/test/CodeGen/empty-union-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s -o -
+// RUN: %clang_cc1 -emit-llvm < %s -o -
// PR2419
struct Mem {
diff --git a/test/CodeGen/enum.c b/test/CodeGen/enum.c
index 172d308c2b0b..771fc6b182e3 100644
--- a/test/CodeGen/enum.c
+++ b/test/CodeGen/enum.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm-bc -o - | opt -std-compile-opts | llvm-dis | grep 'ret i32 6'
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm-bc -o - | opt -std-compile-opts | llvm-dis | grep 'ret i32 6'
static enum { foo, bar = 1U } z;
diff --git a/test/CodeGen/exprs.c b/test/CodeGen/exprs.c
index c1a5995dfc8d..d82cbf48d30a 100644
--- a/test/CodeGen/exprs.c
+++ b/test/CodeGen/exprs.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
// PR1895
// sizeof function
diff --git a/test/CodeGen/ext-vector-shuffle.c b/test/CodeGen/ext-vector-shuffle.c
index 88f8c242e880..1d147a3b3e32 100644
--- a/test/CodeGen/ext-vector-shuffle.c
+++ b/test/CodeGen/ext-vector-shuffle.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'extractelement'
-// RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'insertelement'
-// RUN: clang-cc %s -x cl -emit-llvm -o - | grep 'shufflevector'
+// RUN: %clang_cc1 %s -x cl -emit-llvm -o - | not grep 'extractelement'
+// RUN: %clang_cc1 %s -x cl -emit-llvm -o - | not grep 'insertelement'
+// RUN: %clang_cc1 %s -x cl -emit-llvm -o - | grep 'shufflevector'
typedef __attribute__(( ext_vector_type(2) )) float float2;
typedef __attribute__(( ext_vector_type(4) )) float float4;
diff --git a/test/CodeGen/ext-vector.c b/test/CodeGen/ext-vector.c
index 6a246db63515..6215323881fc 100644
--- a/test/CodeGen/ext-vector.c
+++ b/test/CodeGen/ext-vector.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
typedef __attribute__(( ext_vector_type(4) )) float float4;
typedef __attribute__(( ext_vector_type(2) )) float float2;
@@ -138,3 +138,16 @@ void test8(float4 *ap, float4 *bp, int c) {
cmp = a == b;
cmp = a != b;
}
+
+int test9(int4 V) {
+ return V.xy.x;
+}
+
+int test10(int4 V) {
+ return (V+V).x;
+}
+
+int4 test11a();
+int test11() {
+ return test11a().x;
+}
diff --git a/test/CodeGen/extern-block-var.c b/test/CodeGen/extern-block-var.c
index e8de3e7f11fe..329f10956842 100644
--- a/test/CodeGen/extern-block-var.c
+++ b/test/CodeGen/extern-block-var.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
int f() {
extern int a;
diff --git a/test/CodeGen/flexible-array-init.c b/test/CodeGen/flexible-array-init.c
index bf8f057c2a06..36323502a415 100644
--- a/test/CodeGen/flexible-array-init.c
+++ b/test/CodeGen/flexible-array-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s
struct { int x; int y[]; } a = { 1, 7, 11 };
// CHECK: @a = global %0 { i32 1, [2 x i32] [i32 7, i32 11] }
diff --git a/test/CodeGen/func-decl-cleanup.c b/test/CodeGen/func-decl-cleanup.c
index 4808e12fdfcc..0af8b6940202 100644
--- a/test/CodeGen/func-decl-cleanup.c
+++ b/test/CodeGen/func-decl-cleanup.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
// PR2360
diff --git a/test/CodeGen/func-ptr-cast-decl.c b/test/CodeGen/func-ptr-cast-decl.c
new file mode 100644
index 000000000000..e6307964294a
--- /dev/null
+++ b/test/CodeGen/func-ptr-cast-decl.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -emit-llvm-only %s -verify
+// PR5882
+
+int q_sk_num(void *a);
+typedef int (*fptr)(double);
+void a() { ((fptr)q_sk_num)(0); }
diff --git a/test/CodeGen/func-return-member.c b/test/CodeGen/func-return-member.c
index 68a48fc1041f..8c55a9671cd0 100644
--- a/test/CodeGen/func-return-member.c
+++ b/test/CodeGen/func-return-member.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
struct frk { float _Complex c; int x; };
struct faz { struct frk f; };
diff --git a/test/CodeGen/function-attributes.c b/test/CodeGen/function-attributes.c
index b09b28b8d93d..8ddaa28eed03 100644
--- a/test/CodeGen/function-attributes.c
+++ b/test/CodeGen/function-attributes.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -Os -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -Os -o - %s | FileCheck %s
// CHECK: define signext i8 @f0(i32 %x) nounwind
// CHECK: define zeroext i8 @f1(i32 %x) nounwind
// CHECK: define void @f2(i8 signext %x) nounwind
diff --git a/test/CodeGen/function-decay.m b/test/CodeGen/function-decay.m
index 4b8e3602d460..161f9079b254 100644
--- a/test/CodeGen/function-decay.m
+++ b/test/CodeGen/function-decay.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
@interface I0 @end
@implementation I0
diff --git a/test/CodeGen/functions.c b/test/CodeGen/functions.c
index 1c53db411961..cb9a4ef81f13 100644
--- a/test/CodeGen/functions.c
+++ b/test/CodeGen/functions.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
int g();
diff --git a/test/CodeGen/global-decls.c b/test/CodeGen/global-decls.c
index c7a70fa237ac..89e899f5baba 100644
--- a/test/CodeGen/global-decls.c
+++ b/test/CodeGen/global-decls.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
// RUN: grep '@g0_ext = extern_weak global i32' %t
extern int g0_ext __attribute__((weak));
diff --git a/test/CodeGen/global-init.c b/test/CodeGen/global-init.c
index 2368422f3ab7..e166fb44659d 100644
--- a/test/CodeGen/global-init.c
+++ b/test/CodeGen/global-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - -triple i386-linux-gnu %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple i386-linux-gnu %s | FileCheck %s
// This checks that the global won't be marked as common.
// (It shouldn't because it's being initialized).
diff --git a/test/CodeGen/global-with-initialiser.c b/test/CodeGen/global-with-initialiser.c
index d253782f66e1..27d209e0ad09 100644
--- a/test/CodeGen/global-with-initialiser.c
+++ b/test/CodeGen/global-with-initialiser.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
const int globalInt = 1;
int globalIntWithFloat = 1.5f;
diff --git a/test/CodeGen/globalinit.c b/test/CodeGen/globalinit.c
index b3d0cb54d15c..e07a419418bc 100644
--- a/test/CodeGen/globalinit.c
+++ b/test/CodeGen/globalinit.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
int A[10] = { 1,2,3,4,5 };
diff --git a/test/CodeGen/illegal-UTF8.m b/test/CodeGen/illegal-UTF8.m
index a9d5a37ac757..871e6e5956a8 100644
--- a/test/CodeGen/illegal-UTF8.m
+++ b/test/CodeGen/illegal-UTF8.m
@@ -1,4 +1,4 @@
-// RUN: clang %s -S -m64 -o -
+// RUN: %clang %s -S -m64 -o -
@class NSString;
diff --git a/test/CodeGen/incomplete-function-type.c b/test/CodeGen/incomplete-function-type.c
index c760e04a08f5..0ba6633b4adf 100644
--- a/test/CodeGen/incomplete-function-type.c
+++ b/test/CodeGen/incomplete-function-type.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
// CHECK: ModuleID
// CHECK-NOT: opaque
// CHECK: define void @f0
diff --git a/test/CodeGen/indirect-goto.c b/test/CodeGen/indirect-goto.c
index 6804f5739bbf..9fd8cfacecbf 100644
--- a/test/CodeGen/indirect-goto.c
+++ b/test/CodeGen/indirect-goto.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts -S | grep "ret i32 2520"
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts -S | grep "ret i32 2520"
static int foo(unsigned i) {
void *addrs[] = { &&L1, &&L2, &&L3, &&L4, &&L5 };
diff --git a/test/CodeGen/init-with-member-expr.c b/test/CodeGen/init-with-member-expr.c
index 197a9ab4e3b8..fdc8c149e522 100644
--- a/test/CodeGen/init-with-member-expr.c
+++ b/test/CodeGen/init-with-member-expr.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc < %s -emit-llvm
+// RUN: %clang_cc1 < %s -emit-llvm
struct test {
int a;
};
diff --git a/test/CodeGen/init.c b/test/CodeGen/init.c
index b0537ae5b077..f6b35361570a 100644
--- a/test/CodeGen/init.c
+++ b/test/CodeGen/init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o %t
void f1() {
// Scalars in braces.
diff --git a/test/CodeGen/inline.c b/test/CodeGen/inline.c
index 76d90eda2100..a17b06992968 100644
--- a/test/CodeGen/inline.c
+++ b/test/CodeGen/inline.c
@@ -1,5 +1,5 @@
// RUN: echo "GNU89 tests:"
-// RUN: clang %s -emit-llvm -S -o %t -std=gnu89
+// RUN: %clang %s -emit-llvm -S -o %t -std=gnu89
// RUN: grep "define available_externally i32 @ei()" %t
// RUN: grep "define i32 @foo()" %t
// RUN: grep "define i32 @bar()" %t
@@ -14,7 +14,7 @@
// RUN: grep "define available_externally i32 @test5" %t
// RUN: echo "\nC99 tests:"
-// RUN: clang %s -emit-llvm -S -o %t -std=c99
+// RUN: %clang %s -emit-llvm -S -o %t -std=c99
// RUN: grep "define i32 @ei()" %t
// RUN: grep "define available_externally i32 @foo()" %t
// RUN: grep "define i32 @bar()" %t
@@ -29,7 +29,7 @@
// RUN: grep "define available_externally i32 @test5" %t
// RUN: echo "\nC++ tests:"
-// RUN: clang %s -emit-llvm -S -o %t -std=c++98
+// RUN: %clang %s -emit-llvm -S -o %t -std=c++98
// RUN: grep "define linkonce_odr i32 @_Z2eiv()" %t
// RUN: grep "define linkonce_odr i32 @_Z3foov()" %t
// RUN: grep "define i32 @_Z3barv()" %t
diff --git a/test/CodeGen/inline2.c b/test/CodeGen/inline2.c
index 304d6168578c..737b58fa44c6 100644
--- a/test/CodeGen/inline2.c
+++ b/test/CodeGen/inline2.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -std=gnu89 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix GNU89 %s
-// RUN: clang-cc -std=c99 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix C99 %s
+// RUN: %clang_cc1 -std=gnu89 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix GNU89 %s
+// RUN: %clang_cc1 -std=c99 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix C99 %s
// CHECK-GNU89: define i32 @f0()
// CHECK-C99: define i32 @f0()
diff --git a/test/CodeGen/int-to-pointer.c b/test/CodeGen/int-to-pointer.c
index 7cefc3902ebc..242a8a694259 100644
--- a/test/CodeGen/int-to-pointer.c
+++ b/test/CodeGen/int-to-pointer.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
void *test(int i)
{
diff --git a/test/CodeGen/kr-func-promote.c b/test/CodeGen/kr-func-promote.c
index d4c3851909ab..fcdbac3ee424 100644
--- a/test/CodeGen/kr-func-promote.c
+++ b/test/CodeGen/kr-func-promote.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o - | grep "i32 @a(i32)"
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | grep "i32 @a(i32)"
int a();
int a(x) short x; {return x;}
diff --git a/test/CodeGen/kr-style-block.c b/test/CodeGen/kr-style-block.c
index ac788dc9ab9f..09efb37927a8 100644
--- a/test/CodeGen/kr-style-block.c
+++ b/test/CodeGen/kr-style-block.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t -fblocks
+// RUN: %clang_cc1 -emit-llvm %s -o %t -fblocks
void foo (void(^)());
diff --git a/test/CodeGen/libcalls.c b/test/CodeGen/libcalls.c
index 32fc59f27fee..fe12f4a08a52 100644
--- a/test/CodeGen/libcalls.c
+++ b/test/CodeGen/libcalls.c
@@ -1,7 +1,7 @@
-// RUN: clang-cc -emit-llvm -o %t %s -triple i386-unknown-unknown
+// RUN: %clang_cc1 -emit-llvm -o %t %s -triple i386-unknown-unknown
// RUN: grep "declare " %t | count 6
// RUN: grep "declare " %t | grep "@llvm." | count 1
-// RUN: clang-cc -fno-math-errno -emit-llvm -o %t %s -triple i386-unknown-unknown
+// RUN: %clang_cc1 -fno-math-errno -emit-llvm -o %t %s -triple i386-unknown-unknown
// RUN: grep "declare " %t | count 6
// RUN: grep "declare " %t | grep -v "@llvm." | count 0
diff --git a/test/CodeGen/lineno-dbginfo.c b/test/CodeGen/lineno-dbginfo.c
index b78dd21d72b3..c5c350f7009e 100644
--- a/test/CodeGen/lineno-dbginfo.c
+++ b/test/CodeGen/lineno-dbginfo.c
@@ -1,5 +1,5 @@
// RUN: echo "#include <stdio.h>" > %t.h
-// RUN: clang -S -save-temps -g -include %t.h %s -emit-llvm -o %t.ll
+// RUN: %clang -S -save-temps -g -include %t.h %s -emit-llvm -o %t.ll
// RUN: grep "i32 5" %t.ll
// RUN: rm -f lineno-dbginfo.i
// outer is at line number 5.
diff --git a/test/CodeGen/linkage-redecl.c b/test/CodeGen/linkage-redecl.c
index b015ca854737..09b51f02c13f 100644
--- a/test/CodeGen/linkage-redecl.c
+++ b/test/CodeGen/linkage-redecl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - |grep internal
+// RUN: %clang_cc1 -emit-llvm %s -o - |grep internal
// C99 6.2.2p3
// PR3425
diff --git a/test/CodeGen/long-double-x86.c b/test/CodeGen/long-double-x86.c
index b01ce0b93ec3..f040207e73a8 100644
--- a/test/CodeGen/long-double-x86.c
+++ b/test/CodeGen/long-double-x86.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - -triple=i686-apple-darwin9 | grep x86_fp80
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 | grep x86_fp80
long double x = 0;
int checksize[sizeof(x) == 16 ? 1 : -1];
diff --git a/test/CodeGen/mandel.c b/test/CodeGen/mandel.c
index 9d7956c56d1b..8ecf8f2337a3 100644
--- a/test/CodeGen/mandel.c
+++ b/test/CodeGen/mandel.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
/* Sparc is not C99-compliant */
#if defined(sparc) || defined(__sparc__) || defined(__sparcv9)
diff --git a/test/CodeGen/mangle.c b/test/CodeGen/mangle.c
index 6f42f6f6496c..a087b42ad21a 100644
--- a/test/CodeGen/mangle.c
+++ b/test/CodeGen/mangle.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
// CHECK: @"\01foo"
diff --git a/test/CodeGen/merge-attrs.c b/test/CodeGen/merge-attrs.c
index 1aab47a3a30c..474b17225ab3 100644
--- a/test/CodeGen/merge-attrs.c
+++ b/test/CodeGen/merge-attrs.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
void *malloc(__SIZE_TYPE__ size) __attribute__ ((__nothrow__));
diff --git a/test/CodeGen/merge-statics.c b/test/CodeGen/merge-statics.c
index c442669e6422..6716935c4d12 100644
--- a/test/CodeGen/merge-statics.c
+++ b/test/CodeGen/merge-statics.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc < %s -emit-llvm | grep internal | count 1
+// RUN: %clang_cc1 < %s -emit-llvm | grep internal | count 1
// The two decls for 'a' should merge into one llvm GlobalVariable.
diff --git a/test/CodeGen/no-common.c b/test/CodeGen/no-common.c
index 64e37d78f964..03a5bb064c31 100644
--- a/test/CodeGen/no-common.c
+++ b/test/CodeGen/no-common.c
@@ -1,6 +1,6 @@
-// RUN: clang -emit-llvm -S -o %t %s
+// RUN: %clang -emit-llvm -S -o %t %s
// RUN: grep '@x = common global' %t
-// RUN: clang -fno-common -emit-llvm -S -o %t %s
+// RUN: %clang -fno-common -emit-llvm -S -o %t %s
// RUN: grep '@x = global' %t
int x;
diff --git a/test/CodeGen/object-size.c b/test/CodeGen/object-size.c
index 45747de6c921..4947c19a5de8 100644
--- a/test/CodeGen/object-size.c
+++ b/test/CodeGen/object-size.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s
#define strcpy(dest, src) \
((__builtin_object_size(dest, 0) != -1ULL) \
@@ -35,7 +35,7 @@ void test4() {
void test5() {
// CHECK: %tmp = load i8** @gp
- // CHECK-NEXT:%0 = call i64 @llvm.objectsize.i64(i8* %tmp, i32 0)
+ // CHECK-NEXT:%0 = call i64 @llvm.objectsize.i64(i8* %tmp, i1 false)
// CHECK-NEXT:%cmp = icmp ne i64 %0, -1
strcpy(gp, "Hi there");
}
diff --git a/test/CodeGen/offsetof.c b/test/CodeGen/offsetof.c
index b0f5727a92dc..c279e2282e46 100644
--- a/test/CodeGen/offsetof.c
+++ b/test/CodeGen/offsetof.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
// PR2910
struct sockaddr_un {
diff --git a/test/CodeGen/opaque-pointer.c b/test/CodeGen/opaque-pointer.c
index 7f78b91fb17e..d658db111d3a 100644
--- a/test/CodeGen/opaque-pointer.c
+++ b/test/CodeGen/opaque-pointer.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
struct test;
typedef void (*my_func) (struct test *);
diff --git a/test/CodeGen/overloadable.c b/test/CodeGen/overloadable.c
index 4b58c8254624..1ed72b19c4d4 100644
--- a/test/CodeGen/overloadable.c
+++ b/test/CodeGen/overloadable.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | grep _Z1fPA10_1X
+// RUN: %clang_cc1 -emit-llvm %s -o - | grep _Z1fPA10_1X
int __attribute__((overloadable)) f(int x) { return x; }
float __attribute__((overloadable)) f(float x) { return x; }
double __attribute__((overloadable)) f(double x) { return x; }
diff --git a/test/CodeGen/packed-union.c b/test/CodeGen/packed-union.c
index 41dc94c7a410..0aeed008b752 100644
--- a/test/CodeGen/packed-union.c
+++ b/test/CodeGen/packed-union.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin10 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o %t
// RUN: grep "struct._attrs = type <{ i32, i8 }>" %t
typedef struct _attrs {
diff --git a/test/CodeGen/palignr.c b/test/CodeGen/palignr.c
index 41e48bd2854d..68efb414509c 100644
--- a/test/CodeGen/palignr.c
+++ b/test/CodeGen/palignr.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=i686-apple-darwin -target-feature +ssse3 -O1 -S -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=i686-apple-darwin -target-feature +ssse3 -O1 -S -o - | FileCheck %s
#define _mm_alignr_epi8(a, b, n) (__builtin_ia32_palignr128((a), (b), (n)))
#define _mm_alignr_pi8(a, b, n) (__builtin_ia32_palignr((a), (b), (n*8)))
diff --git a/test/CodeGen/parameter-passing.c b/test/CodeGen/parameter-passing.c
index 966223a39f56..e48815b96612 100644
--- a/test/CodeGen/parameter-passing.c
+++ b/test/CodeGen/parameter-passing.c
@@ -5,13 +5,13 @@
// We also check _Bool and empty structures, as these can have annoying
// corner cases.
-// RUN: clang-cc %s -triple i386-unknown-unknown -O3 -emit-llvm -o %t
+// RUN: %clang_cc1 %s -triple i386-unknown-unknown -O3 -emit-llvm -o %t
// RUN: not grep '@g0' %t
-// RUN: clang-cc %s -triple x86_64-unknown-unknown -O3 -emit-llvm -o %t
+// RUN: %clang_cc1 %s -triple x86_64-unknown-unknown -O3 -emit-llvm -o %t
// RUN: not grep '@g0' %t
-// RUN: clang-cc %s -triple powerpc-unknown-unknown -O3 -emit-llvm -o %t
+// RUN: %clang_cc1 %s -triple powerpc-unknown-unknown -O3 -emit-llvm -o %t
// RUN: not grep '@g0' %t
typedef _Bool BoolTy;
diff --git a/test/CodeGen/pascal-string.c b/test/CodeGen/pascal-string.c
index fcd807cde7b1..0a9ee67ea01e 100644
--- a/test/CodeGen/pascal-string.c
+++ b/test/CodeGen/pascal-string.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s -fpascal-strings | grep "05Hello"
+// RUN: %clang_cc1 -emit-llvm -o - %s -fpascal-strings | grep "05Hello"
unsigned char * Foo( void )
{
diff --git a/test/CodeGen/pointer-arithmetic.c b/test/CodeGen/pointer-arithmetic.c
index 5049875dd3ed..33465e0aa137 100644
--- a/test/CodeGen/pointer-arithmetic.c
+++ b/test/CodeGen/pointer-arithmetic.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -S %s -o -
+// RUN: %clang_cc1 -S %s -o -
typedef int Int;
diff --git a/test/CodeGen/pointer-cmp-type.c b/test/CodeGen/pointer-cmp-type.c
index d88c0911ba48..59b271235ca9 100644
--- a/test/CodeGen/pointer-cmp-type.c
+++ b/test/CodeGen/pointer-cmp-type.c
@@ -1,3 +1,3 @@
-// RUN: clang-cc -emit-llvm %s -o - | grep "icmp ult"
+// RUN: %clang_cc1 -emit-llvm %s -o - | grep "icmp ult"
int a(char* a, char* b) {return a<b;}
diff --git a/test/CodeGen/pointer-to-int.c b/test/CodeGen/pointer-to-int.c
index e40bd91d8f99..30a6db280d41 100644
--- a/test/CodeGen/pointer-to-int.c
+++ b/test/CodeGen/pointer-to-int.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o -
+// RUN: %clang_cc1 -emit-llvm %s -o -
int test(void* i)
{
diff --git a/test/CodeGen/pragma-pack-1.c b/test/CodeGen/pragma-pack-1.c
index bcfcd5ac3ab9..f5d301639e05 100644
--- a/test/CodeGen/pragma-pack-1.c
+++ b/test/CodeGen/pragma-pack-1.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o -
+// RUN: %clang_cc1 -emit-llvm -o -
// PR4610
#pragma pack(4)
diff --git a/test/CodeGen/pragma-pack-2.c b/test/CodeGen/pragma-pack-2.c
index bfc5dc943c5e..bfb34d7c688d 100644
--- a/test/CodeGen/pragma-pack-2.c
+++ b/test/CodeGen/pragma-pack-2.c
@@ -1,8 +1,8 @@
-// RUN: clang-cc -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X32 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X32 %s
// CHECK-X32: %struct.s0 = type { i64, i64, i32, [12 x i32] }
// CHECK-X32: %struct.s1 = type { [15 x i32], %struct.s0 }
-// RUN: clang-cc -triple x86_64-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X64 %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X64 %s
// CHECK-X64: %struct.s0 = type <{ i64, i64, i32, [12 x i32] }>
// CHECK-X64: %struct.s1 = type <{ [15 x i32], %struct.s0 }>
diff --git a/test/CodeGen/pragma-pack-3.c b/test/CodeGen/pragma-pack-3.c
index 56a6be3874fa..676f0d77eba3 100644
--- a/test/CodeGen/pragma-pack-3.c
+++ b/test/CodeGen/pragma-pack-3.c
@@ -1,8 +1,8 @@
-// RUN: clang-cc -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X32 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X32 %s
// CHECK-X32: %struct.menu = type <{ i8*, i8, i8 }>
// CHECK-X32: %union.command = type <{ i8*, [2 x i8] }>
-// RUN: clang-cc -triple x86_64-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X64 %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X64 %s
// CHECK-X64: %struct.menu = type <{ i8*, i8, i8 }>
// CHECK-X64: %union.command = type <{ i8*, [2 x i8] }>
diff --git a/test/CodeGen/pragma-weak.c b/test/CodeGen/pragma-weak.c
index 497039a8f42c..5c2866e3d35f 100644
--- a/test/CodeGen/pragma-weak.c
+++ b/test/CodeGen/pragma-weak.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -verify | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -verify | FileCheck %s
// CHECK: @weakvar = weak global
// CHECK: @__weakvar_alias = common global
diff --git a/test/CodeGen/predefined-expr.c b/test/CodeGen/predefined-expr.c
index 1a5dcb4fc6ff..9be5754114bf 100644
--- a/test/CodeGen/predefined-expr.c
+++ b/test/CodeGen/predefined-expr.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// CHECK: @__func__.plainFunction = private constant [14 x i8] c"plainFunction\00"
// CHECK: @__PRETTY_FUNCTION__.plainFunction = private constant [21 x i8] c"void plainFunction()\00"
diff --git a/test/CodeGen/private-extern.c b/test/CodeGen/private-extern.c
index a9bb28bfad4e..2d34d543213d 100644
--- a/test/CodeGen/private-extern.c
+++ b/test/CodeGen/private-extern.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: grep '@g0 = external hidden constant i32' %t
// RUN: grep '@g1 = hidden constant i32 1' %t
diff --git a/test/CodeGen/rdr-6098585-default-after-caserange.c b/test/CodeGen/rdr-6098585-default-after-caserange.c
index 2c58548744d6..3a89aa39a0d7 100644
--- a/test/CodeGen/rdr-6098585-default-after-caserange.c
+++ b/test/CodeGen/rdr-6098585-default-after-caserange.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32" %t | count 1
// RUN: grep "ret i32 10" %t | count 1
diff --git a/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c b/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c
index 257a9d7f8acd..ba41b519fcca 100644
--- a/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c
+++ b/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32 10" %t
// Ensure that this doesn't compile to infinite loop in g() due to
diff --git a/test/CodeGen/rdr-6098585-empty-case-range.c b/test/CodeGen/rdr-6098585-empty-case-range.c
index 2dd1eaac9df8..1cf77ac6aa56 100644
--- a/test/CodeGen/rdr-6098585-empty-case-range.c
+++ b/test/CodeGen/rdr-6098585-empty-case-range.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32" %t | count 2
// RUN: grep "ret i32 3" %t | count 2
diff --git a/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c b/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c
index c12cf82ba0cc..48a6cc228558 100644
--- a/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c
+++ b/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32 %" %t
// Make sure return is not constant (if empty range is skipped or miscompiled)
diff --git a/test/CodeGen/rdr-6098585-unsigned-caserange.c b/test/CodeGen/rdr-6098585-unsigned-caserange.c
index a2b85d989530..6f577df188c5 100644
--- a/test/CodeGen/rdr-6098585-unsigned-caserange.c
+++ b/test/CodeGen/rdr-6098585-unsigned-caserange.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32" %t | count 1
// RUN: grep "ret i32 3" %t | count 1
diff --git a/test/CodeGen/rdr-6732143-dangling-block-reference.m b/test/CodeGen/rdr-6732143-dangling-block-reference.m
index 90641dd083cb..b4d21a3f8fcc 100644
--- a/test/CodeGen/rdr-6732143-dangling-block-reference.m
+++ b/test/CodeGen/rdr-6732143-dangling-block-reference.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm %s -o -
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm %s -o -
void f0(id x) {
@synchronized (x) {
diff --git a/test/CodeGen/regparm.c b/test/CodeGen/regparm.c
index 28dfae7f628b..ac3797547d99 100644
--- a/test/CodeGen/regparm.c
+++ b/test/CodeGen/regparm.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o - | grep inreg | count 2
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | grep inreg | count 2
#define FASTCALL __attribute__((regparm(2)))
diff --git a/test/CodeGen/shared-string-literals.c b/test/CodeGen/shared-string-literals.c
index a05975b4aeb7..00636b0f55aa 100644
--- a/test/CodeGen/shared-string-literals.c
+++ b/test/CodeGen/shared-string-literals.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
char *globalString = "abc";
char *globalStringArray[5] = { "123", "abc" };
diff --git a/test/CodeGen/sizeof-vla.c b/test/CodeGen/sizeof-vla.c
index af5088553e48..b0c514fd0161 100644
--- a/test/CodeGen/sizeof-vla.c
+++ b/test/CodeGen/sizeof-vla.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o %t %s
// PR3442
diff --git a/test/CodeGen/stack-protector.c b/test/CodeGen/stack-protector.c
index 57635976d05f..eb4cea211779 100644
--- a/test/CodeGen/stack-protector.c
+++ b/test/CodeGen/stack-protector.c
@@ -1,8 +1,8 @@
-// RUN: clang-cc -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s
// NOSSP: define void @test1(i8* %msg) nounwind {
-// RUN: clang-cc -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s
// WITHSSP: define void @test1(i8* %msg) nounwind ssp {
-// RUN: clang-cc -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPREQ %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPREQ %s
// SSPREQ: define void @test1(i8* %msg) nounwind sspreq {
int printf(const char * _Format, ...);
diff --git a/test/CodeGen/statements.c b/test/CodeGen/statements.c
index 45bbd9ac024f..e3835f062a69 100644
--- a/test/CodeGen/statements.c
+++ b/test/CodeGen/statements.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc < %s -emit-llvm
+// RUN: %clang_cc1 < %s -emit-llvm
void test1(int x) {
switch (x) {
diff --git a/test/CodeGen/static-forward-decl-fun.c b/test/CodeGen/static-forward-decl-fun.c
index a945df3d3b38..e33ee621b345 100644
--- a/test/CodeGen/static-forward-decl-fun.c
+++ b/test/CodeGen/static-forward-decl-fun.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
static int staticfun(void);
int (*staticuse1)(void) = staticfun;
diff --git a/test/CodeGen/static-forward-decl.c b/test/CodeGen/static-forward-decl.c
index f12c22fb41af..0d35061279c3 100644
--- a/test/CodeGen/static-forward-decl.c
+++ b/test/CodeGen/static-forward-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - -triple=i686-apple-darwin9 | grep "global i32 10"
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 | grep "global i32 10"
static int i;
int*j=&i;
diff --git a/test/CodeGen/static-local-union.c b/test/CodeGen/static-local-union.c
index f276b200eb10..bd32519e43e9 100644
--- a/test/CodeGen/static-local-union.c
+++ b/test/CodeGen/static-local-union.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s
+// RUN: %clang_cc1 -emit-llvm < %s
int a() {static union{int a;} r[2] = {1,2};return r[1].a;}
diff --git a/test/CodeGen/static-order.c b/test/CodeGen/static-order.c
index 58340b691302..e7f9814261cc 100644
--- a/test/CodeGen/static-order.c
+++ b/test/CodeGen/static-order.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
// CHECK: ModuleID
// CHECK-NOT: zeroinitializer
// CHECK: define i8* @f
diff --git a/test/CodeGen/staticinit.c b/test/CodeGen/staticinit.c
index 8b87ccd6b905..cd1f059e570a 100644
--- a/test/CodeGen/staticinit.c
+++ b/test/CodeGen/staticinit.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
// RUN: grep "g.b = internal global i8. getelementptr" %t
struct AStruct {
diff --git a/test/CodeGen/stdcall-fastcall.c b/test/CodeGen/stdcall-fastcall.c
index 11b652178ca8..838ccfb48c56 100644
--- a/test/CodeGen/stdcall-fastcall.c
+++ b/test/CodeGen/stdcall-fastcall.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -emit-llvm < %s | grep 'fastcallcc' | count 4
-// RUN: clang-cc -emit-llvm < %s | grep 'stdcallcc' | count 4
+// RUN: %clang_cc1 -emit-llvm < %s | grep 'fastcallcc' | count 4
+// RUN: %clang_cc1 -emit-llvm < %s | grep 'stdcallcc' | count 4
void __attribute__((fastcall)) f1(void);
void __attribute__((stdcall)) f2(void);
diff --git a/test/CodeGen/string-literal.c b/test/CodeGen/string-literal.c
index a4011938c106..22a81e718551 100644
--- a/test/CodeGen/string-literal.c
+++ b/test/CodeGen/string-literal.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o -
+// RUN: %clang_cc1 -emit-llvm %s -o -
int main() {
char a[10] = "abc";
diff --git a/test/CodeGen/struct-comma.c b/test/CodeGen/struct-comma.c
index d7f50da13122..e5b51514384a 100644
--- a/test/CodeGen/struct-comma.c
+++ b/test/CodeGen/struct-comma.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
struct S {int a, b;} x;
void a(struct S* b) {*b = (r(), x);}
diff --git a/test/CodeGen/struct-copy.c b/test/CodeGen/struct-copy.c
index 62c29aba6c9c..6f3b6643f09a 100644
--- a/test/CodeGen/struct-copy.c
+++ b/test/CodeGen/struct-copy.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | grep 'call.*llvm.memcpy'
+// RUN: %clang_cc1 -emit-llvm %s -o - | grep 'call.*llvm.memcpy'
struct x { int a[100]; };
diff --git a/test/CodeGen/struct-init.c b/test/CodeGen/struct-init.c
index cb84fef4d1c1..88b57a26478a 100644
--- a/test/CodeGen/struct-init.c
+++ b/test/CodeGen/struct-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
typedef struct _zend_ini_entry zend_ini_entry;
struct _zend_ini_entry {
diff --git a/test/CodeGen/struct-passing.c b/test/CodeGen/struct-passing.c
index 772077a5964f..b351d8148e91 100644
--- a/test/CodeGen/struct-passing.c
+++ b/test/CodeGen/struct-passing.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
// RUN: grep 'declare i32 @f0() readnone$' %t
// RUN: grep 'declare i32 @f1() readonly$' %t
// RUN: grep 'declare void @f2(.* noalias sret)$' %t
diff --git a/test/CodeGen/struct-x86-darwin.c b/test/CodeGen/struct-x86-darwin.c
index e7822f073d2a..afdcb8a39a06 100644
--- a/test/CodeGen/struct-x86-darwin.c
+++ b/test/CodeGen/struct-x86-darwin.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc < %s -emit-llvm > %t1 -triple=i686-apple-darwin9
+// RUN: %clang_cc1 < %s -emit-llvm > %t1 -triple=i686-apple-darwin9
// RUN: grep "STest1 = type { i32, \[4 x i16\], double }" %t1
// RUN: grep "STest2 = type { i16, i16, i32, i32 }" %t1
// RUN: grep "STest3 = type { i8, i16, i32 }" %t1
diff --git a/test/CodeGen/struct.c b/test/CodeGen/struct.c
index d1e58a244561..25477a052e8a 100644
--- a/test/CodeGen/struct.c
+++ b/test/CodeGen/struct.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o -
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o -
struct {
int x;
diff --git a/test/CodeGen/switch.c b/test/CodeGen/switch.c
index 96118f6e6fc3..519ccbac0159 100644
--- a/test/CodeGen/switch.c
+++ b/test/CodeGen/switch.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -O3 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -O3 %s -emit-llvm -o - | FileCheck %s
int foo(int i) {
int j = 0;
diff --git a/test/CodeGen/target-data.c b/test/CodeGen/target-data.c
index 26775f98117c..8139a4efc599 100644
--- a/test/CodeGen/target-data.c
+++ b/test/CodeGen/target-data.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple i686-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i686-unknown-unknown -emit-llvm -o %t %s
// RUN: grep 'target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"' %t
-// RUN: clang-cc -triple i686-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i686-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep 'target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"' %t
-// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o %t %s
// RUN: grep 'target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"' %t
diff --git a/test/CodeGen/tentative-decls.c b/test/CodeGen/tentative-decls.c
index b72c5850ac2c..d88c346d7c52 100644
--- a/test/CodeGen/tentative-decls.c
+++ b/test/CodeGen/tentative-decls.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: grep '@r = common global \[1 x .*\] zeroinitializer' %t
diff --git a/test/CodeGen/thread-specifier.c b/test/CodeGen/thread-specifier.c
index 456f7a6d9761..b1e1ed84647f 100644
--- a/test/CodeGen/thread-specifier.c
+++ b/test/CodeGen/thread-specifier.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i686-pc-linux-gnu -emit-llvm -o - %s | grep thread_local | count 4
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o - %s | grep thread_local | count 4
__thread int a;
extern __thread int b;
diff --git a/test/CodeGen/trapv.c b/test/CodeGen/trapv.c
index 6045ed908d0e..d10d6176bf94 100644
--- a/test/CodeGen/trapv.c
+++ b/test/CodeGen/trapv.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -ftrapv %s -emit-llvm -o %t
+// RUN: %clang_cc1 -ftrapv %s -emit-llvm -o %t
// RUN: grep "__overflow_handler" %t | count 2
unsigned int ui, uj, uk;
diff --git a/test/CodeGen/typedef-func.c b/test/CodeGen/typedef-func.c
index a64426ddb274..bc08b359d70f 100644
--- a/test/CodeGen/typedef-func.c
+++ b/test/CodeGen/typedef-func.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s
+// RUN: %clang_cc1 -emit-llvm < %s
// PR2414
struct mad_frame{};
diff --git a/test/CodeGen/typedef.c b/test/CodeGen/typedef.c
index 3bdd52f6c572..4af9d819f026 100644
--- a/test/CodeGen/typedef.c
+++ b/test/CodeGen/typedef.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o -
+// RUN: %clang_cc1 -emit-llvm %s -o -
typedef struct { int i; } Value;
typedef Value *PValue;
diff --git a/test/CodeGen/types.c b/test/CodeGen/types.c
index 75cb851c2599..55b806c93a25 100644
--- a/test/CodeGen/types.c
+++ b/test/CodeGen/types.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm <%s
+// RUN: %clang_cc1 -emit-llvm <%s
struct FileName {
struct FileName *next;
diff --git a/test/CodeGen/uint128_t.c b/test/CodeGen/uint128_t.c
index b3bf7279623f..92cb5faba4a0 100644
--- a/test/CodeGen/uint128_t.c
+++ b/test/CodeGen/uint128_t.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - -triple=x86_64-apple-darwin9
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin9
typedef unsigned long long uint64_t;
extern uint64_t numer;
diff --git a/test/CodeGen/union-init.c b/test/CodeGen/union-init.c
index f4e9e9a08f4d..60906b533d65 100644
--- a/test/CodeGen/union-init.c
+++ b/test/CodeGen/union-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s -o -
+// RUN: %clang_cc1 -emit-llvm < %s -o -
// A nice and complicated initialization example with unions from Python
typedef int Py_ssize_t;
diff --git a/test/CodeGen/union-init2.c b/test/CodeGen/union-init2.c
index e782425cf2b1..ac469cd4b512 100644
--- a/test/CodeGen/union-init2.c
+++ b/test/CodeGen/union-init2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple i686-pc-linux-gnu | grep "bitcast (%0\* @r to %union.x\*), \[4 x i8\] undef"
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple i686-pc-linux-gnu | grep "bitcast (%0\* @r to %union.x\*), \[4 x i8\] undef"
// Make sure we generate something sane instead of a ptrtoint
union x {long long b;union x* a;} r = {.a = &r};
diff --git a/test/CodeGen/union.c b/test/CodeGen/union.c
index 4884690f3fdc..b40a405597ac 100644
--- a/test/CodeGen/union.c
+++ b/test/CodeGen/union.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
union u_tag {
int a;
diff --git a/test/CodeGen/unreachable.c b/test/CodeGen/unreachable.c
index 3f39a27def97..5e9fa6a5456d 100644
--- a/test/CodeGen/unreachable.c
+++ b/test/CodeGen/unreachable.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: grep '@unreachable' %t | count 0
extern void abort() __attribute__((noreturn));
diff --git a/test/CodeGen/unwind-attr.c b/test/CodeGen/unwind-attr.c
index 1148ba10315e..ee3199d274dd 100644
--- a/test/CodeGen/unwind-attr.c
+++ b/test/CodeGen/unwind-attr.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -fexceptions -emit-llvm -o - %s | grep "@foo()" | not grep nounwind
-// RUN: clang-cc -emit-llvm -o - %s | grep "@foo()" | grep nounwind
+// RUN: %clang_cc1 -fexceptions -emit-llvm -o - %s | grep "@foo()" | not grep nounwind
+// RUN: %clang_cc1 -emit-llvm -o - %s | grep "@foo()" | grep nounwind
int foo(void) {
return 0;
diff --git a/test/CodeGen/var-align.c b/test/CodeGen/var-align.c
index b0b62ae26473..fefd35ab634d 100644
--- a/test/CodeGen/var-align.c
+++ b/test/CodeGen/var-align.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | grep "align 16" | count 2
+// RUN: %clang_cc1 -emit-llvm %s -o - | grep "align 16" | count 2
__attribute((aligned(16))) float a[128];
union {int a[4]; __attribute((aligned(16))) float b[4];} u;
diff --git a/test/CodeGen/variable-array.c b/test/CodeGen/variable-array.c
index f5621c289d7a..80ca78d5cf5f 100644
--- a/test/CodeGen/variable-array.c
+++ b/test/CodeGen/variable-array.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s | grep puts | count 4
+// RUN: %clang_cc1 -emit-llvm < %s | grep puts | count 4
// PR3248
int a(int x)
diff --git a/test/CodeGen/vector.c b/test/CodeGen/vector.c
index 21a03d0593d6..c16d65bebec2 100644
--- a/test/CodeGen/vector.c
+++ b/test/CodeGen/vector.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-apple-darwin9 -mcpu pentium4 -g -emit-llvm %s -o -
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -target-cpu pentium4 -g -emit-llvm %s -o -
typedef short __v4hi __attribute__ ((__vector_size__ (8)));
void test1() {
diff --git a/test/CodeGen/vfprintf.c b/test/CodeGen/vfprintf.c
index 89261c7469c6..7c583b58852d 100644
--- a/test/CodeGen/vfprintf.c
+++ b/test/CodeGen/vfprintf.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only %s
+// RUN: %clang_cc1 -emit-llvm-only %s
typedef struct _IO_FILE FILE;
int vfprintf(FILE*restrict,const char*restrict, __builtin_va_list);
diff --git a/test/CodeGen/visibility.c b/test/CodeGen/visibility.c
index c19004a5a2cb..8f81c8f3a990 100644
--- a/test/CodeGen/visibility.c
+++ b/test/CodeGen/visibility.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -fvisibility default -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fvisibility default -emit-llvm -o %t %s
// RUN: grep '@g_com = common global i32 0' %t
// RUN: grep '@g_def = global i32 0' %t
// RUN: grep '@g_ext = external global i32' %t
@@ -6,7 +6,7 @@
// RUN: grep 'declare void @f_ext()' %t
// RUN: grep 'define internal void @f_deferred()' %t
// RUN: grep 'define i32 @f_def()' %t
-// RUN: clang-cc -triple i386-unknown-unknown -fvisibility protected -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fvisibility protected -emit-llvm -o %t %s
// RUN: grep '@g_com = common protected global i32 0' %t
// RUN: grep '@g_def = protected global i32 0' %t
// RUN: grep '@g_ext = external global i32' %t
@@ -14,7 +14,7 @@
// RUN: grep 'declare void @f_ext()' %t
// RUN: grep 'define internal void @f_deferred()' %t
// RUN: grep 'define protected i32 @f_def()' %t
-// RUN: clang-cc -triple i386-unknown-unknown -fvisibility hidden -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fvisibility hidden -emit-llvm -o %t %s
// RUN: grep '@g_com = common hidden global i32 0' %t
// RUN: grep '@g_def = hidden global i32 0' %t
// RUN: grep '@g_ext = external global i32' %t
diff --git a/test/CodeGen/vla.c b/test/CodeGen/vla.c
index 844e49e72c46..0c539003842a 100644
--- a/test/CodeGen/vla.c
+++ b/test/CodeGen/vla.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
int b(char* x);
diff --git a/test/CodeGen/volatile-1.c b/test/CodeGen/volatile-1.c
index 3203326ecebf..e0c672b41eae 100644
--- a/test/CodeGen/volatile-1.c
+++ b/test/CodeGen/volatile-1.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -Wno-unused-value -emit-llvm < %s -o %t
+// RUN: %clang_cc1 -Wno-unused-value -emit-llvm < %s -o %t
// RUN: grep volatile %t | count 145
// RUN: grep memcpy %t | count 4
diff --git a/test/CodeGen/volatile.c b/test/CodeGen/volatile.c
index a0cc891ccd88..db87a375152a 100644
--- a/test/CodeGen/volatile.c
+++ b/test/CodeGen/volatile.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s -o %t
+// RUN: %clang_cc1 -emit-llvm < %s -o %t
// RUN: grep volatile %t | count 29
// RUN: grep memcpy %t | count 7
diff --git a/test/CodeGen/weak-global.c b/test/CodeGen/weak-global.c
index d4ee52f48956..f972cea91200 100644
--- a/test/CodeGen/weak-global.c
+++ b/test/CodeGen/weak-global.c
@@ -1,3 +1,3 @@
-// RUN: clang-cc -emit-llvm < %s | grep common
+// RUN: %clang_cc1 -emit-llvm < %s | grep common
int i;
diff --git a/test/CodeGen/weak-incomplete.c b/test/CodeGen/weak-incomplete.c
index a15dbac03cb7..af91ae7eb5cc 100644
--- a/test/CodeGen/weak-incomplete.c
+++ b/test/CodeGen/weak-incomplete.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s | grep 'extern_weak' | count 1
+// RUN: %clang_cc1 -emit-llvm < %s | grep 'extern_weak' | count 1
struct S;
void __attribute__((weak)) foo1(struct S);
diff --git a/test/CodeGen/whilestmt.c b/test/CodeGen/whilestmt.c
index 95e18f4d21ff..3973b2860db9 100644
--- a/test/CodeGen/whilestmt.c
+++ b/test/CodeGen/whilestmt.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
int bar();
int foo() {
diff --git a/test/CodeGen/writable-strings.c b/test/CodeGen/writable-strings.c
index c8b70d5f0540..693fa5ea24ba 100644
--- a/test/CodeGen/writable-strings.c
+++ b/test/CodeGen/writable-strings.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - -fwritable-strings %s
+// RUN: %clang_cc1 -emit-llvm -o - -fwritable-strings %s
int main() {
char *str = "abc";
diff --git a/test/CodeGen/x86.c b/test/CodeGen/x86.c
index 0420a4cd97de..e97d537d331b 100644
--- a/test/CodeGen/x86.c
+++ b/test/CodeGen/x86.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=i686-pc-linux-gnu -emit-llvm -o - > %t1
+// RUN: %clang_cc1 %s -triple=i686-pc-linux-gnu -emit-llvm -o - > %t1
// RUN: grep "ax" %t1
// RUN: grep "bx" %t1
// RUN: grep "cx" %t1
diff --git a/test/CodeGen/x86_32-arguments.c b/test/CodeGen/x86_32-arguments.c
index 33f635c31ae1..eb98e1a2282a 100644
--- a/test/CodeGen/x86_32-arguments.c
+++ b/test/CodeGen/x86_32-arguments.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fblocks -triple i386-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fblocks -triple i386-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep 'define signext i8 @f0()' %t
// RUN: grep 'define signext i16 @f1()' %t
// RUN: grep 'define i32 @f2()' %t
diff --git a/test/CodeGen/x86_64-arguments.c b/test/CodeGen/x86_64-arguments.c
index 1a848ead356f..d6b9b2936045 100644
--- a/test/CodeGen/x86_64-arguments.c
+++ b/test/CodeGen/x86_64-arguments.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o %t %s
// RUN: grep 'define signext i8 @f0()' %t
// RUN: grep 'define signext i16 @f1()' %t
// RUN: grep 'define i32 @f2()' %t
diff --git a/test/CodeGenCXX/PR4827-cast.cpp b/test/CodeGenCXX/PR4827-cast.cpp
index 958798d77f60..34a840cbdf5b 100644
--- a/test/CodeGenCXX/PR4827-cast.cpp
+++ b/test/CodeGenCXX/PR4827-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-llvm -o - %s
struct A;
struct B;
extern A *f();
diff --git a/test/CodeGenCXX/PR4890-debug-info-dtor.cpp b/test/CodeGenCXX/PR4890-debug-info-dtor.cpp
index a0d3a8ddac23..bcaf1b96274e 100644
--- a/test/CodeGenCXX/PR4890-debug-info-dtor.cpp
+++ b/test/CodeGenCXX/PR4890-debug-info-dtor.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only -g %s
+// RUN: %clang_cc1 -emit-llvm-only -g %s
struct X {
~X();
};
diff --git a/test/CodeGenCXX/PR4983-constructor-conversion.cpp b/test/CodeGenCXX/PR4983-constructor-conversion.cpp
index 31eae2e791f6..797a1baa49e0 100644
--- a/test/CodeGenCXX/PR4983-constructor-conversion.cpp
+++ b/test/CodeGenCXX/PR4983-constructor-conversion.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only %s
+// RUN: %clang_cc1 -emit-llvm-only %s
struct A {
A(const char *s){}
diff --git a/test/CodeGenCXX/PR5050-constructor-conversion.cpp b/test/CodeGenCXX/PR5050-constructor-conversion.cpp
index c0b53d5f6e55..9103b8321f84 100644
--- a/test/CodeGenCXX/PR5050-constructor-conversion.cpp
+++ b/test/CodeGenCXX/PR5050-constructor-conversion.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
struct A { A(const A&, int i1 = 1); };
@@ -11,7 +11,7 @@ A f(const B &b) {
return b;
}
-// CHECK-LP64: call __ZN1AC1ERKS_i
+// CHECK-LP64: callq __ZN1AC1ERKS_i
// CHECK-LP32: call L__ZN1AC1ERKS_i
diff --git a/test/CodeGenCXX/PR5093-static-member-function.cpp b/test/CodeGenCXX/PR5093-static-member-function.cpp
index a27b08f6ada7..ceab8528e8bc 100644
--- a/test/CodeGenCXX/PR5093-static-member-function.cpp
+++ b/test/CodeGenCXX/PR5093-static-member-function.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
struct a {
static void f();
};
diff --git a/test/CodeGenCXX/PR5834-constructor-conversion.cpp b/test/CodeGenCXX/PR5834-constructor-conversion.cpp
new file mode 100644
index 000000000000..044d8e555d7c
--- /dev/null
+++ b/test/CodeGenCXX/PR5834-constructor-conversion.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s
+
+// PR5834
+struct ASTMultiMover {};
+struct ASTMultiPtr {
+ ASTMultiPtr();
+ ASTMultiPtr(ASTMultiPtr&);
+ ASTMultiPtr(ASTMultiMover mover);
+ operator ASTMultiMover();
+};
+void f1() {
+ extern void f0(ASTMultiPtr);
+ f0(ASTMultiPtr());
+}
diff --git a/test/CodeGenCXX/__null.cpp b/test/CodeGenCXX/__null.cpp
index 476b0ad083bc..8a1779788395 100644
--- a/test/CodeGenCXX/__null.cpp
+++ b/test/CodeGenCXX/__null.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
int* a = __null;
int b = __null;
diff --git a/test/CodeGenCXX/address-of-fntemplate.cpp b/test/CodeGenCXX/address-of-fntemplate.cpp
index 1f0c8f38630b..c5fa89d86d41 100644
--- a/test/CodeGenCXX/address-of-fntemplate.cpp
+++ b/test/CodeGenCXX/address-of-fntemplate.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
template <typename T> void f(T) {}
template <typename T> void f() { }
diff --git a/test/CodeGenCXX/anonymous-namespaces.cpp b/test/CodeGenCXX/anonymous-namespaces.cpp
index dcfd518d684b..7689c941e103 100644
--- a/test/CodeGenCXX/anonymous-namespaces.cpp
+++ b/test/CodeGenCXX/anonymous-namespaces.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
namespace {
// CHECK: @_ZN12_GLOBAL__N_11aE = internal global i32 0
diff --git a/test/CodeGenCXX/anonymous-union-member-initializer.cpp b/test/CodeGenCXX/anonymous-union-member-initializer.cpp
index 2030f4053c90..ea3eafc99553 100644
--- a/test/CodeGenCXX/anonymous-union-member-initializer.cpp
+++ b/test/CodeGenCXX/anonymous-union-member-initializer.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-llvm -o - %s
struct A {
union {
diff --git a/test/CodeGenCXX/array-construction.cpp b/test/CodeGenCXX/array-construction.cpp
index 2f82872d6c9e..ab46be72d879 100644
--- a/test/CodeGenCXX/array-construction.cpp
+++ b/test/CodeGenCXX/array-construction.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
extern "C" int printf(...);
@@ -30,7 +30,7 @@ int main() {
h, i, j, array[h][i][j].i, array[h][i][j].f);
}
-// CHECK-LP64: call __ZN4xptoC1Ev
+// CHECK-LP64: callq __ZN4xptoC1Ev
// CHECK-LP32: call L__ZN4xptoC1Ev
diff --git a/test/CodeGenCXX/array-operator-delete-call.cpp b/test/CodeGenCXX/array-operator-delete-call.cpp
index c23d33632a38..acb85d23b3d9 100644
--- a/test/CodeGenCXX/array-operator-delete-call.cpp
+++ b/test/CodeGenCXX/array-operator-delete-call.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
extern "C" int printf(...);
@@ -57,7 +57,7 @@ int main()
}
COST c2;
-// CHECK-LP64: call __ZdaPv
+// CHECK-LP64: callq __ZdaPv
// CHECK-LP32: call L__ZdaPv
diff --git a/test/CodeGenCXX/array-pointer-decay.cpp b/test/CodeGenCXX/array-pointer-decay.cpp
index 5751b67b7491..3fe6b72a5419 100644
--- a/test/CodeGenCXX/array-pointer-decay.cpp
+++ b/test/CodeGenCXX/array-pointer-decay.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
void f(const char*);
diff --git a/test/CodeGenCXX/array-value-initialize.cpp b/test/CodeGenCXX/array-value-initialize.cpp
index f041bc584b12..5fe6c2022d8f 100644
--- a/test/CodeGenCXX/array-value-initialize.cpp
+++ b/test/CodeGenCXX/array-value-initialize.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-llvm -o - %s
// PR5463
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/assign-operator.cpp b/test/CodeGenCXX/assign-operator.cpp
index 3e0be4519438..cb8867f2f6a3 100644
--- a/test/CodeGenCXX/assign-operator.cpp
+++ b/test/CodeGenCXX/assign-operator.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm-only -verify
+// RUN: %clang_cc1 %s -emit-llvm-only -verify
class x {
int operator=(int);
diff --git a/test/CodeGenCXX/attr.cpp b/test/CodeGenCXX/attr.cpp
index 695e9e72f1a1..8fd86414862c 100644
--- a/test/CodeGenCXX/attr.cpp
+++ b/test/CodeGenCXX/attr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -O0 -S %s -o %t.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -O0 -S %s -o %t.s
// RUN: FileCheck --input-file=%t.s %s
int foo() __attribute__((aligned(1024)));
diff --git a/test/CodeGenCXX/call-arg-zero-temp.cpp b/test/CodeGenCXX/call-arg-zero-temp.cpp
index e066927ad702..ed8118e07d92 100644
--- a/test/CodeGenCXX/call-arg-zero-temp.cpp
+++ b/test/CodeGenCXX/call-arg-zero-temp.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
@@ -17,6 +17,6 @@ int main() {
foo(obj());
}
-// CHECK-LP64: call __Z3foo3obj
+// CHECK-LP64: callq __Z3foo3obj
// CHECK-LP32: call __Z3foo3obj
diff --git a/test/CodeGenCXX/cast-conversion.cpp b/test/CodeGenCXX/cast-conversion.cpp
index fa8487ac66b9..6dc6de601848 100644
--- a/test/CodeGenCXX/cast-conversion.cpp
+++ b/test/CodeGenCXX/cast-conversion.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
struct A {
@@ -17,12 +17,12 @@ int main () {
static_cast<B>(10);
}
-// CHECK-LP64: call __ZN1AC1Ei
-// CHECK-LP64: call __ZN1BC1E1A
-// CHECK-LP64: call __ZN1AC1Ei
-// CHECK-LP64: call __ZN1BC1E1A
-// CHECK-LP64: call __ZN1AC1Ei
-// CHECK-LP64: call __ZN1BC1E1A
+// CHECK-LP64: callq __ZN1AC1Ei
+// CHECK-LP64: callq __ZN1BC1E1A
+// CHECK-LP64: callq __ZN1AC1Ei
+// CHECK-LP64: callq __ZN1BC1E1A
+// CHECK-LP64: callq __ZN1AC1Ei
+// CHECK-LP64: callq __ZN1BC1E1A
// CHECK-LP32: call L__ZN1AC1Ei
// CHECK-LP32: call L__ZN1BC1E1A
diff --git a/test/CodeGenCXX/casts.cpp b/test/CodeGenCXX/casts.cpp
index 045f2d4fe031..436b722e69d2 100644
--- a/test/CodeGenCXX/casts.cpp
+++ b/test/CodeGenCXX/casts.cpp
@@ -1,10 +1,12 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
// PR5248
namespace PR5248 {
struct A {
void copyFrom(const A &src);
void addRef(void);
+
+ A& operator=(int);
};
void A::copyFrom(const A &src) {
@@ -12,3 +14,7 @@ void A::copyFrom(const A &src) {
}
}
+// reinterpret_cast to self
+void test(PR5248::A* a) {
+ reinterpret_cast<PR5248::A&>(*a) = 17;
+}
diff --git a/test/CodeGenCXX/class-layout.cpp b/test/CodeGenCXX/class-layout.cpp
index d4fc627082d2..31091c5f4543 100644
--- a/test/CodeGenCXX/class-layout.cpp
+++ b/test/CodeGenCXX/class-layout.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// An extra byte shoudl be allocated for an empty class.
// CHECK: %struct.A = type { i8 }
@@ -7,3 +7,7 @@ struct A { } a;
// No need to add tail padding here.
// CHECK: %struct.B = type { i8*, i32 }
struct B { void *a; int b; } b;
+
+// C should have a vtable pointer.
+// CHECK: %struct.C = type { i8**, i32 }
+struct C { virtual void f(); int a; } *c;
diff --git a/test/CodeGenCXX/condition.cpp b/test/CodeGenCXX/condition.cpp
index a6b74efff389..eca07d866bfc 100644
--- a/test/CodeGenCXX/condition.cpp
+++ b/test/CodeGenCXX/condition.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
void *f();
template <typename T> T* g() {
diff --git a/test/CodeGenCXX/conditional-expr-lvalue.cpp b/test/CodeGenCXX/conditional-expr-lvalue.cpp
index 7b3233a5bed0..a0843c40f071 100644
--- a/test/CodeGenCXX/conditional-expr-lvalue.cpp
+++ b/test/CodeGenCXX/conditional-expr-lvalue.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only %s
+// RUN: %clang_cc1 -emit-llvm-only %s
void f(bool flag) {
int a = 1;
int b = 2;
diff --git a/test/CodeGenCXX/conditional-temporaries.cpp b/test/CodeGenCXX/conditional-temporaries.cpp
index f6c466a93135..0eac10b43cfd 100644
--- a/test/CodeGenCXX/conditional-temporaries.cpp
+++ b/test/CodeGenCXX/conditional-temporaries.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
struct I {
int i;
diff --git a/test/CodeGenCXX/const-base-cast.cpp b/test/CodeGenCXX/const-base-cast.cpp
new file mode 100644
index 000000000000..ed47069d2415
--- /dev/null
+++ b/test/CodeGenCXX/const-base-cast.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -O1 -emit-llvm %s -o - | FileCheck %s
+
+// Check that the following construct, which is similar to one which occurs
+// in Firefox, is not misfolded (folding it correctly would be a bonus, but
+// that doesn't work at the moment, hence the -O1 in the runline).
+struct A { char x; };
+struct B { char y; };
+struct C : A,B {};
+unsigned char x = ((char*)(B*)(C*)0x1000) - (char*)0x1000;
+
+// CHECK: @x = global i8 1
diff --git a/test/CodeGenCXX/const-global-linkage.cpp b/test/CodeGenCXX/const-global-linkage.cpp
index f12c569d9428..f88bc808a7c6 100644
--- a/test/CodeGenCXX/const-global-linkage.cpp
+++ b/test/CodeGenCXX/const-global-linkage.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
const int x = 10;
const int y = 20;
diff --git a/test/CodeGenCXX/const-init.cpp b/test/CodeGenCXX/const-init.cpp
index 42da6346daf3..874b5f64e2ba 100644
--- a/test/CodeGenCXX/const-init.cpp
+++ b/test/CodeGenCXX/const-init.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
// CHECK: @a = global i32 10
int a = 10;
diff --git a/test/CodeGenCXX/constructor-conversion.cpp b/test/CodeGenCXX/constructor-conversion.cpp
index dcc9535315ab..f135da5e85db 100644
--- a/test/CodeGenCXX/constructor-conversion.cpp
+++ b/test/CodeGenCXX/constructor-conversion.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
extern "C" int printf(...);
@@ -45,9 +45,9 @@ int main() {
g(3); // g(X(3))
}
-// CHECK-LP64: call __ZN1XC1Ei
-// CHECK-LP64: call __ZN1XC1EPKci
-// CHECK-LP64: call __ZN1XC1Ev
+// CHECK-LP64: callq __ZN1XC1Ei
+// CHECK-LP64: callq __ZN1XC1EPKci
+// CHECK-LP64: callq __ZN1XC1Ev
// CHECK-LP32: call L__ZN1XC1Ei
// CHECK-LP32: call L__ZN1XC1EPKci
diff --git a/test/CodeGenCXX/constructor-convert.cpp b/test/CodeGenCXX/constructor-convert.cpp
index 6fa6d556dc50..7de07724bf17 100644
--- a/test/CodeGenCXX/constructor-convert.cpp
+++ b/test/CodeGenCXX/constructor-convert.cpp
@@ -1,4 +1,4 @@
-// RUN: clang -emit-llvm -S -o - %s
+// RUN: %clang -emit-llvm -S -o - %s
// PR5775
class Twine {
diff --git a/test/CodeGenCXX/constructor-default-arg.cpp b/test/CodeGenCXX/constructor-default-arg.cpp
index c494149d1110..ec0b8da69b3d 100644
--- a/test/CodeGenCXX/constructor-default-arg.cpp
+++ b/test/CodeGenCXX/constructor-default-arg.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
extern "C" int printf(...);
@@ -30,9 +30,9 @@ int main() {
X d(a, 5, 6);
}
-// CHECK-LP64: call __ZN1XC1ERKS_iii
-// CHECK-LP64: call __ZN1XC1ERKS_iii
-// CHECK-LP64: call __ZN1XC1ERKS_iii
+// CHECK-LP64: callq __ZN1XC1ERKS_iii
+// CHECK-LP64: callq __ZN1XC1ERKS_iii
+// CHECK-LP64: callq __ZN1XC1ERKS_iii
// CHECK-LP32: call L__ZN1XC1ERKS_iii
// CHECK-LP32: call L__ZN1XC1ERKS_iii
diff --git a/test/CodeGenCXX/constructor-for-array-members.cpp b/test/CodeGenCXX/constructor-for-array-members.cpp
index 5160a8975488..b981da497364 100644
--- a/test/CodeGenCXX/constructor-for-array-members.cpp
+++ b/test/CodeGenCXX/constructor-for-array-members.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
extern "C" int printf(...);
@@ -38,6 +38,6 @@ int main() {
m1.pr();
}
-// CHECK-LP64: call __ZN1SC1Ev
+// CHECK-LP64: callq __ZN1SC1Ev
// CHECK-LP32: call L__ZN1SC1Ev
diff --git a/test/CodeGenCXX/constructor-init-reference.cpp b/test/CodeGenCXX/constructor-init-reference.cpp
index 040441fde0f8..c2f41e1f0cbf 100644
--- a/test/CodeGenCXX/constructor-init-reference.cpp
+++ b/test/CodeGenCXX/constructor-init-reference.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | grep "store i32\* @x, i32\*\*"
+// RUN: %clang_cc1 -emit-llvm -o - %s | grep "store i32\* @x, i32\*\*"
int x;
class A {
diff --git a/test/CodeGenCXX/constructor-init.cpp b/test/CodeGenCXX/constructor-init.cpp
index 1b025126a345..a0a35fa16f1b 100644
--- a/test/CodeGenCXX/constructor-init.cpp
+++ b/test/CodeGenCXX/constructor-init.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -emit-llvm -o - | FileCheck %s
extern "C" int printf(...);
@@ -59,3 +59,24 @@ int main() {
n1.PR();
}
+// PR5826
+template <class T> struct A {
+ A() {}
+ A(int) {}
+ A(const A&) {}
+ ~A() {}
+ operator int() {return 0;}
+};
+
+// CHECK: define void @_Z1fv()
+void f() {
+ // CHECK: call void @_ZN1AIsEC1Ei
+ A<short> a4 = 97;
+
+ // CHECK-NEXT: store i32 17
+ int i = 17;
+
+ // CHECK-NEXT: call void @_ZN1AIsED1Ev
+ // CHECK-NOT: call void @_ZN1AIsED1Ev
+ // CHECK: ret void
+}
diff --git a/test/CodeGenCXX/constructor-template.cpp b/test/CodeGenCXX/constructor-template.cpp
index 1142aac30e24..a3576fdc72fe 100644
--- a/test/CodeGenCXX/constructor-template.cpp
+++ b/test/CodeGenCXX/constructor-template.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
// PR4826
diff --git a/test/CodeGenCXX/conversion-function.cpp b/test/CodeGenCXX/conversion-function.cpp
index c93587675ba1..fccb6f094e07 100644
--- a/test/CodeGenCXX/conversion-function.cpp
+++ b/test/CodeGenCXX/conversion-function.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
extern "C" int printf(...);
@@ -12,6 +12,9 @@ S::operator int() {
return 10;
}
+int f(S s) {
+ return s;
+}
class X { // ...
public: operator int() { printf("operator int()\n"); return iX; }
@@ -94,15 +97,18 @@ void f(Yb& a) {
char ch = a; // OK. calls Yb::operator char();
}
+struct A {
+ operator int() const;
+};
// CHECK-LP64: .globl __ZN1ScviEv
// CHECK-LP64-NEXT: __ZN1ScviEv:
-// CHECK-LP64: call __ZN1Ycv1ZEv
-// CHECK-LP64: call __ZN1Zcv1XEv
-// CHECK-LP64: call __ZN1XcviEv
-// CHECK-LP64: call __ZN1XcvfEv
-// CHECK-LP64: call __ZN2XBcviEv
-// CHECK-LP64: call __ZN2YbcvcEv
+// CHECK-LP64: callq __ZN1Ycv1ZEv
+// CHECK-LP64: callq __ZN1Zcv1XEv
+// CHECK-LP64: callq __ZN1XcviEv
+// CHECK-LP64: callq __ZN1XcvfEv
+// CHECK-LP64: callq __ZN2XBcviEv
+// CHECK-LP64: callq __ZN2YbcvcEv
// CHECK-LP32: .globl __ZN1ScviEv
// CHECK-LP32-NEXT: __ZN1ScviEv:
diff --git a/test/CodeGenCXX/conversion-operator-base.cpp b/test/CodeGenCXX/conversion-operator-base.cpp
index 49796d08a87f..8fbeadf14916 100644
--- a/test/CodeGenCXX/conversion-operator-base.cpp
+++ b/test/CodeGenCXX/conversion-operator-base.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only %s -verify
+// RUN: %clang_cc1 -emit-llvm-only %s -verify
// PR5730
struct A { operator int(); float y; };
diff --git a/test/CodeGenCXX/convert-to-fptr.cpp b/test/CodeGenCXX/convert-to-fptr.cpp
index 7cc8c08444aa..dc49401af929 100644
--- a/test/CodeGenCXX/convert-to-fptr.cpp
+++ b/test/CodeGenCXX/convert-to-fptr.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
extern "C" int printf(...);
@@ -38,8 +38,8 @@ int main()
return 0;
}
-// CHECK-LP64: call __ZN1AcvPFiiEEv
-// CHECK-LP64: call __ZN1BcvRFiiEEv
+// CHECK-LP64: callq __ZN1AcvPFiiEEv
+// CHECK-LP64: callq __ZN1BcvRFiiEEv
// CHECK-LP32: call L__ZN1AcvPFiiEEv
// CHECK-LP32: call L__ZN1BcvRFiiEEv
diff --git a/test/CodeGenCXX/copy-assign-synthesis-1.cpp b/test/CodeGenCXX/copy-assign-synthesis-1.cpp
index 14fbe30703d3..eb761c27367d 100644
--- a/test/CodeGenCXX/copy-assign-synthesis-1.cpp
+++ b/test/CodeGenCXX/copy-assign-synthesis-1.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/copy-assign-synthesis-2.cpp b/test/CodeGenCXX/copy-assign-synthesis-2.cpp
index 60d52f57de98..c25e0467fad5 100644
--- a/test/CodeGenCXX/copy-assign-synthesis-2.cpp
+++ b/test/CodeGenCXX/copy-assign-synthesis-2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
struct A {};
A& (A::*x)(const A&) = &A::operator=;
// CHECK: define linkonce_odr %struct.A* @_ZN1AaSERKS_
diff --git a/test/CodeGenCXX/copy-assign-synthesis-3.cpp b/test/CodeGenCXX/copy-assign-synthesis-3.cpp
index 3dab0f2a81b3..0c876d02ec56 100644
--- a/test/CodeGenCXX/copy-assign-synthesis-3.cpp
+++ b/test/CodeGenCXX/copy-assign-synthesis-3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -verify %s
struct A {
A& operator=(const A&);
diff --git a/test/CodeGenCXX/copy-assign-synthesis.cpp b/test/CodeGenCXX/copy-assign-synthesis.cpp
index 65a84f414a93..e9fc0c337c10 100644
--- a/test/CodeGenCXX/copy-assign-synthesis.cpp
+++ b/test/CodeGenCXX/copy-assign-synthesis.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: grep "_ZN1XaSERK1X" %t | count 0
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/copy-constructor-elim-2.cpp b/test/CodeGenCXX/copy-constructor-elim-2.cpp
new file mode 100644
index 000000000000..3a06c10ff186
--- /dev/null
+++ b/test/CodeGenCXX/copy-constructor-elim-2.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+struct A { int x; A(int); ~A(); };
+A f() { return A(0); }
+// CHECK: define void @_Z1fv
+// CHECK: call void @_ZN1AC1Ei
+// CHECK-NEXT: ret void
diff --git a/test/CodeGenCXX/copy-constructor-elim.cpp b/test/CodeGenCXX/copy-constructor-elim.cpp
index 953effe77af1..c883584fe02f 100644
--- a/test/CodeGenCXX/copy-constructor-elim.cpp
+++ b/test/CodeGenCXX/copy-constructor-elim.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: grep "_ZN1CC1ERK1C" %t | count 0
// RUN: grep "_ZN1SC1ERK1S" %t | count 0
diff --git a/test/CodeGenCXX/copy-constructor-synthesis-2.cpp b/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
index b4add46db85a..2f7c79b90303 100644
--- a/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
+++ b/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
struct A { virtual void a(); };
A x(A& y) { return y; }
diff --git a/test/CodeGenCXX/copy-constructor-synthesis.cpp b/test/CodeGenCXX/copy-constructor-synthesis.cpp
index 2e950eb9e9b2..ae8eefa7fe40 100644
--- a/test/CodeGenCXX/copy-constructor-synthesis.cpp
+++ b/test/CodeGenCXX/copy-constructor-synthesis.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/debug-info.cpp b/test/CodeGenCXX/debug-info.cpp
index c5e3c79b0aab..705491e3a9b4 100644
--- a/test/CodeGenCXX/debug-info.cpp
+++ b/test/CodeGenCXX/debug-info.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only -g
+// RUN: %clang_cc1 -emit-llvm-only -g
template<typename T> struct Identity {
typedef T Type;
};
diff --git a/test/CodeGenCXX/decl-ref-init.cpp b/test/CodeGenCXX/decl-ref-init.cpp
index fd93b7b21e04..c215b1b9be67 100644
--- a/test/CodeGenCXX/decl-ref-init.cpp
+++ b/test/CodeGenCXX/decl-ref-init.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
struct A {};
@@ -23,8 +23,8 @@ int main() {
const A& rca2 = d();
}
-// CHECK-LP64: call __ZN1BcvR1AEv
-// CHECK-LP64: call __ZN1BcvR1AEv
+// CHECK-LP64: callq __ZN1BcvR1AEv
+// CHECK-LP64: callq __ZN1BcvR1AEv
// CHECK-LP32: call L__ZN1BcvR1AEv
// CHECK-LP32: call L__ZN1BcvR1AEv
diff --git a/test/CodeGenCXX/default-arg-temps.cpp b/test/CodeGenCXX/default-arg-temps.cpp
index 0ec5b582c95b..e523eb0cfd23 100644
--- a/test/CodeGenCXX/default-arg-temps.cpp
+++ b/test/CodeGenCXX/default-arg-temps.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9
+// RUN: %clang_cc1 -emit-llvm %s -o %t -triple=x86_64-apple-darwin9
struct T {
T();
diff --git a/test/CodeGenCXX/default-arguments.cpp b/test/CodeGenCXX/default-arguments.cpp
index 71d4baa47566..282e5d0d5042 100644
--- a/test/CodeGenCXX/default-arguments.cpp
+++ b/test/CodeGenCXX/default-arguments.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// PR5484
namespace PR5484 {
diff --git a/test/CodeGenCXX/default-constructor-default-argument.cpp b/test/CodeGenCXX/default-constructor-default-argument.cpp
index f53732e471fe..971757d241b4 100644
--- a/test/CodeGenCXX/default-constructor-default-argument.cpp
+++ b/test/CodeGenCXX/default-constructor-default-argument.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// Check that call to constructor for struct A is generated correctly.
struct A { A(int x = 2); };
diff --git a/test/CodeGenCXX/default-constructor-for-members.cpp b/test/CodeGenCXX/default-constructor-for-members.cpp
index d972d63d3cbc..1f177460236c 100644
--- a/test/CodeGenCXX/default-constructor-for-members.cpp
+++ b/test/CodeGenCXX/default-constructor-for-members.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
extern "C" int printf(...);
@@ -18,6 +18,6 @@ int main() {
M m1;
}
-// CHECK-LP64: call __ZN1SC1Ev
+// CHECK-LP64: callq __ZN1SC1Ev
// CHECK-LP32: call L__ZN1SC1Ev
diff --git a/test/CodeGenCXX/default-constructor-template-member.cpp b/test/CodeGenCXX/default-constructor-template-member.cpp
index e0a17e0e4f71..e74fb6da69a6 100644
--- a/test/CodeGenCXX/default-constructor-template-member.cpp
+++ b/test/CodeGenCXX/default-constructor-template-member.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
template <class T> struct A { A(); };
struct B { A<int> x; };
diff --git a/test/CodeGenCXX/default-destructor-synthesis.cpp b/test/CodeGenCXX/default-destructor-synthesis.cpp
index fef9c03d7ac1..098458d35d5c 100644
--- a/test/CodeGenCXX/default-destructor-synthesis.cpp
+++ b/test/CodeGenCXX/default-destructor-synthesis.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -O0 -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -O0 -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 -input-file=%t-32.s %s
extern "C" int printf(...);
@@ -45,8 +45,8 @@ M gm;
int main() {M m1;}
-// CHECK-LP64: call __ZN1MC1Ev
-// CHECK-LP64: call __ZN1MD1Ev
+// CHECK-LP64: callq __ZN1MC1Ev
+// CHECK-LP64: callq __ZN1MD1Ev
// CHECK-LP64: .globl __ZN1MD1Ev
// CHECK-LP64-NEXT: .weak_definition __ZN1MD1Ev
// CHECK-LP64-NEXT: __ZN1MD1Ev:
diff --git a/test/CodeGenCXX/delete-two-arg.cpp b/test/CodeGenCXX/delete-two-arg.cpp
index a5b18ba06fc3..d6bdb098844f 100644
--- a/test/CodeGenCXX/delete-two-arg.cpp
+++ b/test/CodeGenCXX/delete-two-arg.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i686-pc-linux-gnu %s -o - -emit-llvm -verify | FileCheck %s
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu %s -o - -emit-llvm -verify | FileCheck %s
struct A { void operator delete(void*,__typeof(sizeof(int))); int x; };
void a(A* x) { delete x; }
diff --git a/test/CodeGenCXX/delete.cpp b/test/CodeGenCXX/delete.cpp
index 78c83cf0df62..7cc264f5c5f5 100644
--- a/test/CodeGenCXX/delete.cpp
+++ b/test/CodeGenCXX/delete.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
void t1(int *a) {
delete a;
diff --git a/test/CodeGenCXX/derived-to-base-conv.cpp b/test/CodeGenCXX/derived-to-base-conv.cpp
index 70948b0ff933..c1a0caa7584f 100644
--- a/test/CodeGenCXX/derived-to-base-conv.cpp
+++ b/test/CodeGenCXX/derived-to-base-conv.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
extern "C" int printf(...);
@@ -65,12 +65,12 @@ void foo(Base) {}
void test(Derived bb)
{
- // CHECK-LP64-NOT: call __ZN4BasecvR7DerivedEv
- // CHECK-LP32-NOT: call L__ZN4BasecvR7DerivedEv
+ // CHECK-LP64-NOT: callq __ZN4BasecvR7DerivedEv
+ // CHECK-LP32-NOT: callq L__ZN4BasecvR7DerivedEv
foo(bb);
}
-// CHECK-LP64: call __ZN1XcvR1BEv
-// CHECK-LP64: call __ZN1AC1ERKS_
+// CHECK-LP64: callq __ZN1XcvR1BEv
+// CHECK-LP64: callq __ZN1AC1ERKS_
// CHECK-LP32: call L__ZN1XcvR1BEv
// CHECK-LP32: call L__ZN1AC1ERKS_
diff --git a/test/CodeGenCXX/derived-to-base.cpp b/test/CodeGenCXX/derived-to-base.cpp
index 63492d604d17..45728b7c0122 100644
--- a/test/CodeGenCXX/derived-to-base.cpp
+++ b/test/CodeGenCXX/derived-to-base.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o -
+// RUN: %clang_cc1 -emit-llvm %s -o -
struct A {
void f();
diff --git a/test/CodeGenCXX/destructor-calls.cpp b/test/CodeGenCXX/destructor-calls.cpp
index 3f0288b85c14..4da46a4358a6 100644
--- a/test/CodeGenCXX/destructor-calls.cpp
+++ b/test/CodeGenCXX/destructor-calls.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/destructors.cpp b/test/CodeGenCXX/destructors.cpp
index a196c13f8f42..0a7e1e5505ed 100644
--- a/test/CodeGenCXX/destructors.cpp
+++ b/test/CodeGenCXX/destructors.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm -o -
struct A {
int a;
diff --git a/test/CodeGenCXX/devirtualize-virtual-function-calls.cpp b/test/CodeGenCXX/devirtualize-virtual-function-calls.cpp
index cbf55ad61331..74795b5dfb0e 100644
--- a/test/CodeGenCXX/devirtualize-virtual-function-calls.cpp
+++ b/test/CodeGenCXX/devirtualize-virtual-function-calls.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
struct A {
virtual void f();
diff --git a/test/CodeGenCXX/dynamic-cast.cpp b/test/CodeGenCXX/dynamic-cast.cpp
new file mode 100644
index 000000000000..aeb2a64157b4
--- /dev/null
+++ b/test/CodeGenCXX/dynamic-cast.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -emit-llvm-only
+
+struct A { virtual void f(); };
+struct B : A { };
+
+const B& f(A *a) {
+ return dynamic_cast<const B&>(*a);
+}
diff --git a/test/CodeGenCXX/dyncast.cpp b/test/CodeGenCXX/dyncast.cpp
index 0f78fb0deb60..a2d116a89872 100644
--- a/test/CodeGenCXX/dyncast.cpp
+++ b/test/CodeGenCXX/dyncast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -I%S -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll
+// RUN: %clang_cc1 -I%S -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll
// RUN: FileCheck -check-prefix LL --input-file=%t.ll %s
#include <typeinfo>
@@ -97,7 +97,7 @@ void test1() {
// CHECK-LL-NEXT: br i1 %4, label %5, label %9
// CHECK-LL: ; <label>:5
// CHECK-LL-NEXT: %6 = bitcast %class.test1_A* %tmp to i8*
-// CHECK-LL-NEXT: %7 = call i8* @__dynamic_cast(i8* %6, i8* bitcast ({{.*}} @_ZTI7test1_B to i8*), i8* bitcast (i8** @_ZTI7test1_D to i8*), i64 -1)
+// CHECK-LL-NEXT: %7 = call i8* @__dynamic_cast(i8* %6, i8* bitcast (%0* @_ZTI7test1_B to i8*), i8* bitcast (%1* @_ZTI7test1_D to i8*), i64 -1) ; <i8*> [#uses=1]
// CHECK-LL-NEXT: %8 = bitcast i8* %7 to %class.test1_D*
// CHECK-LL-NEXT: br label %10
// CHECK-LL: ; <label>:9
diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp
index 5570fb44c24c..dd798f4ca32e 100644
--- a/test/CodeGenCXX/eh.cpp
+++ b/test/CodeGenCXX/eh.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll
// RUN: FileCheck --input-file=%t.ll %s
struct test1_D {
diff --git a/test/CodeGenCXX/elide-call-reference.cpp b/test/CodeGenCXX/elide-call-reference.cpp
index 863e69c9cc02..c82eee70c840 100644
--- a/test/CodeGenCXX/elide-call-reference.cpp
+++ b/test/CodeGenCXX/elide-call-reference.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// PR5695
struct A { A(const A&); ~A(); };
diff --git a/test/CodeGenCXX/empty-union.cpp b/test/CodeGenCXX/empty-union.cpp
index fdd97415a203..118a0d29b47d 100644
--- a/test/CodeGenCXX/empty-union.cpp
+++ b/test/CodeGenCXX/empty-union.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-llvm -o - %s
union sigval { };
diff --git a/test/CodeGenCXX/enum.cpp b/test/CodeGenCXX/enum.cpp
index 6ce04a3a532b..cfcd264bd347 100644
--- a/test/CodeGenCXX/enum.cpp
+++ b/test/CodeGenCXX/enum.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -verify %s
enum A { a } __attribute((packed));
int func(A x) { return x==a; }
diff --git a/test/CodeGenCXX/eval-recursive-constant.cpp b/test/CodeGenCXX/eval-recursive-constant.cpp
index b60070fa1f4e..608c95d828ed 100644
--- a/test/CodeGenCXX/eval-recursive-constant.cpp
+++ b/test/CodeGenCXX/eval-recursive-constant.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm-only
+// RUN: %clang_cc1 %s -emit-llvm-only
extern const int a,b;
const int a=b,b=a;
diff --git a/test/CodeGenCXX/exceptions.cpp b/test/CodeGenCXX/exceptions.cpp
index 396ff441ef9a..4d8fb809ab9c 100644
--- a/test/CodeGenCXX/exceptions.cpp
+++ b/test/CodeGenCXX/exceptions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fexceptions
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fexceptions
struct allocator {
allocator();
diff --git a/test/CodeGenCXX/explicit-instantiation.cpp b/test/CodeGenCXX/explicit-instantiation.cpp
index b33ba85cf660..ab9174e8f406 100644
--- a/test/CodeGenCXX/explicit-instantiation.cpp
+++ b/test/CodeGenCXX/explicit-instantiation.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -triple i686-pc-linux-gnu -o %t %s
+// RUN: %clang_cc1 -emit-llvm -triple i686-pc-linux-gnu -o %t %s
// RUN: grep "define i32 @_ZNK4plusIillEclERKiRKl" %t | count 1
template<typename T, typename U, typename Result>
diff --git a/test/CodeGenCXX/expr.cpp b/test/CodeGenCXX/expr.cpp
index 4dc97c47aa26..6d641dcb622d 100644
--- a/test/CodeGenCXX/expr.cpp
+++ b/test/CodeGenCXX/expr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -x c++ < %s
+// RUN: %clang_cc1 -emit-llvm -x c++ < %s
void test0(int x) {
if (x != 0) return;
diff --git a/test/CodeGenCXX/extern-c.cpp b/test/CodeGenCXX/extern-c.cpp
index 3af8f3adb54f..427a45aebb1e 100644
--- a/test/CodeGenCXX/extern-c.cpp
+++ b/test/CodeGenCXX/extern-c.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
namespace foo {
// RUN: not grep "@a = global i32" %t
diff --git a/test/CodeGenCXX/function-template-explicit-specialization.cpp b/test/CodeGenCXX/function-template-explicit-specialization.cpp
index 046bc325a5d9..21f0127ab489 100644
--- a/test/CodeGenCXX/function-template-explicit-specialization.cpp
+++ b/test/CodeGenCXX/function-template-explicit-specialization.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
template<typename T> void a(T);
template<> void a(int) {}
diff --git a/test/CodeGenCXX/function-template-specialization.cpp b/test/CodeGenCXX/function-template-specialization.cpp
index 677be4cc0f9a..4a79fb1d6747 100644
--- a/test/CodeGenCXX/function-template-specialization.cpp
+++ b/test/CodeGenCXX/function-template-specialization.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
template<typename T, typename U>
T* next(T* ptr, const U& diff);
diff --git a/test/CodeGenCXX/global-array-destruction.cpp b/test/CodeGenCXX/global-array-destruction.cpp
index ebea9c156e27..c77551cb32d1 100644
--- a/test/CodeGenCXX/global-array-destruction.cpp
+++ b/test/CodeGenCXX/global-array-destruction.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
extern "C" int printf(...);
@@ -23,11 +23,11 @@ static S sarr1[4];
S s2;
S arr3[3];
-// CHECK-LP64: call ___cxa_atexit
-// CHECK-LP64: call ___cxa_atexit
-// CHECK-LP64: call ___cxa_atexit
-// CHECK-LP64: call ___cxa_atexit
-// CHECK-LP64: call ___cxa_atexit
-// CHECK-LP64: call ___cxa_atexit
-// CHECK-LP64: call ___cxa_atexit
-// CHECK-LP64: call ___cxa_atexit
+// CHECK-LP64: callq ___cxa_atexit
+// CHECK-LP64: callq ___cxa_atexit
+// CHECK-LP64: callq ___cxa_atexit
+// CHECK-LP64: callq ___cxa_atexit
+// CHECK-LP64: callq ___cxa_atexit
+// CHECK-LP64: callq ___cxa_atexit
+// CHECK-LP64: callq ___cxa_atexit
+// CHECK-LP64: callq ___cxa_atexit
diff --git a/test/CodeGenCXX/global-init.cpp b/test/CodeGenCXX/global-init.cpp
index ae450e17e85e..b375aef4c8e0 100644
--- a/test/CodeGenCXX/global-init.cpp
+++ b/test/CodeGenCXX/global-init.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple=x86_64-apple-darwin10 -emit-llvm %s -o - |FileCheck %s
+// RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm %s -o - |FileCheck %s
struct A {
A();
diff --git a/test/CodeGenCXX/global-llvm-constant.cpp b/test/CodeGenCXX/global-llvm-constant.cpp
index bd4319667e8f..e799231ab744 100644
--- a/test/CodeGenCXX/global-llvm-constant.cpp
+++ b/test/CodeGenCXX/global-llvm-constant.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
struct A {
A() { x = 10; }
diff --git a/test/CodeGenCXX/implicit-instantiation-1.cpp b/test/CodeGenCXX/implicit-instantiation-1.cpp
index cc86ef4cb502..0c826e4b20d1 100644
--- a/test/CodeGenCXX/implicit-instantiation-1.cpp
+++ b/test/CodeGenCXX/implicit-instantiation-1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
template<typename T>
struct X {
diff --git a/test/CodeGenCXX/init-incomplete-type.cpp b/test/CodeGenCXX/init-incomplete-type.cpp
index 402b86ea8cb4..3312d3e04b71 100644
--- a/test/CodeGenCXX/init-incomplete-type.cpp
+++ b/test/CodeGenCXX/init-incomplete-type.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm-only -verify
+// RUN: %clang_cc1 %s -emit-llvm-only -verify
// PR5489
template<typename E>
diff --git a/test/CodeGenCXX/inline-functions.cpp b/test/CodeGenCXX/inline-functions.cpp
index 9af4c6e5bec7..8d046a2f4a9b 100644
--- a/test/CodeGenCXX/inline-functions.cpp
+++ b/test/CodeGenCXX/inline-functions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// CHECK: ; ModuleID
struct A {
diff --git a/test/CodeGenCXX/instantiate-init-list.cpp b/test/CodeGenCXX/instantiate-init-list.cpp
index 7d5458af1f55..676d2994e7ed 100644
--- a/test/CodeGenCXX/instantiate-init-list.cpp
+++ b/test/CodeGenCXX/instantiate-init-list.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm-only -verify
+// RUN: %clang_cc1 %s -emit-llvm-only -verify
struct F {
void (*x)();
diff --git a/test/CodeGenCXX/key-function-vtable.cpp b/test/CodeGenCXX/key-function-vtable.cpp
index e61f33a4cfc3..251a14e28f2a 100644
--- a/test/CodeGenCXX/key-function-vtable.cpp
+++ b/test/CodeGenCXX/key-function-vtable.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// Simple key function test
struct testa { virtual void a(); };
diff --git a/test/CodeGenCXX/mangle-extern-local.cpp b/test/CodeGenCXX/mangle-extern-local.cpp
index 7c25859a9a6c..ed91da4e2e37 100644
--- a/test/CodeGenCXX/mangle-extern-local.cpp
+++ b/test/CodeGenCXX/mangle-extern-local.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// CHECK: @var1 = external global i32
// CHECK: @_ZN1N4var2E = external global i32
diff --git a/test/CodeGenCXX/mangle-extreme.cpp b/test/CodeGenCXX/mangle-extreme.cpp
index 77558d29d824..ef2d466e416c 100644
--- a/test/CodeGenCXX/mangle-extreme.cpp
+++ b/test/CodeGenCXX/mangle-extreme.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
struct X { };
diff --git a/test/CodeGenCXX/mangle-subst-std.cpp b/test/CodeGenCXX/mangle-subst-std.cpp
index a2994c4abf23..913c8f101b54 100644
--- a/test/CodeGenCXX/mangle-subst-std.cpp
+++ b/test/CodeGenCXX/mangle-subst-std.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
namespace std {
struct A { A(); };
diff --git a/test/CodeGenCXX/mangle-subst.cpp b/test/CodeGenCXX/mangle-subst.cpp
index a940f4f447b6..bd06869ff7f9 100644
--- a/test/CodeGenCXX/mangle-subst.cpp
+++ b/test/CodeGenCXX/mangle-subst.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
struct X {};
diff --git a/test/CodeGenCXX/mangle-system-header.cpp b/test/CodeGenCXX/mangle-system-header.cpp
index 8c642bd07533..cb68bc197600 100644
--- a/test/CodeGenCXX/mangle-system-header.cpp
+++ b/test/CodeGenCXX/mangle-system-header.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
// PR5420
diff --git a/test/CodeGenCXX/mangle-template.cpp b/test/CodeGenCXX/mangle-template.cpp
index 32ce33da952c..c8296f3c4bd7 100644
--- a/test/CodeGenCXX/mangle-template.cpp
+++ b/test/CodeGenCXX/mangle-template.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
namespace test1 {
int x;
diff --git a/test/CodeGenCXX/mangle-unnamed.cpp b/test/CodeGenCXX/mangle-unnamed.cpp
index 66c81e593225..4aec7dbf4a76 100644
--- a/test/CodeGenCXX/mangle-unnamed.cpp
+++ b/test/CodeGenCXX/mangle-unnamed.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -verify %s
struct S {
virtual ~S() { }
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index 62d8c6cc1e48..e8770dfec3e8 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -fblocks | FileCheck %s
struct X { };
struct Y { };
@@ -141,7 +141,7 @@ int f(struct a *x) {
// PR5017
extern "C" {
struct Debug {
- const Debug& operator<< (unsigned a) const { }
+ const Debug& operator<< (unsigned a) const { return *this; }
};
Debug dbg;
// CHECK: @_ZNK5DebuglsEj
@@ -229,6 +229,22 @@ template void ft8<int>();
// CHECK: @_Z3ft8IPvEN11__enable_ifIXsr11__is_scalarIT_E7__valueEvE6__typeEv
template void ft8<void*>();
+// PR5796
+namespace PR5796 {
+template<typename> struct __is_scalar {
+ enum { __value = 0 };
+};
+
+template<bool, typename> struct __enable_if {};
+template<typename T> struct __enable_if<true, T> { typedef T __type; };
+template<typename T>
+
+// CHECK: define linkonce_odr void @_ZN6PR57968__fill_aIiEENS_11__enable_ifIXntsrNS_11__is_scalarIT_EE7__valueEvE6__typeEv
+typename __enable_if<!__is_scalar<T>::__value, void>::__type __fill_a() { };
+
+void f() { __fill_a<int>(); }
+}
+
namespace Expressions {
// Unary operators.
@@ -254,5 +270,42 @@ template void f4<1>(int (*)[4]);
// CHECK: define void @_ZN11Expressions2f4ILb1EEEvPAquT_Li1ELi2E_i
template <bool b> void f4(int (*)[b ? 1 : 2]) { };
template void f4<true>(int (*)[1]);
+}
+
+struct Ops {
+ Ops& operator+(const Ops&);
+ Ops& operator-(const Ops&);
+ Ops& operator&(const Ops&);
+ Ops& operator*(const Ops&);
+
+ void *v;
+};
+// CHECK: define %struct.Ops* @_ZN3OpsplERKS_
+Ops& Ops::operator+(const Ops&) { return *this; }
+// CHECK: define %struct.Ops* @_ZN3OpsmiERKS_
+Ops& Ops::operator-(const Ops&) { return *this; }
+// CHECK: define %struct.Ops* @_ZN3OpsanERKS_
+Ops& Ops::operator&(const Ops&) { return *this; }
+// CHECK: define %struct.Ops* @_ZN3OpsmlERKS_
+Ops& Ops::operator*(const Ops&) { return *this; }
+
+// PR5861
+namespace PR5861 {
+template<bool> class P;
+template<> class P<true> {};
+
+template<template <bool> class, bool>
+struct Policy { };
+
+template<typename T, typename = Policy<P, true> > class Alloc
+{
+ T *allocate(int, const void*) { return 0; }
+};
+
+// CHECK: define i8* @_ZN6PR58615AllocIcNS_6PolicyINS_1PELb1EEEE8allocateEiPKv
+template class Alloc<char>;
}
+
+// CHECK: define void @_Z1fU13block_pointerFiiiE
+void f(int (^)(int, int)) { } \ No newline at end of file
diff --git a/test/CodeGenCXX/member-call-parens.cpp b/test/CodeGenCXX/member-call-parens.cpp
index 0b808e044459..2054137fe941 100644
--- a/test/CodeGenCXX/member-call-parens.cpp
+++ b/test/CodeGenCXX/member-call-parens.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -verify %s
struct A { int a(); };
typedef int B;
diff --git a/test/CodeGenCXX/member-expressions.cpp b/test/CodeGenCXX/member-expressions.cpp
index a38d5f9eaa2c..720a9a70d07b 100644
--- a/test/CodeGenCXX/member-expressions.cpp
+++ b/test/CodeGenCXX/member-expressions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
// PR5392
namespace PR5392 {
diff --git a/test/CodeGenCXX/member-function-pointers.cpp b/test/CodeGenCXX/member-function-pointers.cpp
index 491ca5345afa..149b5603ad7c 100644
--- a/test/CodeGenCXX/member-function-pointers.cpp
+++ b/test/CodeGenCXX/member-function-pointers.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin9 | FileCheck %s
struct A { int a; void f(); virtual void vf(); };
struct B { int b; virtual void g(); };
diff --git a/test/CodeGenCXX/member-functions.cpp b/test/CodeGenCXX/member-functions.cpp
index 0dfaedff931c..087e62c5bb37 100644
--- a/test/CodeGenCXX/member-functions.cpp
+++ b/test/CodeGenCXX/member-functions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -triple x86_64-apple-darwin9 -o %t
+// RUN: %clang_cc1 -emit-llvm %s -triple x86_64-apple-darwin9 -o %t
struct C {
void f();
void g(int, ...);
@@ -58,6 +58,6 @@ struct T {
void test3() {
T t1, t2;
- // RUN: grep "call void @_ZN1TpsERKS_" %t
+ // RUN: grep "call i64 @_ZN1TplERKS_" %t
T result = t1 + t2;
}
diff --git a/test/CodeGenCXX/member-init-struct.cpp b/test/CodeGenCXX/member-init-struct.cpp
index 9c0c3919794e..688d92d74b8e 100644
--- a/test/CodeGenCXX/member-init-struct.cpp
+++ b/test/CodeGenCXX/member-init-struct.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm-only -verify
+// RUN: %clang_cc1 %s -emit-llvm-only -verify
struct A {int a;};
struct B {float a;};
diff --git a/test/CodeGenCXX/member-init-union.cpp b/test/CodeGenCXX/member-init-union.cpp
index 334d5fd1f1c4..2c50e18b6ffa 100644
--- a/test/CodeGenCXX/member-init-union.cpp
+++ b/test/CodeGenCXX/member-init-union.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm-only -verify
+// RUN: %clang_cc1 %s -emit-llvm-only -verify
union x {
int a;
diff --git a/test/CodeGenCXX/member-pointer-cast.cpp b/test/CodeGenCXX/member-pointer-cast.cpp
index 794996881e2f..4937b037de53 100644
--- a/test/CodeGenCXX/member-pointer-cast.cpp
+++ b/test/CodeGenCXX/member-pointer-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin9 | FileCheck %s
struct A { int a; };
struct B { int b; };
diff --git a/test/CodeGenCXX/member-pointer-type-convert.cpp b/test/CodeGenCXX/member-pointer-type-convert.cpp
index 290daf2b4f12..16c14692f66d 100644
--- a/test/CodeGenCXX/member-pointer-type-convert.cpp
+++ b/test/CodeGenCXX/member-pointer-type-convert.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
struct A;
typedef int A::*param_t;
diff --git a/test/CodeGenCXX/member-pointers-zero-init.cpp b/test/CodeGenCXX/member-pointers-zero-init.cpp
index caf31bd0621a..18a2ead1ede5 100644
--- a/test/CodeGenCXX/member-pointers-zero-init.cpp
+++ b/test/CodeGenCXX/member-pointers-zero-init.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9
+// RUN: %clang_cc1 -emit-llvm %s -o %t -triple=x86_64-apple-darwin9
struct A {
int i;
diff --git a/test/CodeGenCXX/member-templates.cpp b/test/CodeGenCXX/member-templates.cpp
index c8494c42cef9..355ba20e171f 100644
--- a/test/CodeGenCXX/member-templates.cpp
+++ b/test/CodeGenCXX/member-templates.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// CHECK: ; ModuleID
struct A {
diff --git a/test/CodeGenCXX/namespace-aliases.cpp b/test/CodeGenCXX/namespace-aliases.cpp
index 5baea8791ef9..74b8ebab4a54 100644
--- a/test/CodeGenCXX/namespace-aliases.cpp
+++ b/test/CodeGenCXX/namespace-aliases.cpp
@@ -1,3 +1,3 @@
-// RUN: clang-cc -emit-llvm-only %s
+// RUN: %clang_cc1 -emit-llvm-only %s
namespace A { }
namespace B = A;
diff --git a/test/CodeGenCXX/nested-base-member-access.cpp b/test/CodeGenCXX/nested-base-member-access.cpp
index 308f952c6dc2..f1c7dd9a867e 100644
--- a/test/CodeGenCXX/nested-base-member-access.cpp
+++ b/test/CodeGenCXX/nested-base-member-access.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o %t
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/new-operator-phi.cpp b/test/CodeGenCXX/new-operator-phi.cpp
index a5eed28ccf95..38467ad31f9b 100644
--- a/test/CodeGenCXX/new-operator-phi.cpp
+++ b/test/CodeGenCXX/new-operator-phi.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -verify %s
// PR5454
#include <stddef.h>
diff --git a/test/CodeGenCXX/new-with-default-arg.cpp b/test/CodeGenCXX/new-with-default-arg.cpp
index b73b7f0865ec..248cc9e0b930 100644
--- a/test/CodeGenCXX/new-with-default-arg.cpp
+++ b/test/CodeGenCXX/new-with-default-arg.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-llvm -o - %s
// pr5547
struct A {
diff --git a/test/CodeGenCXX/new.cpp b/test/CodeGenCXX/new.cpp
index 13f26b253cd9..6ea12eb5f6ba 100644
--- a/test/CodeGenCXX/new.cpp
+++ b/test/CodeGenCXX/new.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-unknown-unknown %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -emit-llvm -o - | FileCheck %s
#include <stddef.h>
void t1() {
@@ -90,3 +90,9 @@ A* t10() {
return new(1, 2, 3.45, 100) A;
}
+struct B { };
+void t11() {
+ // CHECK: call noalias i8* @_Znwm
+ // CHECK: call void @llvm.memset.i64(
+ B* b = new B();
+}
diff --git a/test/CodeGenCXX/nullptr.cpp b/test/CodeGenCXX/nullptr.cpp
index 7bc52ad5210a..31bd47522ed4 100644
--- a/test/CodeGenCXX/nullptr.cpp
+++ b/test/CodeGenCXX/nullptr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -std=c++0x %s -emit-llvm -o %t
+// RUN: %clang_cc1 -std=c++0x %s -emit-llvm -o %t
int* a = nullptr;
diff --git a/test/CodeGenCXX/operator-new.cpp b/test/CodeGenCXX/operator-new.cpp
new file mode 100644
index 000000000000..da64fc1b2d4e
--- /dev/null
+++ b/test/CodeGenCXX/operator-new.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o %t-1.ll %s
+// RUN: FileCheck -check-prefix SANE --input-file=%t-1.ll %s
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -fno-assume-sane-operator-new -o %t-2.ll %s
+// RUN: FileCheck -check-prefix SANENOT --input-file=%t-2.ll %s
+
+
+class teste {
+ int A;
+ teste() : A(2) {}
+};
+
+void f1() {
+ // CHECK-SANE: declare noalias i8* @_Znwj(
+ // CHECK-SANENOT: declare i8* @_Znwj(
+ new teste();
+}
diff --git a/test/CodeGenCXX/overload-binop-implicitconvert.cpp b/test/CodeGenCXX/overload-binop-implicitconvert.cpp
index f17a4585e69f..0eb7a0609612 100644
--- a/test/CodeGenCXX/overload-binop-implicitconvert.cpp
+++ b/test/CodeGenCXX/overload-binop-implicitconvert.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm-only
+// RUN: %clang_cc1 %s -emit-llvm-only
class T
{};
diff --git a/test/CodeGenCXX/predefined-expr-sizeof.cpp b/test/CodeGenCXX/predefined-expr-sizeof.cpp
index e318fbec18ae..f74cfb38fd13 100644
--- a/test/CodeGenCXX/predefined-expr-sizeof.cpp
+++ b/test/CodeGenCXX/predefined-expr-sizeof.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// CHECK: store i32 49, i32* %size
// CHECK: store i32 52, i32* %size
diff --git a/test/CodeGenCXX/predefined-expr.cpp b/test/CodeGenCXX/predefined-expr.cpp
index 45b4e9f5402f..f5e5ca95282d 100644
--- a/test/CodeGenCXX/predefined-expr.cpp
+++ b/test/CodeGenCXX/predefined-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// CHECK: private constant [15 x i8] c"externFunction\00"
// CHECK: private constant [26 x i8] c"void NS::externFunction()\00"
@@ -11,6 +11,15 @@
// CHECK: private constant [45 x i8] c"void NS::Base::functionTemplate1(NS::Base *)\00"
// CHECK: private constant [38 x i8] c"void NS::Base::functionTemplate1(int)\00"
+// CHECK: private constant [23 x i8] c"anonymousUnionFunction\00"
+// CHECK: private constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous union>::anonymousUnionFunction()\00"
+
+// CHECK: private constant [24 x i8] c"anonymousStructFunction\00"
+// CHECK: private constant [85 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous struct>::anonymousStructFunction()\00"
+
+// CHECK: private constant [23 x i8] c"anonymousClassFunction\00"
+// CHECK: private constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous class>::anonymousClassFunction()\00"
+
// CHECK: private constant [12 x i8] c"~Destructor\00"
// CHECK: private constant [30 x i8] c"NS::Destructor::~Destructor()\00"
@@ -22,6 +31,15 @@
// CHECK: private constant [16 x i8] c"virtualFunction\00"
// CHECK: private constant [44 x i8] c"virtual void NS::Derived::virtualFunction()\00"
+// CHECK: private constant [22 x i8] c"constVolatileFunction\00"
+// CHECK: private constant [54 x i8] c"void NS::Base::constVolatileFunction() const volatile\00"
+
+// CHECK: private constant [17 x i8] c"volatileFunction\00"
+// CHECK: private constant [43 x i8] c"void NS::Base::volatileFunction() volatile\00"
+
+// CHECK: private constant [14 x i8] c"constFunction\00"
+// CHECK: private constant [37 x i8] c"void NS::Base::constFunction() const\00"
+
// CHECK: private constant [26 x i8] c"functionReturingTemplate2\00"
// CHECK: private constant [64 x i8] c"ClassTemplate<NS::Base *> NS::Base::functionReturingTemplate2()\00"
@@ -48,11 +66,42 @@
// CHECK: private constant [15 x i8] c"inlineFunction\00"
// CHECK: private constant [32 x i8] c"void NS::Base::inlineFunction()\00"
-// CHECK: private constant [11 x i8] c"staticFunc\00"
-// CHECK: private constant [28 x i8] c"void NS::Base::staticFunc()\00"
+// CHECK: private constant [15 x i8] c"staticFunction\00"
+// CHECK: private constant [39 x i8] c"static void NS::Base::staticFunction()\00"
+
+// CHECK: private constant [26 x i8] c"topLevelNamespaceFunction\00"
+// CHECK: private constant [59 x i8] c"void ClassInTopLevelNamespace::topLevelNamespaceFunction()\00"
+
+// CHECK: private constant [27 x i8] c"anonymousNamespaceFunction\00"
+// CHECK: private constant [84 x i8] c"void <anonymous namespace>::ClassInAnonymousNamespace::anonymousNamespaceFunction()\00"
+
+// CHECK: private constant [19 x i8] c"localClassFunction\00"
+// CHECK: private constant [59 x i8] c"void NS::localClass(int)::LocalClass::localClassFunction()\00"
int printf(const char * _Format, ...);
+class ClassInTopLevelNamespace {
+public:
+ void topLevelNamespaceFunction() {
+ printf("__func__ %s\n", __func__);
+ printf("__FUNCTION__ %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
+ }
+};
+
+namespace {
+
+ class ClassInAnonymousNamespace {
+ public:
+ void anonymousNamespaceFunction() {
+ printf("__func__ %s\n", __func__);
+ printf("__FUNCTION__ %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
+ }
+ };
+
+} // end anonymous namespace
+
namespace NS {
template<typename T>
@@ -67,7 +116,7 @@ public:
class Base {
public:
- static void staticFunc() {
+ static void staticFunction() {
printf("__func__ %s\n", __func__);
printf("__FUNCTION__ %s\n", __FUNCTION__);
printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
@@ -136,6 +185,24 @@ public:
printf("__FUNCTION__ %s\n", __FUNCTION__);
printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
}
+
+ void constFunction() const {
+ printf("__func__ %s\n", __func__);
+ printf("__FUNCTION__ %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
+ }
+
+ void volatileFunction() volatile {
+ printf("__func__ %s\n", __func__);
+ printf("__FUNCTION__ %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
+ }
+
+ void constVolatileFunction() const volatile {
+ printf("__func__ %s\n", __func__);
+ printf("__FUNCTION__ %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
+ }
};
class Derived : public Base {
@@ -167,7 +234,6 @@ public:
printf("__FUNCTION__ %s\n", __FUNCTION__);
printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
}
-
};
class Destructor {
@@ -179,17 +245,64 @@ public:
}
};
+class ContainerForAnonymousRecords {
+public:
+ class {
+ public:
+ void anonymousClassFunction() {
+ printf("__func__ %s\n", __func__);
+ printf("__FUNCTION__ %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
+ }
+ } anonymousClass;
+
+ struct {
+ void anonymousStructFunction() {
+ printf("__func__ %s\n", __func__);
+ printf("__FUNCTION__ %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
+ }
+ } anonymousStruct;
+
+ union {
+ void anonymousUnionFunction() {
+ printf("__func__ %s\n", __func__);
+ printf("__FUNCTION__ %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
+ }
+ } anonymousUnion;
+};
+
+void localClass(int) {
+ class LocalClass {
+ public:
+ void localClassFunction() {
+ printf("__func__ %s\n", __func__);
+ printf("__FUNCTION__ %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
+ }
+ };
+ LocalClass lc;
+ lc.localClassFunction();
+}
+
extern void externFunction() {
printf("__func__ %s\n", __func__);
printf("__FUNCTION__ %s\n", __FUNCTION__);
printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
}
-}
+} // end NS namespace
int main() {
- NS::Base::staticFunc();
+ ClassInAnonymousNamespace anonymousNamespace;
+ anonymousNamespace.anonymousNamespaceFunction();
+
+ ClassInTopLevelNamespace topLevelNamespace;
+ topLevelNamespace.topLevelNamespaceFunction();
+ NS::Base::staticFunction();
+
NS::Base b;
b.inlineFunction();
b.virtualFunction();
@@ -203,7 +316,10 @@ int main() {
b.functionReturingTemplate2();
b.functionTemplate1<int>(0);
b.functionTemplate1<NS::Base *>(0);
-
+ b.constFunction();
+ b.volatileFunction();
+ b.constVolatileFunction();
+
NS::Derived d;
d.virtualFunction();
@@ -219,8 +335,15 @@ int main() {
{
NS::Destructor destructor;
}
-
+
+ NS::ContainerForAnonymousRecords anonymous;
+ anonymous.anonymousClass.anonymousClassFunction();
+ anonymous.anonymousStruct.anonymousStructFunction();
+ anonymous.anonymousUnion.anonymousUnionFunction();
+
+ NS::localClass(0);
+
NS::externFunction();
-
+
return 0;
}
diff --git a/test/CodeGenCXX/ptr-to-datamember.cpp b/test/CodeGenCXX/ptr-to-datamember.cpp
index ffaef32a13c9..a6f523e2d7dd 100644
--- a/test/CodeGenCXX/ptr-to-datamember.cpp
+++ b/test/CodeGenCXX/ptr-to-datamember.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-llvm -o - %s
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/ptr-to-member-function.cpp b/test/CodeGenCXX/ptr-to-member-function.cpp
index 52190b937377..e3912fe9081c 100644
--- a/test/CodeGenCXX/ptr-to-member-function.cpp
+++ b/test/CodeGenCXX/ptr-to-member-function.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
// 13.3.3.2 Ranking implicit conversion sequences
@@ -63,8 +63,8 @@ int main()
B1 c = B1(2);
}
-// CHECK-LP64: call __ZN1XcvM1BFvvEEv
-// CHECK-LP64: call __Z1gM1CFvvE
+// CHECK-LP64: callq __ZN1XcvM1BFvvEEv
+// CHECK-LP64: callq __Z1gM1CFvvE
// CHECK-LP32: call L__ZN1XcvM1BFvvEEv
// CHECK-LP32: call __Z1gM1CFvvE
diff --git a/test/CodeGenCXX/reference-bind-default-argument.cpp b/test/CodeGenCXX/reference-bind-default-argument.cpp
new file mode 100644
index 000000000000..acce962b1953
--- /dev/null
+++ b/test/CodeGenCXX/reference-bind-default-argument.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -emit-llvm-only -verify
+
+struct A {};
+struct B : A {};
+void a(const A& x = B());
+void b() { a(); }
diff --git a/test/CodeGenCXX/reference-field.cpp b/test/CodeGenCXX/reference-field.cpp
index 88d4c1f37e6e..031202925952 100644
--- a/test/CodeGenCXX/reference-field.cpp
+++ b/test/CodeGenCXX/reference-field.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s -O2 | grep "@_Z1bv"
+// RUN: %clang_cc1 -emit-llvm -o - %s -O2 | grep "@_Z1bv"
// Make sure the call to b() doesn't get optimized out.
extern struct x {char& x,y;}y;
diff --git a/test/CodeGenCXX/reference-init.cpp b/test/CodeGenCXX/reference-init.cpp
index 9baad94a96e7..1bfb28a66a03 100644
--- a/test/CodeGenCXX/reference-init.cpp
+++ b/test/CodeGenCXX/reference-init.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -verify %s
struct XPTParamDescriptor {};
struct nsXPTParamInfo {
diff --git a/test/CodeGenCXX/references.cpp b/test/CodeGenCXX/references.cpp
index 74dc0ea6d7b0..6bec8bd8c384 100644
--- a/test/CodeGenCXX/references.cpp
+++ b/test/CodeGenCXX/references.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -verify -emit-llvm -o - %s | FileCheck %s
void t1() {
extern int& a;
int b = a;
diff --git a/test/CodeGenCXX/reinterpret-cast.cpp b/test/CodeGenCXX/reinterpret-cast.cpp
index 58a980d5288c..ff5679248c25 100644
--- a/test/CodeGenCXX/reinterpret-cast.cpp
+++ b/test/CodeGenCXX/reinterpret-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s -std=c++0x
+// RUN: %clang_cc1 -emit-llvm -o - %s -std=c++0x
void *f1(unsigned long l) {
return reinterpret_cast<void *>(l);
}
@@ -14,4 +14,4 @@ unsigned long f3(void *p) {
void f4(int*&);
void f5(void*& u) {
f4(reinterpret_cast<int*&>(u));
-} \ No newline at end of file
+}
diff --git a/test/CodeGenCXX/rtti-layout.cpp b/test/CodeGenCXX/rtti-layout.cpp
new file mode 100644
index 000000000000..1ad87fbc7ef7
--- /dev/null
+++ b/test/CodeGenCXX/rtti-layout.cpp
@@ -0,0 +1,191 @@
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s
+#include <typeinfo>
+
+// vtables.
+extern "C" {
+ const void *_ZTVN10__cxxabiv123__fundamental_type_infoE;
+ const void *_ZTVN10__cxxabiv117__class_type_infoE;
+ const void *_ZTVN10__cxxabiv120__si_class_type_infoE;
+ const void *_ZTVN10__cxxabiv121__vmi_class_type_infoE;
+ const void *_ZTVN10__cxxabiv119__pointer_type_infoE;
+ const void *_ZTVN10__cxxabiv129__pointer_to_member_type_infoE;
+};
+#define fundamental_type_info_vtable _ZTVN10__cxxabiv123__fundamental_type_infoE
+#define class_type_info_vtable _ZTVN10__cxxabiv117__class_type_infoE
+#define si_class_type_info_vtable _ZTVN10__cxxabiv120__si_class_type_infoE
+#define vmi_class_type_info_vtable _ZTVN10__cxxabiv121__vmi_class_type_infoE
+#define pointer_type_info_vtable _ZTVN10__cxxabiv119__pointer_type_infoE
+#define pointer_to_member_type_info_vtable _ZTVN10__cxxabiv129__pointer_to_member_type_infoE
+
+class __pbase_type_info : public std::type_info {
+public:
+ unsigned int __flags;
+ const std::type_info *__pointee;
+
+ enum __masks {
+ __const_mask = 0x1,
+ __volatile_mask = 0x2,
+ __restrict_mask = 0x4,
+ __incomplete_mask = 0x8,
+ __incomplete_class_mask = 0x10
+ };
+};
+
+class __class_type_info : public std::type_info { };
+
+class __si_class_type_info : public __class_type_info {
+public:
+ const __class_type_info *__base_type;
+};
+
+struct __base_class_type_info {
+public:
+ const __class_type_info *__base_type;
+ long __offset_flags;
+
+ enum __offset_flags_masks {
+ __virtual_mask = 0x1,
+ __public_mask = 0x2,
+ __offset_shift = 8
+ };
+};
+
+class __vmi_class_type_info : public __class_type_info {
+public:
+ unsigned int __flags;
+ unsigned int __base_count;
+ __base_class_type_info __base_info[1];
+
+ enum __flags_masks {
+ __non_diamond_repeat_mask = 0x1,
+ __diamond_shaped_mask = 0x2
+ };
+};
+
+template<typename T> const T& to(const std::type_info &info) {
+return static_cast<const T&>(info);
+}
+struct Incomplete;
+
+struct A { int a; };
+struct Empty { };
+
+struct SI1 : A { };
+struct SI2 : Empty { };
+struct SI3 : Empty { virtual void f() { } };
+
+struct VMI1 : private A { };
+struct VMI2 : virtual A { };
+struct VMI3 : A { virtual void f() { } };
+struct VMI4 : A, Empty { };
+
+struct VMIBase1 { int a; };
+struct VMIBase2 : VMIBase1 { int a; };
+struct VMI5 : VMIBase1, VMIBase2 { int a; };
+
+struct VMIBase3 : virtual VMIBase1 { int a; };
+struct VMI6 : virtual VMIBase1, VMIBase3 { int a; };
+
+struct VMI7 : VMIBase1, VMI5, private VMI6 { };
+
+#define CHECK(x) if (!(x)) return __LINE__
+#define CHECK_VTABLE(type, vtable) CHECK(&vtable##_type_info_vtable + 2 == (((void **)&(typeid(type)))[0]))
+#define CHECK_BASE_INFO_TYPE(type, index, base) CHECK(to<__vmi_class_type_info>(typeid(type)).__base_info[(index)].__base_type == &typeid(base))
+#define CHECK_BASE_INFO_OFFSET_FLAGS(type, index, offset, flags) CHECK(to<__vmi_class_type_info>(typeid(type)).__base_info[(index)].__offset_flags == (((offset) << 8) | (flags)))
+
+// CHECK: define i32 @_Z1fv()
+int f() {
+ // Vectors should be treated as fundamental types.
+ typedef short __v4hi __attribute__ ((__vector_size__ (8)));
+ CHECK_VTABLE(__v4hi, fundamental);
+
+ // A does not have any bases.
+ CHECK_VTABLE(A, class);
+
+ // SI1 has a single public base.
+ CHECK_VTABLE(SI1, si_class);
+ CHECK(to<__si_class_type_info>(typeid(SI1)).__base_type == &typeid(A));
+
+ // SI2 has a single public empty base.
+ CHECK_VTABLE(SI2, si_class);
+ CHECK(to<__si_class_type_info>(typeid(SI2)).__base_type == &typeid(Empty));
+
+ // SI3 has a single public empty base. SI3 is dynamic whereas Empty is not, but since Empty is
+ // an empty class, it will still be at offset zero.
+ CHECK_VTABLE(SI3, si_class);
+ CHECK(to<__si_class_type_info>(typeid(SI3)).__base_type == &typeid(Empty));
+
+ // VMI1 has a single base, but it is private.
+ CHECK_VTABLE(VMI1, vmi_class);
+
+ // VMI2 has a single base, but it is virtual.
+ CHECK_VTABLE(VMI2, vmi_class);
+
+ // VMI3 has a single base, but VMI3 is dynamic whereas A is not, and A is not empty.
+ CHECK_VTABLE(VMI3, vmi_class);
+
+ // VMI4 has two bases.
+ CHECK_VTABLE(VMI4, vmi_class);
+
+ // VMI5 has non-diamond shaped inheritance.
+ CHECK_VTABLE(VMI5, vmi_class);
+ CHECK(to<__vmi_class_type_info>(typeid(VMI5)).__flags == __vmi_class_type_info::__non_diamond_repeat_mask);
+ CHECK(to<__vmi_class_type_info>(typeid(VMI5)).__base_count == 2);
+ CHECK_BASE_INFO_TYPE(VMI5, 0, VMIBase1);
+ CHECK_BASE_INFO_OFFSET_FLAGS(VMI5, 0, 0, __base_class_type_info::__public_mask);
+ CHECK_BASE_INFO_TYPE(VMI5, 1, VMIBase2);
+ CHECK_BASE_INFO_OFFSET_FLAGS(VMI5, 1, 4, __base_class_type_info::__public_mask);
+
+ // VMI6 has diamond shaped inheritance.
+ CHECK_VTABLE(VMI6, vmi_class);
+ CHECK(to<__vmi_class_type_info>(typeid(VMI6)).__flags == __vmi_class_type_info::__diamond_shaped_mask);
+ CHECK(to<__vmi_class_type_info>(typeid(VMI6)).__base_count == 2);
+ CHECK_BASE_INFO_TYPE(VMI6, 0, VMIBase1);
+ CHECK_BASE_INFO_OFFSET_FLAGS(VMI6, 0, -24, __base_class_type_info::__public_mask | __base_class_type_info::__virtual_mask);
+ CHECK_BASE_INFO_TYPE(VMI6, 1, VMIBase3);
+ CHECK_BASE_INFO_OFFSET_FLAGS(VMI6, 1, 0, __base_class_type_info::__public_mask);
+
+ // VMI7 has both non-diamond and diamond shaped inheritance.
+ CHECK_VTABLE(VMI7, vmi_class);
+ CHECK(to<__vmi_class_type_info>(typeid(VMI7)).__flags == (__vmi_class_type_info::__non_diamond_repeat_mask | __vmi_class_type_info::__diamond_shaped_mask));
+ CHECK(to<__vmi_class_type_info>(typeid(VMI7)).__base_count == 3);
+ CHECK_BASE_INFO_TYPE(VMI7, 0, VMIBase1);
+ CHECK_BASE_INFO_OFFSET_FLAGS(VMI7, 0, 16, __base_class_type_info::__public_mask);
+ CHECK_BASE_INFO_TYPE(VMI7, 1, VMI5);
+ CHECK_BASE_INFO_OFFSET_FLAGS(VMI7, 1, 20, __base_class_type_info::__public_mask);
+ CHECK_BASE_INFO_TYPE(VMI7, 2, VMI6);
+ CHECK_BASE_INFO_OFFSET_FLAGS(VMI7, 2, 0, 0);
+
+ // Pointers to incomplete classes.
+ CHECK_VTABLE(Incomplete *, pointer);
+ CHECK(to<__pbase_type_info>(typeid(Incomplete *)).__flags == __pbase_type_info::__incomplete_mask);
+ CHECK(to<__pbase_type_info>(typeid(Incomplete **)).__flags == __pbase_type_info::__incomplete_mask);
+ CHECK(to<__pbase_type_info>(typeid(Incomplete ***)).__flags == __pbase_type_info::__incomplete_mask);
+
+ // Member pointers.
+ CHECK_VTABLE(int Incomplete::*, pointer_to_member);
+ CHECK(to<__pbase_type_info>(typeid(int Incomplete::*)).__flags == __pbase_type_info::__incomplete_class_mask);
+ CHECK(to<__pbase_type_info>(typeid(Incomplete Incomplete::*)).__flags == (__pbase_type_info::__incomplete_class_mask | __pbase_type_info::__incomplete_mask));
+ CHECK(to<__pbase_type_info>(typeid(Incomplete A::*)).__flags == (__pbase_type_info::__incomplete_mask));
+
+ // Success!
+ // CHECK: ret i32 0
+ return 0;
+}
+
+#ifdef HARNESS
+extern "C" void printf(const char *, ...);
+
+int main() {
+ int result = f();
+
+ if (result == 0)
+ printf("success!\n");
+ else
+ printf("test on line %d failed!\n", result);
+
+ return result;
+}
+#endif
+
+
diff --git a/test/CodeGenCXX/rtti-linkage.cpp b/test/CodeGenCXX/rtti-linkage.cpp
index a2a1cdd48c10..799c1d41c726 100644
--- a/test/CodeGenCXX/rtti-linkage.cpp
+++ b/test/CodeGenCXX/rtti-linkage.cpp
@@ -1,9 +1,47 @@
-// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+#include <typeinfo>
// CHECK: _ZTS1B = constant
// CHECK: _ZTS1A = weak_odr constant
// CHECK: _ZTI1A = weak_odr constant
// CHECK: _ZTI1B = constant
+// CHECK: _ZTSP1C = internal constant
+// CHECK: _ZTS1C = internal constant
+// CHECK: _ZTI1C = internal constant
+// CHECK: _ZTIP1C = internal constant
+// CHECK: _ZTSPP1C = internal constant
+// CHECK: _ZTIPP1C = internal constant
+// CHECK: _ZTSM1Ci = internal constant
+// CHECK: _ZTIM1Ci = internal constant
+// CHECK: _ZTSPM1Ci = internal constant
+// CHECK: _ZTIPM1Ci = internal constant
+// CHECK: _ZTSM1CS_ = internal constant
+// CHECK: _ZTIM1CS_ = internal constant
+// CHECK: _ZTSM1CPS_ = internal constant
+// CHECK: _ZTIM1CPS_ = internal constant
+// CHECK: _ZTSM1A1C = internal constant
+// CHECK: _ZTIM1A1C = internal constant
+// CHECK: _ZTSM1AP1C = internal constant
+// CHECK: _ZTIM1AP1C = internal constant
+
+// CHECK: _ZTS1F = weak_odr constant
+
+// CHECK: _ZTSN12_GLOBAL__N_11DE = internal constant
+// CHECK: _ZTIN12_GLOBAL__N_11DE = internal constant
+// CHECK: _ZTSPN12_GLOBAL__N_11DE = internal constant
+// CHECK: _ZTIPN12_GLOBAL__N_11DE = internal constant
+// CHECK: _ZTSFN12_GLOBAL__N_11DEvE = internal constant
+// CHECK: _ZTIFN12_GLOBAL__N_11DEvE = internal constant
+// CHECK: _ZTSFvN12_GLOBAL__N_11DEE = internal constant
+// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal constant
+
+// CHECK: _ZTSPFvvE = weak_odr constant
+// CHECK: _ZTSFvvE = weak_odr constant
+// CHECK: _ZTIFvvE = weak_odr
+// CHECK: _ZTIPFvvE = weak_odr constant
+
+// CHECK: _ZTSN12_GLOBAL__N_11EE = internal constant
+// CHECK: _ZTIN12_GLOBAL__N_11EE = internal constant
// A has no key function, so its RTTI data should be weak_odr.
struct A { };
@@ -14,3 +52,52 @@ struct B : A {
virtual void f();
};
void B::f() { }
+
+// C is an incomplete class type, so any direct or indirect pointer types should have
+// internal linkage, as should the type info for C itself.
+struct C;
+
+void t1() {
+ (void)typeid(C*);
+ (void)typeid(C**);
+ (void)typeid(int C::*);
+ (void)typeid(int C::**);
+ (void)typeid(C C::*);
+ (void)typeid(C *C::*);
+ (void)typeid(C A::*);
+ (void)typeid(C* A::*);
+}
+
+namespace {
+ // D is inside an anonymous namespace, so all type information related to D should have
+ // internal linkage.
+ struct D { };
+
+ // E is also inside an anonymous namespace.
+ enum E { };
+
+};
+
+// F has a key function defined in the translation unit, but it is inline so the RTTI
+// data should be emitted with weak_odr linkage.
+struct F {
+ virtual void f();
+};
+
+inline void F::f() { }
+const D getD();
+
+const std::type_info &t2() {
+ (void)typeid(const D);
+ (void)typeid(D *);
+ (void)typeid(D (*)());
+ (void)typeid(void (*)(D));
+ // The exception specification is not part of the RTTI descriptor, so it should not have
+ // internal linkage.
+ (void)typeid(void (*)() throw (D));
+
+ (void)typeid(E);
+
+ // CHECK: _ZTIN12_GLOBAL__N_11DE to
+ return typeid(getD());
+}
diff --git a/test/CodeGenCXX/rtti.cpp b/test/CodeGenCXX/rtti.cpp
deleted file mode 100644
index 7ba4d56b6633..000000000000
--- a/test/CodeGenCXX/rtti.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-// RUN: clang-cc -I%S -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t.s
-// RUN: FileCheck --input-file=%t.s %s
-
-// RUN: clang-cc -I%S -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll
-// RUN: FileCheck -check-prefix LL --input-file=%t.ll %s
-// XFAIL: *
-
-#include <typeinfo>
-
-class test1_B1 {
- virtual void foo() { }
-};
-class test1_B2 : public test1_B1 {
- virtual void foo() { }
-};
-class test1_B3 : public test1_B2, public test1_B1 {
- virtual void foo() { }
-};
-class test1_B4 : virtual public test1_B3 {
- virtual void foo() { }
-};
-class test1_B5 : virtual test1_B3, test1_B4 {
- virtual void foo() { }
-};
-class test1_B6 {
- virtual void foo() { }
-};
-class test1_B7 : public test1_B6, public test1_B5 {
- virtual void foo() { }
-};
-class test1_D : public test1_B7 {
- virtual void foo() { }
-} d1;
-
-// CHECK:__ZTI7test1_D:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv120__si_class_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTS7test1_D
-// CHECK-NEXT: .quad __ZTI8test1_B7
-
-// CHECK: __ZTSPVi:
-// CHECK-NEXT: .asciz "PVi"
-
-// CHECK: __ZTIPVi:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv119__pointer_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTSPVi
-// CHECK-NEXT: .long 2
-// CHECK-NEXT: .space 4
-// CHECK-NEXT: .quad __ZTIi
-
-// CHECK: .globl __ZTS7test3_A
-// CHECK-NEXT: .weak_definition __ZTS7test3_A
-// CHECK: __ZTS7test3_A:
-// CHECK-NEXT: .asciz "7test3_A"
-
-// CHECK: __ZTIM7test3_Ai:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv129__pointer_to_member_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTSM7test3_Ai
-// CHECK-NEXT: .space 4
-// CHECK-NEXT: .space 4
-// CHECK-NEXT: .quad __ZTIi
-// CHECK-NEXT: .quad __ZTI7test3_A
-
-// CHECK: __ZTIM7test3_Ii:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv129__pointer_to_member_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTSM7test3_Ii
-// CHECK-NEXT: .long 16
-// CHECK-NEXT: .space 4
-// CHECK-NEXT: .quad __ZTIi
-// CHECK-NEXT: .quad __ZTI7test3_I
-
-// CHECK: .private_extern __ZTIFvvE
-// CHECK: .globl __ZTIFvvE
-// CHECK: .weak_definition __ZTIFvvE
-// CHECK: __ZTIFvvE:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv120__function_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTSFvvE
-
-// CHECK: __ZTIM7test3_AFvvE:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv129__pointer_to_member_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTSM7test3_AFvvE
-// CHECK-NEXT: .space 4
-// CHECK-NEXT: .space 4
-// CHECK-NEXT: .quad __ZTIFvvE
-// CHECK-NEXT: .quad __ZTI7test3_A
-
-// CHECK:__ZTI8test1_B7:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv121__vmi_class_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTS8test1_B7
-// CHECK-NEXT: .long 3
-// CHECK-NEXT: .long 2
-// CHECK-NEXT: .quad __ZTI8test1_B6
-// CHECK-NEXT: .quad 2
-// CHECK-NEXT: .quad __ZTI8test1_B5
-// CHECK-NEXT: .quad 2050
-
-// CHECK:__ZTI8test1_B5:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv121__vmi_class_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTS8test1_B5
-// CHECK-NEXT: .long 3
-// CHECK-NEXT: .long 2
-// CHECK-NEXT: .quad __ZTI8test1_B3
-// CHECK-NEXT: .quad 18446744073709545473
-// CHECK-NEXT: .quad __ZTI8test1_B4
-// CHECK-NEXT: .space 8
-
-// CHECK:__ZTI8test1_B4:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv121__vmi_class_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTS8test1_B4
-// CHECK-NEXT: .long 1
-// CHECK-NEXT: .long 1
-// CHECK-NEXT: .quad __ZTI8test1_B3
-// CHECK-NEXT: .quad 18446744073709545475
-
-// CHECK:__ZTI8test1_B6:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv117__class_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTS8test1_B6
-
-// CHECK:__ZTI8test1_B3:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv121__vmi_class_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTS8test1_B3
-// CHECK-NEXT: .long 1
-// CHECK-NEXT: .long 2
-// CHECK-NEXT: .quad __ZTI8test1_B2
-// CHECK-NEXT: .quad 2
-// CHECK-NEXT: .quad __ZTI8test1_B1
-// CHECK-NEXT: .quad 2050
-
-// CHECK:__ZTS8test1_B1:
-// CHECK-NEXT: .asciz "8test1_B1"
-
-// CHECK:__ZTI8test1_B1:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv117__class_type_infoE) + 16
-// CHECK-NEXT:. quad __ZTS8test1_B1
-
-// CHECK:__ZTS8test1_B2:
-// CHECK-NEXT: .asciz "8test1_B2"
-
-// CHECK:__ZTI8test1_B2:
-// CHECK-NEXT: .quad (__ZTVN10__cxxabiv120__si_class_type_infoE) + 16
-// CHECK-NEXT: .quad __ZTS8test1_B2
-// CHECK-NEXT: .quad __ZTI8test1_B1
-
-class NP { };
-void test2_1();
-void test2_2(test1_D *dp) {
- test1_D &d = *dp;
- if (typeid(d) == typeid(test1_D))
- test2_1();
- if (typeid(NP) == typeid(test1_D))
- test2_1();
- if (typeid(((*(dp)))) == typeid(test1_D))
- test2_1();
- if (typeid(int) == typeid(float))
- test2_1();
- if (typeid(int*) == typeid(const int *))
- test2_1();
-}
-
-// CHECK-LL:define void @_Z7test2_2P7test1_D(%class.test1_B7* %dp) nounwind {
-// CHECK-LL: %tmp1 = load %class.test1_B7** %d
-// CHECK-LL-NEXT: %0 = bitcast %class.test1_B7* %tmp1 to %"class.std::type_info"***
-// CHECK-LL-NEXT: %vtable = load %"class.std::type_info"*** %0
-// CHECK-LL-NEXT: %1 = getelementptr inbounds %"class.std::type_info"** %vtable, i64 -1
-// CHECK-LL-NEXT: %2 = load %"class.std::type_info"** %1
-// CHECK-LL-NEXT: %call = call zeroext i1 @_ZNKSt9type_infoeqERKS_(%"class.std::type_info"* %2, %"class.std::type_info"* bitcast (%{{[0-9]*}}* @_ZTI7test1_D to %"class.std::type_info"*))
-
-// CHECK-LL: %call2 = call zeroext i1 @_ZNKSt9type_infoeqERKS_(%"class.std::type_info"* bitcast (%{{[0-9]*}}* @_ZTI2NP to %"class.std::type_info"*), %"class.std::type_info"* bitcast (%{{[0-9]*}}* @_ZTI7test1_D to %"class.std::type_info"*))
-
-// CHECK-LL: %3 = bitcast %class.test1_B7* %tmp5 to %"class.std::type_info"***
-// CHECK-LL-NEXT: %4 = icmp ne %"class.std::type_info"*** %3, null
-// CHECK-LL-NEXT: br i1 %4, label %6, label %5
-// CHECK-LL: ; <label>:5
-// CHECK-LL-NEXT: call void @__cxa_bad_typeid()
-// CHECK-LL-NEXT: unreachable
-// CHECK-LL: ; <label>:6
-// CHECK-LL-NEXT: %vtable6 = load %"class.std::type_info"*** %3
-// CHECK-LL-NEXT: %7 = getelementptr inbounds %"class.std::type_info"** %vtable6, i64 -1
-// CHECK-LL-NEXT: %8 = load %"class.std::type_info"** %7
-// CHECK-LL-NEXT: %call7 = call zeroext i1 @_ZNKSt9type_infoeqERKS_(%"class.std::type_info"* %8, %"class.std::type_info"* bitcast (%{{[0-9]*}}* @_ZTI7test1_D to %"class.std::type_info"*))
-
-// CHECK-LL: %call10 = call zeroext i1 @_ZNKSt9type_infoeqERKS_(%"class.std::type_info"* bitcast (i8** @_ZTIi to %"class.std::type_info"*), %"class.std::type_info"* bitcast (i8** @_ZTIf to %"class.std::type_info"*))
-
-// CHECK-LL: %call13 = call zeroext i1 @_ZNKSt9type_infoeqERKS_(%"class.std::type_info"* bitcast (i8** @_ZTIPi to %"class.std::type_info"*), %"class.std::type_info"* bitcast (i8** @_ZTIPKi to %"class.std::type_info"*))
-
-class test3_A { };
-class test3_I;
-int (test3_A::*pmd);
-int (test3_I::*i_pmd);
-void (test3_A::*pmf)();
-int test3() {
- if (typeid(volatile int *) == typeid(int *))
- return 1;
- if (typeid(pmd) == typeid(i_pmd))
- return 1;
- if (typeid(pmd) == typeid(pmf))
- return 1;
- return 0;
- enum a { };
- if (typeid(int[5]) == typeid(enum a))
- return 0;
-}
-
-bool test4(std::type_info* __pointee) {
- return *__pointee == typeid (void);
-}
diff --git a/test/CodeGenCXX/static-assert.cpp b/test/CodeGenCXX/static-assert.cpp
index e103b9906257..dbb8f34d8414 100644
--- a/test/CodeGenCXX/static-assert.cpp
+++ b/test/CodeGenCXX/static-assert.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - -std=c++0x -verify
+// RUN: %clang_cc1 %s -emit-llvm -o - -std=c++0x -verify
static_assert(true, "");
diff --git a/test/CodeGenCXX/static-data-member.cpp b/test/CodeGenCXX/static-data-member.cpp
index 6e2abcc1adea..53a1d5e4c450 100644
--- a/test/CodeGenCXX/static-data-member.cpp
+++ b/test/CodeGenCXX/static-data-member.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-llvm -o - %s
struct S {
static int i;
};
diff --git a/test/CodeGenCXX/static-init-1.cpp b/test/CodeGenCXX/static-init-1.cpp
index 2c452022c525..a926c0a2d32d 100644
--- a/test/CodeGenCXX/static-init-1.cpp
+++ b/test/CodeGenCXX/static-init-1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple=x86_64-apple-darwin9 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -triple=x86_64-apple-darwin9 -emit-llvm %s -o %t
// RUN: grep "call i32 @_Z5func1i" %t | count 3
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/static-init-2.cpp b/test/CodeGenCXX/static-init-2.cpp
index e229dd4aa734..65ab3bb1262d 100644
--- a/test/CodeGenCXX/static-init-2.cpp
+++ b/test/CodeGenCXX/static-init-2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -verify %s
// Make sure we don't crash generating y; its value is constant, but the
// initializer has side effects, so EmitConstantExpr should fail.
diff --git a/test/CodeGenCXX/static-init.cpp b/test/CodeGenCXX/static-init.cpp
index 91085440ae78..cbd90e789406 100644
--- a/test/CodeGenCXX/static-init.cpp
+++ b/test/CodeGenCXX/static-init.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
struct A {
A();
~A();
@@ -11,7 +11,7 @@ void f() {
}
void g() {
- // CHECK: call i8* @_Znwm(i64 1)
+ // CHECK: call noalias i8* @_Znwm(i64 1)
// CHECK: call void @_ZN1AC1Ev(
static A& a = *new A;
}
diff --git a/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp b/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp
index d439cbd50049..94fd9aa12ced 100644
--- a/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp
+++ b/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// CHECK: ; ModuleID
template<typename> struct A { static int a; };
diff --git a/test/CodeGenCXX/temp-order.cpp b/test/CodeGenCXX/temp-order.cpp
index ecf075fcc11d..e1ef7eb260a2 100644
--- a/test/CodeGenCXX/temp-order.cpp
+++ b/test/CodeGenCXX/temp-order.cpp
@@ -1,5 +1,5 @@
// Output file should have no calls to error() with folding.
-// RUN: clang-cc -triple i386-unknown-unknown -O3 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm -o %t %s
// RUN: FileCheck %s < %t
static unsigned pow(unsigned Base, unsigned Power) {
diff --git a/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp b/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp
index f8454282badc..921113a14841 100644
--- a/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp
+++ b/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
template <typename T>
class A
{
diff --git a/test/CodeGenCXX/template-linkage.cpp b/test/CodeGenCXX/template-linkage.cpp
index 8013ba44c533..5d573d6e829b 100644
--- a/test/CodeGenCXX/template-linkage.cpp
+++ b/test/CodeGenCXX/template-linkage.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
template<typename T> struct A {
virtual void f(T) { }
inline void g() { }
diff --git a/test/CodeGenCXX/temporaries.cpp b/test/CodeGenCXX/temporaries.cpp
index e55027460f0c..611781886b3e 100644
--- a/test/CodeGenCXX/temporaries.cpp
+++ b/test/CodeGenCXX/temporaries.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
struct A {
A();
~A();
@@ -201,4 +201,51 @@ void f11(H h) {
// CHECK-NOT: call void @_ZN1HD1Ev
// CHECK: ret void
f10(h);
-} \ No newline at end of file
+}
+
+// PR5808
+struct I {
+ I(const char *);
+ ~I();
+};
+
+// CHECK: _Z3f12v
+I f12() {
+ // CHECK: call void @_ZN1IC1EPKc
+ // CHECK-NOT: call void @_ZN1ID1Ev
+ // CHECK: ret void
+ return "Hello";
+}
+
+// PR5867
+namespace PR5867 {
+ struct S {
+ S();
+ S(const S &);
+ ~S();
+ };
+
+ void f(S, int);
+ // CHECK: define void @_ZN6PR58671gEv
+ void g() {
+ // CHECK: call void @_ZN6PR58671SC1Ev
+ // CHECK-NEXT: call void @_ZN6PR58671fENS_1SEi
+ // CHECK-NEXT: call void @_ZN6PR58671SD1Ev
+ // CHECK-NEXT: ret void
+ (f)(S(), 0);
+ }
+
+ // CHECK: define linkonce_odr void @_ZN6PR58672g2IiEEvT_
+ template<typename T>
+ void g2(T) {
+ // CHECK: call void @_ZN6PR58671SC1Ev
+ // CHECK-NEXT: call void @_ZN6PR58671fENS_1SEi
+ // CHECK-NEXT: call void @_ZN6PR58671SD1Ev
+ // CHECK-NEXT: ret void
+ (f)(S(), 0);
+ }
+
+ void h() {
+ g2(17);
+ }
+}
diff --git a/test/CodeGenCXX/throw-expressions.cpp b/test/CodeGenCXX/throw-expressions.cpp
index 7fe556312bab..9449618f2f2c 100644
--- a/test/CodeGenCXX/throw-expressions.cpp
+++ b/test/CodeGenCXX/throw-expressions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -verify %s
int val = 42;
int& test1() {
diff --git a/test/CodeGenCXX/trivial-constructor-init.cpp b/test/CodeGenCXX/trivial-constructor-init.cpp
index 90d6e655d8d8..343dc6575a71 100644
--- a/test/CodeGenCXX/trivial-constructor-init.cpp
+++ b/test/CodeGenCXX/trivial-constructor-init.cpp
@@ -1,5 +1,5 @@
-// RUN: clang-cc -S %s -o %t-64.s
-// RUN: clang-cc -S %s -o %t-32.s
+// RUN: %clang_cc1 -S %s -o %t-64.s
+// RUN: %clang_cc1 -S %s -o %t-32.s
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/try-catch.cpp b/test/CodeGenCXX/try-catch.cpp
new file mode 100644
index 000000000000..2b5f3232d1fb
--- /dev/null
+++ b/test/CodeGenCXX/try-catch.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fexceptions | FileCheck %s
+
+struct X { };
+
+const X g();
+
+void f() {
+ try {
+ throw g();
+ // CHECK: @_ZTI1X to i8
+ } catch (const X x) {
+ }
+}
diff --git a/test/CodeGenCXX/unary-type-trait.cpp b/test/CodeGenCXX/unary-type-trait.cpp
index b65b9f9d4f2f..a11c67e12890 100644
--- a/test/CodeGenCXX/unary-type-trait.cpp
+++ b/test/CodeGenCXX/unary-type-trait.cpp
@@ -1,3 +1,3 @@
-// RUN: clang-cc -emit-llvm-only -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -verify %s
bool a() { return __is_pod(int); }
diff --git a/test/CodeGenCXX/value-init.cpp b/test/CodeGenCXX/value-init.cpp
new file mode 100644
index 000000000000..8b6e43fd8ec0
--- /dev/null
+++ b/test/CodeGenCXX/value-init.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+struct A {
+ virtual ~A();
+};
+
+struct B : A { };
+
+struct C {
+ int i;
+ B b;
+};
+
+// CHECK: _Z15test_value_initv
+void test_value_init() {
+ // This value initialization requires zero initialization of the 'B'
+ // subobject followed by a call to its constructor.
+ // PR5800
+
+ // CHECK: store i32 17
+ // CHECK: call void @llvm.memset.i64
+ // CHECK: call void @_ZN1BC1Ev
+ C c = { 17 } ;
+ // CHECK: call void @_ZN1CD1Ev
+}
diff --git a/test/CodeGenCXX/vararg-conversion-ctor.cpp b/test/CodeGenCXX/vararg-conversion-ctor.cpp
index 1306abf4a63d..7e42859ac93e 100644
--- a/test/CodeGenCXX/vararg-conversion-ctor.cpp
+++ b/test/CodeGenCXX/vararg-conversion-ctor.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t-64.ll
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t-64.ll
// RUN: FileCheck -check-prefix LPLL64 --input-file=%t-64.ll %s
extern "C" int printf(...);
diff --git a/test/CodeGenCXX/virt-call-offsets.cpp b/test/CodeGenCXX/virt-call-offsets.cpp
index db0ba2f483b8..3eb6b5da7d0c 100644
--- a/test/CodeGenCXX/virt-call-offsets.cpp
+++ b/test/CodeGenCXX/virt-call-offsets.cpp
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
struct A { virtual void a(); };
struct B : A {};
diff --git a/test/CodeGenCXX/virt-canonical-decl.cpp b/test/CodeGenCXX/virt-canonical-decl.cpp
index c1a8c236af8d..dfc361948921 100644
--- a/test/CodeGenCXX/virt-canonical-decl.cpp
+++ b/test/CodeGenCXX/virt-canonical-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm-only
+// RUN: %clang_cc1 %s -emit-llvm-only
class Base {
public:
diff --git a/test/CodeGenCXX/virt-dtor-gen.cpp b/test/CodeGenCXX/virt-dtor-gen.cpp
index 704d735c776e..a4346bade786 100644
--- a/test/CodeGenCXX/virt-dtor-gen.cpp
+++ b/test/CodeGenCXX/virt-dtor-gen.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -o - -emit-llvm %s | FileCheck %s
+// RUN: %clang_cc1 -o - -emit-llvm %s | FileCheck %s
// PR5483
// Make sure we generate all three forms of the destructor when it is virtual.
diff --git a/test/CodeGenCXX/virt-dtor-key.cpp b/test/CodeGenCXX/virt-dtor-key.cpp
index 9cfd58dae2d3..6a58c50b5b79 100644
--- a/test/CodeGenCXX/virt-dtor-key.cpp
+++ b/test/CodeGenCXX/virt-dtor-key.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
// CHECK: @_ZTI3foo = constant
class foo {
foo();
diff --git a/test/CodeGenCXX/virt-template-vtable.cpp b/test/CodeGenCXX/virt-template-vtable.cpp
index 3fbdd2d9cde0..76a1240731b2 100644
--- a/test/CodeGenCXX/virt-template-vtable.cpp
+++ b/test/CodeGenCXX/virt-template-vtable.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
template<class T> class A {
A() {}
diff --git a/test/CodeGenCXX/virt-thunk-reference.cpp b/test/CodeGenCXX/virt-thunk-reference.cpp
index 4b361cfc3d2c..0cd958bf3208 100644
--- a/test/CodeGenCXX/virt-thunk-reference.cpp
+++ b/test/CodeGenCXX/virt-thunk-reference.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only %s
+// RUN: %clang_cc1 -emit-llvm-only %s
struct A { int a; virtual void aa(int&); };
struct B { int b; virtual void bb(int&); };
diff --git a/test/CodeGenCXX/virt.cpp b/test/CodeGenCXX/virt.cpp
index e3b2afe2f770..259fd03e7aff 100644
--- a/test/CodeGenCXX/virt.cpp
+++ b/test/CodeGenCXX/virt.cpp
@@ -1,7 +1,7 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t-64.ll
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t-64.ll
// RUN: FileCheck -check-prefix LPLL64 --input-file=%t-64.ll %s
@@ -147,12 +147,12 @@ void test12_foo() {
}
// CHECK-LPLL64:define void @_Z10test12_foov() nounwind {
-// CHECK-LPLL64: call void %2(%class.test14* %tmp)
-// CHECK-LPLL64: call void %5(%class.test14* %tmp1)
-// CHECK-LPLL64: call void %8(%class.test14* %tmp3)
-// CHECK-LPLL64: call void %11(%class.test14* %tmp5)
-// CHECK-LPLL64: call void %14(%class.test14* %tmp7)
-// CHECK-LPLL64: call void %17(%class.test14* %tmp9)
+// CHECK-LPLL64: call void %
+// CHECK-LPLL64: call void %
+// CHECK-LPLL64: call void %
+// CHECK-LPLL64: call void %
+// CHECK-LPLL64: call void %
+// CHECK-LPLL64: call void %
// CHECK-LPLL64: call void @_ZN8test12_A3fooEv(%class.test14* %tmp11)
diff --git a/test/CodeGenCXX/virtual-base-cast.cpp b/test/CodeGenCXX/virtual-base-cast.cpp
index eae868f9b69c..73b7c1c95299 100644
--- a/test/CodeGenCXX/virtual-base-cast.cpp
+++ b/test/CodeGenCXX/virtual-base-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple i686-pc-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple i686-pc-linux-gnu | FileCheck %s
struct A { int a; virtual int aa(); };
struct B { int b; virtual int bb(); };
diff --git a/test/CodeGenCXX/virtual-base-ctor.cpp b/test/CodeGenCXX/virtual-base-ctor.cpp
new file mode 100644
index 000000000000..2d81ebd3a407
--- /dev/null
+++ b/test/CodeGenCXX/virtual-base-ctor.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -O2 | FileCheck %s
+
+struct B;
+extern B x;
+char y;
+typedef __typeof(sizeof(int)) size_t;
+struct A { int a; A() { y = ((size_t)this - (size_t)&x) / sizeof(void*); } };
+struct B : virtual A { void* x; };
+B x;
+
+// CHECK: @y = global i8 2
diff --git a/test/CodeGenCXX/virtual-base-destructor-call.cpp b/test/CodeGenCXX/virtual-base-destructor-call.cpp
index e791758aca9f..1ee598afdc3f 100644
--- a/test/CodeGenCXX/virtual-base-destructor-call.cpp
+++ b/test/CodeGenCXX/virtual-base-destructor-call.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
struct basic_ios{~basic_ios(); };
diff --git a/test/CodeGenCXX/virtual-bases.cpp b/test/CodeGenCXX/virtual-bases.cpp
index 4b069ead02b8..1eaef3fa3af4 100644
--- a/test/CodeGenCXX/virtual-bases.cpp
+++ b/test/CodeGenCXX/virtual-bases.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
struct A {
A();
diff --git a/test/CodeGenCXX/virtual-destructor-calls.cpp b/test/CodeGenCXX/virtual-destructor-calls.cpp
index 976f56278ee0..ecfcad232029 100644
--- a/test/CodeGenCXX/virtual-destructor-calls.cpp
+++ b/test/CodeGenCXX/virtual-destructor-calls.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
struct A {
virtual ~A();
diff --git a/test/CodeGenCXX/virtual-destructor-synthesis.cpp b/test/CodeGenCXX/virtual-destructor-synthesis.cpp
index b95218a322f6..90f66a817db1 100644
--- a/test/CodeGenCXX/virtual-destructor-synthesis.cpp
+++ b/test/CodeGenCXX/virtual-destructor-synthesis.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
struct box {
virtual ~box();
diff --git a/test/CodeGenCXX/virtual-function-calls.cpp b/test/CodeGenCXX/virtual-function-calls.cpp
index ca5acbabcc99..0b3a684301eb 100644
--- a/test/CodeGenCXX/virtual-function-calls.cpp
+++ b/test/CodeGenCXX/virtual-function-calls.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// PR5021
struct A {
@@ -9,3 +9,11 @@ void f(A *a) {
// CHECK: call void %
a->f('c');
}
+
+struct B : virtual A {
+ virtual void f();
+};
+
+void f(B * b) {
+ b->f();
+} \ No newline at end of file
diff --git a/test/CodeGenCXX/virtual-functions-incomplete-types.cpp b/test/CodeGenCXX/virtual-functions-incomplete-types.cpp
index 1e1e96286e79..50e04357b390 100644
--- a/test/CodeGenCXX/virtual-functions-incomplete-types.cpp
+++ b/test/CodeGenCXX/virtual-functions-incomplete-types.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
struct A;
diff --git a/test/CodeGenCXX/virtual-implicit-copy-assignment.cpp b/test/CodeGenCXX/virtual-implicit-copy-assignment.cpp
index d179e9b78607..70bc6fceb361 100644
--- a/test/CodeGenCXX/virtual-implicit-copy-assignment.cpp
+++ b/test/CodeGenCXX/virtual-implicit-copy-assignment.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
struct D;
struct B {
diff --git a/test/CodeGenCXX/virtual-inherited-destructor.cpp b/test/CodeGenCXX/virtual-inherited-destructor.cpp
index 52b62edd2944..509d40ae2fef 100644
--- a/test/CodeGenCXX/virtual-inherited-destructor.cpp
+++ b/test/CodeGenCXX/virtual-inherited-destructor.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm-only
+// RUN: %clang_cc1 %s -emit-llvm-only
struct A { virtual ~A(); };
struct B : A {
diff --git a/test/CodeGenCXX/virtual-operator-call.cpp b/test/CodeGenCXX/virtual-operator-call.cpp
index 018052bb472c..42d38e55a04f 100644
--- a/test/CodeGenCXX/virtual-operator-call.cpp
+++ b/test/CodeGenCXX/virtual-operator-call.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
struct A {
virtual int operator-() = 0;
diff --git a/test/CodeGenCXX/virtual-pseudo-destructor-call.cpp b/test/CodeGenCXX/virtual-pseudo-destructor-call.cpp
index 3d99a0216073..285e3da75924 100644
--- a/test/CodeGenCXX/virtual-pseudo-destructor-call.cpp
+++ b/test/CodeGenCXX/virtual-pseudo-destructor-call.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
struct A {
virtual ~A();
diff --git a/test/CodeGenCXX/vtable-cast-crash.cpp b/test/CodeGenCXX/vtable-cast-crash.cpp
index a91d9790fe65..cc419fd4f522 100644
--- a/test/CodeGenCXX/vtable-cast-crash.cpp
+++ b/test/CodeGenCXX/vtable-cast-crash.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only %s
+// RUN: %clang_cc1 -emit-llvm-only %s
struct A
{
A();
diff --git a/test/CodeGenCXX/vtable-key-function.cpp b/test/CodeGenCXX/vtable-key-function.cpp
index b0371c0e0ba7..90e8ea66f769 100644
--- a/test/CodeGenCXX/vtable-key-function.cpp
+++ b/test/CodeGenCXX/vtable-key-function.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// PR5697
namespace PR5697 {
struct A {
diff --git a/test/CodeGenCXX/vtable-linkage.cpp b/test/CodeGenCXX/vtable-linkage.cpp
index f2d914feed9e..6d3cf240096b 100644
--- a/test/CodeGenCXX/vtable-linkage.cpp
+++ b/test/CodeGenCXX/vtable-linkage.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
namespace {
struct A {
diff --git a/test/CodeGenCXX/x86_64-arguments.cpp b/test/CodeGenCXX/x86_64-arguments.cpp
index 0e4c2abc1074..7ebbedc9989e 100644
--- a/test/CodeGenCXX/x86_64-arguments.cpp
+++ b/test/CodeGenCXX/x86_64-arguments.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
// CHECK: [[i64_i64_ty:%.*]] = type { i64, i64 }
// CHECK: [[i64_double_ty:%.*]] = type { i64, double }
@@ -21,4 +21,7 @@ struct f2_s1 : public f2_s0 { char d;};
// CHECK: define void @_Z2f25f2_s1([[i64_i64_ty]])
void f2(f2_s1 a0) { }
-
+// PR5831
+struct s3_0 {};
+struct s3_1 { struct s3_0 a; long b; };
+void f3(struct s3_1 x) {}
diff --git a/test/CodeGenObjC/2008-10-23-invalid-icmp.m b/test/CodeGenObjC/2008-10-23-invalid-icmp.m
index 65fbf9bc092c..ce01bdb489ab 100644
--- a/test/CodeGenObjC/2008-10-23-invalid-icmp.m
+++ b/test/CodeGenObjC/2008-10-23-invalid-icmp.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@protocol P @end
diff --git a/test/CodeGenObjC/PR4541.m b/test/CodeGenObjC/PR4541.m
index 2d2adeb3d88e..84218a968cc8 100644
--- a/test/CodeGenObjC/PR4541.m
+++ b/test/CodeGenObjC/PR4541.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -o %t -w -g %s
+// RUN: %clang_cc1 -o %t -w -g %s
@class NSString;
diff --git a/test/CodeGenObjC/PR4894-recursive-debug-crash.m b/test/CodeGenObjC/PR4894-recursive-debug-crash.m
index 91ae9b3c870f..5d2327ad274b 100644
--- a/test/CodeGenObjC/PR4894-recursive-debug-crash.m
+++ b/test/CodeGenObjC/PR4894-recursive-debug-crash.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -g -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -g -emit-llvm %s -o - | FileCheck %s
// PR4894
//
// This test is actually just making sure we can generate the debug info for the
diff --git a/test/CodeGenObjC/attr-strong.c b/test/CodeGenObjC/attr-strong.c
index ca8333449435..f1474bc93eb5 100644
--- a/test/CodeGenObjC/attr-strong.c
+++ b/test/CodeGenObjC/attr-strong.c
@@ -1,4 +1,4 @@
-// RUN: clang -emit-llvm -S -o %t %s
+// RUN: %clang -emit-llvm -S -o %t %s
struct s0 {
void *a;
diff --git a/test/CodeGenObjC/bitfield-1.m b/test/CodeGenObjC/bitfield-1.m
index 107361f9975d..978b3cc30403 100644
--- a/test/CodeGenObjC/bitfield-1.m
+++ b/test/CodeGenObjC/bitfield-1.m
@@ -1,6 +1,6 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s
-// RUN: clang -cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
@interface Object
- (id) alloc;
diff --git a/test/CodeGenObjC/bitfield-ivar-metadata.m b/test/CodeGenObjC/bitfield-ivar-metadata.m
index 52fd3098bacf..9ab3fef30267 100644
--- a/test/CodeGenObjC/bitfield-ivar-metadata.m
+++ b/test/CodeGenObjC/bitfield-ivar-metadata.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@interface INTF
{
diff --git a/test/CodeGenObjC/bitfield-ivar-offsets.m b/test/CodeGenObjC/bitfield-ivar-offsets.m
index 2a8c31cde757..e0eebe16e882 100644
--- a/test/CodeGenObjC/bitfield-ivar-offsets.m
+++ b/test/CodeGenObjC/bitfield-ivar-offsets.m
@@ -1,5 +1,5 @@
// RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s &&
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// RUN: grep -F '@"OBJC_IVAR_$_I0._b0" = global i64 0, section "__DATA, __objc_const", align 8' %t
// RUN: grep -F '@"OBJC_IVAR_$_I0._b1" = global i64 0, section "__DATA, __objc_const", align 8' %t
// RUN: grep -F '@"OBJC_IVAR_$_I0._b2" = global i64 1, section "__DATA, __objc_const", align 8' %t
diff --git a/test/CodeGenObjC/blocks-1.m b/test/CodeGenObjC/blocks-1.m
index c1b001b66306..76bfd59e41d1 100644
--- a/test/CodeGenObjC/blocks-1.m
+++ b/test/CodeGenObjC/blocks-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10
+// RUN: %clang_cc1 %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10
// RUN: grep "_Block_object_dispose" %t | count 6
// RUN: grep "__copy_helper_block_" %t | count 4
// RUN: grep "__destroy_helper_block_" %t | count 4
diff --git a/test/CodeGenObjC/blocks-2.m b/test/CodeGenObjC/blocks-2.m
index 4949b45cddee..15160cc52b06 100644
--- a/test/CodeGenObjC/blocks-2.m
+++ b/test/CodeGenObjC/blocks-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10
+// RUN: %clang_cc1 %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10
// RUN: grep "objc_assign_strongCast" %t | count 2
// This should generate a strong cast.
diff --git a/test/CodeGenObjC/blocks-3.m b/test/CodeGenObjC/blocks-3.m
index 279f21a52822..d8379b9f9d14 100644
--- a/test/CodeGenObjC/blocks-3.m
+++ b/test/CodeGenObjC/blocks-3.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm -fblocks -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -fblocks -o %t %s
// RUN: grep 'object_assign' %t | count 11
// RUN: grep 'object_dispose' %t | count 29
diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m
index 536d158046b0..6dc14107b7c7 100644
--- a/test/CodeGenObjC/blocks.m
+++ b/test/CodeGenObjC/blocks.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -fblocks -o %t %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fblocks -o %t %s
// rdar://6676764
struct S {
diff --git a/test/CodeGenObjC/category-super-class-meth.m b/test/CodeGenObjC/category-super-class-meth.m
index 595d2af29857..6f02aff96de1 100644
--- a/test/CodeGenObjC/category-super-class-meth.m
+++ b/test/CodeGenObjC/category-super-class-meth.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@interface BASE
+ (int) BaseMeth;
diff --git a/test/CodeGenObjC/class-getter-dotsyntax.m b/test/CodeGenObjC/class-getter-dotsyntax.m
index 599e6e7154aa..bc142ce0dbe7 100644
--- a/test/CodeGenObjC/class-getter-dotsyntax.m
+++ b/test/CodeGenObjC/class-getter-dotsyntax.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@interface Test { }
+ (Test *)crash;
diff --git a/test/CodeGenObjC/class-type.m b/test/CodeGenObjC/class-type.m
index 45d7a8671ba7..192a80832783 100644
--- a/test/CodeGenObjC/class-type.m
+++ b/test/CodeGenObjC/class-type.m
@@ -1,6 +1,6 @@
-// RUN: clang -cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s
@interface I0 {
diff --git a/test/CodeGenObjC/compatibility-alias.m b/test/CodeGenObjC/compatibility-alias.m
index aca274515940..fcc53b841d59 100644
--- a/test/CodeGenObjC/compatibility-alias.m
+++ b/test/CodeGenObjC/compatibility-alias.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@interface Int1 @end
diff --git a/test/CodeGenObjC/constant-strings.m b/test/CodeGenObjC/constant-strings.m
index 08d30ba20f84..227694969bfe 100644
--- a/test/CodeGenObjC/constant-strings.m
+++ b/test/CodeGenObjC/constant-strings.m
@@ -1,6 +1,6 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
-// RUN: clang -cc1 -fgnu-runtime -emit-llvm -o %t %s && grep NXConstantString %t | count 1
-// RUN: clang -cc1 -fgnu-runtime -fconstant-string-class NSConstantString -emit-llvm -o %t %s && grep NSConstantString %t | count 1
+// RUN: %clang_cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o %t %s && grep NXConstantString %t | count 1
+// RUN: %clang_cc1 -fgnu-runtime -fconstant-string-class NSConstantString -emit-llvm -o %t %s && grep NSConstantString %t | count 1
id a = @"Hello World!";
diff --git a/test/CodeGenObjC/continuation-class.m b/test/CodeGenObjC/continuation-class.m
index 9ee61028322e..6f903a0d6ba2 100644
--- a/test/CodeGenObjC/continuation-class.m
+++ b/test/CodeGenObjC/continuation-class.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@interface Object
- (id)new;
diff --git a/test/CodeGenObjC/deadcode_strip_used_var.m b/test/CodeGenObjC/deadcode_strip_used_var.m
index 679d6da66101..01e6bd4feb33 100644
--- a/test/CodeGenObjC/deadcode_strip_used_var.m
+++ b/test/CodeGenObjC/deadcode_strip_used_var.m
@@ -1,6 +1,6 @@
-// RUN: clang -cc1 %s -emit-llvm -o %t -triple i386-apple-darwin10
+// RUN: %clang_cc1 %s -emit-llvm -o %t -triple i386-apple-darwin10
// RUN: grep "llvm.used" %t | count 1
-// RUN: clang -cc1 %s -emit-llvm -o %t -triple x86_64-apple-darwin10
+// RUN: %clang_cc1 %s -emit-llvm -o %t -triple x86_64-apple-darwin10
// RUN: grep "llvm.used" %t | count 1
diff --git a/test/CodeGenObjC/debug-info-linkagename.m b/test/CodeGenObjC/debug-info-linkagename.m
index bace9db1b824..2b10e2bd67b8 100644
--- a/test/CodeGenObjC/debug-info-linkagename.m
+++ b/test/CodeGenObjC/debug-info-linkagename.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -g -S -o %t %s
+// RUN: %clang_cc1 -g -S -o %t %s
// RUN: not grep 001 %t
@interface F
diff --git a/test/CodeGenObjC/dot-syntax-1.m b/test/CodeGenObjC/dot-syntax-1.m
index 96d4cdf4b500..417bcb4b9dfe 100644
--- a/test/CodeGenObjC/dot-syntax-1.m
+++ b/test/CodeGenObjC/dot-syntax-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
int printf(const char *, ...);
diff --git a/test/CodeGenObjC/dot-syntax.m b/test/CodeGenObjC/dot-syntax.m
index 5a40fd8726d2..6282ea491f50 100644
--- a/test/CodeGenObjC/dot-syntax.m
+++ b/test/CodeGenObjC/dot-syntax.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
int printf(const char *, ...);
diff --git a/test/CodeGenObjC/encode-test-1.m b/test/CodeGenObjC/encode-test-1.m
index dd4867cfb79e..af7ad26d2f4b 100644
--- a/test/CodeGenObjC/encode-test-1.m
+++ b/test/CodeGenObjC/encode-test-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep -e "{Base=b2b3b4b5}" %t | count 1
// RUN: grep -e "{Derived=b2b3b4b5b5b4b3}" %t | count 1
diff --git a/test/CodeGenObjC/encode-test-2.m b/test/CodeGenObjC/encode-test-2.m
index 6c20c424058b..9e1423755a79 100644
--- a/test/CodeGenObjC/encode-test-2.m
+++ b/test/CodeGenObjC/encode-test-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep -e "@\\\22<X>\\\22" %t
// RUN: grep -e "@\\\22<X><Y>\\\22" %t
// RUN: grep -e "@\\\22<X><Y><Z>\\\22" %t
diff --git a/test/CodeGenObjC/encode-test-3.m b/test/CodeGenObjC/encode-test-3.m
index 3706ab6a2683..4b39cd718ea2 100644
--- a/test/CodeGenObjC/encode-test-3.m
+++ b/test/CodeGenObjC/encode-test-3.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep -e "\^i" %t | count 1
// RUN: grep -e "\[0i\]" %t | count 1
diff --git a/test/CodeGenObjC/encode-test-4.m b/test/CodeGenObjC/encode-test-4.m
index 149205cdecaa..117e1733486e 100644
--- a/test/CodeGenObjC/encode-test-4.m
+++ b/test/CodeGenObjC/encode-test-4.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o - %s -O2 | grep "ret i32 1"
+// RUN: %clang_cc1 -emit-llvm -o - %s -O2 | grep "ret i32 1"
int a() {
return @encode(int) == @encode(int);
diff --git a/test/CodeGenObjC/encode-test-5.m b/test/CodeGenObjC/encode-test-5.m
index a12d90058964..a27ffb7c5d1d 100644
--- a/test/CodeGenObjC/encode-test-5.m
+++ b/test/CodeGenObjC/encode-test-5.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple=x86_64-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple=x86_64-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep ji.00 %t | count 1
char *a = @encode(_Complex int);
diff --git a/test/CodeGenObjC/encode-test.m b/test/CodeGenObjC/encode-test.m
index 060161d1a998..9d1cf6cec3c4 100644
--- a/test/CodeGenObjC/encode-test.m
+++ b/test/CodeGenObjC/encode-test.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep -e "\^{Innermost=CC}" %t | count 1
// RUN: grep -e "{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}" %t | count 1
// RUN: grep -e "{B1=#@c}" %t | count 1
diff --git a/test/CodeGenObjC/for-in.m b/test/CodeGenObjC/for-in.m
index fab0ee47b501..354ff32c0ef9 100644
--- a/test/CodeGenObjC/for-in.m
+++ b/test/CodeGenObjC/for-in.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
void p(const char*, ...);
diff --git a/test/CodeGenObjC/forward-class-impl-metadata.m b/test/CodeGenObjC/forward-class-impl-metadata.m
index fae745b1ff84..0ab7a8166453 100644
--- a/test/CodeGenObjC/forward-class-impl-metadata.m
+++ b/test/CodeGenObjC/forward-class-impl-metadata.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
@interface BASE {
@private
diff --git a/test/CodeGenObjC/hidden-visibility.m b/test/CodeGenObjC/hidden-visibility.m
index e265e6f754e8..5e08ef9d55d2 100644
--- a/test/CodeGenObjC/hidden-visibility.m
+++ b/test/CodeGenObjC/hidden-visibility.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fvisibility hidden -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fvisibility hidden -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s
// CHECK: @"OBJC_IVAR_$_I.P" = hidden
// CHECK: @"OBJC_CLASS_$_I" = hidden
// CHECK: @"OBJC_METACLASS_$_I" = hidden
diff --git a/test/CodeGenObjC/hidden.m b/test/CodeGenObjC/hidden.m
index 502aaebb6964..0b77e736b903 100644
--- a/test/CodeGenObjC/hidden.m
+++ b/test/CodeGenObjC/hidden.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
__attribute__((visibility("hidden")))
@interface Hidden
diff --git a/test/CodeGenObjC/id-isa-codegen.m b/test/CodeGenObjC/id-isa-codegen.m
index 73b21b0c652d..89e992209071 100644
--- a/test/CodeGenObjC/id-isa-codegen.m
+++ b/test/CodeGenObjC/id-isa-codegen.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
typedef struct objc_class *Class;
@@ -25,3 +25,12 @@ typedef struct objc_object {
}
@end
+
+// rdar 7470820
+static Class MyClass;
+
+Class Test(const void *inObject1) {
+ if(((id)inObject1)->isa == MyClass)
+ return ((id)inObject1)->isa;
+ return (id)0;
+}
diff --git a/test/CodeGenObjC/image-info.m b/test/CodeGenObjC/image-info.m
index 8167ef68ca2e..17f75319a0da 100644
--- a/test/CodeGenObjC/image-info.m
+++ b/test/CodeGenObjC/image-info.m
@@ -1,2 +1,2 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin-10 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin-10 -emit-llvm -o %t %s
// RUN: grep -F '@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__OBJC, __image_info,regular"' %t
diff --git a/test/CodeGenObjC/implicit-objc_msgSend.m b/test/CodeGenObjC/implicit-objc_msgSend.m
index 25d0b8f66984..a21e869229a7 100644
--- a/test/CodeGenObjC/implicit-objc_msgSend.m
+++ b/test/CodeGenObjC/implicit-objc_msgSend.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep -F 'declare i8* @objc_msgSend(...)' %t
typedef struct objc_selector *SEL;
diff --git a/test/CodeGenObjC/implicit-property.m b/test/CodeGenObjC/implicit-property.m
index 9d17d8745142..db1da314b9e6 100644
--- a/test/CodeGenObjC/implicit-property.m
+++ b/test/CodeGenObjC/implicit-property.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -emit-llvm -triple=i686-apple-darwin8 -o %t %s
-// RUNX: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -triple=i686-apple-darwin8 -o %t %s
+// RUNX: %clang_cc1 -emit-llvm -o %t %s
@interface A
-(void) setOk:(int)arg;
diff --git a/test/CodeGenObjC/interface-layout-64.m b/test/CodeGenObjC/interface-layout-64.m
index a8a7c6310863..2800b41c5246 100644
--- a/test/CodeGenObjC/interface-layout-64.m
+++ b/test/CodeGenObjC/interface-layout-64.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s &&
// RUN: grep '@"OBJC_IVAR_$_I3._iv2" = global i64 8, section "__DATA, __objc_const", align 8' %t
diff --git a/test/CodeGenObjC/interface.m b/test/CodeGenObjC/interface.m
index 37efed096050..17d56f7b1db4 100644
--- a/test/CodeGenObjC/interface.m
+++ b/test/CodeGenObjC/interface.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -O3 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -O3 -emit-llvm -o %t %s
// RUN: grep 'ret i32 385' %t
void *alloca();
diff --git a/test/CodeGenObjC/ivar-layout-64-bitfields.m b/test/CodeGenObjC/ivar-layout-64-bitfields.m
index 9a7d4aa8d3a6..1b6a16b1b8be 100644
--- a/test/CodeGenObjC/ivar-layout-64-bitfields.m
+++ b/test/CodeGenObjC/ivar-layout-64-bitfields.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
@interface I
{
struct {
diff --git a/test/CodeGenObjC/ivar-layout-64.m b/test/CodeGenObjC/ivar-layout-64.m
index 833f6dd07245..60ce1dff57de 100644
--- a/test/CodeGenObjC/ivar-layout-64.m
+++ b/test/CodeGenObjC/ivar-layout-64.m
@@ -1,5 +1,5 @@
// RUNX: llvm-gcc -m64 -fobjc-gc -emit-llvm -S -o %t %s &&
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o %t %s
// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"A\\00"' %t
// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\11q\\10\\00"' %t
// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"!q\\00"' %t
diff --git a/test/CodeGenObjC/ivar-layout-no-optimize.m b/test/CodeGenObjC/ivar-layout-no-optimize.m
index 54c37e0ac056..e7fd1301b810 100644
--- a/test/CodeGenObjC/ivar-layout-no-optimize.m
+++ b/test/CodeGenObjC/ivar-layout-no-optimize.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
@interface NSObject {
diff --git a/test/CodeGenObjC/ivars.m b/test/CodeGenObjC/ivars.m
index 0f6e7ca91612..fe178aba14bd 100644
--- a/test/CodeGenObjC/ivars.m
+++ b/test/CodeGenObjC/ivars.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s
// rdar://6800926
@interface ITF {
diff --git a/test/CodeGenObjC/link-errors.m b/test/CodeGenObjC/link-errors.m
index 5ab66ae45950..a82f0ceaf76d 100644
--- a/test/CodeGenObjC/link-errors.m
+++ b/test/CodeGenObjC/link-errors.m
@@ -1,8 +1,8 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep '.lazy_reference .objc_class_name_A' %t | count 1
// RUN: grep '.lazy_reference .objc_class_name_Unknown' %t | count 1
// RUN: grep '.lazy_reference .objc_class_name_Protocol' %t | count 1
-// RUN: clang -cc1 -triple i386-apple-darwin9 -DWITH_IMPL -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -DWITH_IMPL -emit-llvm -o %t %s
// RUN: grep '.lazy_reference .objc_class_name_Root' %t | count 1
@interface Root
diff --git a/test/CodeGenObjC/message-arrays.m b/test/CodeGenObjC/message-arrays.m
index 47d010f2f502..3e8697fc9376 100644
--- a/test/CodeGenObjC/message-arrays.m
+++ b/test/CodeGenObjC/message-arrays.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
void f0(id a) {
// This should have an implicit cast
diff --git a/test/CodeGenObjC/messages-2.m b/test/CodeGenObjC/messages-2.m
index 55bc23324996..2a6e3dcbbda3 100644
--- a/test/CodeGenObjC/messages-2.m
+++ b/test/CodeGenObjC/messages-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
int printf(const char *, ...);
diff --git a/test/CodeGenObjC/messages.m b/test/CodeGenObjC/messages.m
index 113486dde452..5f77a8e327eb 100644
--- a/test/CodeGenObjC/messages.m
+++ b/test/CodeGenObjC/messages.m
@@ -1,8 +1,8 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: grep "objc_msgSend" %t | count 6
-// RUN: clang -cc1 -fgnu-runtime -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o %t %s
// RUN: grep "objc_msg_lookup" %t | count 6
-// RUN: clang -cc1 -fgnu-runtime -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fgnu-runtime -fobjc-nonfragile-abi -emit-llvm -o %t %s
// RUN: grep "objc_msg_lookup_sender" %t | count 6
typedef struct {
diff --git a/test/CodeGenObjC/metadata-symbols-32.m b/test/CodeGenObjC/metadata-symbols-32.m
index 4956cdb8e4c3..34cc83da315a 100644
--- a/test/CodeGenObjC/metadata-symbols-32.m
+++ b/test/CodeGenObjC/metadata-symbols-32.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s
// RUNX: llvm-gcc -m32 -emit-llvm -S -o %t %s &&
// RUN: grep '@"\\01L_OBJC_CATEGORY_A_Cat" = internal global .*section "__OBJC,__category,regular,no_dead_strip", align 4' %t
diff --git a/test/CodeGenObjC/metadata-symbols-64.m b/test/CodeGenObjC/metadata-symbols-64.m
index 7a3e341a312a..886d53a8287e 100644
--- a/test/CodeGenObjC/metadata-symbols-64.m
+++ b/test/CodeGenObjC/metadata-symbols-64.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s &&
// RUN: grep '@"OBJC_CLASS_$_A" = global' %t
diff --git a/test/CodeGenObjC/metadata_symbols.m b/test/CodeGenObjC/metadata_symbols.m
index 5d4841e366be..dc65382e571f 100644
--- a/test/CodeGenObjC/metadata_symbols.m
+++ b/test/CodeGenObjC/metadata_symbols.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// RUN: grep '@"OBJC_METACLASS_$_A" = global .*section "__DATA, __objc_data", align 8' %t
// RUN: grep '@"OBJC_CLASS_$_A" = global .*section "__DATA, __objc_data", align 8' %t
@@ -10,7 +10,7 @@
// RUN: grep -F 'define internal void @"\01-[A im0]"' %t
// RUN: grep -F 'define internal void @"\01-[A(Cat) im1]"' %t
-// RUN: clang -cc1 -fobjc-nonfragile-abi -fvisibility hidden -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -fvisibility hidden -emit-llvm -o %t %s
// RUN: grep '@"OBJC_METACLASS_$_A" = hidden global .*section "__DATA, __objc_data", align 8' %t
// RUN: grep '@"OBJC_CLASS_$_A" = hidden global .*section "__DATA, __objc_data", align 8' %t
diff --git a/test/CodeGenObjC/missing-atend-metadata.m b/test/CodeGenObjC/missing-atend-metadata.m
index fd759e351029..50e597c8d1a8 100644
--- a/test/CodeGenObjC/missing-atend-metadata.m
+++ b/test/CodeGenObjC/missing-atend-metadata.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s
@interface I0
@end
diff --git a/test/CodeGenObjC/nested-rethrow.m b/test/CodeGenObjC/nested-rethrow.m
index dd7439def218..627b913ab067 100644
--- a/test/CodeGenObjC/nested-rethrow.m
+++ b/test/CodeGenObjC/nested-rethrow.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s
extern int printf(const char*, ...);
diff --git a/test/CodeGenObjC/newproperty-nested-synthesis-1.m b/test/CodeGenObjC/newproperty-nested-synthesis-1.m
index 3e8e5ba56e0c..4831c22463b8 100644
--- a/test/CodeGenObjC/newproperty-nested-synthesis-1.m
+++ b/test/CodeGenObjC/newproperty-nested-synthesis-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@interface Object
- (id) new;
diff --git a/test/CodeGenObjC/no-category-class.m b/test/CodeGenObjC/no-category-class.m
index 38ea739053fa..0bd999689dd1 100644
--- a/test/CodeGenObjC/no-category-class.m
+++ b/test/CodeGenObjC/no-category-class.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o %t %s
@interface NSObject
@end
diff --git a/test/CodeGenObjC/non-lazy-classes.m b/test/CodeGenObjC/non-lazy-classes.m
index 0bca6401c999..021db97de9fa 100644
--- a/test/CodeGenObjC/non-lazy-classes.m
+++ b/test/CodeGenObjC/non-lazy-classes.m
@@ -1,5 +1,5 @@
// RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s &&
-// RUN: clang -cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CLASS_$" = internal global \[1 x .*\] .*@"OBJC_CLASS_$_A".*, section "__DATA, __objc_nlclslist, regular, no_dead_strip", align 8' %t
// RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CATEGORY_$" = internal global \[1 x .*\] .*@".01l_OBJC_$_CATEGORY_A_$_Cat".*, section "__DATA, __objc_nlcatlist, regular, no_dead_strip", align 8' %t
diff --git a/test/CodeGenObjC/objc-align.m b/test/CodeGenObjC/objc-align.m
index 785378ae5af8..ff3f2a0a9088 100644
--- a/test/CodeGenObjC/objc-align.m
+++ b/test/CodeGenObjC/objc-align.m
@@ -1,7 +1,7 @@
// 32-bit
// RUNX: llvm-gcc -m32 -emit-llvm -S -o %t %s &&
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep '@"\\01L_OBJC_CATEGORY_A_Cat" = internal global .*, section "__OBJC,__category,regular,no_dead_strip", align 4' %t
// RUN: grep '@"\\01L_OBJC_CLASS_A" = internal global .*, section "__OBJC,__class,regular,no_dead_strip", align 4' %t
// RUN: grep '@"\\01L_OBJC_CLASS_C" = internal global .*, section "__OBJC,__class,regular,no_dead_strip", align 4' %t
@@ -14,7 +14,7 @@
// 64-bit
-// RUNX: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s &&
+// RUNX: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s &&
// RUNX: grep '@"OBJC_CLASS_$_A" = global' %t &&
// RUNX: grep '@"OBJC_CLASS_$_C" = global' %t &&
// RUNX: grep '@"OBJC_METACLASS_$_A" = global' %t &&
diff --git a/test/CodeGenObjC/objc-assign-ivar.m b/test/CodeGenObjC/objc-assign-ivar.m
index d54b8026414f..aefe97d0f2a7 100644
--- a/test/CodeGenObjC/objc-assign-ivar.m
+++ b/test/CodeGenObjC/objc-assign-ivar.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep -F '@objc_assign_ivar' %t | count 14
typedef struct {
diff --git a/test/CodeGenObjC/objc-gc-aggr-assign.m b/test/CodeGenObjC/objc-gc-aggr-assign.m
index 9ed6fdf0f04e..e127242df257 100644
--- a/test/CodeGenObjC/objc-gc-aggr-assign.m
+++ b/test/CodeGenObjC/objc-gc-aggr-assign.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep objc_memmove_collectable %t | grep call | count 3
static int count;
diff --git a/test/CodeGenObjC/objc-read-weak-byref.m b/test/CodeGenObjC/objc-read-weak-byref.m
index 35854f234ef6..1ddbcaffac6f 100644
--- a/test/CodeGenObjC/objc-read-weak-byref.m
+++ b/test/CodeGenObjC/objc-read-weak-byref.m
@@ -1,6 +1,6 @@
-// RUN: clang -cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -S %s -o %t-64.s
+// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang -cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -S %s -o %t-32.s
+// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
@interface NSObject
@@ -18,8 +18,8 @@ int main() {
return 0;
}
-// CHECK-LP64: call _objc_read_weak
-// CHECK-LP64: call _objc_read_weak
+// CHECK-LP64: callq _objc_read_weak
+// CHECK-LP64: callq _objc_read_weak
// CHECK-LP32: call L_objc_read_weak
// CHECK-LP32: call L_objc_read_weak
diff --git a/test/CodeGenObjC/objc2-assign-global.m b/test/CodeGenObjC/objc2-assign-global.m
index fab4f82f39ae..ff3ecef72d8d 100644
--- a/test/CodeGenObjC/objc2-assign-global.m
+++ b/test/CodeGenObjC/objc2-assign-global.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep -F '@objc_assign_global' %t | count 26
@class NSObject;
diff --git a/test/CodeGenObjC/objc2-ivar-assign.m b/test/CodeGenObjC/objc2-ivar-assign.m
index 1d5b97316b8d..e50cc5b53729 100644
--- a/test/CodeGenObjC/objc2-ivar-assign.m
+++ b/test/CodeGenObjC/objc2-ivar-assign.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o %t %s
// RUN: grep objc_assign_ivar %t | count 6
@interface I @end
diff --git a/test/CodeGenObjC/objc2-new-gc-api-strongcast.m b/test/CodeGenObjC/objc2-new-gc-api-strongcast.m
index 2992cef1ed80..1ff2dd3d8de2 100644
--- a/test/CodeGenObjC/objc2-new-gc-api-strongcast.m
+++ b/test/CodeGenObjC/objc2-new-gc-api-strongcast.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fblocks -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fobjc-gc -emit-llvm -o %t %s
// RUN: grep -F '@objc_assign_strongCast' %t | count 4
@interface DSATextSearch @end
diff --git a/test/CodeGenObjC/objc2-no-strong-cast.m b/test/CodeGenObjC/objc2-no-strong-cast.m
index 649c3e925e31..0824f4086537 100644
--- a/test/CodeGenObjC/objc2-no-strong-cast.m
+++ b/test/CodeGenObjC/objc2-no-strong-cast.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@interface PDFViewPrivateVars
{
diff --git a/test/CodeGenObjC/objc2-no-write-barrier.m b/test/CodeGenObjC/objc2-no-write-barrier.m
index 17d4e1046e46..544c329c5e20 100644
--- a/test/CodeGenObjC/objc2-no-write-barrier.m
+++ b/test/CodeGenObjC/objc2-no-write-barrier.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep 'objc_assign' %t | count 0
typedef struct {
diff --git a/test/CodeGenObjC/objc2-property-encode.m b/test/CodeGenObjC/objc2-property-encode.m
index c5f68d2c5b0e..0f18d6fe159b 100644
--- a/test/CodeGenObjC/objc2-property-encode.m
+++ b/test/CodeGenObjC/objc2-property-encode.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep -e "T@\\\\22NSString\\\\22" %t
@interface NSString @end
diff --git a/test/CodeGenObjC/objc2-protocol-enc.m b/test/CodeGenObjC/objc2-protocol-enc.m
index d8b86bc72ff7..0db0cb85bc26 100644
--- a/test/CodeGenObjC/objc2-protocol-enc.m
+++ b/test/CodeGenObjC/objc2-protocol-enc.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
// RUN: grep -e "T@\\\22<X>\\\22" %t
// RUN: grep -e "T@\\\22<X><Y>\\\22" %t
// RUN: grep -e "T@\\\22<X><Y><Z>\\\22" %t
diff --git a/test/CodeGenObjC/objc2-retain-codegen.m b/test/CodeGenObjC/objc2-retain-codegen.m
index 2d49ef78d7cf..2c3317a4854d 100644
--- a/test/CodeGenObjC/objc2-retain-codegen.m
+++ b/test/CodeGenObjC/objc2-retain-codegen.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-unknown-unknown -fobjc-gc-only -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fobjc-gc-only -emit-llvm -o %t %s
@interface I0 {
I0 *_f0;
diff --git a/test/CodeGenObjC/objc2-strong-cast-1.m b/test/CodeGenObjC/objc2-strong-cast-1.m
index ed083c9de929..509f21a342ae 100644
--- a/test/CodeGenObjC/objc2-strong-cast-1.m
+++ b/test/CodeGenObjC/objc2-strong-cast-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-unknown-unknown -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fobjc-gc -emit-llvm -o %t %s
@interface I {
__attribute__((objc_gc(strong))) int *i_IdocumentIDs;
diff --git a/test/CodeGenObjC/objc2-strong-cast.m b/test/CodeGenObjC/objc2-strong-cast.m
index e8cacd1d6fb0..9ef463c0df10 100644
--- a/test/CodeGenObjC/objc2-strong-cast.m
+++ b/test/CodeGenObjC/objc2-strong-cast.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-gc -emit-llvm -o %t %s
@interface I {
__attribute__((objc_gc(strong))) signed long *_documentIDs;
diff --git a/test/CodeGenObjC/objc2-weak-assign.m b/test/CodeGenObjC/objc2-weak-assign.m
index 41a76f0152eb..42fa7738f44e 100644
--- a/test/CodeGenObjC/objc2-weak-assign.m
+++ b/test/CodeGenObjC/objc2-weak-assign.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep -e "objc_assign_weak" %t | grep -e "call" | count 6
__weak id* x;
diff --git a/test/CodeGenObjC/objc2-weak-compare.m b/test/CodeGenObjC/objc2-weak-compare.m
index 346485a3668b..cb8ca5ff4c07 100644
--- a/test/CodeGenObjC/objc2-weak-compare.m
+++ b/test/CodeGenObjC/objc2-weak-compare.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
@interface PBXTarget
{
diff --git a/test/CodeGenObjC/objc2-weak-import-attribute.m b/test/CodeGenObjC/objc2-weak-import-attribute.m
index b5bb87052e45..946c79b5bcc5 100644
--- a/test/CodeGenObjC/objc2-weak-import-attribute.m
+++ b/test/CodeGenObjC/objc2-weak-import-attribute.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s
__attribute__((weak_import)) @interface WeakRootClass @end
diff --git a/test/CodeGenObjC/objc2-weak-ivar-debug.m b/test/CodeGenObjC/objc2-weak-ivar-debug.m
index dc8ced1b0c31..a6fb7fa2751f 100644
--- a/test/CodeGenObjC/objc2-weak-ivar-debug.m
+++ b/test/CodeGenObjC/objc2-weak-ivar-debug.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s
-// RUN: clang -cc1 -triple i386-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s
// rdar://7252252
@interface Loop {
diff --git a/test/CodeGenObjC/objc2-weak-ivar.m b/test/CodeGenObjC/objc2-weak-ivar.m
index bcdb25c03068..cfe1e95952fe 100644
--- a/test/CodeGenObjC/objc2-weak-ivar.m
+++ b/test/CodeGenObjC/objc2-weak-ivar.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
@class NSObject;
@interface Foo {
diff --git a/test/CodeGenObjC/objc2-write-barrier-2.m b/test/CodeGenObjC/objc2-write-barrier-2.m
index 35a812f9620c..9a76c6eb8208 100644
--- a/test/CodeGenObjC/objc2-write-barrier-2.m
+++ b/test/CodeGenObjC/objc2-write-barrier-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep -F '@objc_assign_global' %t | count 7
// RUN: grep -F '@objc_assign_ivar' %t | count 5
// RUN: grep -F '@objc_assign_strongCast' %t | count 8
diff --git a/test/CodeGenObjC/objc2-write-barrier-3.m b/test/CodeGenObjC/objc2-write-barrier-3.m
index ecb038586cac..626083b1c42d 100644
--- a/test/CodeGenObjC/objc2-write-barrier-3.m
+++ b/test/CodeGenObjC/objc2-write-barrier-3.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s
// RUN: grep objc_assign_ivar %t | count 3
// RUN: grep objc_assign_strongCast %t | count 6
diff --git a/test/CodeGenObjC/objc2-write-barrier-4.m b/test/CodeGenObjC/objc2-write-barrier-4.m
index 8b672cc6f0fa..11b4ab4e9604 100644
--- a/test/CodeGenObjC/objc2-write-barrier-4.m
+++ b/test/CodeGenObjC/objc2-write-barrier-4.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep objc_assign_global %t | count 3
// RUN: grep objc_assign_strongCast %t | count 2
diff --git a/test/CodeGenObjC/objc2-write-barrier-5.m b/test/CodeGenObjC/objc2-write-barrier-5.m
index 8241af7b3026..babe26d55a53 100644
--- a/test/CodeGenObjC/objc2-write-barrier-5.m
+++ b/test/CodeGenObjC/objc2-write-barrier-5.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep objc_assign_ivar %t | count 0
// RUN: grep objc_assign_strongCast %t | count 5
diff --git a/test/CodeGenObjC/objc2-write-barrier.m b/test/CodeGenObjC/objc2-write-barrier.m
index 5877064cf310..0934e0a46ac3 100644
--- a/test/CodeGenObjC/objc2-write-barrier.m
+++ b/test/CodeGenObjC/objc2-write-barrier.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s
// RUN: grep -F '@objc_assign_global' %t | count 21
// RUN: grep -F '@objc_assign_ivar' %t | count 11
diff --git a/test/CodeGenObjC/object-incr-decr-1.m b/test/CodeGenObjC/object-incr-decr-1.m
index 7e1870e1e346..6369076174b3 100644
--- a/test/CodeGenObjC/object-incr-decr-1.m
+++ b/test/CodeGenObjC/object-incr-decr-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o %t
@interface Foo
{
diff --git a/test/CodeGenObjC/overloadable.m b/test/CodeGenObjC/overloadable.m
index abf1e27e18b8..4fd1429f2827 100644
--- a/test/CodeGenObjC/overloadable.m
+++ b/test/CodeGenObjC/overloadable.m
@@ -1,5 +1,5 @@
// rdar://6657613
-// RUN: clang -cc1 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
@class C;
diff --git a/test/CodeGenObjC/predefined-expr.m b/test/CodeGenObjC/predefined-expr.m
index f75eef320da1..772093bd8a0e 100644
--- a/test/CodeGenObjC/predefined-expr.m
+++ b/test/CodeGenObjC/predefined-expr.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck %s
// CHECK: @"__func__.-[Foo instanceTest1]" = private constant [21 x i8] c"-[Foo instanceTest1]\00"
// CHECK: @"__func__.-[Foo instanceTest2:]" = private constant [22 x i8] c"-[Foo instanceTest2:]\00"
diff --git a/test/CodeGenObjC/property-aggr-type.m b/test/CodeGenObjC/property-aggr-type.m
index 263f76dda59c..8ba87de3534a 100644
--- a/test/CodeGenObjC/property-aggr-type.m
+++ b/test/CodeGenObjC/property-aggr-type.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@interface Object
- (id) new;
diff --git a/test/CodeGenObjC/property-agrr-getter.m b/test/CodeGenObjC/property-agrr-getter.m
index a5c95c7fba6f..2dd32bb4f373 100644
--- a/test/CodeGenObjC/property-agrr-getter.m
+++ b/test/CodeGenObjC/property-agrr-getter.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
typedef struct {
unsigned f0;
diff --git a/test/CodeGenObjC/property-complex.m b/test/CodeGenObjC/property-complex.m
index 6d1b775408c9..59200eba0905 100644
--- a/test/CodeGenObjC/property-complex.m
+++ b/test/CodeGenObjC/property-complex.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -S -o - %s
-// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm -S -o - %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -S -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -S -o - %s
@interface I0 {
@public
diff --git a/test/CodeGenObjC/property-getter-dot-syntax.m b/test/CodeGenObjC/property-getter-dot-syntax.m
index 8d8ae90b3537..f22b0517735d 100644
--- a/test/CodeGenObjC/property-getter-dot-syntax.m
+++ b/test/CodeGenObjC/property-getter-dot-syntax.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@protocol NSObject
- (void *)description;
diff --git a/test/CodeGenObjC/property-incr-decr-1.m b/test/CodeGenObjC/property-incr-decr-1.m
index f2660fe7a791..d75c02eaa20f 100644
--- a/test/CodeGenObjC/property-incr-decr-1.m
+++ b/test/CodeGenObjC/property-incr-decr-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@interface Object
- (id) new;
diff --git a/test/CodeGenObjC/property-list-in-class.m b/test/CodeGenObjC/property-list-in-class.m
index 2d753b2bbb0d..a5d0dc851dc4 100644
--- a/test/CodeGenObjC/property-list-in-class.m
+++ b/test/CodeGenObjC/property-list-in-class.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// RUN: grep -F 'l_OBJC_$_PROP_LIST_C2" = internal global %8 { i32 16, i32 3' %t
@protocol P
diff --git a/test/CodeGenObjC/property-setter-attr.m b/test/CodeGenObjC/property-setter-attr.m
index 43f74fb07b43..d155ca811af9 100644
--- a/test/CodeGenObjC/property-setter-attr.m
+++ b/test/CodeGenObjC/property-setter-attr.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -triple=i686-apple-darwin8 -o %t %s
+// RUN: %clang_cc1 -emit-llvm -triple=i686-apple-darwin8 -o %t %s
// RUN: grep -e "SiSetOtherThings:" %t
@interface A
diff --git a/test/CodeGenObjC/property.m b/test/CodeGenObjC/property.m
index d4868245156a..7160b16c447e 100644
--- a/test/CodeGenObjC/property.m
+++ b/test/CodeGenObjC/property.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
int printf(const char *, ...);
diff --git a/test/CodeGenObjC/protocol-in-extended-class.m b/test/CodeGenObjC/protocol-in-extended-class.m
index ce1d0f3cea39..d2955b1e3a11 100644
--- a/test/CodeGenObjC/protocol-in-extended-class.m
+++ b/test/CodeGenObjC/protocol-in-extended-class.m
@@ -1,6 +1,6 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S %s -o %t-64.s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: clang -cc1 -triple i386-apple-darwin -S %s -o %t-32.s
+// RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
@protocol MyProtocol
diff --git a/test/CodeGenObjC/protocol-property-synth.m b/test/CodeGenObjC/protocol-property-synth.m
index f59de81f8b37..8566949e5c94 100644
--- a/test/CodeGenObjC/protocol-property-synth.m
+++ b/test/CodeGenObjC/protocol-property-synth.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
@interface BaseClass {
id _delegate;
diff --git a/test/CodeGenObjC/protocols-lazy.m b/test/CodeGenObjC/protocols-lazy.m
index 7e4c45d398e1..2038e60c4e61 100644
--- a/test/CodeGenObjC/protocols-lazy.m
+++ b/test/CodeGenObjC/protocols-lazy.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -triple=i686-apple-darwin8 -o %t %s
+// RUN: %clang_cc1 -emit-llvm -triple=i686-apple-darwin8 -o %t %s
// RUNX: llvm-gcc -S -emit-llvm -o %t %s &&
// No object generated
diff --git a/test/CodeGenObjC/protocols.m b/test/CodeGenObjC/protocols.m
index 1e765df14bef..0f24a1cd1fc1 100644
--- a/test/CodeGenObjC/protocols.m
+++ b/test/CodeGenObjC/protocols.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o %t
void p(const char*, ...);
diff --git a/test/CodeGenObjC/runtime-fns.m b/test/CodeGenObjC/runtime-fns.m
index d5832bc87842..203d87fff065 100644
--- a/test/CodeGenObjC/runtime-fns.m
+++ b/test/CodeGenObjC/runtime-fns.m
@@ -1,6 +1,6 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// RUN: grep -e "^de.*objc_msgSend[0-9]*(" %t | count 1
-// RUN: clang -cc1 -DWITHDEF -emit-llvm -o %t %s
+// RUN: %clang_cc1 -DWITHDEF -emit-llvm -o %t %s
// RUN: grep -e "^de.*objc_msgSend[0-9]*(" %t | count 1
id objc_msgSend(int x);
diff --git a/test/CodeGenObjC/sel-as-builtin-type.m b/test/CodeGenObjC/sel-as-builtin-type.m
index 317c5d3ca97c..72a8564e0888 100644
--- a/test/CodeGenObjC/sel-as-builtin-type.m
+++ b/test/CodeGenObjC/sel-as-builtin-type.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// pr5025
// radar 7405040
diff --git a/test/CodeGenObjC/super-classmethod-category.m b/test/CodeGenObjC/super-classmethod-category.m
index 64ba1419c0f4..c19663cec45a 100644
--- a/test/CodeGenObjC/super-classmethod-category.m
+++ b/test/CodeGenObjC/super-classmethod-category.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@interface SUPER
+ (void)Meth;
diff --git a/test/CodeGenObjC/super-dotsyntax-property.m b/test/CodeGenObjC/super-dotsyntax-property.m
index 0f811040d546..9dfde2d1de3a 100644
--- a/test/CodeGenObjC/super-dotsyntax-property.m
+++ b/test/CodeGenObjC/super-dotsyntax-property.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
@interface B
{
diff --git a/test/CodeGenObjC/super-message-fragileabi.m b/test/CodeGenObjC/super-message-fragileabi.m
index ebb443b81aff..5efc234dcafd 100644
--- a/test/CodeGenObjC/super-message-fragileabi.m
+++ b/test/CodeGenObjC/super-message-fragileabi.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s
@class Some;
diff --git a/test/CodeGenObjC/synchronized.m b/test/CodeGenObjC/synchronized.m
index 8bb19142bdcd..1af82345e0bc 100644
--- a/test/CodeGenObjC/synchronized.m
+++ b/test/CodeGenObjC/synchronized.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -triple=i686-apple-darwin9 -o %t %s -O2
+// RUN: %clang_cc1 -emit-llvm -triple=i686-apple-darwin9 -o %t %s -O2
// RUN: grep 'ret i32' %t | count 1
// RUN: grep 'ret i32 1' %t | count 1
diff --git a/test/CodeGenObjC/synthesize_ivar-cont-class.m b/test/CodeGenObjC/synthesize_ivar-cont-class.m
index fb61137df49d..f85320279bc4 100644
--- a/test/CodeGenObjC/synthesize_ivar-cont-class.m
+++ b/test/CodeGenObjC/synthesize_ivar-cont-class.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// RUN: grep '@"OBJC_IVAR_$_XCOrganizerDeviceNodeInfo.viewController"' %t
@interface XCOrganizerNodeInfo
diff --git a/test/CodeGenObjC/synthesize_ivar.m b/test/CodeGenObjC/synthesize_ivar.m
index ae21044a4ebe..5dd90ab618bb 100644
--- a/test/CodeGenObjC/synthesize_ivar.m
+++ b/test/CodeGenObjC/synthesize_ivar.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
@interface I
@property int IP;
diff --git a/test/CodeGenObjC/try.m b/test/CodeGenObjC/try.m
index 01106a9c2101..884e33a219c0 100644
--- a/test/CodeGenObjC/try.m
+++ b/test/CodeGenObjC/try.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 %s -S -o - -triple=i686-apple-darwin9
-// RUN: clang -cc1 %s -S -o - -triple=x86_64-apple-darwin9
+// RUN: %clang_cc1 %s -S -o - -triple=i686-apple-darwin9
+// RUN: %clang_cc1 %s -S -o - -triple=x86_64-apple-darwin9
// rdar://6757213 - Don't crash if the internal proto for
// __objc_personality_v0 mismatches with an actual one.
diff --git a/test/CodeGenObjC/undefined-protocol.m b/test/CodeGenObjC/undefined-protocol.m
index c57f53dd0b61..d87a5c999ee9 100644
--- a/test/CodeGenObjC/undefined-protocol.m
+++ b/test/CodeGenObjC/undefined-protocol.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm-only -fgnu-runtime %s
+// RUN: %clang_cc1 -emit-llvm-only -fgnu-runtime %s
@protocol MadeUpProtocol;
diff --git a/test/CodeGenObjC/unname-bf-metadata.m b/test/CodeGenObjC/unname-bf-metadata.m
index 48d37f13ce70..c1208c142ca3 100644
--- a/test/CodeGenObjC/unname-bf-metadata.m
+++ b/test/CodeGenObjC/unname-bf-metadata.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
// Test that meta-data for ivar lists with unnamed bitfield are generated.
//
@interface Foo {
diff --git a/test/CodeGenObjC/variadic-sends.m b/test/CodeGenObjC/variadic-sends.m
index 1979e3fc293c..ea13823bc719 100644
--- a/test/CodeGenObjC/variadic-sends.m
+++ b/test/CodeGenObjC/variadic-sends.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-32 %s
-// RUN: clang -cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-32 %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s
@interface A
-(void) im0;
diff --git a/test/CodeGenObjC/x86_64-struct-return-gc.m b/test/CodeGenObjC/x86_64-struct-return-gc.m
new file mode 100644
index 000000000000..32a321c0b7d0
--- /dev/null
+++ b/test/CodeGenObjC/x86_64-struct-return-gc.m
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s
+struct Coerce {
+ id a;
+};
+
+struct Coerce coerce_func(void);
+
+// CHECK: define void @Coerce_test()
+void Coerce_test(void) {
+ struct Coerce c;
+
+ // CHECK: call i64 @coerce_func
+ // CHECK: call i8* @objc_memmove_collectable(
+ c = coerce_func();
+}
+
+struct Indirect {
+ id a;
+ int b[10];
+};
+
+struct Indirect indirect_func(void);
+
+// CHECK: define void @Indirect_test()
+void Indirect_test(void) {
+ struct Indirect i;
+
+ // CHECK: call void @indirect_func(%struct.Indirect* noalias sret
+ // CHECK: call i8* @objc_memmove_collectable(
+ i = indirect_func();
+}
diff --git a/test/CodeGenObjCXX/mangle.mm b/test/CodeGenObjCXX/mangle.mm
index 90d2407838ad..d277c4e51581 100644
--- a/test/CodeGenObjCXX/mangle.mm
+++ b/test/CodeGenObjCXX/mangle.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// CHECK: @"_ZZ11+[A shared]E1a" = internal global
// CHECK: @"_ZZ11-[A(Foo) f]E1a" = internal global
diff --git a/test/Coverage/ast-printing.c b/test/Coverage/ast-printing.c
index 640dc29f394e..182bd4d1b25a 100644
--- a/test/Coverage/ast-printing.c
+++ b/test/Coverage/ast-printing.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -fsyntax-only %s
-// RUN: clang-cc -ast-print %s
-// RUN: clang-cc -ast-dump %s
-// RUN: clang-cc -ast-print-xml -o %t %s
+// RUN: %clang_cc1 -fsyntax-only %s
+// RUN: %clang_cc1 -ast-print %s
+// RUN: %clang_cc1 -ast-dump %s
+// RUN: %clang_cc1 -ast-print-xml -o %t %s
#include "c-language-features.inc"
diff --git a/test/Coverage/ast-printing.cpp b/test/Coverage/ast-printing.cpp
index d627fca3522e..e86e799a8f6e 100644
--- a/test/Coverage/ast-printing.cpp
+++ b/test/Coverage/ast-printing.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -fsyntax-only %s
-// RUN: clang-cc -ast-print %s
-// RUN: clang-cc -ast-dump %s
-// FIXME: clang-cc -ast-print-xml -o %t %s
+// RUN: %clang_cc1 -fsyntax-only %s
+// RUN: %clang_cc1 -ast-print %s
+// RUN: %clang_cc1 -ast-dump %s
+// FIXME: %clang_cc1 -ast-print-xml -o %t %s
#include "cxx-language-features.inc"
diff --git a/test/Coverage/ast-printing.m b/test/Coverage/ast-printing.m
index a864e2d72b88..d9c97d43d463 100644
--- a/test/Coverage/ast-printing.m
+++ b/test/Coverage/ast-printing.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -fsyntax-only %s
-// RUN: clang -cc1 -ast-print %s
-// RUN: clang -cc1 -ast-dump %s
+// RUN: %clang_cc1 -fsyntax-only %s
+// RUN: %clang_cc1 -ast-print %s
+// RUN: %clang_cc1 -ast-dump %s
#include "objc-language-features.inc"
diff --git a/test/Coverage/codegen-gnu.m b/test/Coverage/codegen-gnu.m
index 194809261458..6e7790dc5a70 100644
--- a/test/Coverage/codegen-gnu.m
+++ b/test/Coverage/codegen-gnu.m
@@ -1,3 +1,3 @@
-// RUN: clang -cc1 -triple i386-unknown-unknown -fgnu-runtime -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fgnu-runtime -emit-llvm -o %t %s
#include "objc-language-features.inc"
diff --git a/test/Coverage/codegen-next.m b/test/Coverage/codegen-next.m
index d78f93e61d2d..978b443f0fa6 100644
--- a/test/Coverage/codegen-next.m
+++ b/test/Coverage/codegen-next.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -emit-llvm -o %t %s
-// RUN: clang -cc1 -g -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -emit-llvm -o %t %s
#include "objc-language-features.inc"
diff --git a/test/Coverage/codegen.c b/test/Coverage/codegen.c
index f1d7fcc88672..8e5195cc39ef 100644
--- a/test/Coverage/codegen.c
+++ b/test/Coverage/codegen.c
@@ -1,7 +1,7 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o %t %s
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o %t %s
-// RUN: clang-cc -triple i386-unknown-unknown -g -emit-llvm-bc -o %t %s
-// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm-bc -o %t %s
-// RUN: clang-cc -triple x86_64-unknown-unknown -g -emit-llvm-bc -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -g -emit-llvm-bc -o %t %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm-bc -o %t %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -g -emit-llvm-bc -o %t %s
#include "c-language-features.inc"
diff --git a/test/Coverage/html-diagnostics.c b/test/Coverage/html-diagnostics.c
index 3079632e1205..6971f58f6aa4 100644
--- a/test/Coverage/html-diagnostics.c
+++ b/test/Coverage/html-diagnostics.c
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: clang-cc -analyze -analyzer-output=html -checker-cfref -o %t %s
+// RUN: %clang_cc1 -analyze -analyzer-output=html -checker-cfref -o %t %s
// RUN: cat %t/*.html | FileCheck %s
// CHECK: <h3>Annotated Source Code</h3>
diff --git a/test/Coverage/html-print.c b/test/Coverage/html-print.c
index dab156b145a8..a3f29c6f36f8 100644
--- a/test/Coverage/html-print.c
+++ b/test/Coverage/html-print.c
@@ -1,3 +1,3 @@
-// RUN: clang-cc -emit-html -o %t %s
+// RUN: %clang_cc1 -emit-html -o %t %s
#include "c-language-features.inc"
diff --git a/test/Coverage/parse-callbacks.c b/test/Coverage/parse-callbacks.c
index e29b38bd0d26..02f3a8374bc7 100644
--- a/test/Coverage/parse-callbacks.c
+++ b/test/Coverage/parse-callbacks.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -parse-noop %s
-// RUN: clang-cc -parse-print-callbacks %s
+// RUN: %clang_cc1 -parse-noop %s
+// RUN: %clang_cc1 -parse-print-callbacks %s
#include "c-language-features.inc"
diff --git a/test/Coverage/parse-callbacks.m b/test/Coverage/parse-callbacks.m
index 7666d19432d3..f023d3d0648b 100644
--- a/test/Coverage/parse-callbacks.m
+++ b/test/Coverage/parse-callbacks.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -parse-noop %s
-// RUN: clang -cc1 -parse-print-callbacks %s
+// RUN: %clang_cc1 -parse-noop %s
+// RUN: %clang_cc1 -parse-print-callbacks %s
#include "objc-language-features.inc"
diff --git a/test/Coverage/targets.c b/test/Coverage/targets.c
index 23990e06d393..c9f6f8d88d59 100644
--- a/test/Coverage/targets.c
+++ b/test/Coverage/targets.c
@@ -1,22 +1,22 @@
-// RUN: clang-cc -g -triple armv6-apple-darwin9 -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple armv6-unknown-unknown -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple bfin-unknown-unknown -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple i686-apple-darwin9 -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple i686-pc-linux-gnu -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple i686-unknown-dragonfly -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple i686-unknown-unknown -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple i686-unknown-win32 -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple pic16-unknown-unknown -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple powerpc-apple-darwin9 -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple powerpc-unknown-unknown -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple powerpc64-apple-darwin9 -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple powerpc64-unknown-unknown -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple sparc-unknown-solaris -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple sparc-unknown-unknown -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple x86_64-pc-linux-gnu -emit-llvm -o %t %s
-// RUN: clang-cc -g -triple x86_64-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple armv6-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple armv6-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple bfin-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple i686-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple i686-pc-linux-gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple i686-unknown-dragonfly -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple i686-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple i686-unknown-win32 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple pic16-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple powerpc-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple powerpc-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple powerpc64-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple powerpc64-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple sparc-unknown-solaris -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple sparc-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple x86_64-pc-linux-gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -g -triple x86_64-unknown-unknown -emit-llvm -o %t %s
// <rdar://problem/7181838> clang 1.0 fails to compile Python 2.6
-// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -### -S %s -mmacosx-version-min=10.4
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin9 -### -S %s -mmacosx-version-min=10.4
diff --git a/test/Coverage/verbose.c b/test/Coverage/verbose.c
index a75557b3fdee..72451d4620c1 100644
--- a/test/Coverage/verbose.c
+++ b/test/Coverage/verbose.c
@@ -1 +1 @@
-// RUN: clang-cc -fsyntax-only -v %s
+// RUN: %clang_cc1 -fsyntax-only -v %s
diff --git a/test/Driver/Xarch.c b/test/Driver/Xarch.c
index ba6f5c63d4d4..b35bf6c92dff 100644
--- a/test/Driver/Xarch.c
+++ b/test/Driver/Xarch.c
@@ -1,9 +1,9 @@
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -m32 -Xarch_i386 -O2 %s -S -### 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -m32 -Xarch_i386 -O2 %s -S -### 2> %t.log
// RUN: grep ' "-O2" ' %t.log | count 1
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -m64 -Xarch_i386 -O2 %s -S -### 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -m64 -Xarch_i386 -O2 %s -S -### 2> %t.log
// RUN: grep ' "-O2" ' %t.log | count 0
// RUN: grep "argument unused during compilation: '-Xarch_i386 -O2'" %t.log
-// RUN: not clang -ccc-host-triple i386-apple-darwin9 -m32 -Xarch_i386 -o -Xarch_i386 -S %s -S -Xarch_i386 -o 2> %t.log
+// RUN: not %clang -ccc-host-triple i386-apple-darwin9 -m32 -Xarch_i386 -o -Xarch_i386 -S %s -S -Xarch_i386 -o 2> %t.log
// RUN: grep "error: invalid Xarch argument: '-Xarch_i386 -o'" %t.log | count 2
// RUN: grep "error: invalid Xarch argument: '-Xarch_i386 -S'" %t.log
diff --git a/test/Driver/analyze.c b/test/Driver/analyze.c
index bdbfbbfd88dd..2f850bc73dde 100644
--- a/test/Driver/analyze.c
+++ b/test/Driver/analyze.c
@@ -1,7 +1,7 @@
// Verify that the analyzer gets the same flags as normal compilation
// (at least for a few key ones).
-// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 clang -ccc-host-triple i386-apple-darwin9 -### --analyze -o /dev/null %s -msse 2> %t.log
+// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 %clang -ccc-host-triple i386-apple-darwin9 -### --analyze -o /dev/null %s -msse 2> %t.log
// RUN: FileCheck --input-file=%t.log %s
// CHECK: "-analyze"
diff --git a/test/Driver/arm-darwin-builtin.c b/test/Driver/arm-darwin-builtin.c
index 63cf34332ae1..9d4cee0f05e3 100644
--- a/test/Driver/arm-darwin-builtin.c
+++ b/test/Driver/arm-darwin-builtin.c
@@ -8,7 +8,7 @@
// RUX: not grep -- "-fno-builtin-strcat" %t &&
// RUX: not grep -- "-fno-builtin-strcpy" %t &&
-// RUN: clang -ccc-no-clang -ccc-host-triple x86_64-apple-darwin9 -arch arm -### -fsyntax-only %s -fbuiltin-strcat -fbuiltin-strcpy 2> %t
+// RUN: %clang -ccc-no-clang -ccc-host-triple x86_64-apple-darwin9 -arch arm -### -fsyntax-only %s -fbuiltin-strcat -fbuiltin-strcpy 2> %t
// RUN: not grep -- "-fno-builtin-strcat" %t
// RUN: not grep -- "-fno-builtin-strcpy" %t
diff --git a/test/Driver/ast.c b/test/Driver/ast.c
index fd38c108b051..6e5857fba5e3 100644
--- a/test/Driver/ast.c
+++ b/test/Driver/ast.c
@@ -1,4 +1,4 @@
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -emit-ast %s 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -emit-ast %s 2> %t
// RUN: echo 'END' >> %t
// RUN: FileCheck -check-prefix EMIT-AST-PHASES -input-file %t %s
@@ -10,7 +10,7 @@
// EMIT-AST-PHASES: END
// RUN: touch %t.ast
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -c %t.ast 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -c %t.ast 2> %t
// RUN: echo 'END' >> %t
// RUN: FileCheck -check-prefix COMPILE-AST-PHASES -input-file %t %s
diff --git a/test/Driver/bindings.c b/test/Driver/bindings.c
index 41d6a7ced175..2271ab5c6459 100644
--- a/test/Driver/bindings.c
+++ b/test/Driver/bindings.c
@@ -1,54 +1,54 @@
// Basic binding.
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings %s 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings %s 2> %t
// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: ".*\.s"' %t
// RUN: grep '"gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
// RUN: grep '"gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang %s 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang %s 2> %t
// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: ".*\.s"' %t
// RUN: grep '"gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
// RUN: grep '"gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -no-integrated-cpp %s 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -no-integrated-cpp %s 2> %t
// RUN: grep '"gcc::Preprocess", inputs: \[".*bindings.c"\], output: ".*\.i"' %t
// RUN: grep '"gcc::Compile", inputs: \[".*\.i"\], output: ".*\.s"' %t
// RUN: grep '"gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
// RUN: grep '"gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -no-integrated-cpp -pipe %s 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -no-integrated-cpp -pipe %s 2> %t
// RUN: grep '"gcc::Preprocess", inputs: \[".*bindings.c"\], output: (pipe)' %t
// RUN: grep '"gcc::Compile", inputs: \[(pipe)\], output: (pipe)' %t
// RUN: grep '"gcc::Assemble", inputs: \[(pipe)\], output: ".*\.o"' %t
// RUN: grep '"gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -x c-header %s 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -x c-header %s 2> %t
// RUN: grep '"gcc::Precompile", inputs: \[".*bindings.c"\], output: ".*bindings.c.gch' %t
// Clang control options
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -fsyntax-only %s 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -fsyntax-only %s 2> %t
// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: (nothing)' %t
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -fsyntax-only %s 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -fsyntax-only %s 2> %t
// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: (nothing)' %t
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang-cxx -fsyntax-only -x c++ %s 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang-cxx -fsyntax-only -x c++ %s 2> %t
// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: (nothing)' %t
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-clang-cxx -fsyntax-only -x c++ %s 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-clang-cxx -fsyntax-only -x c++ %s 2> %t
// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: (nothing)' %t
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang-cpp -fsyntax-only -no-integrated-cpp %s 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang-cpp -fsyntax-only -no-integrated-cpp %s 2> %t
// RUN: grep '"gcc::Preprocess", inputs: \[".*bindings.c"\], output: ".*\.i"' %t
// RUN: grep '"clang", inputs: \[".*\.i"\], output: (nothing)' %t
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs i386 %s -S -arch ppc 2> %t
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs i386 %s -S -arch ppc 2> %t
// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs powerpc %s -S -arch ppc 2> %t
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs powerpc %s -S -arch ppc 2> %t
// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
-// RUN: clang -ccc-host-triple powerpc-unknown-unknown -ccc-print-bindings -ccc-clang-archs "" %s -S 2> %t
+// RUN: %clang -ccc-host-triple powerpc-unknown-unknown -ccc-print-bindings -ccc-clang-archs "" %s -S 2> %t
// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
-// RUN: clang -ccc-host-triple powerpc-unknown-unknown -ccc-print-bindings -ccc-clang-archs "i386" %s -S 2> %t
+// RUN: %clang -ccc-host-triple powerpc-unknown-unknown -ccc-print-bindings -ccc-clang-archs "i386" %s -S 2> %t
// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
// Darwin bindings
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings %s 2> %t
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings %s 2> %t
// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: ".*\.s"' %t
// RUN: grep '"darwin::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
// RUN: grep '"darwin::Link", inputs: \[".*\.o"\], output: "a.out"' %t
diff --git a/test/Driver/ccc-add-args.c b/test/Driver/ccc-add-args.c
index afd9bd6f7650..d9a16cbfb460 100644
--- a/test/Driver/ccc-add-args.c
+++ b/test/Driver/ccc-add-args.c
@@ -1,4 +1,4 @@
-// RUN: env CCC_ADD_ARGS="-ccc-echo,-ccc-print-options,,-v" clang -### 2>&1 | FileCheck %s
+// RUN: env CCC_ADD_ARGS="-ccc-echo,-ccc-print-options,,-v" %clang -### 2>&1 | FileCheck %s
// CHECK: Option 0 - Name: "-ccc-echo", Values: {}
// CHECK: Option 1 - Name: "-ccc-print-options", Values: {}
// CHECK: Option 2 - Name: "-v", Values: {}
diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c
index 762ebb7944b2..2464f03b7a1e 100644
--- a/test/Driver/clang-translation.c
+++ b/test/Driver/clang-translation.c
@@ -1,4 +1,4 @@
-// RUN: clang -ccc-host-triple i386-unknown-unknown -### -S -O0 -Os %s -o %t.s -fverbose-asm -funwind-tables -fvisibility=hidden 2> %t.log
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -### -S -O0 -Os %s -o %t.s -fverbose-asm -funwind-tables -fvisibility=hidden 2> %t.log
// RUN: grep '"-triple" "i386-unknown-unknown"' %t.log
// RUN: grep '"-S"' %t.log
// RUN: grep '"-disable-free"' %t.log
@@ -9,12 +9,12 @@
// RUN: grep '"-o" .*clang-translation.*' %t.log
// RUN: grep '"-masm-verbose"' %t.log
// RUN: grep '"-fvisibility" "hidden"' %t.log
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -S %s -o %t.s 2> %t.log
-// RUN: grep '"-mcpu" "yonah"' %t.log
-// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -### -S %s -o %t.s 2> %t.log
-// RUN: grep '"-mcpu" "core2"' %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -S %s -o %t.s 2> %t.log
+// RUN: grep '"-target-cpu" "yonah"' %t.log
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin9 -### -S %s -o %t.s 2> %t.log
+// RUN: grep '"-target-cpu" "core2"' %t.log
-// RUN: clang -ccc-host-triple x86_64-apple-darwin10 -### -S %s 2> %t.log \
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### -S %s 2> %t.log \
// RUN: -arch armv7
// RUN: FileCheck -check-prefix=ARMV7_DEFAULT %s < %t.log
// ARMV7_DEFAULT: clang
@@ -24,7 +24,7 @@
// ARMV7_DEFAULT-NOT: "-msoft-float"
// ARMV7_DEFAULT: "-x" "c"
-// RUN: clang -ccc-host-triple x86_64-apple-darwin10 -### -S %s 2> %t.log \
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### -S %s 2> %t.log \
// RUN: -arch armv7 -msoft-float
// RUN: FileCheck -check-prefix=ARMV7_SOFTFLOAT %s < %t.log
// ARMV7_SOFTFLOAT: clang
@@ -33,7 +33,7 @@
// ARMV7_SOFTFLOAT: "-mfloat-abi" "soft"
// ARMV7_SOFTFLOAT: "-x" "c"
-// RUN: clang -ccc-host-triple x86_64-apple-darwin10 -### -S %s 2> %t.log \
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### -S %s 2> %t.log \
// RUN: -arch armv7 -mhard-float
// RUN: FileCheck -check-prefix=ARMV7_HARDFLOAT %s < %t.log
// ARMV7_HARDFLOAT: clang
diff --git a/test/Driver/clang_cpp.c b/test/Driver/clang_cpp.c
index 8638465e3a2f..79b2f5513156 100644
--- a/test/Driver/clang_cpp.c
+++ b/test/Driver/clang_cpp.c
@@ -1,4 +1,4 @@
// Verify that -include isn't included twice with -save-temps.
-// RUN: clang -S -o - %s -include %t.h -save-temps -### 2> %t.log
+// RUN: %clang -S -o - %s -include %t.h -save-temps -### 2> %t.log
// RUN: grep '"-include' %t.log | count 1
diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c
index 66853422dd1d..c4ea430fdf31 100644
--- a/test/Driver/clang_f_opts.c
+++ b/test/Driver/clang_f_opts.c
@@ -1,6 +1,6 @@
-// RUN: clang -### -S -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
-// RUN: clang -### -S -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
-// RUN: clang -### -fshort-enums %s 2>&1 | FileCheck -check-prefix=CHECK-SHORT-ENUMS %s
+// RUN: %clang -### -S -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
+// RUN: %clang -### -S -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
+// RUN: %clang -### -fshort-enums %s 2>&1 | FileCheck -check-prefix=CHECK-SHORT-ENUMS %s
// CHECK-OPTIONS1: -fblocks
// CHECK-OPTIONS1: -fpascal-strings
diff --git a/test/Driver/cxx-pth.cpp b/test/Driver/cxx-pth.cpp
index e5b69c118fb3..e349691d423b 100644
--- a/test/Driver/cxx-pth.cpp
+++ b/test/Driver/cxx-pth.cpp
@@ -1,12 +1,12 @@
// Test forced PTH for CXX support.
-// RUN: clang -x c++-header %s -### 2> %t.log
+// RUN: %clang -x c++-header %s -### 2> %t.log
// RUN: FileCheck -check-prefix EMIT -input-file %t.log %s
// EMIT: "{{.*}}/clang{{.*}}" {{.*}} "-emit-pth" "{{.*}}.cpp.gch" "-x" "c++-header" "{{.*}}.cpp"
// RUN: touch %t.h.gch
-// RUN: clang -E -include %t.h %s -### 2> %t.log
+// RUN: %clang -E -include %t.h %s -### 2> %t.log
// RUN: FileCheck -check-prefix USE -input-file %t.log %s
// USE: "{{.*}}/clang{{.*}}" {{.*}}"-include-pth" "{{.*}}.h.gch" {{.*}}"-x" "c++" "{{.*}}.cpp"
diff --git a/test/Driver/darwin-arm.c b/test/Driver/darwin-arm.c
index 8b4c23d55724..330918dd47d0 100644
--- a/test/Driver/darwin-arm.c
+++ b/test/Driver/darwin-arm.c
@@ -1,4 +1,4 @@
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -arch arm -print-search-dirs | FileCheck %s
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -arch arm -print-search-dirs | FileCheck %s
// Check that we look in the relative libexec directory.
// CHECK: {{programs: =.*/../libexec:}}
diff --git a/test/Driver/darwin-as.c b/test/Driver/darwin-as.c
index 26e59a5ef670..6410df085637 100644
--- a/test/Driver/darwin-as.c
+++ b/test/Driver/darwin-as.c
@@ -1,9 +1,9 @@
-// RUN: clang -ccc-host-triple i386-apple-darwin10 -### -x assembler -c %s -static -dynamic 2>%t
+// RUN: %clang -ccc-host-triple i386-apple-darwin10 -### -x assembler -c %s -static -dynamic 2>%t
// RUN: FileCheck -check-prefix=STATIC_AND_DYNAMIC-32 --input-file %t %s
// CHECK-STATIC_AND_DYNAMIC-32: as{{(.exe)?}}" "-arch" "i386" "-force_cpusubtype_ALL" "-static" "-o"
-// RUN: clang -ccc-host-triple x86_64-apple-darwin10 -### -x assembler -c %s -static 2>%t
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### -x assembler -c %s -static 2>%t
// RUN: FileCheck -check-prefix=STATIC-64 --input-file %t %s
// CHECK-STATIC-64: as{{(.exe)?}}" "-arch" "x86_64" "-force_cpusubtype_ALL" "-o"
diff --git a/test/Driver/darwin-cc.c b/test/Driver/darwin-cc.c
index 1f4335855b02..7a3a378f89a0 100644
--- a/test/Driver/darwin-cc.c
+++ b/test/Driver/darwin-cc.c
@@ -1,4 +1,4 @@
-// RUN: clang -ccc-no-clang -ccc-host-triple i386-apple-darwin10 -m32 -### -MD -g -fast -Q -dA -mkernel -ansi -aFOO -S -o /tmp/OUTPUTNAME -g0 -gfull -O2 -Werror -pedantic -Wmost -w -std=c99 -trigraphs -v -pg -fFOO -undef -Qn --param a=b -fmudflap -coverage -save-temps -nostdinc -I ARG0 -F ARG1 -I ARG2 -P -MF ARG3 -MG -MP -remap -g3 -H -D ARG4 -U ARG5 -A ARG6 -D ARG7 -U ARG8 -A ARG9 -include ARG10 -pthread %s 2> %t.log
+// RUN: %clang -ccc-no-clang -ccc-host-triple i386-apple-darwin10 -m32 -### -MD -g -fast -Q -dA -mkernel -ansi -aFOO -S -o /tmp/OUTPUTNAME -g0 -gfull -O2 -Werror -pedantic -Wmost -w -std=c99 -trigraphs -v -pg -fFOO -undef -Qn --param a=b -fmudflap -coverage -save-temps -nostdinc -I ARG0 -F ARG1 -I ARG2 -P -MF ARG3 -MG -MP -remap -g3 -H -D ARG4 -U ARG5 -A ARG6 -D ARG7 -U ARG8 -A ARG9 -include ARG10 -pthread %s 2> %t.log
// RUN: grep ' ".*cc1" "-E" "-nostdinc" "-v" "-I" "ARG0" "-F" "ARG1" "-I" "ARG2" "-P" "-MD" "/tmp/OUTPUTNAME.d" "-MF" "ARG3" "-MG" "-MP" "-MQ" "/tmp/OUTPUTNAME" "-remap" "-dD" "-H" "-D__STATIC__" "-D_REENTRANT" "-D" "ARG4" "-U" "ARG5" "-A" "ARG6" "-D" "ARG7" "-U" "ARG8" "-A" "ARG9" "-include" "ARG10" ".*darwin-cc.c" "-D_MUDFLAP" "-include" "mf-runtime.h" "-mmacosx-version-min=10.6.0" "-m32" "-mkernel" "-mtune=core2" "-ansi" "-std=c99" "-trigraphs" "-Werror" "-pedantic" "-Wmost" "-w" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-O2" "-undef" "-fpch-preprocess" "-o" ".*darwin-cc.i"' %t.log
// RUN: grep ' ".*cc1" "-fpreprocessed" ".*darwin-cc.i" "-O3" "-dumpbase" ".*darwin-cc.c" "-dA" "-mmacosx-version-min=10.6.0" "-m32" "-mkernel" "-mtune=core2" "-ansi" "-aFOO" "-auxbase-strip" "/tmp/OUTPUTNAME" "-g" "-g0" "-g" "-g3" "-O2" "-Werror" "-pedantic" "-Wmost" "-w" "-ansi" "-std=c99" "-trigraphs" "-version" "-p" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-undef" "-fno-ident" "-o" "/tmp/OUTPUTNAME" "--param" "a=b" "-fno-builtin" "-fno-merge-constants" "-fprofile-arcs" "-ftest-coverage"' %t.log
diff --git a/test/Driver/darwin-debug-flags.c b/test/Driver/darwin-debug-flags.c
new file mode 100644
index 000000000000..7ce61378413a
--- /dev/null
+++ b/test/Driver/darwin-debug-flags.c
@@ -0,0 +1,11 @@
+// RUN: env RC_DEBUG_OPTIONS=1 %clang -ccc-host-triple i386-apple-darwin9 -g -Os %s -emit-llvm -S -o - | FileCheck %s
+// <rdar://problem/7256886>
+
+// CHECK: !1 = metadata !{
+// CHECK: -cc1
+// CHECK: -triple i386-apple-darwin9
+// CHECK: -g
+// CHECK: -Os
+// CHECK: [ DW_TAG_compile_unit ]
+
+int x;
diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c
index 04f35be09f1d..de751a67d965 100644
--- a/test/Driver/darwin-ld.c
+++ b/test/Driver/darwin-ld.c
@@ -1,26 +1,26 @@
// Check that ld gets arch_multiple.
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -arch i386 -arch x86_64 %s -### -o foo 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -arch i386 -arch x86_64 %s -### -o foo 2> %t.log
// RUN: grep '".*ld.*" .*"-arch_multiple" "-final_output" "foo"' %t.log
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -filelist FOO -static 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -filelist FOO -static 2> %t.log
// RUN: grep '"-lcrt0.o" .*"-lgcc_static"' %t.log
// RUN: grep '"-lgcc"' %t.log | count 0
-// RUN: clang -ccc-host-triple i386-apple-darwin7 -### -filelist FOO 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin7 -### -filelist FOO 2> %t.log
// RUN: grep '"-lcrt1.o" .*"-lgcc" "-lSystem"' %t.log
// RUN: grep '"-lgcc_s"' %t.log | count 0
-// RUN: clang -ccc-host-triple i386-apple-darwin8 -### -filelist FOO 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin8 -### -filelist FOO 2> %t.log
// RUN: grep '"-lcrt1.o" .*"-lgcc_s.10.4" "-lgcc" "-lSystem"' %t.log
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -filelist FOO 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -filelist FOO 2> %t.log
// RUN: grep '"-lcrt1.10.5.o" .*"-lgcc_s.10.5" "-lgcc" "-lSystem"' %t.log
-// RUN: clang -ccc-host-triple i386-apple-darwin10 -### -filelist FOO 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin10 -### -filelist FOO 2> %t.log
// RUN: grep '"-lcrt1.10.6.o" .*"-lSystem" "-lgcc"' %t.log
// RUN: grep '"-lgcc_s"' %t.log | count 0
// Make sure we run dsymutil on source input files.
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -g %s -o BAR 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -g %s -o BAR 2> %t.log
// RUN: grep '".*dsymutil" "BAR"' %t.log
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -g -filelist FOO %s -o BAR 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -g -filelist FOO %s -o BAR 2> %t.log
// RUN: grep '".*dsymutil" "BAR"' %t.log
// Splatter test case. This is gross, but it works for now. For the
@@ -32,11 +32,11 @@
//
// Note that at conception, this exactly matches gcc.
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -A ARG0 -F ARG1 -L ARG2 -Mach -T ARG4 -X -Z -all_load -allowable_client ARG8 -bind_at_load -compatibility_version ARG11 -current_version ARG12 -d -dead_strip -dylib_file ARG14 -dylinker -dylinker_install_name ARG16 -dynamic -dynamiclib -e ARG19 -exported_symbols_list ARG20 -fexceptions -flat_namespace -fnested-functions -fopenmp -force_cpusubtype_ALL -fpie -fprofile-arcs -headerpad_max_install_names -image_base ARG29 -init ARG30 -install_name ARG31 -m ARG33 -miphoneos-version-min=2.0 -mmacosx-version-min=10.3.2 -multi_module -multiply_defined ARG37 -multiply_defined_unused ARG38 -no_dead_strip_inits_and_terms -nodefaultlibs -nofixprebinding -nomultidefs -noprebind -noseglinkedit -nostartfiles -nostdlib -pagezero_size ARG54 -pg -prebind -prebind_all_twolevel_modules -preload -r -read_only_relocs ARG55 -s -sectalign ARG57_0 ARG57_1 ARG57_2 -sectcreate ARG58_0 ARG58_1 ARG58_2 -sectobjectsymbols ARG59_0 ARG59_1 -sectorder ARG60_0 ARG60_1 ARG60_2 -seg1addr ARG61 -seg_addr_table ARG62 -seg_addr_table_filename ARG63 -segaddr ARG64_0 ARG64_1 -segcreate ARG65_0 ARG65_1 ARG65_2 -seglinkedit -segprot ARG67_0 ARG67_1 ARG67_2 -segs_read_FOO -segs_read_only_addr ARG69 -segs_read_write_addr ARG70 -shared-libgcc -single_module -static -static-libgcc -sub_library ARG77 -sub_umbrella ARG78 -t -twolevel_namespace -twolevel_namespace_hints -u ARG82 -umbrella ARG83 -undefined ARG84 -unexported_symbols_list ARG85 -w -weak_reference_mismatches ARG87 -whatsloaded -whyload -y -filelist FOO 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -A ARG0 -F ARG1 -L ARG2 -Mach -T ARG4 -X -Z -all_load -allowable_client ARG8 -bind_at_load -compatibility_version ARG11 -current_version ARG12 -d -dead_strip -dylib_file ARG14 -dylinker -dylinker_install_name ARG16 -dynamic -dynamiclib -e ARG19 -exported_symbols_list ARG20 -fexceptions -flat_namespace -fnested-functions -fopenmp -force_cpusubtype_ALL -fpie -fprofile-arcs -headerpad_max_install_names -image_base ARG29 -init ARG30 -install_name ARG31 -m ARG33 -miphoneos-version-min=2.0 -mmacosx-version-min=10.3.2 -multi_module -multiply_defined ARG37 -multiply_defined_unused ARG38 -no_dead_strip_inits_and_terms -nodefaultlibs -nofixprebinding -nomultidefs -noprebind -noseglinkedit -nostartfiles -nostdlib -pagezero_size ARG54 -pg -prebind -prebind_all_twolevel_modules -preload -r -read_only_relocs ARG55 -s -sectalign ARG57_0 ARG57_1 ARG57_2 -sectcreate ARG58_0 ARG58_1 ARG58_2 -sectobjectsymbols ARG59_0 ARG59_1 -sectorder ARG60_0 ARG60_1 ARG60_2 -seg1addr ARG61 -seg_addr_table ARG62 -seg_addr_table_filename ARG63 -segaddr ARG64_0 ARG64_1 -segcreate ARG65_0 ARG65_1 ARG65_2 -seglinkedit -segprot ARG67_0 ARG67_1 ARG67_2 -segs_read_FOO -segs_read_only_addr ARG69 -segs_read_write_addr ARG70 -shared-libgcc -single_module -static -static-libgcc -sub_library ARG77 -sub_umbrella ARG78 -t -twolevel_namespace -twolevel_namespace_hints -u ARG82 -umbrella ARG83 -undefined ARG84 -unexported_symbols_list ARG85 -w -weak_reference_mismatches ARG87 -whatsloaded -whyload -y -filelist FOO 2> %t.log
// RUN: grep '".*ld.*" "-static" "-dylib" "-dylib_compatibility_version" "ARG11" "-dylib_current_version" "ARG12" "-arch" "i386" "-dylib_install_name" "ARG31" "-all_load" "-allowable_client" "ARG8" "-bind_at_load" "-dead_strip" "-no_dead_strip_inits_and_terms" "-dylib_file" "ARG14" "-dynamic" "-exported_symbols_list" "ARG20" "-flat_namespace" "-headerpad_max_install_names" "-image_base" "ARG29" "-init" "ARG30" "-macosx_version_min" "10.3.2" "-iphoneos_version_min" "2.0" "-nomultidefs" "-multi_module" "-single_module" "-multiply_defined" "ARG37" "-multiply_defined_unused" "ARG38" "-pie" "-prebind" "-noprebind" "-nofixprebinding" "-prebind_all_twolevel_modules" "-read_only_relocs" "ARG55" "-sectcreate" "ARG58_0" "ARG58_1" "ARG58_2" "-sectorder" "ARG60_0" "ARG60_1" "ARG60_2" "-seg1addr" "ARG61" "-segprot" "ARG67_0" "ARG67_1" "ARG67_2" "-segaddr" "ARG64_0" "ARG64_1" "-segs_read_only_addr" "ARG69" "-segs_read_write_addr" "ARG70" "-seg_addr_table" "ARG62" "-seg_addr_table_filename" "ARG63" "-sub_library" "ARG77" "-sub_umbrella" "ARG78" "-twolevel_namespace" "-twolevel_namespace_hints" "-umbrella" "ARG83" "-undefined" "ARG84" "-unexported_symbols_list" "ARG85" "-weak_reference_mismatches" "ARG87" "-X" "-y" "-w" "-pagezero_size" "ARG54" "-segs_read_FOO" "-seglinkedit" "-noseglinkedit" "-sectalign" "ARG57_0" "ARG57_1" "ARG57_2" "-sectobjectsymbols" "ARG59_0" "ARG59_1" "-segcreate" "ARG65_0" "ARG65_1" "ARG65_2" "-whyload" "-whatsloaded" "-dylinker_install_name" "ARG16" "-dylinker" "-Mach" "-d" "-s" "-t" "-Z" "-u" "ARG82" "-undefined" "ARG84" "-A" "ARG0" "-e" "ARG19" "-m" "ARG33" "-r" "-o" "a.out" "-L" "ARG2" "-lgomp" "-L/usr/lib/i686-apple-darwin.*/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin.*/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin.*/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin.*/4.2.1/../../../i686-apple-darwin.*/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin.*/4.2.1/../../.." "-filelist" "FOO" "-lgcov" "-allow_stack_execute" "-T" "ARG4" "-F" "ARG1"' %t.log
// Don't run dsymutil on a fat build of an executable.
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -arch i386 -arch x86_64 -g %s 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch i386 -arch x86_64 -g %s 2> %t.log
// RUN: grep dsymutil %t.log | count 0
diff --git a/test/Driver/darwin-version.c b/test/Driver/darwin-version.c
index dd6905a58961..e69a8447c4a7 100644
--- a/test/Driver/darwin-version.c
+++ b/test/Driver/darwin-version.c
@@ -1,4 +1,4 @@
-// RUN: env MACOSX_DEPLOYMENT_TARGET=10.1 clang -ccc-host-triple i386-apple-darwin9 -E %s
+// RUN: env MACOSX_DEPLOYMENT_TARGET=10.1 %clang -ccc-host-triple i386-apple-darwin9 -E %s
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010
#error Invalid version
diff --git a/test/Driver/default-toolchain.c b/test/Driver/default-toolchain.c
index 9cebdfe581fe..eeff7637b20e 100644
--- a/test/Driver/default-toolchain.c
+++ b/test/Driver/default-toolchain.c
@@ -1,8 +1,8 @@
-// RUN: clang -ccc-host-triple i386-unknown-unknown -m64 -v 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -m64 -v 2> %t
// RUN: grep 'Target: x86_64-unknown-unknown' %t
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -arch ppc -m64 -v 2> %t
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -arch ppc -m64 -v 2> %t
// RUN: grep 'Target: powerpc64-apple-darwin9' %t
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -arch ppc64 -m32 -v 2> %t
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -arch ppc64 -m32 -v 2> %t
// RUN: grep 'Target: powerpc-apple-darwin9' %t
diff --git a/test/Driver/dragonfly.c b/test/Driver/dragonfly.c
index 2eb3b1808ee8..d7b954d586d7 100644
--- a/test/Driver/dragonfly.c
+++ b/test/Driver/dragonfly.c
@@ -1,4 +1,4 @@
-// RUN: clang -ccc-host-triple amd64-pc-dragonfly %s -### 2> %t.log
+// RUN: %clang -ccc-host-triple amd64-pc-dragonfly %s -### 2> %t.log
// RUN: FileCheck -input-file %t.log %s
// CHECK: clang{{.*}}" "-cc1" "-triple" "amd64-pc-dragonfly"
diff --git a/test/Driver/emit-llvm.c b/test/Driver/emit-llvm.c
index 27007c68c2fe..3439b58d85d7 100644
--- a/test/Driver/emit-llvm.c
+++ b/test/Driver/emit-llvm.c
@@ -1,3 +1,13 @@
-// RUN: not clang -ccc-host-triple i386-pc-linux-gnu -emit-llvm -o %t %s 2> %t.log
+// RUN: not %clang -ccc-host-triple i386-pc-linux-gnu -emit-llvm -o %t %s 2> %t.log
// RUN: grep 'unable to pass LLVM bit-code files to linker' %t.log
+// Check that -O4 is only honored as the effective -O option.
+// <rdar://problem/7046672> clang/loader problem
+
+// RUN: %clang -ccc-print-phases -c -O4 -O0 %s 2> %t
+// RUN: FileCheck --check-prefix=O4_AND_O0 %s < %t
+
+// O4_AND_O0: 0: input, "{{.*}}", c
+// O4_AND_O0: 1: preprocessor, {0}, cpp-output
+// O4_AND_O0: 2: compiler, {1}, assembler
+// O4_AND_O0: 3: assembler, {2}, object
diff --git a/test/Driver/flags.c b/test/Driver/flags.c
index bc50aae33870..6d80892da65a 100644
--- a/test/Driver/flags.c
+++ b/test/Driver/flags.c
@@ -1,9 +1,9 @@
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -S -msoft-float %s 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -S -msoft-float %s 2> %t.log
// RUN: grep '"-no-implicit-float"' %t.log
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -S -msoft-float -mno-soft-float %s 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -S -msoft-float -mno-soft-float %s 2> %t.log
// RUN: grep '"-no-implicit-float"' %t.log | count 0
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -### -S -mno-soft-float %s -msoft-float 2> %t.log
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -S -mno-soft-float %s -msoft-float 2> %t.log
// RUN: grep '"-no-implicit-float"' %t.log
diff --git a/test/Driver/freebsd.c b/test/Driver/freebsd.c
index 9700540f46bb..3deee46f9a01 100644
--- a/test/Driver/freebsd.c
+++ b/test/Driver/freebsd.c
@@ -1,4 +1,4 @@
-// RUN: clang -ccc-clang-archs "" -ccc-host-triple powerpc64-pc-freebsd8 %s -### 2> %t.log
+// RUN: %clang -ccc-clang-archs "" -ccc-host-triple powerpc64-pc-freebsd8 %s -### 2> %t.log
// RUN: cat %t.log
// RUN: FileCheck -input-file %t.log %s
diff --git a/test/Driver/hello.c b/test/Driver/hello.c
index e1b6f1a0fd7a..da628724d6d9 100644
--- a/test/Driver/hello.c
+++ b/test/Driver/hello.c
@@ -1,4 +1,4 @@
-// RUN: clang -ccc-echo -o %t %s 2> %t.log
+// RUN: %clang -ccc-echo -o %t %s 2> %t.log
// Make sure we used clang.
// RUN: grep 'clang" -cc1 .*hello.c' %t.log
diff --git a/test/Driver/immediate-options.c b/test/Driver/immediate-options.c
index 923c30ea95ce..5a3ec872b4fe 100644
--- a/test/Driver/immediate-options.c
+++ b/test/Driver/immediate-options.c
@@ -1,4 +1,4 @@
-// RUN: clang --help
-// RUN: clang --help-hidden
-// RUN: clang -dumpversion
-// RUN: clang -print-search-dirs
+// RUN: %clang --help
+// RUN: %clang --help-hidden
+// RUN: %clang -dumpversion
+// RUN: %clang -print-search-dirs
diff --git a/test/Driver/lto.c b/test/Driver/lto.c
index 041b42461808..4543ffcd023e 100644
--- a/test/Driver/lto.c
+++ b/test/Driver/lto.c
@@ -1,12 +1,12 @@
// -emit-llvm, -flto, and -O4 all cause a switch to llvm-bc object
// files.
-// RUN: clang -ccc-print-phases -c %s -flto 2> %t.log
+// RUN: %clang -ccc-print-phases -c %s -flto 2> %t.log
// RUN: grep '2: compiler, {1}, llvm-bc' %t.log
-// RUN: clang -ccc-print-phases -c %s -O4 2> %t.log
+// RUN: %clang -ccc-print-phases -c %s -O4 2> %t.log
// RUN: grep '2: compiler, {1}, llvm-bc' %t.log
// and -emit-llvm doesn't alter pipeline (unfortunately?).
-// RUN: clang -ccc-print-phases %s -emit-llvm 2> %t.log
+// RUN: %clang -ccc-print-phases %s -emit-llvm 2> %t.log
// RUN: grep '0: input, ".*lto.c", c' %t.log
// RUN: grep '1: preprocessor, {0}, cpp-output' %t.log
// RUN: grep '2: compiler, {1}, llvm-bc' %t.log
@@ -14,11 +14,11 @@
// llvm-bc and llvm-ll outputs need to match regular suffixes
// (unfortunately).
-// RUN: clang %s -emit-llvm -save-temps -### 2> %t.log
+// RUN: %clang %s -emit-llvm -save-temps -### 2> %t.log
// RUN: grep '"-o" ".*lto\.i" "-x" "c" ".*lto\.c"' %t.log
// RUN: grep '"-o" ".*lto\.o" .*".*lto\.i"' %t.log
// RUN: grep '".*a.out" .*".*lto\.o"' %t.log
-// RUN: clang %s -emit-llvm -S -### 2> %t.log
+// RUN: %clang %s -emit-llvm -S -### 2> %t.log
// RUN: grep '"-o" ".*lto\.s" "-x" "c" ".*lto\.c"' %t.log
diff --git a/test/Driver/openbsd.c b/test/Driver/openbsd.c
index 97ba30bb69c2..6024461069a1 100644
--- a/test/Driver/openbsd.c
+++ b/test/Driver/openbsd.c
@@ -1,4 +1,4 @@
-// RUN: clang -ccc-clang-archs "" -ccc-host-triple i686-pc-openbsd %s -### 2> %t.log
+// RUN: %clang -ccc-clang-archs "" -ccc-host-triple i686-pc-openbsd %s -### 2> %t.log
// RUN: FileCheck -input-file %t.log %s
// CHECK: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
diff --git a/test/Driver/parsing.c b/test/Driver/parsing.c
index 48b9d6a23f1f..ca3a7f44fd8e 100644
--- a/test/Driver/parsing.c
+++ b/test/Driver/parsing.c
@@ -1,4 +1,4 @@
-// RUN: clang -ccc-print-options input -Yunknown -m32 -arch ppc -djoined -A separate -Ajoined -Wp,one,two -Xarch_joined AndSeparate -sectalign 1 2 3 2> %t
+// RUN: %clang -ccc-print-options input -Yunknown -m32 -arch ppc -djoined -A separate -Ajoined -Wp,one,two -Xarch_joined AndSeparate -sectalign 1 2 3 2> %t
// RUN: grep 'Option 0 - Name: "-ccc-print-options", Values: {}' %t
// RUN: grep 'Option 1 - Name: "<input>", Values: {"input"}' %t
// RUN: grep 'Option 2 - Name: "<unknown>", Values: {"-Yunknown"}' %t
@@ -11,13 +11,13 @@
// RUN: grep 'Option 9 - Name: "-Xarch_", Values: {"joined", "AndSeparate"}' %t
// RUN: grep 'Option 10 - Name: "-sectalign", Values: {"1", "2", "3"}' %t
-// RUN: not clang -V 2> %t
+// RUN: not %clang -V 2> %t
// RUN: grep "error: argument to '-V' is missing (expected 1 value)" %t
-// RUN: not clang -sectalign 1 2 2> %t
+// RUN: not %clang -sectalign 1 2 2> %t
// RUN: grep "error: argument to '-sectalign' is missing (expected 3 values)" %t
// Verify that search continues after find the first option.
-// RUN: clang -ccc-print-options -Wally 2> %t
+// RUN: %clang -ccc-print-options -Wally 2> %t
// RUN: grep 'Option 0 - Name: "-ccc-print-options", Values: {}' %t
// RUN: grep 'Option 1 - Name: "-W", Values: {"ally"}' %t
diff --git a/test/Driver/phases.c b/test/Driver/phases.c
index d03bff9a77b1..7fe529c51a93 100644
--- a/test/Driver/phases.c
+++ b/test/Driver/phases.c
@@ -1,5 +1,5 @@
// Basic compilation for various types of files.
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -x c %s -x objective-c %s -x c++ %s -x objective-c++ -x assembler %s -x assembler-with-cpp %s -x none %s 2>&1 | FileCheck -check-prefix=BASIC %s
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -x c %s -x objective-c %s -x c++ %s -x objective-c++ -x assembler %s -x assembler-with-cpp %s -x none %s 2>&1 | FileCheck -check-prefix=BASIC %s
// BASIC: 0: input, "{{.*}}phases.c", c
// BASIC: 1: preprocessor, {0}, cpp-output
// BASIC: 2: compiler, {1}, assembler
@@ -24,7 +24,7 @@
// BASIC: 21: linker, {3, 7, 11, 13, 16, 20}, image
// Universal linked image.
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=ULI %s
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=ULI %s
// ULI: 0: input, "{{.*}}phases.c", c
// ULI: 1: preprocessor, {0}, cpp-output
// ULI: 2: compiler, {1}, assembler
@@ -35,7 +35,7 @@
// ULI: 7: lipo, {5, 6}, image
// Universal object file.
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=UOF %s
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=UOF %s
// UOF: 0: input, "{{.*}}phases.c", c
// UOF: 1: preprocessor, {0}, cpp-output
// UOF: 2: compiler, {1}, assembler
@@ -45,33 +45,33 @@
// UOF: 6: lipo, {4, 5}, object
// Arch defaulting
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH1 %s
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH1 %s
// ARCH1: 2: bind-arch, "i386", {1}, object
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s -m32 -m64 2>&1 | FileCheck -check-prefix=ARCH2 %s
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s -m32 -m64 2>&1 | FileCheck -check-prefix=ARCH2 %s
// ARCH2: 2: bind-arch, "x86_64", {1}, object
-// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH3 %s
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH3 %s
// ARCH3: 2: bind-arch, "x86_64", {1}, object
-// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s -m64 -m32 2>&1 | FileCheck -check-prefix=ARCH4 %s
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s -m64 -m32 2>&1 | FileCheck -check-prefix=ARCH4 %s
// ARCH4: 2: bind-arch, "i386", {1}, object
// Analyzer
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases --analyze %s 2>&1 | FileCheck -check-prefix=ANALYZE %s
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases --analyze %s 2>&1 | FileCheck -check-prefix=ANALYZE %s
// ANALYZE: 0: input, "{{.*}}phases.c", c
// ANALYZE: 1: preprocessor, {0}, cpp-output
// ANALYZE: 2: analyzer, {1}, plist
// Precompiler
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -x c-header %s 2>&1 | FileCheck -check-prefix=PCH %s
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -x c-header %s 2>&1 | FileCheck -check-prefix=PCH %s
// PCH: 0: input, "{{.*}}phases.c", c-header
// PCH: 1: preprocessor, {0}, c-header-cpp-output
// PCH: 2: precompiler, {1}, precompiled-header
// Darwin overrides the handling for .s
// RUN: touch %t.s
-// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN1 %s
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN1 %s
// DARWIN1: 0: input, "{{.*}}.s", assembler
// DARWIN1: 1: assembler, {0}, object
-// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN2 %s
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN2 %s
// DARWIN2: 0: input, "{{.*}}.s", assembler-with-cpp
// DARWIN2: 1: preprocessor, {0}, assembler
// DARWIN2: 2: assembler, {1}, object
diff --git a/test/Driver/preprocessor.c b/test/Driver/preprocessor.c
index 51b6fc57867e..09c1f6c29cc6 100644
--- a/test/Driver/preprocessor.c
+++ b/test/Driver/preprocessor.c
@@ -1,4 +1,4 @@
-// RUN: clang -E -x c-header %s > %t
+// RUN: %clang -E -x c-header %s > %t
// RUN: grep 'B B' %t
#define A B
diff --git a/test/Driver/pth.c b/test/Driver/pth.c
index 938675a900d8..9c47c5599376 100644
--- a/test/Driver/pth.c
+++ b/test/Driver/pth.c
@@ -1,12 +1,12 @@
// Test transparent PTH support.
-// RUN: clang -ccc-pch-is-pth -x c-header %s -o %t.h.pth -### 2> %t.log
+// RUN: %clang -ccc-pch-is-pth -x c-header %s -o %t.h.pth -### 2> %t.log
// RUN: FileCheck -check-prefix CHECK1 -input-file %t.log %s
// CHECK1: "{{.*}}/clang{{.*}}" "-cc1" {{.*}} "-o" "{{.*}}.h.pth" "-x" "c-header" "{{.*}}pth.c"
// RUN: touch %t.h.pth
-// RUN: clang -ccc-pch-is-pth -E -include %t.h %s -### 2> %t.log
+// RUN: %clang -ccc-pch-is-pth -E -include %t.h %s -### 2> %t.log
// RUN: FileCheck -check-prefix CHECK2 -input-file %t.log %s
// CHECK2: "{{.*}}/clang{{.*}}" "-cc1" {{.*}}"-include-pth" "{{.*}}.h.pth" {{.*}}"-x" "c" "{{.*}}pth.c"
diff --git a/test/Driver/qa_override.c b/test/Driver/qa_override.c
index 822410659ead..5f96976ee98e 100644
--- a/test/Driver/qa_override.c
+++ b/test/Driver/qa_override.c
@@ -1,4 +1,4 @@
-// RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-ccc-print-options " clang x -O2 b -O3 2>&1 | FileCheck %s
+// RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-ccc-print-options " %clang x -O2 b -O3 2>&1 | FileCheck %s
// CHECK-NOT: ###
// CHECK: Option 0 - Name: "-ccc-print-options", Values: {}
// CHECK-NEXT: Option 1 - Name: "<input>", Values: {"x"}
diff --git a/test/Driver/redzone.c b/test/Driver/redzone.c
index 86f412fb4690..9f117d0489bd 100644
--- a/test/Driver/redzone.c
+++ b/test/Driver/redzone.c
@@ -1,6 +1,6 @@
-// RUN: clang -ccc-host-triple i386-unknown-unknown -mno-red-zone %s -S -emit-llvm -o %t.log
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -mno-red-zone %s -S -emit-llvm -o %t.log
// RUN: grep 'noredzone' %t.log
-// RUN: clang -ccc-host-triple i386-unknown-unknown -mred-zone %s -S -emit-llvm -o %t.log
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -mred-zone %s -S -emit-llvm -o %t.log
// RUN: grep -v 'noredzone' %t.log
int foo() { return 42; }
diff --git a/test/Driver/std.c b/test/Driver/std.c
index 01a5f7ccec25..c82e9f15c7da 100644
--- a/test/Driver/std.c
+++ b/test/Driver/std.c
@@ -1,8 +1,8 @@
-// RUN: clang -std=c99 -trigraphs -std=gnu99 %s -E -o - | FileCheck -check-prefix=OVERRIDE %s
+// RUN: %clang -std=c99 -trigraphs -std=gnu99 %s -E -o - | FileCheck -check-prefix=OVERRIDE %s
// OVERRIDE: ??(??)
-// RUN: clang -ansi %s -E -o - | FileCheck -check-prefix=ANSI %s
+// RUN: %clang -ansi %s -E -o - | FileCheck -check-prefix=ANSI %s
// ANSI: []
-// RUN: clang -std=gnu99 -trigraphs %s -E -o - | FileCheck -check-prefix=EXPLICIT %s
+// RUN: %clang -std=gnu99 -trigraphs %s -E -o - | FileCheck -check-prefix=EXPLICIT %s
// EXPLICIT: []
??(??)
diff --git a/test/Driver/unknown-gcc-arch.c b/test/Driver/unknown-gcc-arch.c
index e8b653fbceab..7018bf839d02 100644
--- a/test/Driver/unknown-gcc-arch.c
+++ b/test/Driver/unknown-gcc-arch.c
@@ -1,8 +1,8 @@
-// RUN: clang -ccc-host-triple x86_64-unknown-unknown -c -x assembler %s -### 2> %t.log
+// RUN: %clang -ccc-host-triple x86_64-unknown-unknown -c -x assembler %s -### 2> %t.log
// RUN: grep '.*gcc.*"-m64"' %t.log
-// RUN: clang -ccc-host-triple x86_64-unknown-unknown -c -x assembler %s -### -m32 2> %t.log
+// RUN: %clang -ccc-host-triple x86_64-unknown-unknown -c -x assembler %s -### -m32 2> %t.log
// RUN: grep '.*gcc.*"-m32"' %t.log
-// RUN: clang -ccc-host-triple i386-unknown-unknown -c -x assembler %s -### 2> %t.log
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -c -x assembler %s -### 2> %t.log
// RUN: grep '.*gcc.*"-m32"' %t.log
-// RUN: clang -ccc-host-triple i386-unknown-unknown -c -x assembler %s -### -m64 2> %t.log
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -c -x assembler %s -### -m64 2> %t.log
// RUN: grep '.*gcc.*"-m64"' %t.log
diff --git a/test/Driver/x86_features.c b/test/Driver/x86_features.c
index d0473b38bb1e..9dbdd0ae90b4 100644
--- a/test/Driver/x86_features.c
+++ b/test/Driver/x86_features.c
@@ -1,3 +1,3 @@
-// RUN: clang -ccc-host-triple i386-unknown-unknown -### -S %s -msse -msse4 -mno-sse -mno-mmx -msse 2> %t
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -### -S %s -msse -msse4 -mno-sse -mno-mmx -msse 2> %t
// RUN: grep '"-target-feature" "+sse" "-target-feature" "+sse4" "-target-feature" "-sse" "-target-feature" "-mmx" "-target-feature" "+sse"' %t
diff --git a/test/FixIt/fixit-at.c b/test/FixIt/fixit-at.c
index 5eaa5c346926..c32aee9ea174 100644
--- a/test/FixIt/fixit-at.c
+++ b/test/FixIt/fixit-at.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fixit-at=fixit-at.c:3:1 %s -o - | clang-cc -verify -x c -
+// RUN: %clang_cc1 -fixit-at=fixit-at.c:3:1 %s -o - | %clang_cc1 -verify -x c -
_Complex cd;
diff --git a/test/FixIt/fixit-c90.c b/test/FixIt/fixit-c90.c
index 7036b08022c0..e84733f49dbc 100644
--- a/test/FixIt/fixit-c90.c
+++ b/test/FixIt/fixit-c90.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -std=c90 -pedantic -fixit %s -o - | clang-cc -pedantic -x c -std=c90 -Werror -
+/* RUN: %clang_cc1 -std=c90 -pedantic -fixit %s -o - | %clang_cc1 -pedantic -x c -std=c90 -Werror -
*/
/* This is a test of the various code modification hints that are
diff --git a/test/FixIt/fixit-cxx0x.cpp b/test/FixIt/fixit-cxx0x.cpp
index 2c783bc2e33a..3694b9db1af3 100644
--- a/test/FixIt/fixit-cxx0x.cpp
+++ b/test/FixIt/fixit-cxx0x.cpp
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -std=c++0x -fixit %s -o - | clang-cc -x c++ -std=c++0x -
+/* RUN: %clang_cc1 -std=c++0x -fixit %s -o - | %clang_cc1 -x c++ -std=c++0x -
*/
/* This is a test of the various code modification hints that only
diff --git a/test/FixIt/fixit-errors-1.c b/test/FixIt/fixit-errors-1.c
index 968d1d23151c..ecad53ceb83d 100644
--- a/test/FixIt/fixit-errors-1.c
+++ b/test/FixIt/fixit-errors-1.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -pedantic -Werror -x c -
+// RUN: %clang_cc1 -pedantic -fixit %s -o - | %clang_cc1 -pedantic -Werror -x c -
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
diff --git a/test/FixIt/fixit-errors.c b/test/FixIt/fixit-errors.c
index 030f505e610e..7bf9a58430f1 100644
--- a/test/FixIt/fixit-errors.c
+++ b/test/FixIt/fixit-errors.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -pedantic -Werror -x c -
+// RUN: %clang_cc1 -pedantic -fixit %s -o - | %clang_cc1 -pedantic -Werror -x c -
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
diff --git a/test/FixIt/fixit-objc.m b/test/FixIt/fixit-objc.m
index cdf2057290e3..665ac74441ae 100644
--- a/test/FixIt/fixit-objc.m
+++ b/test/FixIt/fixit-objc.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -pedantic -fixit %s -o %t
-// RUN: clang -cc1 -pedantic -x objective-c %t -verify
+// RUN: %clang_cc1 -pedantic -fixit %s -o %t
+// RUN: %clang_cc1 -pedantic -x objective-c %t -verify
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
diff --git a/test/FixIt/fixit-pmem.cpp b/test/FixIt/fixit-pmem.cpp
index f938009b9030..0926309a9ab8 100644
--- a/test/FixIt/fixit-pmem.cpp
+++ b/test/FixIt/fixit-pmem.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -fsyntax-only -pedantic -Werror -x c++ -
+// RUN: %clang_cc1 -pedantic -fixit %s -o - | %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ -
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
diff --git a/test/FixIt/fixit.c b/test/FixIt/fixit.c
index 4a32682be052..83d724dffc01 100644
--- a/test/FixIt/fixit.c
+++ b/test/FixIt/fixit.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -pedantic -fixit %s -o - | grep -v 'CHECK' > %t
-// RUN: clang-cc -pedantic -Werror -x c -
+// RUN: %clang_cc1 -pedantic -fixit %s -o - | grep -v 'CHECK' > %t
+// RUN: %clang_cc1 -pedantic -Werror -x c -
// RUN: FileCheck -input-file=%t %s
/* This is a test of the various code modification hints that are
diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp
index dac1fa03de37..04b99c941654 100644
--- a/test/FixIt/fixit.cpp
+++ b/test/FixIt/fixit.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -fsyntax-only -pedantic -Werror -x c++ -
+// RUN: %clang_cc1 -pedantic -fixit %s -o - | %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ -
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
diff --git a/test/FixIt/typo.c b/test/FixIt/typo.c
new file mode 100644
index 000000000000..07775517809f
--- /dev/null
+++ b/test/FixIt/typo.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fixit -o - | %clang_cc1 -fsyntax-only -pedantic -Werror -x c -
+struct Point {
+ float x, y;
+};
+
+struct Rectangle {
+ struct Point top_left, bottom_right;
+};
+
+enum Color { Red, Green, Blue };
+
+struct Window {
+ struct Rectangle bounds;
+ enum Color color;
+};
+
+struct Window window = {
+ .bunds. // expected-error{{field designator 'bunds' does not refer to any field in type 'struct Window'; did you mean 'bounds'?}}
+ topleft.x = 3.14, // expected-error{{field designator 'topleft' does not refer to any field in type 'struct Rectangle'; did you mean 'top_left'?}}
+ 2.71818, 5.0, 6.0, Red
+};
diff --git a/test/FixIt/typo.cpp b/test/FixIt/typo.cpp
new file mode 100644
index 000000000000..12bfc712f3ee
--- /dev/null
+++ b/test/FixIt/typo.cpp
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fixit -o - | %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ -
+namespace std {
+ template<typename T> class basic_string {
+ int find(const char *substr);
+ static const int npos = -1;
+ };
+
+ typedef basic_string<char> string;
+}
+
+namespace otherstd {
+ using namespace std;
+}
+
+using namespace std;
+
+other_std::strng str1; // expected-error{{use of undeclared identifier 'other_std'; did you mean 'otherstd'?}} \
+// expected-error{{no type named 'strng' in namespace 'otherstd'; did you mean 'string'?}}
+tring str2; // expected-error{{unknown type name 'tring'; did you mean 'string'?}}
+
+::other_std::string str3; // expected-error{{no member named 'other_std' in the global namespace; did you mean 'otherstd'?}}
+
+float area(float radius, float pi) {
+ return radious * pi; // expected-error{{use of undeclared identifier 'radious'; did you mean 'radius'?}}
+}
+
+bool test_string(std::string s) {
+ basc_string<char> b1; // expected-error{{no template named 'basc_string'; did you mean 'basic_string'?}}
+ std::basic_sting<char> b2; // expected-error{{no template named 'basic_sting' in namespace 'std'; did you mean 'basic_string'?}}
+ (void)b1;
+ (void)b2;
+ return s.fnd("hello") // expected-error{{no member named 'fnd' in 'class std::basic_string<char>'; did you mean 'find'?}}
+ == std::string::pos; // expected-error{{no member named 'pos' in 'class std::basic_string<char>'; did you mean 'npos'?}}
+}
+
+struct Base { };
+struct Derived : public Base {
+ int member;
+
+ Derived() : base(), // expected-error{{initializer 'base' does not name a non-static data member or base class; did you mean the base class 'Base'?}}
+ ember() { } // expected-error{{initializer 'ember' does not name a non-static data member or base class; did you mean the member 'member'?}}
+};
diff --git a/test/FixIt/typo.m b/test/FixIt/typo.m
new file mode 100644
index 000000000000..251684949ef2
--- /dev/null
+++ b/test/FixIt/typo.m
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fixit -o - | %clang_cc1 -fsyntax-only -pedantic -Werror -x objective-c -
+
+@interface NSString
+@end
+
+void test() {
+ NSstring *str = @"A string"; // expected-error{{use of undeclared identifier 'NSstring'; did you mean 'NSString'?}}
+}
diff --git a/test/Frontend/ast-codegen.c b/test/Frontend/ast-codegen.c
index bd8a20adb69b..b5b2157e21ae 100644
--- a/test/Frontend/ast-codegen.c
+++ b/test/Frontend/ast-codegen.c
@@ -1,5 +1,5 @@
-// RUN: clang -emit-ast -o %t.ast %s
-// RUN: clang -emit-llvm -S -o - %t.ast | FileCheck %s
+// RUN: %clang -emit-ast -o %t.ast %s
+// RUN: %clang -emit-llvm -S -o - %t.ast | FileCheck %s
// CHECK: module asm "foo"
__asm__("foo");
diff --git a/test/Frontend/ast-main.c b/test/Frontend/ast-main.c
index ef072b92f9c1..43237a12ef59 100644
--- a/test/Frontend/ast-main.c
+++ b/test/Frontend/ast-main.c
@@ -1,6 +1,6 @@
-// RUN: clang -emit-llvm -S -o %t1.ll -x c - < %s
-// RUN: clang -emit-ast -o %t.ast %s
-// RUN: clang -emit-llvm -S -o %t2.ll -x ast - < %t.ast
+// RUN: %clang -emit-llvm -S -o %t1.ll -x c - < %s
+// RUN: %clang -emit-ast -o %t.ast %s
+// RUN: %clang -emit-llvm -S -o %t2.ll -x ast - < %t.ast
// RUN: diff %t1.ll %t2.ll
int main() {
diff --git a/test/Frontend/cpp-output.c b/test/Frontend/cpp-output.c
index 9a6fc9b21425..e44095b59902 100644
--- a/test/Frontend/cpp-output.c
+++ b/test/Frontend/cpp-output.c
@@ -1,7 +1,7 @@
-// RUN: clang -E -o %t -C %s
+// RUN: %clang -E -o %t -C %s
// RUN: grep '^int x; // comment' %t
// RUN: grep '^x x' %t
-// RUN: clang -E -o %t -CC %s
+// RUN: %clang -E -o %t -CC %s
// RUN: grep '^int x; // comment' %t
// RUN: grep '^x /\* comment \*/ x /\* comment \*/' %t
diff --git a/test/Frontend/darwin-version.c b/test/Frontend/darwin-version.c
index 4896aecdfae5..1c866ee09601 100644
--- a/test/Frontend/darwin-version.c
+++ b/test/Frontend/darwin-version.c
@@ -1,22 +1,22 @@
-// RUN: clang -ccc-host-triple armv6-apple-darwin9 -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple armv6-apple-darwin9 -dM -E -o %t %s
// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '30000' | count 1
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | count 0
-// RUN: clang -ccc-host-triple armv6-apple-darwin9 -miphoneos-version-min=2.0 -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple armv6-apple-darwin9 -miphoneos-version-min=2.0 -dM -E -o %t %s
// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20000' | count 1
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | count 0
-// RUN: clang -ccc-host-triple armv6-apple-darwin9 -miphoneos-version-min=2.2 -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple armv6-apple-darwin9 -miphoneos-version-min=2.2 -dM -E -o %t %s
// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20200' | count 1
-// RUN: clang -ccc-host-triple i686-apple-darwin8 -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple i686-apple-darwin8 -dM -E -o %t %s
// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | count 0
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1040' | count 1
-// RUN: clang -ccc-host-triple i686-apple-darwin9 -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple i686-apple-darwin9 -dM -E -o %t %s
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1050' | count 1
-// RUN: clang -ccc-host-triple i686-apple-darwin10 -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple i686-apple-darwin10 -dM -E -o %t %s
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1060' | count 1
-// RUN: clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.4 -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.4 -dM -E -o %t %s
// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | count 0
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1040' | count 1
-// RUN: clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.5 -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.5 -dM -E -o %t %s
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1050' | count 1
-// RUN: clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.6 -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.6 -dM -E -o %t %s
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1060' | count 1
diff --git a/test/Frontend/dependency-gen.c b/test/Frontend/dependency-gen.c
index 9185921407da..c85d60be73f8 100644
--- a/test/Frontend/dependency-gen.c
+++ b/test/Frontend/dependency-gen.c
@@ -1,8 +1,8 @@
// rdar://6533411
-// RUN: clang -MD -MF %t.d -S -x c -o %t.o %s
+// RUN: %clang -MD -MF %t.d -S -x c -o %t.o %s
// RUN: grep '.*dependency-gen.*:' %t.d
// RUN: grep 'dependency-gen.c' %t.d
-// RUN: clang -S -M -x c %s -o %t.d
+// RUN: %clang -S -M -x c %s -o %t.d
// RUN: grep '.*dependency-gen.*:' %t.d
// RUN: grep 'dependency-gen.c' %t.d
diff --git a/test/Frontend/output-failures.c b/test/Frontend/output-failures.c
index a8687c754a01..e2af7c7ddc90 100644
--- a/test/Frontend/output-failures.c
+++ b/test/Frontend/output-failures.c
@@ -1,4 +1,4 @@
-// RUN: not clang-cc -emit-llvm -o %S/doesnotexist/somename %s 2> %t
+// RUN: not %clang_cc1 -emit-llvm -o %S/doesnotexist/somename %s 2> %t
// RUN: FileCheck -check-prefix=OUTPUTFAIL -input-file=%t %s
// OUTPUTFAIL: Error opening output file '{{.*}}doesnotexist{{.*}}'
diff --git a/test/Frontend/rewrite-macros.c b/test/Frontend/rewrite-macros.c
index 1667925a2ba4..f44e545728e9 100644
--- a/test/Frontend/rewrite-macros.c
+++ b/test/Frontend/rewrite-macros.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -rewrite-macros -o %t %s
+// RUN: %clang_cc1 -verify -rewrite-macros -o %t %s
#define A(a,b) a ## b
diff --git a/test/Frontend/stdin.c b/test/Frontend/stdin.c
index 35fe45d35b40..2d0a2377f76d 100644
--- a/test/Frontend/stdin.c
+++ b/test/Frontend/stdin.c
@@ -1,3 +1,3 @@
-// RUN: clang-cc -E - < /dev/null > %t
+// RUN: %clang_cc1 -E - < /dev/null > %t
// RUN: grep '<built-in>' %t
diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m
index 12ae4f451620..5cccf9264c7f 100644
--- a/test/Index/TestClassDecl.m
+++ b/test/Index/TestClassDecl.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
// RUN: c-index-test -test-file-scan %t.ast %s | FileCheck -check-prefix=scan %s
// RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=load %s
diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m
index db9a1eb5c7af..e795972a7d13 100644
--- a/test/Index/TestClassForwardDecl.m
+++ b/test/Index/TestClassForwardDecl.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
// RUN: c-index-test -test-file-scan %t.ast %s | FileCheck -check-prefix=scan %s
// RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=load %s
diff --git a/test/Index/c-index-api-fn-scan.m b/test/Index/c-index-api-fn-scan.m
index 0350d87b39e4..8cbc036a5ca2 100644
--- a/test/Index/c-index-api-fn-scan.m
+++ b/test/Index/c-index-api-fn-scan.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
// RUN: c-index-test -test-load-tu %t.ast scan-function | FileCheck %s
diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m
index 446f588c4f9d..6ee50aef1e04 100644
--- a/test/Index/c-index-api-loadTU-test.m
+++ b/test/Index/c-index-api-loadTU-test.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
// RUN: c-index-test -test-load-tu %t.ast all | FileCheck %s
diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m
index d6081bc9de8c..23ae21887830 100644
--- a/test/Index/c-index-getCursor-test.m
+++ b/test/Index/c-index-getCursor-test.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
// RUN: c-index-test -test-file-scan %t.ast %s | FileCheck %s
@interface Foo
{
diff --git a/test/Index/c-index-pch.c b/test/Index/c-index-pch.c
index 1ce108525186..2037fc58802c 100644
--- a/test/Index/c-index-pch.c
+++ b/test/Index/c-index-pch.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -emit-pch -x c -o %t.pch %S/Inputs/c-index-pch.h
-// RUN: clang-cc -include-pch %t.pch -x c -emit-pch -o %t.ast %s
+// RUN: %clang_cc1 -emit-pch -x c -o %t.pch %S/Inputs/c-index-pch.h
+// RUN: %clang_cc1 -include-pch %t.pch -x c -emit-pch -o %t.ast %s
// RUN: c-index-test -test-load-tu %t.ast all | FileCheck -check-prefix=ALL %s
// RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=LOCAL %s
// ALL: FunctionDecl=foo
diff --git a/test/Index/cindex-from-source.m b/test/Index/cindex-from-source.m
index 8d6a1de4bbdc..e775bb71e11e 100644
--- a/test/Index/cindex-from-source.m
+++ b/test/Index/cindex-from-source.m
@@ -1,5 +1,5 @@
// RUN: echo 'typedef int t0;' > %t.pfx.h
-// RUN: clang -x objective-c-header %t.pfx.h -o %t.pfx.h.gch
+// RUN: %clang -x objective-c-header %t.pfx.h -o %t.pfx.h.gch
// RUN: c-index-test -test-load-source local %s -include %t.pfx.h > %t
// RUN: FileCheck %s < %t
// CHECK: cindex-from-source.m:{{.*}}:{{.*}}: StructDecl=s0:{{.*}}:{{.*}} [Context=cindex-from-source.m]
diff --git a/test/Index/code-completion.cpp b/test/Index/code-completion.cpp
index c286c82d0480..55d068a16694 100644
--- a/test/Index/code-completion.cpp
+++ b/test/Index/code-completion.cpp
@@ -33,20 +33,22 @@ void test_overloaded() {
overloaded(Z(), 0);
}
-// CHECK-MEMBER: FieldDecl:{TypedText member}
-// CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
-// CHECK-MEMBER: EnumConstantDecl:{Informative E::}{TypedText Val1}
-// CHECK-MEMBER: FunctionDecl:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )}
-// CHECK-MEMBER: FunctionDecl:{TypedText operator int}{LeftParen (}{RightParen )}
-// CHECK-MEMBER: FunctionDecl:{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )}
-// CHECK-MEMBER: FieldDecl:{Text X::}{TypedText member}
-// CHECK-MEMBER: FieldDecl:{Text Y::}{TypedText member}
-// CHECK-MEMBER: FunctionDecl:{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )}
-// CHECK-MEMBER: FunctionDecl:{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )}
+// CHECK-MEMBER: FieldDecl:{ResultType double}{TypedText member}
+// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
+// CHECK-MEMBER: EnumConstantDecl:{ResultType enum X::E}{Informative E::}{TypedText Val1}
+// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )}
+// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )}
+// CHECK-MEMBER: FunctionDecl:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )}
+// CHECK-MEMBER: FunctionDecl:{ResultType int}{TypedText operator int}{LeftParen (}{RightParen )}{Informative const}
+// CHECK-MEMBER: FunctionDecl:{ResultType struct Z &}{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )}
+// CHECK-MEMBER: FieldDecl:{ResultType int}{Text X::}{TypedText member}
+// CHECK-MEMBER: FieldDecl:{ResultType float}{Text Y::}{TypedText member}
+// CHECK-MEMBER: FunctionDecl:{ResultType struct X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )}
+// CHECK-MEMBER: FunctionDecl:{ResultType struct Y &}{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )}
// CHECK-MEMBER: StructDecl:{TypedText X}{Text ::}
// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::}
// CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::}
-// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )}
-// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
-// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}
+// CHECK-OVERLOAD: NotImplemented:{ResultType int &}{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )}
+// CHECK-OVERLOAD: NotImplemented:{ResultType float &}{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
+// CHECK-OVERLOAD: NotImplemented:{ResultType double &}{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}
diff --git a/test/Index/comments.c b/test/Index/comments.c
index 83bdbf6eed7d..034317779c6e 100644
--- a/test/Index/comments.c
+++ b/test/Index/comments.c
@@ -19,7 +19,7 @@ void g(int);
void h(int); ///< This is a member comment.
-// RUN: clang-cc -emit-pch -o %t.ast %s
+// RUN: %clang_cc1 -emit-pch -o %t.ast %s
// RUN: index-test %t.ast -point-at %s:11:6 > %t
// RUN: grep "starts here" %t
diff --git a/test/Index/complete-member-access.m b/test/Index/complete-member-access.m
index 9202d0522f4b..2502d7705b9c 100644
--- a/test/Index/complete-member-access.m
+++ b/test/Index/complete-member-access.m
@@ -23,8 +23,8 @@ void test_props(Int* ptr) {
}
// RUN: c-index-test -code-completion-at=%s:21:7 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: ObjCPropertyDecl:{TypedText prop1}
-// CHECK-CC1: ObjCPropertyDecl:{TypedText ProtoProp}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText prop1}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp}
// RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: ObjCIvarDecl:{TypedText IVar}
-// CHECK-CC2: ObjCIvarDecl:{TypedText SuperIVar}
+// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText IVar}
+// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText SuperIVar}
diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m
index 1c03095e2a01..a7b37fd2442c 100644
--- a/test/Index/complete-objc-message.m
+++ b/test/Index/complete-objc-message.m
@@ -95,6 +95,14 @@ void test_overload(Overload *ovl) {
[ovl Method:1 Arg1:1 OtherArg:ovl];
}
+@interface Ellipsis
+- (int)Method:(int)i, ...;
+@end
+
+void f(Ellipsis *e) {
+ [e Method:1, 2, 3];
+}
+
// RUN: c-index-test -code-completion-at=%s:23:19 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: {TypedText categoryClassMethod}
// CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)a}{Text withKeyword:}{Placeholder (int)b}
@@ -106,40 +114,42 @@ void test_overload(Overload *ovl) {
// CHECK-CC2: {TypedText instanceMethod1}
// CHECK-CC2: {TypedText protocolInstanceMethod:}{Placeholder (int)value}
// RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: ObjCClassMethodDecl:{TypedText MyClassMethod:}{Placeholder (id)obj}
-// CHECK-CC3: ObjCClassMethodDecl:{TypedText MyPrivateMethod}
+// CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)obj}
+// CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y}
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText MyPrivateInstMethod}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
-// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y}
-// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText MySubInstMethod}
+// CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y}
+// CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
// RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s
-// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText protocolInstanceMethod:}{Placeholder (int)value}
-// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText secondProtocolInstanceMethod}
+// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType id}{TypedText protocolInstanceMethod:}{Placeholder (int)value}
+// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType int}{TypedText secondProtocolInstanceMethod}
// RUN: c-index-test -code-completion-at=%s:95:8 %s | FileCheck -check-prefix=CHECK-CC7 %s
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method}
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (int)i}
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (float)f}{Text SomeArg:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText OtherMethod:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)i}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{Text SomeArg:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
// RUN: c-index-test -code-completion-at=%s:95:17 %s | FileCheck -check-prefix=CHECK-CC8 %s
-// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText }
-// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
-// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
-// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText SomeArg:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText }
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
// RUN: c-index-test -code-completion-at=%s:95:24 %s | FileCheck -check-prefix=CHECK-CC9 %s
-// CHECK-CC9: ObjCInstanceMethodDecl:{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)i2}
-// CHECK-CC9: ObjCInstanceMethodDecl:{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)obj}
+// CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)i2}
+// CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)obj}
// RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCA %s
-// CHECK-CCA: {TypedText _cmd}
-// CHECK-CCA: {TypedText self}
+// CHECK-CCA: {ResultType SEL}{TypedText _cmd}
+// CHECK-CCA: {ResultType Class}{TypedText self}
// CHECK-CCA: TypedefDecl:{TypedText Class}
// CHECK-CCA: ObjCInterfaceDecl:{TypedText Foo}
-// CHECK-CCA: FunctionDecl:{TypedText func}{LeftParen (}{RightParen )}
+// CHECK-CCA: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )}
// CHECK-CCA: TypedefDecl:{TypedText id}
// CHECK-CCA: ObjCInterfaceDecl:{TypedText MyClass}
// CHECK-CCA: ObjCInterfaceDecl:{TypedText MySubClass}
// CHECK-CCA: TypedefDecl:{TypedText SEL}
// CHECK-CCA: {TypedText super}
+// RUN: c-index-test -code-completion-at=%s:103:6 %s | FileCheck -check-prefix=CHECK-CCB %s
+// CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)i}{Placeholder , ...}
diff --git a/test/Index/complete-properties.m b/test/Index/complete-properties.m
index a99b1d1413d9..80e10e7822c7 100644
--- a/test/Index/complete-properties.m
+++ b/test/Index/complete-properties.m
@@ -22,19 +22,19 @@
@end
// RUN: c-index-test -code-completion-at=%s:20:13 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop0}
-// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop1}
-// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop2}
-// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop3}
-// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop4}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText Prop0}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText Prop1}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText Prop2}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType id}{TypedText Prop3}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType id}{TypedText Prop4}
// RUN: c-index-test -code-completion-at=%s:20:20 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: ObjCPropertyDecl:{TypedText Prop0}
-// CHECK-CC2: ObjCPropertyDecl:{TypedText Prop1}
-// CHECK-CC2-NEXT: ObjCPropertyDecl:{TypedText Prop3}
-// CHECK-CC2: ObjCPropertyDecl:{TypedText Prop4}
+// CHECK-CC2: ObjCPropertyDecl:{ResultType int}{TypedText Prop0}
+// CHECK-CC2: ObjCPropertyDecl:{ResultType int}{TypedText Prop1}
+// CHECK-CC2-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop3}
+// CHECK-CC2: ObjCPropertyDecl:{ResultType id}{TypedText Prop4}
// RUN: c-index-test -code-completion-at=%s:20:35 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: ObjCIvarDecl:{TypedText RandomIVar}
-// CHECK-CC3: ObjCIvarDecl:{TypedText StoredProp3}
+// CHECK-CC3: ObjCIvarDecl:{ResultType int}{TypedText RandomIVar}
+// CHECK-CC3: ObjCIvarDecl:{ResultType id}{TypedText StoredProp3}
// RUN: c-index-test -code-completion-at=%s:21:10 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: ObjCPropertyDecl:{TypedText Prop0}
-// CHECK-CC4-NEXT: ObjCPropertyDecl:{TypedText Prop4}
+// CHECK-CC4: ObjCPropertyDecl:{ResultType int}{TypedText Prop0}
+// CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop4}
diff --git a/test/Index/complete-property-getset.m b/test/Index/complete-property-getset.m
index a2a80533a32b..f4424ced0812 100644
--- a/test/Index/complete-property-getset.m
+++ b/test/Index/complete-property-getset.m
@@ -20,22 +20,22 @@
@end
// RUN: c-index-test -code-completion-at=%s:13:21 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: ObjCInstanceMethodDecl:{TypedText getter1}
+// CHECK-CC1: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter1}
// CHECK-CC1-NOT: getter2
-// CHECK-CC1: ObjCInstanceMethodDecl:{TypedText getter3}
+// CHECK-CC1: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter3}
// RUN: c-index-test -code-completion-at=%s:13:39 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText getter2_not:}
-// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText setter1:}
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter2_not:}
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType void}{TypedText setter1:}
// CHECK-CC2-NOT: setter2
-// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText setter3:}
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType void}{TypedText setter3:}
// RUN: c-index-test -code-completion-at=%s:19:21 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText getter1}
+// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter1}
// CHECK-CC3-NOT: getter2
-// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText getter3}
-// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText getter4}
+// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter3}
+// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter4}
// RUN: c-index-test -code-completion-at=%s:19:39 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText getter2_not:}{Informative (int)x}
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText setter1:}{Informative (int)x}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter2_not:}{Informative (int)x}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType void}{TypedText setter1:}{Informative (int)x}
// CHECK-CC4-NOT: setter2
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText setter3:}{Informative (int)y}
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText setter4:}{Informative (int)x}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType void}{TypedText setter3:}{Informative (int)y}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType void}{TypedText setter4:}{Informative (int)x}
diff --git a/test/Index/cxx-operator-overload.cpp b/test/Index/cxx-operator-overload.cpp
index 9bda03ef8dc4..864744859332 100644
--- a/test/Index/cxx-operator-overload.cpp
+++ b/test/Index/cxx-operator-overload.cpp
@@ -12,7 +12,7 @@ static void bar() {
Cls Cls::operator +(const Cls &RHS) { while (1) {} }
-// RUN: clang-cc -emit-pch %s -o %t.ast
+// RUN: %clang_cc1 -emit-pch %s -o %t.ast
// RUNx: index-test %t.ast -point-at %s:10:17 -print-decls > %t &&
// RUNx: cat %t | count 2 &&
diff --git a/test/Index/find-decls.c b/test/Index/find-decls.c
index 99a32428005b..f1999b2151b4 100644
--- a/test/Index/find-decls.c
+++ b/test/Index/find-decls.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t1.c -o %t1.ast
-// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t2.c -o %t2.ast
+// RUN: %clang_cc1 -fblocks -emit-pch %S/Inputs/t1.c -o %t1.ast
+// RUN: %clang_cc1 -fblocks -emit-pch %S/Inputs/t2.c -o %t2.ast
// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/t1.c:8:7 -print-decls > %t
// RUN: cat %t | count 3
diff --git a/test/Index/find-defs.c b/test/Index/find-defs.c
index fb540727341a..51292704a1b6 100644
--- a/test/Index/find-defs.c
+++ b/test/Index/find-defs.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t1.c -o %t1.ast
-// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t2.c -o %t2.ast
+// RUN: %clang_cc1 -fblocks -emit-pch %S/Inputs/t1.c -o %t1.ast
+// RUN: %clang_cc1 -fblocks -emit-pch %S/Inputs/t2.c -o %t2.ast
// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/foo.h:1:14 -print-defs > %t
// RUN: cat %t | count 1
diff --git a/test/Index/find-refs.c b/test/Index/find-refs.c
index 5209e141b629..1f29a77017de 100644
--- a/test/Index/find-refs.c
+++ b/test/Index/find-refs.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t1.c -o %t1.ast
-// RUN: clang-cc -fblocks -emit-pch %S/Inputs/t2.c -o %t2.ast
+// RUN: %clang_cc1 -fblocks -emit-pch %S/Inputs/t1.c -o %t1.ast
+// RUN: %clang_cc1 -fblocks -emit-pch %S/Inputs/t2.c -o %t2.ast
// RUN: index-test %t1.ast %t2.ast -point-at %S/Inputs/foo.h:1:14 -print-refs > %t
// RUN: cat %t | count 4
diff --git a/test/Index/multiple-redecls.c b/test/Index/multiple-redecls.c
index ea6d00b6a3c4..faea88fc6b77 100644
--- a/test/Index/multiple-redecls.c
+++ b/test/Index/multiple-redecls.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-pch %s -o %t.ast
+// RUN: %clang_cc1 -emit-pch %s -o %t.ast
// RUN: index-test %t.ast -point-at %s:8:4 -print-decls | count 2
// RUN: index-test %t.ast -point-at %s:8:4 -print-defs | count 1
diff --git a/test/Index/objc-decls.m b/test/Index/objc-decls.m
index 62a43da007b3..4fcd830212bb 100644
--- a/test/Index/objc-decls.m
+++ b/test/Index/objc-decls.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -emit-pch %S/Inputs/t1.m -o %t1.m.ast
-// RUN: clang -cc1 -emit-pch %S/Inputs/t2.m -o %t2.m.ast
+// RUN: %clang_cc1 -emit-pch %S/Inputs/t1.m -o %t1.m.ast
+// RUN: %clang_cc1 -emit-pch %S/Inputs/t2.m -o %t2.m.ast
// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/t1.m:12:12 -print-decls > %t
// RUN: cat %t | count 2
diff --git a/test/Index/objc-message.m b/test/Index/objc-message.m
index 568ca9494f55..151565b9bba2 100644
--- a/test/Index/objc-message.m
+++ b/test/Index/objc-message.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -emit-pch %S/Inputs/t1.m -o %t1.m.ast
-// RUN: clang -cc1 -emit-pch %S/Inputs/t2.m -o %t2.m.ast
+// RUN: %clang_cc1 -emit-pch %S/Inputs/t1.m -o %t1.m.ast
+// RUN: %clang_cc1 -emit-pch %S/Inputs/t2.m -o %t2.m.ast
// RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/objc.h:5:13 -print-refs > %t
// RUN: cat %t | count 1
diff --git a/test/Index/recover-bad-code-rdar_7487294.c b/test/Index/recover-bad-code-rdar_7487294.c
new file mode 100644
index 000000000000..97bb5158e472
--- /dev/null
+++ b/test/Index/recover-bad-code-rdar_7487294.c
@@ -0,0 +1,14 @@
+// RUN: %clang-cc1 -fsyntax-only %s 2>&1 | FileCheck %s
+
+// IMPORTANT: This test case intentionally DOES NOT use --disable-free. It
+// tests that we are properly reclaiming the ASTs and we do not have a double free.
+// Previously we tried to free the size expression of the VLA twice.
+
+int foo(int x) {
+ int y[x * 3];
+ help
+};
+
+// CHECK: 9:3: error: use of undeclared identifier 'help'
+// CHECK: help
+// CHECK: 14:102: error: expected '}'
diff --git a/test/Index/remap-complete.c b/test/Index/remap-complete.c
index cfafd3051d8f..9b7de0699d45 100644
--- a/test/Index/remap-complete.c
+++ b/test/Index/remap-complete.c
@@ -1,5 +1,5 @@
// RUN: c-index-test -code-completion-at=%s:1:12 -remap-file="%s;%S/Inputs/remap-complete-to.c" %s | FileCheck %s
// XFAIL: win32
-// CHECK: FunctionDecl:{TypedText f0}{LeftParen (}{RightParen )}
+// CHECK: FunctionDecl:{ResultType void}{TypedText f0}{LeftParen (}{RightParen )}
void f() { }
diff --git a/test/Index/resolve-loc.c b/test/Index/resolve-loc.c
index f4697171ee18..68504ee0d2bc 100644
--- a/test/Index/resolve-loc.c
+++ b/test/Index/resolve-loc.c
@@ -16,7 +16,7 @@ struct S {
};
-// RUN: clang-cc -emit-pch %s -o %t.ast
+// RUN: %clang_cc1 -emit-pch %s -o %t.ast
// RUN: index-test %t.ast -point-at %s:3:8 | grep top_var
// RUN: index-test %t.ast -point-at %s:5:15 | grep top_func_decl
// RUN: index-test %t.ast -point-at %s:5:25 | grep param1
diff --git a/test/Lexer/11-27-2007-FloatLiterals.c b/test/Lexer/11-27-2007-FloatLiterals.c
index ab3aba1a6eaf..ccd9e2eff592 100644
--- a/test/Lexer/11-27-2007-FloatLiterals.c
+++ b/test/Lexer/11-27-2007-FloatLiterals.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// CHECK: 0x3BFD83C940000000
// CHECK: 2.000000e+{{[0]*}}32
diff --git a/test/Lexer/badstring_in_if0.c b/test/Lexer/badstring_in_if0.c
index 5fa5a2bb2403..486dcf221a6e 100644
--- a/test/Lexer/badstring_in_if0.c
+++ b/test/Lexer/badstring_in_if0.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s 2>&1 | not grep error
+// RUN: %clang_cc1 -E %s 2>&1 | not grep error
#if 0
"
diff --git a/test/Lexer/block_cmt_end.c b/test/Lexer/block_cmt_end.c
index 5efb77e3cc38..72bc836a0ef0 100644
--- a/test/Lexer/block_cmt_end.c
+++ b/test/Lexer/block_cmt_end.c
@@ -1,9 +1,9 @@
/*
- RUN: clang-cc -E -trigraphs %s | grep bar
- RUN: clang-cc -E -trigraphs %s | grep foo
- RUN: clang-cc -E -trigraphs %s | not grep abc
- RUN: clang-cc -E -trigraphs %s | not grep xyz
- RUN: clang-cc -fsyntax-only -trigraphs -verify %s
+ RUN: %clang_cc1 -E -trigraphs %s | grep bar
+ RUN: %clang_cc1 -E -trigraphs %s | grep foo
+ RUN: %clang_cc1 -E -trigraphs %s | not grep abc
+ RUN: %clang_cc1 -E -trigraphs %s | not grep xyz
+ RUN: %clang_cc1 -fsyntax-only -trigraphs -verify %s
*/
// This is a simple comment, /*/ does not end a comment, the trailing */ does.
diff --git a/test/Lexer/c90.c b/test/Lexer/c90.c
index d743d68cd501..6293d42a2f61 100644
--- a/test/Lexer/c90.c
+++ b/test/Lexer/c90.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -std=c90 -fsyntax-only %s -verify -pedantic-errors
+/* RUN: %clang_cc1 -std=c90 -fsyntax-only %s -verify -pedantic-errors
*/
enum { cast_hex = (long) (
diff --git a/test/Lexer/char-escapes.c b/test/Lexer/char-escapes.c
index ef665fe84a5b..d918bf4cf07c 100644
--- a/test/Lexer/char-escapes.c
+++ b/test/Lexer/char-escapes.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
int test['\\' == 92 ? 1 : -1];
int test['\"' == 34 ? 1 : -1];
diff --git a/test/Lexer/comment-escape.c b/test/Lexer/comment-escape.c
index c46145715843..191e65441dd4 100644
--- a/test/Lexer/comment-escape.c
+++ b/test/Lexer/comment-escape.c
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only %s
+// RUN: %clang -fsyntax-only %s
// rdar://6757323
// foo \
diff --git a/test/Lexer/constants-ms.c b/test/Lexer/constants-ms.c
index 8176ec3249f9..5b3f82611977 100644
--- a/test/Lexer/constants-ms.c
+++ b/test/Lexer/constants-ms.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -fms-extensions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
__int8 x1 = 3i8;
__int16 x2 = 4i16;
diff --git a/test/Lexer/constants.c b/test/Lexer/constants.c
index fcb6de954516..104a3a2a2b27 100644
--- a/test/Lexer/constants.c
+++ b/test/Lexer/constants.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic -trigraphs %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -trigraphs %s
int x = 000000080; // expected-error {{invalid digit}}
@@ -33,3 +33,25 @@ char e = 'abcd'; // still warn: expected-warning {{multi-character character co
#pragma clang diagnostic ignored "-Wfour-char-constants"
char f = 'abcd'; // ignored.
+
+// rdar://problem/6974641
+float t0[] = {
+ 1.9e20f,
+ 1.9e-20f,
+ 1.9e50f, // expected-error {{too large}}
+ 1.9e-50f, // expected-error {{too small}}
+ -1.9e20f,
+ -1.9e-20f,
+ -1.9e50f, // expected-error {{too large}}
+ -1.9e-50f // expected-error {{too small}}
+};
+double t1[] = {
+ 1.9e50,
+ 1.9e-50,
+ 1.9e500, // expected-error {{too large}}
+ 1.9e-500, // expected-error {{too small}}
+ -1.9e50,
+ -1.9e-50,
+ -1.9e500, // expected-error {{too large}}
+ -1.9e-500 // expected-error {{too small}}
+};
diff --git a/test/Lexer/counter.c b/test/Lexer/counter.c
index 044570f88869..21737300228d 100644
--- a/test/Lexer/counter.c
+++ b/test/Lexer/counter.c
@@ -1,5 +1,5 @@
// __COUNTER__ support: rdar://4329310
-// RUN: clang -E %s > %t
+// RUN: %clang -E %s > %t
#define PASTE2(x,y) x##y
#define PASTE1(x,y) PASTE2(x,y)
diff --git a/test/Lexer/cxx0x_keyword.cpp b/test/Lexer/cxx0x_keyword.cpp
index 412c25e83c48..c27925bcfee4 100644
--- a/test/Lexer/cxx0x_keyword.cpp
+++ b/test/Lexer/cxx0x_keyword.cpp
@@ -1,2 +1,2 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s 2>&1
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s 2>&1
int static_assert; /* expected-error {{expected unqualified-id}} */
diff --git a/test/Lexer/cxx0x_keyword_as_cxx98.cpp b/test/Lexer/cxx0x_keyword_as_cxx98.cpp
index 9f8aea127cb9..2bfb8b0b931b 100644
--- a/test/Lexer/cxx0x_keyword_as_cxx98.cpp
+++ b/test/Lexer/cxx0x_keyword_as_cxx98.cpp
@@ -1,2 +1,2 @@
-// RUN: clang-cc %s -fsyntax-only
+// RUN: %clang_cc1 %s -fsyntax-only
int static_assert;
diff --git a/test/Lexer/digraph.c b/test/Lexer/digraph.c
index 3c92db1c02b2..b8a99bbae151 100644
--- a/test/Lexer/digraph.c
+++ b/test/Lexer/digraph.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify < %s
+// RUN: %clang_cc1 -fsyntax-only -verify < %s
%:include <stdint.h>
diff --git a/test/Lexer/dollar-idents.c b/test/Lexer/dollar-idents.c
index 276545d160a1..cbf25b0251bc 100644
--- a/test/Lexer/dollar-idents.c
+++ b/test/Lexer/dollar-idents.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -dump-tokens %s 2> %t
+// RUN: %clang_cc1 -dump-tokens %s 2> %t
// RUN: grep "identifier '\$A'" %t
-// RUN: clang-cc -dump-tokens -x assembler-with-cpp %s 2> %t
+// RUN: %clang_cc1 -dump-tokens -x assembler-with-cpp %s 2> %t
// RUN: grep "identifier 'A'" %t
// PR3808
diff --git a/test/Lexer/escape_newline.c b/test/Lexer/escape_newline.c
index d07f0450ebbe..43ba41795db8 100644
--- a/test/Lexer/escape_newline.c
+++ b/test/Lexer/escape_newline.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -E -trigraphs %s | grep -- ' ->'
-// RUN: clang-cc -E -trigraphs %s 2>&1 | grep 'backslash and newline separated by space'
-// RUN: clang-cc -E -trigraphs %s 2>&1 | grep 'trigraph converted'
+// RUN: %clang_cc1 -E -trigraphs %s | grep -- ' ->'
+// RUN: %clang_cc1 -E -trigraphs %s 2>&1 | grep 'backslash and newline separated by space'
+// RUN: %clang_cc1 -E -trigraphs %s 2>&1 | grep 'trigraph converted'
// This is an ugly way to spell a -> token.
-??/
diff --git a/test/Lexer/has_feature_exceptions.cpp b/test/Lexer/has_feature_exceptions.cpp
index 231a6c56a45b..cfd1efbf8464 100644
--- a/test/Lexer/has_feature_exceptions.cpp
+++ b/test/Lexer/has_feature_exceptions.cpp
@@ -1,5 +1,5 @@
-// RUN: clang -E -fexceptions %s -o - | FileCheck --check-prefix=CHECK-EXCEPTIONS %s
-// RUN: clang -E -fno-exceptions %s -o - | FileCheck --check-prefix=CHECK-NO-EXCEPTIONS %s
+// RUN: %clang -E -fexceptions %s -o - | FileCheck --check-prefix=CHECK-EXCEPTIONS %s
+// RUN: %clang -E -fno-exceptions %s -o - | FileCheck --check-prefix=CHECK-NO-EXCEPTIONS %s
#if __has_feature(cxx_exceptions)
int foo();
diff --git a/test/Lexer/has_feature_rtti.cpp b/test/Lexer/has_feature_rtti.cpp
index cc01f61cba67..690906c292f2 100644
--- a/test/Lexer/has_feature_rtti.cpp
+++ b/test/Lexer/has_feature_rtti.cpp
@@ -1,5 +1,5 @@
-// RUN: clang -E -frtti %s -o - | FileCheck --check-prefix=CHECK-RTTI %s
-// RUN: clang -E -fno-rtti %s -o - | FileCheck --check-prefix=CHECK-NO-RTTI %s
+// RUN: %clang -E -frtti %s -o - | FileCheck --check-prefix=CHECK-RTTI %s
+// RUN: %clang -E -fno-rtti %s -o - | FileCheck --check-prefix=CHECK-NO-RTTI %s
#if __has_feature(cxx_rtti)
int foo();
diff --git a/test/Lexer/msdos-cpm-eof.c b/test/Lexer/msdos-cpm-eof.c
index e4dacd9802f2..9ef6e32ea0b4 100644
--- a/test/Lexer/msdos-cpm-eof.c
+++ b/test/Lexer/msdos-cpm-eof.c
@@ -1,5 +1,7 @@
-// RUN: clang-cc -fsyntax-only -verify -fms-extensions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
-int a;
+int x;

+
+I am random garbage after ^Z
diff --git a/test/Lexer/multiple-include.c b/test/Lexer/multiple-include.c
index e5fd52926eee..d737f95db271 100644
--- a/test/Lexer/multiple-include.c
+++ b/test/Lexer/multiple-include.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only
+// RUN: %clang_cc1 %s -fsyntax-only
#ifndef XVID_AUTO_INCLUDE
diff --git a/test/Lexer/numeric-literal-trash.c b/test/Lexer/numeric-literal-trash.c
index 047e0b8e95f9..1d7c87bfbf06 100644
--- a/test/Lexer/numeric-literal-trash.c
+++ b/test/Lexer/numeric-literal-trash.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -fsyntax-only -verify %s
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
*/
# define XRECORD(x, c_name) e##c (x, __LINE__)
diff --git a/test/Lexer/pragma-mark.c b/test/Lexer/pragma-mark.c
index f4204aa9d807..96e8485a70ac 100644
--- a/test/Lexer/pragma-mark.c
+++ b/test/Lexer/pragma-mark.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// Lexer diagnostics shouldn't be included in #pragma mark.
#pragma mark Mike's world
diff --git a/test/Lexer/rdr-6096838-2.c b/test/Lexer/rdr-6096838-2.c
index b135dc1409cb..f7f5906c8f4c 100644
--- a/test/Lexer/rdr-6096838-2.c
+++ b/test/Lexer/rdr-6096838-2.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -pedantic -std=gnu89 -fsyntax-only -verify %s
+/* RUN: %clang_cc1 -pedantic -std=gnu89 -fsyntax-only -verify %s
rdar://6096838
*/
diff --git a/test/Lexer/rdr-6096838.c b/test/Lexer/rdr-6096838.c
index 6a8899af95bd..2f00f47099b7 100644
--- a/test/Lexer/rdr-6096838.c
+++ b/test/Lexer/rdr-6096838.c
@@ -1,5 +1,5 @@
-/* RUN: clang-cc -fsyntax-only -verify %s
- * RUN: clang-cc -std=gnu89 -fsyntax-only -verify %s
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
+ * RUN: %clang_cc1 -std=gnu89 -fsyntax-only -verify %s
rdar://6096838
*/
diff --git a/test/Lexer/token-concat-2.c b/test/Lexer/token-concat-2.c
index 28916547d5b6..7d3cd6443982 100644
--- a/test/Lexer/token-concat-2.c
+++ b/test/Lexer/token-concat-2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E -x c -o - %s | grep '[.][*]'
+// RUN: %clang_cc1 -E -x c -o - %s | grep '[.][*]'
// PR4395
#define X .*
X
diff --git a/test/Lexer/token-concat.c b/test/Lexer/token-concat.c
index 9194932b1bed..551af950ae92 100644
--- a/test/Lexer/token-concat.c
+++ b/test/Lexer/token-concat.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E -x c -o %t %s
+// RUN: %clang_cc1 -E -x c -o %t %s
// RUN: grep 'IDENT.2' %t
IDENT.2
diff --git a/test/Lexer/unknown-char.c b/test/Lexer/unknown-char.c
index acbf4f039a71..334df37225ec 100644
--- a/test/Lexer/unknown-char.c
+++ b/test/Lexer/unknown-char.c
@@ -1,2 +1,2 @@
-// RUN: clang-cc -E %s 2>&1 | not grep error
+// RUN: %clang_cc1 -E %s 2>&1 | not grep error
` ` ` `
diff --git a/test/Misc/caret-diags-macros.c b/test/Misc/caret-diags-macros.c
index fd3c6170ec3c..80371a94eb38 100644
--- a/test/Misc/caret-diags-macros.c
+++ b/test/Misc/caret-diags-macros.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s > %t 2>&1
+// RUN: %clang_cc1 -fsyntax-only %s > %t 2>&1
#define M1(x) x
diff --git a/test/Misc/caret-diags-scratch-buffer.c b/test/Misc/caret-diags-scratch-buffer.c
index e339d5635754..883c68e81dce 100644
--- a/test/Misc/caret-diags-scratch-buffer.c
+++ b/test/Misc/caret-diags-scratch-buffer.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s 2>&1 | not grep keyXXXX
+// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | not grep keyXXXX
// This should not show keyXXXX in the caret diag output. This once
// happened because the two tokens ended up in the scratch buffer and
// the caret diag from the scratch buffer included the previous token.
diff --git a/test/Misc/diag-mapping.c b/test/Misc/diag-mapping.c
index 5816cf5ca16d..75b49ef17c98 100644
--- a/test/Misc/diag-mapping.c
+++ b/test/Misc/diag-mapping.c
@@ -1,28 +1,28 @@
// This should warn by default.
-// RUN: clang-cc %s 2>&1 | grep "warning:"
+// RUN: %clang_cc1 %s 2>&1 | grep "warning:"
// This should not emit anything.
-// RUN: clang-cc %s -Wno-extra-tokens 2>&1 | not grep diagnostic
+// RUN: %clang_cc1 %s -Wno-extra-tokens 2>&1 | not grep diagnostic
// -Werror can map all warnings to error.
-// RUN: clang-cc %s -Werror 2>&1 | grep "error:"
+// RUN: %clang_cc1 %s -Werror 2>&1 | grep "error:"
// -Werror can map this one warning to error.
-// RUN: clang-cc %s -Werror=extra-tokens 2>&1 | grep "error:"
+// RUN: %clang_cc1 %s -Werror=extra-tokens 2>&1 | grep "error:"
// Mapping unrelated diags to errors doesn't affect this one.
-// RUN: clang-cc %s -Werror=trigraphs 2>&1 | grep "warning:"
+// RUN: %clang_cc1 %s -Werror=trigraphs 2>&1 | grep "warning:"
// This should stay a warning with -pedantic.
-// RUN: clang-cc %s -pedantic 2>&1 | grep "warning:"
+// RUN: %clang_cc1 %s -pedantic 2>&1 | grep "warning:"
// This should emit an error with -pedantic-errors.
-// RUN: clang-cc %s -pedantic-errors 2>&1 | grep "error:"
+// RUN: %clang_cc1 %s -pedantic-errors 2>&1 | grep "error:"
// This should emit a warning, because -Wfoo overrides -pedantic*.
-// RUN: clang-cc %s -pedantic-errors -Wextra-tokens 2>&1 | grep "warning:"
+// RUN: %clang_cc1 %s -pedantic-errors -Wextra-tokens 2>&1 | grep "warning:"
// This should emit nothing, because -Wno-extra-tokens overrides -pedantic*
-// RUN: clang-cc %s -pedantic-errors -Wno-extra-tokens 2>&1 | not grep diagnostic
+// RUN: %clang_cc1 %s -pedantic-errors -Wno-extra-tokens 2>&1 | not grep diagnostic
#ifdef foo
#endif bad // extension!
diff --git a/test/Misc/diag-mapping2.c b/test/Misc/diag-mapping2.c
index cde90e299a04..bc5a0872e7c8 100644
--- a/test/Misc/diag-mapping2.c
+++ b/test/Misc/diag-mapping2.c
@@ -1,21 +1,21 @@
// This should warn by default.
-// RUN: clang-cc %s 2>&1 | grep "warning:"
+// RUN: %clang_cc1 %s 2>&1 | grep "warning:"
// This should not emit anything.
-// RUN: clang-cc %s -w 2>&1 | not grep diagnostic
-// RUN: clang-cc %s -Wno-#warnings 2>&1 | not grep diagnostic
+// RUN: %clang_cc1 %s -w 2>&1 | not grep diagnostic
+// RUN: %clang_cc1 %s -Wno-#warnings 2>&1 | not grep diagnostic
// -Werror can map all warnings to error.
-// RUN: clang-cc %s -Werror 2>&1 | grep "error:"
+// RUN: %clang_cc1 %s -Werror 2>&1 | grep "error:"
// -Werror can map this one warning to error.
-// RUN: clang-cc %s -Werror=#warnings 2>&1 | grep "error:"
+// RUN: %clang_cc1 %s -Werror=#warnings 2>&1 | grep "error:"
// -Wno-error= overrides -Werror. rdar://3158301
-// RUN: clang-cc %s -Werror -Wno-error=#warnings 2>&1 | grep "warning:"
+// RUN: %clang_cc1 %s -Werror -Wno-error=#warnings 2>&1 | grep "warning:"
// -Wno-error overrides -Werror. PR4715
-// RUN: clang-cc %s -Werror -Wno-error 2>&1 | grep "warning:"
+// RUN: %clang_cc1 %s -Werror -Wno-error 2>&1 | grep "warning:"
#warning foo
diff --git a/test/Misc/emit-html-insert.c b/test/Misc/emit-html-insert.c
index ac6b519a3a0d..289c28a5c6d7 100644
--- a/test/Misc/emit-html-insert.c
+++ b/test/Misc/emit-html-insert.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-html -o - | grep ">&lt; 10; }"
+// RUN: %clang_cc1 %s -emit-html -o - | grep ">&lt; 10; }"
int a(int x) { return x
< 10; }
diff --git a/test/Misc/emit-html.c b/test/Misc/emit-html.c
index 22d0d28dd65d..48c8b61b38de 100644
--- a/test/Misc/emit-html.c
+++ b/test/Misc/emit-html.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-html -o -
+// RUN: %clang_cc1 %s -emit-html -o -
// rdar://6562329
#line 42 "foo.c"
diff --git a/test/Misc/message-length.c b/test/Misc/message-length.c
index 24f623394d88..3c746052fd3c 100644
--- a/test/Misc/message-length.c
+++ b/test/Misc/message-length.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -fmessage-length 72 %s 2>&1 | FileCheck -strict-whitespace %s
-// RUN: clang-cc -fmessage-length 1 %s
+// RUN: %clang_cc1 -fmessage-length 72 %s 2>&1 | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -fmessage-length 1 %s
// Hack so we can check things better, force the file name and line.
# 1 "FILE" 1
diff --git a/test/Misc/predefines.c b/test/Misc/predefines.c
index c7fac86331a5..8e57c809df20 100644
--- a/test/Misc/predefines.c
+++ b/test/Misc/predefines.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -fsyntax-only -verify -std=c89 -pedantic-errors %s
+/* RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -pedantic-errors %s
* rdar://6814950
*/
#include <stdint.h>
diff --git a/test/Misc/remap-file.c b/test/Misc/remap-file.c
index f12fe9501265..003cd2e469fd 100644
--- a/test/Misc/remap-file.c
+++ b/test/Misc/remap-file.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -remap-file "%s;%S/Inputs/remapped-file" -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-EXIST %s
-// RUN: clang-cc -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-NONEXIST %s
-// RUN: clang-cc -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file-2" -remap-file "%S/nonexistent.h;%S/Inputs/remapped-file-3" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-HEADER %s
+// RUN: %clang_cc1 -remap-file "%s;%S/Inputs/remapped-file" -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-EXIST %s
+// RUN: %clang_cc1 -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-NONEXIST %s
+// RUN: %clang_cc1 -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file-2" -remap-file "%S/nonexistent.h;%S/Inputs/remapped-file-3" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-HEADER %s
// CHECK-EXIST: remap-file.c:1:28: warning: incompatible pointer types
// CHECK-NONEXIST: nonexistent.c:1:28: warning: incompatible pointer types
diff --git a/test/PCH/asm.c b/test/PCH/asm.c
index 61665d607f41..99bc14dc2fb4 100644
--- a/test/PCH/asm.c
+++ b/test/PCH/asm.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -triple i386-unknown-unknown -include %S/asm.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -include %S/asm.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang-cc -triple i386-unknown-unknown -emit-pch -o %t %S/asm.h
-// RUN: clang-cc -triple i386-unknown-unknown -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pch -o %t %S/asm.h
+// RUN: %clang_cc1 -triple i386-unknown-unknown -include-pch %t -fsyntax-only -verify %s
void call_f(void) { f(); }
diff --git a/test/PCH/attrs.c b/test/PCH/attrs.c
index f381f2370406..c9711935c075 100644
--- a/test/PCH/attrs.c
+++ b/test/PCH/attrs.c
@@ -1,8 +1,8 @@
// Test this without pch.
-// RUN: clang-cc -include %S/attrs.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/attrs.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang-cc -emit-pch -o %t %S/attrs.h
-// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -emit-pch -o %t %S/attrs.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
// expected-note{{previous overload}}
double f(double); // expected-error{{overloadable}}
diff --git a/test/PCH/blocks.c b/test/PCH/blocks.c
index ccecd3652350..e7498865bd88 100644
--- a/test/PCH/blocks.c
+++ b/test/PCH/blocks.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -fblocks -include %S/blocks.h -fsyntax-only -emit-llvm -o - %s
+// RUN: %clang_cc1 -fblocks -include %S/blocks.h -fsyntax-only -emit-llvm -o - %s
// Test with pch.
-// RUN: clang-cc -emit-pch -fblocks -o %t %S/blocks.h
-// RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/blocks.h
+// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -emit-llvm -o - %s
int do_add(int x, int y) { return add(x, y); }
diff --git a/test/PCH/builtins.c b/test/PCH/builtins.c
index 796b9dcda12c..eed2224d415f 100644
--- a/test/PCH/builtins.c
+++ b/test/PCH/builtins.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -include %S/builtins.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/builtins.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang-cc -emit-pch -o %t %S/builtins.h
-// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -emit-pch -o %t %S/builtins.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
void hello() {
printf("Hello, World!");
diff --git a/test/PCH/cxx-method.cpp b/test/PCH/cxx-method.cpp
index 144406e7bdaf..37dabcc466a8 100644
--- a/test/PCH/cxx-method.cpp
+++ b/test/PCH/cxx-method.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-pch %s -o %t
+// RUN: %clang_cc1 -emit-pch %s -o %t
struct S {
void m(int x);
diff --git a/test/PCH/enum.c b/test/PCH/enum.c
index 607de59a8aea..10ceb7c60b0a 100644
--- a/test/PCH/enum.c
+++ b/test/PCH/enum.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -include %S/enum.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/enum.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang-cc -emit-pch -o %t %S/enum.h
-// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -emit-pch -o %t %S/enum.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
int i = Red;
diff --git a/test/PCH/exprs.c b/test/PCH/exprs.c
index 6cd1ee71b4c3..2b588a229e76 100644
--- a/test/PCH/exprs.c
+++ b/test/PCH/exprs.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -fblocks -include %S/exprs.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fblocks -include %S/exprs.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang-cc -emit-pch -fblocks -o %t %S/exprs.h
-// RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/exprs.h
+// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s
int integer;
long long_integer;
diff --git a/test/PCH/ext_vector.c b/test/PCH/ext_vector.c
index 314dbfcf1692..bd129ea18a93 100644
--- a/test/PCH/ext_vector.c
+++ b/test/PCH/ext_vector.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -include %S/ext_vector.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/ext_vector.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang-cc -emit-pch -o %t %S/ext_vector.h
-// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -emit-pch -o %t %S/ext_vector.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
int test(float4 f4) {
return f4.xy; // expected-error{{float2}}
diff --git a/test/PCH/external-defs.c b/test/PCH/external-defs.c
index 447124cc3f78..5097859297a5 100644
--- a/test/PCH/external-defs.c
+++ b/test/PCH/external-defs.c
@@ -1,6 +1,6 @@
// Test with pch.
-// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-pch -o %t.pch %S/external-defs.h
-// RUN: clang-cc -triple x86_64-apple-darwin9 -include-pch %t.pch -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t.pch %S/external-defs.h
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -include-pch %t.pch -emit-llvm -o %t %s
// RUN: grep "@x = common global i32 0" %t | count 1
// RUN: grep "@z" %t | count 0
diff --git a/test/PCH/functions.c b/test/PCH/functions.c
index 2121b9aaa107..eb8579ab2ef4 100644
--- a/test/PCH/functions.c
+++ b/test/PCH/functions.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -include %S/functions.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/functions.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang-cc -emit-pch -o %t %S/functions.h
-// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -emit-pch -o %t %S/functions.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
int f0(int x0, int y0, ...) { return x0 + y0; }
@@ -18,3 +18,8 @@ void test_g0(int *x, float * y) {
g0(y); // expected-warning{{incompatible pointer types passing 'float *', expected 'int *'}}
g0(x);
}
+
+void __attribute__((noreturn)) test_abort(int code) {
+ do_abort(code);
+}
+
diff --git a/test/PCH/functions.h b/test/PCH/functions.h
index bc28ad7321c7..39724300816a 100644
--- a/test/PCH/functions.h
+++ b/test/PCH/functions.h
@@ -4,3 +4,5 @@ int f0(int x, int y, ...);
float *f1(float x, float y);
void g0(int *);
+
+void do_abort(int) __attribute__((noreturn));
diff --git a/test/PCH/fuzzy-pch.c b/test/PCH/fuzzy-pch.c
index b29638bb0b10..567575346ce1 100644
--- a/test/PCH/fuzzy-pch.c
+++ b/test/PCH/fuzzy-pch.c
@@ -1,8 +1,8 @@
// Test with pch.
-// RUN: clang-cc -emit-pch -DFOO -o %t %S/variables.h
-// RUN: clang-cc -DBAR=int -include-pch %t -fsyntax-only -pedantic %s
-// RUN: clang-cc -DFOO -DBAR=int -include-pch %t -Werror %s
-// RUN: not clang-cc -DFOO -DBAR=int -DX=5 -include-pch %t -Werror %s
+// RUN: %clang_cc1 -emit-pch -DFOO -o %t %S/variables.h
+// RUN: %clang_cc1 -DBAR=int -include-pch %t -fsyntax-only -pedantic %s
+// RUN: %clang_cc1 -DFOO -DBAR=int -include-pch %t -Werror %s
+// RUN: not %clang_cc1 -DFOO -DBAR=int -DX=5 -include-pch %t -Werror %s
BAR bar = 17;
diff --git a/test/PCH/line-directive.c b/test/PCH/line-directive.c
index 9eed4f4a9823..4710c40d7234 100644
--- a/test/PCH/line-directive.c
+++ b/test/PCH/line-directive.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -include %S/line-directive.h -fsyntax-only %s 2>&1|grep "25:5"
+// RUN: %clang_cc1 -include %S/line-directive.h -fsyntax-only %s 2>&1|grep "25:5"
// Test with pch.
-// RUN: clang-cc -emit-pch -o %t %S/line-directive.h
-// RUN: clang-cc -include-pch %t -fsyntax-only %s 2>&1|grep "25:5"
+// RUN: %clang_cc1 -emit-pch -o %t %S/line-directive.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s 2>&1|grep "25:5"
double x; // expected-error{{redefinition of 'x' with a different type}}
diff --git a/test/PCH/method_pool.m b/test/PCH/method_pool.m
index 17e2420081ff..ee537840e0eb 100644
--- a/test/PCH/method_pool.m
+++ b/test/PCH/method_pool.m
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang -cc1 -include %S/method_pool.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/method_pool.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang -cc1 -x objective-c -emit-pch -o %t %S/method_pool.h
-// RUN: clang -cc1 -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c -emit-pch -o %t %S/method_pool.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
int message_id(id x) {
return [x instMethod:17]; // expected-warning{{multiple methods}}
diff --git a/test/PCH/multiple_decls.c b/test/PCH/multiple_decls.c
index 2702cd61bba6..e2cc552336ea 100644
--- a/test/PCH/multiple_decls.c
+++ b/test/PCH/multiple_decls.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -include %S/multiple_decls.h -fsyntax-only -ast-print -o - %s
+// RUN: %clang_cc1 -include %S/multiple_decls.h -fsyntax-only -ast-print -o - %s
// Test with pch.
-// RUN: clang-cc -emit-pch -o %t %S/multiple_decls.h
-// RUN: clang-cc -include-pch %t -fsyntax-only -ast-print -o - %s
+// RUN: %clang_cc1 -emit-pch -o %t %S/multiple_decls.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -ast-print -o - %s
void f0(char c) {
wide(c);
diff --git a/test/PCH/nonvisible-external-defs.c b/test/PCH/nonvisible-external-defs.c
index a78674985c98..49392ca2fef5 100644
--- a/test/PCH/nonvisible-external-defs.c
+++ b/test/PCH/nonvisible-external-defs.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -include %S/nonvisible-external-defs.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/nonvisible-external-defs.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang-cc -emit-pch -o %t %S/nonvisible-external-defs.h
-// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -emit-pch -o %t %S/nonvisible-external-defs.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
int g(int, float); // expected-error{{conflicting types}}
diff --git a/test/PCH/objc_exprs.m b/test/PCH/objc_exprs.m
index 0c12b8e177fc..c37968b7b938 100644
--- a/test/PCH/objc_exprs.m
+++ b/test/PCH/objc_exprs.m
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang -cc1 -fblocks -include %S/objc_exprs.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fblocks -include %S/objc_exprs.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang -cc1 -x objective-c-header -emit-pch -fblocks -o %t %S/objc_exprs.h
-// RUN: clang -cc1 -fblocks -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c-header -emit-pch -fblocks -o %t %S/objc_exprs.h
+// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s
// Expressions
int *A1 = (objc_string)0; // expected-warning {{aka 'id'}}
diff --git a/test/PCH/objc_import.m b/test/PCH/objc_import.m
index c109f4083660..277c6dd6c2f0 100644
--- a/test/PCH/objc_import.m
+++ b/test/PCH/objc_import.m
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang -cc1 -include %S/objc_import.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/objc_import.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang -cc1 -x objective-c -emit-pch -o %t %S/objc_import.h
-// RUN: clang -cc1 -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c -emit-pch -o %t %S/objc_import.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
#import "objc_import.h"
diff --git a/test/PCH/objc_methods.m b/test/PCH/objc_methods.m
index a60ffad4f2a1..e90a463dce6b 100644
--- a/test/PCH/objc_methods.m
+++ b/test/PCH/objc_methods.m
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang -cc1 -include %S/objc_methods.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/objc_methods.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang -cc1 -x objective-c -emit-pch -o %t %S/objc_methods.h
-// RUN: clang -cc1 -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c -emit-pch -o %t %S/objc_methods.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
void func() {
TestPCH *xx;
diff --git a/test/PCH/objc_property.m b/test/PCH/objc_property.m
index 17c3a729c5c6..b51cd90927ae 100644
--- a/test/PCH/objc_property.m
+++ b/test/PCH/objc_property.m
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang -cc1 -include %S/objc_property.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/objc_property.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang -cc1 -x objective-c -emit-pch -o %t %S/objc_property.h
-// RUN: clang -cc1 -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c -emit-pch -o %t %S/objc_property.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
void func() {
TestProperties *xx = [TestProperties alloc];
diff --git a/test/PCH/pr4489.c b/test/PCH/pr4489.c
index aaf5aac749e5..1d8be2d76cc5 100644
--- a/test/PCH/pr4489.c
+++ b/test/PCH/pr4489.c
@@ -1,6 +1,6 @@
-// RUN: clang -x c-header -o %t.pch %s
+// RUN: %clang -x c-header -o %t.pch %s
// RUN: echo > %t.empty.c
-// RUN: clang -include %t -x c %t.empty.c -emit-llvm -S -o -
+// RUN: %clang -include %t -x c %t.empty.c -emit-llvm -S -o -
// PR 4489: Crash with PCH
// PR 4492: Crash with PCH (round two)
// PR 4509: Crash with PCH (round three)
diff --git a/test/PCH/preprocess.c b/test/PCH/preprocess.c
index 7a6c2c5a4e2b..8bf841f17f8d 100644
--- a/test/PCH/preprocess.c
+++ b/test/PCH/preprocess.c
@@ -1,8 +1,8 @@
// Check that -E mode is invariant when using an implicit PCH.
-// RUN: clang-cc -include %S/preprocess.h -E -o %t.orig %s
-// RUN: clang-cc -emit-pch -o %t %S/preprocess.h
-// RUN: clang-cc -include-pch %t -E -o %t.from_pch %s
+// RUN: %clang_cc1 -include %S/preprocess.h -E -o %t.orig %s
+// RUN: %clang_cc1 -emit-pch -o %t %S/preprocess.h
+// RUN: %clang_cc1 -include-pch %t -E -o %t.from_pch %s
// RUN: diff %t.orig %t.from_pch
a_typedef a_value;
diff --git a/test/PCH/reloc.c b/test/PCH/reloc.c
index ba8e70db024a..fd78feba6047 100644
--- a/test/PCH/reloc.c
+++ b/test/PCH/reloc.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -emit-pch -o %t -relocatable-pch -isysroot %S/libroot %S/libroot/usr/include/reloc.h
-// RUN: clang-cc -include-pch %t -isysroot %S/libroot %s -verify
-// RUN: not clang-cc -include-pch %t %s
+// RUN: %clang_cc1 -emit-pch -o %t -relocatable-pch -isysroot %S/libroot %S/libroot/usr/include/reloc.h
+// RUN: %clang_cc1 -include-pch %t -isysroot %S/libroot %s -verify
+// RUN: not %clang_cc1 -include-pch %t %s
#include <reloc.h>
diff --git a/test/PCH/source-manager-stack.c b/test/PCH/source-manager-stack.c
index 72084d9760ed..cc8555661a4d 100644
--- a/test/PCH/source-manager-stack.c
+++ b/test/PCH/source-manager-stack.c
@@ -2,9 +2,9 @@
// when using PCH.
// RUN: echo 'int x;' > %t.prefix.h
-// RUN: not clang-cc -fsyntax-only -include %t.prefix.h %s 2> %t.diags.no_pch.txt
-// RUN: clang-cc -emit-pch -o %t.prefix.pch %t.prefix.h
-// RUN: not clang-cc -fsyntax-only -include-pch %t.prefix.pch %s 2> %t.diags.pch.txt
+// RUN: not %clang_cc1 -fsyntax-only -include %t.prefix.h %s 2> %t.diags.no_pch.txt
+// RUN: %clang_cc1 -emit-pch -o %t.prefix.pch %t.prefix.h
+// RUN: not %clang_cc1 -fsyntax-only -include-pch %t.prefix.pch %s 2> %t.diags.pch.txt
// RUN: diff %t.diags.no_pch.txt %t.diags.pch.txt
// XFAIL: *
// PR5662
diff --git a/test/PCH/stmts.c b/test/PCH/stmts.c
index 69c7ec7dbf49..6def453c86e4 100644
--- a/test/PCH/stmts.c
+++ b/test/PCH/stmts.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -include %S/stmts.h -fsyntax-only -emit-llvm -o - %s
+// RUN: %clang_cc1 -include %S/stmts.h -fsyntax-only -emit-llvm -o - %s
// Test with pch.
-// RUN: clang-cc -emit-pch -o %t %S/stmts.h
-// RUN: clang-cc -include-pch %t -fsyntax-only -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-pch -o %t %S/stmts.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -emit-llvm -o - %s
void g0(void) { f0(5); }
int g1(int x) { return f1(x); }
diff --git a/test/PCH/struct.c b/test/PCH/struct.c
index 6595a2fbdccc..3e9d18833234 100644
--- a/test/PCH/struct.c
+++ b/test/PCH/struct.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -include %S/struct.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/struct.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang-cc -emit-pch -o %t %S/struct.h
-// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -emit-pch -o %t %S/struct.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
struct Point *p1;
diff --git a/test/PCH/tentative-defs.c b/test/PCH/tentative-defs.c
index 5b85fccbcacd..0072818a1a2f 100644
--- a/test/PCH/tentative-defs.c
+++ b/test/PCH/tentative-defs.c
@@ -1,6 +1,6 @@
// Test with pch.
-// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-pch -o %t.pch %S/tentative-defs.h
-// RUN: clang-cc -triple x86_64-apple-darwin9 -include-pch %t.pch -verify -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t.pch %S/tentative-defs.h
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -include-pch %t.pch -verify -emit-llvm -o %t %s
// RUN: grep "@variable = common global i32 0" %t | count 1
// RUN: grep "@incomplete_array = common global .*1 x i32" %t | count 1
diff --git a/test/PCH/types.c b/test/PCH/types.c
index a7efaef9a2c4..1ebc01be6a14 100644
--- a/test/PCH/types.c
+++ b/test/PCH/types.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -fblocks -include %S/types.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fblocks -include %S/types.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang-cc -emit-pch -fblocks -o %t %S/types.h
-// RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/types.h
+// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s
typedef int INT;
INT int_value;
diff --git a/test/PCH/va_arg.c b/test/PCH/va_arg.c
index 6f7ccf456185..1fb2a838e4f7 100644
--- a/test/PCH/va_arg.c
+++ b/test/PCH/va_arg.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h %s -emit-llvm -o -
+// RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h %s -emit-llvm -o -
// Test with pch.
-// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -emit-pch -o %t %S/va_arg.h
-// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o -
+// RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -emit-pch -o %t %S/va_arg.h
+// RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o -
char *g0(char** argv, int argc) { return argv[argc]; }
diff --git a/test/PCH/variables.c b/test/PCH/variables.c
index f79b68483fd9..58fd8ae84661 100644
--- a/test/PCH/variables.c
+++ b/test/PCH/variables.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -include %S/variables.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/variables.h -fsyntax-only -verify %s
// Test with pch.
-// RUN: clang-cc -emit-pch -o %t %S/variables.h
-// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -emit-pch -o %t %S/variables.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
int *ip2 = &x;
float *fp = &ip; // expected-warning{{incompatible pointer types}}
diff --git a/test/PCH/variables.h b/test/PCH/variables.h
index 70aec6518091..c9374297fc02 100644
--- a/test/PCH/variables.h
+++ b/test/PCH/variables.h
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-pch -o variables.h.pch variables.h
+// RUN: %clang_cc1 -emit-pch -o variables.h.pch variables.h
// Do not mess with the whitespace in this file. It's important.
diff --git a/test/Parser/2008-10-31-parse-noop-failure.c b/test/Parser/2008-10-31-parse-noop-failure.c
index 8243cb973105..6df508ee4dde 100755
--- a/test/Parser/2008-10-31-parse-noop-failure.c
+++ b/test/Parser/2008-10-31-parse-noop-failure.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -parse-noop %s
+// RUN: %clang_cc1 -verify -parse-noop %s
void add_attribute(id) int id; {}
diff --git a/test/Parser/CompoundStmtScope.c b/test/Parser/CompoundStmtScope.c
index 90e3d24a32f5..4f991031d0c3 100644
--- a/test/Parser/CompoundStmtScope.c
+++ b/test/Parser/CompoundStmtScope.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void foo() {
{
diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c
index 9c804c354e5a..082929f6d843 100644
--- a/test/Parser/MicrosoftExtensions.c
+++ b/test/Parser/MicrosoftExtensions.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -fms-extensions -x objective-c++ %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions -x objective-c++ %s
__stdcall int func0();
int __stdcall func();
typedef int (__cdecl *tptr)();
@@ -28,3 +28,9 @@ void foo() {
}
typedef bool (__stdcall __stdcall *blarg)(int);
+
+
+// Charify extension.
+#define FOO(x) #@x
+char x = FOO(a);
+
diff --git a/test/Parser/argument_qualified.c b/test/Parser/argument_qualified.c
index c9494e7373a0..7d1b9fdc2c33 100644
--- a/test/Parser/argument_qualified.c
+++ b/test/Parser/argument_qualified.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s
+// RUN: %clang_cc1 %s
int abc (const float x) {
return 1;
}
diff --git a/test/Parser/argument_redef.c b/test/Parser/argument_redef.c
index fd22c465e5c6..519e8fd2033f 100644
--- a/test/Parser/argument_redef.c
+++ b/test/Parser/argument_redef.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -fsyntax-only -verify %s
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
*/
void foo(int A) { /* expected-note {{previous definition is here}} */
diff --git a/test/Parser/argument_scope.c b/test/Parser/argument_scope.c
index 5e6f439cfdf8..d2d10c249857 100644
--- a/test/Parser/argument_scope.c
+++ b/test/Parser/argument_scope.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
typedef struct foo foo;
void blah(int foo) {
diff --git a/test/Parser/asm.c b/test/Parser/asm.c
index 9cf9046aab6a..df2e16feea5b 100644
--- a/test/Parser/asm.c
+++ b/test/Parser/asm.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f1() {
asm ("ret" : : :); // expected-error {{expected string literal}}
diff --git a/test/Parser/attributes.c b/test/Parser/attributes.c
index cad39d382d18..ca606f5391ae 100644
--- a/test/Parser/attributes.c
+++ b/test/Parser/attributes.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -pedantic -std=c99
+// RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic -std=c99
int __attribute__(()) x;
diff --git a/test/Parser/bad-control.c b/test/Parser/bad-control.c
index 0bdd179af215..480d81be0d57 100644
--- a/test/Parser/bad-control.c
+++ b/test/Parser/bad-control.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -fsyntax-only -verify %s
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
*/
void foo() {
break; /* expected-error {{'break' statement not in loop or switch statement}} */
diff --git a/test/Parser/block-block-storageclass.c b/test/Parser/block-block-storageclass.c
index df9423460cd5..a4efc44b1828 100644
--- a/test/Parser/block-block-storageclass.c
+++ b/test/Parser/block-block-storageclass.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -parse-noop %s
+// RUN: %clang_cc1 -fsyntax-only -verify -parse-noop %s
#if 0
int printf(const char *, ...);
void _Block_byref_release(void*src){}
diff --git a/test/Parser/block-pointer-decl.c b/test/Parser/block-pointer-decl.c
index 7a21651bad32..2979b012c449 100644
--- a/test/Parser/block-pointer-decl.c
+++ b/test/Parser/block-pointer-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -parse-noop -fblocks %s
+// RUN: %clang_cc1 -fsyntax-only -verify -parse-noop -fblocks %s
struct blockStruct {
int (^a)(float, int);
diff --git a/test/Parser/builtin_classify_type.c b/test/Parser/builtin_classify_type.c
index 7046310eb4a8..a7c08555c905 100644
--- a/test/Parser/builtin_classify_type.c
+++ b/test/Parser/builtin_classify_type.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct foo { int a; };
diff --git a/test/Parser/builtin_types_compatible.c b/test/Parser/builtin_types_compatible.c
index 0664a9f55641..325615c7ee91 100644
--- a/test/Parser/builtin_types_compatible.c
+++ b/test/Parser/builtin_types_compatible.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
extern int funcInt(int);
extern float funcFloat(float);
diff --git a/test/Parser/c-namespace.c b/test/Parser/c-namespace.c
index ffca15e6a2eb..fbef09e0cd79 100644
--- a/test/Parser/c-namespace.c
+++ b/test/Parser/c-namespace.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
void bla1() {
struct XXX;
int XXX;
diff --git a/test/Parser/char-literal-printing.c b/test/Parser/char-literal-printing.c
index f6ad0ff511be..5843e5f40157 100644
--- a/test/Parser/char-literal-printing.c
+++ b/test/Parser/char-literal-printing.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -ast-print %s
+// RUN: %clang_cc1 -ast-print %s
#include <stddef.h>
diff --git a/test/Parser/check-objc2-syntax-1.m b/test/Parser/check-objc2-syntax-1.m
index aafb2e090a6a..3cdf2b05cf85 100644
--- a/test/Parser/check-objc2-syntax-1.m
+++ b/test/Parser/check-objc2-syntax-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Subclass
+ (int)magicNumber;
diff --git a/test/Parser/check-syntax-1.m b/test/Parser/check-syntax-1.m
index 8ad207270c3f..a1999def5982 100644
--- a/test/Parser/check-syntax-1.m
+++ b/test/Parser/check-syntax-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int @interface bla ; // expected-error {{cannot combine with previous 'int' declaration specifier}}
@end
diff --git a/test/Parser/check_cast.c b/test/Parser/check_cast.c
index 4df851c7bf9f..790ee409c976 100644
--- a/test/Parser/check_cast.c
+++ b/test/Parser/check_cast.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct foo {
int a;
};
diff --git a/test/Parser/compound_literal.c b/test/Parser/compound_literal.c
index c263763b2e2a..4f3609dc29f4 100644
--- a/test/Parser/compound_literal.c
+++ b/test/Parser/compound_literal.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int main() {
char *s;
s = (char []){"whatever"};
diff --git a/test/Parser/control-scope.c b/test/Parser/control-scope.c
index 8c4e19965edb..53149802c4cb 100644
--- a/test/Parser/control-scope.c
+++ b/test/Parser/control-scope.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc %s -std=c90 -verify
-// RUN: clang-cc %s -std=c99
+// RUN: %clang_cc1 %s -std=c90 -verify
+// RUN: %clang_cc1 %s -std=c99
int f (int z) {
if (z + sizeof (enum {a})) // expected-note {{previous definition is here}}
diff --git a/test/Parser/cxx-ambig-paren-expr.cpp b/test/Parser/cxx-ambig-paren-expr.cpp
index 324f6b5f9f88..398820567237 100644
--- a/test/Parser/cxx-ambig-paren-expr.cpp
+++ b/test/Parser/cxx-ambig-paren-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
void f() {
typedef int T;
@@ -24,3 +24,43 @@ void f() {
// FIXME: Special case: "++" is postfix here, not prefix
// (S())++;
}
+
+// Make sure we do tentative parsing correctly in conditions.
+typedef int type;
+struct rec { rec(int); };
+
+namespace ns {
+ typedef int type;
+ struct rec { rec(int); };
+}
+
+struct cls {
+ typedef int type;
+ struct rec { rec(int); };
+};
+
+struct result {
+ template <class T> result(T);
+ bool check();
+};
+
+void test(int i) {
+ if (result((cls::type) i).check())
+ return;
+
+ if (result((ns::type) i).check())
+ return;
+
+ if (result((::type) i).check())
+ return;
+
+ if (result((cls::rec) i).check())
+ return;
+
+ if (result((ns::rec) i).check())
+ return;
+
+ if (result((::rec) i).check())
+ return;
+}
+
diff --git a/test/Parser/cxx-attributes.cpp b/test/Parser/cxx-attributes.cpp
index 743d9b9ec1f2..192193a6dfdc 100644
--- a/test/Parser/cxx-attributes.cpp
+++ b/test/Parser/cxx-attributes.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class c {
virtual void f1(const char* a, ...)
diff --git a/test/Parser/cxx-bool.cpp b/test/Parser/cxx-bool.cpp
index f0b3a9f9f038..a8a161edb105 100644
--- a/test/Parser/cxx-bool.cpp
+++ b/test/Parser/cxx-bool.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
bool a = true;
bool b = false;
diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp
index 1fdc28d2c880..c8b4716aa356 100644
--- a/test/Parser/cxx-casting.cpp
+++ b/test/Parser/cxx-casting.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
char *const_cast_test(const char *var)
{
diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp
index ff452b919114..576e57d0716a 100644
--- a/test/Parser/cxx-class.cpp
+++ b/test/Parser/cxx-class.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class C;
class C {
public:
diff --git a/test/Parser/cxx-condition.cpp b/test/Parser/cxx-condition.cpp
index 8fbca2a90f78..a3991c45f24e 100644
--- a/test/Parser/cxx-condition.cpp
+++ b/test/Parser/cxx-condition.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -parse-noop -verify %s
+// RUN: %clang_cc1 -parse-noop -verify %s
void f() {
int a;
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
index 6f3fd391b95a..3c88b7adfa84 100644
--- a/test/Parser/cxx-decl.cpp
+++ b/test/Parser/cxx-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only %s
int x(*g); // expected-error {{use of undeclared identifier 'g'}}
@@ -51,4 +51,4 @@ void test(struct Type *P) {
Type = 1 ? (
(y:b) // expected-error {{unexpected ':' in nested name specifier}}
4) : 5;
-} \ No newline at end of file
+}
diff --git a/test/Parser/cxx-exception-spec.cpp b/test/Parser/cxx-exception-spec.cpp
index 0a87ab702302..e6c3c757f012 100644
--- a/test/Parser/cxx-exception-spec.cpp
+++ b/test/Parser/cxx-exception-spec.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
struct X { };
diff --git a/test/Parser/cxx-extern-c-array.cpp b/test/Parser/cxx-extern-c-array.cpp
index 1a04fa05c24e..14912fd1067b 100644
--- a/test/Parser/cxx-extern-c-array.cpp
+++ b/test/Parser/cxx-extern-c-array.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
extern "C" int myarray[];
int myarray[12] = {0};
diff --git a/test/Parser/cxx-friend.cpp b/test/Parser/cxx-friend.cpp
index 6505ad0f6f76..2fe30cd3e428 100644
--- a/test/Parser/cxx-friend.cpp
+++ b/test/Parser/cxx-friend.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class C {
friend class D;
diff --git a/test/Parser/cxx-member-initializers.cpp b/test/Parser/cxx-member-initializers.cpp
index bebb5c5e40d1..34a725ff43af 100644
--- a/test/Parser/cxx-member-initializers.cpp
+++ b/test/Parser/cxx-member-initializers.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct x {
x() : a(4) ; // expected-error {{expected '{'}}
diff --git a/test/Parser/cxx-namespace-alias.cpp b/test/Parser/cxx-namespace-alias.cpp
index 65e1459d379b..2e4d7af6bf30 100644
--- a/test/Parser/cxx-namespace-alias.cpp
+++ b/test/Parser/cxx-namespace-alias.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -parse-noop -verify %s
+// RUN: %clang_cc1 -parse-noop -verify %s
namespace A = B;
diff --git a/test/Parser/cxx-reference.cpp b/test/Parser/cxx-reference.cpp
index 0d2b9d29c369..46f9fb07dba0 100644
--- a/test/Parser/cxx-reference.cpp
+++ b/test/Parser/cxx-reference.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
extern char *bork;
char *& bar = bork;
diff --git a/test/Parser/cxx-stmt.cpp b/test/Parser/cxx-stmt.cpp
index cc35ba153f6b..fdd573e6bfa5 100644
--- a/test/Parser/cxx-stmt.cpp
+++ b/test/Parser/cxx-stmt.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f1()
{
@@ -51,4 +51,10 @@ void f4() {
switch (Kind) {
case Type: i = 7; break; // no error.
}
-} \ No newline at end of file
+}
+
+// PR5500
+void f5() {
+ asm volatile ("":: :"memory");
+ asm volatile ("": ::"memory");
+}
diff --git a/test/Parser/cxx-template-argument.cpp b/test/Parser/cxx-template-argument.cpp
new file mode 100644
index 000000000000..80389a07b0ac
--- /dev/null
+++ b/test/Parser/cxx-template-argument.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename T> struct A {};
+
+// Check for template argument lists followed by junk
+// FIXME: The diagnostics here aren't great...
+A<int+> int x; // expected-error {{expected '>'}} expected-error {{expected unqualified-id}}
+A<int x; // expected-error {{expected '>'}} expected-error {{C++ requires a type specifier for all declarations}}
+
diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp
index 644f0def79c9..5cb84a63069b 100644
--- a/test/Parser/cxx-template-decl.cpp
+++ b/test/Parser/cxx-template-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Errors
export class foo { }; // expected-error {{expected template}}
diff --git a/test/Parser/cxx-throw.cpp b/test/Parser/cxx-throw.cpp
index bcc49ec1b4fb..a87881647dd4 100644
--- a/test/Parser/cxx-throw.cpp
+++ b/test/Parser/cxx-throw.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int i;
diff --git a/test/Parser/cxx-typeid.cpp b/test/Parser/cxx-typeid.cpp
index 5a92e7322f1f..a825dc3cc7a5 100644
--- a/test/Parser/cxx-typeid.cpp
+++ b/test/Parser/cxx-typeid.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// FIXME: This should really include <typeinfo>, but we don't have that yet.
namespace std {
diff --git a/test/Parser/cxx-typeof.cpp b/test/Parser/cxx-typeof.cpp
index 0bf446316cfc..7e891013e92c 100644
--- a/test/Parser/cxx-typeof.cpp
+++ b/test/Parser/cxx-typeof.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
static void test() {
int *pi;
diff --git a/test/Parser/cxx-using-declaration.cpp b/test/Parser/cxx-using-declaration.cpp
index 20c9fb391a80..2b2a69d1a421 100644
--- a/test/Parser/cxx-using-declaration.cpp
+++ b/test/Parser/cxx-using-declaration.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace A {
int VA;
diff --git a/test/Parser/cxx-using-directive.cpp b/test/Parser/cxx-using-directive.cpp
index 504d026b4391..1e918996d147 100644
--- a/test/Parser/cxx-using-directive.cpp
+++ b/test/Parser/cxx-using-directive.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class A {};
diff --git a/test/Parser/cxx-variadic-func.cpp b/test/Parser/cxx-variadic-func.cpp
index 86d6b6bf2c5d..b9360d6ed10a 100644
--- a/test/Parser/cxx-variadic-func.cpp
+++ b/test/Parser/cxx-variadic-func.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
void f(...) {
int g(int(...));
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index a66e3e059766..67b2ea6f62ea 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
// Declaration syntax checks
[[]] int before_attr;
diff --git a/test/Parser/cxx0x-literal-operators.cpp b/test/Parser/cxx0x-literal-operators.cpp
index c5514601d116..830754e56ae0 100644
--- a/test/Parser/cxx0x-literal-operators.cpp
+++ b/test/Parser/cxx0x-literal-operators.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
void operator "" (); // expected-error {{expected identifier}}
void operator "k" foo(); // expected-error {{string literal after 'operator' must be '""'}}
diff --git a/test/Parser/cxx0x-rvalue-reference.cpp b/test/Parser/cxx0x-rvalue-reference.cpp
index 389f2b947003..ae568e8859c0 100644
--- a/test/Parser/cxx0x-rvalue-reference.cpp
+++ b/test/Parser/cxx0x-rvalue-reference.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
int && r1(int &&a);
diff --git a/test/Parser/declarators.c b/test/Parser/declarators.c
index da8327a1e834..3831199c8d71 100644
--- a/test/Parser/declarators.c
+++ b/test/Parser/declarators.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -pedantic
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
extern int a1[];
diff --git a/test/Parser/designator.c b/test/Parser/designator.c
index 76c2d435227f..6badab7a75c3 100644
--- a/test/Parser/designator.c
+++ b/test/Parser/designator.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify -pedantic
+// RUN: %clang_cc1 -fsyntax-only %s -verify -pedantic
int X[] = {
[4]4, // expected-warning {{use of GNU 'missing =' extension in designator}}
diff --git a/test/Parser/encode.m b/test/Parser/encode.m
index 15e9fe9828be..e0e753508119 100644
--- a/test/Parser/encode.m
+++ b/test/Parser/encode.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int main(void) {
const char ch = @encode(char *)[2];
diff --git a/test/Parser/enhanced-proto-1.m b/test/Parser/enhanced-proto-1.m
index b80eb7d09d8f..a3819f3a1958 100644
--- a/test/Parser/enhanced-proto-1.m
+++ b/test/Parser/enhanced-proto-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol MyProto1
@optional
diff --git a/test/Parser/expressions.c b/test/Parser/expressions.c
index 2b4d4636ebb1..44ebe661befd 100644
--- a/test/Parser/expressions.c
+++ b/test/Parser/expressions.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -parse-noop -verify %s
+// RUN: %clang_cc1 -parse-noop -verify %s
void test1() {
if (sizeof (int){ 1}); // sizeof compound literal
diff --git a/test/Parser/expressions.m b/test/Parser/expressions.m
index 9adc34af1fc7..e27f40506926 100644
--- a/test/Parser/expressions.m
+++ b/test/Parser/expressions.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -parse-noop %s
+// RUN: %clang_cc1 -parse-noop %s
void test1() {
@"s"; // expected-warning {{expression result unused}}
diff --git a/test/Parser/extension.c b/test/Parser/extension.c
index 519dc053c82f..fd4cf8086748 100644
--- a/test/Parser/extension.c
+++ b/test/Parser/extension.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc %s -fsyntax-only -pedantic -verify -std=c89
+/* RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify -std=c89
*/
/* Top level extension marker. */
diff --git a/test/Parser/function-decls.c b/test/Parser/function-decls.c
index 28bb5c2e18da..db9a98b391e6 100644
--- a/test/Parser/function-decls.c
+++ b/test/Parser/function-decls.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc %s -ast-print
+/* RUN: %clang_cc1 %s -ast-print
*/
void foo() {
diff --git a/test/Parser/goto-ident.c b/test/Parser/goto-ident.c
index e8d1963e38c2..32051dc677ec 100644
--- a/test/Parser/goto-ident.c
+++ b/test/Parser/goto-ident.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -fsyntax-only -verify %s
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
*/
void foo() {
diff --git a/test/Parser/if-scope-c90.c b/test/Parser/if-scope-c90.c
index c372f0fc4f4d..c368fabb80ed 100644
--- a/test/Parser/if-scope-c90.c
+++ b/test/Parser/if-scope-c90.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c90 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c90 %s
int f (int z)
{
diff --git a/test/Parser/if-scope-c99.c b/test/Parser/if-scope-c99.c
index 0cb2495efce2..63f82e0f7aa7 100644
--- a/test/Parser/if-scope-c99.c
+++ b/test/Parser/if-scope-c99.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c99 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c99 %s
int f (int z)
{
diff --git a/test/Parser/implicit-casts.c b/test/Parser/implicit-casts.c
index 3e8f599047c4..900b4ece8bab 100644
--- a/test/Parser/implicit-casts.c
+++ b/test/Parser/implicit-casts.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
_Complex double X;
void test1(int c) {
X = 5;
diff --git a/test/Parser/method-prototype-1.m b/test/Parser/method-prototype-1.m
index 86a912f46eb7..d2d9563a2ec4 100644
--- a/test/Parser/method-prototype-1.m
+++ b/test/Parser/method-prototype-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -parse-noop
+// RUN: %clang_cc1 %s -parse-noop
@interface MyObject
- (void) bycopy : (int) woodo, ... ;
- (void) break : (int) woodo, ... ;
diff --git a/test/Parser/namelookup-bug-1.c b/test/Parser/namelookup-bug-1.c
index 3c8b85a2d61a..8667a71657cc 100644
--- a/test/Parser/namelookup-bug-1.c
+++ b/test/Parser/namelookup-bug-1.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
typedef int Object;
diff --git a/test/Parser/namelookup-bug-2.c b/test/Parser/namelookup-bug-2.c
index 42298c39c46f..84850ffafb17 100644
--- a/test/Parser/namelookup-bug-2.c
+++ b/test/Parser/namelookup-bug-2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
typedef int Object;
diff --git a/test/Parser/namespace-alias-attr.cpp b/test/Parser/namespace-alias-attr.cpp
index 9e4072cde225..ba809229a646 100644
--- a/test/Parser/namespace-alias-attr.cpp
+++ b/test/Parser/namespace-alias-attr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
namespace A
{
diff --git a/test/Parser/objc-alias-printing.m b/test/Parser/objc-alias-printing.m
index afb522cfa3d9..8b9cc6e13924 100644
--- a/test/Parser/objc-alias-printing.m
+++ b/test/Parser/objc-alias-printing.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -ast-print %s
+// RUN: %clang_cc1 -ast-print %s
@protocol P1 @end
@protocol P2 @end
diff --git a/test/Parser/objc-category-neg-1.m b/test/Parser/objc-category-neg-1.m
index 957dbde2d7fa..5799db0bd2e7 100644
--- a/test/Parser/objc-category-neg-1.m
+++ b/test/Parser/objc-category-neg-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void __assert_rtn(const char *, const char *, int, const char *) __attribute__((__noreturn__));
static __inline__ int __inline_isfinitef (float ) __attribute__ ((always_inline));
diff --git a/test/Parser/objc-forcollection-1.m b/test/Parser/objc-forcollection-1.m
index 6075332dcd5b..4850deb1fa9a 100644
--- a/test/Parser/objc-forcollection-1.m
+++ b/test/Parser/objc-forcollection-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
typedef struct objc_class *Class;
typedef struct objc_object {
diff --git a/test/Parser/objc-forcollection-neg-2.m b/test/Parser/objc-forcollection-neg-2.m
index 9019d441a60a..e02c51c1ba35 100644
--- a/test/Parser/objc-forcollection-neg-2.m
+++ b/test/Parser/objc-forcollection-neg-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct objc_class *Class;
typedef struct objc_object {
diff --git a/test/Parser/objc-forcollection-neg.m b/test/Parser/objc-forcollection-neg.m
index 464759e0d175..0ba093efa08a 100644
--- a/test/Parser/objc-forcollection-neg.m
+++ b/test/Parser/objc-forcollection-neg.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct objc_class *Class;
typedef struct objc_object {
diff --git a/test/Parser/objc-foreach-syntax.m b/test/Parser/objc-foreach-syntax.m
index 294a6029378c..943540ef1f23 100644
--- a/test/Parser/objc-foreach-syntax.m
+++ b/test/Parser/objc-foreach-syntax.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
diff --git a/test/Parser/objc-init.m b/test/Parser/objc-init.m
index b3f033ea25f1..0c23aebc878c 100644
--- a/test/Parser/objc-init.m
+++ b/test/Parser/objc-init.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s -pedantic
+// RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic
// rdar://5707001
@interface NSNumber;
diff --git a/test/Parser/objc-interfaces.m b/test/Parser/objc-interfaces.m
index fdb52e763f2c..aac3faa4350a 100644
--- a/test/Parser/objc-interfaces.m
+++ b/test/Parser/objc-interfaces.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// Test features and error recovery for objc interfaces.
diff --git a/test/Parser/objc-messaging-1.m b/test/Parser/objc-messaging-1.m
index 2ee3639b06cb..511290eabfc0 100644
--- a/test/Parser/objc-messaging-1.m
+++ b/test/Parser/objc-messaging-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -parse-noop
+// RUN: %clang_cc1 %s -parse-noop
int main ()
{
int i,j;
diff --git a/test/Parser/objc-messaging-neg-1.m b/test/Parser/objc-messaging-neg-1.m
index 4dcbb79a996a..0d0cb9d8d6fe 100644
--- a/test/Parser/objc-messaging-neg-1.m
+++ b/test/Parser/objc-messaging-neg-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int main() {
id a;
diff --git a/test/Parser/objc-missing-impl.m b/test/Parser/objc-missing-impl.m
index 392b26f63838..05d9d6c0b232 100644
--- a/test/Parser/objc-missing-impl.m
+++ b/test/Parser/objc-missing-impl.m
@@ -1,2 +1,2 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@end // expected-warning {{@end must appear in an @implementation context}}
diff --git a/test/Parser/objc-property-syntax.m b/test/Parser/objc-property-syntax.m
index 294fb541e474..b5f57f305f39 100644
--- a/test/Parser/objc-property-syntax.m
+++ b/test/Parser/objc-property-syntax.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface MyClass {
diff --git a/test/Parser/objc-quirks.m b/test/Parser/objc-quirks.m
index 233739bc38d0..62984a458f36 100644
--- a/test/Parser/objc-quirks.m
+++ b/test/Parser/objc-quirks.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// FIXME: This is a horrible error message here. Fix.
int @"s" = 5; // expected-error {{prefix attribute must be}}
diff --git a/test/Parser/objc-synthesized-recover.m b/test/Parser/objc-synthesized-recover.m
index dbe9b1d93b61..3f04a8c21d39 100644
--- a/test/Parser/objc-synthesized-recover.m
+++ b/test/Parser/objc-synthesized-recover.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface I1
{
diff --git a/test/Parser/objc-try-catch-1.m b/test/Parser/objc-try-catch-1.m
index 25b52794a77d..1934cbd3b83d 100644
--- a/test/Parser/objc-try-catch-1.m
+++ b/test/Parser/objc-try-catch-1.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
-// RUN: clang -cc1 -fsyntax-only -verify -x objective-c++ %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -x objective-c++ %s
void * proc();
@interface NSConstantString
diff --git a/test/Parser/objc-type-printing.m b/test/Parser/objc-type-printing.m
index e619b72ab6b1..9bbdac98bcbd 100644
--- a/test/Parser/objc-type-printing.m
+++ b/test/Parser/objc-type-printing.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -ast-print %s
+// RUN: %clang_cc1 -ast-print %s
@protocol P1 @end
@protocol P2 @end
diff --git a/test/Parser/offsetof.c b/test/Parser/offsetof.c
index 6c4e3feaa694..3a5b9f36c7f2 100644
--- a/test/Parser/offsetof.c
+++ b/test/Parser/offsetof.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct a { struct { int b; } x[2]; };
diff --git a/test/Parser/parmvardecl_conversion.c b/test/Parser/parmvardecl_conversion.c
index f35487ee95c6..9fa8a6880a21 100644
--- a/test/Parser/parmvardecl_conversion.c
+++ b/test/Parser/parmvardecl_conversion.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f (int p[]) { p++; }
diff --git a/test/Parser/pointer-arithmetic.c b/test/Parser/pointer-arithmetic.c
index d252b42c9b15..87eb1a270494 100644
--- a/test/Parser/pointer-arithmetic.c
+++ b/test/Parser/pointer-arithmetic.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int *test1(int *a) { return a + 1; }
int *test2(int *a) { return 1 + a; }
diff --git a/test/Parser/pointer_promotion.c b/test/Parser/pointer_promotion.c
index 3226eabbf53d..30589d01326f 100644
--- a/test/Parser/pointer_promotion.c
+++ b/test/Parser/pointer_promotion.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void test() {
void *vp;
diff --git a/test/Parser/pragma-pack.c b/test/Parser/pragma-pack.c
index d42bbe5c40d2..84778cd501d0 100644
--- a/test/Parser/pragma-pack.c
+++ b/test/Parser/pragma-pack.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Note that this puts the expected lines before the directives to work around
// limitations in the -verify mode.
diff --git a/test/Parser/pragma-weak.c b/test/Parser/pragma-weak.c
index dca0f8dd4c15..7e5740b48308 100644
--- a/test/Parser/pragma-weak.c
+++ b/test/Parser/pragma-weak.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Note that this puts the expected lines before the directives to work around
// limitations in the -verify mode.
diff --git a/test/Parser/prefix-attributes.m b/test/Parser/prefix-attributes.m
index 31be34076fe3..399421fd728f 100644
--- a/test/Parser/prefix-attributes.m
+++ b/test/Parser/prefix-attributes.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only %s
__attribute__((deprecated)) @class B; // expected-error {{prefix attribute must be followed by an interface or protocol}}
diff --git a/test/Parser/promote_types_in_proto.c b/test/Parser/promote_types_in_proto.c
index faff3e35d5a3..969ba28120f2 100644
--- a/test/Parser/promote_types_in_proto.c
+++ b/test/Parser/promote_types_in_proto.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s
+// RUN: %clang_cc1 %s
void functionPromotion(void f(char *const []));
void arrayPromotion(char * const argv[]);
diff --git a/test/Parser/recovery.c b/test/Parser/recovery.c
index 43d3e2d8a69d..8e7181e0ba05 100644
--- a/test/Parser/recovery.c
+++ b/test/Parser/recovery.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic -fblocks %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fblocks %s
// PR2241
float test2241[2] = {
diff --git a/test/Parser/selector-1.m b/test/Parser/selector-1.m
index fdc74ff4b424..1f9cad62aee3 100644
--- a/test/Parser/selector-1.m
+++ b/test/Parser/selector-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -parse-noop %s
+// RUN: %clang_cc1 -parse-noop %s
int main() {
SEL s = @selector(retain);
diff --git a/test/Parser/statements.c b/test/Parser/statements.c
index 25e06a27bd13..8fec0f1b262f 100644
--- a/test/Parser/statements.c
+++ b/test/Parser/statements.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void test1() {
{ ; { ;;}} ;;
diff --git a/test/Parser/struct-recursion.c b/test/Parser/struct-recursion.c
index 11e5f7e97ab1..834c5d0f771f 100644
--- a/test/Parser/struct-recursion.c
+++ b/test/Parser/struct-recursion.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only
+// RUN: %clang_cc1 %s -fsyntax-only
// C99 6.7.2.3p11
diff --git a/test/Parser/top-level-semi-cxx0x.cpp b/test/Parser/top-level-semi-cxx0x.cpp
index e83fd9e8dbd7..592483c86bb6 100644
--- a/test/Parser/top-level-semi-cxx0x.cpp
+++ b/test/Parser/top-level-semi-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++0x -verify %s
void foo();
diff --git a/test/Parser/traditional_arg_scope.c b/test/Parser/traditional_arg_scope.c
index 2a21ec3708d4..3811d0d88cde 100644
--- a/test/Parser/traditional_arg_scope.c
+++ b/test/Parser/traditional_arg_scope.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify
+// RUN: %clang_cc1 -fsyntax-only %s -verify
int x(a) int a; {return a;}
int y(b) int b; {return a;} // expected-error {{use of undeclared identifier}}
diff --git a/test/Parser/typeof.c b/test/Parser/typeof.c
index a7c488023ae2..cf0e47a6b124 100644
--- a/test/Parser/typeof.c
+++ b/test/Parser/typeof.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef int TInt;
diff --git a/test/Parser/types.c b/test/Parser/types.c
index 2131ab0346f4..0e8a63d81fc0 100644
--- a/test/Parser/types.c
+++ b/test/Parser/types.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -parse-noop
+// RUN: %clang_cc1 %s -parse-noop
// Test the X can be overloaded inside the struct.
typedef int X;
diff --git a/test/Preprocessor/_Pragma-dependency.c b/test/Preprocessor/_Pragma-dependency.c
index 17c5355302c2..a2861c97cb85 100644
--- a/test/Preprocessor/_Pragma-dependency.c
+++ b/test/Preprocessor/_Pragma-dependency.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc %s -E 2>&1 | grep 'DO_PRAGMA (STR'
-// RUN: clang-cc %s -E 2>&1 | grep '7:3'
+// RUN: %clang_cc1 %s -E 2>&1 | grep 'DO_PRAGMA (STR'
+// RUN: %clang_cc1 %s -E 2>&1 | grep '7:3'
#define DO_PRAGMA _Pragma
#define STR "GCC dependency \"parse.y\"")
diff --git a/test/Preprocessor/_Pragma-dependency2.c b/test/Preprocessor/_Pragma-dependency2.c
index c21c7c85d485..c178764e5e2e 100644
--- a/test/Preprocessor/_Pragma-dependency2.c
+++ b/test/Preprocessor/_Pragma-dependency2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s -verify
+// RUN: %clang_cc1 -E %s -verify
#define DO_PRAGMA _Pragma
DO_PRAGMA ("GCC dependency \"blahblabh\"") // expected-error {{file not found}}
diff --git a/test/Preprocessor/_Pragma-location.c b/test/Preprocessor/_Pragma-location.c
index 61cadfbb8a18..8b68d6ca1f76 100644
--- a/test/Preprocessor/_Pragma-location.c
+++ b/test/Preprocessor/_Pragma-location.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E | not grep 'scratch space'
+// RUN: %clang_cc1 %s -E | not grep 'scratch space'
#define push _Pragma ("pack(push)")
push
diff --git a/test/Preprocessor/_Pragma-physloc.c b/test/Preprocessor/_Pragma-physloc.c
index 016c97b82fd8..a093af214179 100644
--- a/test/Preprocessor/_Pragma-physloc.c
+++ b/test/Preprocessor/_Pragma-physloc.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc %s -E | grep '#pragma x y z'
-// RUN: clang-cc %s -E | grep '#pragma a b c'
+// RUN: %clang_cc1 %s -E | grep '#pragma x y z'
+// RUN: %clang_cc1 %s -E | grep '#pragma a b c'
_Pragma("x y z")
_Pragma("a b c")
diff --git a/test/Preprocessor/_Pragma.c b/test/Preprocessor/_Pragma.c
index 9c0c97d1f011..0a83b149ff75 100644
--- a/test/Preprocessor/_Pragma.c
+++ b/test/Preprocessor/_Pragma.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -Wall
+// RUN: %clang_cc1 %s -verify -Wall
_Pragma ("GCC system_header") // expected-warning {{system_header ignored in main file}}
diff --git a/test/Preprocessor/assembler-with-cpp.c b/test/Preprocessor/assembler-with-cpp.c
index 17880c8da7e3..0543077c01c7 100644
--- a/test/Preprocessor/assembler-with-cpp.c
+++ b/test/Preprocessor/assembler-with-cpp.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -x assembler-with-cpp -E %s -o - | FileCheck -strict-whitespace -check-prefix=CHECK-Identifiers-False %s
+// RUN: %clang_cc1 -x assembler-with-cpp -E %s -o - | FileCheck -strict-whitespace -check-prefix=CHECK-Identifiers-False %s
#ifndef __ASSEMBLER__
#error "__ASSEMBLER__ not defined"
@@ -49,7 +49,7 @@
6: FOO(blarg)
// CHECK-Identifiers-False: 6: blarg $foo
-// RUN: clang-cc -x assembler-with-cpp -fdollars-in-identifiers -E %s -o - | FileCheck -check-prefix=CHECK-Identifiers-True -strict-whitespace %s
+// RUN: %clang_cc1 -x assembler-with-cpp -fdollars-in-identifiers -E %s -o - | FileCheck -check-prefix=CHECK-Identifiers-True -strict-whitespace %s
#define FOO(name) name ## $foo
7: FOO(blarg)
// CHECK-Identifiers-True: 7: blarg$foo
diff --git a/test/Preprocessor/builtin_line.c b/test/Preprocessor/builtin_line.c
index 06a2ac20d04c..52228b5fdbf5 100644
--- a/test/Preprocessor/builtin_line.c
+++ b/test/Preprocessor/builtin_line.c
@@ -1,10 +1,10 @@
-// RUN: clang-cc %s -E | grep "^ 4"
+// RUN: %clang_cc1 %s -E | grep "^ 4"
#define FOO __LINE__
FOO
// PR3579 - This should expand to the __LINE__ of the ')' not of the X.
-// RUN: clang-cc %s -E | grep "^A 13"
+// RUN: %clang_cc1 %s -E | grep "^A 13"
#define X() __LINE__
diff --git a/test/Preprocessor/c90.c b/test/Preprocessor/c90.c
index ed63d1b3d7cc..1d5010d75e34 100644
--- a/test/Preprocessor/c90.c
+++ b/test/Preprocessor/c90.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc %s -std=c89 -Eonly -verify -pedantic-errors
+/* RUN: %clang_cc1 %s -std=c89 -Eonly -verify -pedantic-errors
*/
/* PR3919 */
diff --git a/test/Preprocessor/c99-6_10_3_3_p4.c b/test/Preprocessor/c99-6_10_3_3_p4.c
index 99ad6e88a3f9..320e6cf3e2a2 100644
--- a/test/Preprocessor/c99-6_10_3_3_p4.c
+++ b/test/Preprocessor/c99-6_10_3_3_p4.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
#define hash_hash # ## #
#define mkstr(a) # a
diff --git a/test/Preprocessor/c99-6_10_3_4_p5.c b/test/Preprocessor/c99-6_10_3_4_p5.c
index 08b2c423601f..6dea09d1130a 100644
--- a/test/Preprocessor/c99-6_10_3_4_p5.c
+++ b/test/Preprocessor/c99-6_10_3_4_p5.c
@@ -1,5 +1,5 @@
// Example from C99 6.10.3.4p5
-// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
#define x 3
#define f(a) f(x * (a))
diff --git a/test/Preprocessor/c99-6_10_3_4_p6.c b/test/Preprocessor/c99-6_10_3_4_p6.c
index 8072d7b87bf2..98bacb24e1d3 100644
--- a/test/Preprocessor/c99-6_10_3_4_p6.c
+++ b/test/Preprocessor/c99-6_10_3_4_p6.c
@@ -1,6 +1,6 @@
// Example from C99 6.10.3.4p6
-// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
#define str(s) # s
#define xstr(s) str(s)
diff --git a/test/Preprocessor/c99-6_10_3_4_p7.c b/test/Preprocessor/c99-6_10_3_4_p7.c
index 6a7eb48173b8..b63209b26891 100644
--- a/test/Preprocessor/c99-6_10_3_4_p7.c
+++ b/test/Preprocessor/c99-6_10_3_4_p7.c
@@ -1,6 +1,6 @@
// Example from C99 6.10.3.4p7
-// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
#define t(x,y,z) x ## y ## z
int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
diff --git a/test/Preprocessor/c99-6_10_3_4_p9.c b/test/Preprocessor/c99-6_10_3_4_p9.c
index 704241e46e3f..04c4b79700db 100644
--- a/test/Preprocessor/c99-6_10_3_4_p9.c
+++ b/test/Preprocessor/c99-6_10_3_4_p9.c
@@ -1,6 +1,6 @@
// Example from C99 6.10.3.4p9
-// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define showlist(...) puts(#__VA_ARGS__)
diff --git a/test/Preprocessor/clang_headers.c b/test/Preprocessor/clang_headers.c
index 1cb331998f43..f2dec4fbe565 100644
--- a/test/Preprocessor/clang_headers.c
+++ b/test/Preprocessor/clang_headers.c
@@ -1,3 +1,3 @@
-// RUN: clang-cc -E %s
+// RUN: %clang_cc1 -E %s
#include <limits.h>
diff --git a/test/Preprocessor/comment_save.c b/test/Preprocessor/comment_save.c
index ae609b117e7e..b86004272b20 100644
--- a/test/Preprocessor/comment_save.c
+++ b/test/Preprocessor/comment_save.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E -C %s | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -E -C %s | FileCheck -strict-whitespace %s
// foo
// CHECK: // foo
diff --git a/test/Preprocessor/comment_save_if.c b/test/Preprocessor/comment_save_if.c
index c08b2d7c78b7..2f35bcb9e8c6 100644
--- a/test/Preprocessor/comment_save_if.c
+++ b/test/Preprocessor/comment_save_if.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E -CC -pedantic 2>&1 | grep -v '^/' | not grep warning
+// RUN: %clang_cc1 %s -E -CC -pedantic 2>&1 | grep -v '^/' | not grep warning
#if 1 /*bar */
diff --git a/test/Preprocessor/comment_save_macro.c b/test/Preprocessor/comment_save_macro.c
index 76a21bfbdea8..6ad759f5c31a 100644
--- a/test/Preprocessor/comment_save_macro.c
+++ b/test/Preprocessor/comment_save_macro.c
@@ -1,10 +1,10 @@
-// RUN: clang-cc -E -C %s | FileCheck -check-prefix=CHECK-C -strict-whitespace %s
+// RUN: %clang_cc1 -E -C %s | FileCheck -check-prefix=CHECK-C -strict-whitespace %s
// CHECK-C: boo bork bar // zot
-// RUN: clang-cc -E -CC %s | FileCheck -check-prefix=CHECK-CC -strict-whitespace %s
+// RUN: %clang_cc1 -E -CC %s | FileCheck -check-prefix=CHECK-CC -strict-whitespace %s
// CHECK-CC: boo bork /* blah*/ bar // zot
-// RUN: clang-cc -E %s | FileCheck -check-prefix=CHECK -strict-whitespace %s
+// RUN: %clang_cc1 -E %s | FileCheck -check-prefix=CHECK -strict-whitespace %s
// CHECK: boo bork bar
diff --git a/test/Preprocessor/cxx_and.cpp b/test/Preprocessor/cxx_and.cpp
index 747091387fde..a84ffe7f2665 100644
--- a/test/Preprocessor/cxx_and.cpp
+++ b/test/Preprocessor/cxx_and.cpp
@@ -1,7 +1,7 @@
-// RUN: clang-cc -DA -DB -E %s | grep 'int a = 37 == 37'
-// RUN: clang-cc -DA -E %s | grep 'int a = 927 == 927'
-// RUN: clang-cc -DB -E %s | grep 'int a = 927 == 927'
-// RUN: clang-cc -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -DA -DB -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -DA -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -DB -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927'
#if defined(A) and defined(B)
#define X 37
#else
diff --git a/test/Preprocessor/cxx_bitand.cpp b/test/Preprocessor/cxx_bitand.cpp
index e6b7c2c6370a..01b4ff1909d0 100644
--- a/test/Preprocessor/cxx_bitand.cpp
+++ b/test/Preprocessor/cxx_bitand.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -DA=1 -DB=2 -E %s | grep 'int a = 927 == 927'
-// RUN: clang-cc -DA=1 -DB=1 -E %s | grep 'int a = 37 == 37'
-// RUN: clang-cc -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -DA=1 -DB=2 -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -DA=1 -DB=1 -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927'
#if A bitand B
#define X 37
#else
diff --git a/test/Preprocessor/cxx_bitor.cpp b/test/Preprocessor/cxx_bitor.cpp
index e72fcb44a950..c92596e5e175 100644
--- a/test/Preprocessor/cxx_bitor.cpp
+++ b/test/Preprocessor/cxx_bitor.cpp
@@ -1,8 +1,8 @@
-// RUN: clang-cc -DA=1 -DB=1 -E %s | grep 'int a = 37 == 37'
-// RUN: clang-cc -DA=0 -DB=1 -E %s | grep 'int a = 37 == 37'
-// RUN: clang-cc -DA=1 -DB=0 -E %s | grep 'int a = 37 == 37'
-// RUN: clang-cc -DA=0 -DB=0 -E %s | grep 'int a = 927 == 927'
-// RUN: clang-cc -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -DA=1 -DB=1 -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -DA=0 -DB=1 -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -DA=1 -DB=0 -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -DA=0 -DB=0 -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927'
#if A bitor B
#define X 37
#else
diff --git a/test/Preprocessor/cxx_compl.cpp b/test/Preprocessor/cxx_compl.cpp
index b319c51f29fb..824092c16f50 100644
--- a/test/Preprocessor/cxx_compl.cpp
+++ b/test/Preprocessor/cxx_compl.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -DA=1 -E %s | grep 'int a = 37 == 37'
-// RUN: clang-cc -DA=0 -E %s | grep 'int a = 927 == 927'
-// RUN: clang-cc -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -DA=1 -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -DA=0 -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927'
#if compl 0 bitand A
#define X 37
#else
diff --git a/test/Preprocessor/cxx_not.cpp b/test/Preprocessor/cxx_not.cpp
index 2272941b68da..67e8775295ad 100644
--- a/test/Preprocessor/cxx_not.cpp
+++ b/test/Preprocessor/cxx_not.cpp
@@ -1,5 +1,5 @@
-// RUN: clang-cc -DA=1 -E %s | grep 'int a = 927 == 927'
-// RUN: clang-cc -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -DA=1 -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -E %s | grep 'int a = 37 == 37'
#if not defined(A)
#define X 37
#else
diff --git a/test/Preprocessor/cxx_not_eq.cpp b/test/Preprocessor/cxx_not_eq.cpp
index 92418b287a50..f7670fabf853 100644
--- a/test/Preprocessor/cxx_not_eq.cpp
+++ b/test/Preprocessor/cxx_not_eq.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -DA=1 -DB=1 -E %s | grep 'int a = 927 == 927'
-// RUN: clang-cc -E %s | grep 'int a = 927 == 927'
-// RUN: clang-cc -DA=1 -DB=2 -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -DA=1 -DB=1 -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -DA=1 -DB=2 -E %s | grep 'int a = 37 == 37'
#if A not_eq B
#define X 37
#else
diff --git a/test/Preprocessor/cxx_oper_keyword.cpp b/test/Preprocessor/cxx_oper_keyword.cpp
index 0464e97eb903..3fc246dd6c2a 100644
--- a/test/Preprocessor/cxx_oper_keyword.cpp
+++ b/test/Preprocessor/cxx_oper_keyword.cpp
@@ -1,5 +1,5 @@
-// RUN: not clang-cc %s -E
-// RUN: clang-cc %s -E -fno-operator-names
+// RUN: not %clang_cc1 %s -E
+// RUN: %clang_cc1 %s -E -fno-operator-names
// Not valid in C++ unless -fno-operator-names is passed.
#define and foo
diff --git a/test/Preprocessor/cxx_oper_spelling.cpp b/test/Preprocessor/cxx_oper_spelling.cpp
index 85f0426ca3a9..0ae9afd7eea5 100644
--- a/test/Preprocessor/cxx_oper_spelling.cpp
+++ b/test/Preprocessor/cxx_oper_spelling.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | grep 'a: "and"'
+// RUN: %clang_cc1 -E %s | grep 'a: "and"'
#define X(A) #A
diff --git a/test/Preprocessor/cxx_or.cpp b/test/Preprocessor/cxx_or.cpp
index 2f7c0a5d65db..e8ed92fd062b 100644
--- a/test/Preprocessor/cxx_or.cpp
+++ b/test/Preprocessor/cxx_or.cpp
@@ -1,7 +1,7 @@
-// RUN: clang-cc -DA -DB -E %s | grep 'int a = 37 == 37'
-// RUN: clang-cc -DA -E %s | grep 'int a = 37 == 37'
-// RUN: clang-cc -DB -E %s | grep 'int a = 37 == 37'
-// RUN: clang-cc -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -DA -DB -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -DA -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -DB -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927'
#if defined(A) or defined(B)
#define X 37
#else
diff --git a/test/Preprocessor/cxx_true.cpp b/test/Preprocessor/cxx_true.cpp
index bca70c5949e6..b123e0cb681a 100644
--- a/test/Preprocessor/cxx_true.cpp
+++ b/test/Preprocessor/cxx_true.cpp
@@ -1,6 +1,6 @@
-/* RUN: clang-cc -E %s -x c++ | grep block_1
- RUN: clang-cc -E %s -x c++ | not grep block_2
- RUN: clang-cc -E %s -x c | not grep block
+/* RUN: %clang_cc1 -E %s -x c++ | grep block_1
+ RUN: %clang_cc1 -E %s -x c++ | not grep block_2
+ RUN: %clang_cc1 -E %s -x c | not grep block
*/
#if true
diff --git a/test/Preprocessor/cxx_xor.cpp b/test/Preprocessor/cxx_xor.cpp
index e6df9bb819e1..24a6ce43559c 100644
--- a/test/Preprocessor/cxx_xor.cpp
+++ b/test/Preprocessor/cxx_xor.cpp
@@ -1,8 +1,8 @@
-// RUN: clang-cc -DA=1 -DB=1 -E %s | grep 'int a = 927 == 927'
-// RUN: clang-cc -DA=0 -DB=1 -E %s | grep 'int a = 37 == 37'
-// RUN: clang-cc -DA=1 -DB=0 -E %s | grep 'int a = 37 == 37'
-// RUN: clang-cc -DA=0 -DB=0 -E %s | grep 'int a = 927 == 927'
-// RUN: clang-cc -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -DA=1 -DB=1 -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -DA=0 -DB=1 -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -DA=1 -DB=0 -E %s | grep 'int a = 37 == 37'
+// RUN: %clang_cc1 -DA=0 -DB=0 -E %s | grep 'int a = 927 == 927'
+// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927'
#if A xor B
#define X 37
#else
diff --git a/test/Preprocessor/dependencies-and-pp.c b/test/Preprocessor/dependencies-and-pp.c
index 5359d0af4d7a..d7bf4df51c81 100644
--- a/test/Preprocessor/dependencies-and-pp.c
+++ b/test/Preprocessor/dependencies-and-pp.c
@@ -1,5 +1,5 @@
-// RUN: clang -E -o %t.1 %s
-// RUN: clang -E -MD -MF %t.d -MT foo -o %t.2 %s
+// RUN: %clang -E -o %t.1 %s
+// RUN: %clang -E -MD -MF %t.d -MT foo -o %t.2 %s
// RUN: diff %t.1 %t.2
// RUN: grep "foo:" %t.d
// RUN: grep "dependencies-and-pp.c" %t.d
diff --git a/test/Preprocessor/disabled-cond-diags.c b/test/Preprocessor/disabled-cond-diags.c
index eb7632f29b3f..531842a73158 100644
--- a/test/Preprocessor/disabled-cond-diags.c
+++ b/test/Preprocessor/disabled-cond-diags.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s 2>&1 | not grep "warning\|error"
+// RUN: %clang_cc1 -E %s 2>&1 | not grep "warning\|error"
#if 0
diff --git a/test/Preprocessor/dump-macros-spacing.c b/test/Preprocessor/dump-macros-spacing.c
index 335e37c97e0e..13924422d694 100644
--- a/test/Preprocessor/dump-macros-spacing.c
+++ b/test/Preprocessor/dump-macros-spacing.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E -dD < %s | grep stdin | grep -v define
+// RUN: %clang_cc1 -E -dD < %s | grep stdin | grep -v define
#define A A
/* 1
* 2
diff --git a/test/Preprocessor/dump-options.c b/test/Preprocessor/dump-options.c
index 8302f1a32615..a329bd46ac1d 100644
--- a/test/Preprocessor/dump-options.c
+++ b/test/Preprocessor/dump-options.c
@@ -1,3 +1,3 @@
-// RUN: clang %s -E -dD | grep __INTMAX_MAX__
-// RUN: clang %s -E -dM | grep __INTMAX_MAX__
+// RUN: %clang %s -E -dD | grep __INTMAX_MAX__
+// RUN: %clang %s -E -dM | grep __INTMAX_MAX__
diff --git a/test/Preprocessor/dump_macros.c b/test/Preprocessor/dump_macros.c
index 5908fec4b681..d420eb4066de 100644
--- a/test/Preprocessor/dump_macros.c
+++ b/test/Preprocessor/dump_macros.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E -dM %s -o - | FileCheck %s -strict-whitespace
+// RUN: %clang_cc1 -E -dM %s -o - | FileCheck %s -strict-whitespace
// Space at end even without expansion tokens
// CHECK: #define A(x)
diff --git a/test/Preprocessor/dumptokens_phyloc.c b/test/Preprocessor/dumptokens_phyloc.c
index c0e78c9b155d..7321c0eeef7f 100644
--- a/test/Preprocessor/dumptokens_phyloc.c
+++ b/test/Preprocessor/dumptokens_phyloc.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -dump-tokens %s 2>&1 | grep "Spelling=.*dumptokens_phyloc.c:3:20"
+// RUN: %clang_cc1 -dump-tokens %s 2>&1 | grep "Spelling=.*dumptokens_phyloc.c:3:20"
#define TESTPHYLOC 10
diff --git a/test/Preprocessor/expr_comma.c b/test/Preprocessor/expr_comma.c
index 88ceabf8e480..538727d12bf3 100644
--- a/test/Preprocessor/expr_comma.c
+++ b/test/Preprocessor/expr_comma.c
@@ -1,8 +1,8 @@
// Comma is not allowed in C89
-// RUN: not clang-cc -E %s -std=c89 -pedantic-errors
+// RUN: not %clang_cc1 -E %s -std=c89 -pedantic-errors
// Comma is allowed if unevaluated in C99
-// RUN: clang-cc -E %s -std=c99 -pedantic-errors
+// RUN: %clang_cc1 -E %s -std=c99 -pedantic-errors
// PR2279
diff --git a/test/Preprocessor/expr_invalid_tok.c b/test/Preprocessor/expr_invalid_tok.c
index 8bc2b8eb75c9..5defcc5bfbbd 100644
--- a/test/Preprocessor/expr_invalid_tok.c
+++ b/test/Preprocessor/expr_invalid_tok.c
@@ -1,6 +1,6 @@
-// RUN: not clang-cc -E %s 2>&1 | grep 'invalid token at start of a preprocessor expression'
-// RUN: not clang-cc -E %s 2>&1 | grep 'token is not a valid binary operator in a preprocessor subexpression'
-// RUN: not clang-cc -E %s 2>&1 | grep ':14: error: expected end of line in preprocessor expression'
+// RUN: not %clang_cc1 -E %s 2>&1 | grep 'invalid token at start of a preprocessor expression'
+// RUN: not %clang_cc1 -E %s 2>&1 | grep 'token is not a valid binary operator in a preprocessor subexpression'
+// RUN: not %clang_cc1 -E %s 2>&1 | grep ':14: error: expected end of line in preprocessor expression'
// PR2220
#if 1 * * 2
diff --git a/test/Preprocessor/expr_liveness.c b/test/Preprocessor/expr_liveness.c
index d44b196afa83..c3b64210bb49 100644
--- a/test/Preprocessor/expr_liveness.c
+++ b/test/Preprocessor/expr_liveness.c
@@ -1,5 +1,5 @@
-/* RUN: clang-cc -E %s -DNO_ERRORS -Werror -Wundef
- RUN: not clang-cc -E %s
+/* RUN: %clang_cc1 -E %s -DNO_ERRORS -Werror -Wundef
+ RUN: not %clang_cc1 -E %s
*/
#ifdef NO_ERRORS
diff --git a/test/Preprocessor/expr_multichar.c b/test/Preprocessor/expr_multichar.c
index 4df8f3d4f9ea..8ab12d9ab8aa 100644
--- a/test/Preprocessor/expr_multichar.c
+++ b/test/Preprocessor/expr_multichar.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc < %s -E -verify -triple i686-pc-linux-gnu
+// RUN: %clang_cc1 < %s -E -verify -triple i686-pc-linux-gnu
#if (('1234' >> 24) != '1')
#error Bad multichar constant calculation!
diff --git a/test/Preprocessor/expr_usual_conversions.c b/test/Preprocessor/expr_usual_conversions.c
index 47aca7beca6f..b1bddd34546c 100644
--- a/test/Preprocessor/expr_usual_conversions.c
+++ b/test/Preprocessor/expr_usual_conversions.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E 2>&1 | grep warning | wc -l | grep 2
+// RUN: %clang_cc1 %s -E 2>&1 | grep warning | wc -l | grep 2
#define INTMAX_MIN (-9223372036854775807LL -1)
diff --git a/test/Preprocessor/extension-warning.c b/test/Preprocessor/extension-warning.c
index 7b5095f6e923..4ba57f78f77d 100644
--- a/test/Preprocessor/extension-warning.c
+++ b/test/Preprocessor/extension-warning.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
// The preprocessor shouldn't warn about extensions within macro bodies that
// aren't expanded.
diff --git a/test/Preprocessor/feature_tests.c b/test/Preprocessor/feature_tests.c
index 9ccff0e12025..35592bd8e1c3 100644
--- a/test/Preprocessor/feature_tests.c
+++ b/test/Preprocessor/feature_tests.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc %s -triple=i686-apple-darwin9
-// RUN: clang-cc %s -E -triple=i686-apple-darwin9
+// RUN: %clang_cc1 %s -triple=i686-apple-darwin9
+// RUN: %clang_cc1 %s -E -triple=i686-apple-darwin9
#ifndef __has_feature
#error Should have __has_feature
#endif
diff --git a/test/Preprocessor/function_macro_file.c b/test/Preprocessor/function_macro_file.c
index 6a266dd0790a..c97bb75d8a33 100644
--- a/test/Preprocessor/function_macro_file.c
+++ b/test/Preprocessor/function_macro_file.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -E -P %s | grep f
+/* RUN: %clang_cc1 -E -P %s | grep f
*/
#include "function_macro_file.h"
diff --git a/test/Preprocessor/has_include.c b/test/Preprocessor/has_include.c
index 40697c099f4f..c34c3488036a 100644
--- a/test/Preprocessor/has_include.c
+++ b/test/Preprocessor/has_include.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -Eonly -verify %s
+// RUN: %clang_cc1 -Eonly -verify %s
// Try different path permutations of __has_include with existing file.
#if __has_include("stdio.h")
diff --git a/test/Preprocessor/hash_line.c b/test/Preprocessor/hash_line.c
index 31f708ce73ad..4f724dfbba91 100644
--- a/test/Preprocessor/hash_line.c
+++ b/test/Preprocessor/hash_line.c
@@ -1,7 +1,7 @@
// The 1 and # should not go on the same line.
-// RUN: clang-cc %s -E | not grep "1 #"
-// RUN: clang-cc %s -E | grep '^1$'
-// RUN: clang-cc %s -E | grep '^ #$'
+// RUN: %clang_cc1 %s -E | not grep "1 #"
+// RUN: %clang_cc1 %s -E | grep '^1$'
+// RUN: %clang_cc1 %s -E | grep '^ #$'
1
#define EMPTY
EMPTY #
diff --git a/test/Preprocessor/hash_space.c b/test/Preprocessor/hash_space.c
index e7dbd3bc617b..ac97556cda0d 100644
--- a/test/Preprocessor/hash_space.c
+++ b/test/Preprocessor/hash_space.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E | grep " #"
+// RUN: %clang_cc1 %s -E | grep " #"
// Should put a space before the # so that -fpreprocessed mode doesn't
// macro expand this again.
diff --git a/test/Preprocessor/header_lookup1.c b/test/Preprocessor/header_lookup1.c
index 961e55161418..f93d0afe331e 100644
--- a/test/Preprocessor/header_lookup1.c
+++ b/test/Preprocessor/header_lookup1.c
@@ -1,2 +1,2 @@
-// RUN: clang -fno-ms-extensions -I /usr/include %s -E | grep 'stdio.h.*3.*4'
+// RUN: %clang -fno-ms-extensions -I /usr/include %s -E | grep 'stdio.h.*3.*4'
#include <stdio.h>
diff --git a/test/Preprocessor/if_warning.c b/test/Preprocessor/if_warning.c
index 2ce7b3159982..98653a8feef6 100644
--- a/test/Preprocessor/if_warning.c
+++ b/test/Preprocessor/if_warning.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc %s -Eonly -Werror=undef -verify
-// RUN: clang-cc %s -Eonly -Werror-undef -verify
+// RUN: %clang_cc1 %s -Eonly -Werror=undef -verify
+// RUN: %clang_cc1 %s -Eonly -Werror-undef -verify
extern int x;
diff --git a/test/Preprocessor/ifdef-recover.c b/test/Preprocessor/ifdef-recover.c
index 3fffcc0290de..51d06d1f1b6e 100644
--- a/test/Preprocessor/ifdef-recover.c
+++ b/test/Preprocessor/ifdef-recover.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -E %s 2>&1 >/dev/null | grep error: | count 3
+/* RUN: %clang_cc1 -E %s 2>&1 >/dev/null | grep error: | count 3
*/
#ifdef
diff --git a/test/Preprocessor/import_self.c b/test/Preprocessor/import_self.c
index 2cabe3d71ca6..8ba0b19c94ae 100644
--- a/test/Preprocessor/import_self.c
+++ b/test/Preprocessor/import_self.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E -I. %s | grep BODY_OF_FILE | wc -l | grep 1
+// RUN: %clang_cc1 -E -I. %s | grep BODY_OF_FILE | wc -l | grep 1
// This #import should have no effect, as we're importing the current file.
#import <import_self.c>
diff --git a/test/Preprocessor/include-directive1.c b/test/Preprocessor/include-directive1.c
index 66f70fb3a9e5..20f45829eebb 100644
--- a/test/Preprocessor/include-directive1.c
+++ b/test/Preprocessor/include-directive1.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s -fno-caret-diagnostics 2>&1 >/dev/null | grep 'file successfully included' | count 3
+// RUN: %clang_cc1 -E %s -fno-caret-diagnostics 2>&1 >/dev/null | grep 'file successfully included' | count 3
// XX expands to nothing.
#define XX
diff --git a/test/Preprocessor/include-directive2.c b/test/Preprocessor/include-directive2.c
index 123998246bff..b205325f601e 100644
--- a/test/Preprocessor/include-directive2.c
+++ b/test/Preprocessor/include-directive2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -Eonly -verify %s
+// RUN: %clang_cc1 -Eonly -verify %s
# define HEADER <float.h>
# include HEADER
diff --git a/test/Preprocessor/include-directive3.c b/test/Preprocessor/include-directive3.c
index e5b7a940c6cb..c0e2ae124cd7 100644
--- a/test/Preprocessor/include-directive3.c
+++ b/test/Preprocessor/include-directive3.c
@@ -1,3 +1,3 @@
-// RUN: clang-cc -include %S/file_to_include.h -E %s -fno-caret-diagnostics 2>&1 >/dev/null | grep 'file successfully included' | count 1
+// RUN: %clang_cc1 -include %S/file_to_include.h -E %s -fno-caret-diagnostics 2>&1 >/dev/null | grep 'file successfully included' | count 1
// PR3464
diff --git a/test/Preprocessor/include-macros.c b/test/Preprocessor/include-macros.c
index d64ee5e3e6d9..b86cd0df2611 100644
--- a/test/Preprocessor/include-macros.c
+++ b/test/Preprocessor/include-macros.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E -Dtest=FOO -imacros %S/pr2086.h %s | grep 'HERE: test'
+// RUN: %clang_cc1 -E -Dtest=FOO -imacros %S/pr2086.h %s | grep 'HERE: test'
// This should not be expanded into FOO because pr2086.h undefs 'test'.
HERE: test
diff --git a/test/Preprocessor/include-pth.c b/test/Preprocessor/include-pth.c
index 5634d719f567..e1d6685d1fa5 100644
--- a/test/Preprocessor/include-pth.c
+++ b/test/Preprocessor/include-pth.c
@@ -1,3 +1,3 @@
-// RUN: clang-cc -emit-pth %s -o %t
-// RUN: clang-cc -include-pth %t %s -E | grep 'file_to_include' | count 2
+// RUN: %clang_cc1 -emit-pth %s -o %t
+// RUN: %clang_cc1 -include-pth %t %s -E | grep 'file_to_include' | count 2
#include "file_to_include.h"
diff --git a/test/Preprocessor/indent_macro.c b/test/Preprocessor/indent_macro.c
index f6b411e93ff0..e69500750f51 100644
--- a/test/Preprocessor/indent_macro.c
+++ b/test/Preprocessor/indent_macro.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | grep '^ zzap$'
+// RUN: %clang_cc1 -E %s | grep '^ zzap$'
// zzap is on a new line, should be indented.
#define BLAH zzap
diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
index 163734e185e3..5796b11e14bd 100644
--- a/test/Preprocessor/init.c
+++ b/test/Preprocessor/init.c
@@ -1,15 +1,15 @@
-// RUN: clang-cc -E -dM -x assembler-with-cpp < /dev/null | FileCheck -check-prefix ASM %s
+// RUN: %clang_cc1 -E -dM -x assembler-with-cpp < /dev/null | FileCheck -check-prefix ASM %s
//
// ASM:#define __ASSEMBLER__ 1
//
//
-// RUN: clang-cc -fblocks -E -dM < /dev/null | FileCheck -check-prefix BLOCKS %s
+// RUN: %clang_cc1 -fblocks -E -dM < /dev/null | FileCheck -check-prefix BLOCKS %s
//
// BLOCKS:#define __BLOCKS__ 1
// BLOCKS:#define __block __attribute__((__blocks__(byref)))
//
//
-// RUN: clang-cc -x c++ -std=c++0x -E -dM < /dev/null | FileCheck -check-prefix CXX0X %s
+// RUN: %clang_cc1 -x c++ -std=c++0x -E -dM < /dev/null | FileCheck -check-prefix CXX0X %s
//
// CXX0X:#define _GNU_SOURCE 1
// CXX0X:#define __DEPRECATED 1
@@ -20,7 +20,7 @@
// CXX0X:#define __private_extern__ extern
//
//
-// RUN: clang-cc -x c++ -std=c++98 -E -dM < /dev/null | FileCheck -check-prefix CXX98 %s
+// RUN: %clang_cc1 -x c++ -std=c++98 -E -dM < /dev/null | FileCheck -check-prefix CXX98 %s
//
// CXX98:#define _GNU_SOURCE 1
// CXX98:#define __DEPRECATED 1
@@ -30,13 +30,13 @@
// CXX98:#define __private_extern__ extern
//
//
-// RUN: clang-cc -std=c99 -E -dM < /dev/null | FileCheck -check-prefix C99 %s
+// RUN: %clang_cc1 -std=c99 -E -dM < /dev/null | FileCheck -check-prefix C99 %s
//
// C99:#define __STDC_VERSION__ 199901L
// C99:#define __STRICT_ANSI__ 1
//
//
-// RUN: clang-cc -E -dM < /dev/null | FileCheck -check-prefix COMMON %s
+// RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -check-prefix COMMON %s
//
// COMMON:#define __CONSTANT_CFSTRINGS__ 1
// COMMON:#define __FINITE_MATH_ONLY__ 0
@@ -53,10 +53,10 @@
// COMMON:#define __llvm__ 1
//
//
-// RUN: clang-cc -ffreestanding -E -dM < /dev/null | FileCheck -check-prefix FREESTANDING %s
+// RUN: %clang_cc1 -ffreestanding -E -dM < /dev/null | FileCheck -check-prefix FREESTANDING %s
// FREESTANDING:#define __STDC_HOSTED__ 0
//
-// RUN: clang-cc -x c++ -std=gnu++98 -E -dM < /dev/null | FileCheck -check-prefix GXX98 %s
+// RUN: %clang_cc1 -x c++ -std=gnu++98 -E -dM < /dev/null | FileCheck -check-prefix GXX98 %s
//
// GXX98:#define _GNU_SOURCE 1
// GXX98:#define __DEPRECATED 1
@@ -66,12 +66,12 @@
// GXX98:#define __private_extern__ extern
//
//
-// RUN: clang-cc -std=iso9899:199409 -E -dM < /dev/null | FileCheck -check-prefix C94 %s
+// RUN: %clang_cc1 -std=iso9899:199409 -E -dM < /dev/null | FileCheck -check-prefix C94 %s
//
// C94:#define __STDC_VERSION__ 199409L
//
//
-// RUN: clang-cc -fms-extensions -E -dM < /dev/null | FileCheck -check-prefix MSEXT %s
+// RUN: %clang_cc1 -fms-extensions -E -dM < /dev/null | FileCheck -check-prefix MSEXT %s
//
// MSEXT-NOT:#define __STDC__
// MSEXT:#define __int16 __INT16_TYPE__
@@ -80,45 +80,45 @@
// MSEXT:#define __int8 __INT8_TYPE__
//
//
-// RUN: clang-cc -x objective-c -E -dM < /dev/null | FileCheck -check-prefix OBJC %s
+// RUN: %clang_cc1 -x objective-c -E -dM < /dev/null | FileCheck -check-prefix OBJC %s
//
// OBJC:#define OBJC_NEW_PROPERTIES 1
// OBJC:#define __NEXT_RUNTIME__ 1
// OBJC:#define __OBJC__ 1
//
//
-// RUN: clang-cc -x objective-c -fobjc-gc -E -dM < /dev/null | FileCheck -check-prefix OBJCGC %s
+// RUN: %clang_cc1 -x objective-c -fobjc-gc -E -dM < /dev/null | FileCheck -check-prefix OBJCGC %s
//
// OBJCGC:#define __OBJC_GC__ 1
//
//
-// RUN: clang-cc -x objective-c -fobjc-nonfragile-abi -E -dM < /dev/null | FileCheck -check-prefix NONFRAGILE %s
+// RUN: %clang_cc1 -x objective-c -fobjc-nonfragile-abi -E -dM < /dev/null | FileCheck -check-prefix NONFRAGILE %s
//
// NONFRAGILE:#define OBJC_ZEROCOST_EXCEPTIONS 1
// NONFRAGILE:#define __OBJC2__ 1
//
//
-// RUN: clang-cc -O1 -E -dM < /dev/null | FileCheck -check-prefix O1 %s
+// RUN: %clang_cc1 -O1 -E -dM < /dev/null | FileCheck -check-prefix O1 %s
//
// O1:#define __OPTIMIZE__ 1
//
//
-// RUN: clang-cc -fpascal-strings -E -dM < /dev/null | FileCheck -check-prefix PASCAL %s
+// RUN: %clang_cc1 -fpascal-strings -E -dM < /dev/null | FileCheck -check-prefix PASCAL %s
//
// PASCAL:#define __PASCAL_STRINGS__ 1
//
//
-// RUN: clang-cc -E -dM < /dev/null | FileCheck -check-prefix SCHAR %s
+// RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -check-prefix SCHAR %s
//
// SCHAR:#define __STDC__ 1
// SCHAR-NOT:#define __UNSIGNED_CHAR__
// SCHAR:#define __clang__ 1
//
-// RUN: clang-cc -E -dM -ffreestanding -triple=arm-none-none < /dev/null | FileCheck -check-prefix ARM %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-none < /dev/null | FileCheck -check-prefix ARM %s
//
// ARM:#define __APCS_32__ 1
// ARM:#define __ARMEL__ 1
-// ARM:#define __ARM_ARCH_6K__ 1
+// ARM:#define __ARM_ARCH_6J__ 1
// ARM:#define __CHAR_BIT__ 8
// ARM:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
// ARM:#define __DBL_DIG__ 15
@@ -180,6 +180,7 @@
// ARM:#define __POINTER_WIDTH__ 32
// ARM:#define __PTRDIFF_TYPE__ int
// ARM:#define __PTRDIFF_WIDTH__ 32
+// ARM:#define __REGISTER_PREFIX__
// ARM:#define __SCHAR_MAX__ 127
// ARM:#define __SHRT_MAX__ 32767
// ARM:#define __SIG_ATOMIC_WIDTH__ 32
@@ -188,7 +189,6 @@
// ARM:#define __THUMB_INTERWORK__ 1
// ARM:#define __UINTMAX_TYPE__ long long unsigned int
// ARM:#define __USER_LABEL_PREFIX__ _
-// ARM:#define __VFP_FP__ 1
// ARM:#define __WCHAR_MAX__ 2147483647
// ARM:#define __WCHAR_TYPE__ int
// ARM:#define __WCHAR_WIDTH__ 32
@@ -197,7 +197,7 @@
// ARM:#define __arm 1
// ARM:#define __arm__ 1
//
-// RUN: clang-cc -E -dM -ffreestanding -triple=bfin-none-none < /dev/null | FileCheck -check-prefix BFIN %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=bfin-none-none < /dev/null | FileCheck -check-prefix BFIN %s
//
// BFIN:#define BFIN 1
// BFIN:#define __ADSPBLACKFIN__ 1
@@ -280,7 +280,7 @@
// BFIN:#define __bfin__ 1
// BFIN:#define bfin 1
//
-// RUN: clang-cc -E -dM -ffreestanding -triple=i386-none-none < /dev/null | FileCheck -check-prefix I386 %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-none-none < /dev/null | FileCheck -check-prefix I386 %s
//
// I386:#define __CHAR_BIT__ 8
// I386:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
@@ -364,7 +364,7 @@
// I386:#define __tune_nocona__ 1
// I386:#define i386 1
//
-// RUN: clang-cc -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -check-prefix MSP430 %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -check-prefix MSP430 %s
//
// MSP430:#define MSP430 1
// MSP430:#define __CHAR_BIT__ 8
@@ -441,7 +441,7 @@
// MSP430:#define __WINT_WIDTH__ 16
// MSP430:#define __clang__ 1
//
-// RUN: clang-cc -E -dM -ffreestanding -triple=pic16-none-none < /dev/null | FileCheck -check-prefix PIC16 %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=pic16-none-none < /dev/null | FileCheck -check-prefix PIC16 %s
//
// PIC16:#define _CONFIG(conf) asm("CONFIG "#conf)
// PIC16:#define __CHAR_BIT__ 8
@@ -524,7 +524,7 @@
// PIC16:#define ram __attribute__((address_space(0)))
// PIC16:#define rom __attribute__((address_space(1)))
//
-// RUN: clang-cc -E -dM -ffreestanding -triple=powerpc64-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix PPC64 %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix PPC64 %s
//
// PPC64:#define _ARCH_PPC 1
// PPC64:#define _ARCH_PPC64 1
@@ -612,7 +612,7 @@
// PPC64:#define __ppc64__ 1
// PPC64:#define __ppc__ 1
//
-// RUN: clang-cc -E -dM -ffreestanding -triple=powerpc-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix PPC %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix PPC %s
//
// PPC:#define _ARCH_PPC 1
// PPC:#define _BIG_ENDIAN 1
@@ -696,7 +696,7 @@
// PPC:#define __WINT_WIDTH__ 32
// PPC:#define __ppc__ 1
//
-// RUN: clang-cc -E -dM -ffreestanding -triple=s390x-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix S390X %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=s390x-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix S390X %s
//
// S390X:#define __CHAR_BIT__ 8
// S390X:#define __CHAR_UNSIGNED__ 1
@@ -774,7 +774,7 @@
// S390X:#define __s390__ 1
// S390X:#define __s390x__ 1
//
-// RUN: clang-cc -E -dM -ffreestanding -triple=sparc-none-none < /dev/null | FileCheck -check-prefix SPARC %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-none < /dev/null | FileCheck -check-prefix SPARC %s
//
// SPARC:#define __CHAR_BIT__ 8
// SPARC:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
@@ -836,7 +836,7 @@
// SPARC:#define __POINTER_WIDTH__ 32
// SPARC:#define __PTRDIFF_TYPE__ long int
// SPARC:#define __PTRDIFF_WIDTH__ 32
-// SPARC:#define __REGISTER_PREFIX__
+// SPARC:#define __REGISTER_PREFIX__
// SPARC:#define __SCHAR_MAX__ 127
// SPARC:#define __SHRT_MAX__ 32767
// SPARC:#define __SIG_ATOMIC_WIDTH__ 32
@@ -855,7 +855,7 @@
// SPARC:#define __sparcv8 1
// SPARC:#define sparc 1
//
-// RUN: clang-cc -E -dM -ffreestanding -triple=tce-none-none < /dev/null | FileCheck -check-prefix TCE %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=tce-none-none < /dev/null | FileCheck -check-prefix TCE %s
//
// TCE:#define __CHAR_BIT__ 8
// TCE:#define __DBL_DENORM_MIN__ 1.40129846e-45F
@@ -933,7 +933,7 @@
// TCE:#define __tce__ 1
// TCE:#define tce 1
//
-// RUN: clang-cc -E -dM -ffreestanding -triple=x86_64-none-none < /dev/null | FileCheck -check-prefix X86_64 %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-none-none < /dev/null | FileCheck -check-prefix X86_64 %s
//
// X86_64:#define _LP64 1
// X86_64:#define __CHAR_BIT__ 8
diff --git a/test/Preprocessor/line-directive.c b/test/Preprocessor/line-directive.c
index 33dd9bb3fe16..878d067a30dd 100644
--- a/test/Preprocessor/line-directive.c
+++ b/test/Preprocessor/line-directive.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic %s
-// RUN: clang-cc -E %s 2>&1 | grep 'blonk.c:92:2: error: #error ABC'
-// RUN: clang-cc -E %s 2>&1 | grep 'blonk.c:93:2: error: #error DEF'
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -E %s 2>&1 | grep 'blonk.c:92:2: error: #error ABC'
+// RUN: %clang_cc1 -E %s 2>&1 | grep 'blonk.c:93:2: error: #error DEF'
#line 'a' // expected-error {{#line directive requires a positive integer argument}}
#line 0 // expected-error {{#line directive requires a positive integer argument}}
diff --git a/test/Preprocessor/macro-multiline.c b/test/Preprocessor/macro-multiline.c
index 9f24ae8e5563..df7c40a954d6 100644
--- a/test/Preprocessor/macro-multiline.c
+++ b/test/Preprocessor/macro-multiline.c
@@ -1,4 +1,4 @@
-// RUN: clang -E %s "-DX=A
+// RUN: %clang -E %s "-DX=A
// RUN: THIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT" > %t
// RUN: grep "GOOD: A" %t
// RUN: not grep THIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT %t
diff --git a/test/Preprocessor/macro_arg_keyword.c b/test/Preprocessor/macro_arg_keyword.c
index 92b1ae535713..b9bbbf3ee2d8 100644
--- a/test/Preprocessor/macro_arg_keyword.c
+++ b/test/Preprocessor/macro_arg_keyword.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | grep xxx-xxx
+// RUN: %clang_cc1 -E %s | grep xxx-xxx
#define foo(return) return-return
diff --git a/test/Preprocessor/macro_disable.c b/test/Preprocessor/macro_disable.c
index f102ddddafc7..d6509c35bf2c 100644
--- a/test/Preprocessor/macro_disable.c
+++ b/test/Preprocessor/macro_disable.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -E %s | grep 'a: 2 + M_0(3)(4)(5);'
-// RUN: clang-cc -E %s | grep 'b: 4 + 4 + 3 + 2 + 1 + M_0(3)(2)(1);'
+// RUN: %clang_cc1 -E %s | grep 'a: 2 + M_0(3)(4)(5);'
+// RUN: %clang_cc1 -E %s | grep 'b: 4 + 4 + 3 + 2 + 1 + M_0(3)(2)(1);'
#define M_0(x) M_ ## x
#define M_1(x) x + M_0(0)
diff --git a/test/Preprocessor/macro_disable2.c b/test/Preprocessor/macro_disable2.c
index 286539e96f43..229cf3264bfe 100644
--- a/test/Preprocessor/macro_disable2.c
+++ b/test/Preprocessor/macro_disable2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | grep 'A B C A B A C A B C A'
+// RUN: %clang_cc1 -E %s | grep 'A B C A B A C A B C A'
#define A A B C
#define B B C A
diff --git a/test/Preprocessor/macro_disable3.c b/test/Preprocessor/macro_disable3.c
index d4a5664ae999..eab0a5e04631 100644
--- a/test/Preprocessor/macro_disable3.c
+++ b/test/Preprocessor/macro_disable3.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 %s -E | FileCheck -strict-whitespace %s
// Check for C99 6.10.3.4p2.
#define f(a) f(x * (a))
diff --git a/test/Preprocessor/macro_disable4.c b/test/Preprocessor/macro_disable4.c
index b652b988d020..820858c37f64 100644
--- a/test/Preprocessor/macro_disable4.c
+++ b/test/Preprocessor/macro_disable4.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -P -E %s | grep 'int f(void)'
+// RUN: %clang_cc1 -P -E %s | grep 'int f(void)'
// PR1820
#define f(x) h(x
diff --git a/test/Preprocessor/macro_expand.c b/test/Preprocessor/macro_expand.c
index a93c04e373c6..4dc03576cf53 100644
--- a/test/Preprocessor/macro_expand.c
+++ b/test/Preprocessor/macro_expand.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -E %s | grep '^A: Y$'
-// RUN: clang-cc -E %s | grep '^B: f()$'
-// RUN: clang-cc -E %s | grep '^C: for()$'
+// RUN: %clang_cc1 -E %s | grep '^A: Y$'
+// RUN: %clang_cc1 -E %s | grep '^B: f()$'
+// RUN: %clang_cc1 -E %s | grep '^C: for()$'
#define X() Y
#define Y() X
diff --git a/test/Preprocessor/macro_expandloc.c b/test/Preprocessor/macro_expandloc.c
index ce1efd20a277..f4660132f542 100644
--- a/test/Preprocessor/macro_expandloc.c
+++ b/test/Preprocessor/macro_expandloc.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E 2>&1 | grep '#include'
+// RUN: %clang_cc1 %s -E 2>&1 | grep '#include'
#define FOO 1
// The error message should be on the #include line, not the 1.
diff --git a/test/Preprocessor/macro_expandloc2.c b/test/Preprocessor/macro_expandloc2.c
index 9adf3fd911f9..4aa7dfe94426 100644
--- a/test/Preprocessor/macro_expandloc2.c
+++ b/test/Preprocessor/macro_expandloc2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E 2>&1 | grep '#include'
+// RUN: %clang_cc1 %s -E 2>&1 | grep '#include'
#define FOO BAR
// The error message should be on the #include line, not the 1.
diff --git a/test/Preprocessor/macro_fn.c b/test/Preprocessor/macro_fn.c
index 5c55c0ceed5f..85733b4af068 100644
--- a/test/Preprocessor/macro_fn.c
+++ b/test/Preprocessor/macro_fn.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc %s -Eonly -std=c89 -pedantic -verify
+/* RUN: %clang_cc1 %s -Eonly -std=c89 -pedantic -verify
*/
/* PR3937 */
#define zero() 0
diff --git a/test/Preprocessor/macro_fn_comma_swallow.c b/test/Preprocessor/macro_fn_comma_swallow.c
index c98e37823453..57425910b8a9 100644
--- a/test/Preprocessor/macro_fn_comma_swallow.c
+++ b/test/Preprocessor/macro_fn_comma_swallow.c
@@ -1,7 +1,7 @@
// Test the GNU comma swallowing extension.
-// RUN: clang-cc %s -E | grep 'foo{A, }'
-// RUN: clang-cc %s -E | grep 'fo2{A,}'
-// RUN: clang-cc %s -E | grep '{foo}'
+// RUN: %clang_cc1 %s -E | grep 'foo{A, }'
+// RUN: %clang_cc1 %s -E | grep 'fo2{A,}'
+// RUN: %clang_cc1 %s -E | grep '{foo}'
#define X(Y) foo{A, Y}
X()
@@ -15,7 +15,7 @@ X3(foo)
-// RUN: clang-cc %s -E | grep 'AA BB'
+// RUN: %clang_cc1 %s -E | grep 'AA BB'
// PR3880
#define X4(...) AA , ## __VA_ARGS__ BB
X4()
diff --git a/test/Preprocessor/macro_fn_disable_expand.c b/test/Preprocessor/macro_fn_disable_expand.c
index d40ee2aa6ec7..16948dc61c34 100644
--- a/test/Preprocessor/macro_fn_disable_expand.c
+++ b/test/Preprocessor/macro_fn_disable_expand.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E | FileCheck %s
+// RUN: %clang_cc1 %s -E | FileCheck %s
#define foo(x) bar x
foo(foo) (2)
diff --git a/test/Preprocessor/macro_fn_lparen_scan.c b/test/Preprocessor/macro_fn_lparen_scan.c
index 77e1fb9a3d4b..02184695c3fd 100644
--- a/test/Preprocessor/macro_fn_lparen_scan.c
+++ b/test/Preprocessor/macro_fn_lparen_scan.c
@@ -1,7 +1,7 @@
-// RUN: clang-cc -E %s | grep 'noexp: foo y'
-// RUN: clang-cc -E %s | grep 'expand: abc'
-// RUN: clang-cc -E %s | grep 'noexp2: foo nonexp'
-// RUN: clang-cc -E %s | grep 'expand2: abc'
+// RUN: %clang_cc1 -E %s | grep 'noexp: foo y'
+// RUN: %clang_cc1 -E %s | grep 'expand: abc'
+// RUN: %clang_cc1 -E %s | grep 'noexp2: foo nonexp'
+// RUN: %clang_cc1 -E %s | grep 'expand2: abc'
#define A foo
#define foo() abc
diff --git a/test/Preprocessor/macro_fn_lparen_scan2.c b/test/Preprocessor/macro_fn_lparen_scan2.c
index fb64befaf1e9..c23e7412b850 100644
--- a/test/Preprocessor/macro_fn_lparen_scan2.c
+++ b/test/Preprocessor/macro_fn_lparen_scan2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | grep 'FUNC (3 +1);'
+// RUN: %clang_cc1 -E %s | grep 'FUNC (3 +1);'
#define F(a) a
#define FUNC(a) (a+1)
diff --git a/test/Preprocessor/macro_fn_placemarker.c b/test/Preprocessor/macro_fn_placemarker.c
index ff688ce2d7ae..17910544b899 100644
--- a/test/Preprocessor/macro_fn_placemarker.c
+++ b/test/Preprocessor/macro_fn_placemarker.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E | grep 'foo(A, )'
+// RUN: %clang_cc1 %s -E | grep 'foo(A, )'
#define X(Y) foo(A, Y)
X()
diff --git a/test/Preprocessor/macro_fn_preexpand.c b/test/Preprocessor/macro_fn_preexpand.c
index ac3b3530dc82..1b94c82a2163 100644
--- a/test/Preprocessor/macro_fn_preexpand.c
+++ b/test/Preprocessor/macro_fn_preexpand.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc %s -E | grep 'pre: 1 1 X'
-// RUN: clang-cc %s -E | grep 'nopre: 1A(X)'
+// RUN: %clang_cc1 %s -E | grep 'pre: 1 1 X'
+// RUN: %clang_cc1 %s -E | grep 'nopre: 1A(X)'
/* Preexpansion of argument. */
#define A(X) 1 X
diff --git a/test/Preprocessor/macro_fn_varargs_iso.c b/test/Preprocessor/macro_fn_varargs_iso.c
index b1e5c5282332..a1aab26bae39 100644
--- a/test/Preprocessor/macro_fn_varargs_iso.c
+++ b/test/Preprocessor/macro_fn_varargs_iso.c
@@ -1,7 +1,7 @@
-// RUN: clang-cc -E %s | grep 'foo{a, b, c, d, e}'
-// RUN: clang-cc -E %s | grep 'foo2{d, C, B}'
-// RUN: clang-cc -E %s | grep 'foo2{d,e, C, B}'
+// RUN: %clang_cc1 -E %s | grep 'foo{a, b, c, d, e}'
+// RUN: %clang_cc1 -E %s | grep 'foo2{d, C, B}'
+// RUN: %clang_cc1 -E %s | grep 'foo2{d,e, C, B}'
#define va1(...) foo{a, __VA_ARGS__, e}
va1(b, c, d)
diff --git a/test/Preprocessor/macro_fn_varargs_named.c b/test/Preprocessor/macro_fn_varargs_named.c
index 94770a241d2f..b50d53d46d01 100644
--- a/test/Preprocessor/macro_fn_varargs_named.c
+++ b/test/Preprocessor/macro_fn_varargs_named.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -E %s | grep '^a: x$'
-// RUN: clang-cc -E %s | grep '^b: x y, z,h$'
-// RUN: clang-cc -E %s | grep '^c: foo(x)$'
+// RUN: %clang_cc1 -E %s | grep '^a: x$'
+// RUN: %clang_cc1 -E %s | grep '^b: x y, z,h$'
+// RUN: %clang_cc1 -E %s | grep '^c: foo(x)$'
#define A(b, c...) b c
a: A(x)
diff --git a/test/Preprocessor/macro_misc.c b/test/Preprocessor/macro_misc.c
index 169c5ec772a2..53d99821ccd4 100644
--- a/test/Preprocessor/macro_misc.c
+++ b/test/Preprocessor/macro_misc.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -Eonly -verify
+// RUN: %clang_cc1 %s -Eonly -verify
// This should not be rejected.
#ifdef defined
diff --git a/test/Preprocessor/macro_not_define.c b/test/Preprocessor/macro_not_define.c
index a42240bab607..82648d47d447 100644
--- a/test/Preprocessor/macro_not_define.c
+++ b/test/Preprocessor/macro_not_define.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | grep '^ # define X 3$'
+// RUN: %clang_cc1 -E %s | grep '^ # define X 3$'
#define H #
#define D define
diff --git a/test/Preprocessor/macro_paste_bad.c b/test/Preprocessor/macro_paste_bad.c
index 1212c44c1aa7..2af0173040dc 100644
--- a/test/Preprocessor/macro_paste_bad.c
+++ b/test/Preprocessor/macro_paste_bad.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -Eonly -verify -pedantic %s
+// RUN: %clang_cc1 -Eonly -verify -pedantic %s
// pasting ""x"" and ""+"" does not give a valid preprocessing token
#define XYZ x ## +
XYZ // expected-error {{pasting formed 'x+', an invalid preprocessing token}}
diff --git a/test/Preprocessor/macro_paste_bcpl_comment.c b/test/Preprocessor/macro_paste_bcpl_comment.c
index 8bbee5dc2dd9..fd07b1f7f2fc 100644
--- a/test/Preprocessor/macro_paste_bcpl_comment.c
+++ b/test/Preprocessor/macro_paste_bcpl_comment.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -Eonly 2>&1 | grep error
+// RUN: %clang_cc1 %s -Eonly 2>&1 | grep error
#define COMM1 / ## /
COMM1
diff --git a/test/Preprocessor/macro_paste_c_block_comment.c b/test/Preprocessor/macro_paste_c_block_comment.c
index 2e5a2141698e..3441f273d460 100644
--- a/test/Preprocessor/macro_paste_c_block_comment.c
+++ b/test/Preprocessor/macro_paste_c_block_comment.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc %s -Eonly 2>&1 | grep error
-// RUN: clang-cc %s -Eonly 2>&1 | not grep unterminated
-// RUN: clang-cc %s -Eonly 2>&1 | not grep scratch
+// RUN: %clang_cc1 %s -Eonly 2>&1 | grep error
+// RUN: %clang_cc1 %s -Eonly 2>&1 | not grep unterminated
+// RUN: %clang_cc1 %s -Eonly 2>&1 | not grep scratch
#define COMM / ## *
COMM
diff --git a/test/Preprocessor/macro_paste_commaext.c b/test/Preprocessor/macro_paste_commaext.c
index fe9c92ab8838..7cfe43d077be 100644
--- a/test/Preprocessor/macro_paste_commaext.c
+++ b/test/Preprocessor/macro_paste_commaext.c
@@ -1,8 +1,8 @@
-// RUN: clang-cc %s -E | grep 'V);'
-// RUN: clang-cc %s -E | grep 'W, 1, 2);'
-// RUN: clang-cc %s -E | grep 'X, 1, 2);'
-// RUN: clang-cc %s -E | grep 'Y, );'
-// RUN: clang-cc %s -E | grep 'Z, );'
+// RUN: %clang_cc1 %s -E | grep 'V);'
+// RUN: %clang_cc1 %s -E | grep 'W, 1, 2);'
+// RUN: %clang_cc1 %s -E | grep 'X, 1, 2);'
+// RUN: %clang_cc1 %s -E | grep 'Y, );'
+// RUN: %clang_cc1 %s -E | grep 'Z, );'
#define debug(format, ...) format, ## __VA_ARGS__)
debug(V);
diff --git a/test/Preprocessor/macro_paste_empty.c b/test/Preprocessor/macro_paste_empty.c
index 41843cd24c76..2e26f1419573 100644
--- a/test/Preprocessor/macro_paste_empty.c
+++ b/test/Preprocessor/macro_paste_empty.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -E %s | grep 'a:Y'
-// RUN: clang-cc -E %s | grep 'b:Y'
-// RUN: clang-cc -E %s | grep 'c:YY'
+// RUN: %clang_cc1 -E %s | grep 'a:Y'
+// RUN: %clang_cc1 -E %s | grep 'b:Y'
+// RUN: %clang_cc1 -E %s | grep 'c:YY'
#define FOO(X) X ## Y
a:FOO()
diff --git a/test/Preprocessor/macro_paste_hard.c b/test/Preprocessor/macro_paste_hard.c
index adc447c39f67..fad84264d7f1 100644
--- a/test/Preprocessor/macro_paste_hard.c
+++ b/test/Preprocessor/macro_paste_hard.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -E %s | grep '1: aaab 2'
-// RUN: clang-cc -E %s | grep '2: 2 baaa'
-// RUN: clang-cc -E %s | grep '3: 2 xx'
+// RUN: %clang_cc1 -E %s | grep '1: aaab 2'
+// RUN: %clang_cc1 -E %s | grep '2: 2 baaa'
+// RUN: %clang_cc1 -E %s | grep '3: 2 xx'
#define a(n) aaa ## n
#define b 2
diff --git a/test/Preprocessor/macro_paste_hashhash.c b/test/Preprocessor/macro_paste_hashhash.c
index 42654fd1b18b..e7993cc0a351 100644
--- a/test/Preprocessor/macro_paste_hashhash.c
+++ b/test/Preprocessor/macro_paste_hashhash.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | grep '^"x ## y";$'
+// RUN: %clang_cc1 -E %s | grep '^"x ## y";$'
#define hash_hash # ## #
#define mkstr(a) # a
#define in_between(a) mkstr(a)
diff --git a/test/Preprocessor/macro_paste_mscomment.c b/test/Preprocessor/macro_paste_mscomment.c
index ecd0b9d6a850..71324064f7cd 100644
--- a/test/Preprocessor/macro_paste_mscomment.c
+++ b/test/Preprocessor/macro_paste_mscomment.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -P -E -fms-extensions %s | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -P -E -fms-extensions %s | FileCheck -strict-whitespace %s
// This horrible stuff should preprocess into (other than whitespace):
// int foo;
// int bar;
diff --git a/test/Preprocessor/macro_paste_none.c b/test/Preprocessor/macro_paste_none.c
index e978fca22508..97ccd7c5cb02 100644
--- a/test/Preprocessor/macro_paste_none.c
+++ b/test/Preprocessor/macro_paste_none.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | grep '!!'
+// RUN: %clang_cc1 -E %s | grep '!!'
#define A(B,C) B ## C
diff --git a/test/Preprocessor/macro_paste_simple.c b/test/Preprocessor/macro_paste_simple.c
index 2affbac0dec3..563d7f44958d 100644
--- a/test/Preprocessor/macro_paste_simple.c
+++ b/test/Preprocessor/macro_paste_simple.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E | grep "barbaz123"
+// RUN: %clang_cc1 %s -E | grep "barbaz123"
#define FOO bar ## baz ## 123
diff --git a/test/Preprocessor/macro_paste_spacing.c b/test/Preprocessor/macro_paste_spacing.c
index 130548dbf99e..6498ffc9814d 100644
--- a/test/Preprocessor/macro_paste_spacing.c
+++ b/test/Preprocessor/macro_paste_spacing.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E | grep "^xy$"
+// RUN: %clang_cc1 %s -E | grep "^xy$"
#define A x ## y
blah
diff --git a/test/Preprocessor/macro_paste_spacing2.c b/test/Preprocessor/macro_paste_spacing2.c
index 0db721aa7b41..02cc12f5b023 100644
--- a/test/Preprocessor/macro_paste_spacing2.c
+++ b/test/Preprocessor/macro_paste_spacing2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E | grep "movl %eax"
+// RUN: %clang_cc1 %s -E | grep "movl %eax"
// PR4132
#define R1E %eax
#define epilogue(r1) movl r1 ## E;
diff --git a/test/Preprocessor/macro_rescan.c b/test/Preprocessor/macro_rescan.c
index c6a807ae4e02..3a3854841cd9 100644
--- a/test/Preprocessor/macro_rescan.c
+++ b/test/Preprocessor/macro_rescan.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -E %s | grep 'ei_1 = (17 +1);'
-// RUN: clang-cc -E %s | grep 'ei_2 = (M1)(17);'
+// RUN: %clang_cc1 -E %s | grep 'ei_1 = (17 +1);'
+// RUN: %clang_cc1 -E %s | grep 'ei_2 = (M1)(17);'
#define M1(a) (a+1)
#define M2(b) b
diff --git a/test/Preprocessor/macro_rescan2.c b/test/Preprocessor/macro_rescan2.c
index 9c198c995a54..826f4eefbebc 100644
--- a/test/Preprocessor/macro_rescan2.c
+++ b/test/Preprocessor/macro_rescan2.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc %s -E | grep 'a: 2\*f(9)'
-// RUN: clang-cc %s -E | grep 'b: 2\*9\*g'
+// RUN: %clang_cc1 %s -E | grep 'a: 2\*f(9)'
+// RUN: %clang_cc1 %s -E | grep 'b: 2\*9\*g'
#define f(a) a*g
#define g f
diff --git a/test/Preprocessor/macro_rescan_varargs.c b/test/Preprocessor/macro_rescan_varargs.c
index 8a3ad151141f..6c6415a8ee53 100644
--- a/test/Preprocessor/macro_rescan_varargs.c
+++ b/test/Preprocessor/macro_rescan_varargs.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
#define LPAREN (
#define RPAREN )
diff --git a/test/Preprocessor/macro_rparen_scan.c b/test/Preprocessor/macro_rparen_scan.c
index 927509883845..e4de5dbcef0c 100644
--- a/test/Preprocessor/macro_rparen_scan.c
+++ b/test/Preprocessor/macro_rparen_scan.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | grep '^3 ;$'
+// RUN: %clang_cc1 -E %s | grep '^3 ;$'
/* Right paren scanning, hard case. Should expand to 3. */
#define i(x) 3
diff --git a/test/Preprocessor/macro_rparen_scan2.c b/test/Preprocessor/macro_rparen_scan2.c
index c7fb9e3b08c9..42aa5445e905 100644
--- a/test/Preprocessor/macro_rparen_scan2.c
+++ b/test/Preprocessor/macro_rparen_scan2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
#define R_PAREN )
diff --git a/test/Preprocessor/macro_space.c b/test/Preprocessor/macro_space.c
index 4fdbb0a0ceef..49a9a0fac2cf 100644
--- a/test/Preprocessor/macro_space.c
+++ b/test/Preprocessor/macro_space.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -E | grep '! ,'
+// RUN: %clang_cc1 %s -E | grep '! ,'
#define XX
! XX,
diff --git a/test/Preprocessor/macro_undef.c b/test/Preprocessor/macro_undef.c
index 4507cddcb796..c842c850f3df 100644
--- a/test/Preprocessor/macro_undef.c
+++ b/test/Preprocessor/macro_undef.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -dM -undef -Dfoo=1 -E %s | FileCheck %s
+// RUN: %clang_cc1 -dM -undef -Dfoo=1 -E %s | FileCheck %s
// CHECK-NOT: #define __clang__
// CHECK: #define foo 1
diff --git a/test/Preprocessor/mi_opt.c b/test/Preprocessor/mi_opt.c
index aa69e2b4aeac..597ac072b871 100644
--- a/test/Preprocessor/mi_opt.c
+++ b/test/Preprocessor/mi_opt.c
@@ -1,4 +1,4 @@
-// RUN: not clang-cc -fsyntax-only %s
+// RUN: not %clang_cc1 -fsyntax-only %s
// PR1900
// This test should get a redefinition error from m_iopt.h: the MI opt
// shouldn't apply.
diff --git a/test/Preprocessor/non_fragile_feature.m b/test/Preprocessor/non_fragile_feature.m
index dbf1f9a797e2..552209d4955e 100644
--- a/test/Preprocessor/non_fragile_feature.m
+++ b/test/Preprocessor/non_fragile_feature.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-nonfragile-abi %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi %s
#ifndef __has_feature
#error Should have __has_feature
#endif
diff --git a/test/Preprocessor/non_fragile_feature1.m b/test/Preprocessor/non_fragile_feature1.m
index 5943e01b517e..89b52ed53bf5 100644
--- a/test/Preprocessor/non_fragile_feature1.m
+++ b/test/Preprocessor/non_fragile_feature1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-unknown-unknown %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s
#ifndef __has_feature
#error Should have __has_feature
#endif
diff --git a/test/Preprocessor/objc-pp.m b/test/Preprocessor/objc-pp.m
index 9f375efec2c0..3e093252c644 100644
--- a/test/Preprocessor/objc-pp.m
+++ b/test/Preprocessor/objc-pp.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify -pedantic
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
#import <stdint.h> // no warning on #import in objc mode.
diff --git a/test/Preprocessor/optimize.c b/test/Preprocessor/optimize.c
index 973d27f8c8b5..c820ded909f7 100644
--- a/test/Preprocessor/optimize.c
+++ b/test/Preprocessor/optimize.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -Eonly %s -DOPT_O2 -O2 -verify
+// RUN: %clang_cc1 -Eonly %s -DOPT_O2 -O2 -verify
#ifdef OPT_O2
#ifndef __OPTIMIZE__
#error "__OPTIMIZE__ not defined"
@@ -8,7 +8,7 @@
#endif
#endif
-// RUN: clang-cc -Eonly %s -DOPT_O0 -O0 -verify
+// RUN: %clang_cc1 -Eonly %s -DOPT_O0 -O0 -verify
#ifdef OPT_O0
#ifdef __OPTIMIZE__
#error "__OPTIMIZE__ defined"
@@ -18,7 +18,7 @@
#endif
#endif
-// RUN: clang-cc -Eonly %s -DOPT_OS -Os -verify
+// RUN: %clang_cc1 -Eonly %s -DOPT_OS -Os -verify
#ifdef OPT_OS
#ifndef __OPTIMIZE__
#error "__OPTIMIZE__ not defined"
diff --git a/test/Preprocessor/output_paste_avoid.c b/test/Preprocessor/output_paste_avoid.c
index 200ced9fba7a..835a921fb7d6 100644
--- a/test/Preprocessor/output_paste_avoid.c
+++ b/test/Preprocessor/output_paste_avoid.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s -o - | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck -strict-whitespace %s
#define y(a) ..a
diff --git a/test/Preprocessor/overflow.c b/test/Preprocessor/overflow.c
index 297a35e658fd..a921441b006d 100644
--- a/test/Preprocessor/overflow.c
+++ b/test/Preprocessor/overflow.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -Eonly %s -verify -triple i686-pc-linux-gnu
+// RUN: %clang_cc1 -Eonly %s -verify -triple i686-pc-linux-gnu
// Multiply signed overflow
#if 0x7FFFFFFFFFFFFFFF*2 // expected-warning {{overflow}}
diff --git a/test/Preprocessor/pic.c b/test/Preprocessor/pic.c
index b8068faac8c0..886beb715953 100644
--- a/test/Preprocessor/pic.c
+++ b/test/Preprocessor/pic.c
@@ -1,9 +1,9 @@
-// RUN: clang -ccc-host-triple i386-unknown-unknown -static -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -static -dM -E -o %t %s
// RUN: grep '#define __PIC__' %t | count 0
// RUN: grep '#define __pic__' %t | count 0
-// RUN: clang -ccc-host-triple i386-unknown-unknown -fpic -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -fpic -dM -E -o %t %s
// RUN: grep '#define __PIC__ 1' %t | count 1
// RUN: grep '#define __pic__ 1' %t | count 1
-// RUN: clang -ccc-host-triple i386-unknown-unknown -fPIC -dM -E -o %t %s
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -fPIC -dM -E -o %t %s
// RUN: grep '#define __PIC__ 2' %t | count 1
// RUN: grep '#define __pic__ 2' %t | count 1
diff --git a/test/Preprocessor/pr2086.c b/test/Preprocessor/pr2086.c
index 4df65a4f7c67..d438e879c51c 100644
--- a/test/Preprocessor/pr2086.c
+++ b/test/Preprocessor/pr2086.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s
+// RUN: %clang_cc1 -E %s
#define test
#include "pr2086.h"
diff --git a/test/Preprocessor/pragma_diagnostic.c b/test/Preprocessor/pragma_diagnostic.c
new file mode 100644
index 000000000000..d157406b3dc6
--- /dev/null
+++ b/test/Preprocessor/pragma_diagnostic.c
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-undef %s
+// rdar://2362963
+
+#if FOO // ok.
+#endif
+
+#pragma GCC diagnostic warning "-Wundef"
+
+#if FOO // expected-warning {{'FOO' is not defined}}
+#endif
+
+#pragma GCC diagnostic ignored "-Wun" "def"
+
+#if FOO // ok.
+#endif
+
+#pragma GCC diagnostic error "-Wundef"
+
+#if FOO // expected-error {{'FOO' is not defined}}
+#endif
+
+
+
+#define foo error
+#pragma GCC diagnostic foo "-Wundef" // expected-warning {{pragma diagnostic expected 'error', 'warning', 'ignored', or 'fatal'}}
+
+#pragma GCC diagnostic error 42 // expected-warning {{unexpected token in pragma diagnostic}}
+
+#pragma GCC diagnostic error "-Wundef" 42 // expected-warning {{unexpected token in pragma diagnostic}}
+#pragma GCC diagnostic error "invalid-name" // expected-warning {{pragma diagnostic expected option name (e.g. "-Wundef")}}
+
+#pragma GCC diagnostic error "-Winvalid-name" // expected-warning {{unknown warning group '-Winvalid-name', ignored}}
+
diff --git a/test/Preprocessor/pragma_microsoft.c b/test/Preprocessor/pragma_microsoft.c
index 81e90e3de69f..0201c451deaa 100644
--- a/test/Preprocessor/pragma_microsoft.c
+++ b/test/Preprocessor/pragma_microsoft.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -fms-extensions
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions
// rdar://6495941
diff --git a/test/Preprocessor/pragma_poison.c b/test/Preprocessor/pragma_poison.c
index d91feb7ff2de..5b39183b60d3 100644
--- a/test/Preprocessor/pragma_poison.c
+++ b/test/Preprocessor/pragma_poison.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -Eonly -verify
+// RUN: %clang_cc1 %s -Eonly -verify
#pragma GCC poison rindex
rindex(some_string, 'h'); // expected-error {{attempt to use a poisoned identifier}}
diff --git a/test/Preprocessor/pragma_sysheader.c b/test/Preprocessor/pragma_sysheader.c
index 49082b8c09d1..cf2843bffdea 100644
--- a/test/Preprocessor/pragma_sysheader.c
+++ b/test/Preprocessor/pragma_sysheader.c
@@ -1,3 +1,3 @@
-// RUN: clang -verify -pedantic %s -fsyntax-only
+// RUN: %clang -verify -pedantic %s -fsyntax-only
// rdar://6899937
#include "pragma_sysheader.h"
diff --git a/test/Preprocessor/pragma_unknown.c b/test/Preprocessor/pragma_unknown.c
index c0355e7a9614..c1851534cc33 100644
--- a/test/Preprocessor/pragma_unknown.c
+++ b/test/Preprocessor/pragma_unknown.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -E %s | grep '#pragma foo bar'
-// RUN: clang-cc -fsyntax-only -Wunknown-pragmas -verify %s
+// RUN: %clang_cc1 -E %s | grep '#pragma foo bar'
+// RUN: %clang_cc1 -fsyntax-only -Wunknown-pragmas -verify %s
// GCC doesn't expand macro args for unrecognized pragmas.
#define bar xX
diff --git a/test/Preprocessor/print_line_count.c b/test/Preprocessor/print_line_count.c
index 2eb62df48688..6a02b0eede00 100644
--- a/test/Preprocessor/print_line_count.c
+++ b/test/Preprocessor/print_line_count.c
@@ -1,4 +1,4 @@
-/* RUN: clang -E -C -P %s | wc -l | grep 4
+/* RUN: %clang -E -C -P %s | wc -l | grep 4
PR2741
comment */
y
diff --git a/test/Preprocessor/print_line_track.c b/test/Preprocessor/print_line_track.c
index 553c1861023a..c87fe00f407e 100644
--- a/test/Preprocessor/print_line_track.c
+++ b/test/Preprocessor/print_line_track.c
@@ -1,8 +1,8 @@
-/* RUN: clang-cc -E %s | grep 'a 3'
- * RUN: clang-cc -E %s | grep 'b 16'
- * RUN: clang-cc -E -P %s | grep 'a 3'
- * RUN: clang-cc -E -P %s | grep 'b 16'
- * RUN: clang-cc -E %s | not grep '# 0 '
+/* RUN: %clang_cc1 -E %s | grep 'a 3'
+ * RUN: %clang_cc1 -E %s | grep 'b 16'
+ * RUN: %clang_cc1 -E -P %s | grep 'a 3'
+ * RUN: %clang_cc1 -E -P %s | grep 'b 16'
+ * RUN: %clang_cc1 -E %s | not grep '# 0 '
* PR1848
* PR3437
*/
diff --git a/test/Preprocessor/pushable-diagnostics.c b/test/Preprocessor/pushable-diagnostics.c
index fe55122d66cd..6c861a1b3b6b 100644
--- a/test/Preprocessor/pushable-diagnostics.c
+++ b/test/Preprocessor/pushable-diagnostics.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
#pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
diff --git a/test/Preprocessor/skipping_unclean.c b/test/Preprocessor/skipping_unclean.c
index 31ce9b460def..52d1785030b6 100644
--- a/test/Preprocessor/skipping_unclean.c
+++ b/test/Preprocessor/skipping_unclean.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | grep bark
+// RUN: %clang_cc1 -E %s | grep bark
#if 0
blah
diff --git a/test/Preprocessor/stdint.c b/test/Preprocessor/stdint.c
index 930474645f17..5f0842a616b0 100644
--- a/test/Preprocessor/stdint.c
+++ b/test/Preprocessor/stdint.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E -ffreestanding -triple=arm-none-none %s | FileCheck -check-prefix ARM %s
+// RUN: %clang_cc1 -E -ffreestanding -triple=arm-none-none %s | FileCheck -check-prefix ARM %s
//
// ARM:typedef signed long long int int64_t;
// ARM:typedef unsigned long long int uint64_t;
@@ -106,7 +106,7 @@
// ARM:UINTMAX_C_(0) 0ULL
//
//
-// RUN: clang-cc -E -ffreestanding -triple=bfin-none-none %s | FileCheck -check-prefix BFIN %s
+// RUN: %clang_cc1 -E -ffreestanding -triple=bfin-none-none %s | FileCheck -check-prefix BFIN %s
//
// BFIN:typedef signed long long int int64_t;
// BFIN:typedef unsigned long long int uint64_t;
@@ -214,7 +214,7 @@
// BFIN:UINTMAX_C_(0) 0ULL
//
//
-// RUN: clang-cc -E -ffreestanding -triple=i386-none-none %s | FileCheck -check-prefix I386 %s
+// RUN: %clang_cc1 -E -ffreestanding -triple=i386-none-none %s | FileCheck -check-prefix I386 %s
//
// I386:typedef signed long long int int64_t;
// I386:typedef unsigned long long int uint64_t;
@@ -321,7 +321,7 @@
// I386:INTMAX_C_(0) 0LL
// I386:UINTMAX_C_(0) 0ULL
//
-// RUN: clang-cc -E -ffreestanding -triple=msp430-none-none %s | FileCheck -check-prefix MSP430 %s
+// RUN: %clang_cc1 -E -ffreestanding -triple=msp430-none-none %s | FileCheck -check-prefix MSP430 %s
//
// MSP430:typedef signed long int int32_t;
// MSP430:typedef unsigned long int uint32_t;
@@ -421,7 +421,7 @@
// MSP430:INTMAX_C_(0) 0L
// MSP430:UINTMAX_C_(0) 0UL
//
-// RUN: clang-cc -E -ffreestanding -triple=pic16-none-none %s | FileCheck -check-prefix PIC16 %s
+// RUN: %clang_cc1 -E -ffreestanding -triple=pic16-none-none %s | FileCheck -check-prefix PIC16 %s
//
// PIC16:typedef signed long int int32_t;
// PIC16:typedef unsigned long int uint32_t;
@@ -521,7 +521,7 @@
// PIC16:INTMAX_C_(0) 0L
// PIC16:UINTMAX_C_(0) 0UL
//
-// RUN: clang-cc -E -ffreestanding -triple=powerpc64-none-none %s | FileCheck -check-prefix PPC64 %s
+// RUN: %clang_cc1 -E -ffreestanding -triple=powerpc64-none-none %s | FileCheck -check-prefix PPC64 %s
//
// PPC64:typedef signed long int int64_t;
// PPC64:typedef unsigned long int uint64_t;
@@ -628,7 +628,7 @@
// PPC64:INTMAX_C_(0) 0L
// PPC64:UINTMAX_C_(0) 0UL
//
-// RUN: clang-cc -E -ffreestanding -triple=powerpc-none-none %s | FileCheck -check-prefix PPC %s
+// RUN: %clang_cc1 -E -ffreestanding -triple=powerpc-none-none %s | FileCheck -check-prefix PPC %s
//
//
// PPC:typedef signed long long int int64_t;
@@ -736,7 +736,7 @@
// PPC:INTMAX_C_(0) 0LL
// PPC:UINTMAX_C_(0) 0ULL
//
-// RUN: clang-cc -E -ffreestanding -triple=s390x-none-none %s | FileCheck -check-prefix S390X %s
+// RUN: %clang_cc1 -E -ffreestanding -triple=s390x-none-none %s | FileCheck -check-prefix S390X %s
//
// S390X:typedef signed long int int64_t;
// S390X:typedef unsigned long int uint64_t;
@@ -843,7 +843,7 @@
// S390X:INTMAX_C_(0) 0L
// S390X:UINTMAX_C_(0) 0UL
//
-// RUN: clang-cc -E -ffreestanding -triple=sparc-none-none %s | FileCheck -check-prefix SPARC %s
+// RUN: %clang_cc1 -E -ffreestanding -triple=sparc-none-none %s | FileCheck -check-prefix SPARC %s
//
// SPARC:typedef signed long long int int64_t;
// SPARC:typedef unsigned long long int uint64_t;
@@ -950,7 +950,7 @@
// SPARC:INTMAX_C_(0) 0LL
// SPARC:UINTMAX_C_(0) 0ULL
//
-// RUN: clang-cc -E -ffreestanding -triple=tce-none-none %s | FileCheck -check-prefix TCE %s
+// RUN: %clang_cc1 -E -ffreestanding -triple=tce-none-none %s | FileCheck -check-prefix TCE %s
//
// TCE:typedef signed int int32_t;
// TCE:typedef unsigned int uint32_t;
@@ -1050,7 +1050,7 @@
// TCE:INTMAX_C_(0) 0
// TCE:UINTMAX_C_(0) 0U
//
-// RUN: clang-cc -E -ffreestanding -triple=x86_64-none-none %s | FileCheck -check-prefix X86_64 %s
+// RUN: %clang_cc1 -E -ffreestanding -triple=x86_64-none-none %s | FileCheck -check-prefix X86_64 %s
//
//
// X86_64:typedef signed long int int64_t;
@@ -1165,7 +1165,7 @@
// the identifiers used in the operations (int, uint, _t, INT, UINT, _MIN,
// _MAX, and _C(v)) are themselves macros.
//
-// RUN: clang-cc -E -ffreestanding -Dint=a -Duint=b -D_t=c -DINT=d -DUINT=e -D_MIN=f -D_MAX=g '-D_C(v)=h' -triple=i386-none-none %s | FileCheck -check-prefix JOIN %s
+// RUN: %clang_cc1 -E -ffreestanding -Dint=a -Duint=b -D_t=c -DINT=d -DUINT=e -D_MIN=f -D_MAX=g '-D_C(v)=h' -triple=i386-none-none %s | FileCheck -check-prefix JOIN %s
// JOIN:typedef int32_t intptr_t;
// JOIN:typedef uint32_t uintptr_t;
// JOIN:typedef int64_t intmax_t;
diff --git a/test/Preprocessor/stringize_misc.c b/test/Preprocessor/stringize_misc.c
index 60d66a0061f6..6c2c78d17ac3 100644
--- a/test/Preprocessor/stringize_misc.c
+++ b/test/Preprocessor/stringize_misc.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
#define M(x, y) #x #y
diff --git a/test/Preprocessor/stringize_space.c b/test/Preprocessor/stringize_space.c
index e41736c81683..263cff831b3f 100644
--- a/test/Preprocessor/stringize_space.c
+++ b/test/Preprocessor/stringize_space.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E %s | grep -- '-"" , - "" , -"" , - ""'
+// RUN: %clang_cc1 -E %s | grep -- '-"" , - "" , -"" , - ""'
#define A(b) -#b , - #b , -# b , - # b
A()
diff --git a/test/Preprocessor/stringize_space2.c b/test/Preprocessor/stringize_space2.c
index 6a96894de6ee..a87d78e40437 100644
--- a/test/Preprocessor/stringize_space2.c
+++ b/test/Preprocessor/stringize_space2.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -E %s | grep 'a c'
+/* RUN: %clang_cc1 -E %s | grep 'a c'
*/
#define t(x) #x
t(a
diff --git a/test/Preprocessor/undef-error.c b/test/Preprocessor/undef-error.c
index f818e59a6d1f..ad611decedda 100644
--- a/test/Preprocessor/undef-error.c
+++ b/test/Preprocessor/undef-error.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -pedantic-errors -verify
+// RUN: %clang_cc1 %s -pedantic-errors -verify
// PR2045
#define b
diff --git a/test/Preprocessor/unterminated.c b/test/Preprocessor/unterminated.c
index 2040aac17de2..918065315dc6 100644
--- a/test/Preprocessor/unterminated.c
+++ b/test/Preprocessor/unterminated.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -E -verify %s
+// RUN: %clang_cc1 -E -verify %s
// PR3096
#ifdef FOO // expected-error {{unterminated conditional directive}}
/* /* */
diff --git a/test/Preprocessor/x86_target_features.c b/test/Preprocessor/x86_target_features.c
index f8574e25d474..f39c2208a4c1 100644
--- a/test/Preprocessor/x86_target_features.c
+++ b/test/Preprocessor/x86_target_features.c
@@ -1,6 +1,6 @@
// FIXME: Use -triple, not -ccc-host-triple.
-// RUN: clang -ccc-host-triple i386-unknown-unknown -march=core2 -msse4 -x c -E -dM -o %t %s
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -march=core2 -msse4 -x c -E -dM -o %t %s
// RUN: grep '#define __SSE2_MATH__ 1' %t
// RUN: grep '#define __SSE2__ 1' %t
// RUN: grep '#define __SSE3__ 1' %t
@@ -10,7 +10,7 @@
// RUN: grep '#define __SSE__ 1' %t
// RUN: grep '#define __SSSE3__ 1' %t
-// RUN: clang -ccc-host-triple i386-unknown-unknown -march=core2 -msse4 -mno-sse2 -x c -E -dM -o %t %s
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -march=core2 -msse4 -mno-sse2 -x c -E -dM -o %t %s
// RUN: grep '#define __SSE2_MATH__ 1' %t | count 0
// RUN: grep '#define __SSE2__ 1' %t | count 0
// RUN: grep '#define __SSE3__ 1' %t | count 0
@@ -20,7 +20,7 @@
// RUN: grep '#define __SSE__ 1' %t
// RUN: grep '#define __SSSE3__ 1' %t | count 0
-// RUN: clang -ccc-host-triple i386-unknown-unknown -march=pentium-m -x c -E -dM -o %t %s
+// RUN: %clang -ccc-host-triple i386-unknown-unknown -march=pentium-m -x c -E -dM -o %t %s
// RUN: grep '#define __SSE2_MATH__ 1' %t
// RUN: grep '#define __SSE2__ 1' %t
// RUN: grep '#define __SSE3__ 1' %t | count 0
diff --git a/test/Rewriter/block-test.c b/test/Rewriter/block-test.c
deleted file mode 100644
index 5057056eb3d0..000000000000
--- a/test/Rewriter/block-test.c
+++ /dev/null
@@ -1,38 +0,0 @@
-// RUN: clang -cc1 -rewrite-blocks %s -fblocks -o -
-
-static int (^block)(const void *, const void *) = (int (^)(const void *, const void *))0;
-static int (*func)(int (^block)(void *, void *)) = (int (*)(int (^block)(void *, void *)))0;
-
-typedef int (^block_T)(const void *, const void *);
-typedef int (*func_T)(int (^block)(void *, void *));
-
-void foo(const void *a, const void *b, void *c) {
- int (^block)(const void *, const void *) = (int (^)(const void *, const void *))c;
- int (*func)(int (^block)(void *, void *)) = (int (*)(int (^block)(void *, void *)))c;
-}
-
-typedef void (^test_block_t)();
-
-int main(int argc, char **argv) {
- int a;
-
- void (^test_block_v)();
- void (^test_block_v2)(int, float);
-
- void (^test_block_v3)(void (^barg)(int));
-
- a = 77;
- test_block_v = ^(){ int local=1; printf("a=%d\n",a+local); };
- test_block_v();
- a++;
- test_block_v();
-
- __block int b;
-
- b = 88;
- test_block_v2 = ^(int x, float f){ printf("b=%d\n",b); };
- test_block_v2(1,2.0);
- b++;
- test_block_v2(3,4.0);
- return 7;
-}
diff --git a/test/Rewriter/crash.m b/test/Rewriter/crash.m
index 60d6d1534cdc..107b7a54843d 100644
--- a/test/Rewriter/crash.m
+++ b/test/Rewriter/crash.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc -o - %s
+// RUN: %clang_cc1 -rewrite-objc -o - %s
// rdar://5950938
@interface NSArray {}
+ (id)arrayWithObjects:(id)firstObj, ...;
diff --git a/test/Rewriter/finally.m b/test/Rewriter/finally.m
index ae650568abf1..67774b5d9cda 100644
--- a/test/Rewriter/finally.m
+++ b/test/Rewriter/finally.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc -verify %s -o -
+// RUN: %clang_cc1 -rewrite-objc -verify %s -o -
int main() {
@try {
diff --git a/test/Rewriter/id-test-3.m b/test/Rewriter/id-test-3.m
index 0edd041197ab..8557f2baa667 100644
--- a/test/Rewriter/id-test-3.m
+++ b/test/Rewriter/id-test-3.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@protocol P
- (id<P>) Meth: (id<P>) Arg;
diff --git a/test/Rewriter/ivar-encoding-1.m b/test/Rewriter/ivar-encoding-1.m
index 667c7270e835..af11ce246939 100644
--- a/test/Rewriter/ivar-encoding-1.m
+++ b/test/Rewriter/ivar-encoding-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@interface Intf
{
diff --git a/test/Rewriter/ivar-encoding-2.m b/test/Rewriter/ivar-encoding-2.m
index 6a4966bb2760..4650bdefcc6f 100644
--- a/test/Rewriter/ivar-encoding-2.m
+++ b/test/Rewriter/ivar-encoding-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@implementation Intf
{
diff --git a/test/Rewriter/metadata-test-1.m b/test/Rewriter/metadata-test-1.m
index bfbe486ea487..5dc1a33301e2 100644
--- a/test/Rewriter/metadata-test-1.m
+++ b/test/Rewriter/metadata-test-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@interface Intf
@end
diff --git a/test/Rewriter/metadata-test-2.m b/test/Rewriter/metadata-test-2.m
index c9f937f18798..0fd0429b0b31 100644
--- a/test/Rewriter/metadata-test-2.m
+++ b/test/Rewriter/metadata-test-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
typedef struct _NSPoint {
float x;
diff --git a/test/Rewriter/method-encoding-1.m b/test/Rewriter/method-encoding-1.m
index 77bbd8c25cb2..08ee24b135c7 100644
--- a/test/Rewriter/method-encoding-1.m
+++ b/test/Rewriter/method-encoding-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@protocol P1
- (void) MyProtoMeth : (int **) arg1 : (void*) arg2;
diff --git a/test/Rewriter/objc-encoding-bug-1.m b/test/Rewriter/objc-encoding-bug-1.m
index 797b5bbc03a4..5605b6627fac 100644
--- a/test/Rewriter/objc-encoding-bug-1.m
+++ b/test/Rewriter/objc-encoding-bug-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
typedef struct NSMethodFrameArgInfo {
struct NSMethodFrameArgInfo *subInfo;
diff --git a/test/Rewriter/objc-ivar-receiver-1.m b/test/Rewriter/objc-ivar-receiver-1.m
index 7bf3544a36ea..5fb028e808e9 100644
--- a/test/Rewriter/objc-ivar-receiver-1.m
+++ b/test/Rewriter/objc-ivar-receiver-1.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
-// RUN: clang -cc1 -rewrite-objc %s -o - | grep 'newInv->_container'
+// RUN: %clang_cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o - | grep 'newInv->_container'
@interface NSMutableArray
- (void)addObject:(id)addObject;
diff --git a/test/Rewriter/objc-string-concat-1.m b/test/Rewriter/objc-string-concat-1.m
index bf189beef251..32b25261465f 100644
--- a/test/Rewriter/objc-string-concat-1.m
+++ b/test/Rewriter/objc-string-concat-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@class NSString;
diff --git a/test/Rewriter/objc-super-test.m b/test/Rewriter/objc-super-test.m
index 7a3b3af656ae..38f68b98535a 100644
--- a/test/Rewriter/objc-super-test.m
+++ b/test/Rewriter/objc-super-test.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o - | grep objc_msgSendSuper | grep MainMethod
+// RUN: %clang_cc1 -rewrite-objc %s -o - | grep objc_msgSendSuper | grep MainMethod
typedef struct objc_selector *SEL;
typedef struct objc_object *id;
diff --git a/test/Rewriter/objc-synchronized-1.m b/test/Rewriter/objc-synchronized-1.m
index 3359660e112d..27f2a0af8bdf 100644
--- a/test/Rewriter/objc-synchronized-1.m
+++ b/test/Rewriter/objc-synchronized-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
id SYNCH_EXPR();
void SYNCH_BODY();
diff --git a/test/Rewriter/properties.m b/test/Rewriter/properties.m
index 3b49c22f8e26..44c55b1b69c4 100644
--- a/test/Rewriter/properties.m
+++ b/test/Rewriter/properties.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@interface Foo {
int i;
diff --git a/test/Rewriter/protocol-rewrite-1.m b/test/Rewriter/protocol-rewrite-1.m
index 66280ca1b0f2..440527b6737c 100644
--- a/test/Rewriter/protocol-rewrite-1.m
+++ b/test/Rewriter/protocol-rewrite-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
typedef struct MyWidget {
int a;
diff --git a/test/Rewriter/rewrite-api-bug.m b/test/Rewriter/rewrite-api-bug.m
index 745efec5bd9e..03fc89f34aad 100644
--- a/test/Rewriter/rewrite-api-bug.m
+++ b/test/Rewriter/rewrite-api-bug.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@interface MyDerived
- (void) instanceMethod;
diff --git a/test/Rewriter/rewrite-block-ivar-call.mm b/test/Rewriter/rewrite-block-ivar-call.mm
new file mode 100644
index 000000000000..80e8caab7271
--- /dev/null
+++ b/test/Rewriter/rewrite-block-ivar-call.mm
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -x objective-c++ -fblocks -rewrite-objc -o - %s
+
+@interface Foo {
+ void (^_block)(void);
+}
+@end
+
+@implementation Foo
+- (void)bar {
+ _block();
+}
+@end
diff --git a/test/Rewriter/rewrite-block-literal.c b/test/Rewriter/rewrite-block-literal.c
new file mode 100644
index 000000000000..be9c06f7db25
--- /dev/null
+++ b/test/Rewriter/rewrite-block-literal.c
@@ -0,0 +1,80 @@
+// RUN: %clang_cc1 -rewrite-objc %s -fblocks -o -
+
+void I( void (^)(void));
+void (^noop)(void);
+
+void nothing();
+int printf(const char*, ...);
+
+typedef void (^T) (void);
+
+void takeblock(T);
+int takeintint(int (^C)(int)) { return C(4); }
+
+T somefunction() {
+ if (^{ })
+ nothing();
+
+ noop = ^{};
+
+ noop = ^{printf("\nClosure\n"); };
+
+ I(^{ });
+
+ return ^{printf("\nClosure\n"); };
+}
+void test2() {
+ int x = 4;
+
+ takeblock(^{ printf("%d\n", x); });
+
+ while (1) {
+ takeblock(^{
+ while(1) break; // ok
+ });
+ break;
+ }
+}
+
+
+void (^test3())(void) {
+ return ^{};
+}
+
+void test4() {
+ void (^noop)(void) = ^{};
+ void (*noop2)() = 0;
+}
+
+void myfunc(int (^block)(int)) {}
+
+void myfunc3(const int *x);
+
+void test5() {
+ int a;
+
+ myfunc(^(int abcd) {
+ myfunc3(&a);
+ return 1;
+ });
+}
+
+void *X;
+
+void test_arguments() {
+ int y;
+ int (^c)(char);
+ (1 ? c : 0)('x');
+ (1 ? 0 : c)('x');
+
+ (1 ? c : c)('x');
+}
+
+static int global_x = 10;
+void (^global_block)(void) = ^{ printf("global x is %d\n", global_x); };
+
+typedef void (^void_block_t)(void);
+
+static const void_block_t myBlock = ^{ };
+
+static const void_block_t myBlock2 = ^ void(void) { };
diff --git a/test/Rewriter/rewrite-foreach-1.m b/test/Rewriter/rewrite-foreach-1.m
index 9cf084c502ae..e68b45d1df2d 100644
--- a/test/Rewriter/rewrite-foreach-1.m
+++ b/test/Rewriter/rewrite-foreach-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@protocol P @end
diff --git a/test/Rewriter/rewrite-foreach-2.m b/test/Rewriter/rewrite-foreach-2.m
index 5567d0169b93..5ed15a34ac07 100644
--- a/test/Rewriter/rewrite-foreach-2.m
+++ b/test/Rewriter/rewrite-foreach-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@protocol P @end
diff --git a/test/Rewriter/rewrite-foreach-3.m b/test/Rewriter/rewrite-foreach-3.m
index 804f0204f5e9..ffe8295954e4 100644
--- a/test/Rewriter/rewrite-foreach-3.m
+++ b/test/Rewriter/rewrite-foreach-3.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@protocol P @end
diff --git a/test/Rewriter/rewrite-foreach-4.m b/test/Rewriter/rewrite-foreach-4.m
index 9870690325b2..5b66e978bebf 100644
--- a/test/Rewriter/rewrite-foreach-4.m
+++ b/test/Rewriter/rewrite-foreach-4.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@interface MyList
- (id) allKeys;
diff --git a/test/Rewriter/rewrite-foreach-5.m b/test/Rewriter/rewrite-foreach-5.m
index 141cb6a2c0aa..adfd7f837841 100644
--- a/test/Rewriter/rewrite-foreach-5.m
+++ b/test/Rewriter/rewrite-foreach-5.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@interface MyList
- (id) allKeys;
diff --git a/test/Rewriter/rewrite-foreach-6.m b/test/Rewriter/rewrite-foreach-6.m
index bbc9a94a13f9..2aa19aecb82c 100644
--- a/test/Rewriter/rewrite-foreach-6.m
+++ b/test/Rewriter/rewrite-foreach-6.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -rewrite-objc -o -
+// RUN: %clang_cc1 %s -rewrite-objc -o -
// rdar://5716356
// FIXME: Should be able to pipe into clang, but code is not
// yet correct for other reasons: rdar://5716940
diff --git a/test/Rewriter/rewrite-nest.m b/test/Rewriter/rewrite-nest.m
index 594e1b1629a9..ebbcded414e9 100644
--- a/test/Rewriter/rewrite-nest.m
+++ b/test/Rewriter/rewrite-nest.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@interface NSMapTable @end
@interface NSEnumerator @end
diff --git a/test/Rewriter/rewrite-protocol-type-1.m b/test/Rewriter/rewrite-protocol-type-1.m
index e46a3badfeef..902559dca600 100644
--- a/test/Rewriter/rewrite-protocol-type-1.m
+++ b/test/Rewriter/rewrite-protocol-type-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@protocol MyProto1
@end
diff --git a/test/Rewriter/rewrite-try-catch.m b/test/Rewriter/rewrite-try-catch.m
index e9b002b2be39..d0c6d2acf67d 100644
--- a/test/Rewriter/rewrite-try-catch.m
+++ b/test/Rewriter/rewrite-try-catch.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@interface Foo @end
@interface GARF @end
diff --git a/test/Rewriter/static-type-protocol-1.m b/test/Rewriter/static-type-protocol-1.m
index 735c94278dc5..a072c9f3ca3f 100644
--- a/test/Rewriter/static-type-protocol-1.m
+++ b/test/Rewriter/static-type-protocol-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@protocol Proto
- (void) ProtoDidget;
diff --git a/test/Rewriter/undecl-objc-h.m b/test/Rewriter/undecl-objc-h.m
index b68c6b175705..a60d81024ce2 100644
--- a/test/Rewriter/undecl-objc-h.m
+++ b/test/Rewriter/undecl-objc-h.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
typedef struct S {
int * pint;
diff --git a/test/Rewriter/undeclared-method-1.m b/test/Rewriter/undeclared-method-1.m
index 6c1460d02ec8..89d33ce4518a 100644
--- a/test/Rewriter/undeclared-method-1.m
+++ b/test/Rewriter/undeclared-method-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@interface Derived @end
diff --git a/test/Rewriter/undef-field-reference-1.m b/test/Rewriter/undef-field-reference-1.m
index ef80c26d7c50..039c500a2486 100644
--- a/test/Rewriter/undef-field-reference-1.m
+++ b/test/Rewriter/undef-field-reference-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@interface MyDerived
{
diff --git a/test/Rewriter/va-method.m b/test/Rewriter/va-method.m
index f808b8f59641..366552fd56ab 100644
--- a/test/Rewriter/va-method.m
+++ b/test/Rewriter/va-method.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
#include <stdarg.h>
diff --git a/test/Sema/128bitint.c b/test/Sema/128bitint.c
index a068d81e4981..fe83d97ca4fc 100644
--- a/test/Sema/128bitint.c
+++ b/test/Sema/128bitint.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin9 %s
typedef int i128 __attribute__((__mode__(TI)));
typedef unsigned u128 __attribute__((__mode__(TI)));
diff --git a/test/Sema/PR2727.c b/test/Sema/PR2727.c
index 0829dc239df8..332b0df72835 100644
--- a/test/Sema/PR2727.c
+++ b/test/Sema/PR2727.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -verify -fsyntax-only -std=c90 %s
-// RUN: clang-cc -verify -fsyntax-only -std=c99 %s
+// RUN: %clang_cc1 -verify -fsyntax-only -std=c90 %s
+// RUN: %clang_cc1 -verify -fsyntax-only -std=c99 %s
int f (int x)
{
diff --git a/test/Sema/PR2728.c b/test/Sema/PR2728.c
index e8c2e268b5d7..e9f1deaf7cd6 100644
--- a/test/Sema/PR2728.c
+++ b/test/Sema/PR2728.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -verify -fsyntax-only -std=c90 %s
-// RUN: clang-cc -verify -fsyntax-only -std=c99 %s
+// RUN: %clang_cc1 -verify -fsyntax-only -std=c90 %s
+// RUN: %clang_cc1 -verify -fsyntax-only -std=c99 %s
struct s
{
diff --git a/test/Sema/PR2919-builtin-types-compat-strips-crv.c b/test/Sema/PR2919-builtin-types-compat-strips-crv.c
index 160ec4a38058..9c1335786a50 100644
--- a/test/Sema/PR2919-builtin-types-compat-strips-crv.c
+++ b/test/Sema/PR2919-builtin-types-compat-strips-crv.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
typedef struct foo T0;
typedef const struct foo T1;
diff --git a/test/Sema/PR2923.c b/test/Sema/PR2923.c
index c75e7baed1a1..f22e70dd8d3d 100644
--- a/test/Sema/PR2923.c
+++ b/test/Sema/PR2923.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Test for absence of crash reported in PR 2923:
//
diff --git a/test/Sema/PR2963-enum-constant.c b/test/Sema/PR2963-enum-constant.c
index 78f2326dae1b..1900eefc7c62 100644
--- a/test/Sema/PR2963-enum-constant.c
+++ b/test/Sema/PR2963-enum-constant.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
typedef short short_fixed;
diff --git a/test/Sema/address-constant.c b/test/Sema/address-constant.c
index 69f2f79f6857..e842a7396b8d 100644
--- a/test/Sema/address-constant.c
+++ b/test/Sema/address-constant.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int i;
int a[] = {0};
diff --git a/test/Sema/address_spaces.c b/test/Sema/address_spaces.c
index d9d23edb3cf4..badd2383abc2 100644
--- a/test/Sema/address_spaces.c
+++ b/test/Sema/address_spaces.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
#define _AS1 __attribute__((address_space(1)))
#define _AS2 __attribute__((address_space(2)))
diff --git a/test/Sema/align-arm-apcs.c b/test/Sema/align-arm-apcs.c
index 9689906488b1..0a5d3fe92151 100644
--- a/test/Sema/align-arm-apcs.c
+++ b/test/Sema/align-arm-apcs.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple arm-unknown-unknown -target-abi apcs-gnu -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple arm-unknown-unknown -target-abi apcs-gnu -fsyntax-only -verify %s
struct s0 { double f0; int f1; };
char chk0[__alignof__(struct s0) == 4 ? 1 : -1];
diff --git a/test/Sema/align-x86.c b/test/Sema/align-x86.c
index 2bc1cc848554..f67adecbf517 100644
--- a/test/Sema/align-x86.c
+++ b/test/Sema/align-x86.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
// PR3433
double g1;
diff --git a/test/Sema/altivec-init.c b/test/Sema/altivec-init.c
index 2a33e1e56f55..f22c1fc4db8a 100644
--- a/test/Sema/altivec-init.c
+++ b/test/Sema/altivec-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -faltivec -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -faltivec -verify -pedantic -fsyntax-only
typedef int v4 __attribute((vector_size(16)));
typedef short v8 __attribute((vector_size(16)));
diff --git a/test/Sema/annotate.c b/test/Sema/annotate.c
index aec2af8b022f..4d550759a25f 100644
--- a/test/Sema/annotate.c
+++ b/test/Sema/annotate.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
void __attribute__((annotate("foo"))) foo(float *a) {
__attribute__((annotate("bar"))) int x;
diff --git a/test/Sema/anonymous-struct-union.c b/test/Sema/anonymous-struct-union.c
index ca1133bd8ace..47fb2b6fba09 100644
--- a/test/Sema/anonymous-struct-union.c
+++ b/test/Sema/anonymous-struct-union.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X {
union {
float f3;
diff --git a/test/Sema/arg-duplicate.c b/test/Sema/arg-duplicate.c
index e40a964234d9..ca091eb309e4 100644
--- a/test/Sema/arg-duplicate.c
+++ b/test/Sema/arg-duplicate.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int f3(y, x,
x) // expected-error {{redefinition of parameter}}
diff --git a/test/Sema/arg-scope-c99.c b/test/Sema/arg-scope-c99.c
index 1d81410b8d01..912776ab8ff6 100644
--- a/test/Sema/arg-scope-c99.c
+++ b/test/Sema/arg-scope-c99.c
@@ -1,2 +1,2 @@
-// RUN: clang-cc -fsyntax-only -std=c99 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c99 -verify %s
void bb(int sz, int ar[sz][sz]) { }
diff --git a/test/Sema/arg-scope.c b/test/Sema/arg-scope.c
index d5e59603cfbf..ed9261941b58 100644
--- a/test/Sema/arg-scope.c
+++ b/test/Sema/arg-scope.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void aa(int b, int x[sizeof b]) {}
void foo(int i, int A[i]) {}
diff --git a/test/Sema/array-constraint.c b/test/Sema/array-constraint.c
index 6407b5daf56a..66f15c3a3ccc 100644
--- a/test/Sema/array-constraint.c
+++ b/test/Sema/array-constraint.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
struct s; // expected-note 2 {{forward declaration of 'struct s'}}
struct s* t (struct s z[]) { // expected-error {{array has incomplete element type}}
diff --git a/test/Sema/array-declared-as-incorrect-type.c b/test/Sema/array-declared-as-incorrect-type.c
index 3f6fa33a3bd2..b93fa9a0edf7 100644
--- a/test/Sema/array-declared-as-incorrect-type.c
+++ b/test/Sema/array-declared-as-incorrect-type.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
extern int a1[];
int a1[1];
diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c
index c78fd29a89c1..45d318385299 100644
--- a/test/Sema/array-init.c
+++ b/test/Sema/array-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
extern int foof() = 1; // expected-error{{illegal initializer (only variables can be initialized)}}
@@ -167,7 +167,7 @@ void charArrays() {
void variableArrayInit() {
int a = 4;
- char strlit[a] = "foo"; //expected-error{{variable-sized object may not be initialized}}
+ char strlit[a] = "foo"; //expected-error{{array initializer must be an initializer list or string literal}}
int b[a] = { 1, 2, 4 }; //expected-error{{variable-sized object may not be initialized}}
}
diff --git a/test/Sema/asm.c b/test/Sema/asm.c
index 0a62545a1e08..18d900c80dd4 100644
--- a/test/Sema/asm.c
+++ b/test/Sema/asm.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -triple i386-pc-linux-gnu -verify -fsyntax-only
+// RUN: %clang_cc1 %s -triple i386-pc-linux-gnu -verify -fsyntax-only
void f() {
int i;
diff --git a/test/Sema/assign-null.c b/test/Sema/assign-null.c
index a343c8069fdc..7f172b195355 100644
--- a/test/Sema/assign-null.c
+++ b/test/Sema/assign-null.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stddef.h>
diff --git a/test/Sema/assign.c b/test/Sema/assign.c
index b25262c62438..2d57029fc05f 100644
--- a/test/Sema/assign.c
+++ b/test/Sema/assign.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void *test1(void) { return 0; }
diff --git a/test/Sema/ast-print.c b/test/Sema/ast-print.c
index a8988b029f49..ff66d35a1ba6 100644
--- a/test/Sema/ast-print.c
+++ b/test/Sema/ast-print.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -ast-print
+// RUN: %clang_cc1 %s -ast-print
typedef void func_typedef();
func_typedef xxx;
diff --git a/test/Sema/attr-aligned.c b/test/Sema/attr-aligned.c
index 6e641cb371f9..bcb12ee40de7 100644
--- a/test/Sema/attr-aligned.c
+++ b/test/Sema/attr-aligned.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
int x __attribute__((aligned(3))); // expected-error {{requested alignment is not a power of 2}}
diff --git a/test/Sema/attr-cleanup.c b/test/Sema/attr-cleanup.c
index 0434981c6c4a..9057c27a56fe 100644
--- a/test/Sema/attr-cleanup.c
+++ b/test/Sema/attr-cleanup.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
void c1(int *a);
diff --git a/test/Sema/attr-decl-after-definition.c b/test/Sema/attr-decl-after-definition.c
index c1d1b536fc69..4d32e0028b54 100644
--- a/test/Sema/attr-decl-after-definition.c
+++ b/test/Sema/attr-decl-after-definition.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void foo();
void foo() __attribute__((unused));
diff --git a/test/Sema/attr-deprecated.c b/test/Sema/attr-deprecated.c
index 4b889fc8aa4f..e723255c0cfa 100644
--- a/test/Sema/attr-deprecated.c
+++ b/test/Sema/attr-deprecated.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
int f() __attribute__((deprecated));
void g() __attribute__((deprecated));
diff --git a/test/Sema/attr-format_arg.c b/test/Sema/attr-format_arg.c
index 5f06f4ba3fc9..64a23878317c 100644
--- a/test/Sema/attr-format_arg.c
+++ b/test/Sema/attr-format_arg.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int printf(const char *, ...);
diff --git a/test/Sema/attr-malloc.c b/test/Sema/attr-malloc.c
index 6483ffc4c1a6..9970b9de4f95 100644
--- a/test/Sema/attr-malloc.c
+++ b/test/Sema/attr-malloc.c
@@ -1,5 +1,5 @@
-// RUN: clang -Xclang -verify -fsyntax-only %s
-// RUN: clang -emit-llvm -S -o %t %s
+// RUN: %clang -Xclang -verify -fsyntax-only %s
+// RUN: %clang -emit-llvm -S -o %t %s
#include <stdlib.h>
diff --git a/test/Sema/attr-mode.c b/test/Sema/attr-mode.c
index ac411d7c42dd..9acd2c6f65d3 100644
--- a/test/Sema/attr-mode.c
+++ b/test/Sema/attr-mode.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef int i16_1 __attribute((mode(HI)));
int i16_1_test[sizeof(i16_1) == 2 ? 1 : -1];
diff --git a/test/Sema/attr-nodebug.c b/test/Sema/attr-nodebug.c
index 512ecfdcafc6..203c2a7300ab 100644
--- a/test/Sema/attr-nodebug.c
+++ b/test/Sema/attr-nodebug.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
int a __attribute__((nodebug)); // expected-warning {{'nodebug' attribute only applies to function types}}
diff --git a/test/Sema/attr-noinline.c b/test/Sema/attr-noinline.c
index cf695f0d21f5..92dc9007eb19 100644
--- a/test/Sema/attr-noinline.c
+++ b/test/Sema/attr-noinline.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
int a __attribute__((noinline)); // expected-warning {{'noinline' attribute only applies to function types}}
diff --git a/test/Sema/attr-noreturn.c b/test/Sema/attr-noreturn.c
index 14011bedca1a..0966989bf9a3 100644
--- a/test/Sema/attr-noreturn.c
+++ b/test/Sema/attr-noreturn.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only %s
static void (*fp0)(void) __attribute__((noreturn));
@@ -33,3 +33,8 @@ f5 (unsigned long size)
{
}
+
+// PR2461
+__attribute__((noreturn)) void f(__attribute__((noreturn)) void (*x)(void)) {
+ x();
+}
diff --git a/test/Sema/attr-regparm.c b/test/Sema/attr-regparm.c
index 944f01489c8b..045a41396e3f 100644
--- a/test/Sema/attr-regparm.c
+++ b/test/Sema/attr-regparm.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
__attribute((regparm(2))) int x(void);
__attribute((regparm(1.0))) int x(void); // expected-error{{'regparm' attribute requires integer constant}}
diff --git a/test/Sema/attr-section.c b/test/Sema/attr-section.c
index c61ed80cbf7a..20ae2e3547b9 100644
--- a/test/Sema/attr-section.c
+++ b/test/Sema/attr-section.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -fsyntax-only -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -verify -fsyntax-only -triple x86_64-apple-darwin9 %s
int x __attribute__((section(
42))); // expected-error {{argument to section attribute was not a string literal}}
diff --git a/test/Sema/attr-unused.c b/test/Sema/attr-unused.c
index dbb5e630d7a1..e45ec434f533 100644
--- a/test/Sema/attr-unused.c
+++ b/test/Sema/attr-unused.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only %s
static void (*fp0)(void) __attribute__((unused));
diff --git a/test/Sema/attr-used.c b/test/Sema/attr-used.c
index fdabf7ff2ad5..d50f4c09ac85 100644
--- a/test/Sema/attr-used.c
+++ b/test/Sema/attr-used.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only %s
extern int l0 __attribute__((used)); // expected-warning {{used attribute ignored}}
__private_extern__ int l1 __attribute__((used)); // expected-warning {{used attribute ignored}}
diff --git a/test/Sema/attr-weak.c b/test/Sema/attr-weak.c
index 4532cccf98d9..8e3e626c5d34 100644
--- a/test/Sema/attr-weak.c
+++ b/test/Sema/attr-weak.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only %s
extern int g0 __attribute__((weak));
extern int g1 __attribute__((weak_import));
diff --git a/test/Sema/bitfield-layout.c b/test/Sema/bitfield-layout.c
index 4405c80fee6b..edc44bdefa08 100644
--- a/test/Sema/bitfield-layout.c
+++ b/test/Sema/bitfield-layout.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -triple=i686-apple-darwin9
+// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=i686-apple-darwin9
#define CHECK_SIZE(kind, name, size) extern int name##1[sizeof(kind name) == size ? 1 : -1];
#define CHECK_ALIGN(kind, name, size) extern int name##2[__alignof(kind name) == size ? 1 : -1];
diff --git a/test/Sema/bitfield-promote-int-16bit.c b/test/Sema/bitfield-promote-int-16bit.c
index 12d47205e87d..cd9adcffc071 100644
--- a/test/Sema/bitfield-promote-int-16bit.c
+++ b/test/Sema/bitfield-promote-int-16bit.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -triple pic16-unknown-unknown
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple pic16-unknown-unknown
// Check that int-sized unsigned bit-fields promote to unsigned int
// on targets where sizeof(unsigned short) == sizeof(unsigned int)
diff --git a/test/Sema/bitfield-promote.c b/test/Sema/bitfield-promote.c
index 066f5d78e715..4d14ad191e1e 100644
--- a/test/Sema/bitfield-promote.c
+++ b/test/Sema/bitfield-promote.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct {unsigned x : 2;} x;
__typeof__((x.x+=1)+1) y;
__typeof__(x.x<<1) y;
diff --git a/test/Sema/bitfield.c b/test/Sema/bitfield.c
index 581af6d0c5ea..6f129daceba5 100644
--- a/test/Sema/bitfield.c
+++ b/test/Sema/bitfield.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
enum e0; // expected-note{{forward declaration of 'enum e0'}}
struct a {
diff --git a/test/Sema/block-args.c b/test/Sema/block-args.c
index 3a58735f23a3..08af9b377361 100644
--- a/test/Sema/block-args.c
+++ b/test/Sema/block-args.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -fblocks
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks
void take(void*);
diff --git a/test/Sema/block-as-object.m b/test/Sema/block-as-object.m
index 1197a1972fec..a85b6067571e 100644
--- a/test/Sema/block-as-object.m
+++ b/test/Sema/block-as-object.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify -fblocks
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks
@interface Whatever
- copy;
diff --git a/test/Sema/block-byref-args.c b/test/Sema/block-byref-args.c
index 06bab121f917..7b7cc3d2c49b 100644
--- a/test/Sema/block-byref-args.c
+++ b/test/Sema/block-byref-args.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -fblocks
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks
int printf(const char *, ...);
diff --git a/test/Sema/block-call.c b/test/Sema/block-call.c
index 893a8f61da8d..0aba75e14a9a 100644
--- a/test/Sema/block-call.c
+++ b/test/Sema/block-call.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -fblocks
+// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
int (*FP)();
int (^IFP) ();
diff --git a/test/Sema/block-labels.c b/test/Sema/block-labels.c
index f0f8c4856d81..af364b4f863a 100644
--- a/test/Sema/block-labels.c
+++ b/test/Sema/block-labels.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fblocks -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fblocks -fsyntax-only
int a() {
A:if (1) xx();
diff --git a/test/Sema/block-literal.c b/test/Sema/block-literal.c
index 9f5022dc6387..e9c2341a99c7 100644
--- a/test/Sema/block-literal.c
+++ b/test/Sema/block-literal.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify -fblocks
+// RUN: %clang_cc1 -fsyntax-only %s -verify -fblocks
void I( void (^)(void));
void (^noop)(void);
diff --git a/test/Sema/block-misc.c b/test/Sema/block-misc.c
index 8661fd8a5227..9f1bc4025fac 100644
--- a/test/Sema/block-misc.c
+++ b/test/Sema/block-misc.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -fblocks
+// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
void donotwarn();
int (^IFP) ();
diff --git a/test/Sema/block-printf-attribute-1.c b/test/Sema/block-printf-attribute-1.c
index 4941ae7bc679..8ea77ece12d8 100644
--- a/test/Sema/block-printf-attribute-1.c
+++ b/test/Sema/block-printf-attribute-1.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -fblocks
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks
int main() {
void (^b) (int arg, const char * format, ...) __attribute__ ((__format__ (__printf__, 1, 3))) = // expected-error {{format argument not a string type}}
diff --git a/test/Sema/block-return-1.c b/test/Sema/block-return-1.c
index 2da87351e4f5..631a2d443e1f 100644
--- a/test/Sema/block-return-1.c
+++ b/test/Sema/block-return-1.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify -fblocks
+// RUN: %clang_cc1 -fsyntax-only %s -verify -fblocks
int j;
void foo() {
diff --git a/test/Sema/block-return-2.c b/test/Sema/block-return-2.c
index d389f4e4ffcc..d5fbc6f70c5d 100644
--- a/test/Sema/block-return-2.c
+++ b/test/Sema/block-return-2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify -fblocks
+// RUN: %clang_cc1 -fsyntax-only %s -verify -fblocks
void foo() {
^ (void) __attribute__((noreturn)) { }(); // expected-error {{block declared 'noreturn' should not return}}
diff --git a/test/Sema/block-return-3.c b/test/Sema/block-return-3.c
index e7e9342e02f4..cd942a7f3047 100644
--- a/test/Sema/block-return-3.c
+++ b/test/Sema/block-return-3.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify -fblocks
+// RUN: %clang_cc1 -fsyntax-only %s -verify -fblocks
void foo() {
^ int (void) { }(); // expected-error {{control reaches end of non-void block}}
diff --git a/test/Sema/block-return.c b/test/Sema/block-return.c
index 98a72731d672..4240b0985625 100644
--- a/test/Sema/block-return.c
+++ b/test/Sema/block-return.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify -fblocks
+// RUN: %clang_cc1 -fsyntax-only %s -verify -fblocks
typedef void (^CL)(void);
diff --git a/test/Sema/block-sentinel-attribute.c b/test/Sema/block-sentinel-attribute.c
index 5628a2c7801f..b5ce0da15c60 100644
--- a/test/Sema/block-sentinel-attribute.c
+++ b/test/Sema/block-sentinel-attribute.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fblocks -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fblocks -fsyntax-only -verify %s
void (^e) (int arg, const char * format, ...) __attribute__ ((__sentinel__ (1,1)));
diff --git a/test/Sema/block-storageclass.c b/test/Sema/block-storageclass.c
index aacf8be2c06d..9bfbfbd614e5 100644
--- a/test/Sema/block-storageclass.c
+++ b/test/Sema/block-storageclass.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -fblocks
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks
int printf(const char *, ...);
void _Block_byref_release(void*src){}
diff --git a/test/Sema/builtin-object-size.c b/test/Sema/builtin-object-size.c
index 0c6d288d8c18..0abc27ba187a 100644
--- a/test/Sema/builtin-object-size.c
+++ b/test/Sema/builtin-object-size.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -fsyntax-only -verify %s
-// RUN: clang-cc -fsyntax-only -triple x86_64-apple-darwin9 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin9 -verify %s
int a[10];
diff --git a/test/Sema/builtin-prefetch.c b/test/Sema/builtin-prefetch.c
index 4ee9f8947bbb..4f09da6c28cf 100644
--- a/test/Sema/builtin-prefetch.c
+++ b/test/Sema/builtin-prefetch.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void foo() {
int a;
diff --git a/test/Sema/builtin-stackaddress.c b/test/Sema/builtin-stackaddress.c
index 67582a549f5f..1feb57ea5267 100644
--- a/test/Sema/builtin-stackaddress.c
+++ b/test/Sema/builtin-stackaddress.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void* a(unsigned x) {
return __builtin_return_address(0);
}
diff --git a/test/Sema/builtin-unary-fp.c b/test/Sema/builtin-unary-fp.c
index 70c7a297fbe3..8f48d7ffc56c 100644
--- a/test/Sema/builtin-unary-fp.c
+++ b/test/Sema/builtin-unary-fp.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -pedantic
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
void check(int);
void a() {
check(__builtin_isfinite(1.0f));
diff --git a/test/Sema/builtins.c b/test/Sema/builtins.c
index e133d626ee52..7b2f2afbd9ca 100644
--- a/test/Sema/builtins.c
+++ b/test/Sema/builtins.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -pedantic -triple=i686-apple-darwin9
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic -triple=i686-apple-darwin9
// This test needs to set the target because it uses __builtin_ia32_vec_ext_v4si
int test1(float a, int b) {
@@ -25,10 +25,11 @@ int test6(float a, long double b) {
#define CFSTR __builtin___CFStringMakeConstantString
void test7() {
- CFSTR("\242");
- CFSTR("\0"); // expected-warning {{ CFString literal contains NUL character }}
- CFSTR(242); // expected-error {{ CFString literal is not a string constant }} expected-warning {{incompatible integer to pointer conversion}}
- CFSTR("foo", "bar"); // expected-error {{too many arguments to function call}}
+ const void *X;
+ X = CFSTR("\242");
+ X = CFSTR("\0"); // expected-warning {{ CFString literal contains NUL character }}
+ X = CFSTR(242); // expected-error {{ CFString literal is not a string constant }} expected-warning {{incompatible integer to pointer conversion}}
+ X = CFSTR("foo", "bar"); // expected-error {{too many arguments to function call}}
}
diff --git a/test/Sema/c89-2.c b/test/Sema/c89-2.c
index 50c5f4e5a840..f6f6bd972090 100644
--- a/test/Sema/c89-2.c
+++ b/test/Sema/c89-2.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc %s -std=c89 -pedantic-errors -verify
+/* RUN: %clang_cc1 %s -std=c89 -pedantic-errors -verify
*/
#if 1LL /* expected-error {{long long}} */
diff --git a/test/Sema/c89.c b/test/Sema/c89.c
index fc50ebed6631..8a9e622d8749 100644
--- a/test/Sema/c89.c
+++ b/test/Sema/c89.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc %s -std=c89 -pedantic -fsyntax-only -verify
+/* RUN: %clang_cc1 %s -std=c89 -pedantic -fsyntax-only -verify
*/
void test1() {
{
diff --git a/test/Sema/callingconv.c b/test/Sema/callingconv.c
index f65aab463f57..a32a4953084d 100644
--- a/test/Sema/callingconv.c
+++ b/test/Sema/callingconv.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
void __attribute__((fastcall)) foo(float *a) {
}
diff --git a/test/Sema/carbon.c b/test/Sema/carbon.c
index 8292ba8a506b..f0affd254088 100644
--- a/test/Sema/carbon.c
+++ b/test/Sema/carbon.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -mcpu pentium4 %s -print-stats
+// RUN: %clang_cc1 -target-cpu pentium4 %s -print-stats
#ifdef __APPLE__
#include <Carbon/Carbon.h>
#endif
diff --git a/test/Sema/cast-to-union.c b/test/Sema/cast-to-union.c
index 24f913b9ea33..6856c17c721a 100644
--- a/test/Sema/cast-to-union.c
+++ b/test/Sema/cast-to-union.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
union u { int i; };
void f(union u);
diff --git a/test/Sema/cast.c b/test/Sema/cast.c
index d2e3e0c7e3a1..e52dcaebbddb 100644
--- a/test/Sema/cast.c
+++ b/test/Sema/cast.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify
+// RUN: %clang_cc1 -fsyntax-only %s -verify
typedef struct { unsigned long bits[(((1) + (64) - 1) / (64))]; } cpumask_t;
cpumask_t x;
diff --git a/test/Sema/check-increment.c b/test/Sema/check-increment.c
index 72eae06bfa1b..070ea74f6800 100644
--- a/test/Sema/check-increment.c
+++ b/test/Sema/check-increment.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int printf(const char *, ...);
typedef int *pint;
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index fa2d3a062ed1..75a3cf1f62b8 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -fsyntax-only -pedantic -verify -Wsign-compare %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -pedantic -verify -Wsign-compare %s
int test(char *C) { // nothing here should warn.
return C != ((void*)0);
diff --git a/test/Sema/complex-int.c b/test/Sema/complex-int.c
index 6c660899e8a1..2bd03744d7a0 100644
--- a/test/Sema/complex-int.c
+++ b/test/Sema/complex-int.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
void a() {
__complex__ int arr;
diff --git a/test/Sema/complex-promotion.c b/test/Sema/complex-promotion.c
index 3d86c20eb248..23c3b6895314 100644
--- a/test/Sema/complex-promotion.c
+++ b/test/Sema/complex-promotion.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
float a;
diff --git a/test/Sema/compound-literal.c b/test/Sema/compound-literal.c
index b51bcfe2a233..a650d12de973 100644
--- a/test/Sema/compound-literal.c
+++ b/test/Sema/compound-literal.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
struct foo { int a, b; };
diff --git a/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c
index 8cac32c82f45..5f01374be366 100644
--- a/test/Sema/conditional-expr.c
+++ b/test/Sema/conditional-expr.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic -Wsign-compare %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wsign-compare %s
void foo() {
*(0 ? (double *)0 : (void *)0) = 0;
// FIXME: GCC doesn't consider the the following two statements to be errors.
diff --git a/test/Sema/conditional.c b/test/Sema/conditional.c
index 9f48c349c964..e67580ace600 100644
--- a/test/Sema/conditional.c
+++ b/test/Sema/conditional.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
const char* test1 = 1 ? "i" : 1 == 1 ? "v" : "r";
diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c
index 39a24b326991..fee8d97f9bb4 100644
--- a/test/Sema/const-eval.c
+++ b/test/Sema/const-eval.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#define EVAL_EXPR(testno, expr) int test##testno = sizeof(struct{char qq[expr];});
int x;
diff --git a/test/Sema/const-ptr-int-ptr-cast.c b/test/Sema/const-ptr-int-ptr-cast.c
index 4e08bfff2cbb..c6e70b8b2455 100644
--- a/test/Sema/const-ptr-int-ptr-cast.c
+++ b/test/Sema/const-ptr-int-ptr-cast.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stdint.h>
diff --git a/test/Sema/constant-builtins-2.c b/test/Sema/constant-builtins-2.c
index 18dbb1e7c54a..23aa314e0c32 100644
--- a/test/Sema/constant-builtins-2.c
+++ b/test/Sema/constant-builtins-2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
// Math stuff
diff --git a/test/Sema/constant-builtins.c b/test/Sema/constant-builtins.c
index f8cea33d6762..5d67fc7cb717 100644
--- a/test/Sema/constant-builtins.c
+++ b/test/Sema/constant-builtins.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify -pedantic
+// RUN: %clang_cc1 -fsyntax-only %s -verify -pedantic
// Math stuff
diff --git a/test/Sema/constructor-attribute.c b/test/Sema/constructor-attribute.c
index bf876f344a8f..3dfbbcbe281c 100644
--- a/test/Sema/constructor-attribute.c
+++ b/test/Sema/constructor-attribute.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int x __attribute__((constructor)); // expected-warning {{'constructor' attribute only applies to function types}}
int f() __attribute__((constructor));
diff --git a/test/Sema/conversion-64-32.c b/test/Sema/conversion-64-32.c
index 53830fd061c4..104399641d28 100644
--- a/test/Sema/conversion-64-32.c
+++ b/test/Sema/conversion-64-32.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -Wshorten-64-to-32 -triple x86_64-apple-darwin %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wshorten-64-to-32 -triple x86_64-apple-darwin %s
int test0(long v) {
return v; // expected-warning {{implicit cast loses integer precision}}
diff --git a/test/Sema/conversion.c b/test/Sema/conversion.c
index bca23f8f8df8..264e0430dacd 100644
--- a/test/Sema/conversion.c
+++ b/test/Sema/conversion.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -Wconversion -triple x86_64-apple-darwin %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wconversion -triple x86_64-apple-darwin %s
#define BIG 0x7f7f7f7f7f7f7f7fL
diff --git a/test/Sema/darwin-align-cast.c b/test/Sema/darwin-align-cast.c
index fed898319157..208097481cdc 100644
--- a/test/Sema/darwin-align-cast.c
+++ b/test/Sema/darwin-align-cast.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef long unsigned int __darwin_size_t;
typedef long __darwin_ssize_t;
typedef __darwin_size_t size_t;
diff --git a/test/Sema/decl-invalid.c b/test/Sema/decl-invalid.c
index 823551f02e6f..815e6dd9ca50 100644
--- a/test/Sema/decl-invalid.c
+++ b/test/Sema/decl-invalid.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// See Sema::ParsedFreeStandingDeclSpec about the double diagnostic
typedef union <anonymous> __mbstate_t; // expected-error {{declaration of anonymous union must be a definition}} expected-error {{declaration does not declare anything}}
diff --git a/test/Sema/decl-type-merging.c b/test/Sema/decl-type-merging.c
index 1a8601298e9a..259b0ddf1545 100644
--- a/test/Sema/decl-type-merging.c
+++ b/test/Sema/decl-type-merging.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c99 -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -std=c99 -verify -pedantic %s
int x[10];
int x[] = {1,2,3};
diff --git a/test/Sema/declspec.c b/test/Sema/declspec.c
index e325cc83521a..2cf49aa29da1 100644
--- a/test/Sema/declspec.c
+++ b/test/Sema/declspec.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
typedef char T[4];
T foo(int n, int m) { } // expected-error {{cannot return array or function}}
@@ -21,3 +21,4 @@ __restrict__ f* v2; // expected-error {{restrict requires a pointer or referenc
__restrict__ fptr v3; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
f *__restrict__ v4; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
+restrict struct hallo; // expected-error {{restrict requires a pointer or reference}}
diff --git a/test/Sema/default.c b/test/Sema/default.c
index 5dac99131b6b..131860184501 100644
--- a/test/Sema/default.c
+++ b/test/Sema/default.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f5 (int z) {
if (z)
diff --git a/test/Sema/default1.c b/test/Sema/default1.c
index 6e8a27bf5733..631e848df16c 100644
--- a/test/Sema/default1.c
+++ b/test/Sema/default1.c
@@ -1,2 +1,2 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f(int i = 0); // expected-error {{C does not support default arguments}}
diff --git a/test/Sema/deref.c b/test/Sema/deref.c
index 965940e26d5e..845b28645a48 100644
--- a/test/Sema/deref.c
+++ b/test/Sema/deref.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -fsyntax-only -verify -std=c90 -pedantic %s
+/* RUN: %clang_cc1 -fsyntax-only -verify -std=c90 -pedantic %s
*/
void
foo (void)
diff --git a/test/Sema/designated-initializers.c b/test/Sema/designated-initializers.c
index ae951d42a1a6..7e4ed6892aee 100644
--- a/test/Sema/designated-initializers.c
+++ b/test/Sema/designated-initializers.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -triple x86_64-unknown-unknown %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-unknown-unknown %s
int complete_array_from_init[] = { 1, 2, [10] = 5, 1, 2, [5] = 2, 6 };
@@ -231,4 +231,21 @@ int crazy_Y[] = {
[ 0 ? crazy_x : 4] = 1
};
+// PR5843
+struct expr {
+ int nargs;
+ union {
+ unsigned long int num;
+ struct expr *args[3];
+ } val;
+};
+struct expr expr0 = {
+ .nargs = 2,
+ .val = {
+ .args = {
+ [0] = (struct expr *)0,
+ [1] = (struct expr *)0
+ }
+ }
+};
diff --git a/test/Sema/dllimport-dllexport.c b/test/Sema/dllimport-dllexport.c
index 90ed1456d24d..a1e7a18166c5 100644
--- a/test/Sema/dllimport-dllexport.c
+++ b/test/Sema/dllimport-dllexport.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
inline void __attribute__((dllexport)) foo1(){} // expected-warning{{dllexport attribute ignored}}
inline void __attribute__((dllimport)) foo2(){} // expected-warning{{dllimport attribute ignored}}
diff --git a/test/Sema/enum.c b/test/Sema/enum.c
index 31649e0ae9ed..262cab50a55f 100644
--- a/test/Sema/enum.c
+++ b/test/Sema/enum.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -pedantic
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
enum e {A,
B = 42LL << 32, // expected-warning {{ISO C restricts enumerator values to range of 'int'}}
C = -4, D = 12456 };
diff --git a/test/Sema/expr-address-of.c b/test/Sema/expr-address-of.c
index 909acfb26662..8f9f795d00dd 100644
--- a/test/Sema/expr-address-of.c
+++ b/test/Sema/expr-address-of.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
struct xx { int bitf:1; };
struct entry { struct xx *whatever;
diff --git a/test/Sema/expr-comma-c89.c b/test/Sema/expr-comma-c89.c
index ffe8b696f608..d0883ba202f9 100644
--- a/test/Sema/expr-comma-c89.c
+++ b/test/Sema/expr-comma-c89.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -std=c99
+// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c99
// rdar://6095180
struct s { char c[17]; };
diff --git a/test/Sema/expr-comma.c b/test/Sema/expr-comma.c
index 3a05130eae32..d3e4020af637 100644
--- a/test/Sema/expr-comma.c
+++ b/test/Sema/expr-comma.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -std=c89
+// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c89
// rdar://6095180
struct s { char c[17]; };
diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c
index 10fcde6e7576..e6cfa5fbe3e4 100644
--- a/test/Sema/exprs.c
+++ b/test/Sema/exprs.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
// PR1966
_Complex double test1() {
diff --git a/test/Sema/ext_vector_casts.c b/test/Sema/ext_vector_casts.c
index dbcd1c9b3ac0..cbda021cd282 100644
--- a/test/Sema/ext_vector_casts.c
+++ b/test/Sema/ext_vector_casts.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef __attribute__(( ext_vector_type(2) )) float float2;
typedef __attribute__(( ext_vector_type(4) )) int int4;
diff --git a/test/Sema/ext_vector_components.c b/test/Sema/ext_vector_components.c
index 48903024d3c6..7d3d52aa9546 100644
--- a/test/Sema/ext_vector_components.c
+++ b/test/Sema/ext_vector_components.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef __attribute__(( ext_vector_type(2) )) float float2;
typedef __attribute__(( ext_vector_type(3) )) float float3;
@@ -26,8 +26,6 @@ static void test() {
f = vec2.x; // legal, shorten
f = vec4.xy.x; // legal, shorten
- vec2 = vec3.hi; // expected-error {{vector component access invalid for odd-sized type 'float3'}}
-
vec4_2.xyzx = vec4.xyzw; // expected-error {{vector is not assignable (contains duplicate components)}}
vec4_2.xyzz = vec4.xyzw; // expected-error {{vector is not assignable (contains duplicate components)}}
vec4_2.xyyw = vec4.xyzw; // expected-error {{vector is not assignable (contains duplicate components)}}
@@ -42,3 +40,8 @@ static void test() {
vec4p->yz = vec4p->xy;
}
+
+float2 lo(float3 x) { return x.lo; }
+float2 hi(float3 x) { return x.hi; }
+float2 ev(float3 x) { return x.even; }
+float2 od(float3 x) { return x.odd; }
diff --git a/test/Sema/flexible-array-init.c b/test/Sema/flexible-array-init.c
index afe31fb8294f..e03881cdbcbe 100644
--- a/test/Sema/flexible-array-init.c
+++ b/test/Sema/flexible-array-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
struct one {
int a;
int values[]; // expected-note 3{{initialized flexible array member 'values' is here}}
diff --git a/test/Sema/floating-point-compare.c b/test/Sema/floating-point-compare.c
index 9888105518d9..60f971c6df97 100644
--- a/test/Sema/floating-point-compare.c
+++ b/test/Sema/floating-point-compare.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -Wfloat-equal -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wfloat-equal -verify %s
int f1(float x, float y) {
return x == y; // expected-warning {{comparing floating point with ==}}
diff --git a/test/Sema/for.c b/test/Sema/for.c
index 183a95d0ab44..b998f4b07cf0 100644
--- a/test/Sema/for.c
+++ b/test/Sema/for.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Check C99 6.8.5p3
void b1 (void) { for (void (*f) (void);;); }
diff --git a/test/Sema/format-attr-pr4470.c b/test/Sema/format-attr-pr4470.c
index 24eece8878e2..374d8b3af03f 100644
--- a/test/Sema/format-attr-pr4470.c
+++ b/test/Sema/format-attr-pr4470.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -Wformat=2 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wformat=2 %s
#include <stdarg.h>
int vprintf(const char *, va_list);
diff --git a/test/Sema/format-attribute-printf0.c b/test/Sema/format-attribute-printf0.c
index fa7eafd52fb8..33e8d40076dc 100644
--- a/test/Sema/format-attribute-printf0.c
+++ b/test/Sema/format-attribute-printf0.c
@@ -1,4 +1,4 @@
-//RUN: clang-cc -fsyntax-only -verify %s
+//RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stdarg.h>
diff --git a/test/Sema/format-attribute.c b/test/Sema/format-attribute.c
index cb823318592e..6e1bd0f1ab65 100644
--- a/test/Sema/format-attribute.c
+++ b/test/Sema/format-attribute.c
@@ -1,4 +1,4 @@
-//RUN: clang-cc -fsyntax-only -verify %s
+//RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stdarg.h>
diff --git a/test/Sema/format-string-percentm.c b/test/Sema/format-string-percentm.c
index f531372fd451..f2e9dd81bab3 100644
--- a/test/Sema/format-string-percentm.c
+++ b/test/Sema/format-string-percentm.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -triple i686-pc-linux-gnu
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple i686-pc-linux-gnu
int printf(char const*,...);
void percentm(void) {
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 0a9fccebd7fd..67081b5e2603 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -Wformat-nonliteral %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral %s
#include <stdarg.h>
typedef __typeof(sizeof(int)) size_t;
@@ -50,6 +50,7 @@ void check_conditional_literal(const char* s, int i) {
printf(i == 1 ? "yes" : "no"); // no-warning
printf(i == 0 ? (i == 1 ? "yes" : "no") : "dont know"); // no-warning
printf(i == 0 ? (i == 1 ? s : "no") : "dont know"); // expected-warning{{format string is not a string literal}}
+ printf("yes" ?: "no %d", 1); // expected-warning{{more data arguments than '%' conversions}}
}
void check_writeback_specifier()
diff --git a/test/Sema/freemain.c b/test/Sema/freemain.c
index a2364df259bf..eed644d483ac 100644
--- a/test/Sema/freemain.c
+++ b/test/Sema/freemain.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -ffreestanding %s
+// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding %s
// Tests that -ffreestanding disables all special treatment of main().
diff --git a/test/Sema/function-pointer-sentinel-attribute.c b/test/Sema/function-pointer-sentinel-attribute.c
index 6d3fb1718076..5f17a260b26f 100644
--- a/test/Sema/function-pointer-sentinel-attribute.c
+++ b/test/Sema/function-pointer-sentinel-attribute.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void (*e) (int arg, const char * format, ...) __attribute__ ((__sentinel__ (1,1)));
diff --git a/test/Sema/function-ptr.c b/test/Sema/function-ptr.c
index 6b410018f4b7..c1ff8e1d7b1f 100644
--- a/test/Sema/function-ptr.c
+++ b/test/Sema/function-ptr.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -pedantic
+// RUN: %clang_cc1 %s -verify -pedantic
typedef int unary_int_func(int arg);
unary_int_func *func;
diff --git a/test/Sema/function-redecl.c b/test/Sema/function-redecl.c
index 28593b0678d1..9544dc9baef6 100644
--- a/test/Sema/function-redecl.c
+++ b/test/Sema/function-redecl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR3588
void g0(int, int);
diff --git a/test/Sema/function-sentinel-attr.c b/test/Sema/function-sentinel-attr.c
index b33b4a063ce2..9bcbec4c0c36 100644
--- a/test/Sema/function-sentinel-attr.c
+++ b/test/Sema/function-sentinel-attr.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#define NULL (void*)0
diff --git a/test/Sema/function.c b/test/Sema/function.c
index e7a37f1a2fc1..9a83519a90b5 100644
--- a/test/Sema/function.c
+++ b/test/Sema/function.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -pedantic
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
// PR1892
void f(double a[restrict][5]); // should promote to restrict ptr.
void f(double (* restrict a)[5]);
diff --git a/test/Sema/gnu89.c b/test/Sema/gnu89.c
index 4601cbe93f6e..fc21dcd5cd45 100644
--- a/test/Sema/gnu89.c
+++ b/test/Sema/gnu89.c
@@ -1,3 +1,3 @@
-// RUN: clang-cc %s -std=gnu89 -pedantic -fsyntax-only -verify
+// RUN: %clang_cc1 %s -std=gnu89 -pedantic -fsyntax-only -verify
int f(int restrict);
diff --git a/test/Sema/heinous-extensions-off.c b/test/Sema/heinous-extensions-off.c
index 3a9880ce7f75..9b80d3496de9 100644
--- a/test/Sema/heinous-extensions-off.c
+++ b/test/Sema/heinous-extensions-off.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify
+// RUN: %clang_cc1 %s -verify
int foo() {
int a;
diff --git a/test/Sema/heinous-extensions-on.c b/test/Sema/heinous-extensions-on.c
index a56f1f6f625c..176f4727ef2b 100644
--- a/test/Sema/heinous-extensions-on.c
+++ b/test/Sema/heinous-extensions-on.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fheinous-gnu-extensions
+// RUN: %clang_cc1 %s -verify -fheinous-gnu-extensions
void foo() {
int a;
diff --git a/test/Sema/i-c-e.c b/test/Sema/i-c-e.c
index 6e14833166d8..c561fe01c6ee 100644
--- a/test/Sema/i-c-e.c
+++ b/test/Sema/i-c-e.c
@@ -1,4 +1,4 @@
-// RUN: clang %s -fsyntax-only -Xclang -verify -pedantic -fpascal-strings
+// RUN: %clang %s -fsyntax-only -Xclang -verify -pedantic -fpascal-strings
#include <stdint.h>
#include <limits.h>
diff --git a/test/Sema/if-empty-body.c b/test/Sema/if-empty-body.c
index 1d1df40bd6a3..af1e62f6b1b6 100644
--- a/test/Sema/if-empty-body.c
+++ b/test/Sema/if-empty-body.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f1(int a) {
if (a); // expected-warning {{if statement has empty body}}
diff --git a/test/Sema/illegal-types.c b/test/Sema/illegal-types.c
index c932bb28dcca..3c59df8298c0 100644
--- a/test/Sema/illegal-types.c
+++ b/test/Sema/illegal-types.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
void a (void []()); // expected-error{{'type name' declared as array of functions}}
void b (void p[]()); // expected-error{{'p' declared as array of functions}}
diff --git a/test/Sema/implicit-builtin-decl.c b/test/Sema/implicit-builtin-decl.c
index 696a2b926c9b..09ecd23ca1ba 100644
--- a/test/Sema/implicit-builtin-decl.c
+++ b/test/Sema/implicit-builtin-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f() {
int *ptr = malloc(sizeof(int) * 10); // expected-warning{{implicitly declaring C library function 'malloc' with type}} \
// expected-note{{please include the header <stdlib.h> or explicitly provide a declaration for 'malloc'}} \
diff --git a/test/Sema/implicit-builtin-freestanding.c b/test/Sema/implicit-builtin-freestanding.c
index 9bd5c05892ec..505e5221eff8 100644
--- a/test/Sema/implicit-builtin-freestanding.c
+++ b/test/Sema/implicit-builtin-freestanding.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -ffreestanding %s
+// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding %s
int malloc(int a) { return a; }
diff --git a/test/Sema/implicit-builtin-redecl.c b/test/Sema/implicit-builtin-redecl.c
index fc51312f1770..1e520d2ae902 100644
--- a/test/Sema/implicit-builtin-redecl.c
+++ b/test/Sema/implicit-builtin-redecl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR3592
static void* malloc(int);
diff --git a/test/Sema/implicit-cast.c b/test/Sema/implicit-cast.c
index ce34ad6d1c65..088b1958d9b8 100644
--- a/test/Sema/implicit-cast.c
+++ b/test/Sema/implicit-cast.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
static char *test1(int cf) {
return cf ? "abc" : 0;
diff --git a/test/Sema/implicit-decl.c b/test/Sema/implicit-decl.c
index 8873e76098ca..fc48895f4eb1 100644
--- a/test/Sema/implicit-decl.c
+++ b/test/Sema/implicit-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
typedef int int32_t;
typedef unsigned char Boolean;
diff --git a/test/Sema/implicit-def.c b/test/Sema/implicit-def.c
index 3b31b999667c..6caa090631e6 100644
--- a/test/Sema/implicit-def.c
+++ b/test/Sema/implicit-def.c
@@ -1,5 +1,5 @@
-/* RUN: clang-cc -fsyntax-only %s -std=c89
- * RUN: not clang-cc -fsyntax-only %s -std=c99 -pedantic-errors
+/* RUN: %clang_cc1 -fsyntax-only %s -std=c89
+ * RUN: not %clang_cc1 -fsyntax-only %s -std=c99 -pedantic-errors
*/
int A() {
diff --git a/test/Sema/implicit-int.c b/test/Sema/implicit-int.c
index 5190bdbf934b..1bb9a8385306 100644
--- a/test/Sema/implicit-int.c
+++ b/test/Sema/implicit-int.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify -pedantic
+// RUN: %clang_cc1 -fsyntax-only %s -verify -pedantic
foo() { // expected-warning {{type specifier missing, defaults to 'int'}}
return 0;
diff --git a/test/Sema/incompatible-sign.c b/test/Sema/incompatible-sign.c
index a62f9a8ba709..a1592efc4c47 100644
--- a/test/Sema/incompatible-sign.c
+++ b/test/Sema/incompatible-sign.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
int a(int* x);
int b(unsigned* y) { return a(y); } // expected-warning {{pointer types point to integer types with different sign}}
diff --git a/test/Sema/incomplete-call.c b/test/Sema/incomplete-call.c
index 15d97683c5a0..3ef578d59f6f 100644
--- a/test/Sema/incomplete-call.c
+++ b/test/Sema/incomplete-call.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct foo; // expected-note 3 {{forward declaration of 'struct foo'}}
diff --git a/test/Sema/incomplete-decl.c b/test/Sema/incomplete-decl.c
index 6a6ba753f3fe..753d9c0a3c1a 100644
--- a/test/Sema/incomplete-decl.c
+++ b/test/Sema/incomplete-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct foo; // expected-note 5 {{forward declaration of 'struct foo'}}
diff --git a/test/Sema/indirect-goto.c b/test/Sema/indirect-goto.c
index 35fb5e6315e2..134ccd8a7076 100644
--- a/test/Sema/indirect-goto.c
+++ b/test/Sema/indirect-goto.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct c {int x;};
int a(struct c x, long long y) {
diff --git a/test/Sema/init-struct-qualified.c b/test/Sema/init-struct-qualified.c
index 539820ae418c..49ec7cc5e060 100644
--- a/test/Sema/init-struct-qualified.c
+++ b/test/Sema/init-struct-qualified.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify < %s
+// RUN: %clang_cc1 -fsyntax-only -verify < %s
typedef float CGFloat;
typedef struct _NSPoint { CGFloat x; CGFloat y; } NSPoint;
typedef struct _NSSize { CGFloat width; CGFloat height; } NSSize;
diff --git a/test/Sema/init-vector.c b/test/Sema/init-vector.c
index 691ea97268fd..f0cf32bd3f9c 100644
--- a/test/Sema/init-vector.c
+++ b/test/Sema/init-vector.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef float __attribute__((vector_size (16))) v4f_t;
diff --git a/test/Sema/init.c b/test/Sema/init.c
index 4ba6867d0b0f..c2712480c616 100644
--- a/test/Sema/init.c
+++ b/test/Sema/init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
#include <stddef.h>
#include <stdint.h>
@@ -20,7 +20,7 @@ int *h = &x;
int test() {
int a[10];
-int b[10] = a; // expected-error {{initialization with '{...}' expected}}
+int b[10] = a; // expected-error {{array initializer must be an initializer list}}
int +; // expected-error {{expected identifier or '('}}
}
diff --git a/test/Sema/inline.c b/test/Sema/inline.c
index adcde51363eb..3c99f2433783 100644
--- a/test/Sema/inline.c
+++ b/test/Sema/inline.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Check that we don't allow illegal uses of inline
inline int a; // expected-error{{'inline' can only appear on functions}}
diff --git a/test/Sema/int-arith-convert.c b/test/Sema/int-arith-convert.c
index 5bbab7d9af96..c56ab3b76302 100644
--- a/test/Sema/int-arith-convert.c
+++ b/test/Sema/int-arith-convert.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple=i686-linux-gnu -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple=i686-linux-gnu -fsyntax-only -verify %s
// Check types are the same through redeclaration
unsigned long x;
diff --git a/test/Sema/invalid-decl.c b/test/Sema/invalid-decl.c
index 8c458008cb5c..7f471a152681 100644
--- a/test/Sema/invalid-decl.c
+++ b/test/Sema/invalid-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
void test() {
char = 4; // expected-error {{expected identifier}}
diff --git a/test/Sema/invalid-init-diag.c b/test/Sema/invalid-init-diag.c
index 724d0ea368ba..a215fa7c254b 100644
--- a/test/Sema/invalid-init-diag.c
+++ b/test/Sema/invalid-init-diag.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
int a;
struct {int x;} x = a; // expected-error {{incompatible type initializing 'int', expected 'struct <anonymous>'}}
diff --git a/test/Sema/invalid-struct-init.c b/test/Sema/invalid-struct-init.c
index 73e2e446f131..a598d577f006 100644
--- a/test/Sema/invalid-struct-init.c
+++ b/test/Sema/invalid-struct-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
typedef struct _zend_module_entry zend_module_entry;
struct _zend_module_entry {
diff --git a/test/Sema/knr-def-call.c b/test/Sema/knr-def-call.c
index 6b033fc3a21f..8ae0550dc8b1 100644
--- a/test/Sema/knr-def-call.c
+++ b/test/Sema/knr-def-call.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C DR #316, PR 3626.
void f0(a, b, c, d) int a,b,c,d; {}
diff --git a/test/Sema/knr-variadic-def.c b/test/Sema/knr-variadic-def.c
index 070ba071ca67..6d5d63208bf0 100644
--- a/test/Sema/knr-variadic-def.c
+++ b/test/Sema/knr-variadic-def.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
// PR4287
#include <stdarg.h>
diff --git a/test/Sema/member-reference.c b/test/Sema/member-reference.c
index b810ccf15b72..7bda14303a2d 100644
--- a/test/Sema/member-reference.c
+++ b/test/Sema/member-reference.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
struct simple { int i; };
diff --git a/test/Sema/merge-decls.c b/test/Sema/merge-decls.c
index f4c25f511429..1a84d33b7943 100644
--- a/test/Sema/merge-decls.c
+++ b/test/Sema/merge-decls.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
void foo(void);
void foo(void) {}
diff --git a/test/Sema/ms-fuzzy-asm.c b/test/Sema/ms-fuzzy-asm.c
index 2113949f237b..9ace6569348e 100644
--- a/test/Sema/ms-fuzzy-asm.c
+++ b/test/Sema/ms-fuzzy-asm.c
@@ -1,4 +1,5 @@
-// RUN: clang-cc %s -verify -fms-extensions
+// RUN: %clang_cc1 %s -verify -fms-extensions
+// XFAIL: *
#define M __asm int 0x2c
#define M2 int
diff --git a/test/Sema/nested-redef.c b/test/Sema/nested-redef.c
index 54a970f04421..6a19921f47fa 100644
--- a/test/Sema/nested-redef.c
+++ b/test/Sema/nested-redef.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X { // expected-note{{previous definition is here}}
struct X { } x; // expected-error{{nested redefinition of 'X'}} \
// expected-error{{field has incomplete type}}
diff --git a/test/Sema/offsetof.c b/test/Sema/offsetof.c
index dfae99216f8a..49d4eb43e423 100644
--- a/test/Sema/offsetof.c
+++ b/test/Sema/offsetof.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
diff --git a/test/Sema/overloadable-complex.c b/test/Sema/overloadable-complex.c
index 62b388213347..e8dbf3a6094a 100644
--- a/test/Sema/overloadable-complex.c
+++ b/test/Sema/overloadable-complex.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
char *foo(float) __attribute__((__overloadable__)); // expected-note 3 {{candidate function}}
void test_foo_1(float fv, double dv, float _Complex fc, double _Complex dc) {
diff --git a/test/Sema/overloadable.c b/test/Sema/overloadable.c
index 0d5db3a98454..72d3673c825e 100644
--- a/test/Sema/overloadable.c
+++ b/test/Sema/overloadable.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int var __attribute__((overloadable)); // expected-error{{'overloadable' attribute can only be applied to a function}}
diff --git a/test/Sema/parentheses.c b/test/Sema/parentheses.c
index f9f647c9cff7..f7a7fbd37db3 100644
--- a/test/Sema/parentheses.c
+++ b/test/Sema/parentheses.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -Wparentheses -fsyntax-only -verify %s
-// RUN: clang-cc -Wparentheses -fixit %s -o - | clang-cc -Wparentheses -Werror -
+// RUN: %clang_cc1 -Wparentheses -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wparentheses -fixit %s -o - | %clang_cc1 -Wparentheses -Werror -
// Test the various warnings under -Wparentheses
void if_assign(void) {
diff --git a/test/Sema/pointer-addition.c b/test/Sema/pointer-addition.c
index 87d5eaf39c99..34f8bbbfcd6d 100644
--- a/test/Sema/pointer-addition.c
+++ b/test/Sema/pointer-addition.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -pedantic
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
typedef struct S S; // expected-note 3 {{forward declaration of 'struct S'}}
void a(S* b, void* c) {
diff --git a/test/Sema/pointer-conversion.c b/test/Sema/pointer-conversion.c
index 5f41ff67411b..7191bf7c63f4 100644
--- a/test/Sema/pointer-conversion.c
+++ b/test/Sema/pointer-conversion.c
@@ -1,4 +1,4 @@
-//RUN: clang-cc -fsyntax-only -verify %s
+//RUN: %clang_cc1 -fsyntax-only -verify %s
char * c;
char const ** c2 = &c; // expected-warning {{initializing, 'char const **' and 'char **' have different qualifiers in nested pointer types}}
diff --git a/test/Sema/pointer-subtract-compat.c b/test/Sema/pointer-subtract-compat.c
index b3be37e7f185..70340c6a4cd3 100644
--- a/test/Sema/pointer-subtract-compat.c
+++ b/test/Sema/pointer-subtract-compat.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -pedantic
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
typedef const char rchar;
int a(char* a, rchar* b) {
diff --git a/test/Sema/pragma-pack-2.c b/test/Sema/pragma-pack-2.c
index 25be5539783e..3e6234c57f0e 100644
--- a/test/Sema/pragma-pack-2.c
+++ b/test/Sema/pragma-pack-2.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i686-apple-darwin9 %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
#include <stddef.h>
diff --git a/test/Sema/pragma-pack-3.c b/test/Sema/pragma-pack-3.c
index a2d665ea7417..d97359e45b71 100644
--- a/test/Sema/pragma-pack-3.c
+++ b/test/Sema/pragma-pack-3.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i686-apple-darwin9 %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
// Stack: [], Alignment: 8
diff --git a/test/Sema/pragma-pack-4.c b/test/Sema/pragma-pack-4.c
index 3ccaf7e96ce6..b06fc0eaf15f 100644
--- a/test/Sema/pragma-pack-4.c
+++ b/test/Sema/pragma-pack-4.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -triple i686-apple-darwin9 %s -fsyntax-only -verify
-// RUN: clang-cc -triple x86_64-apple-darwin9 %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -fsyntax-only -verify
// rdar://problem/7095436
#pragma pack(4)
diff --git a/test/Sema/pragma-pack.c b/test/Sema/pragma-pack.c
index 51398fa0a554..e93ce42148ca 100644
--- a/test/Sema/pragma-pack.c
+++ b/test/Sema/pragma-pack.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i686-apple-darwin9 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i686-apple-darwin9 -fsyntax-only -verify %s
/* expected-warning {{value of #pragma pack(show) == 8}} */ #pragma pack(show)
/* expected-warning {{expected #pragma pack parameter to be}} */ #pragma pack(3)
diff --git a/test/Sema/pragma-unused.c b/test/Sema/pragma-unused.c
index 8b9498962646..8a051a3ec9ef 100644
--- a/test/Sema/pragma-unused.c
+++ b/test/Sema/pragma-unused.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f1(void) {
int x, y, z;
diff --git a/test/Sema/predef.c b/test/Sema/predef.c
index 7b3fe5038f96..9c1994699da7 100644
--- a/test/Sema/predef.c
+++ b/test/Sema/predef.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void abcdefghi12(void) {
const char (*ss)[12] = &__func__;
diff --git a/test/Sema/predefined-function.c b/test/Sema/predefined-function.c
index c8d17f0078e6..665d0fa1a8b7 100644
--- a/test/Sema/predefined-function.c
+++ b/test/Sema/predefined-function.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
char *funk(int format);
enum Test {A=-1};
diff --git a/test/Sema/private-extern.c b/test/Sema/private-extern.c
index 5dd37f430efa..d3c12651098a 100644
--- a/test/Sema/private-extern.c
+++ b/test/Sema/private-extern.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only %s
static int g0; // expected-note{{previous definition}}
int g0; // expected-error{{non-static declaration of 'g0' follows static declaration}}
diff --git a/test/Sema/promote-int-16bit.c b/test/Sema/promote-int-16bit.c
index fbd1215d90d2..6446720a815e 100644
--- a/test/Sema/promote-int-16bit.c
+++ b/test/Sema/promote-int-16bit.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -triple pic16-unknown-unknown
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple pic16-unknown-unknown
// Check that unsigned short promotes to unsigned int on targets where
// sizeof(unsigned short) == sizeof(unsigned int)
diff --git a/test/Sema/rdar6248119.m b/test/Sema/rdar6248119.m
index d4ee305c2912..6b120b284756 100644
--- a/test/Sema/rdar6248119.m
+++ b/test/Sema/rdar6248119.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only %s -verify
+// RUN: %clang_cc1 -fsyntax-only %s -verify
// Test case for:
// <rdar://problem/6248119> @finally doesn't introduce a new scope
diff --git a/test/Sema/rdr6094103-unordered-compare-promote.c b/test/Sema/rdr6094103-unordered-compare-promote.c
index 636f770e3ee0..9991982a20b2 100644
--- a/test/Sema/rdr6094103-unordered-compare-promote.c
+++ b/test/Sema/rdr6094103-unordered-compare-promote.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -ast-dump %s 2>&1 | grep ImplicitCastExpr | count 2
+// RUN: %clang_cc1 -ast-dump %s 2>&1 | grep ImplicitCastExpr | count 2
int foo (double x, long double y) {
// There needs to be an implicit cast on x here.
diff --git a/test/Sema/recover-goto.c b/test/Sema/recover-goto.c
index e7b9f3c8eafc..0d665f9a60f5 100644
--- a/test/Sema/recover-goto.c
+++ b/test/Sema/recover-goto.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify
+// RUN: %clang_cc1 -fsyntax-only %s -verify
void a() {goto A; // expected-error {{use of undeclared label}}
// expected-error {{expected '}'}}
diff --git a/test/Sema/redefinition.c b/test/Sema/redefinition.c
index 9339bb935f6c..1092b33ca35d 100644
--- a/test/Sema/redefinition.c
+++ b/test/Sema/redefinition.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
int f(int a) { return 0; } // expected-note {{previous definition is here}}
int f(int);
int f(int a) { return 0; } // expected-error {{redefinition of 'f'}}
diff --git a/test/Sema/return-noreturn.c b/test/Sema/return-noreturn.c
index 8868c9ee0aeb..198ab11c6760 100644
--- a/test/Sema/return-noreturn.c
+++ b/test/Sema/return-noreturn.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify -fblocks -Wmissing-noreturn
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks -Wmissing-noreturn
int j;
void test1() { // expected-warning {{function could be attribute 'noreturn'}}
diff --git a/test/Sema/return-silent.c b/test/Sema/return-silent.c
index b3b2a5621819..eb9641b7f3be 100644
--- a/test/Sema/return-silent.c
+++ b/test/Sema/return-silent.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -Wno-return-type -fsyntax-only -verify
+// RUN: %clang_cc1 %s -Wno-return-type -fsyntax-only -verify
int t14() {
return;
diff --git a/test/Sema/return.c b/test/Sema/return.c
index 2e8120a7542e..17d21789f05a 100644
--- a/test/Sema/return.c
+++ b/test/Sema/return.c
@@ -1,4 +1,4 @@
-// RUN: clang %s -fsyntax-only -Xclang -verify -fblocks
+// RUN: %clang %s -fsyntax-only -Xclang -verify -fblocks
// clang emits the following warning by default.
// With GCC, -pedantic, -Wreturn-type or -Wall are required to produce the
@@ -222,7 +222,3 @@ void test32() {
void test33() {
if (j) while (1) { }
}
-
-int test34() {
- asm("nop");
-}
diff --git a/test/Sema/scope-check.c b/test/Sema/scope-check.c
index 76041c491653..4d3f6cbcf2b8 100644
--- a/test/Sema/scope-check.c
+++ b/test/Sema/scope-check.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -fblocks -std=gnu99 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=gnu99 %s
int test1(int x) {
goto L; // expected-error{{illegal goto into protected scope}}
diff --git a/test/Sema/self-comparison.c b/test/Sema/self-comparison.c
index db56e8bf17d8..b2b06c209a61 100644
--- a/test/Sema/self-comparison.c
+++ b/test/Sema/self-comparison.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int foo(int x) {
return x == x; // expected-warning {{self-comparison always results}}
diff --git a/test/Sema/sentinel-attribute.c b/test/Sema/sentinel-attribute.c
index c40f8df29c33..4c0927396763 100644
--- a/test/Sema/sentinel-attribute.c
+++ b/test/Sema/sentinel-attribute.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int x __attribute__((sentinel)); //expected-warning{{'sentinel' attribute only applies to function, method or block types}}
void f1(int a, ...) __attribute__ ((sentinel));
diff --git a/test/Sema/shift.c b/test/Sema/shift.c
index fdfebc589a77..558a7d20065a 100644
--- a/test/Sema/shift.c
+++ b/test/Sema/shift.c
@@ -1,4 +1,4 @@
-// RUN: clang -Wall -fsyntax-only -Xclang -verify %s
+// RUN: %clang -Wall -fsyntax-only -Xclang -verify %s
#include <limits.h>
diff --git a/test/Sema/statements.c b/test/Sema/statements.c
index 8eac052a25c7..3cd2460e79d9 100644
--- a/test/Sema/statements.c
+++ b/test/Sema/statements.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
typedef unsigned __uint32_t;
diff --git a/test/Sema/static-init.c b/test/Sema/static-init.c
index 510f3ab099af..8011943755c0 100644
--- a/test/Sema/static-init.c
+++ b/test/Sema/static-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -fsyntax-only -verify %s
#include <stdint.h>
diff --git a/test/Sema/stdcall-fastcall.c b/test/Sema/stdcall-fastcall.c
index e0db63822fb3..c45f93e07c05 100644
--- a/test/Sema/stdcall-fastcall.c
+++ b/test/Sema/stdcall-fastcall.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// CC qualifier can be applied only to functions
int __attribute__((stdcall)) var1; // expected-warning{{'stdcall' attribute only applies to function types}}
diff --git a/test/Sema/struct-cast.c b/test/Sema/struct-cast.c
index 063e8e32c02d..dc7db130dc19 100644
--- a/test/Sema/struct-cast.c
+++ b/test/Sema/struct-cast.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify
+// RUN: %clang_cc1 -fsyntax-only %s -verify
struct S {
int one;
diff --git a/test/Sema/struct-compat.c b/test/Sema/struct-compat.c
index 35d8fb1aa0c2..2e112e17dade 100644
--- a/test/Sema/struct-compat.c
+++ b/test/Sema/struct-compat.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc %s -fsyntax-only -pedantic -verify
+/* RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify
*/
extern struct {int a;} x; // expected-note {{previous definition is here}}
diff --git a/test/Sema/struct-decl.c b/test/Sema/struct-decl.c
index a5a299bf09b2..f8880530f950 100644
--- a/test/Sema/struct-decl.c
+++ b/test/Sema/struct-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR3459
struct bar {
char n[1];
diff --git a/test/Sema/struct-packed-align.c b/test/Sema/struct-packed-align.c
index 8250c14d4420..60a9febafbad 100644
--- a/test/Sema/struct-packed-align.c
+++ b/test/Sema/struct-packed-align.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// Packed structs.
struct s {
diff --git a/test/Sema/surpress-deprecated.c b/test/Sema/surpress-deprecated.c
index 8dbe9dd36581..78faf22328a4 100644
--- a/test/Sema/surpress-deprecated.c
+++ b/test/Sema/surpress-deprecated.c
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -Wno-deprecated-declarations -verify %s
+// RUN: %clang -fsyntax-only -Wno-deprecated-declarations -verify %s
extern void OldFunction() __attribute__((deprecated));
int main (int argc, const char * argv[]) {
diff --git a/test/Sema/switch.c b/test/Sema/switch.c
index 3ee371202f91..f815ba4627f9 100644
--- a/test/Sema/switch.c
+++ b/test/Sema/switch.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f (int z) {
while (z) {
default: z--; // expected-error {{statement not in switch}}
diff --git a/test/Sema/tentative-decls.c b/test/Sema/tentative-decls.c
index c94af1160b89..b15537bfa0cd 100644
--- a/test/Sema/tentative-decls.c
+++ b/test/Sema/tentative-decls.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// PR3310
struct a x1; // expected-note 2{{forward declaration of 'struct a'}}
diff --git a/test/Sema/text-diag.c b/test/Sema/text-diag.c
index 19847c6d1e91..6dcaaa87a9a6 100644
--- a/test/Sema/text-diag.c
+++ b/test/Sema/text-diag.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
unsigned char *foo = "texto\
que continua\
e continua";
diff --git a/test/Sema/thread-specifier.c b/test/Sema/thread-specifier.c
index 8d66e539c875..ed27c7063df7 100644
--- a/test/Sema/thread-specifier.c
+++ b/test/Sema/thread-specifier.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i686-pc-linux-gnu -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify %s
__thread int t1;
__thread extern int t2;
diff --git a/test/Sema/transparent-union-pointer.c b/test/Sema/transparent-union-pointer.c
index a58bd42f821f..31c93914b819 100644
--- a/test/Sema/transparent-union-pointer.c
+++ b/test/Sema/transparent-union-pointer.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
typedef union {
union wait *__uptr;
diff --git a/test/Sema/transparent-union.c b/test/Sema/transparent-union.c
index 90ecaadea6e7..03f6a53d059a 100644
--- a/test/Sema/transparent-union.c
+++ b/test/Sema/transparent-union.c
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -Xclang -verify %s
+// RUN: %clang -fsyntax-only -Xclang -verify %s
typedef union {
int *ip;
float *fp;
diff --git a/test/Sema/type-spec-struct-union.c b/test/Sema/type-spec-struct-union.c
index 003efb14620b..ce65095873ef 100644
--- a/test/Sema/type-spec-struct-union.c
+++ b/test/Sema/type-spec-struct-union.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
/* This test checks the introduction of struct and union types based
on a type specifier of the form "struct-or-union identifier" when they
diff --git a/test/Sema/typecheck-binop.c b/test/Sema/typecheck-binop.c
index f5bdcbb70e83..712dad279db5 100644
--- a/test/Sema/typecheck-binop.c
+++ b/test/Sema/typecheck-binop.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc %s -fsyntax-only -pedantic -verify
+/* RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify
*/
struct incomplete; // expected-note{{forward declaration of 'struct incomplete'}}
diff --git a/test/Sema/typedef-prototype.c b/test/Sema/typedef-prototype.c
index fc0e05ead292..8372154ce0ef 100644
--- a/test/Sema/typedef-prototype.c
+++ b/test/Sema/typedef-prototype.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef int unary_int_func(int arg);
unary_int_func add_one;
diff --git a/test/Sema/typedef-redef.c b/test/Sema/typedef-redef.c
index 9a1c48873242..025f65cb35a5 100644
--- a/test/Sema/typedef-redef.c
+++ b/test/Sema/typedef-redef.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef const int x; // expected-note {{previous definition is here}}
extern x a;
diff --git a/test/Sema/typedef-retain.c b/test/Sema/typedef-retain.c
index ef9ec76f467b..0ef15fdec6cd 100644
--- a/test/Sema/typedef-retain.c
+++ b/test/Sema/typedef-retain.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -fno-lax-vector-conversions
+// RUN: %clang_cc1 -fsyntax-only -verify %s -fno-lax-vector-conversions
typedef float float4 __attribute__((vector_size(16)));
typedef int int4 __attribute__((vector_size(16)));
diff --git a/test/Sema/typedef-variable-type.c b/test/Sema/typedef-variable-type.c
index 7a9bb4879bc2..f29896850b1b 100644
--- a/test/Sema/typedef-variable-type.c
+++ b/test/Sema/typedef-variable-type.c
@@ -1,3 +1,3 @@
-// RUN: clang-cc %s -verify -fsyntax-only -pedantic
+// RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic
typedef int (*a)[!.0]; // expected-warning{{size of static array must be an integer constant expression}}
diff --git a/test/Sema/types.c b/test/Sema/types.c
index e7d4b00a4d2a..1770bf5bd03e 100644
--- a/test/Sema/types.c
+++ b/test/Sema/types.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -pedantic -verify -triple=x86_64-apple-darwin9
+// RUN: %clang_cc1 %s -pedantic -verify -triple=x86_64-apple-darwin9
// rdar://6097662
typedef int (*T)[2];
diff --git a/test/Sema/ucn-cstring.c b/test/Sema/ucn-cstring.c
index fb9a3b604eb7..f5bf457ed144 100644
--- a/test/Sema/ucn-cstring.c
+++ b/test/Sema/ucn-cstring.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only -pedantic
+// RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic
int printf(const char *, ...);
diff --git a/test/Sema/unnamed-bitfield-init.c b/test/Sema/unnamed-bitfield-init.c
index 249f06e07d94..f3cc49c34bf2 100644
--- a/test/Sema/unnamed-bitfield-init.c
+++ b/test/Sema/unnamed-bitfield-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct {
int a; int : 24; char b;
} S;
diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c
index 522fda42a169..f5c64e6715cd 100644
--- a/test/Sema/unused-expr.c
+++ b/test/Sema/unused-expr.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -fno-math-errno %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fno-math-errno %s
int foo(int X, int Y);
@@ -87,12 +87,20 @@ int fn3() __attribute__ ((const));
int t6() {
if (fn1() < 0 || fn2(2,1) < 0 || fn3(2) < 0) // no warnings
return -1;
-
+
fn1(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
fn2(92, 21); // expected-warning {{ignoring return value of function declared with pure attribute}}
fn3(42); // expected-warning {{ignoring return value of function declared with const attribute}}
+ __builtin_fabsf(0); // expected-warning {{ignoring return value of function declared with const attribute}}
return 0;
}
-int t7 __attribute__ ((warn_unused_result)); // expected-warning {{warning: 'warn_unused_result' attribute only applies to function types}}
+int t7 __attribute__ ((warn_unused_result)); // expected-warning {{'warn_unused_result' attribute only applies to function types}}
+
+// PR4010
+int (*fn4)(void) __attribute__ ((warn_unused_result));
+void t8() {
+ fn4(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
+}
+void t9() __attribute__((warn_unused_result)); // expected-warning {{attribute 'warn_unused_result' cannot be applied to functions without return value}}
diff --git a/test/Sema/usual-float.c b/test/Sema/usual-float.c
index 40c0bde4e0cf..5a9ab344ce36 100644
--- a/test/Sema/usual-float.c
+++ b/test/Sema/usual-float.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only
+// RUN: %clang_cc1 %s -fsyntax-only
typedef float CGFloat;
diff --git a/test/Sema/va_arg_x86_32.c b/test/Sema/va_arg_x86_32.c
index 850d324dbfc9..e49f0a42ccf9 100644
--- a/test/Sema/va_arg_x86_32.c
+++ b/test/Sema/va_arg_x86_32.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -triple=i686-pc-linux-gnu %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple=i686-pc-linux-gnu %s
int a() {
__builtin_va_arg((char*)0, int); // expected-error {{expression is not assignable}}
diff --git a/test/Sema/va_arg_x86_64.c b/test/Sema/va_arg_x86_64.c
index 61ac97b7d451..9f514c1f59e4 100644
--- a/test/Sema/va_arg_x86_64.c
+++ b/test/Sema/va_arg_x86_64.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -triple=x86_64-unknown-freebsd7.0 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple=x86_64-unknown-freebsd7.0 %s
// PR2631
char* foo(char *fmt, __builtin_va_list ap)
diff --git a/test/Sema/var-redecl.c b/test/Sema/var-redecl.c
index 129fd17cd533..e67499bcc4c9 100644
--- a/test/Sema/var-redecl.c
+++ b/test/Sema/var-redecl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int outer1; // expected-note{{previous definition is here}}
extern int outer2; // expected-note{{previous definition is here}}
@@ -53,7 +53,8 @@ void outer_shadowing_test() {
void g18(void) {
extern int g19;
}
-int *p=&g19; // expected-error{{use of undeclared identifier 'g19'}}
+int *p=&g19; // expected-error{{use of undeclared identifier 'g19'}} \
+ // expected-warning{{incompatible pointer types}}
// PR3645
static int a;
diff --git a/test/Sema/varargs-x86-64.c b/test/Sema/varargs-x86-64.c
index 7c71c9673891..2cfedc1b37e7 100644
--- a/test/Sema/varargs-x86-64.c
+++ b/test/Sema/varargs-x86-64.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -triple x86_64-apple-darwin9
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-apple-darwin9
// rdar://6726818
void f1() {
diff --git a/test/Sema/varargs.c b/test/Sema/varargs.c
index e928997dd8ba..e399f89ae0aa 100644
--- a/test/Sema/varargs.c
+++ b/test/Sema/varargs.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -fsyntax-only -verify %s
-// RUN: clang-cc -fsyntax-only -verify %s -triple x86_64-apple-darwin9
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-apple-darwin9
void f1(int a)
{
diff --git a/test/Sema/variadic-block.c b/test/Sema/variadic-block.c
index 29f597b00672..ba4bb71c9750 100644
--- a/test/Sema/variadic-block.c
+++ b/test/Sema/variadic-block.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only -fblocks
+// RUN: %clang_cc1 %s -verify -fsyntax-only -fblocks
#include <stdarg.h>
diff --git a/test/Sema/vector-assign.c b/test/Sema/vector-assign.c
index bf9c7f37ca6d..d074a958fa0f 100644
--- a/test/Sema/vector-assign.c
+++ b/test/Sema/vector-assign.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only -Wvector-conversions
+// RUN: %clang_cc1 %s -verify -fsyntax-only -Wvector-conversions
typedef unsigned int v2u __attribute__ ((vector_size (8)));
typedef signed int v2s __attribute__ ((vector_size (8)));
typedef signed int v1s __attribute__ ((vector_size (4)));
diff --git a/test/Sema/vector-cast.c b/test/Sema/vector-cast.c
index 8c607aad073e..aab0ab4775ab 100644
--- a/test/Sema/vector-cast.c
+++ b/test/Sema/vector-cast.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify -Wvector-conversions
+// RUN: %clang_cc1 -fsyntax-only %s -verify -Wvector-conversions
typedef long long t1 __attribute__ ((vector_size (8)));
typedef char t2 __attribute__ ((vector_size (16)));
diff --git a/test/Sema/vector-init.c b/test/Sema/vector-init.c
index 1eec6c57a68c..8f81adc05ba3 100644
--- a/test/Sema/vector-init.c
+++ b/test/Sema/vector-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
//typedef __attribute__(( ext_vector_type(4) )) float float4;
typedef float float4 __attribute__((vector_size(16)));
diff --git a/test/Sema/vfprintf-invalid-redecl.c b/test/Sema/vfprintf-invalid-redecl.c
index 02c5061d8cd5..cbf47a69a9a1 100644
--- a/test/Sema/vfprintf-invalid-redecl.c
+++ b/test/Sema/vfprintf-invalid-redecl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// PR4290
// The following declaration is not compatible with vfprintf(), but make
diff --git a/test/Sema/vfprintf-valid-redecl.c b/test/Sema/vfprintf-valid-redecl.c
index cc8e2c40d30b..14fbbc47ddbc 100644
--- a/test/Sema/vfprintf-valid-redecl.c
+++ b/test/Sema/vfprintf-valid-redecl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -pedantic -verify
+// RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify
// PR4290
// The following declaration is compatible with vfprintf, so we shouldn't
diff --git a/test/Sema/vla.c b/test/Sema/vla.c
index 70ba08b7eb0a..7ddd432fbc0f 100644
--- a/test/Sema/vla.c
+++ b/test/Sema/vla.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only -pedantic
+// RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic
int test1() {
typedef int x[test1()]; // vla
diff --git a/test/Sema/void_arg.c b/test/Sema/void_arg.c
index 6799146a5ff9..337972fd149b 100644
--- a/test/Sema/void_arg.c
+++ b/test/Sema/void_arg.c
@@ -1,4 +1,4 @@
-/* RUN: clang-cc -fsyntax-only %s -verify
+/* RUN: %clang_cc1 -fsyntax-only %s -verify
*/
typedef void Void;
diff --git a/test/Sema/warn-char-subscripts.c b/test/Sema/warn-char-subscripts.c
index c6fd78cc1f74..374a609e81f7 100644
--- a/test/Sema/warn-char-subscripts.c
+++ b/test/Sema/warn-char-subscripts.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -Wchar-subscripts -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wchar-subscripts -fsyntax-only -verify %s
void t1() {
int array[1] = { 0 };
diff --git a/test/Sema/warn-freestanding-complex.c b/test/Sema/warn-freestanding-complex.c
index a4d3f5be3189..14e063f83c1b 100644
--- a/test/Sema/warn-freestanding-complex.c
+++ b/test/Sema/warn-freestanding-complex.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -ffreestanding -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -ffreestanding -pedantic -verify %s
void foo(float _Complex c) { // expected-warning{{complex numbers are an extension in a freestanding C99 implementation}}
}
diff --git a/test/Sema/warn-missing-prototypes.c b/test/Sema/warn-missing-prototypes.c
index 299d8a726585..bfd1459b41d0 100644
--- a/test/Sema/warn-missing-prototypes.c
+++ b/test/Sema/warn-missing-prototypes.c
@@ -1,4 +1,4 @@
-// RUN: clang -Wmissing-prototypes -fsyntax-only -Xclang -verify %s
+// RUN: %clang -Wmissing-prototypes -fsyntax-only -Xclang -verify %s
int f();
diff --git a/test/Sema/warn-unused-parameters.c b/test/Sema/warn-unused-parameters.c
index afb95166cbce..c6458cf9712b 100644
--- a/test/Sema/warn-unused-parameters.c
+++ b/test/Sema/warn-unused-parameters.c
@@ -1,4 +1,4 @@
-// RUN: clang -fblocks -fsyntax-only -Wunused-parameter %s -Xclang -verify
+// RUN: %clang -fblocks -fsyntax-only -Wunused-parameter %s -Xclang -verify
int f0(int x,
int y, // expected-warning{{unused}}
diff --git a/test/Sema/warn-unused-variables.c b/test/Sema/warn-unused-variables.c
index fd225436be82..36615061fe6f 100644
--- a/test/Sema/warn-unused-variables.c
+++ b/test/Sema/warn-unused-variables.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -Wunused-variable -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
struct s0 {
unsigned int i;
diff --git a/test/Sema/wchar.c b/test/Sema/wchar.c
index ed6649a31d98..28ec2f14ceb7 100644
--- a/test/Sema/wchar.c
+++ b/test/Sema/wchar.c
@@ -1,5 +1,5 @@
-// RUN: clang %s -fsyntax-only -Xclang -verify
-// RUN: clang %s -fsyntax-only -fshort-wchar -Xclang -verify -DSHORT_WCHAR
+// RUN: %clang %s -fsyntax-only -Xclang -verify
+// RUN: %clang %s -fsyntax-only -fshort-wchar -Xclang -verify -DSHORT_WCHAR
typedef __WCHAR_TYPE__ wchar_t;
@@ -17,6 +17,6 @@ int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1];
void foo() {
WCHAR_T_TYPE t1[] = L"x";
wchar_t tab[] = L"x";
- WCHAR_T_TYPE t2[] = "x"; // expected-error {{initialization}}
- char t3[] = L"x"; // expected-error {{initialization}}
+ WCHAR_T_TYPE t2[] = "x"; // expected-error {{initializer}}
+ char t3[] = L"x"; // expected-error {{initializer}}
}
diff --git a/test/Sema/x86-intrinsics-headers.c b/test/Sema/x86-intrinsics-headers.c
index 5b43e2bd07a4..006716ef5ba4 100644
--- a/test/Sema/x86-intrinsics-headers.c
+++ b/test/Sema/x86-intrinsics-headers.c
@@ -1,6 +1,6 @@
-// RUN: clang -fsyntax-only %s
-// RUN: clang -fsyntax-only -fno-lax-vector-conversions %s
-// RUN: clang -fsyntax-only -x c++ %s
+// RUN: %clang -fsyntax-only %s
+// RUN: %clang -fsyntax-only -fno-lax-vector-conversions %s
+// RUN: %clang -fsyntax-only -x c++ %s
#if defined(i386) || defined(__x86_64__)
diff --git a/test/SemaCXX/PR5086-ambig-resolution-enum.cpp b/test/SemaCXX/PR5086-ambig-resolution-enum.cpp
index 838bc6f3c716..720566a69b05 100644
--- a/test/SemaCXX/PR5086-ambig-resolution-enum.cpp
+++ b/test/SemaCXX/PR5086-ambig-resolution-enum.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
class C {
public:
diff --git a/test/SemaCXX/__null.cpp b/test/SemaCXX/__null.cpp
index cf7851444092..3583655134a7 100644
--- a/test/SemaCXX/__null.cpp
+++ b/test/SemaCXX/__null.cpp
@@ -1,5 +1,5 @@
-// RUN: clang-cc -triple x86_64-unknown-unknown %s -fsyntax-only -verify
-// RUN: clang-cc -triple i686-unknown-unknown %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple i686-unknown-unknown %s -fsyntax-only -verify
void f() {
int* i = __null;
diff --git a/test/SemaCXX/abstract.cpp b/test/SemaCXX/abstract.cpp
index 3db607a365c0..0ae6c446f3da 100644
--- a/test/SemaCXX/abstract.cpp
+++ b/test/SemaCXX/abstract.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define __CONCAT(__X, __Y) __CONCAT1(__X, __Y)
@@ -155,3 +155,17 @@ namespace PR5550 {
};
C x;
}
+
+namespace PureImplicit {
+ // A pure virtual destructor should be implicitly overridden.
+ struct A { virtual ~A() = 0; };
+ struct B : A {};
+ B x;
+
+ // A pure virtual assignment operator should be implicitly overridden.
+ struct D;
+ struct C { virtual D& operator=(const D&) = 0; };
+ struct D : C {};
+ D y;
+}
+
diff --git a/test/SemaCXX/access-base-class.cpp b/test/SemaCXX/access-base-class.cpp
index 4a9ee51dbfb5..f4c58d940b63 100644
--- a/test/SemaCXX/access-base-class.cpp
+++ b/test/SemaCXX/access-base-class.cpp
@@ -1,12 +1,11 @@
-// RUN: clang-cc -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
namespace T1 {
class A { };
class B : private A { }; // expected-note {{'private' inheritance specifier here}}
void f(B* b) {
- A *a = b; // expected-error{{conversion from 'class T1::B' to inaccessible base class 'class T1::A'}} \
- expected-error{{incompatible type initializing 'class T1::B *', expected 'class T1::A *'}}
+ A *a = b; // expected-error{{conversion from 'class T1::B' to inaccessible base class 'class T1::A'}}
}
}
@@ -17,8 +16,7 @@ class A { };
class B : A { }; // expected-note {{inheritance is implicitly 'private'}}
void f(B* b) {
- A *a = b; // expected-error {{conversion from 'class T2::B' to inaccessible base class 'class T2::A'}} \
- expected-error {{incompatible type initializing 'class T2::B *', expected 'class T2::A *'}}
+ A *a = b; // expected-error {{conversion from 'class T2::B' to inaccessible base class 'class T2::A'}}
}
}
@@ -71,8 +69,7 @@ namespace T6 {
class C : public B {
void f(C *c) {
- A* a = c; // expected-error {{conversion from 'class T6::C' to inaccessible base class 'class T6::A'}} \
- expected-error {{incompatible type initializing 'class T6::C *', expected 'class T6::A *'}}
+ A* a = c; // expected-error {{conversion from 'class T6::C' to inaccessible base class 'class T6::A'}}
}
};
diff --git a/test/SemaCXX/access-control-check.cpp b/test/SemaCXX/access-control-check.cpp
index fb124a932a12..e6e261c1a89f 100644
--- a/test/SemaCXX/access-control-check.cpp
+++ b/test/SemaCXX/access-control-check.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
class M {
int iM;
diff --git a/test/SemaCXX/access.cpp b/test/SemaCXX/access.cpp
index cfbc9c80692b..6115ff6a94f4 100644
--- a/test/SemaCXX/access.cpp
+++ b/test/SemaCXX/access.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class C {
struct S; // expected-note {{previously declared 'private' here}}
@@ -21,3 +21,14 @@ protected:
private:
template<typename T> struct A {}; // expected-error {{'A' redeclared with 'private' access}}
};
+
+// PR5573
+namespace test1 {
+ class A {
+ private:
+ class X; // expected-note {{previously declared 'private' here}}
+ public:
+ class X; // expected-error {{ 'X' redeclared with 'public' access}}
+ class X {};
+ };
+}
diff --git a/test/SemaCXX/addr-of-overloaded-function.cpp b/test/SemaCXX/addr-of-overloaded-function.cpp
index 80ea02bafd41..3b06119393d0 100644
--- a/test/SemaCXX/addr-of-overloaded-function.cpp
+++ b/test/SemaCXX/addr-of-overloaded-function.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int f(double);
int f(int);
@@ -9,7 +9,7 @@ int (*pfi)(int) = &f; // selects f(int)
// FIXME: This error message is not very good. We need to keep better
// track of what went wrong when the implicit conversion failed to
// give a better error message here.
-int (*pfe)(...) = &f; // expected-error{{incompatible type initializing '<overloaded function type>', expected 'int (*)(...)'}}
+int (*pfe)(...) = &f; // expected-error{{cannot initialize a variable of type 'int (*)(...)' with an rvalue of type '<overloaded function type>'}}
int (&rfi)(int) = f; // selects f(int)
int (&rfd)(double) = f; // selects f(double)
diff --git a/test/SemaCXX/address-of.cpp b/test/SemaCXX/address-of.cpp
index 4e436d6e98b2..a7e712b04c1d 100644
--- a/test/SemaCXX/address-of.cpp
+++ b/test/SemaCXX/address-of.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR clang/3175
void bar(int*);
diff --git a/test/SemaCXX/aggregate-initialization.cpp b/test/SemaCXX/aggregate-initialization.cpp
index c96eda448032..255b3529823e 100644
--- a/test/SemaCXX/aggregate-initialization.cpp
+++ b/test/SemaCXX/aggregate-initialization.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
// Verify that we can't initialize non-aggregates with an initializer
// list.
@@ -22,7 +22,7 @@ struct NonAggr4 {
virtual void f();
};
-NonAggr1 na1 = { 17 }; // expected-error{{initialization of non-aggregate type 'struct NonAggr1' with an initializer list}}
-NonAggr2 na2 = { 17 }; // expected-error{{initialization of non-aggregate type 'struct NonAggr2' with an initializer list}}
-NonAggr3 na3 = { 17 }; // expected-error{{initialization of non-aggregate type 'class NonAggr3' with an initializer list}}
-NonAggr4 na4 = { 17 }; // expected-error{{initialization of non-aggregate type 'struct NonAggr4' with an initializer list}}
+NonAggr1 na1 = { 17 }; // expected-error{{non-aggregate type 'struct NonAggr1' cannot be initialized with an initializer list}}
+NonAggr2 na2 = { 17 }; // expected-error{{non-aggregate type 'struct NonAggr2' cannot be initialized with an initializer list}}
+NonAggr3 na3 = { 17 }; // expected-error{{non-aggregate type 'class NonAggr3' cannot be initialized with an initializer list}}
+NonAggr4 na4 = { 17 }; // expected-error{{non-aggregate type 'struct NonAggr4' cannot be initialized with an initializer list}}
diff --git a/test/SemaCXX/alignof-sizeof-reference.cpp b/test/SemaCXX/alignof-sizeof-reference.cpp
index 27d98ab6491e..f02282d72d30 100644
--- a/test/SemaCXX/alignof-sizeof-reference.cpp
+++ b/test/SemaCXX/alignof-sizeof-reference.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
struct s0; // expected-note {{forward declaration}}
char ar[sizeof(s0&)]; // expected-error {{invalid application of 'sizeof' to an incomplete type}}
diff --git a/test/SemaCXX/ambig-user-defined-conversions.cpp b/test/SemaCXX/ambig-user-defined-conversions.cpp
index 94598f0e8ef2..0820bc93c39f 100644
--- a/test/SemaCXX/ambig-user-defined-conversions.cpp
+++ b/test/SemaCXX/ambig-user-defined-conversions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Test1
struct BASE {
diff --git a/test/SemaCXX/ambiguous-builtin-unary-operator.cpp b/test/SemaCXX/ambiguous-builtin-unary-operator.cpp
index 5affd19a2fdf..1aa09a6827a0 100644
--- a/test/SemaCXX/ambiguous-builtin-unary-operator.cpp
+++ b/test/SemaCXX/ambiguous-builtin-unary-operator.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
struct A {
operator int&();
diff --git a/test/SemaCXX/anonymous-union.cpp b/test/SemaCXX/anonymous-union.cpp
index f77fa03328f6..374241c9e4e6 100644
--- a/test/SemaCXX/anonymous-union.cpp
+++ b/test/SemaCXX/anonymous-union.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X {
union {
float f3;
diff --git a/test/SemaCXX/array-bound-merge.cpp b/test/SemaCXX/array-bound-merge.cpp
index 579c7933684d..74f58fa12360 100644
--- a/test/SemaCXX/array-bound-merge.cpp
+++ b/test/SemaCXX/array-bound-merge.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR5515
extern int a[];
diff --git a/test/SemaCXX/arrow-operator.cpp b/test/SemaCXX/arrow-operator.cpp
index 08b3cd4cc716..fd1ec0120a71 100644
--- a/test/SemaCXX/arrow-operator.cpp
+++ b/test/SemaCXX/arrow-operator.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct T {
void f();
};
diff --git a/test/SemaCXX/attr-after-definition.cpp b/test/SemaCXX/attr-after-definition.cpp
index 2ef5acfbc0f1..148a63e4d6c1 100644
--- a/test/SemaCXX/attr-after-definition.cpp
+++ b/test/SemaCXX/attr-after-definition.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X { };
struct Y { };
diff --git a/test/SemaCXX/attr-cxx0x.cpp b/test/SemaCXX/attr-cxx0x.cpp
index d68779cc8886..9924d1bc5707 100644
--- a/test/SemaCXX/attr-cxx0x.cpp
+++ b/test/SemaCXX/attr-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
int final_fail [[final]]; //expected-error {{'final' attribute only applies to virtual method or class types}}
diff --git a/test/SemaCXX/attr-deprecated.cpp b/test/SemaCXX/attr-deprecated.cpp
index 54f8b5b57fcd..d5662d3f6313 100644
--- a/test/SemaCXX/attr-deprecated.cpp
+++ b/test/SemaCXX/attr-deprecated.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
class A {
void f() __attribute__((deprecated));
void g(A* a);
diff --git a/test/SemaCXX/attr-format.cpp b/test/SemaCXX/attr-format.cpp
index 369099a84800..0c1eb53ea07f 100644
--- a/test/SemaCXX/attr-format.cpp
+++ b/test/SemaCXX/attr-format.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct S {
static void f(const char*, ...) __attribute__((format(printf, 1, 2)));
diff --git a/test/SemaCXX/attr-noreturn.cpp b/test/SemaCXX/attr-noreturn.cpp
index e4fdc08ae9e7..b7d39992b8fb 100644
--- a/test/SemaCXX/attr-noreturn.cpp
+++ b/test/SemaCXX/attr-noreturn.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR5620
void f0() __attribute__((__noreturn__));
@@ -28,3 +28,12 @@ void test_f3() {
f3(f0); // okay
f3(f2); // expected-error{{no matching function for call}}
}
+
+
+class xpto {
+ int blah() __attribute__((noreturn));
+};
+
+int xpto::blah() {
+ return 3; // expected-warning {{function 'blah' declared 'noreturn' should not return}}
+}
diff --git a/test/SemaCXX/attr-sentinel.cpp b/test/SemaCXX/attr-sentinel.cpp
index 0293a5dce00c..56c8f881600b 100644
--- a/test/SemaCXX/attr-sentinel.cpp
+++ b/test/SemaCXX/attr-sentinel.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f(int, ...) __attribute__((sentinel));
void g() {
diff --git a/test/SemaCXX/attr-unavailable.cpp b/test/SemaCXX/attr-unavailable.cpp
index 8e5f76bcacfa..bebd4cb18e5d 100644
--- a/test/SemaCXX/attr-unavailable.cpp
+++ b/test/SemaCXX/attr-unavailable.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int &foo(int);
double &foo(double);
diff --git a/test/SemaCXX/auto-cxx0x.cpp b/test/SemaCXX/auto-cxx0x.cpp
index aa92bbe4f1f1..654acb5ad20c 100644
--- a/test/SemaCXX/auto-cxx0x.cpp
+++ b/test/SemaCXX/auto-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
void f() {
auto int a; // expected-error{{cannot combine with previous 'auto' declaration specifier}} // expected-error{{declaration of variable 'a' with type 'auto' requires an initializer}}
int auto b; // expected-error{{cannot combine with previous 'int' declaration specifier}}
diff --git a/test/SemaCXX/auto-cxx98.cpp b/test/SemaCXX/auto-cxx98.cpp
index 14670cd69942..fe028114880a 100644
--- a/test/SemaCXX/auto-cxx98.cpp
+++ b/test/SemaCXX/auto-cxx98.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++98
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98
void f() {
auto int a;
int auto b;
diff --git a/test/SemaCXX/blocks.cpp b/test/SemaCXX/blocks.cpp
index 9d789bb3252a..94295437e161 100644
--- a/test/SemaCXX/blocks.cpp
+++ b/test/SemaCXX/blocks.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -fblocks
+// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
void tovoid(void*);
diff --git a/test/SemaCXX/bool.cpp b/test/SemaCXX/bool.cpp
index 259c09c6cb83..44e17ce62b79 100644
--- a/test/SemaCXX/bool.cpp
+++ b/test/SemaCXX/bool.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Bool literals can be enum values.
enum {
@@ -14,7 +14,7 @@ void test(bool b)
--b; // expected-error {{cannot decrement expression of type bool}}
b--; // expected-error {{cannot decrement expression of type bool}}
- bool *b1 = (int *)0; // expected-error{{expected 'bool *'}}
+ bool *b1 = (int *)0; // expected-error{{cannot initialize}}
}
// static_assert_arg_is_bool(x) compiles only if x is a bool.
diff --git a/test/SemaCXX/builtin-ptrtomember-ambig.cpp b/test/SemaCXX/builtin-ptrtomember-ambig.cpp
index 1b52651910d9..3e0dfbb48eda 100644
--- a/test/SemaCXX/builtin-ptrtomember-ambig.cpp
+++ b/test/SemaCXX/builtin-ptrtomember-ambig.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
struct A {};
diff --git a/test/SemaCXX/builtin-ptrtomember-overload-1.cpp b/test/SemaCXX/builtin-ptrtomember-overload-1.cpp
index 27ca6dc77897..137503b2a4e0 100644
--- a/test/SemaCXX/builtin-ptrtomember-overload-1.cpp
+++ b/test/SemaCXX/builtin-ptrtomember-overload-1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
struct A {};
struct E {};
diff --git a/test/SemaCXX/builtin-ptrtomember-overload.cpp b/test/SemaCXX/builtin-ptrtomember-overload.cpp
index ed52d47f2cda..6c132366199b 100644
--- a/test/SemaCXX/builtin-ptrtomember-overload.cpp
+++ b/test/SemaCXX/builtin-ptrtomember-overload.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
struct A {};
diff --git a/test/SemaCXX/builtins.cpp b/test/SemaCXX/builtins.cpp
index 9e9d1522f4f6..a75b4f2e403a 100644
--- a/test/SemaCXX/builtins.cpp
+++ b/test/SemaCXX/builtins.cpp
@@ -1,7 +1,7 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
typedef const struct __CFString * CFStringRef;
#define CFSTR __builtin___CFStringMakeConstantString
void f() {
(void)CFStringRef(CFSTR("Hello"));
-} \ No newline at end of file
+}
diff --git a/test/SemaCXX/c99.cpp b/test/SemaCXX/c99.cpp
index b0ee056ef379..f4c3639e16a9 100644
--- a/test/SemaCXX/c99.cpp
+++ b/test/SemaCXX/c99.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f0(int i) {
char array[i]; // expected-error{{variable length arrays}}
diff --git a/test/SemaCXX/cast-conversion.cpp b/test/SemaCXX/cast-conversion.cpp
index 3b6a9d6f8c49..77f4a528906d 100644
--- a/test/SemaCXX/cast-conversion.cpp
+++ b/test/SemaCXX/cast-conversion.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
struct R {
R(int);
diff --git a/test/SemaCXX/cast-explicit-ctor.cpp b/test/SemaCXX/cast-explicit-ctor.cpp
index 62134ae658db..0052856d2ff9 100644
--- a/test/SemaCXX/cast-explicit-ctor.cpp
+++ b/test/SemaCXX/cast-explicit-ctor.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct B { explicit B(bool); };
void f() {
(void)(B)true;
diff --git a/test/SemaCXX/class-base-member-init.cpp b/test/SemaCXX/class-base-member-init.cpp
index 2092847bc02d..67bc43c2e80b 100644
--- a/test/SemaCXX/class-base-member-init.cpp
+++ b/test/SemaCXX/class-base-member-init.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class S {
public:
diff --git a/test/SemaCXX/class-layout.cpp b/test/SemaCXX/class-layout.cpp
index b5971723a70d..2b8d1d3210b3 100644
--- a/test/SemaCXX/class-layout.cpp
+++ b/test/SemaCXX/class-layout.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-unknown-unknown %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify
#define SA(n, p) int a##n[(p) ? 1 : -1]
diff --git a/test/SemaCXX/class-names.cpp b/test/SemaCXX/class-names.cpp
index da9014574d2c..2962988bec5b 100644
--- a/test/SemaCXX/class-names.cpp
+++ b/test/SemaCXX/class-names.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class C { };
C c;
diff --git a/test/SemaCXX/class.cpp b/test/SemaCXX/class.cpp
index 2637f320207f..743983cd3461 100644
--- a/test/SemaCXX/class.cpp
+++ b/test/SemaCXX/class.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class C {
public:
auto int errx; // expected-error {{error: storage class specified for a member declaration}}
diff --git a/test/SemaCXX/compare.cpp b/test/SemaCXX/compare.cpp
index 7188678b74db..cd243e3d6b23 100644
--- a/test/SemaCXX/compare.cpp
+++ b/test/SemaCXX/compare.cpp
@@ -1,7 +1,7 @@
// Force x86-64 because some of our heuristics are actually based
// on integer sizes.
-// RUN: clang-cc -triple x86_64-apple-darwin -fsyntax-only -pedantic -verify -Wsign-compare %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -pedantic -verify -Wsign-compare %s
int test0(long a, unsigned long b) {
enum EnumA {A};
diff --git a/test/SemaCXX/complex-overload.cpp b/test/SemaCXX/complex-overload.cpp
index 55d3c76d0638..337875507245 100644
--- a/test/SemaCXX/complex-overload.cpp
+++ b/test/SemaCXX/complex-overload.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
char *foo(float); // expected-note 3 {{candidate function}}
void test_foo_1(float fv, double dv, float _Complex fc, double _Complex dc) {
diff --git a/test/SemaCXX/composite-pointer-type.cpp b/test/SemaCXX/composite-pointer-type.cpp
index 1eec525f4834..829e64f6c72e 100644
--- a/test/SemaCXX/composite-pointer-type.cpp
+++ b/test/SemaCXX/composite-pointer-type.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class Base { };
class Derived1 : public Base { };
diff --git a/test/SemaCXX/condition.cpp b/test/SemaCXX/condition.cpp
index b2645d4fe0fa..a0b57e1baa53 100644
--- a/test/SemaCXX/condition.cpp
+++ b/test/SemaCXX/condition.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void test() {
int x;
@@ -6,7 +6,7 @@ void test() {
if (int x=0) ++x;
typedef int arr[10];
- while (arr x=0) ; // expected-error {{an array type is not allowed here}} expected-error {{initialization with '{...}' expected for array}}
+ while (arr x=0) ; // expected-error {{an array type is not allowed here}} expected-error {{array initializer must be an initializer list}}
while (int f()=0) ; // expected-error {{a function type is not allowed here}}
struct S {} s;
@@ -16,9 +16,9 @@ void test() {
for (;s;) ; // expected-error {{value of type 'struct S' is not contextually convertible to 'bool'}}
switch (s) {} // expected-error {{statement requires expression of integer type ('struct S' invalid)}}
- while (struct S {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{cannot initialize 'x' with an rvalue of type 'int'}} expected-error {{value of type 'struct S' is not contextually convertible to 'bool'}}
- while (struct {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{cannot initialize 'x' with an rvalue of type 'int'}} expected-error {{value of type 'struct <anonymous>' is not contextually convertible to 'bool'}}
- switch (enum {E} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{incompatible type}}
+ while (struct S {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{no viable conversion}} expected-error {{value of type 'struct S' is not contextually convertible to 'bool'}} expected-note{{candidate function}}
+ while (struct {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{no viable conversion}} expected-error {{value of type 'struct <anonymous>' is not contextually convertible to 'bool'}} expected-note{{candidate function}}
+ switch (enum {E} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{cannot initialize}}
if (int x=0) { // expected-note 2 {{previous definition is here}}
int x; // expected-error {{redefinition of 'x'}}
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp
index f76472bf2f42..0617cd5702c6 100644
--- a/test/SemaCXX/conditional-expr.cpp
+++ b/test/SemaCXX/conditional-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -faccess-control -std=c++0x -Wsign-compare %s
+// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control -std=c++0x -Wsign-compare %s
// C++ rules for ?: are a lot stricter than C rules, and have to take into
// account more conversion options.
@@ -25,7 +25,7 @@ struct Derived : Base {
void fn2();
};
struct Convertible { operator Base&(); };
-struct Priv : private Base {}; // expected-note 2 {{'private' inheritance specifier here}}
+struct Priv : private Base {}; // expected-note 4 {{'private' inheritance specifier here}}
struct Mid : Base {};
struct Fin : Mid, Derived {};
typedef void (Derived::*DFnPtr)();
@@ -109,13 +109,12 @@ void test()
(void)(i1 ? Base() : constder()); // expected-error {{incompatible operand types ('struct Base' and 'struct Derived const')}}
(void)(i1 ? constder() : Base()); // expected-error {{incompatible operand types ('struct Derived const' and 'struct Base')}}
- // FIXME: these are invalid hierarchy conversions
Priv priv;
Fin fin;
- (void)(i1 ? Base() : Priv()); // xpected-error private base
- (void)(i1 ? Priv() : Base()); // xpected-error private base
- (void)(i1 ? Base() : Fin()); // xpected-error ambiguous base
- (void)(i1 ? Fin() : Base()); // xpected-error ambiguous base
+ (void)(i1 ? Base() : Priv()); // expected-error{{conversion from 'struct Priv' to inaccessible base class 'struct Base'}}
+ (void)(i1 ? Priv() : Base()); // expected-error{{error: conversion from 'struct Priv' to inaccessible base class 'struct Base'}}
+ (void)(i1 ? Base() : Fin()); // expected-error{{ambiguous conversion from derived class 'struct Fin' to base class 'struct Base'}}
+ (void)(i1 ? Fin() : Base()); // expected-error{{ambiguous conversion from derived class 'struct Fin' to base class 'struct Base'}}
(void)(i1 ? base : priv); // expected-error {{conversion from 'struct Priv' to inaccessible base class 'struct Base'}}
(void)(i1 ? priv : base); // expected-error {{conversion from 'struct Priv' to inaccessible base class 'struct Base'}}
(void)(i1 ? base : fin); // expected-error {{ambiguous conversion from derived class 'struct Fin' to base class 'struct Base'}}
diff --git a/test/SemaCXX/const-cast.cpp b/test/SemaCXX/const-cast.cpp
index ee0048bd73be..220e6faeee3c 100644
--- a/test/SemaCXX/const-cast.cpp
+++ b/test/SemaCXX/const-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {};
@@ -28,8 +28,9 @@ char ***good_const_cast_test(ccvpcvpp var)
char ***&var4 = const_cast<cpppr>(var3);
// Drop reference. Intentionally without qualifier change.
char *** var5 = const_cast<cppp>(var4);
+ // Const array to array reference.
const int ar[100] = {0};
- int (&rar)[100] = const_cast<iarr>(ar); // expected-error {{const_cast from 'int const [100]' to 'iarr' (aka 'iar &') is not allowed}}
+ int (&rar)[100] = const_cast<iarr>(ar);
// Array decay. Intentionally without qualifier change.
int *pi = const_cast<int*>(ar);
f fp = 0;
diff --git a/test/SemaCXX/constant-expression.cpp b/test/SemaCXX/constant-expression.cpp
index 02ea802c7265..0d4d38743300 100644
--- a/test/SemaCXX/constant-expression.cpp
+++ b/test/SemaCXX/constant-expression.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
// C++ [expr.const]p1:
// In several places, C++ requires expressions that evaluate to an integral
diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp
index 43186013aaa6..67d4074cbcdc 100644
--- a/test/SemaCXX/constructor-initializer.cpp
+++ b/test/SemaCXX/constructor-initializer.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -Wreorder -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wreorder -fsyntax-only -verify %s
class A {
int m;
A() : A::m(17) { } // expected-error {{member initializer 'm' does not name a non-static data member or base class}}
diff --git a/test/SemaCXX/constructor-recovery.cpp b/test/SemaCXX/constructor-recovery.cpp
index 50fdc9622e4c..c1bb43628356 100644
--- a/test/SemaCXX/constructor-recovery.cpp
+++ b/test/SemaCXX/constructor-recovery.cpp
@@ -1,10 +1,9 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
-struct C { // expected-note {{candidate function}}
- virtual C() = 0; // expected-error{{constructor cannot be declared 'virtual'}} \
- expected-note {{candidate function}}
+struct C {
+ virtual C() = 0; // expected-error{{constructor cannot be declared 'virtual'}}
};
void f() {
- C c; // expected-error {{call to constructor of 'c' is ambiguous}}
+ C c;
}
diff --git a/test/SemaCXX/constructor.cpp b/test/SemaCXX/constructor.cpp
index 58d28b55184c..9ef5c98e9e2c 100644
--- a/test/SemaCXX/constructor.cpp
+++ b/test/SemaCXX/constructor.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef int INT;
class Foo {
diff --git a/test/SemaCXX/conversion-delete-expr.cpp b/test/SemaCXX/conversion-delete-expr.cpp
index 708289c362dc..2338778ebaac 100644
--- a/test/SemaCXX/conversion-delete-expr.cpp
+++ b/test/SemaCXX/conversion-delete-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
// Test1
struct B {
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp
index c0c318ed3368..db322f4a3d34 100644
--- a/test/SemaCXX/conversion-function.cpp
+++ b/test/SemaCXX/conversion-function.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class X {
public:
operator bool();
@@ -9,7 +9,7 @@ public:
}
float g() {
- return operator float(); // expected-error{{no matching function for call to 'operator float'}}
+ return operator float(); // expected-error{{use of undeclared 'operator float'}}
}
};
@@ -56,14 +56,14 @@ public:
// This used to crash Clang.
struct Flip;
-struct Flop {
+struct Flop { // expected-note{{candidate function}}
Flop();
- Flop(const Flip&);
+ Flop(const Flip&); // expected-note{{candidate function}}
};
struct Flip {
- operator Flop() const;
+ operator Flop() const; // expected-note{{candidate function}}
};
-Flop flop = Flip(); // expected-error {{cannot initialize 'flop' with an rvalue of type 'struct Flip'}}
+Flop flop = Flip(); // expected-error {{conversion from 'struct Flip' to 'struct Flop' is ambiguous}}
// This tests that we don't add the second conversion declaration to the list of user conversions
struct C {
@@ -99,7 +99,7 @@ class AutoPtrRef { };
class AutoPtr {
// FIXME: Using 'unavailable' since we do not have access control yet.
// FIXME: The error message isn't so good.
- AutoPtr(AutoPtr &) __attribute__((unavailable));
+ AutoPtr(AutoPtr &) __attribute__((unavailable)); // expected-note{{explicitly marked}}
public:
AutoPtr();
@@ -115,9 +115,19 @@ AutoPtr test_auto_ptr(bool Cond) {
AutoPtr p;
if (Cond)
- return p; // expected-error{{incompatible type returning}}
+ return p; // expected-error{{call to deleted constructor}}
return AutoPtr();
}
+struct A1 {
+ A1(const char *);
+ ~A1();
+private:
+ A1(const A1&) __attribute__((unavailable)); // expected-note{{here}}
+};
+
+A1 f() {
+ return "Hello"; // expected-error{{invokes deleted copy constructor}}
+}
diff --git a/test/SemaCXX/convert-to-bool.cpp b/test/SemaCXX/convert-to-bool.cpp
index 277bfc6c6888..4b5002e44a01 100644
--- a/test/SemaCXX/convert-to-bool.cpp
+++ b/test/SemaCXX/convert-to-bool.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct ConvToBool {
operator bool() const;
};
@@ -44,7 +44,7 @@ struct ExplicitConvToRef {
void test_explicit_bool(ExplicitConvToBool ecb) {
bool b1(ecb); // okay
- bool b2 = ecb; // expected-error{{incompatible type initializing 'struct ExplicitConvToBool', expected 'bool'}}
+ bool b2 = ecb; // expected-error{{no viable conversion from 'struct ExplicitConvToBool' to 'bool'}}
accepts_bool(ecb); // expected-error{{no matching function for call to}}
}
diff --git a/test/SemaCXX/converting-constructor.cpp b/test/SemaCXX/converting-constructor.cpp
index 3f347b49022e..e78798b82cb7 100644
--- a/test/SemaCXX/converting-constructor.cpp
+++ b/test/SemaCXX/converting-constructor.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class Z { };
class Y {
@@ -27,7 +27,7 @@ public:
FromShort(short s);
};
-class FromShortExplicitly {
+class FromShortExplicitly { // expected-note{{candidate function}}
public:
explicit FromShortExplicitly(short s);
};
@@ -36,7 +36,7 @@ void explicit_constructor(short s) {
FromShort fs1(s);
FromShort fs2 = s;
FromShortExplicitly fse1(s);
- FromShortExplicitly fse2 = s; // expected-error{{error: cannot initialize 'fse2' with an lvalue of type 'short'}}
+ FromShortExplicitly fse2 = s; // expected-error{{no viable conversion}}
}
// PR5519
diff --git a/test/SemaCXX/copy-assignment.cpp b/test/SemaCXX/copy-assignment.cpp
index 413e4d193367..315e29a5b5ec 100644
--- a/test/SemaCXX/copy-assignment.cpp
+++ b/test/SemaCXX/copy-assignment.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
};
diff --git a/test/SemaCXX/copy-constructor-error.cpp b/test/SemaCXX/copy-constructor-error.cpp
index 2e42fcc3b1cd..9cae77504b51 100644
--- a/test/SemaCXX/copy-constructor-error.cpp
+++ b/test/SemaCXX/copy-constructor-error.cpp
@@ -1,13 +1,12 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
-struct S { // expected-note {{candidate function}}
- S (S); // expected-error {{copy constructor must pass its first argument by reference}} \\
- // expected-note {{candidate function}}
+struct S {
+ S (S); // expected-error {{copy constructor must pass its first argument by reference}}
};
S f();
void g() {
- S a( f() ); // expected-error {{call to constructor of 'a' is ambiguous}}
+ S a( f() );
}
diff --git a/test/SemaCXX/copy-initialization.cpp b/test/SemaCXX/copy-initialization.cpp
index 5b1fbaa46052..ad149232a4e3 100644
--- a/test/SemaCXX/copy-initialization.cpp
+++ b/test/SemaCXX/copy-initialization.cpp
@@ -1,18 +1,18 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class X {
public:
explicit X(const X&);
- X(int*); // expected-note{{candidate function}}
+ X(int*); // expected-note 2{{candidate function}}
explicit X(float*);
};
class Y : public X { };
void f(Y y, int *ip, float *fp) {
- X x1 = y; // expected-error{{no matching constructor for initialization of 'x1'; candidate is:}}
+ X x1 = y; // expected-error{{no matching constructor for initialization of 'class X'}}
X x2 = 0;
X x3 = ip;
- X x4 = fp; // expected-error{{cannot initialize 'x4' with an lvalue of type 'float *'}}
+ X x4 = fp; // expected-error{{no viable conversion}}
}
struct foo {
diff --git a/test/SemaCXX/cstyle-cast.cpp b/test/SemaCXX/cstyle-cast.cpp
index 9c47df927e7b..dbb1e4a18a2e 100644
--- a/test/SemaCXX/cstyle-cast.cpp
+++ b/test/SemaCXX/cstyle-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -faccess-control %s
+// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control %s
struct A {};
diff --git a/test/SemaCXX/cxx-member-pointer-op.cpp b/test/SemaCXX/cxx-member-pointer-op.cpp
index 63b29c723e07..f43d438eb46f 100644
--- a/test/SemaCXX/cxx-member-pointer-op.cpp
+++ b/test/SemaCXX/cxx-member-pointer-op.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
struct C {
static int (C::* a);
diff --git a/test/SemaCXX/dcl_ambig_res.cpp b/test/SemaCXX/dcl_ambig_res.cpp
index 495a6e6e42c8..859d2045da09 100644
--- a/test/SemaCXX/dcl_ambig_res.cpp
+++ b/test/SemaCXX/dcl_ambig_res.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
// [dcl.ambig.res]p1:
struct S {
diff --git a/test/SemaCXX/dcl_init_aggr.cpp b/test/SemaCXX/dcl_init_aggr.cpp
index 20b787a22526..87b51e32e5cf 100644
--- a/test/SemaCXX/dcl_init_aggr.cpp
+++ b/test/SemaCXX/dcl_init_aggr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
// C++ [dcl.init.aggr]p2
struct A {
int x;
@@ -13,7 +13,7 @@ struct NonAggregate {
int a, b;
};
-NonAggregate non_aggregate_test = { 1, 2 }; // expected-error{{initialization of non-aggregate type 'struct NonAggregate' with an initializer list}}
+NonAggregate non_aggregate_test = { 1, 2 }; // expected-error{{non-aggregate type 'struct NonAggregate' cannot be initialized with an initializer list}}
NonAggregate non_aggregate_test2[2] = { { 1, 2 }, { 3, 4 } }; // expected-error 2 {{initialization of non-aggregate type 'struct NonAggregate' with an initializer list}}
@@ -40,17 +40,18 @@ char cv[4] = { 'a', 's', 'd', 'f', 0 }; // expected-error{{excess elements in ar
struct TooFew { int a; char* b; int c; };
TooFew too_few = { 1, "asdf" }; // okay
-struct NoDefaultConstructor { // expected-note 3 {{candidate function}}
+struct NoDefaultConstructor { // expected-note 3 {{candidate function}} \
+ // expected-note{{declared here}}
NoDefaultConstructor(int); // expected-note 3 {{candidate function}}
};
-struct TooFewError {
+struct TooFewError { // expected-error{{implicit default constructor for}}
int a;
- NoDefaultConstructor nodef;
+ NoDefaultConstructor nodef; // expected-note{{member is declared here}}
};
TooFewError too_few_okay = { 1, 1 };
TooFewError too_few_error = { 1 }; // expected-error{{no matching constructor}}
-TooFewError too_few_okay2[2] = { 1, 1 };
+TooFewError too_few_okay2[2] = { 1, 1 }; // expected-note{{implicit default constructor for 'struct TooFewError' first required here}}
TooFewError too_few_error2[2] = { 1 }; // expected-error{{no matching constructor}}
NoDefaultConstructor too_few_error3[3] = { }; // expected-error {{no matching constructor}}
@@ -114,9 +115,9 @@ B2 b2_2 = { 4, d2, 0 };
B2 b2_3 = { c2, a2, a2 };
// C++ [dcl.init.aggr]p15:
-union u { int a; char* b; };
+union u { int a; char* b; }; // expected-note{{candidate function}}
u u1 = { 1 };
u u2 = u1;
-u u3 = 1; // expected-error{{cannot initialize 'u3' with an rvalue of type 'int'}}
+u u3 = 1; // expected-error{{no viable conversion}}
u u4 = { 0, "asdf" }; // expected-error{{excess elements in union initializer}}
u u5 = { "asdf" }; // expected-error{{incompatible type initializing 'char const [5]', expected 'int'}}
diff --git a/test/SemaCXX/decl-expr-ambiguity.cpp b/test/SemaCXX/decl-expr-ambiguity.cpp
index 8d34a9ee7df9..81f68392d85a 100644
--- a/test/SemaCXX/decl-expr-ambiguity.cpp
+++ b/test/SemaCXX/decl-expr-ambiguity.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -pedantic-errors %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic-errors %s
void f() {
int a;
diff --git a/test/SemaCXX/decl-init-ref.cpp b/test/SemaCXX/decl-init-ref.cpp
index 20eb91a608ca..294543f495db 100644
--- a/test/SemaCXX/decl-init-ref.cpp
+++ b/test/SemaCXX/decl-init-ref.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
struct A {}; // expected-note {{candidate function}}
@@ -18,9 +18,9 @@ class B : public BASE , public BASE1
extern B f();
-const int& ri = (void)0; // expected-error {{invalid initialization of reference of type 'int const &' from expression of type 'void'}}
+const int& ri = (void)0; // expected-error {{reference to type 'int const' could not bind to an rvalue of type 'void'}}
int main() {
- const A& rca = f(); // expected-error {{conversion from 'class B' to 'struct A const' is ambiguous}}
+ const A& rca = f(); // expected-error {{reference initialization of type 'struct A const &' with initializer of type 'class B' is ambiguous}}
A& ra = f(); // expected-error {{non-const lvalue reference to type 'struct A' cannot bind to a temporary of type 'class B'}}
}
diff --git a/test/SemaCXX/decltype-crash.cpp b/test/SemaCXX/decltype-crash.cpp
index b56a7f602987..f94ba453ffb4 100644
--- a/test/SemaCXX/decltype-crash.cpp
+++ b/test/SemaCXX/decltype-crash.cpp
@@ -1,7 +1,7 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int& a();
void f() {
- decltype(a()) c; // expected-error {{no matching function for call to 'decltype'}}
+ decltype(a()) c; // expected-error {{use of undeclared identifier 'decltype'}}
}
diff --git a/test/SemaCXX/decltype-overloaded-functions.cpp b/test/SemaCXX/decltype-overloaded-functions.cpp
index 4c5349b85868..906e868a4282 100644
--- a/test/SemaCXX/decltype-overloaded-functions.cpp
+++ b/test/SemaCXX/decltype-overloaded-functions.cpp
@@ -1,11 +1,11 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
void f();
void f(int);
-decltype(f) a; // expected-error{{can't determine the declared type of an overloaded function}}
+decltype(f) a; // expected-error{{cannot determine the declared type of an overloaded function}}
template<typename T> struct S {
- decltype(T::f) * f; // expected-error{{can't determine the declared type of an overloaded function}}
+ decltype(T::f) * f; // expected-error{{cannot determine the declared type of an overloaded function}}
};
struct K { void f(); void f(int); };
diff --git a/test/SemaCXX/decltype-pr4444.cpp b/test/SemaCXX/decltype-pr4444.cpp
index 8b2f584d24dd..456b22c5f7f2 100644
--- a/test/SemaCXX/decltype-pr4444.cpp
+++ b/test/SemaCXX/decltype-pr4444.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
template<typename T, T t>
struct TestStruct {
diff --git a/test/SemaCXX/decltype-pr4448.cpp b/test/SemaCXX/decltype-pr4448.cpp
index fbf5da1d53ea..ead24ce0ca86 100644
--- a/test/SemaCXX/decltype-pr4448.cpp
+++ b/test/SemaCXX/decltype-pr4448.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
template< typename T, T t, decltype(t+2) v >
struct Convoluted {};
diff --git a/test/SemaCXX/decltype-this.cpp b/test/SemaCXX/decltype-this.cpp
index c6bf299f3f3b..f9bf49973b5c 100644
--- a/test/SemaCXX/decltype-this.cpp
+++ b/test/SemaCXX/decltype-this.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
template<typename T, typename U> struct is_same {
static const bool value = false;
diff --git a/test/SemaCXX/default-argument-temporaries.cpp b/test/SemaCXX/default-argument-temporaries.cpp
index 232351dcff3d..3ab7bf4eb13d 100644
--- a/test/SemaCXX/default-argument-temporaries.cpp
+++ b/test/SemaCXX/default-argument-temporaries.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct B { B(void* = 0); };
struct A {
diff --git a/test/SemaCXX/default-assignment-operator.cpp b/test/SemaCXX/default-assignment-operator.cpp
index 0377657a82d2..9c99ad594458 100644
--- a/test/SemaCXX/default-assignment-operator.cpp
+++ b/test/SemaCXX/default-assignment-operator.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class Base { // expected-error {{cannot define the implicit default assignment operator for 'class Base'}}
int &ref; // expected-note {{declared at}}
diff --git a/test/SemaCXX/default-constructor-initializers.cpp b/test/SemaCXX/default-constructor-initializers.cpp
index 6adcdca3e177..4269991adecf 100644
--- a/test/SemaCXX/default-constructor-initializers.cpp
+++ b/test/SemaCXX/default-constructor-initializers.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X1 { // has no implicit default constructor
X1(int);
diff --git a/test/SemaCXX/default1.cpp b/test/SemaCXX/default1.cpp
index be264ad62b13..790208aa1d05 100644
--- a/test/SemaCXX/default1.cpp
+++ b/test/SemaCXX/default1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f(int i);
void f(int i = 0); // expected-note {{previous definition is here}}
void f(int i = 17); // expected-error {{redefinition of default argument}}
@@ -14,7 +14,7 @@ void h(int i, int j = 2, int k = 3,
int n);// expected-error {{missing default argument on parameter 'n'}}
struct S { } s;
-void i(int = s) { } // expected-error {{incompatible type}}
+void i(int = s) { } // expected-error {{no viable conversion}}
struct X {
X(int);
@@ -22,10 +22,10 @@ struct X {
void j(X x = 17);
-struct Y {
+struct Y { // expected-note 2{{candidate}}
explicit Y(int);
};
-void k(Y y = 17); // expected-error{{cannot initialize 'y' with an rvalue of type 'int'}}
+void k(Y y = 17); // expected-error{{no viable conversion}}
-void kk(Y = 17); // expected-error{{cannot initialize a value of type 'struct Y' with an rvalue of type 'int'}}
+void kk(Y = 17); // expected-error{{no viable conversion}}
diff --git a/test/SemaCXX/default2.cpp b/test/SemaCXX/default2.cpp
index 183452070da4..880255e4531b 100644
--- a/test/SemaCXX/default2.cpp
+++ b/test/SemaCXX/default2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f(int i, int j, int k = 3);
void f(int i, int j, int k);
@@ -82,7 +82,7 @@ int Y::mem4(int i = a) // expected-error{{invalid use of nonstatic data member '
// constructors.
class Z {
public:
- Z(Z&, int i = 17); // expected-note 2 {{candidate function}}
+ Z(Z&, int i = 17); // expected-note 3 {{candidate function}}
void f(Z& z) {
Z z2; // expected-error{{no matching constructor for initialization}}
@@ -90,12 +90,12 @@ public:
}
void test_Z(const Z& z) {
- Z z2(z); // expected-error{{no matching constructor for initialization of 'z2'}}
+ Z z2(z); // expected-error{{no matching constructor for initialization of 'class Z'}}
}
};
void test_Z(const Z& z) {
- Z z2(z); // expected-error{{no matching constructor for initialization of 'z2'}}
+ Z z2(z); // expected-error{{no matching constructor for initialization of 'class Z'}}
}
struct ZZ {
diff --git a/test/SemaCXX/deleted-function.cpp b/test/SemaCXX/deleted-function.cpp
index 637b2b1b2d5c..d9df1bf5b05a 100644
--- a/test/SemaCXX/deleted-function.cpp
+++ b/test/SemaCXX/deleted-function.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
int i = delete; // expected-error {{only functions can have deleted definitions}}
@@ -16,9 +16,9 @@ void ov(int) {} // expected-note {{candidate function}}
void ov(double) = delete; // expected-note {{candidate function has been explicitly deleted}}
struct WithDel {
- WithDel() = delete; // expected-note {{candidate function has been explicitly deleted}}
+ WithDel() = delete; // expected-note {{function has been explicitly marked deleted here}}
void fn() = delete; // expected-note {{function has been explicitly marked deleted here}}
- operator int() = delete;
+ operator int() = delete; // expected-note {{function has been explicitly marked deleted here}}
void operator +(int) = delete;
int i = delete; // expected-error {{only functions can have deleted definitions}}
@@ -29,8 +29,8 @@ void test() {
ov(1);
ov(1.0); // expected-error {{call to deleted function 'ov'}}
- WithDel dd; // expected-error {{call to deleted constructor of 'dd'}}
+ WithDel dd; // expected-error {{call to deleted constructor of 'struct WithDel'}}
WithDel *d = 0;
d->fn(); // expected-error {{attempt to use a deleted function}}
- int i = *d; // expected-error {{incompatible type initializing}}
+ int i = *d; // expected-error {{invokes a deleted function}}
}
diff --git a/test/SemaCXX/dependent-types.cpp b/test/SemaCXX/dependent-types.cpp
index 300312580a8f..d9b53230c994 100644
--- a/test/SemaCXX/dependent-types.cpp
+++ b/test/SemaCXX/dependent-types.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
template<typename T, int Size> void f() {
T x1;
diff --git a/test/SemaCXX/derived-to-base-ambig.cpp b/test/SemaCXX/derived-to-base-ambig.cpp
index e15ddde9d91f..cfcad7989aa2 100644
--- a/test/SemaCXX/derived-to-base-ambig.cpp
+++ b/test/SemaCXX/derived-to-base-ambig.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class A { };
class B : public A { };
class C : public A { };
diff --git a/test/SemaCXX/destructor.cpp b/test/SemaCXX/destructor.cpp
index 790a401ae99c..6837cd40157c 100644
--- a/test/SemaCXX/destructor.cpp
+++ b/test/SemaCXX/destructor.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class A {
public:
~A();
diff --git a/test/SemaCXX/direct-initializer.cpp b/test/SemaCXX/direct-initializer.cpp
index a9e2b2bb6e45..03a5da3a303b 100644
--- a/test/SemaCXX/direct-initializer.cpp
+++ b/test/SemaCXX/direct-initializer.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int x(1);
int (x2)(1);
@@ -20,19 +20,19 @@ public:
X(float, Y); // expected-note{{candidate function}}
};
-class Z {
+class Z { // expected-note{{candidate function}}
public:
- Z(int);
+ Z(int); // expected-note{{candidate function}}
};
void g() {
X x1(5);
X x2(1.0, 3, 4.2);
- X x3(1.0, 1.0); // expected-error{{no matching constructor for initialization of 'x3'; candidates are:}}
+ X x3(1.0, 1.0); // expected-error{{no matching constructor for initialization of 'class X'}}
Y y(1.0);
X x4(3.14, y);
- Z z; // expected-error{{no matching constructor for initialization of 'z'}}
+ Z z; // expected-error{{no matching constructor for initialization of 'class Z'}}
}
struct Base {
@@ -40,11 +40,11 @@ struct Base {
};
struct Derived : Base {
- operator int*();
+ operator int*(); // expected-note {{candidate function}}
};
void foo(const Derived cd, Derived d) {
- int *pi = cd; // expected-error {{incompatible type initializing 'struct Derived const', expected 'int *'}}
+ int *pi = cd; // expected-error {{no viable conversion from 'struct Derived const' to 'int *'}}
int *ppi = d;
}
diff --git a/test/SemaCXX/do-while-scope.cpp b/test/SemaCXX/do-while-scope.cpp
index 4e4a48325c1c..2602ae12f243 100644
--- a/test/SemaCXX/do-while-scope.cpp
+++ b/test/SemaCXX/do-while-scope.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void test() {
int x;
diff --git a/test/SemaCXX/dynamic-cast.cpp b/test/SemaCXX/dynamic-cast.cpp
index 42c5e0132a82..53d0b9d0189c 100644
--- a/test/SemaCXX/dynamic-cast.cpp
+++ b/test/SemaCXX/dynamic-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {};
struct B : A {};
diff --git a/test/SemaCXX/elaborated-type-specifier.cpp b/test/SemaCXX/elaborated-type-specifier.cpp
index 70478e0f32c4..8d2d67f705cd 100644
--- a/test/SemaCXX/elaborated-type-specifier.cpp
+++ b/test/SemaCXX/elaborated-type-specifier.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Test the use of elaborated-type-specifiers to inject the names of
// structs (or classes or unions) into an outer scope as described in
@@ -27,7 +27,7 @@ namespace NS {
void test_X_elab(NS::X x) {
struct S4 *s4 = 0;
- x.test_elab2(s4); // expected-error{{incompatible type passing 'struct S4 *', expected 'struct NS::S4 *'}}
+ x.test_elab2(s4); // expected-error{{cannot initialize a parameter of type 'struct NS::S4 *' with an lvalue of type 'struct S4 *'}}
}
namespace NS {
diff --git a/test/SemaCXX/empty-class-layout.cpp b/test/SemaCXX/empty-class-layout.cpp
index 8b54ea1c66f2..c3dc7330fe76 100644
--- a/test/SemaCXX/empty-class-layout.cpp
+++ b/test/SemaCXX/empty-class-layout.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-unknown-unknown %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify
#define SA(n, p) int a##n[(p) ? 1 : -1]
diff --git a/test/SemaCXX/enum.cpp b/test/SemaCXX/enum.cpp
index 3315de00ca83..f1b02f5d4c6d 100644
--- a/test/SemaCXX/enum.cpp
+++ b/test/SemaCXX/enum.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++98 -verify -triple x86_64-apple-darwin %s
enum E {
Val1,
@@ -42,26 +42,17 @@ namespace test1 {
template <class A> struct is_same<A,A> { static const int value = 1; };
enum enum0 { v0 };
- int test0[is_same<typeof(+v0), int>::value];
+ int test0[is_same<__typeof(+v0), int>::value];
enum enum1 { v1 = __INT_MAX__ };
- int test1[is_same<typeof(+v1), int>::value];
+ int test1[is_same<__typeof(+v1), int>::value];
enum enum2 { v2 = __INT_MAX__ * 2U };
- int test2[is_same<typeof(+v2), unsigned int>::value];
+ int test2[is_same<__typeof(+v2), unsigned int>::value];
- // This kindof assumes that 'int' is smaller than 'long long'.
-#if defined(__LP64__)
- enum enum3 { v3 = __LONG_LONG_MAX__ };
- int test3[is_same<typeof(+v3), long>::value];
+ enum enum3 { v3 = __LONG_MAX__ };
+ int test3[is_same<__typeof(+v3), long>::value];
- enum enum4 { v4 = __LONG_LONG_MAX__ * 2ULL };
- int test4[is_same<typeof(+v4), unsigned long>::value];
-#else
- enum enum3 { v3 = __LONG_LONG_MAX__ };
- int test3[is_same<typeof(+v3), long long>::value];
-
- enum enum4 { v4 = __LONG_LONG_MAX__ * 2ULL };
- int test4[is_same<typeof(+v4), unsigned long long>::value];
-#endif
+ enum enum4 { v4 = __LONG_MAX__ * 2UL };
+ int test4[is_same<__typeof(+v4), unsigned long>::value];
}
diff --git a/test/SemaCXX/exception-spec.cpp b/test/SemaCXX/exception-spec.cpp
index efc983322ae5..291b359dfdc4 100644
--- a/test/SemaCXX/exception-spec.cpp
+++ b/test/SemaCXX/exception-spec.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -fms-extensions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
// Straight from the standard:
// Plain function with spec
@@ -160,11 +160,11 @@ void fnptrs()
// return types and arguments must match exactly, no inheritance allowed
void (*(*t7)())() throw(B1) = &s8; // valid
- void (*(*t8)())() throw(A) = &s8; // expected-error {{return types differ}} expected-error {{incompatible type}}
- void (*(*t9)())() throw(D) = &s8; // expected-error {{return types differ}} expected-error {{incompatible type}}
+ void (*(*t8)())() throw(A) = &s8; // expected-error {{return types differ}}
+ void (*(*t9)())() throw(D) = &s8; // expected-error {{return types differ}}
void (*t10)(void (*)() throw(B1)) = &s9; // valid expected-warning{{disambiguated}}
- void (*t11)(void (*)() throw(A)) = &s9; // expected-error {{argument types differ}} expected-error {{incompatible type}} expected-warning{{disambiguated}}
- void (*t12)(void (*)() throw(D)) = &s9; // expected-error {{argument types differ}} expected-error {{incompatible type}} expected-warning{{disambiguated}}
+ void (*t11)(void (*)() throw(A)) = &s9; // expected-error {{argument types differ}} expected-warning{{disambiguated}}
+ void (*t12)(void (*)() throw(D)) = &s9; // expected-error {{argument types differ}} expected-warning{{disambiguated}}
}
// Member function stuff
@@ -178,7 +178,7 @@ void mfnptr()
{
void (Str1::*pfn1)() throw(int) = &Str1::f; // valid
void (Str1::*pfn2)() = &Str1::f; // valid
- void (Str1::*pfn3)() throw() = &Str1::f; // expected-error {{not superset}} expected-error {{incompatible type}}
+ void (Str1::*pfn3)() throw() = &Str1::f; // expected-error {{not superset}}
}
// Don't suppress errors in template instantiation.
diff --git a/test/SemaCXX/exceptions.cpp b/test/SemaCXX/exceptions.cpp
index 5882b9cb7083..924b48aad26f 100644
--- a/test/SemaCXX/exceptions.cpp
+++ b/test/SemaCXX/exceptions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A; // expected-note 4 {{forward declaration of 'struct A'}}
diff --git a/test/SemaCXX/expressions.cpp b/test/SemaCXX/expressions.cpp
index 6a2f30d33e5e..f3a05c1dbced 100644
--- a/test/SemaCXX/expressions.cpp
+++ b/test/SemaCXX/expressions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void choice(int);
int choice(bool);
diff --git a/test/SemaCXX/fntype-decl.cpp b/test/SemaCXX/fntype-decl.cpp
index ae85ff45353d..b8ae625710db 100644
--- a/test/SemaCXX/fntype-decl.cpp
+++ b/test/SemaCXX/fntype-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR2942
typedef void fn(int);
diff --git a/test/SemaCXX/format-attribute.cpp b/test/SemaCXX/format-attribute.cpp
index a21ebe113066..92b7cf517eff 100644
--- a/test/SemaCXX/format-attribute.cpp
+++ b/test/SemaCXX/format-attribute.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR5521
struct A { void a(const char*,...) __attribute((format(printf,2,3))); };
diff --git a/test/SemaCXX/friend-class-nodecl.cpp b/test/SemaCXX/friend-class-nodecl.cpp
index 13330f815db7..41e2da6a554d 100644
--- a/test/SemaCXX/friend-class-nodecl.cpp
+++ b/test/SemaCXX/friend-class-nodecl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -ast-print %s -o %t
+// RUN: %clang_cc1 -ast-print %s -o %t
// RUN: not grep '^ *class B' %t
// Tests that the tag decls in friend declarations aren't added to the
diff --git a/test/SemaCXX/friend.cpp b/test/SemaCXX/friend.cpp
index d1c42eb9fbb5..ffad0e2b44ef 100644
--- a/test/SemaCXX/friend.cpp
+++ b/test/SemaCXX/friend.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
friend class A; // expected-error {{'friend' used outside of class}}
void f() { friend class A; } // expected-error {{'friend' used outside of class}}
@@ -15,3 +15,35 @@ namespace test0 {
friend void ns::f(int a);
};
}
+
+// Test derived from LLVM's Registry.h
+namespace test1 {
+ template <class T> struct Outer {
+ void foo(T);
+ struct Inner {
+ friend void Outer::foo(T);
+ };
+ };
+
+ void test() {
+ (void) Outer<int>::Inner();
+ }
+}
+
+// PR5476
+namespace test2 {
+ namespace foo {
+ void Func(int x);
+ }
+
+ class Bar {
+ friend void ::test2::foo::Func(int x);
+ };
+}
+
+// PR5134
+namespace test3 {
+ class Foo {
+ friend const int getInt(int inInt = 0);
+ };
+}
diff --git a/test/SemaCXX/function-overloaded-redecl.cpp b/test/SemaCXX/function-overloaded-redecl.cpp
index 4d8e57c1b9fe..00778816920e 100644
--- a/test/SemaCXX/function-overloaded-redecl.cpp
+++ b/test/SemaCXX/function-overloaded-redecl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef const int cInt;
diff --git a/test/SemaCXX/function-redecl.cpp b/test/SemaCXX/function-redecl.cpp
index 9f6783731d33..b15d86616585 100644
--- a/test/SemaCXX/function-redecl.cpp
+++ b/test/SemaCXX/function-redecl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int foo(int);
namespace N {
diff --git a/test/SemaCXX/function-type-qual.cpp b/test/SemaCXX/function-type-qual.cpp
index f1d5aac7fc99..be61f2ba5639 100644
--- a/test/SemaCXX/function-type-qual.cpp
+++ b/test/SemaCXX/function-type-qual.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f() const; // expected-error {{type qualifier is not allowed on this function}}
diff --git a/test/SemaCXX/functional-cast.cpp b/test/SemaCXX/functional-cast.cpp
index 142dba7b13f7..63be77008cb4 100644
--- a/test/SemaCXX/functional-cast.cpp
+++ b/test/SemaCXX/functional-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -faccess-control %s
+// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control %s
// ------------ not interpreted as C-style cast ------------
diff --git a/test/SemaCXX/i-c-e-cxx.cpp b/test/SemaCXX/i-c-e-cxx.cpp
index b7db907e2216..8c70bc258701 100644
--- a/test/SemaCXX/i-c-e-cxx.cpp
+++ b/test/SemaCXX/i-c-e-cxx.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++-specific tests for integral constant expressions.
diff --git a/test/SemaCXX/illegal-member-initialization.cpp b/test/SemaCXX/illegal-member-initialization.cpp
index 2d7c73d68a3f..1890dbc9b594 100644
--- a/test/SemaCXX/illegal-member-initialization.cpp
+++ b/test/SemaCXX/illegal-member-initialization.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
A() : value(), cvalue() { } // expected-error {{cannot initialize the member to null in default constructor because reference member 'value' cannot be null-initialized}} \
@@ -20,3 +20,13 @@ struct X {
B& b; // expected-note{{declared at}}
const B cb; // expected-note{{declared at}}
};
+
+
+// PR5924
+struct bar {};
+bar xxx();
+
+struct foo {
+ foo_t a; // expected-error {{unknown type name 'foo_t'}}
+ foo() : a(xxx()) {} // no error here.
+};
diff --git a/test/SemaCXX/implicit-int.cpp b/test/SemaCXX/implicit-int.cpp
index 6fa8dd3463d3..9711adf34304 100644
--- a/test/SemaCXX/implicit-int.cpp
+++ b/test/SemaCXX/implicit-int.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
x; // expected-error{{C++ requires a type specifier for all declarations}}
diff --git a/test/SemaCXX/implicit-member-functions.cpp b/test/SemaCXX/implicit-member-functions.cpp
index 186780833d39..40a61e47fd3c 100644
--- a/test/SemaCXX/implicit-member-functions.cpp
+++ b/test/SemaCXX/implicit-member-functions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A { }; // expected-note {{previous implicit declaration is here}}
A::A() { } // expected-error {{definition of implicitly declared constructor}}
diff --git a/test/SemaCXX/implicit-virtual-member-functions.cpp b/test/SemaCXX/implicit-virtual-member-functions.cpp
index 30fe2786ba46..a6b1f8c537d2 100644
--- a/test/SemaCXX/implicit-virtual-member-functions.cpp
+++ b/test/SemaCXX/implicit-virtual-member-functions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
virtual ~A();
};
diff --git a/test/SemaCXX/incomplete-call.cpp b/test/SemaCXX/incomplete-call.cpp
index 3ce898a76f2c..5bdaf829e64e 100644
--- a/test/SemaCXX/incomplete-call.cpp
+++ b/test/SemaCXX/incomplete-call.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A; // expected-note 14 {{forward declaration of 'struct A'}}
A f(); // expected-note {{note: 'f' declared here}}
diff --git a/test/SemaCXX/inherit.cpp b/test/SemaCXX/inherit.cpp
index 069e30d0cdfa..aabed2bff9e7 100644
--- a/test/SemaCXX/inherit.cpp
+++ b/test/SemaCXX/inherit.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class A { };
class B1 : A { };
diff --git a/test/SemaCXX/inline.cpp b/test/SemaCXX/inline.cpp
index 7d0505a435ee..e569300faf77 100644
--- a/test/SemaCXX/inline.cpp
+++ b/test/SemaCXX/inline.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Check that we don't allow illegal uses of inline
// (checking C++-only constructs here)
diff --git a/test/SemaCXX/invalid-member-expr.cpp b/test/SemaCXX/invalid-member-expr.cpp
index 730beb32698b..666595c84f07 100644
--- a/test/SemaCXX/invalid-member-expr.cpp
+++ b/test/SemaCXX/invalid-member-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class X {};
diff --git a/test/SemaCXX/invalid-template-specifier.cpp b/test/SemaCXX/invalid-template-specifier.cpp
index 034ad73b086a..bcd6da7f32f7 100644
--- a/test/SemaCXX/invalid-template-specifier.cpp
+++ b/test/SemaCXX/invalid-template-specifier.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
// PR4809
// This test is primarily checking that this doesn't crash, not the particular
// diagnostics.
diff --git a/test/SemaCXX/libstdcxx_is_pod_hack.cpp b/test/SemaCXX/libstdcxx_is_pod_hack.cpp
index df064bc6a0fa..7a4bebca864e 100644
--- a/test/SemaCXX/libstdcxx_is_pod_hack.cpp
+++ b/test/SemaCXX/libstdcxx_is_pod_hack.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
template<typename T>
struct __is_pod {
diff --git a/test/SemaCXX/linkage-spec.cpp b/test/SemaCXX/linkage-spec.cpp
index d19727ac0766..57730a62aae3 100644
--- a/test/SemaCXX/linkage-spec.cpp
+++ b/test/SemaCXX/linkage-spec.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
extern "C" {
extern "C" void f(int);
}
diff --git a/test/SemaCXX/literal-type.cpp b/test/SemaCXX/literal-type.cpp
index 0dca9c9a92b3..142dd756e5a3 100644
--- a/test/SemaCXX/literal-type.cpp
+++ b/test/SemaCXX/literal-type.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
static_assert(__is_literal(int), "fail");
static_assert(__is_literal(void*), "fail");
diff --git a/test/SemaCXX/member-expr-anonymous-union.cpp b/test/SemaCXX/member-expr-anonymous-union.cpp
index 9566df4a20ff..0f0359667b38 100644
--- a/test/SemaCXX/member-expr-anonymous-union.cpp
+++ b/test/SemaCXX/member-expr-anonymous-union.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// PR5543
struct A { int x; union { int* y; float& z; }; }; struct B : A {int a;};
diff --git a/test/SemaCXX/member-expr-static.cpp b/test/SemaCXX/member-expr-static.cpp
index 2fa7e0781c1e..7ed60f7a17b7 100644
--- a/test/SemaCXX/member-expr-static.cpp
+++ b/test/SemaCXX/member-expr-static.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef void (*thread_continue_t)();
extern "C" {
diff --git a/test/SemaCXX/member-expr.cpp b/test/SemaCXX/member-expr.cpp
index 9cd6855ccd55..13ff64d8cffc 100644
--- a/test/SemaCXX/member-expr.cpp
+++ b/test/SemaCXX/member-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class X{
public:
diff --git a/test/SemaCXX/member-location.cpp b/test/SemaCXX/member-location.cpp
index cb53ae15123d..c3099d25e0e1 100644
--- a/test/SemaCXX/member-location.cpp
+++ b/test/SemaCXX/member-location.cpp
@@ -1,5 +1,5 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR4103: Make sure we have a location for the error
class A { float a(int *); int b(); };
-int A::b() { return a(a((int*)0)); } // expected-error {{incompatible type}}
+int A::b() { return a(a((int*)0)); } // expected-error {{cannot initialize a parameter of type 'int *' with an rvalue of type 'float'}}
diff --git a/test/SemaCXX/member-name-lookup.cpp b/test/SemaCXX/member-name-lookup.cpp
index e95641b4bf9c..ff14416089d5 100644
--- a/test/SemaCXX/member-name-lookup.cpp
+++ b/test/SemaCXX/member-name-lookup.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
int a; // expected-note 4{{member found by ambiguous name lookup}}
static int b;
diff --git a/test/SemaCXX/member-operator-expr.cpp b/test/SemaCXX/member-operator-expr.cpp
index 4d0e00fd6010..5e3d0c0a1bc8 100644
--- a/test/SemaCXX/member-operator-expr.cpp
+++ b/test/SemaCXX/member-operator-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class X {
public:
diff --git a/test/SemaCXX/member-pointer-size.cpp b/test/SemaCXX/member-pointer-size.cpp
index 952027d12395..3aa1eaf5f256 100644
--- a/test/SemaCXX/member-pointer-size.cpp
+++ b/test/SemaCXX/member-pointer-size.cpp
@@ -1,5 +1,5 @@
-// RUN: clang-cc -triple x86_64-unknown-unknown %s -fsyntax-only -verify
-// RUN: clang-cc -triple i686-unknown-unknown %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple i686-unknown-unknown %s -fsyntax-only -verify
#include <stddef.h>
struct A;
diff --git a/test/SemaCXX/member-pointer.cpp b/test/SemaCXX/member-pointer.cpp
index d13b16e6d672..65d05eb5af74 100644
--- a/test/SemaCXX/member-pointer.cpp
+++ b/test/SemaCXX/member-pointer.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {};
enum B { Dummy };
@@ -35,8 +35,8 @@ void f() {
pdid = pdi2;
// Fail conversion due to ambiguity and virtuality.
- int F::*pdif = pdi1; // expected-error {{ambiguous conversion from pointer to member of base class 'struct A' to pointer to member of derived class 'struct F'}} expected-error {{incompatible type}}
- int G::*pdig = pdi1; // expected-error {{conversion from pointer to member of class 'struct A' to pointer to member of class 'struct G' via virtual base 'struct D' is not allowed}} expected-error {{incompatible type}}
+ int F::*pdif = pdi1; // expected-error {{ambiguous conversion from pointer to member of base class 'struct A' to pointer to member of derived class 'struct F'}}
+ int G::*pdig = pdi1; // expected-error {{conversion from pointer to member of class 'struct A' to pointer to member of class 'struct G' via virtual base 'struct D' is not allowed}}
// Conversion to member of base.
pdi1 = pdid; // expected-error {{incompatible type assigning 'int struct D::*', expected 'int struct A::*'}}
diff --git a/test/SemaCXX/member-pointers-2.cpp b/test/SemaCXX/member-pointers-2.cpp
index fea1d74b0255..4b3b82c02975 100644
--- a/test/SemaCXX/member-pointers-2.cpp
+++ b/test/SemaCXX/member-pointers-2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm-only %s
+// RUN: %clang_cc1 -emit-llvm-only %s
// Tests that Sema properly creates member-access expressions for
// these instead of bare FieldDecls.
diff --git a/test/SemaCXX/missing-members.cpp b/test/SemaCXX/missing-members.cpp
index 28ad9a04e790..9ec17f7b9933 100644
--- a/test/SemaCXX/missing-members.cpp
+++ b/test/SemaCXX/missing-members.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace A {
namespace B {
class C { };
diff --git a/test/SemaCXX/ms-exception-spec.cpp b/test/SemaCXX/ms-exception-spec.cpp
index b84ea178e1e2..bda56f5468d4 100644
--- a/test/SemaCXX/ms-exception-spec.cpp
+++ b/test/SemaCXX/ms-exception-spec.cpp
@@ -1,3 +1,3 @@
-// RUN: clang-cc %s -fsyntax-only -verify -fms-extensions
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions
void f() throw(...) { }
diff --git a/test/SemaCXX/namespace-alias.cpp b/test/SemaCXX/namespace-alias.cpp
index d5e423848cb5..f9836064d131 100644
--- a/test/SemaCXX/namespace-alias.cpp
+++ b/test/SemaCXX/namespace-alias.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace N { };
diff --git a/test/SemaCXX/namespace.cpp b/test/SemaCXX/namespace.cpp
index 5ed6ba50ce1b..ab690b7286ec 100644
--- a/test/SemaCXX/namespace.cpp
+++ b/test/SemaCXX/namespace.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace A { // expected-note 2 {{previous definition is here}}
int A;
void f() { A = 0; }
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp
index 6a51261e26fc..4e65b41e666c 100644
--- a/test/SemaCXX/nested-name-spec.cpp
+++ b/test/SemaCXX/nested-name-spec.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c++98 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s
namespace A {
struct C {
static int cx;
@@ -178,7 +178,7 @@ bool (foo_S::value);
namespace somens {
- struct a { };
+ struct a { }; // expected-note{{candidate function}}
}
template <typename T>
@@ -189,8 +189,34 @@ class foo {
// PR4452 / PR4451
foo<somens:a> a2; // expected-error {{unexpected ':' in nested name specifier}}
-somens::a a3 = a2; // expected-error {{cannot initialize 'a3' with an lvalue of type 'foo<somens::a>'}}
+somens::a a3 = a2; // expected-error {{no viable conversion}}
+// typedefs and using declarations.
+namespace test1 {
+ namespace ns {
+ class Counter { static int count; };
+ typedef Counter counter;
+ }
+ using ns::counter;
+ class Test {
+ void test1() {
+ counter c;
+ c.count++;
+ counter::count++;
+ }
+ };
+}
+// We still need to do lookup in the lexical scope, even if we push a
+// non-lexical scope.
+namespace test2 {
+ namespace ns {
+ int *count_ptr;
+ }
+ namespace {
+ int count = 0;
+ }
+ int *ns::count_ptr = &count;
+}
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index 8a3ec8b16a26..0e0f630bc497 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stddef.h>
@@ -18,7 +18,8 @@ struct V : U
{
};
-void* operator new(size_t); // expected-note 2 {{candidate}}
+// PR5823
+void* operator new(const size_t); // expected-note 2 {{candidate}}
void* operator new(size_t, int*); // expected-note 3 {{candidate}}
void* operator new(size_t, float*); // expected-note 3 {{candidate}}
void* operator new(size_t, S); // expected-note 2 {{candidate}}
@@ -59,12 +60,12 @@ void bad_news(int *ip)
(void)new int[1][i]; // expected-error {{only the first dimension}}
(void)new (int[1][i]); // expected-error {{only the first dimension}}
(void)new (int[i]); // expected-error {{when type is in parentheses}}
- (void)new int(*(S*)0); // expected-error {{incompatible type initializing}}
- (void)new int(1, 2); // expected-error {{initializer of a builtin type can only take one argument}}
+ (void)new int(*(S*)0); // expected-error {{no viable conversion from 'struct S' to 'int'}}
+ (void)new int(1, 2); // expected-error {{excess elements in scalar initializer}}
(void)new S(1); // expected-error {{no matching constructor}}
- (void)new S(1, 1); // expected-error {{call to constructor of 'S' is ambiguous}}
- (void)new const int; // expected-error {{must provide an initializer}}
- (void)new float*(ip); // expected-error {{incompatible type initializing 'int *', expected 'float *'}}
+ (void)new S(1, 1); // expected-error {{call to constructor of 'struct S' is ambiguous}}
+ (void)new const int; // expected-error {{default initialization of an object of const type 'int const'}}
+ (void)new float*(ip); // expected-error {{cannot initialize a value of type 'float *' with an lvalue of type 'int *'}}
// Undefined, but clang should reject it directly.
(void)new int[-1]; // expected-error {{array size is negative}}
(void)new int[*(S*)0]; // expected-error {{array size expression must have integral or enumerated type, not 'struct S'}}
@@ -215,4 +216,3 @@ static void* f(void* g)
{
return new (g) X13();
}
-
diff --git a/test/SemaCXX/no-implicit-builtin-decls.cpp b/test/SemaCXX/no-implicit-builtin-decls.cpp
index bd11f92f7e62..d82f7f18bffe 100644
--- a/test/SemaCXX/no-implicit-builtin-decls.cpp
+++ b/test/SemaCXX/no-implicit-builtin-decls.cpp
@@ -1,7 +1,7 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f() {
- void *p = malloc(sizeof(int) * 10); // expected-error{{no matching function for call to 'malloc'}}
+ void *p = malloc(sizeof(int) * 10); // expected-error{{use of undeclared identifier 'malloc'}}
}
int malloc(double);
diff --git a/test/SemaCXX/nullptr.cpp b/test/SemaCXX/nullptr.cpp
index 6cc5a8168313..a3aab7fbe3e0 100644
--- a/test/SemaCXX/nullptr.cpp
+++ b/test/SemaCXX/nullptr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
#include <stdint.h>
// Don't have decltype yet.
@@ -29,7 +29,7 @@ nullptr_t f(nullptr_t null)
bool b = nullptr;
// Can't convert nullptr to integral implicitly.
- uintptr_t i = nullptr; // expected-error {{incompatible type initializing}}
+ uintptr_t i = nullptr; // expected-error {{cannot initialize}}
// Operators
(void)(null == nullptr);
diff --git a/test/SemaCXX/offsetof.cpp b/test/SemaCXX/offsetof.cpp
index bc7a707ee546..f3dc52df4977 100644
--- a/test/SemaCXX/offsetof.cpp
+++ b/test/SemaCXX/offsetof.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -Winvalid-offsetof
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Winvalid-offsetof
struct NonPOD {
virtual void f();
diff --git a/test/SemaCXX/overload-call-copycon.cpp b/test/SemaCXX/overload-call-copycon.cpp
index 6436236b81e9..472fae26b81f 100644
--- a/test/SemaCXX/overload-call-copycon.cpp
+++ b/test/SemaCXX/overload-call-copycon.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -Wnon-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only %s -Wnon-pod-varargs
class X { };
int& copycon(X x);
diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp
index 5d2718208f2b..299c0a78f926 100644
--- a/test/SemaCXX/overload-call.cpp
+++ b/test/SemaCXX/overload-call.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
int* f(int) { return 0; }
float* f(float) { return 0; }
void f();
diff --git a/test/SemaCXX/overload-decl.cpp b/test/SemaCXX/overload-decl.cpp
index 2bc832f558f7..c610ff7ab064 100644
--- a/test/SemaCXX/overload-decl.cpp
+++ b/test/SemaCXX/overload-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f();
void f(int);
void f(int, float);
diff --git a/test/SemaCXX/overload-member-call.cpp b/test/SemaCXX/overload-member-call.cpp
index 937b65d633f9..4bb3ff3a54cd 100644
--- a/test/SemaCXX/overload-member-call.cpp
+++ b/test/SemaCXX/overload-member-call.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X {
int& f(int) const; // expected-note 2 {{candidate function}}
diff --git a/test/SemaCXX/overload-value-dep-arg.cpp b/test/SemaCXX/overload-value-dep-arg.cpp
index 1e94d5a30136..c1834a722577 100644
--- a/test/SemaCXX/overload-value-dep-arg.cpp
+++ b/test/SemaCXX/overload-value-dep-arg.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class C {
C(void*);
diff --git a/test/SemaCXX/overloaded-builtin-operators.cpp b/test/SemaCXX/overloaded-builtin-operators.cpp
index fd0cbc6c8643..12903cc7facf 100644
--- a/test/SemaCXX/overloaded-builtin-operators.cpp
+++ b/test/SemaCXX/overloaded-builtin-operators.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct yes;
struct no;
diff --git a/test/SemaCXX/overloaded-operator-decl.cpp b/test/SemaCXX/overloaded-operator-decl.cpp
index fc17faf6634f..c43d7c217cca 100644
--- a/test/SemaCXX/overloaded-operator-decl.cpp
+++ b/test/SemaCXX/overloaded-operator-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X {
X();
X(int);
diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp
index 672b8b4fc266..a20c69b8d5d1 100644
--- a/test/SemaCXX/overloaded-operator.cpp
+++ b/test/SemaCXX/overloaded-operator.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class X { };
X operator+(X, X);
diff --git a/test/SemaCXX/prefetch-enum.cpp b/test/SemaCXX/prefetch-enum.cpp
index 829321fb0e91..3c77dae70ff5 100644
--- a/test/SemaCXX/prefetch-enum.cpp
+++ b/test/SemaCXX/prefetch-enum.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -verify
+// RUN: %clang_cc1 -fsyntax-only %s -verify
// PR5679
enum X { A = 3 };
diff --git a/test/SemaCXX/primary-base.cpp b/test/SemaCXX/primary-base.cpp
index a7e18bd528a1..a6cbbad2427a 100644
--- a/test/SemaCXX/primary-base.cpp
+++ b/test/SemaCXX/primary-base.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class A { virtual void f(); };
class B : virtual A { };
diff --git a/test/SemaCXX/pseudo-destructors.cpp b/test/SemaCXX/pseudo-destructors.cpp
index 8f69def9fd4f..15e37c588202 100644
--- a/test/SemaCXX/pseudo-destructors.cpp
+++ b/test/SemaCXX/pseudo-destructors.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {};
enum Foo { F };
diff --git a/test/SemaCXX/ptrtomember-badcall.cpp b/test/SemaCXX/ptrtomember-badcall.cpp
index 42b8e3b6e0c9..fb774d85e3e4 100644
--- a/test/SemaCXX/ptrtomember-badcall.cpp
+++ b/test/SemaCXX/ptrtomember-badcall.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
struct S {
int i;
diff --git a/test/SemaCXX/ptrtomember-overload-resolution.cpp b/test/SemaCXX/ptrtomember-overload-resolution.cpp
index b3b65ce840cb..4c7908e1137e 100644
--- a/test/SemaCXX/ptrtomember-overload-resolution.cpp
+++ b/test/SemaCXX/ptrtomember-overload-resolution.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
// 13.3.3.2 Ranking implicit conversion sequences
// conversion of A::* to B::* is better than conversion of A::* to C::*,
diff --git a/test/SemaCXX/qual-id-test.cpp b/test/SemaCXX/qual-id-test.cpp
index 02e69996c772..00dc662d0670 100644
--- a/test/SemaCXX/qual-id-test.cpp
+++ b/test/SemaCXX/qual-id-test.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace A
{
namespace B
@@ -137,4 +137,4 @@ struct a {
a a;
-int a::sa = a.a;
+int a::sa = a.a; // expected-error {{invalid use of nonstatic data member 'a'}}
diff --git a/test/SemaCXX/qualification-conversion.cpp b/test/SemaCXX/qualification-conversion.cpp
index 01e503ddac6c..f1af5bf2852d 100644
--- a/test/SemaCXX/qualification-conversion.cpp
+++ b/test/SemaCXX/qualification-conversion.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
int* quals1(int const * p);
int* quals2(int const * const * pp);
int* quals3(int const * * const * ppp); // expected-note{{candidate function}}
@@ -21,3 +21,14 @@ void test_mquals(int A::*p, int A::* A::*pp, int A::* A::* A::*ppp) {
mquals2(pp);
mquals3(ppp); // expected-error {{no matching}}
}
+
+void aquals1(int const (*p)[1]);
+void aquals2(int * const (*pp)[1]);
+void aquals2a(int const * (*pp2)[1]); // expected-note{{candidate function}}
+
+void test_aquals(int (*p)[1], int * (*pp)[1], int * (*pp2)[1]) {
+ int const (*p2)[1] = p;
+ aquals1(p);
+ aquals2(pp);
+ aquals2a(pp2); // expected-error {{no matching}}
+}
diff --git a/test/SemaCXX/qualified-id-lookup.cpp b/test/SemaCXX/qualified-id-lookup.cpp
index 5a11a0cd07b8..a187d4908cd4 100644
--- a/test/SemaCXX/qualified-id-lookup.cpp
+++ b/test/SemaCXX/qualified-id-lookup.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace Ns {
int f(); // expected-note{{previous declaration is here}}
diff --git a/test/SemaCXX/qualified-names-diag.cpp b/test/SemaCXX/qualified-names-diag.cpp
index 3bffd7c05d3b..86c10888b8a2 100644
--- a/test/SemaCXX/qualified-names-diag.cpp
+++ b/test/SemaCXX/qualified-names-diag.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace foo {
namespace wibble {
struct x { int y; };
diff --git a/test/SemaCXX/qualified-names-print.cpp b/test/SemaCXX/qualified-names-print.cpp
index 1cb19f0312e4..2099268a1a92 100644
--- a/test/SemaCXX/qualified-names-print.cpp
+++ b/test/SemaCXX/qualified-names-print.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -ast-print %s 2>&1 | grep "N::M::X<INT>::value"
+// RUN: %clang_cc1 -ast-print %s 2>&1 | grep "N::M::X<INT>::value"
namespace N {
namespace M {
template<typename T>
diff --git a/test/SemaCXX/ref-init-ambiguous.cpp b/test/SemaCXX/ref-init-ambiguous.cpp
index 60620993b43c..976879ecd0ae 100644
--- a/test/SemaCXX/ref-init-ambiguous.cpp
+++ b/test/SemaCXX/ref-init-ambiguous.cpp
@@ -1,21 +1,20 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
enum E2 { };
struct A {
- operator E2&(); // expected-note 2 {{candidate function}}
+ operator E2&(); // expected-note 3 {{candidate function}}
};
struct B {
- operator E2&(); // expected-note 2 {{candidate function}}
+ operator E2&(); // expected-note 3 {{candidate function}}
};
struct C : B, A {
};
void test(C c) {
- // FIXME: state that there was an ambiguity in the conversion!
- const E2 &e2 = c; // expected-error {{reference to type 'enum E2 const' could not bind to an lvalue of type 'struct C'}}
+ const E2 &e2 = c; // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}}
}
void foo(const E2 &);
diff --git a/test/SemaCXX/references.cpp b/test/SemaCXX/references.cpp
index 45d3923ff0ad..630f53f2839e 100644
--- a/test/SemaCXX/references.cpp
+++ b/test/SemaCXX/references.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int g(int);
void f() {
diff --git a/test/SemaCXX/reinterpret-cast.cpp b/test/SemaCXX/reinterpret-cast.cpp
index bfe8887bd3d3..da675609d123 100644
--- a/test/SemaCXX/reinterpret-cast.cpp
+++ b/test/SemaCXX/reinterpret-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stdint.h>
diff --git a/test/SemaCXX/reinterpret-fn-obj-pedantic.cpp b/test/SemaCXX/reinterpret-fn-obj-pedantic.cpp
index 16b8659711e2..09d08f95ee28 100644
--- a/test/SemaCXX/reinterpret-fn-obj-pedantic.cpp
+++ b/test/SemaCXX/reinterpret-fn-obj-pedantic.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++98 -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 -pedantic %s
void fnptrs()
{
diff --git a/test/SemaCXX/return-stack-addr.cpp b/test/SemaCXX/return-stack-addr.cpp
index 457de297b008..ba6476560360 100644
--- a/test/SemaCXX/return-stack-addr.cpp
+++ b/test/SemaCXX/return-stack-addr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int* ret_local() {
int x = 1;
diff --git a/test/SemaCXX/return.cpp b/test/SemaCXX/return.cpp
index 03b0ddb87965..e682fdfb5009 100644
--- a/test/SemaCXX/return.cpp
+++ b/test/SemaCXX/return.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
int test1() {
throw;
diff --git a/test/SemaCXX/rval-references-xfail.cpp b/test/SemaCXX/rval-references-xfail.cpp
new file mode 100644
index 000000000000..d41f8f141cde
--- /dev/null
+++ b/test/SemaCXX/rval-references-xfail.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// XFAIL: *
+struct MoveOnly {
+ MoveOnly();
+ MoveOnly(const MoveOnly&) = delete; // expected-note {{candidate function}} \
+ // expected-note 3{{explicitly marked deleted here}}
+ MoveOnly(MoveOnly&&); // expected-note {{candidate function}}
+ MoveOnly(int&&); // expected-note {{candidate function}}
+};
+
+MoveOnly returning() {
+ MoveOnly mo;
+ return mo;
+}
diff --git a/test/SemaCXX/rval-references.cpp b/test/SemaCXX/rval-references.cpp
index 7a71607707c8..7ff3d584c02e 100644
--- a/test/SemaCXX/rval-references.cpp
+++ b/test/SemaCXX/rval-references.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
typedef int&& irr;
typedef irr& ilr_c1; // Collapses to int&
@@ -65,27 +65,23 @@ int&& should_not_warn(int&& i) { // But GCC 4.4 does
// Test the return dance. This also tests IsReturnCopyElidable.
struct MoveOnly {
MoveOnly();
- MoveOnly(const MoveOnly&) = delete; // expected-note {{candidate function}}
+ MoveOnly(const MoveOnly&) = delete; // expected-note {{candidate function}} \
+ // expected-note 3{{explicitly marked deleted here}}
MoveOnly(MoveOnly&&); // expected-note {{candidate function}}
MoveOnly(int&&); // expected-note {{candidate function}}
};
-MoveOnly returning() {
- MoveOnly mo;
- return mo;
-}
-
MoveOnly gmo;
MoveOnly returningNonEligible() {
int i;
static MoveOnly mo;
MoveOnly &r = mo;
if (0) // Copy from global can't be elided
- return gmo; // expected-error {{incompatible type returning}}
+ return gmo; // expected-error {{call to deleted constructor}}
else if (0) // Copy from local static can't be elided
- return mo; // expected-error {{incompatible type returning}}
+ return mo; // expected-error {{call to deleted constructor}}
else if (0) // Copy from reference can't be elided
- return r; // expected-error {{incompatible type returning}}
+ return r; // expected-error {{call to deleted constructor}}
else // Construction from different type can't be elided
return i; // expected-error {{no viable conversion from 'int' to 'struct MoveOnly'}}
}
diff --git a/test/SemaCXX/statements.cpp b/test/SemaCXX/statements.cpp
index d6925fe032e9..36982582fa12 100644
--- a/test/SemaCXX/statements.cpp
+++ b/test/SemaCXX/statements.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -pedantic
+// RUN: %clang_cc1 %s -fsyntax-only -pedantic
void foo() {
return foo();
diff --git a/test/SemaCXX/static-array-member.cpp b/test/SemaCXX/static-array-member.cpp
index dac70cd2eabf..8f575491b245 100644
--- a/test/SemaCXX/static-array-member.cpp
+++ b/test/SemaCXX/static-array-member.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
struct X0 {
static int array[];
diff --git a/test/SemaCXX/static-assert.cpp b/test/SemaCXX/static-assert.cpp
index caf76033af70..62208cd2aeeb 100644
--- a/test/SemaCXX/static-assert.cpp
+++ b/test/SemaCXX/static-assert.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
int f();
diff --git a/test/SemaCXX/static-cast-complete-type.cpp b/test/SemaCXX/static-cast-complete-type.cpp
index 83583a5adf8e..11bf22dfe899 100644
--- a/test/SemaCXX/static-cast-complete-type.cpp
+++ b/test/SemaCXX/static-cast-complete-type.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> struct S {
S(int);
};
diff --git a/test/SemaCXX/static-cast.cpp b/test/SemaCXX/static-cast.cpp
index d3962727b806..cdaa843b8170 100644
--- a/test/SemaCXX/static-cast.cpp
+++ b/test/SemaCXX/static-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -faccess-control %s
+// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control %s
struct A {};
struct B : public A {}; // Single public base.
struct C1 : public virtual B {}; // Single virtual base.
diff --git a/test/SemaCXX/static-initializers.cpp b/test/SemaCXX/static-initializers.cpp
index a651243df7ef..ca49fce052e3 100644
--- a/test/SemaCXX/static-initializers.cpp
+++ b/test/SemaCXX/static-initializers.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int f() {
return 10;
}
diff --git a/test/SemaCXX/struct-class-redecl.cpp b/test/SemaCXX/struct-class-redecl.cpp
index 4b6cef6dd2bf..d3d6d79ea82e 100644
--- a/test/SemaCXX/struct-class-redecl.cpp
+++ b/test/SemaCXX/struct-class-redecl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -Wmismatched-tags -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wmismatched-tags -verify %s
class X; // expected-note 2{{here}}
typedef struct X * X_t; // expected-warning{{previously declared}}
diff --git a/test/SemaCXX/switch-0x.cpp b/test/SemaCXX/switch-0x.cpp
index c1f6bd9d19a8..adaeb85bce17 100644
--- a/test/SemaCXX/switch-0x.cpp
+++ b/test/SemaCXX/switch-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
// PR5518
struct A {
diff --git a/test/SemaCXX/switch.cpp b/test/SemaCXX/switch.cpp
index 003d5b8b9c08..c256960af1da 100644
--- a/test/SemaCXX/switch.cpp
+++ b/test/SemaCXX/switch.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void test() {
bool x = true;
diff --git a/test/SemaCXX/this.cpp b/test/SemaCXX/this.cpp
index 0577d3c2b9bf..167755f0a74d 100644
--- a/test/SemaCXX/this.cpp
+++ b/test/SemaCXX/this.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int x = this; // expected-error {{error: invalid use of 'this' outside of a nonstatic member function}}
void f() {
diff --git a/test/SemaCXX/trivial-constructor.cpp b/test/SemaCXX/trivial-constructor.cpp
index 8fc14d9c82cb..494d1ec0843f 100644
--- a/test/SemaCXX/trivial-constructor.cpp
+++ b/test/SemaCXX/trivial-constructor.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
struct T1 {
};
static_assert(__has_trivial_constructor(T1), "T1 has trivial constructor!");
diff --git a/test/SemaCXX/trivial-destructor.cpp b/test/SemaCXX/trivial-destructor.cpp
index 9e7f3a16dd66..29358d8bd228 100644
--- a/test/SemaCXX/trivial-destructor.cpp
+++ b/test/SemaCXX/trivial-destructor.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
struct T1 {
};
static_assert(__has_trivial_destructor(T1), "T1 has trivial destructor!");
diff --git a/test/SemaCXX/type-convert-construct.cpp b/test/SemaCXX/type-convert-construct.cpp
index 1840456bde8e..d786a9a8a6fc 100644
--- a/test/SemaCXX/type-convert-construct.cpp
+++ b/test/SemaCXX/type-convert-construct.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f() {
float v1 = float(1);
diff --git a/test/SemaCXX/type-definition-in-specifier.cpp b/test/SemaCXX/type-definition-in-specifier.cpp
index 60c28b0f5e43..a614e6c2812e 100644
--- a/test/SemaCXX/type-definition-in-specifier.cpp
+++ b/test/SemaCXX/type-definition-in-specifier.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct S0;
struct S1;
diff --git a/test/SemaCXX/type-dependent-exprs.cpp b/test/SemaCXX/type-dependent-exprs.cpp
index dd31ef020c6a..abe1b4d730ca 100644
--- a/test/SemaCXX/type-dependent-exprs.cpp
+++ b/test/SemaCXX/type-dependent-exprs.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class X {
public:
virtual int f();
@@ -19,6 +19,6 @@ T f(T x) {
return g(x);
h(x); // h is a dependent name
g(1, 1); // expected-error{{no matching function for call}}
- h(1); // expected-error{{no matching function for call to 'h'}}
+ h(1); // expected-error{{use of undeclared identifier 'h'}}
return 0;
}
diff --git a/test/SemaCXX/type-traits-incomplete.cpp b/test/SemaCXX/type-traits-incomplete.cpp
index ac8ec452b93f..0ef6917c5911 100644
--- a/test/SemaCXX/type-traits-incomplete.cpp
+++ b/test/SemaCXX/type-traits-incomplete.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct S; // expected-note{{forward declaration of 'struct S'}}
diff --git a/test/SemaCXX/type-traits.cpp b/test/SemaCXX/type-traits.cpp
index dfb4edce67c8..85bd59612688 100644
--- a/test/SemaCXX/type-traits.cpp
+++ b/test/SemaCXX/type-traits.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#define T(b) (b) ? 1 : -1
#define F(b) (b) ? -1 : 1
@@ -257,4 +257,4 @@ template<typename> struct B : A { };
void f() {
int t01[T(!__has_trivial_destructor(A))];
int t02[T(!__has_trivial_destructor(B<int>))];
-} \ No newline at end of file
+}
diff --git a/test/SemaCXX/typedef-redecl.cpp b/test/SemaCXX/typedef-redecl.cpp
index e38f47436d1c..0d8dc8487bf7 100644
--- a/test/SemaCXX/typedef-redecl.cpp
+++ b/test/SemaCXX/typedef-redecl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef int INT;
typedef INT REALLY_INT; // expected-note {{previous definition is here}}
typedef REALLY_INT REALLY_REALLY_INT;
@@ -29,3 +29,11 @@ typedef I I;
struct s { };
+// PR5874
+namespace test1 {
+ typedef int foo;
+ namespace a { using test1::foo; };
+ typedef int foo;
+ using namespace a;
+ foo x;
+}
diff --git a/test/SemaCXX/typeid.cpp b/test/SemaCXX/typeid.cpp
index f9ad7592187c..7960cac78310 100644
--- a/test/SemaCXX/typeid.cpp
+++ b/test/SemaCXX/typeid.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f()
{
@@ -14,3 +14,11 @@ void g()
{
(void)typeid(int);
}
+
+struct X; // expected-note 3{{forward declaration}}
+
+void g1(X &x) {
+ (void)typeid(X); // expected-error{{'typeid' of incomplete type 'struct X'}}
+ (void)typeid(X&); // expected-error{{'typeid' of incomplete type 'struct X'}}
+ (void)typeid(x); // expected-error{{'typeid' of incomplete type 'struct X'}}
+}
diff --git a/test/SemaCXX/types_compatible_p.cpp b/test/SemaCXX/types_compatible_p.cpp
index 30b16006c685..4aa9a1cfa939 100644
--- a/test/SemaCXX/types_compatible_p.cpp
+++ b/test/SemaCXX/types_compatible_p.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
bool f() {
return __builtin_types_compatible_p(int, const int); // expected-error{{C++}}
diff --git a/test/SemaCXX/unknown-type-name.cpp b/test/SemaCXX/unknown-type-name.cpp
index 054212951338..084a81104d55 100644
--- a/test/SemaCXX/unknown-type-name.cpp
+++ b/test/SemaCXX/unknown-type-name.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR3990
namespace N {
diff --git a/test/SemaCXX/unreachable-catch-clauses.cpp b/test/SemaCXX/unreachable-catch-clauses.cpp
index c8b642e7ab53..9fc4aef44a04 100644
--- a/test/SemaCXX/unreachable-catch-clauses.cpp
+++ b/test/SemaCXX/unreachable-catch-clauses.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class BaseEx {};
class Ex1: public BaseEx {};
diff --git a/test/SemaCXX/unused.cpp b/test/SemaCXX/unused.cpp
index 55f959de0f02..6fd108186afa 100644
--- a/test/SemaCXX/unused.cpp
+++ b/test/SemaCXX/unused.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR4103 : Make sure we don't get a bogus unused expression warning
class APInt {
char foo;
diff --git a/test/SemaCXX/user-defined-conversions.cpp b/test/SemaCXX/user-defined-conversions.cpp
index 0a4bb773d396..4367f4b8a353 100644
--- a/test/SemaCXX/user-defined-conversions.cpp
+++ b/test/SemaCXX/user-defined-conversions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X {
operator bool();
};
diff --git a/test/SemaCXX/using-decl-1.cpp b/test/SemaCXX/using-decl-1.cpp
index 0235624a8ea5..e8a7d70976ec 100644
--- a/test/SemaCXX/using-decl-1.cpp
+++ b/test/SemaCXX/using-decl-1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
extern "C" { void f(bool); }
@@ -42,3 +42,21 @@ struct X1 : X0 {
struct A { void f(); };
struct B : A { };
class C : B { using B::f; };
+
+// PR5751: Resolve overloaded functions through using decls.
+namespace O {
+ void f(int i);
+ void f(double d);
+}
+namespace P {
+ void f();
+ void g(void (*ptr)(int));
+ using O::f;
+ void test() {
+ f();
+ f(1);
+ void (*f_ptr1)(double) = f;
+ void (*f_ptr2)() = f;
+ g(f);
+ }
+}
diff --git a/test/SemaCXX/using-decl-pr4441.cpp b/test/SemaCXX/using-decl-pr4441.cpp
index 6aa2b261e4db..39a446fed9ac 100644
--- a/test/SemaCXX/using-decl-pr4441.cpp
+++ b/test/SemaCXX/using-decl-pr4441.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace A {
struct B { };
diff --git a/test/SemaCXX/using-decl-pr4450.cpp b/test/SemaCXX/using-decl-pr4450.cpp
index c3d5b8300624..4f929ad15f5f 100644
--- a/test/SemaCXX/using-decl-pr4450.cpp
+++ b/test/SemaCXX/using-decl-pr4450.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace A {
void g();
diff --git a/test/SemaCXX/using-decl-templates.cpp b/test/SemaCXX/using-decl-templates.cpp
index a19223d479d0..8f2876ce4b32 100644
--- a/test/SemaCXX/using-decl-templates.cpp
+++ b/test/SemaCXX/using-decl-templates.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> struct A {
void f() { }
diff --git a/test/SemaCXX/using-directive.cpp b/test/SemaCXX/using-directive.cpp
index b7583f27cb64..0d5c8400ab7e 100644
--- a/test/SemaCXX/using-directive.cpp
+++ b/test/SemaCXX/using-directive.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace A {
short i; // expected-note 2{{candidate found by name lookup is 'A::i'}}
diff --git a/test/SemaCXX/value-dependent-exprs.cpp b/test/SemaCXX/value-dependent-exprs.cpp
index c70f895d2bf9..2017ffa67c90 100644
--- a/test/SemaCXX/value-dependent-exprs.cpp
+++ b/test/SemaCXX/value-dependent-exprs.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -verify %s
+// RUN: %clang_cc1 -verify %s
template <unsigned I>
class C0 {
diff --git a/test/SemaCXX/value-initialization.cpp b/test/SemaCXX/value-initialization.cpp
index 25d708494b1a..d6a86c4c8cb5 100644
--- a/test/SemaCXX/value-initialization.cpp
+++ b/test/SemaCXX/value-initialization.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
struct A { // expected-error {{implicit default constructor for 'struct A' must explicitly initialize the const member 'i'}}
const int i; // expected-note {{declared at}}
diff --git a/test/SemaCXX/vararg-default-arg.cpp b/test/SemaCXX/vararg-default-arg.cpp
index 5ba032027742..3c8e41cb3e35 100644
--- a/test/SemaCXX/vararg-default-arg.cpp
+++ b/test/SemaCXX/vararg-default-arg.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
// PR5462
void f1(void);
diff --git a/test/SemaCXX/vararg-non-pod.cpp b/test/SemaCXX/vararg-non-pod.cpp
index f913531a27d0..5f95446d41f2 100644
--- a/test/SemaCXX/vararg-non-pod.cpp
+++ b/test/SemaCXX/vararg-non-pod.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -fblocks %s -Wnon-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wnon-pod-varargs
extern char version[];
diff --git a/test/SemaCXX/vector-casts.cpp b/test/SemaCXX/vector-casts.cpp
index 5b08043545fa..6ee619ef0647 100644
--- a/test/SemaCXX/vector-casts.cpp
+++ b/test/SemaCXX/vector-casts.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef int __v2si __attribute__((__vector_size__(8)));
typedef short __v4hi __attribute__((__vector_size__(8)));
typedef short __v8hi __attribute__((__vector_size__(16)));
diff --git a/test/SemaCXX/virtual-member-functions-key-function.cpp b/test/SemaCXX/virtual-member-functions-key-function.cpp
index 4e7ff69b2edf..3d048595e94e 100644
--- a/test/SemaCXX/virtual-member-functions-key-function.cpp
+++ b/test/SemaCXX/virtual-member-functions-key-function.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
virtual ~A();
};
diff --git a/test/SemaCXX/virtual-override.cpp b/test/SemaCXX/virtual-override.cpp
index c18a77f036bb..4fdac85040be 100644
--- a/test/SemaCXX/virtual-override.cpp
+++ b/test/SemaCXX/virtual-override.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
namespace T1 {
class A {
@@ -104,6 +104,35 @@ namespace T7 {
};
}
+namespace T8 {
+ struct a { };
+ struct b; // expected-note {{forward declaration of 'struct T8::b'}}
+
+ class A {
+ virtual a *f();
+ };
+
+ class B : A {
+ b* f(); // expected-error {{return type of virtual function 'f' is not covariant with the return type of the function it overrides ('struct T8::b' is incomplete)}}
+ };
+}
+
+namespace T9 {
+ struct a { };
+
+ template<typename T> struct b : a {
+ int a[sizeof(T) ? -1 : -1]; // expected-error {{array size is negative}}
+ };
+
+ class A {
+ virtual a *f();
+ };
+
+ class B : A {
+ virtual b<int> *f(); // expected-note {{in instantiation of template class 'struct T9::b<int>' requested here}}
+ };
+}
+
// PR5656
class X0 {
virtual void f0();
@@ -150,3 +179,21 @@ void test3() {
Bar3<int> b3i; // okay
Bar3<float> b3f; // expected-error{{is an abstract class}}
}
+
+// 5920
+namespace PR5920 {
+ class Base {};
+
+ template <typename T>
+ class Derived : public Base {};
+
+ class Foo {
+ public:
+ virtual Base* Method();
+ };
+
+ class Bar : public Foo {
+ public:
+ virtual Derived<int>* Method();
+ };
+}
diff --git a/test/SemaCXX/virtuals.cpp b/test/SemaCXX/virtuals.cpp
index c2ac77b30479..792467e5f86b 100644
--- a/test/SemaCXX/virtuals.cpp
+++ b/test/SemaCXX/virtuals.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class A {
virtual void f();
diff --git a/test/SemaCXX/warn-assignment-condition.cpp b/test/SemaCXX/warn-assignment-condition.cpp
index 3b9f3066a16b..1df906dd7ec6 100644
--- a/test/SemaCXX/warn-assignment-condition.cpp
+++ b/test/SemaCXX/warn-assignment-condition.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -Wparentheses -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wparentheses -verify %s
struct A {
int foo();
diff --git a/test/SemaCXX/warn-char-subscripts.cpp b/test/SemaCXX/warn-char-subscripts.cpp
index 1c06db91c3f7..84ea536b979e 100644
--- a/test/SemaCXX/warn-char-subscripts.cpp
+++ b/test/SemaCXX/warn-char-subscripts.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -Wchar-subscripts -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wchar-subscripts -fsyntax-only -verify %s
template<typename T>
void t1() {
diff --git a/test/SemaCXX/warn-for-var-in-else.cpp b/test/SemaCXX/warn-for-var-in-else.cpp
index c46b30640fb2..1307c43bc20a 100644
--- a/test/SemaCXX/warn-for-var-in-else.cpp
+++ b/test/SemaCXX/warn-for-var-in-else.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar://6425550
int bar();
void do_something(int);
diff --git a/test/SemaCXX/warn-missing-prototypes.cpp b/test/SemaCXX/warn-missing-prototypes.cpp
index 079a83725223..b6ebe820f39c 100644
--- a/test/SemaCXX/warn-missing-prototypes.cpp
+++ b/test/SemaCXX/warn-missing-prototypes.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -Wmissing-prototypes %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-prototypes %s
void f() { } // expected-warning {{no previous prototype for function 'f'}}
diff --git a/test/SemaCXX/warn-reorder-ctor-initialization.cpp b/test/SemaCXX/warn-reorder-ctor-initialization.cpp
index bfce588b570a..35b32b26a066 100644
--- a/test/SemaCXX/warn-reorder-ctor-initialization.cpp
+++ b/test/SemaCXX/warn-reorder-ctor-initialization.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -Wreorder -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wreorder -verify %s
struct BB {};
diff --git a/test/SemaCXX/warn-unused-variables.cpp b/test/SemaCXX/warn-unused-variables.cpp
index 019863686d32..5620248f5005 100644
--- a/test/SemaCXX/warn-unused-variables.cpp
+++ b/test/SemaCXX/warn-unused-variables.cpp
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -Wunused-variable -verify %s
+// RUN: %clang -fsyntax-only -Wunused-variable -verify %s
template<typename T> void f() {
T t;
@@ -32,3 +32,14 @@ namespace PR5531 {
C();
}
}
+
+
+struct X {
+ int foo() __attribute__((warn_unused_result));
+};
+
+void bah() {
+ X x, *x2;
+ x.foo(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
+ x2->foo(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
+}
diff --git a/test/SemaCXX/wchar_t.cpp b/test/SemaCXX/wchar_t.cpp
index cb85bc3ae729..789dbf643863 100644
--- a/test/SemaCXX/wchar_t.cpp
+++ b/test/SemaCXX/wchar_t.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
wchar_t x;
void f(wchar_t p) {
@@ -11,3 +11,17 @@ void f(wchar_t p) {
// PR4502
wchar_t const c = L'c';
int a[c == L'c' ? 1 : -1];
+
+
+// PR5917
+template<typename _CharT>
+struct basic_string {
+};
+
+template<typename _CharT>
+basic_string<_CharT> operator+ (const basic_string<_CharT>&, _CharT);
+
+int t(void) {
+ basic_string<wchar_t>() + L'-';
+ return (0);
+}
diff --git a/test/SemaObjC/ContClassPropertyLookup.m b/test/SemaObjC/ContClassPropertyLookup.m
index 46bcc5365fdd..b3459c13e413 100644
--- a/test/SemaObjC/ContClassPropertyLookup.m
+++ b/test/SemaObjC/ContClassPropertyLookup.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface MyObject {
int _foo;
diff --git a/test/SemaObjC/DoubleMethod.m b/test/SemaObjC/DoubleMethod.m
index e92a017f2930..98aa699a0fce 100644
--- a/test/SemaObjC/DoubleMethod.m
+++ b/test/SemaObjC/DoubleMethod.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Subclass
{
diff --git a/test/SemaObjC/access-property-getter.m b/test/SemaObjC/access-property-getter.m
index 1bd5c33f5106..331bb30dd539 100644
--- a/test/SemaObjC/access-property-getter.m
+++ b/test/SemaObjC/access-property-getter.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify %s
+// RUN: %clang_cc1 -verify %s
@protocol NSObject
- (oneway void)release;
diff --git a/test/SemaObjC/alias-test-1.m b/test/SemaObjC/alias-test-1.m
index e946c3eb1ecb..2cea115b429e 100644
--- a/test/SemaObjC/alias-test-1.m
+++ b/test/SemaObjC/alias-test-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@compatibility_alias alias4 foo; // expected-warning {{cannot find interface declaration for 'foo'}}
diff --git a/test/SemaObjC/alias-test-2.m b/test/SemaObjC/alias-test-2.m
index 976e2a3758c7..1f12b76055e8 100644
--- a/test/SemaObjC/alias-test-2.m
+++ b/test/SemaObjC/alias-test-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Note: GCC doesn't produce any of the following errors.
@interface Super @end // expected-note {{previous definition is here}}
diff --git a/test/SemaObjC/argument-checking.m b/test/SemaObjC/argument-checking.m
index c4ada44c5122..3806a4c96530 100644
--- a/test/SemaObjC/argument-checking.m
+++ b/test/SemaObjC/argument-checking.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
struct S { int a; };
diff --git a/test/SemaObjC/at-defs.m b/test/SemaObjC/at-defs.m
index 03c9c76e3b2c..bfa212375050 100644
--- a/test/SemaObjC/at-defs.m
+++ b/test/SemaObjC/at-defs.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-unknown-unknown %s -fsyntax-only
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -fsyntax-only
@interface Test {
double a;
diff --git a/test/SemaObjC/atomoic-property-synnthesis-rules.m b/test/SemaObjC/atomoic-property-synnthesis-rules.m
index 42b173b78704..af790e3159ad 100644
--- a/test/SemaObjC/atomoic-property-synnthesis-rules.m
+++ b/test/SemaObjC/atomoic-property-synnthesis-rules.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
/*
Conditions for warning:
diff --git a/test/SemaObjC/attr-cleanup.m b/test/SemaObjC/attr-cleanup.m
index 821da000a3c1..8415c698f348 100644
--- a/test/SemaObjC/attr-cleanup.m
+++ b/test/SemaObjC/attr-cleanup.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
@class NSString;
diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m
index 675f96963280..a58068bf8324 100644
--- a/test/SemaObjC/attr-deprecated.m
+++ b/test/SemaObjC/attr-deprecated.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
@interface A {
int X __attribute__((deprecated));
diff --git a/test/SemaObjC/attr-malloc.m b/test/SemaObjC/attr-malloc.m
index 4d2093fa3d4f..a504b333b51f 100644
--- a/test/SemaObjC/attr-malloc.m
+++ b/test/SemaObjC/attr-malloc.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify -fsyntax-only -fblocks %s
+// RUN: %clang_cc1 -verify -fsyntax-only -fblocks %s
@interface TestAttrMallocOnMethods {}
- (id) test1 __attribute((malloc)); // expected-warning {{functions returning a pointer type}}
diff --git a/test/SemaObjC/attr-objc-exception.m b/test/SemaObjC/attr-objc-exception.m
index 3e012c748230..b497271521e2 100644
--- a/test/SemaObjC/attr-objc-exception.m
+++ b/test/SemaObjC/attr-objc-exception.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
__attribute__((__objc_exception__))
@interface NSException {
diff --git a/test/SemaObjC/attr-objc-gc.m b/test/SemaObjC/attr-objc-gc.m
index 90ca4e3280c2..47da653afe6e 100644
--- a/test/SemaObjC/attr-objc-gc.m
+++ b/test/SemaObjC/attr-objc-gc.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
static id __attribute((objc_gc(weak))) a;
static id __attribute((objc_gc(strong))) b;
diff --git a/test/SemaObjC/bad-receiver-1.m b/test/SemaObjC/bad-receiver-1.m
index 52509753d8a2..094c12f7d81b 100644
--- a/test/SemaObjC/bad-receiver-1.m
+++ b/test/SemaObjC/bad-receiver-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface I
- (id) retain;
diff --git a/test/SemaObjC/block-attr.m b/test/SemaObjC/block-attr.m
index 885a94649393..c89aed4bb60d 100644
--- a/test/SemaObjC/block-attr.m
+++ b/test/SemaObjC/block-attr.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks -fobjc-gc-only %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks -fobjc-gc-only %s
@interface Thing {}
diff --git a/test/SemaObjC/block-explicit-return-type.m b/test/SemaObjC/block-explicit-return-type.m
index 6e9728613a8e..22e5b6f75106 100644
--- a/test/SemaObjC/block-explicit-return-type.m
+++ b/test/SemaObjC/block-explicit-return-type.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only %s -verify -fblocks
+// RUN: %clang_cc1 -fsyntax-only %s -verify -fblocks
// FIXME: should compile
// Test for blocks with explicit return type specified.
diff --git a/test/SemaObjC/block-ivar.m b/test/SemaObjC/block-ivar.m
index 5dbefdcbaad9..c7ea1d96a05b 100644
--- a/test/SemaObjC/block-ivar.m
+++ b/test/SemaObjC/block-ivar.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s -fblocks
+// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
@interface NSObject {
struct objc_object *isa;
diff --git a/test/SemaObjC/blocks.m b/test/SemaObjC/blocks.m
index c16372bcc421..36292309732b 100644
--- a/test/SemaObjC/blocks.m
+++ b/test/SemaObjC/blocks.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify -fblocks %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
@protocol NSObject;
void bar(id(^)(void));
diff --git a/test/SemaObjC/call-super-2.m b/test/SemaObjC/call-super-2.m
index f3d0a9676039..9be853b81f8a 100644
--- a/test/SemaObjC/call-super-2.m
+++ b/test/SemaObjC/call-super-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stddef.h>
diff --git a/test/SemaObjC/catch-stmt.m b/test/SemaObjC/catch-stmt.m
index eb570c02edfc..80c986ff5447 100644
--- a/test/SemaObjC/catch-stmt.m
+++ b/test/SemaObjC/catch-stmt.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify %s
+// RUN: %clang_cc1 -verify %s
@protocol P;
diff --git a/test/SemaObjC/category-1.m b/test/SemaObjC/category-1.m
index 588261891131..17c6b4620274 100644
--- a/test/SemaObjC/category-1.m
+++ b/test/SemaObjC/category-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface MyClass1 @end
diff --git a/test/SemaObjC/category-method-lookup-2.m b/test/SemaObjC/category-method-lookup-2.m
index ea828d9a3bcb..a31d824d1d45 100644
--- a/test/SemaObjC/category-method-lookup-2.m
+++ b/test/SemaObjC/category-method-lookup-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct objc_class *Class;
@interface NSObject
diff --git a/test/SemaObjC/category-method-lookup.m b/test/SemaObjC/category-method-lookup.m
index 9b880c4ac707..27a10e556c28 100644
--- a/test/SemaObjC/category-method-lookup.m
+++ b/test/SemaObjC/category-method-lookup.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Foo
@end
diff --git a/test/SemaObjC/check-dup-decl-methods-1.m b/test/SemaObjC/check-dup-decl-methods-1.m
index edcd3be518a3..1dd6446e84ca 100644
--- a/test/SemaObjC/check-dup-decl-methods-1.m
+++ b/test/SemaObjC/check-dup-decl-methods-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface SUPER
- (int) meth;
diff --git a/test/SemaObjC/check-dup-objc-decls-1.m b/test/SemaObjC/check-dup-objc-decls-1.m
index 434f8ddae51e..1f80293588a6 100644
--- a/test/SemaObjC/check-dup-objc-decls-1.m
+++ b/test/SemaObjC/check-dup-objc-decls-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Foo // expected-note {{previous definition is here}}
@end
diff --git a/test/SemaObjC/class-bitfield.m b/test/SemaObjC/class-bitfield.m
index d6d9855b2952..d1525622429e 100644
--- a/test/SemaObjC/class-bitfield.m
+++ b/test/SemaObjC/class-bitfield.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
@interface X
{
diff --git a/test/SemaObjC/class-conforming-protocol-1.m b/test/SemaObjC/class-conforming-protocol-1.m
index e2889c3f9d3b..43ea6d34d1bb 100644
--- a/test/SemaObjC/class-conforming-protocol-1.m
+++ b/test/SemaObjC/class-conforming-protocol-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P1 @end
@protocol P2 @end
diff --git a/test/SemaObjC/class-conforming-protocol-2.m b/test/SemaObjC/class-conforming-protocol-2.m
index 550bafd60f71..fcf9146a110f 100644
--- a/test/SemaObjC/class-conforming-protocol-2.m
+++ b/test/SemaObjC/class-conforming-protocol-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol NSWindowDelegate @end
diff --git a/test/SemaObjC/class-def-test-1.m b/test/SemaObjC/class-def-test-1.m
index 0cf49ddd1b9a..95a259bd527b 100644
--- a/test/SemaObjC/class-def-test-1.m
+++ b/test/SemaObjC/class-def-test-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol SUPER;
diff --git a/test/SemaObjC/class-extension-dup-methods.m b/test/SemaObjC/class-extension-dup-methods.m
index 929ad0665a89..452d242888af 100644
--- a/test/SemaObjC/class-extension-dup-methods.m
+++ b/test/SemaObjC/class-extension-dup-methods.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Foo
- (int) garf; // expected-note {{ previous declaration is here}}
diff --git a/test/SemaObjC/class-getter-using-dotsyntax.m b/test/SemaObjC/class-getter-using-dotsyntax.m
index 049c6ce62737..6454bc013c1a 100644
--- a/test/SemaObjC/class-getter-using-dotsyntax.m
+++ b/test/SemaObjC/class-getter-using-dotsyntax.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct objc_class *Class;
diff --git a/test/SemaObjC/class-impl-1.m b/test/SemaObjC/class-impl-1.m
index 80d6915d7557..90a4112c7122 100644
--- a/test/SemaObjC/class-impl-1.m
+++ b/test/SemaObjC/class-impl-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef int INTF3; // expected-note {{previous definition is here}}
diff --git a/test/SemaObjC/class-method-lookup.m b/test/SemaObjC/class-method-lookup.m
index ef9df5a1461b..f1269f2f4610 100644
--- a/test/SemaObjC/class-method-lookup.m
+++ b/test/SemaObjC/class-method-lookup.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface MyBase
- (void) rootInstanceMethod;
diff --git a/test/SemaObjC/class-method-self.m b/test/SemaObjC/class-method-self.m
index ea4de84dae91..71509baf9012 100644
--- a/test/SemaObjC/class-method-self.m
+++ b/test/SemaObjC/class-method-self.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify %s
+// RUN: %clang_cc1 -verify %s
typedef struct objc_class *Class;
@interface XX
diff --git a/test/SemaObjC/class-property-access.m b/test/SemaObjC/class-property-access.m
index ce34a233f7b4..c46d3fb397ce 100644
--- a/test/SemaObjC/class-property-access.m
+++ b/test/SemaObjC/class-property-access.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Test {}
+ (Test*)one;
diff --git a/test/SemaObjC/class-proto-1.m b/test/SemaObjC/class-proto-1.m
index 5e9ee6063e74..246b5002f67f 100644
--- a/test/SemaObjC/class-proto-1.m
+++ b/test/SemaObjC/class-proto-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface INTF1 @end
diff --git a/test/SemaObjC/class-protocol.m b/test/SemaObjC/class-protocol.m
index c2eded75f97a..91cd1389f1e6 100644
--- a/test/SemaObjC/class-protocol.m
+++ b/test/SemaObjC/class-protocol.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// pr5552
@interface Protocol
diff --git a/test/SemaObjC/cocoa.m b/test/SemaObjC/cocoa.m
index a0715453dfff..9c92731fe7b9 100644
--- a/test/SemaObjC/cocoa.m
+++ b/test/SemaObjC/cocoa.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -mcpu pentium4 %s -print-stats
+// RUN: %clang_cc1 -target-cpu pentium4 %s -print-stats
#ifdef __APPLE__
#include <Cocoa/Cocoa.h>
#endif
diff --git a/test/SemaObjC/compare-qualified-id.m b/test/SemaObjC/compare-qualified-id.m
index c9776d0f41c3..497a1b6afdca 100644
--- a/test/SemaObjC/compare-qualified-id.m
+++ b/test/SemaObjC/compare-qualified-id.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
diff --git a/test/SemaObjC/compatible-protocol-qualified-types.m b/test/SemaObjC/compatible-protocol-qualified-types.m
index 54d6a04085d9..0df905c9ca15 100644
--- a/test/SemaObjC/compatible-protocol-qualified-types.m
+++ b/test/SemaObjC/compatible-protocol-qualified-types.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -pedantic -fsyntax-only -verify %s
+// RUN: %clang_cc1 -pedantic -fsyntax-only -verify %s
typedef signed char BOOL;
@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
diff --git a/test/SemaObjC/comptypes-1.m b/test/SemaObjC/comptypes-1.m
index bffbd763ad98..24f704113d7c 100644
--- a/test/SemaObjC/comptypes-1.m
+++ b/test/SemaObjC/comptypes-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
#define nil (void *)0;
#define Nil (void *)0;
diff --git a/test/SemaObjC/comptypes-2.m b/test/SemaObjC/comptypes-2.m
index a53b942930e5..74e42c96137d 100644
--- a/test/SemaObjC/comptypes-2.m
+++ b/test/SemaObjC/comptypes-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#define nil (void *)0;
#define Nil (void *)0;
diff --git a/test/SemaObjC/comptypes-3.m b/test/SemaObjC/comptypes-3.m
index 2d1b6236e3d7..94171d11d568 100644
--- a/test/SemaObjC/comptypes-3.m
+++ b/test/SemaObjC/comptypes-3.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#define nil (void *)0;
diff --git a/test/SemaObjC/comptypes-4.m b/test/SemaObjC/comptypes-4.m
index 794ede25962f..56b23b22458f 100644
--- a/test/SemaObjC/comptypes-4.m
+++ b/test/SemaObjC/comptypes-4.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
extern void foo();
diff --git a/test/SemaObjC/comptypes-5.m b/test/SemaObjC/comptypes-5.m
index 4b8f48968514..aaf64462b186 100644
--- a/test/SemaObjC/comptypes-5.m
+++ b/test/SemaObjC/comptypes-5.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
#define nil (void *)0;
diff --git a/test/SemaObjC/comptypes-6.m b/test/SemaObjC/comptypes-6.m
index ad3da26185a7..2911a390ef84 100644
--- a/test/SemaObjC/comptypes-6.m
+++ b/test/SemaObjC/comptypes-6.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
@interface Derived
@end
diff --git a/test/SemaObjC/comptypes-7.m b/test/SemaObjC/comptypes-7.m
index ea1aa06292de..fedad1bd81f9 100644
--- a/test/SemaObjC/comptypes-7.m
+++ b/test/SemaObjC/comptypes-7.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
#define nil (void *)0;
#define Nil (void *)0;
diff --git a/test/SemaObjC/comptypes-8.m b/test/SemaObjC/comptypes-8.m
index b19bc302b223..750b0a6a5a97 100644
--- a/test/SemaObjC/comptypes-8.m
+++ b/test/SemaObjC/comptypes-8.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol MyProtocol
@end
diff --git a/test/SemaObjC/comptypes-9.m b/test/SemaObjC/comptypes-9.m
index 89647b5b9826..cc6932dcdbf3 100644
--- a/test/SemaObjC/comptypes-9.m
+++ b/test/SemaObjC/comptypes-9.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
// FIXME: This test case tests the patch applied in: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080602/006017.html
// Eventually that logic should be treated as an extension.
diff --git a/test/SemaObjC/comptypes-a.m b/test/SemaObjC/comptypes-a.m
index 4c7967d89c0a..d48dfe4074fc 100644
--- a/test/SemaObjC/comptypes-a.m
+++ b/test/SemaObjC/comptypes-a.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
typedef signed char BOOL;
typedef int NSInteger;
diff --git a/test/SemaObjC/comptypes-legal.m b/test/SemaObjC/comptypes-legal.m
index 6a837b6aa8fa..8caf18563b07 100644
--- a/test/SemaObjC/comptypes-legal.m
+++ b/test/SemaObjC/comptypes-legal.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
@protocol NSObject
@end
diff --git a/test/SemaObjC/conditional-expr-2.m b/test/SemaObjC/conditional-expr-2.m
index 9835f3ea31c2..e97b693dfc57 100644
--- a/test/SemaObjC/conditional-expr-2.m
+++ b/test/SemaObjC/conditional-expr-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface A
@end
diff --git a/test/SemaObjC/conditional-expr-3.m b/test/SemaObjC/conditional-expr-3.m
index b7dae6bc48e7..312f77a15ff4 100644
--- a/test/SemaObjC/conditional-expr-3.m
+++ b/test/SemaObjC/conditional-expr-3.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P0
@end
diff --git a/test/SemaObjC/conditional-expr-4.m b/test/SemaObjC/conditional-expr-4.m
index 19215e3c36cc..84652e4513df 100644
--- a/test/SemaObjC/conditional-expr-4.m
+++ b/test/SemaObjC/conditional-expr-4.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// <rdar://problem/6212771>
#define nil ((void*) 0)
diff --git a/test/SemaObjC/conditional-expr-5.m b/test/SemaObjC/conditional-expr-5.m
index 74f866be0034..63afca18fdd6 100644
--- a/test/SemaObjC/conditional-expr-5.m
+++ b/test/SemaObjC/conditional-expr-5.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface PBXBuildSettingsDictionary
{
diff --git a/test/SemaObjC/conditional-expr-6.m b/test/SemaObjC/conditional-expr-6.m
index dcd2f958f23a..098688a8a90a 100644
--- a/test/SemaObjC/conditional-expr-6.m
+++ b/test/SemaObjC/conditional-expr-6.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol MyProtocol @end
diff --git a/test/SemaObjC/conditional-expr.m b/test/SemaObjC/conditional-expr.m
index 8fdb2810eddf..914e3cabbf01 100644
--- a/test/SemaObjC/conditional-expr.m
+++ b/test/SemaObjC/conditional-expr.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
@protocol NSObject
@end
diff --git a/test/SemaObjC/conflicting-ivar-test-1.m b/test/SemaObjC/conflicting-ivar-test-1.m
index acba8e431ab8..1c68a23d7e28 100644
--- a/test/SemaObjC/conflicting-ivar-test-1.m
+++ b/test/SemaObjC/conflicting-ivar-test-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface INTF
{
diff --git a/test/SemaObjC/continuation-class-err.m b/test/SemaObjC/continuation-class-err.m
index c251d460cdf2..214c4e5b30b5 100644
--- a/test/SemaObjC/continuation-class-err.m
+++ b/test/SemaObjC/continuation-class-err.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface ReadOnly
{
diff --git a/test/SemaObjC/crash-label.m b/test/SemaObjC/crash-label.m
index 477c9a12c142..d0a5ae40c7f5 100644
--- a/test/SemaObjC/crash-label.m
+++ b/test/SemaObjC/crash-label.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
- (NSDictionary*) _executeScript:(NSString *)source { // expected-error 2 {{expected a type}} \
// expected-error {{missing context for method declaration}}
diff --git a/test/SemaObjC/deref-interface.m b/test/SemaObjC/deref-interface.m
index 2308677ab825..c7096bd59a04 100644
--- a/test/SemaObjC/deref-interface.m
+++ b/test/SemaObjC/deref-interface.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s
@interface NSView
- (id)initWithView:(id)realView;
diff --git a/test/SemaObjC/duplicate-ivar-check.m b/test/SemaObjC/duplicate-ivar-check.m
index b4a9df282d44..260c215c2154 100644
--- a/test/SemaObjC/duplicate-ivar-check.m
+++ b/test/SemaObjC/duplicate-ivar-check.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface B1 {
@public
diff --git a/test/SemaObjC/enhanced-proto-2.m b/test/SemaObjC/enhanced-proto-2.m
index a83ef23afd5a..da7875cfa7c7 100644
--- a/test/SemaObjC/enhanced-proto-2.m
+++ b/test/SemaObjC/enhanced-proto-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify %s
+// RUN: %clang_cc1 -verify %s
@protocol MyProto1
@optional
diff --git a/test/SemaObjC/error-property-gc-attr.m b/test/SemaObjC/error-property-gc-attr.m
index da742e7f7331..a36170475bc2 100644
--- a/test/SemaObjC/error-property-gc-attr.m
+++ b/test/SemaObjC/error-property-gc-attr.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s
@interface INTF
{
diff --git a/test/SemaObjC/exprs.m b/test/SemaObjC/exprs.m
index 52bd61877080..f4424f57a91d 100644
--- a/test/SemaObjC/exprs.m
+++ b/test/SemaObjC/exprs.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// rdar://6597252
Class test1(Class X) {
diff --git a/test/SemaObjC/foreach.m b/test/SemaObjC/foreach.m
index 315202f5eba6..0f7fd9eea992 100644
--- a/test/SemaObjC/foreach.m
+++ b/test/SemaObjC/foreach.m
@@ -1,4 +1,4 @@
-/* RUN: clang -cc1 -Wall -fsyntax-only -verify -std=c89 -pedantic %s
+/* RUN: %clang_cc1 -Wall -fsyntax-only -verify -std=c89 -pedantic %s
*/
@class NSArray;
diff --git a/test/SemaObjC/format-arg-attribute.m b/test/SemaObjC/format-arg-attribute.m
index 7de9e9f139c2..264e7a8179da 100644
--- a/test/SemaObjC/format-arg-attribute.m
+++ b/test/SemaObjC/format-arg-attribute.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only %s
@class NSString;
diff --git a/test/SemaObjC/format-strings-objc.m b/test/SemaObjC/format-strings-objc.m
index b0d5b513dc7a..e7550a758bdf 100644
--- a/test/SemaObjC/format-strings-objc.m
+++ b/test/SemaObjC/format-strings-objc.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
diff --git a/test/SemaObjC/forward-class-1.m b/test/SemaObjC/forward-class-1.m
index e3d2c157d6ad..ab213fb4ce72 100644
--- a/test/SemaObjC/forward-class-1.m
+++ b/test/SemaObjC/forward-class-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@class FOO, BAR;
@class FOO, BAR;
diff --git a/test/SemaObjC/forward-class-receiver.m b/test/SemaObjC/forward-class-receiver.m
index 7f8aec9a39e2..55b29c15c5c3 100644
--- a/test/SemaObjC/forward-class-receiver.m
+++ b/test/SemaObjC/forward-class-receiver.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface I
+ new; // expected-note {{method 'new' is used for the forward class}}
diff --git a/test/SemaObjC/gcc-cast-ext.m b/test/SemaObjC/gcc-cast-ext.m
index 6b4cbafcf817..28abfbc8b2ab 100644
--- a/test/SemaObjC/gcc-cast-ext.m
+++ b/test/SemaObjC/gcc-cast-ext.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -verify -fms-extensions
+// RUN: %clang_cc1 %s -verify -fms-extensions
@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
typedef struct _NSRange { } NSRange;
diff --git a/test/SemaObjC/id-isa-ref.m b/test/SemaObjC/id-isa-ref.m
index c80f0809c53f..a75f2f336751 100644
--- a/test/SemaObjC/id-isa-ref.m
+++ b/test/SemaObjC/id-isa-ref.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct objc_object {
struct objc_class *isa;
diff --git a/test/SemaObjC/id.m b/test/SemaObjC/id.m
index aa99cfa6471e..98904fe1ee9c 100644
--- a/test/SemaObjC/id.m
+++ b/test/SemaObjC/id.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol Foo;
diff --git a/test/SemaObjC/id_builtin.m b/test/SemaObjC/id_builtin.m
index 1ec049b9ff79..a1431d60abe3 100644
--- a/test/SemaObjC/id_builtin.m
+++ b/test/SemaObjC/id_builtin.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// id is now builtin. There should be no errors.
id obj;
diff --git a/test/SemaObjC/idiomatic-parentheses.m b/test/SemaObjC/idiomatic-parentheses.m
index ec1d3638410e..011efbc437bf 100644
--- a/test/SemaObjC/idiomatic-parentheses.m
+++ b/test/SemaObjC/idiomatic-parentheses.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Don't warn about some common ObjC idioms unless we have -Wparentheses on.
// <rdar://problem/7382435>
diff --git a/test/SemaObjC/ignore-weakimport-method.m b/test/SemaObjC/ignore-weakimport-method.m
index f745e443cf1e..f80312ac06f3 100644
--- a/test/SemaObjC/ignore-weakimport-method.m
+++ b/test/SemaObjC/ignore-weakimport-method.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface foo
+ (void) cx __attribute__((weak_import));
diff --git a/test/SemaObjC/incompatible-protocol-qualified-types.m b/test/SemaObjC/incompatible-protocol-qualified-types.m
index 624377fbf968..7eb540ad556e 100644
--- a/test/SemaObjC/incompatible-protocol-qualified-types.m
+++ b/test/SemaObjC/incompatible-protocol-qualified-types.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -pedantic -fsyntax-only -verify %s
+// RUN: %clang_cc1 -pedantic -fsyntax-only -verify %s
@protocol MyProto1
@end
diff --git a/test/SemaObjC/inst-method-lookup-in-root.m b/test/SemaObjC/inst-method-lookup-in-root.m
index 8980d3709e47..babd2a0e8da1 100644
--- a/test/SemaObjC/inst-method-lookup-in-root.m
+++ b/test/SemaObjC/inst-method-lookup-in-root.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P
- (id) inst_in_proto;
diff --git a/test/SemaObjC/interface-1.m b/test/SemaObjC/interface-1.m
index 989893684874..91586c9bb34a 100644
--- a/test/SemaObjC/interface-1.m
+++ b/test/SemaObjC/interface-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple i386-apple-darwin9 %s -fsyntax-only -verify
// rdar://5957506
@interface NSWhatever :
diff --git a/test/SemaObjC/interface-layout-2.m b/test/SemaObjC/interface-layout-2.m
index cad71428da45..02b14035a223 100644
--- a/test/SemaObjC/interface-layout-2.m
+++ b/test/SemaObjC/interface-layout-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
@interface A
{
int ivar;
diff --git a/test/SemaObjC/interface-layout.m b/test/SemaObjC/interface-layout.m
index b2c6f0d95fc2..72a7155644a0 100644
--- a/test/SemaObjC/interface-layout.m
+++ b/test/SemaObjC/interface-layout.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify -triple i386-apple-darwin9
+// RUN: %clang_cc1 %s -fsyntax-only -verify -triple i386-apple-darwin9
typedef struct objc_object {} *id;
typedef signed char BOOL;
typedef unsigned int NSUInteger;
diff --git a/test/SemaObjC/interface-scope-2.m b/test/SemaObjC/interface-scope-2.m
index bdf28f46360f..d8046c9c2fa7 100644
--- a/test/SemaObjC/interface-scope-2.m
+++ b/test/SemaObjC/interface-scope-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify -triple i686-apple-darwin9 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-apple-darwin9 %s
// FIXME: must also compile as Objective-C++
// <rdar://problem/6487662>
diff --git a/test/SemaObjC/interface-scope.m b/test/SemaObjC/interface-scope.m
index bc80722febfb..0671dae61e82 100644
--- a/test/SemaObjC/interface-scope.m
+++ b/test/SemaObjC/interface-scope.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface I1 {
@private
diff --git a/test/SemaObjC/interface-tu-variable.m b/test/SemaObjC/interface-tu-variable.m
index b451d3634929..b8779cc3e078 100644
--- a/test/SemaObjC/interface-tu-variable.m
+++ b/test/SemaObjC/interface-tu-variable.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface XX
int x; // expected-error {{cannot declare variable inside @interface or @protocol}}
diff --git a/test/SemaObjC/invalid-code.m b/test/SemaObjC/invalid-code.m
index d0679a3f98c5..9913a3a237c2 100644
--- a/test/SemaObjC/invalid-code.m
+++ b/test/SemaObjC/invalid-code.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// rdar://6124613
void test1() {
diff --git a/test/SemaObjC/invalid-objc-decls-1.m b/test/SemaObjC/invalid-objc-decls-1.m
index b58fa68337be..2f3be285df3f 100644
--- a/test/SemaObjC/invalid-objc-decls-1.m
+++ b/test/SemaObjC/invalid-objc-decls-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Super @end
Super s1; // expected-error{{interface type cannot be statically allocated}}
diff --git a/test/SemaObjC/invalid-receiver.m b/test/SemaObjC/invalid-receiver.m
index 366f71400856..16f0155173d0 100644
--- a/test/SemaObjC/invalid-receiver.m
+++ b/test/SemaObjC/invalid-receiver.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct NotAClass {
int a, b;
diff --git a/test/SemaObjC/invalid-typename.m b/test/SemaObjC/invalid-typename.m
index ecc03ba9813a..50dd18873822 100644
--- a/test/SemaObjC/invalid-typename.m
+++ b/test/SemaObjC/invalid-typename.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@class NSString, NSArray;
diff --git a/test/SemaObjC/ivar-access-package.m b/test/SemaObjC/ivar-access-package.m
index 077b0cf57c68..956ae5bdb6cc 100644
--- a/test/SemaObjC/ivar-access-package.m
+++ b/test/SemaObjC/ivar-access-package.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef unsigned char BOOL;
diff --git a/test/SemaObjC/ivar-access-tests.m b/test/SemaObjC/ivar-access-tests.m
index 1dc33db5b1e8..85612209003f 100644
--- a/test/SemaObjC/ivar-access-tests.m
+++ b/test/SemaObjC/ivar-access-tests.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface MySuperClass
{
diff --git a/test/SemaObjC/ivar-lookup.m b/test/SemaObjC/ivar-lookup.m
index 63bf040d636f..644b3b638c92 100644
--- a/test/SemaObjC/ivar-lookup.m
+++ b/test/SemaObjC/ivar-lookup.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
@interface Test {
int x;
diff --git a/test/SemaObjC/ivar-ref-misuse.m b/test/SemaObjC/ivar-ref-misuse.m
index 04047533af43..ba2f11594f96 100644
--- a/test/SemaObjC/ivar-ref-misuse.m
+++ b/test/SemaObjC/ivar-ref-misuse.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Sprite {
int sprite, spree;
diff --git a/test/SemaObjC/ivar-sem-check-1.m b/test/SemaObjC/ivar-sem-check-1.m
index 318f510672ce..099a7a669a91 100644
--- a/test/SemaObjC/ivar-sem-check-1.m
+++ b/test/SemaObjC/ivar-sem-check-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct S; // expected-note{{forward declaration of 'struct S'}}
typedef int FOO();
diff --git a/test/SemaObjC/ivar-sem-check-2.m b/test/SemaObjC/ivar-sem-check-2.m
index 242504f0a177..28c795ee7fe1 100644
--- a/test/SemaObjC/ivar-sem-check-2.m
+++ b/test/SemaObjC/ivar-sem-check-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
@interface Super {
id value2; // expected-note {{previously declared 'value2' here}}
diff --git a/test/SemaObjC/legacy-implementation-1.m b/test/SemaObjC/legacy-implementation-1.m
index e480561693a4..e9abb87f041e 100644
--- a/test/SemaObjC/legacy-implementation-1.m
+++ b/test/SemaObjC/legacy-implementation-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@implementation INTF // expected-warning {{cannot find interface declaration for 'INTF'}}
@end
diff --git a/test/SemaObjC/message.m b/test/SemaObjC/message.m
index 244f5d7b74e6..57b109796257 100644
--- a/test/SemaObjC/message.m
+++ b/test/SemaObjC/message.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct objc_object {
Class isa;
diff --git a/test/SemaObjC/method-arg-decay.m b/test/SemaObjC/method-arg-decay.m
index 09949de3293d..82bdc6d9fb7b 100644
--- a/test/SemaObjC/method-arg-decay.m
+++ b/test/SemaObjC/method-arg-decay.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -checker-cfref -verify %s
+// RUN: %clang_cc1 -checker-cfref -verify %s
typedef signed char BOOL;
typedef int NSInteger;
typedef unsigned int NSUInteger;
diff --git a/test/SemaObjC/method-arg-qualifier-warning.m b/test/SemaObjC/method-arg-qualifier-warning.m
index 2d9499f2fdbe..397f24135f58 100644
--- a/test/SemaObjC/method-arg-qualifier-warning.m
+++ b/test/SemaObjC/method-arg-qualifier-warning.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
diff --git a/test/SemaObjC/method-attributes.m b/test/SemaObjC/method-attributes.m
index d5f92edee40c..9157fcfefe11 100644
--- a/test/SemaObjC/method-attributes.m
+++ b/test/SemaObjC/method-attributes.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only %s
@class NSString;
diff --git a/test/SemaObjC/method-bad-param.m b/test/SemaObjC/method-bad-param.m
index 8ef7be9d403b..c1509bf9f6f2 100644
--- a/test/SemaObjC/method-bad-param.m
+++ b/test/SemaObjC/method-bad-param.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface foo
@end
diff --git a/test/SemaObjC/method-conflict.m b/test/SemaObjC/method-conflict.m
index 0f7fd61fe164..08fdfc017ccc 100644
--- a/test/SemaObjC/method-conflict.m
+++ b/test/SemaObjC/method-conflict.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
diff --git a/test/SemaObjC/method-def-1.m b/test/SemaObjC/method-def-1.m
index f98ba896db40..7630ad0fbd2b 100644
--- a/test/SemaObjC/method-def-1.m
+++ b/test/SemaObjC/method-def-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface foo
- (int)meth;
diff --git a/test/SemaObjC/method-def-2.m b/test/SemaObjC/method-def-2.m
index e595589695ea..915f23164d61 100644
--- a/test/SemaObjC/method-def-2.m
+++ b/test/SemaObjC/method-def-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -ast-print %s
+// RUN: %clang_cc1 -ast-print %s
extern void abort(void);
#define CHECK_IF(expr) if(!(expr)) abort()
diff --git a/test/SemaObjC/method-encoding-2.m b/test/SemaObjC/method-encoding-2.m
index 50d2d9250dd4..619a88625a6c 100644
--- a/test/SemaObjC/method-encoding-2.m
+++ b/test/SemaObjC/method-encoding-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s
+// RUN: %clang_cc1 %s
// TODO: We don't support rewrite of method definitions
@interface Intf
diff --git a/test/SemaObjC/method-lookup-2.m b/test/SemaObjC/method-lookup-2.m
index 5493653f3eca..53cae8371252 100644
--- a/test/SemaObjC/method-lookup-2.m
+++ b/test/SemaObjC/method-lookup-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
@protocol NSObject
diff --git a/test/SemaObjC/method-lookup-3.m b/test/SemaObjC/method-lookup-3.m
index 9e7c4c93abeb..18a9982840bd 100644
--- a/test/SemaObjC/method-lookup-3.m
+++ b/test/SemaObjC/method-lookup-3.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct { int y; } Abstract;
diff --git a/test/SemaObjC/method-lookup-4.m b/test/SemaObjC/method-lookup-4.m
index 20b4e60b018f..700565e78329 100644
--- a/test/SemaObjC/method-lookup-4.m
+++ b/test/SemaObjC/method-lookup-4.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface NSObject {}
diff --git a/test/SemaObjC/method-lookup.m b/test/SemaObjC/method-lookup.m
index b9607eb690c3..e3789584bf59 100644
--- a/test/SemaObjC/method-lookup.m
+++ b/test/SemaObjC/method-lookup.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
typedef int NSInteger;
diff --git a/test/SemaObjC/method-no-context.m b/test/SemaObjC/method-no-context.m
index 63caa7e399cc..c88205dfd28f 100644
--- a/test/SemaObjC/method-no-context.m
+++ b/test/SemaObjC/method-no-context.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
- im0 { int a; return 0; // expected-error{{missing context for method declaration}}
// expected-error{{expected '}'}}
diff --git a/test/SemaObjC/method-not-defined.m b/test/SemaObjC/method-not-defined.m
index 37171af2e889..78bf65027284 100644
--- a/test/SemaObjC/method-not-defined.m
+++ b/test/SemaObjC/method-not-defined.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Foo
@end
diff --git a/test/SemaObjC/method-sentinel-attr.m b/test/SemaObjC/method-sentinel-attr.m
index 080d6649cc04..08358cc9154a 100644
--- a/test/SemaObjC/method-sentinel-attr.m
+++ b/test/SemaObjC/method-sentinel-attr.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#define NULL (void*)0
diff --git a/test/SemaObjC/method-typecheck-1.m b/test/SemaObjC/method-typecheck-1.m
index bd62ded3c413..6c382d8cd956 100644
--- a/test/SemaObjC/method-typecheck-1.m
+++ b/test/SemaObjC/method-typecheck-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface A
- (void) setMoo: (int) x; // expected-note {{previous definition is here}}
diff --git a/test/SemaObjC/method-typecheck-2.m b/test/SemaObjC/method-typecheck-2.m
index 642893da804d..84efa0b22091 100644
--- a/test/SemaObjC/method-typecheck-2.m
+++ b/test/SemaObjC/method-typecheck-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P
- (void) doSomethingInProtocol: (float) x; // expected-note {{previous definition is here}}
diff --git a/test/SemaObjC/method-undef-category-warn-1.m b/test/SemaObjC/method-undef-category-warn-1.m
index 8f5d1ace4c88..75ca5b5ff9fb 100644
--- a/test/SemaObjC/method-undef-category-warn-1.m
+++ b/test/SemaObjC/method-undef-category-warn-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface MyClass1
@end
diff --git a/test/SemaObjC/method-undef-extension-warn-1.m b/test/SemaObjC/method-undef-extension-warn-1.m
index c1efe5a44fdc..fc27870f42dd 100644
--- a/test/SemaObjC/method-undef-extension-warn-1.m
+++ b/test/SemaObjC/method-undef-extension-warn-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface MyClass
@end
diff --git a/test/SemaObjC/method-undefined-warn-1.m b/test/SemaObjC/method-undefined-warn-1.m
index bbf993f13665..cfe1d56ee5c8 100644
--- a/test/SemaObjC/method-undefined-warn-1.m
+++ b/test/SemaObjC/method-undefined-warn-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface INTF
- (void) meth;
diff --git a/test/SemaObjC/missing-method-context.m b/test/SemaObjC/missing-method-context.m
index 506cccf512a9..1378b3694012 100644
--- a/test/SemaObjC/missing-method-context.m
+++ b/test/SemaObjC/missing-method-context.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
- (void)compilerTestAgainst; // expected-error {{missing context for method declaration}}
void xx(); // expected-error {{expected method body}}
diff --git a/test/SemaObjC/newproperty-class-method-1.m b/test/SemaObjC/newproperty-class-method-1.m
index 972f0909693d..d4ea5e54a553 100644
--- a/test/SemaObjC/newproperty-class-method-1.m
+++ b/test/SemaObjC/newproperty-class-method-1.m
@@ -1,4 +1,6 @@
-// RUN: clang -cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+void abort(void);
@interface Subclass
+ (int)magicNumber;
diff --git a/test/SemaObjC/no-gc-weak-test.m b/test/SemaObjC/no-gc-weak-test.m
index 498278ec91d7..ca8318d00fc2 100644
--- a/test/SemaObjC/no-gc-weak-test.m
+++ b/test/SemaObjC/no-gc-weak-test.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
@interface Subtask
{
diff --git a/test/SemaObjC/no-warn-qual-mismatch.m b/test/SemaObjC/no-warn-qual-mismatch.m
index 73b56711e388..1b5f184ae063 100644
--- a/test/SemaObjC/no-warn-qual-mismatch.m
+++ b/test/SemaObjC/no-warn-qual-mismatch.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// radar 7211563
@interface X
diff --git a/test/SemaObjC/no-warn-synth-protocol-meth.m b/test/SemaObjC/no-warn-synth-protocol-meth.m
index 8c8f33b56058..fed6b27652ea 100644
--- a/test/SemaObjC/no-warn-synth-protocol-meth.m
+++ b/test/SemaObjC/no-warn-synth-protocol-meth.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol CYCdef
- (int)name;
diff --git a/test/SemaObjC/no-warn-unimpl-method.m b/test/SemaObjC/no-warn-unimpl-method.m
index 4345914092af..dd6e3ad4aa32 100644
--- a/test/SemaObjC/no-warn-unimpl-method.m
+++ b/test/SemaObjC/no-warn-unimpl-method.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
// This program tests that if class implements the forwardInvocation method, then
// every method possible is implemented in the class and should not issue
// warning of the "Method definition not found" kind. */
diff --git a/test/SemaObjC/nonnull.m b/test/SemaObjC/nonnull.m
index e657707790d5..c96a91a7f815 100644
--- a/test/SemaObjC/nonnull.m
+++ b/test/SemaObjC/nonnull.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fblocks -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fblocks -fsyntax-only -verify %s
@class NSObject;
diff --git a/test/SemaObjC/nsobject-attribute-1.m b/test/SemaObjC/nsobject-attribute-1.m
index 6eb5d63db2d1..991246c72fd4 100644
--- a/test/SemaObjC/nsobject-attribute-1.m
+++ b/test/SemaObjC/nsobject-attribute-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fblocks -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fblocks -fsyntax-only -verify %s
@interface NSObject
- (id)self;
diff --git a/test/SemaObjC/nsobject-attribute.m b/test/SemaObjC/nsobject-attribute.m
index 896c44a3dc74..fdf9e358ee8e 100644
--- a/test/SemaObjC/nsobject-attribute.m
+++ b/test/SemaObjC/nsobject-attribute.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct CGColor * __attribute__ ((NSObject)) CGColorRef;
static int count;
diff --git a/test/SemaObjC/objc-string-constant.m b/test/SemaObjC/objc-string-constant.m
index 46d1242cc5e5..cc6d60c82ae6 100644
--- a/test/SemaObjC/objc-string-constant.m
+++ b/test/SemaObjC/objc-string-constant.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -Wsemicolon-before-method-body %s -verify -fsyntax-only
+// RUN: %clang_cc1 -Wsemicolon-before-method-body %s -verify -fsyntax-only
#define nil 0 /* id of Nil instance */
diff --git a/test/SemaObjC/objc2-merge-gc-attribue-decl.m b/test/SemaObjC/objc2-merge-gc-attribue-decl.m
index c15e10781a3d..673a7417e384 100644
--- a/test/SemaObjC/objc2-merge-gc-attribue-decl.m
+++ b/test/SemaObjC/objc2-merge-gc-attribue-decl.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s
@interface INTF @end
extern INTF* p2;
diff --git a/test/SemaObjC/objc2-warn-weak-decl.m b/test/SemaObjC/objc2-warn-weak-decl.m
index bd59c6613304..76b542de94a6 100644
--- a/test/SemaObjC/objc2-warn-weak-decl.m
+++ b/test/SemaObjC/objc2-warn-weak-decl.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s
struct S {
__weak id p; // expected-warning {{__weak attribute cannot be specified on a field declaration}}
};
diff --git a/test/SemaObjC/property-10.m b/test/SemaObjC/property-10.m
index cf615bcde7cd..bd07df685db1 100644
--- a/test/SemaObjC/property-10.m
+++ b/test/SemaObjC/property-10.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -Wreadonly-setter-attrs -verify %s -fblocks
+// RUN: %clang_cc1 -fsyntax-only -Wreadonly-setter-attrs -verify %s -fblocks
// Check property attribute consistency.
diff --git a/test/SemaObjC/property-11.m b/test/SemaObjC/property-11.m
index c9b35402ae77..297611574eae 100644
--- a/test/SemaObjC/property-11.m
+++ b/test/SemaObjC/property-11.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface NSSound
@end
diff --git a/test/SemaObjC/property-12.m b/test/SemaObjC/property-12.m
index f022dcda4389..cd0fccf0e383 100644
--- a/test/SemaObjC/property-12.m
+++ b/test/SemaObjC/property-12.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -Wreadonly-setter-attrs -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wreadonly-setter-attrs -verify %s
@protocol P0
@property(readonly,assign) id X; // expected-warning {{property attributes 'readonly' and 'assign' are mutually exclusive}}
diff --git a/test/SemaObjC/property-13.m b/test/SemaObjC/property-13.m
index 23e3714accf9..f34ec568b94c 100644
--- a/test/SemaObjC/property-13.m
+++ b/test/SemaObjC/property-13.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface NSObject
+ alloc;
@@ -44,6 +44,7 @@
- (void) setOptional_getter_attr:(int)value { ivar = value; }
@end
+void abort(void);
int main ()
{
Test *x = [[Test alloc] init];
diff --git a/test/SemaObjC/property-2.m b/test/SemaObjC/property-2.m
index 01fcdb9fa881..069b0cbc7132 100644
--- a/test/SemaObjC/property-2.m
+++ b/test/SemaObjC/property-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Tester
@property char PropertyAtomic_char;
diff --git a/test/SemaObjC/property-3.m b/test/SemaObjC/property-3.m
index c79efc823a13..439dc28be9f2 100644
--- a/test/SemaObjC/property-3.m
+++ b/test/SemaObjC/property-3.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify %s
+// RUN: %clang_cc1 -verify %s
@interface I
{
diff --git a/test/SemaObjC/property-4.m b/test/SemaObjC/property-4.m
index b70514f1ae63..2168048800ac 100644
--- a/test/SemaObjC/property-4.m
+++ b/test/SemaObjC/property-4.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify %s
+// RUN: %clang_cc1 -verify %s
@interface Object
@end
diff --git a/test/SemaObjC/property-5.m b/test/SemaObjC/property-5.m
index 40b9e67f6311..cd7cc2487acc 100644
--- a/test/SemaObjC/property-5.m
+++ b/test/SemaObjC/property-5.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify %s
+// RUN: %clang_cc1 -verify %s
@protocol P1 @end
@protocol P2 @end
diff --git a/test/SemaObjC/property-6.m b/test/SemaObjC/property-6.m
index 0253fe889b1a..72beb67b43e4 100644
--- a/test/SemaObjC/property-6.m
+++ b/test/SemaObjC/property-6.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
# 1 "<command line>"
# 1 "/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h" 1 3
typedef signed char BOOL;
diff --git a/test/SemaObjC/property-7.m b/test/SemaObjC/property-7.m
index 63eb3cf2cb80..e6cba50f7a61 100644
--- a/test/SemaObjC/property-7.m
+++ b/test/SemaObjC/property-7.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
typedef struct _NSZone NSZone;
diff --git a/test/SemaObjC/property-8.m b/test/SemaObjC/property-8.m
index 82d8c6b00208..8647aba8c3e7 100644
--- a/test/SemaObjC/property-8.m
+++ b/test/SemaObjC/property-8.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
typedef struct _NSZone NSZone;
diff --git a/test/SemaObjC/property-9-impl-method.m b/test/SemaObjC/property-9-impl-method.m
index c7b149717ec5..84eb3635e2ac 100644
--- a/test/SemaObjC/property-9-impl-method.m
+++ b/test/SemaObjC/property-9-impl-method.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// rdar://5967199
typedef signed char BOOL;
diff --git a/test/SemaObjC/property-9.m b/test/SemaObjC/property-9.m
index a3faa4822f31..138f09953d5a 100644
--- a/test/SemaObjC/property-9.m
+++ b/test/SemaObjC/property-9.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
@protocol NSObject - (BOOL)isEqual:(id)object; @end
diff --git a/test/SemaObjC/property-category-1.m b/test/SemaObjC/property-category-1.m
index d6b580080d48..26e73136d01f 100644
--- a/test/SemaObjC/property-category-1.m
+++ b/test/SemaObjC/property-category-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Object
+ (id)new;
diff --git a/test/SemaObjC/property-category-2.m b/test/SemaObjC/property-category-2.m
index 6a3883a35b77..f258b2c25012 100644
--- a/test/SemaObjC/property-category-2.m
+++ b/test/SemaObjC/property-category-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Test that a property can be synthesize in a category
// implementation with no error.
diff --git a/test/SemaObjC/property-category-3.m b/test/SemaObjC/property-category-3.m
index de0f302bc5d7..237de0f1f5fb 100644
--- a/test/SemaObjC/property-category-3.m
+++ b/test/SemaObjC/property-category-3.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P
@property(readonly) int X;
diff --git a/test/SemaObjC/property-category-4.m b/test/SemaObjC/property-category-4.m
index c807f394544b..aa49a3f0b5ed 100644
--- a/test/SemaObjC/property-category-4.m
+++ b/test/SemaObjC/property-category-4.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface IDELogNavigator
{
diff --git a/test/SemaObjC/property-error-readonly-assign.m b/test/SemaObjC/property-error-readonly-assign.m
index 482ae2cb8189..fc8c48c4f6cf 100644
--- a/test/SemaObjC/property-error-readonly-assign.m
+++ b/test/SemaObjC/property-error-readonly-assign.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface A
-(int) x;
diff --git a/test/SemaObjC/property-expression-error.m b/test/SemaObjC/property-expression-error.m
index f03244dc79fb..b59c1b154b9d 100644
--- a/test/SemaObjC/property-expression-error.m
+++ b/test/SemaObjC/property-expression-error.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface AddressMyProperties
{
diff --git a/test/SemaObjC/property-impl-misuse.m b/test/SemaObjC/property-impl-misuse.m
index 5bbc3f19c090..58c91c59d05e 100644
--- a/test/SemaObjC/property-impl-misuse.m
+++ b/test/SemaObjC/property-impl-misuse.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface I {
int Y;
diff --git a/test/SemaObjC/property-inherited.m b/test/SemaObjC/property-inherited.m
index 67897526224d..5c5631e6fb89 100644
--- a/test/SemaObjC/property-inherited.m
+++ b/test/SemaObjC/property-inherited.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// <rdar://problem/6497242> Inherited overridden protocol declared objects don't work
diff --git a/test/SemaObjC/property-ivar-mismatch.m b/test/SemaObjC/property-ivar-mismatch.m
index d4f6e1a4f4e1..ea3acfc3fcf9 100644
--- a/test/SemaObjC/property-ivar-mismatch.m
+++ b/test/SemaObjC/property-ivar-mismatch.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Test that arithmatic types on property and its ivar have exact match.
@interface Test4
diff --git a/test/SemaObjC/property-method-lookup-impl.m b/test/SemaObjC/property-method-lookup-impl.m
index f85babafbdbd..0a018b0dffd8 100644
--- a/test/SemaObjC/property-method-lookup-impl.m
+++ b/test/SemaObjC/property-method-lookup-impl.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface SSyncCEList
{
diff --git a/test/SemaObjC/property-missing.m b/test/SemaObjC/property-missing.m
index a74cf6236dbe..6ce0beac51c1 100644
--- a/test/SemaObjC/property-missing.m
+++ b/test/SemaObjC/property-missing.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR3234
diff --git a/test/SemaObjC/property-nonfragile-abi.m b/test/SemaObjC/property-nonfragile-abi.m
index ede9515123c1..ae82cb7d9295 100644
--- a/test/SemaObjC/property-nonfragile-abi.m
+++ b/test/SemaObjC/property-nonfragile-abi.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
typedef signed char BOOL;
diff --git a/test/SemaObjC/property-noprotocol-warning.m b/test/SemaObjC/property-noprotocol-warning.m
index 20234a0b2ab3..71bb86a301ef 100644
--- a/test/SemaObjC/property-noprotocol-warning.m
+++ b/test/SemaObjC/property-noprotocol-warning.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Object
diff --git a/test/SemaObjC/property-not-lvalue.m b/test/SemaObjC/property-not-lvalue.m
new file mode 100644
index 000000000000..f1bda094c2db
--- /dev/null
+++ b/test/SemaObjC/property-not-lvalue.m
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+typedef struct NSSize {
+ int width;
+ struct {
+ int dim;
+ } inner;
+} NSSize;
+
+@interface Foo {
+ NSSize _size;
+}
+@property NSSize size;
+@end
+
+void foo() {
+ Foo *f;
+ f.size.width = 2.2; // expected-error {{cannot assign to a sub-structure of an ivar using property assignment syntax}}
+ f.size.inner.dim = 200; // expected-error {{cannot assign to a sub-structure of an ivar using property assignment syntax}}
+}
diff --git a/test/SemaObjC/property-redundant-decl-accessor.m b/test/SemaObjC/property-redundant-decl-accessor.m
index 84fc8fa3be4f..2a24e7e82446 100644
--- a/test/SemaObjC/property-redundant-decl-accessor.m
+++ b/test/SemaObjC/property-redundant-decl-accessor.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -Werror -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Werror -verify %s
@interface MyClass {
const char *_myName;
diff --git a/test/SemaObjC/property-typecheck-1.m b/test/SemaObjC/property-typecheck-1.m
index c9562787983a..fc53b590b8b2 100644
--- a/test/SemaObjC/property-typecheck-1.m
+++ b/test/SemaObjC/property-typecheck-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface A
-(float) x; // expected-note {{declared at}}
diff --git a/test/SemaObjC/property-user-setter.m b/test/SemaObjC/property-user-setter.m
index 94458dca6ee0..c06f2b6f44fb 100644
--- a/test/SemaObjC/property-user-setter.m
+++ b/test/SemaObjC/property-user-setter.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface I0
@property(readonly) int x;
@@ -80,6 +80,7 @@ static int g_val;
}
@end
+void abort(void);
int main (void) {
Subclass *x = [[Subclass alloc] init];
diff --git a/test/SemaObjC/property-weak.m b/test/SemaObjC/property-weak.m
index 2e4e1f0044fd..a4397a684fc0 100644
--- a/test/SemaObjC/property-weak.m
+++ b/test/SemaObjC/property-weak.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
@interface foo
@property(nonatomic) int foo __attribute__((weak_import));
diff --git a/test/SemaObjC/property.m b/test/SemaObjC/property.m
index b2f594fe3201..bc2056c97911 100644
--- a/test/SemaObjC/property.m
+++ b/test/SemaObjC/property.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
@interface I
{
@@ -53,3 +53,12 @@ typedef id BYObjectIdentifier;
@property(copy) BYObjectIdentifier identifier;
@end
+@interface Foo2
+{
+ int ivar;
+}
+@property int treeController; // expected-note {{property declared here}}
+@property int ivar; // OK
+@property int treeController; // expected-error {{property has a previous declaration}}
+@end
+
diff --git a/test/SemaObjC/props-on-prots.m b/test/SemaObjC/props-on-prots.m
index dd92bfac49c1..c01e8338628e 100644
--- a/test/SemaObjC/props-on-prots.m
+++ b/test/SemaObjC/props-on-prots.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
diff --git a/test/SemaObjC/protocol-archane.m b/test/SemaObjC/protocol-archane.m
index c24e9fb5ed16..108a72988e21 100644
--- a/test/SemaObjC/protocol-archane.m
+++ b/test/SemaObjC/protocol-archane.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar://5986251
@protocol SomeProtocol
diff --git a/test/SemaObjC/protocol-attribute.m b/test/SemaObjC/protocol-attribute.m
index 1bce37e49d84..e04a39bda6ca 100644
--- a/test/SemaObjC/protocol-attribute.m
+++ b/test/SemaObjC/protocol-attribute.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
__attribute ((unavailable))
@protocol FwProto; // expected-note{{marked unavailable}}
diff --git a/test/SemaObjC/protocol-expr-1.m b/test/SemaObjC/protocol-expr-1.m
index 22c0ed0ba4c3..fe01d1d47a8d 100644
--- a/test/SemaObjC/protocol-expr-1.m
+++ b/test/SemaObjC/protocol-expr-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol fproto;
diff --git a/test/SemaObjC/protocol-expr-neg-1.m b/test/SemaObjC/protocol-expr-neg-1.m
index 2928a46bc07a..58ac8c0ca322 100644
--- a/test/SemaObjC/protocol-expr-neg-1.m
+++ b/test/SemaObjC/protocol-expr-neg-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@class Protocol;
diff --git a/test/SemaObjC/protocol-id-test-1.m b/test/SemaObjC/protocol-id-test-1.m
index 79220ea1a459..6b2b682a135d 100644
--- a/test/SemaObjC/protocol-id-test-1.m
+++ b/test/SemaObjC/protocol-id-test-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify %s
+// RUN: %clang_cc1 -verify %s
@interface FF
- (void) Meth;
diff --git a/test/SemaObjC/protocol-id-test-2.m b/test/SemaObjC/protocol-id-test-2.m
index b8f94a6d7579..a9365e9cb932 100644
--- a/test/SemaObjC/protocol-id-test-2.m
+++ b/test/SemaObjC/protocol-id-test-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify %s
+// RUN: %clang_cc1 -verify %s
@protocol P
@end
diff --git a/test/SemaObjC/protocol-id-test-3.m b/test/SemaObjC/protocol-id-test-3.m
index 54c55cd4845e..3538b0e05e37 100644
--- a/test/SemaObjC/protocol-id-test-3.m
+++ b/test/SemaObjC/protocol-id-test-3.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -pedantic -fsyntax-only -verify %s
+// RUN: %clang_cc1 -pedantic -fsyntax-only -verify %s
@protocol MyProto1
@end
diff --git a/test/SemaObjC/protocol-implementation-inherited.m b/test/SemaObjC/protocol-implementation-inherited.m
index 4fc60fe5c98f..c333bb5042d2 100644
--- a/test/SemaObjC/protocol-implementation-inherited.m
+++ b/test/SemaObjC/protocol-implementation-inherited.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P0
-bar;
diff --git a/test/SemaObjC/protocol-lookup-2.m b/test/SemaObjC/protocol-lookup-2.m
index 744fbee9828d..bf0752312e44 100644
--- a/test/SemaObjC/protocol-lookup-2.m
+++ b/test/SemaObjC/protocol-lookup-2.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface NSObject @end
@protocol ProtocolA
diff --git a/test/SemaObjC/protocol-lookup.m b/test/SemaObjC/protocol-lookup.m
index b2b354b7782d..ed3fbe0f72bf 100644
--- a/test/SemaObjC/protocol-lookup.m
+++ b/test/SemaObjC/protocol-lookup.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol NSObject
- retain;
- release;
diff --git a/test/SemaObjC/protocol-qualified-class-unsupported.m b/test/SemaObjC/protocol-qualified-class-unsupported.m
index e4e12d6a39d4..4bf6b289e7b7 100644
--- a/test/SemaObjC/protocol-qualified-class-unsupported.m
+++ b/test/SemaObjC/protocol-qualified-class-unsupported.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stddef.h>
diff --git a/test/SemaObjC/protocol-typecheck.m b/test/SemaObjC/protocol-typecheck.m
index e91cdfefb728..d9cde87d4c2c 100644
--- a/test/SemaObjC/protocol-typecheck.m
+++ b/test/SemaObjC/protocol-typecheck.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface NSObject @end
@protocol XCElementP @end
diff --git a/test/SemaObjC/protocols.m b/test/SemaObjC/protocols.m
index 579feee7b9c2..8447fe2aad2f 100644
--- a/test/SemaObjC/protocols.m
+++ b/test/SemaObjC/protocols.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface INTF1
@required // expected-error {{directive may only be specified in protocols only}}
diff --git a/test/SemaObjC/rdr-6211479-array-property.m b/test/SemaObjC/rdr-6211479-array-property.m
index a5d177335cee..39c056c5ba61 100644
--- a/test/SemaObjC/rdr-6211479-array-property.m
+++ b/test/SemaObjC/rdr-6211479-array-property.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// <rdar://problem/6211479>
typedef int T[2];
diff --git a/test/SemaObjC/restrict-id-type.m b/test/SemaObjC/restrict-id-type.m
index 9bd5612aba33..b24fcb0185e4 100644
--- a/test/SemaObjC/restrict-id-type.m
+++ b/test/SemaObjC/restrict-id-type.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -std=gnu99 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=gnu99 -fsyntax-only -verify %s
void f0(restrict id a0) {}
diff --git a/test/SemaObjC/return.m b/test/SemaObjC/return.m
index 743f0f9fca30..c578bf3b6569 100644
--- a/test/SemaObjC/return.m
+++ b/test/SemaObjC/return.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only -verify -Wmissing-noreturn
+// RUN: %clang_cc1 %s -fsyntax-only -verify -Wmissing-noreturn
int test1() {
id a;
diff --git a/test/SemaObjC/scope-check.m b/test/SemaObjC/scope-check.m
index 618bcd7bf1e3..bba321e65766 100644
--- a/test/SemaObjC/scope-check.m
+++ b/test/SemaObjC/scope-check.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@class A, B, C;
diff --git a/test/SemaObjC/selector-1.m b/test/SemaObjC/selector-1.m
index 7df2bdaeb701..9a7375b8d288 100644
--- a/test/SemaObjC/selector-1.m
+++ b/test/SemaObjC/selector-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -verify %s
+// RUN: %clang_cc1 -verify %s
@interface Lancelot @end
@implementation Lancelot
diff --git a/test/SemaObjC/selector-error.m b/test/SemaObjC/selector-error.m
index 0df5df0bcc10..dfd6bd053d19 100644
--- a/test/SemaObjC/selector-error.m
+++ b/test/SemaObjC/selector-error.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Foo
- (char*) foo;
diff --git a/test/SemaObjC/selector-overload.m b/test/SemaObjC/selector-overload.m
index 65c907eacded..53ba6f7e7e32 100644
--- a/test/SemaObjC/selector-overload.m
+++ b/test/SemaObjC/selector-overload.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -fsyntax-only
+// RUN: %clang_cc1 %s -fsyntax-only
@interface NSObject
+ alloc;
diff --git a/test/SemaObjC/sizeof-interface.m b/test/SemaObjC/sizeof-interface.m
index cb4195bbd99b..9d85f1f53fcc 100644
--- a/test/SemaObjC/sizeof-interface.m
+++ b/test/SemaObjC/sizeof-interface.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s
@class I0;
diff --git a/test/SemaObjC/static-ivar-ref-1.m b/test/SemaObjC/static-ivar-ref-1.m
index 5c977580e702..cd5e05558c35 100644
--- a/test/SemaObjC/static-ivar-ref-1.m
+++ b/test/SemaObjC/static-ivar-ref-1.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 -triple i386-unknown-unknown -ast-print %s
-// RUN: clang -cc1 -triple x86_64-apple-darwin10 -ast-print %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -ast-print %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -ast-print %s
@interface current
{
diff --git a/test/SemaObjC/stmts.m b/test/SemaObjC/stmts.m
index 1402b288b3e8..20a9f55b2095 100644
--- a/test/SemaObjC/stmts.m
+++ b/test/SemaObjC/stmts.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
struct some_struct;
diff --git a/test/SemaObjC/string.m b/test/SemaObjC/string.m
index 077ba7d93e01..04f20ab1bcf1 100644
--- a/test/SemaObjC/string.m
+++ b/test/SemaObjC/string.m
@@ -1,5 +1,5 @@
-// RUN: clang -cc1 %s -verify -fsyntax-only
-// RUN: clang -cc1 %s -verify -fsyntax-only -DDECLAREIT
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only -DDECLAREIT
// a declaration of NSConstantString is not required.
#ifdef DECLAREIT
diff --git a/test/SemaObjC/super-cat-prot.m b/test/SemaObjC/super-cat-prot.m
index a7288bbc3bab..3e289860c06e 100644
--- a/test/SemaObjC/super-cat-prot.m
+++ b/test/SemaObjC/super-cat-prot.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
diff --git a/test/SemaObjC/super-property-message-expr.m b/test/SemaObjC/super-property-message-expr.m
index 15d4db00414d..c25164e15973 100644
--- a/test/SemaObjC/super-property-message-expr.m
+++ b/test/SemaObjC/super-property-message-expr.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface SStoreNodeInfo
diff --git a/test/SemaObjC/super-property-notation.m b/test/SemaObjC/super-property-notation.m
index d67bdcb8e6f0..7d3f7c70bb52 100644
--- a/test/SemaObjC/super-property-notation.m
+++ b/test/SemaObjC/super-property-notation.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface B
+(int) classGetter;
diff --git a/test/SemaObjC/super.m b/test/SemaObjC/super.m
index 2896968e464d..3b8697288a3a 100644
--- a/test/SemaObjC/super.m
+++ b/test/SemaObjC/super.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Foo
- iMethod;
diff --git a/test/SemaObjC/synchronized.m b/test/SemaObjC/synchronized.m
index d1aa101c7dc2..dac620a81829 100644
--- a/test/SemaObjC/synchronized.m
+++ b/test/SemaObjC/synchronized.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface PBXTrackableTaskManager @end
diff --git a/test/SemaObjC/synthesize-setter-contclass.m b/test/SemaObjC/synthesize-setter-contclass.m
index 184c4ead0785..36967d458e36 100644
--- a/test/SemaObjC/synthesize-setter-contclass.m
+++ b/test/SemaObjC/synthesize-setter-contclass.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface TestClass
{
diff --git a/test/SemaObjC/synthesized-ivar.m b/test/SemaObjC/synthesized-ivar.m
index c41884eef712..465caf24a736 100644
--- a/test/SemaObjC/synthesized-ivar.m
+++ b/test/SemaObjC/synthesized-ivar.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
@interface I
{
}
diff --git a/test/SemaObjC/try-catch.m b/test/SemaObjC/try-catch.m
index fb6182cc76d7..01fc4f4f2c56 100644
--- a/test/SemaObjC/try-catch.m
+++ b/test/SemaObjC/try-catch.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
typedef struct _NSZone NSZone;
diff --git a/test/SemaObjC/typedef-class.m b/test/SemaObjC/typedef-class.m
index 0c48715f19bd..0f7e6822c4f9 100644
--- a/test/SemaObjC/typedef-class.m
+++ b/test/SemaObjC/typedef-class.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
typedef struct _NSZone NSZone;
diff --git a/test/SemaObjC/ucn-objc-string.m b/test/SemaObjC/ucn-objc-string.m
index 7603199d0211..6070278bb134 100644
--- a/test/SemaObjC/ucn-objc-string.m
+++ b/test/SemaObjC/ucn-objc-string.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
@class NSString;
extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));
diff --git a/test/SemaObjC/undeclared-selector.m b/test/SemaObjC/undeclared-selector.m
index 6791aaf0f361..758e1d7f5602 100644
--- a/test/SemaObjC/undeclared-selector.m
+++ b/test/SemaObjC/undeclared-selector.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -Wundeclared-selector -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wundeclared-selector -verify %s
typedef struct objc_selector *SEL;
diff --git a/test/SemaObjC/undef-class-messagin-error.m b/test/SemaObjC/undef-class-messagin-error.m
index d8e50a0acd22..0a400dd39f5f 100644
--- a/test/SemaObjC/undef-class-messagin-error.m
+++ b/test/SemaObjC/undef-class-messagin-error.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface _Child
+ (int) flashCache;
diff --git a/test/SemaObjC/undef-protocol-methods-1.m b/test/SemaObjC/undef-protocol-methods-1.m
index 066d53218bbf..9a35ef7ba806 100644
--- a/test/SemaObjC/undef-protocol-methods-1.m
+++ b/test/SemaObjC/undef-protocol-methods-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P1
- (void) P1proto;
diff --git a/test/SemaObjC/undef-superclass-1.m b/test/SemaObjC/undef-superclass-1.m
index 2deb0b1ae60f..7611cf3b1554 100644
--- a/test/SemaObjC/undef-superclass-1.m
+++ b/test/SemaObjC/undef-superclass-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@class SUPER, Y;
diff --git a/test/SemaObjC/undefined-protocol-type-1.m b/test/SemaObjC/undefined-protocol-type-1.m
index c2e2abc5bb60..3be4425cdcec 100644
--- a/test/SemaObjC/undefined-protocol-type-1.m
+++ b/test/SemaObjC/undefined-protocol-type-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol p1, p4;
@protocol p2 @end
diff --git a/test/SemaObjC/unused.m b/test/SemaObjC/unused.m
index f492ac5d3789..7fdb80152f31 100644
--- a/test/SemaObjC/unused.m
+++ b/test/SemaObjC/unused.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 %s -verify -Wunused -fsyntax-only
+// RUN: %clang_cc1 %s -verify -Wunused -fsyntax-only
int printf(const char *, ...);
diff --git a/test/SemaObjC/va-method-1.m b/test/SemaObjC/va-method-1.m
index 424ecab006d6..fe7ccd7632cd 100644
--- a/test/SemaObjC/va-method-1.m
+++ b/test/SemaObjC/va-method-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#include <stdarg.h>
diff --git a/test/SemaObjC/warn-assign-property-nscopying.m b/test/SemaObjC/warn-assign-property-nscopying.m
index ecf2c6a00a62..953814cdce1b 100644
--- a/test/SemaObjC/warn-assign-property-nscopying.m
+++ b/test/SemaObjC/warn-assign-property-nscopying.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fobjc-gc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fobjc-gc -fsyntax-only -verify %s
@protocol NSCopying @end
diff --git a/test/SemaObjC/warn-selector-selection.m b/test/SemaObjC/warn-selector-selection.m
index 19c9154a36b2..96ed77c14bef 100644
--- a/test/SemaObjC/warn-selector-selection.m
+++ b/test/SemaObjC/warn-selector-selection.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Object
- (void)foo;
diff --git a/test/SemaObjC/warn-superclass-method-mismatch.m b/test/SemaObjC/warn-superclass-method-mismatch.m
index acca86797e9d..a4005ad2b293 100644
--- a/test/SemaObjC/warn-superclass-method-mismatch.m
+++ b/test/SemaObjC/warn-superclass-method-mismatch.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -Wsuper-class-method-mismatch -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wsuper-class-method-mismatch -verify %s
@interface Root
-(void) method_r: (char)ch : (float*)f1 : (int*) x; // expected-note {{previous declaration is here}}
diff --git a/test/SemaObjC/warn-weak-field.m b/test/SemaObjC/warn-weak-field.m
index b688a1fea009..f20691c18696 100644
--- a/test/SemaObjC/warn-weak-field.m
+++ b/test/SemaObjC/warn-weak-field.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s
struct S {
__weak id w; // expected-warning {{__weak attribute cannot be specified on a field declaration}}
diff --git a/test/SemaObjC/weak-attr-ivar.m b/test/SemaObjC/weak-attr-ivar.m
index 84bdb967262d..d5bbb01902db 100644
--- a/test/SemaObjC/weak-attr-ivar.m
+++ b/test/SemaObjC/weak-attr-ivar.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
diff --git a/test/SemaObjC/writable-property-in-superclass.m b/test/SemaObjC/writable-property-in-superclass.m
index cc9295a9bc01..bbd1f16cffc0 100644
--- a/test/SemaObjC/writable-property-in-superclass.m
+++ b/test/SemaObjC/writable-property-in-superclass.m
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface MessageStore
@property (assign, readonly) int P;
diff --git a/test/SemaObjCXX/blocks.mm b/test/SemaObjCXX/blocks.mm
index 92a909621421..72de17133617 100644
--- a/test/SemaObjCXX/blocks.mm
+++ b/test/SemaObjCXX/blocks.mm
@@ -1,14 +1,14 @@
-// RUN: clang -cc1 -fsyntax-only -verify -fblocks %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
@protocol NSObject;
void bar(id(^)(void));
void foo(id <NSObject>(^objectCreationBlock)(void)) {
- return bar(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (^)()', expected 'id<NSObject> (^)()'}}
+ return bar(objectCreationBlock); // expected-warning{{incompatible pointer types converting 'id (^)()', expected 'id<NSObject> (^)()'}}
}
void bar2(id(*)(void));
void foo2(id <NSObject>(*objectCreationBlock)(void)) {
- return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (*)()', expected 'id<NSObject> (*)()'}}
+ return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types converting 'id (*)()', expected 'id<NSObject> (*)()'}}
}
void bar3(id(*)()); // expected-note{{candidate function}}
diff --git a/test/SemaObjCXX/category-lookup.mm b/test/SemaObjCXX/category-lookup.mm
index 0458752d9338..0e870259b735 100644
--- a/test/SemaObjCXX/category-lookup.mm
+++ b/test/SemaObjCXX/category-lookup.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface NSObject @end
diff --git a/test/SemaObjCXX/composite-objc-pointertype.mm b/test/SemaObjCXX/composite-objc-pointertype.mm
index 786315e0e7a3..0d9a93897656 100644
--- a/test/SemaObjCXX/composite-objc-pointertype.mm
+++ b/test/SemaObjCXX/composite-objc-pointertype.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface Foo
@end
diff --git a/test/SemaObjCXX/conditional-expr.mm b/test/SemaObjCXX/conditional-expr.mm
index e1f92cded3ac..a6b7c08e8fcb 100644
--- a/test/SemaObjCXX/conditional-expr.mm
+++ b/test/SemaObjCXX/conditional-expr.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P0
@end
@@ -27,11 +27,11 @@ void f1(id x, A *a) {
}
void f2(id<P1> x) {
- id<P0> l = x; // expected-error {{incompatible type initializing 'id<P1>', expected 'id<P0>'}}
+ id<P0> l = x; // expected-error {{cannot initialize a variable of type 'id<P0>' with an lvalue of type 'id<P1>'}}
}
void f3(A *a) {
- id<P1> l = a; // expected-error {{incompatible type initializing 'A *', expected 'id<P1>'}}
+ id<P1> l = a; // expected-error {{cannot initialize a variable of type 'id<P1>' with an lvalue of type 'A *'}}
}
void f4(int cond, id x, A *a) {
diff --git a/test/SemaObjCXX/cstyle-cast.mm b/test/SemaObjCXX/cstyle-cast.mm
index fca2ef5cb613..4a211e319704 100644
--- a/test/SemaObjCXX/cstyle-cast.mm
+++ b/test/SemaObjCXX/cstyle-cast.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P @end
@interface I @end
diff --git a/test/SemaObjCXX/function-pointer-void-star.mm b/test/SemaObjCXX/function-pointer-void-star.mm
new file mode 100644
index 000000000000..8d3d6251734f
--- /dev/null
+++ b/test/SemaObjCXX/function-pointer-void-star.mm
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+extern "C" id (*_dealloc)(id) ;
+
+void foo() {
+ extern void *_original_dealloc;
+ if (_dealloc == _original_dealloc) { }
+ if (_dealloc != _original_dealloc) { }
+}
diff --git a/test/SemaObjCXX/linkage-spec.mm b/test/SemaObjCXX/linkage-spec.mm
index bbdea7b25873..b4e809eee161 100644
--- a/test/SemaObjCXX/linkage-spec.mm
+++ b/test/SemaObjCXX/linkage-spec.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
extern "C" {
@class Protocol;
}
diff --git a/test/SemaObjCXX/objc-decls-inside-namespace.mm b/test/SemaObjCXX/objc-decls-inside-namespace.mm
index 464b2871c85d..9953ec366e16 100644
--- a/test/SemaObjCXX/objc-decls-inside-namespace.mm
+++ b/test/SemaObjCXX/objc-decls-inside-namespace.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace C {
diff --git a/test/SemaObjCXX/objc-pointer-conv.mm b/test/SemaObjCXX/objc-pointer-conv.mm
new file mode 100644
index 000000000000..c03e3aaad3db
--- /dev/null
+++ b/test/SemaObjCXX/objc-pointer-conv.mm
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+typedef const void * VoidStar;
+
+typedef struct __CFDictionary * CFMDRef;
+
+void RandomFunc(CFMDRef theDict, const void *key, const void *value);
+
+@interface Foo
+- (void)_apply:(void (*)(const void *, const void *, void *))func context:(void *)context;
+- (void)a:(id *)objects b:(id *)keys;
+@end
+
+@implementation Foo
+- (void)_apply:(void (*)(const void *, const void *, void *))func context:(void *)context {
+ id item;
+ id obj;
+ func(item, obj, context);
+}
+
+- (void)a:(id *)objects b:(id *)keys {
+ VoidStar dict;
+ id key;
+ RandomFunc((CFMDRef)dict, key, objects[3]);
+}
+@end
diff --git a/test/SemaObjCXX/overload.mm b/test/SemaObjCXX/overload.mm
index a15907ce421f..18da69f5442e 100644
--- a/test/SemaObjCXX/overload.mm
+++ b/test/SemaObjCXX/overload.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// XFAIL: *
@interface Foo
@end
diff --git a/test/SemaObjCXX/protocol-lookup.mm b/test/SemaObjCXX/protocol-lookup.mm
index b2b354b7782d..ed3fbe0f72bf 100644
--- a/test/SemaObjCXX/protocol-lookup.mm
+++ b/test/SemaObjCXX/protocol-lookup.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol NSObject
- retain;
- release;
diff --git a/test/SemaObjCXX/references.mm b/test/SemaObjCXX/references.mm
index c4961efc1a55..70ce8278e8f0 100644
--- a/test/SemaObjCXX/references.mm
+++ b/test/SemaObjCXX/references.mm
@@ -1,7 +1,4 @@
-// FIXME: This crashes, disable it until fixed.
-// RN: clang -cc1 -verify -emit-llvm -o - %s
-// RUN: false
-// XFAIL: *
+// RUN: %clang_cc1 -verify -emit-llvm -o - %s
// Test reference binding.
@@ -12,7 +9,7 @@ typedef struct {
@interface A
@property (assign) T p0;
-@property (assign) T& p1;
+@property (assign) T& p1; // expected-error {{property of reference type is not supported}}
@end
int f0(const T& t) {
@@ -24,6 +21,6 @@ int f1(A *a) {
}
int f2(A *a) {
- return f0(a.p1);
+ return f0(a.p1); // expected-error {{property 'p1' not found on object of type 'A *'}}
}
diff --git a/test/SemaObjCXX/reserved-keyword-selectors.mm b/test/SemaObjCXX/reserved-keyword-selectors.mm
index add8e75ef806..3c4bef595daa 100644
--- a/test/SemaObjCXX/reserved-keyword-selectors.mm
+++ b/test/SemaObjCXX/reserved-keyword-selectors.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface A
- (void)asm;
diff --git a/test/SemaObjCXX/standard-conversion-to-bool.mm b/test/SemaObjCXX/standard-conversion-to-bool.mm
index cb97546582d7..2e6984872d79 100644
--- a/test/SemaObjCXX/standard-conversion-to-bool.mm
+++ b/test/SemaObjCXX/standard-conversion-to-bool.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@class NSString;
id a;
diff --git a/test/SemaObjCXX/vararg-non-pod.mm b/test/SemaObjCXX/vararg-non-pod.mm
index ee6462b0e027..6ced8e426bc5 100644
--- a/test/SemaObjCXX/vararg-non-pod.mm
+++ b/test/SemaObjCXX/vararg-non-pod.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s -Wnon-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wnon-pod-varargs
extern char version[];
diff --git a/test/SemaObjCXX/void_to_obj.mm b/test/SemaObjCXX/void_to_obj.mm
index 851ecf5db666..932827e61425 100644
--- a/test/SemaObjCXX/void_to_obj.mm
+++ b/test/SemaObjCXX/void_to_obj.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// <rdar://problem/6463729>
@class XX;
diff --git a/test/SemaTemplate/ackermann.cpp b/test/SemaTemplate/ackermann.cpp
index c936889f25f9..9525bfcc4f43 100644
--- a/test/SemaTemplate/ackermann.cpp
+++ b/test/SemaTemplate/ackermann.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// template<unsigned M, unsigned N>
// struct Ackermann {
diff --git a/test/SemaTemplate/ambiguous-ovl-print.cpp b/test/SemaTemplate/ambiguous-ovl-print.cpp
index ccdeb9bebc57..17f412f6716d 100644
--- a/test/SemaTemplate/ambiguous-ovl-print.cpp
+++ b/test/SemaTemplate/ambiguous-ovl-print.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f(void*, int); // expected-note{{candidate function}}
template<typename T>
diff --git a/test/SemaTemplate/anonymous-union.cpp b/test/SemaTemplate/anonymous-union.cpp
new file mode 100644
index 000000000000..59d1f25a4fd2
--- /dev/null
+++ b/test/SemaTemplate/anonymous-union.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR5868
+struct T0 {
+ int x;
+ union {
+ void *m0;
+ };
+};
+template <typename T>
+struct T1 : public T0, public T {
+ void f0() {
+ m0 = 0; // expected-error{{ambiguous conversion}}
+ }
+};
+
+struct A : public T0 { };
+
+void f1(T1<A> *S) { S->f0(); } // expected-note{{instantiation of member function}}
diff --git a/test/SemaTemplate/canonical-expr-type-0x.cpp b/test/SemaTemplate/canonical-expr-type-0x.cpp
index 21552105b0ff..73cf3c29665c 100644
--- a/test/SemaTemplate/canonical-expr-type-0x.cpp
+++ b/test/SemaTemplate/canonical-expr-type-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
void f();
diff --git a/test/SemaTemplate/canonical-expr-type.cpp b/test/SemaTemplate/canonical-expr-type.cpp
index 0580c677e627..7582df5e66aa 100644
--- a/test/SemaTemplate/canonical-expr-type.cpp
+++ b/test/SemaTemplate/canonical-expr-type.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f();
diff --git a/test/SemaTemplate/class-template-ctor-initializer.cpp b/test/SemaTemplate/class-template-ctor-initializer.cpp
index d7649f52688d..fd9417c795f6 100644
--- a/test/SemaTemplate/class-template-ctor-initializer.cpp
+++ b/test/SemaTemplate/class-template-ctor-initializer.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<class X> struct A {};
diff --git a/test/SemaTemplate/class-template-decl.cpp b/test/SemaTemplate/class-template-decl.cpp
index a8163127b000..71aabe97f4e3 100644
--- a/test/SemaTemplate/class-template-decl.cpp
+++ b/test/SemaTemplate/class-template-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> class A;
diff --git a/test/SemaTemplate/class-template-id-2.cpp b/test/SemaTemplate/class-template-id-2.cpp
index c4388a7c1556..c492a365880c 100644
--- a/test/SemaTemplate/class-template-id-2.cpp
+++ b/test/SemaTemplate/class-template-id-2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace N {
template<typename T> class A { };
diff --git a/test/SemaTemplate/class-template-id.cpp b/test/SemaTemplate/class-template-id.cpp
index 98ccbe7db6f8..df5ef554f7aa 100644
--- a/test/SemaTemplate/class-template-id.cpp
+++ b/test/SemaTemplate/class-template-id.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, typename U = float> struct A { };
typedef A<int> A_int;
@@ -9,9 +9,9 @@ A<int, FLOAT> *foo(A<int> *ptr, A<int> const *ptr2, A<int, double> *ptr3) {
if (ptr)
return ptr; // okay
else if (ptr2)
- return ptr2; // expected-error{{incompatible type returning 'A<int> const *', expected 'A<int, FLOAT> *'}}
+ return ptr2; // expected-error{{cannot initialize return object of type 'A<int, FLOAT> *' with an lvalue of type 'A<int> const *'}}
else {
- return ptr3; // expected-error{{incompatible type returning 'A<int, double> *', expected 'A<int, FLOAT> *'}}
+ return ptr3; // expected-error{{cannot initialize return object of type 'A<int, FLOAT> *' with an lvalue of type 'A<int, double> *'}}
}
}
@@ -24,7 +24,7 @@ B<17 + 2> *bar(B<(19)> *ptr1, B< (::value + 7) > *ptr2, B<19 - 3> *ptr3) {
else if (ptr2)
return ptr2;
else
- return ptr3; // expected-error{{incompatible type returning 'B<19 - 3> *', expected 'B<17 + 2> *'}}
+ return ptr3; // expected-error{{cannot initialize return object of type 'B<17 + 2> *' with an lvalue of type 'B<19 - 3>}}
}
typedef B<5> B5;
diff --git a/test/SemaTemplate/class-template-spec.cpp b/test/SemaTemplate/class-template-spec.cpp
index 2808404b1d99..efb00c7f3d25 100644
--- a/test/SemaTemplate/class-template-spec.cpp
+++ b/test/SemaTemplate/class-template-spec.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, typename U = int> struct A; // expected-note {{template is declared here}} \
// expected-note{{explicitly specialized}}
diff --git a/test/SemaTemplate/constructor-template.cpp b/test/SemaTemplate/constructor-template.cpp
index 0b6916fa485d..139de9d68605 100644
--- a/test/SemaTemplate/constructor-template.cpp
+++ b/test/SemaTemplate/constructor-template.cpp
@@ -1,11 +1,11 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X0 { // expected-note{{candidate}}
X0(int); // expected-note{{candidate}}
- template<typename T> X0(T);
- template<typename T, typename U> X0(T*, U*);
+ template<typename T> X0(T); // expected-note {{candidate}}
+ template<typename T, typename U> X0(T*, U*); // expected-note {{candidate}}
// PR4761
- template<typename T> X0() : f0(T::foo) {}
+ template<typename T> X0() : f0(T::foo) {} // expected-note {{candidate}}
int f0;
};
@@ -52,7 +52,7 @@ template <> struct A<int>{A(const A<int>&);};
struct B { A<int> x; B(B& a) : x(a.x) {} };
struct X2 {
- X2();
+ X2(); // expected-note{{candidate function}}
X2(X2&); // expected-note {{candidate function}}
template<typename T> X2(T);
};
@@ -61,7 +61,7 @@ X2 test(bool Cond, X2 x2) {
if (Cond)
return x2; // okay, uses copy constructor
- return X2(); // expected-error{{no viable conversion from 'struct X2' to 'struct X2' is possible}}
+ return X2(); // expected-error{{no matching constructor}}
}
struct X3 {
@@ -71,7 +71,7 @@ struct X3 {
template<> X3::X3(X3); // expected-error{{must pass its first argument by reference}}
struct X4 {
- X4();
+ X4(); // expected-note{{candidate function}}
~X4();
X4(X4&); // expected-note {{candidate function}}
template<typename T> X4(const T&, int = 17);
@@ -80,7 +80,7 @@ struct X4 {
X4 test_X4(bool Cond, X4 x4) {
X4 a(x4, 17); // okay, constructor template
X4 b(x4); // okay, copy constructor
- return X4(); // expected-error{{no viable conversion}}
+ return X4(); // expected-error{{no matching constructor}}
}
// Instantiation of a non-dependent use of a constructor
diff --git a/test/SemaTemplate/copy-ctor-assign.cpp b/test/SemaTemplate/copy-ctor-assign.cpp
index 69481ea557f4..ae6dc9c30fa1 100644
--- a/test/SemaTemplate/copy-ctor-assign.cpp
+++ b/test/SemaTemplate/copy-ctor-assign.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Make sure that copy constructors and assignment operators are properly
// generated when there is a matching
diff --git a/test/SemaTemplate/current-instantiation.cpp b/test/SemaTemplate/current-instantiation.cpp
index fe2c558a3d21..45637484f0fd 100644
--- a/test/SemaTemplate/current-instantiation.cpp
+++ b/test/SemaTemplate/current-instantiation.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// This test concerns the identity of dependent types within the
// canonical type system, specifically focusing on the difference
diff --git a/test/SemaTemplate/deduction.cpp b/test/SemaTemplate/deduction.cpp
index 7b7e18f74aec..375d199f5899 100644
--- a/test/SemaTemplate/deduction.cpp
+++ b/test/SemaTemplate/deduction.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
// Template argument deduction with template template parameters.
template<typename T, template<T> class A>
@@ -81,3 +81,8 @@ int array1[is_same<Replace<const _1, int, float>::type, const int>::value? 1 : -
int array2[is_same<Replace<vector<_1>, int, float>::type, vector<int> >::value? 1 : -1];
int array3[is_same<Replace<vector<const _1>, int, float>::type, vector<const int> >::value? 1 : -1];
int array4[is_same<Replace<vector<int, _2>, double, float>::type, vector<int, float> >::value? 1 : -1];
+
+// PR5911
+template <typename T, int N> void f(const T (&a)[N]);
+int iarr[] = { 1 };
+void test_PR5911() { f(iarr); }
diff --git a/test/SemaTemplate/default-arguments-cxx0x.cpp b/test/SemaTemplate/default-arguments-cxx0x.cpp
index 8d8833c6702e..0f7ba4678b8e 100644
--- a/test/SemaTemplate/default-arguments-cxx0x.cpp
+++ b/test/SemaTemplate/default-arguments-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
// Test default template arguments for function templates.
template<typename T = int>
diff --git a/test/SemaTemplate/default-arguments.cpp b/test/SemaTemplate/default-arguments.cpp
index 0247ddc0ef28..9ea0fc2e4d52 100644
--- a/test/SemaTemplate/default-arguments.cpp
+++ b/test/SemaTemplate/default-arguments.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, int N = 2> struct X; // expected-note{{template is declared here}}
X<int, 1> *x1;
diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp
index 34ac2d967efc..0edc504ea0a3 100644
--- a/test/SemaTemplate/default-expr-arguments.cpp
+++ b/test/SemaTemplate/default-expr-arguments.cpp
@@ -1,14 +1,13 @@
-// RUN: clang-cc -fsyntax-only -verify %s
-
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
class C { C(int a0 = 0); };
template<>
C<char>::C(int a0);
-struct S { };
+struct S { }; // expected-note 3 {{candidate function}}
-template<typename T> void f1(T a, T b = 10) { } // expected-error{{cannot initialize 'b' with an rvalue of type 'int'}}
+template<typename T> void f1(T a, T b = 10) { } // expected-error{{no viable conversion}}
template<typename T> void f2(T a, T b = T()) { }
@@ -26,8 +25,8 @@ void g() {
}
template<typename T> struct F {
- F(T t = 10); // expected-error{{cannot initialize 't' with an rvalue of type 'int'}}
- void f(T t = 10); // expected-error{{cannot initialize 't' with an rvalue of type 'int'}}
+ F(T t = 10); // expected-error{{no viable conversion}}
+ void f(T t = 10); // expected-error{{no viable conversion}}
};
struct FD : F<int> { };
@@ -100,7 +99,7 @@ void test_x2(X2<int> x2i, X2<NotDefaultConstructible> x2n) {
// PR5283
namespace PR5283 {
template<typename T> struct A {
- A(T = 1); // expected-error 3 {{incompatible type initializing 'int', expected 'int *'}}
+ A(T = 1); // expected-error 3 {{cannot initialize a parameter of type 'int *' with an rvalue of type 'int'}}
};
struct B : A<int*> {
@@ -144,3 +143,37 @@ namespace pr5301 {
}
}
+// PR5810
+namespace PR5810 {
+ template<typename T>
+ struct allocator {
+ allocator() { int a[sizeof(T) ? -1 : -1]; } // expected-error2 {{array size is negative}}
+ };
+
+ template<typename T>
+ struct vector {
+ vector(const allocator<T>& = allocator<T>()) {} // expected-note2 {{instantiation of}}
+ };
+
+ struct A { };
+ struct B { };
+
+ template<typename>
+ void FilterVTs() {
+ vector<A> Result;
+ }
+
+ void f() {
+ vector<A> Result;
+ }
+
+ template<typename T>
+ struct X {
+ vector<B> bs;
+ X() { }
+ };
+
+ void f2() {
+ X<float> x; // expected-note{{member function}}
+ }
+}
diff --git a/test/SemaTemplate/dependent-base-member-init.cpp b/test/SemaTemplate/dependent-base-member-init.cpp
index b3d707b632b1..c9823d227d4c 100644
--- a/test/SemaTemplate/dependent-base-member-init.cpp
+++ b/test/SemaTemplate/dependent-base-member-init.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR4381
template<class T> struct X {};
diff --git a/test/SemaTemplate/dependent-expr.cpp b/test/SemaTemplate/dependent-expr.cpp
new file mode 100644
index 000000000000..412a811f7292
--- /dev/null
+++ b/test/SemaTemplate/dependent-expr.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR5908
+template <typename Iterator>
+void Test(Iterator it) {
+ *(it += 1);
+}
diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp
index aef43cb29db4..a2d3c56501e8 100644
--- a/test/SemaTemplate/dependent-names.cpp
+++ b/test/SemaTemplate/dependent-names.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef double A;
template<typename T> class B {
@@ -84,3 +84,17 @@ namespace test0 {
d2.test3(); // expected-note {{in instantiation of member function}}
}
}
+
+namespace test1 {
+ template <class T> struct Base {
+ void foo(T); // expected-note {{must qualify identifier to find this declaration in dependent base class}}
+ };
+
+ template <class T> struct Derived : Base<T> {
+ void doFoo(T v) {
+ foo(v); // expected-error {{use of undeclared identifier}}
+ }
+ };
+
+ template struct Derived<int>; // expected-note {{requested here}}
+}
diff --git a/test/SemaTemplate/dependent-sized_array.cpp b/test/SemaTemplate/dependent-sized_array.cpp
index d221a4d276d2..cf0e0f37ee04 100644
--- a/test/SemaTemplate/dependent-sized_array.cpp
+++ b/test/SemaTemplate/dependent-sized_array.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
template<int N>
void f() {
diff --git a/test/SemaTemplate/dependent-type-identity.cpp b/test/SemaTemplate/dependent-type-identity.cpp
index b7c9040e6cb5..e09581223af6 100644
--- a/test/SemaTemplate/dependent-type-identity.cpp
+++ b/test/SemaTemplate/dependent-type-identity.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// This test concerns the identity of dependent types within the
// canonical type system. This corresponds to C++ [temp.type], which
diff --git a/test/SemaTemplate/destructor-template.cpp b/test/SemaTemplate/destructor-template.cpp
index afe2cfc30019..b5ad967d69d5 100644
--- a/test/SemaTemplate/destructor-template.cpp
+++ b/test/SemaTemplate/destructor-template.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename A> class s0 {
diff --git a/test/SemaTemplate/enum-argument.cpp b/test/SemaTemplate/enum-argument.cpp
index 1d782df202e3..de89487bd581 100644
--- a/test/SemaTemplate/enum-argument.cpp
+++ b/test/SemaTemplate/enum-argument.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
enum Enum { val = 1 };
template <Enum v> struct C {
diff --git a/test/SemaTemplate/example-dynarray.cpp b/test/SemaTemplate/example-dynarray.cpp
index 6f3e58e32ab6..1f6ede67a522 100644
--- a/test/SemaTemplate/example-dynarray.cpp
+++ b/test/SemaTemplate/example-dynarray.cpp
@@ -1,4 +1,4 @@
-// RUN: clang -emit-llvm -S -o %t %s
+// RUN: %clang -emit-llvm -S -o %t %s
#include <stddef.h>
#include <stdlib.h>
#include <assert.h>
diff --git a/test/SemaTemplate/example-typelist.cpp b/test/SemaTemplate/example-typelist.cpp
index 4a2aeb20e730..082aeb83fbdd 100644
--- a/test/SemaTemplate/example-typelist.cpp
+++ b/test/SemaTemplate/example-typelist.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// A simple cons-style typelist
struct nil { };
diff --git a/test/SemaTemplate/explicit-instantiation.cpp b/test/SemaTemplate/explicit-instantiation.cpp
index b04639f6e78c..fbb5edbefd6c 100644
--- a/test/SemaTemplate/explicit-instantiation.cpp
+++ b/test/SemaTemplate/explicit-instantiation.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template void *; // expected-error{{expected unqualified-id}}
@@ -25,8 +25,8 @@ T X0<T>::value; // expected-error{{no matching constructor}}
template int X0<int>::value;
-struct NotDefaultConstructible {
- NotDefaultConstructible(int);
+struct NotDefaultConstructible { // expected-note{{candidate function}}
+ NotDefaultConstructible(int); // expected-note{{candidate function}}
};
template NotDefaultConstructible X0<NotDefaultConstructible>::value; // expected-note{{instantiation}}
diff --git a/test/SemaTemplate/explicit-specialization-member.cpp b/test/SemaTemplate/explicit-specialization-member.cpp
index 197dae5a15af..06dd382fc7a4 100644
--- a/test/SemaTemplate/explicit-specialization-member.cpp
+++ b/test/SemaTemplate/explicit-specialization-member.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X0 {
typedef T* type;
diff --git a/test/SemaTemplate/ext-vector-type.cpp b/test/SemaTemplate/ext-vector-type.cpp
index 7cc4ae930ed2..0e2debf22b99 100644
--- a/test/SemaTemplate/ext-vector-type.cpp
+++ b/test/SemaTemplate/ext-vector-type.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, unsigned Length>
struct make1 {
typedef T __attribute__((ext_vector_type(Length))) type;
diff --git a/test/SemaTemplate/extern-templates.cpp b/test/SemaTemplate/extern-templates.cpp
index 44728d188a24..eca64ed595eb 100644
--- a/test/SemaTemplate/extern-templates.cpp
+++ b/test/SemaTemplate/extern-templates.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
class X0 {
diff --git a/test/SemaTemplate/fibonacci.cpp b/test/SemaTemplate/fibonacci.cpp
index 6cd50157e2bd..ff1711fc529f 100644
--- a/test/SemaTemplate/fibonacci.cpp
+++ b/test/SemaTemplate/fibonacci.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
template<unsigned I>
struct FibonacciEval;
diff --git a/test/SemaTemplate/friend-template.cpp b/test/SemaTemplate/friend-template.cpp
index 98992f6f6078..05289b10d26c 100644
--- a/test/SemaTemplate/friend-template.cpp
+++ b/test/SemaTemplate/friend-template.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR5057
namespace test0 {
@@ -97,3 +97,13 @@ namespace test4 {
f(A<int>()); // expected-note {{in instantiation of function template specialization}}
}
}
+
+namespace test5 {
+ class outer {
+ class foo;
+ template <typename T> friend struct cache;
+ };
+ class outer::foo {
+ template <typename T> friend struct cache;
+ };
+}
diff --git a/test/SemaTemplate/friend.cpp b/test/SemaTemplate/friend.cpp
index 27299523862e..61ef1865da5d 100644
--- a/test/SemaTemplate/friend.cpp
+++ b/test/SemaTemplate/friend.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> struct A {
struct B { };
diff --git a/test/SemaTemplate/fun-template-def.cpp b/test/SemaTemplate/fun-template-def.cpp
index 4d8aaa8d16f1..0c2cf9c4f2e6 100644
--- a/test/SemaTemplate/fun-template-def.cpp
+++ b/test/SemaTemplate/fun-template-def.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Tests that dependent expressions are always allowed, whereas non-dependent
// are checked as usual.
@@ -8,7 +8,7 @@
// Fake typeid, lacking a typeinfo header.
namespace std { class type_info {}; }
-struct dummy {};
+struct dummy {}; // expected-note 3 {{candidate function}}
template<typename T>
int f0(T x) {
@@ -39,9 +39,9 @@ T f1(T t1, U u1, int i1)
new (t1, u1) int;
delete t1;
- dummy d1 = sizeof(t1); // FIXME: delayed checking okay?
- dummy d2 = offsetof(T, foo); // expected-error {{cannot initialize 'd2'}}
- dummy d3 = __alignof(u1); // FIXME: delayed checking okay?
+ dummy d1 = sizeof(t1); // expected-error {{no viable conversion}}
+ dummy d2 = offsetof(T, foo); // expected-error {{no viable conversion}}
+ dummy d3 = __alignof(u1); // expected-error {{no viable conversion}}
i1 = typeid(t1); // expected-error {{incompatible type assigning}}
return u1;
diff --git a/test/SemaTemplate/function-template-specialization.cpp b/test/SemaTemplate/function-template-specialization.cpp
index 90e38cc882fe..91989b1ccae0 100644
--- a/test/SemaTemplate/function-template-specialization.cpp
+++ b/test/SemaTemplate/function-template-specialization.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<int N> void f0(int (&array)[N]);
diff --git a/test/SemaTemplate/implicit-instantiation-1.cpp b/test/SemaTemplate/implicit-instantiation-1.cpp
index d04bbd848407..d1bc5a89da15 100644
--- a/test/SemaTemplate/implicit-instantiation-1.cpp
+++ b/test/SemaTemplate/implicit-instantiation-1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, typename U>
struct X {
T f(T x, U y) { return x + y; }
diff --git a/test/SemaTemplate/injected-class-name.cpp b/test/SemaTemplate/injected-class-name.cpp
index f9674c39a58b..1a65aeb3d6cb 100644
--- a/test/SemaTemplate/injected-class-name.cpp
+++ b/test/SemaTemplate/injected-class-name.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X {
X<T*> *ptr;
diff --git a/test/SemaTemplate/instantiate-anonymous-union.cpp b/test/SemaTemplate/instantiate-anonymous-union.cpp
index 375c1da3ca59..7c75885788de 100644
--- a/test/SemaTemplate/instantiate-anonymous-union.cpp
+++ b/test/SemaTemplate/instantiate-anonymous-union.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s -Wall
+// RUN: %clang_cc1 -fsyntax-only %s -Wall
template <typename T> class A { struct { }; };
diff --git a/test/SemaTemplate/instantiate-array.cpp b/test/SemaTemplate/instantiate-array.cpp
index 29279b436899..97ea6cbb8e53 100644
--- a/test/SemaTemplate/instantiate-array.cpp
+++ b/test/SemaTemplate/instantiate-array.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define __CONCAT(__X, __Y) __CONCAT1(__X, __Y)
diff --git a/test/SemaTemplate/instantiate-attr.cpp b/test/SemaTemplate/instantiate-attr.cpp
index 08ba9c3a0cd5..7fb173645932 100644
--- a/test/SemaTemplate/instantiate-attr.cpp
+++ b/test/SemaTemplate/instantiate-attr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template <typename T>
struct A {
char a __attribute__((aligned(16)));
diff --git a/test/SemaTemplate/instantiate-c99.cpp b/test/SemaTemplate/instantiate-c99.cpp
index cf691cffad36..ae1552887b26 100644
--- a/test/SemaTemplate/instantiate-c99.cpp
+++ b/test/SemaTemplate/instantiate-c99.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Test template instantiation for C99-specific features.
diff --git a/test/SemaTemplate/instantiate-call.cpp b/test/SemaTemplate/instantiate-call.cpp
index a9c4bf481ded..ad06be33aa2b 100644
--- a/test/SemaTemplate/instantiate-call.cpp
+++ b/test/SemaTemplate/instantiate-call.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace N1 {
struct X0 { };
@@ -24,7 +24,7 @@ namespace N3 {
template<typename T, typename Result>
struct call_f0 {
void test_f0(T t) {
- Result &result = f0(t); // expected-error 2{{no matching}}
+ Result &result = f0(t); // expected-error 2{{undeclared identifier}}
}
};
}
diff --git a/test/SemaTemplate/instantiate-case.cpp b/test/SemaTemplate/instantiate-case.cpp
index bed39d7ffb06..1cc2d5d6c62a 100644
--- a/test/SemaTemplate/instantiate-case.cpp
+++ b/test/SemaTemplate/instantiate-case.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<class T>
static int alpha(T c)
diff --git a/test/SemaTemplate/instantiate-cast.cpp b/test/SemaTemplate/instantiate-cast.cpp
index c3c318f36d5d..97d3dc30c56c 100644
--- a/test/SemaTemplate/instantiate-cast.cpp
+++ b/test/SemaTemplate/instantiate-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A { int x; };
diff --git a/test/SemaTemplate/instantiate-clang.cpp b/test/SemaTemplate/instantiate-clang.cpp
index a6c28d9e19db..cef2b7090bf2 100644
--- a/test/SemaTemplate/instantiate-clang.cpp
+++ b/test/SemaTemplate/instantiate-clang.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Test template instantiation for Clang-specific features.
diff --git a/test/SemaTemplate/instantiate-complete.cpp b/test/SemaTemplate/instantiate-complete.cpp
index 507894a2ff69..183fefab4116 100644
--- a/test/SemaTemplate/instantiate-complete.cpp
+++ b/test/SemaTemplate/instantiate-complete.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Tests various places where requiring a complete type involves
// instantiation of that type.
diff --git a/test/SemaTemplate/instantiate-decl-dtor.cpp b/test/SemaTemplate/instantiate-decl-dtor.cpp
new file mode 100644
index 000000000000..193d9764c28c
--- /dev/null
+++ b/test/SemaTemplate/instantiate-decl-dtor.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+template <typename T> struct A {
+ T x;
+ A(int y) { x = y; }
+ ~A() { *x = 10; } // expected-error {{indirection requires pointer operand}}
+};
+
+void a() {
+ A<int> b = 10; // expected-note {{requested here}}
+}
diff --git a/test/SemaTemplate/instantiate-decl-init.cpp b/test/SemaTemplate/instantiate-decl-init.cpp
index d957f2de7da5..b0c2aa8afa91 100644
--- a/test/SemaTemplate/instantiate-decl-init.cpp
+++ b/test/SemaTemplate/instantiate-decl-init.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR5426 - the non-dependent obj would be fully processed and wrapped in a
// CXXConstructExpr at definition time, which would lead to a failure at
diff --git a/test/SemaTemplate/instantiate-declref-ice.cpp b/test/SemaTemplate/instantiate-declref-ice.cpp
index ab12b90f6c98..e4e071dd20d7 100644
--- a/test/SemaTemplate/instantiate-declref-ice.cpp
+++ b/test/SemaTemplate/instantiate-declref-ice.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<int i> struct x {
static const int j = i;
diff --git a/test/SemaTemplate/instantiate-declref.cpp b/test/SemaTemplate/instantiate-declref.cpp
index 359e2c7dfaa4..da8b263ab3ab 100644
--- a/test/SemaTemplate/instantiate-declref.cpp
+++ b/test/SemaTemplate/instantiate-declref.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace N {
struct Outer {
struct Inner {
diff --git a/test/SemaTemplate/instantiate-deeply.cpp b/test/SemaTemplate/instantiate-deeply.cpp
index 7f15bf1200f1..c5f65945afcb 100644
--- a/test/SemaTemplate/instantiate-deeply.cpp
+++ b/test/SemaTemplate/instantiate-deeply.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -Wall -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wall -verify %s
template<typename a> struct A {
template <typename b> struct B {
template <typename c> struct C {
diff --git a/test/SemaTemplate/instantiate-default-assignment-operator.cpp b/test/SemaTemplate/instantiate-default-assignment-operator.cpp
index b0ac078893de..5594d6c7d799 100644
--- a/test/SemaTemplate/instantiate-default-assignment-operator.cpp
+++ b/test/SemaTemplate/instantiate-default-assignment-operator.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename> struct PassRefPtr { };
template<typename T> struct RefPtr {
RefPtr& operator=(const RefPtr&) { int a[sizeof(T) ? -1 : -1];} // expected-error 2 {{array size is negative}}
diff --git a/test/SemaTemplate/instantiate-dependent-nested-name.cpp b/test/SemaTemplate/instantiate-dependent-nested-name.cpp
index 2b1d29878a54..eb1d3fba10ed 100644
--- a/test/SemaTemplate/instantiate-dependent-nested-name.cpp
+++ b/test/SemaTemplate/instantiate-dependent-nested-name.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR4382
template<typename T> struct X { static const T A = 1; };
template<typename T, bool = X<T>::A> struct Y { typedef T A; };
diff --git a/test/SemaTemplate/instantiate-enum-2.cpp b/test/SemaTemplate/instantiate-enum-2.cpp
index 2b56a036e947..aa3b590cada4 100644
--- a/test/SemaTemplate/instantiate-enum-2.cpp
+++ b/test/SemaTemplate/instantiate-enum-2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
template<int IntBits> struct X {
enum {
diff --git a/test/SemaTemplate/instantiate-enum.cpp b/test/SemaTemplate/instantiate-enum.cpp
index a7acf22a45a1..6f9aa4b116d7 100644
--- a/test/SemaTemplate/instantiate-enum.cpp
+++ b/test/SemaTemplate/instantiate-enum.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
template<typename T, T I, int J>
struct adder {
diff --git a/test/SemaTemplate/instantiate-exception-spec.cpp b/test/SemaTemplate/instantiate-exception-spec.cpp
index 31db4487a27a..c418fe16e87f 100644
--- a/test/SemaTemplate/instantiate-exception-spec.cpp
+++ b/test/SemaTemplate/instantiate-exception-spec.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// FIXME: the "note" should be down at the call site!
template<typename T> void f1(T*) throw(T); // expected-error{{incomplete type 'struct Incomplete' is not allowed in exception specification}} \
diff --git a/test/SemaTemplate/instantiate-expr-1.cpp b/test/SemaTemplate/instantiate-expr-1.cpp
index 1cd55d9ad257..663749ddce5b 100644
--- a/test/SemaTemplate/instantiate-expr-1.cpp
+++ b/test/SemaTemplate/instantiate-expr-1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<int I, int J>
struct Bitfields {
int simple : I; // expected-error{{bit-field 'simple' has zero width}}
diff --git a/test/SemaTemplate/instantiate-expr-2.cpp b/test/SemaTemplate/instantiate-expr-2.cpp
index 194593ac4006..4da4e713ec18 100644
--- a/test/SemaTemplate/instantiate-expr-2.cpp
+++ b/test/SemaTemplate/instantiate-expr-2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
typedef char one_byte;
typedef char (&two_bytes)[2];
typedef char (&four_bytes)[4];
diff --git a/test/SemaTemplate/instantiate-expr-3.cpp b/test/SemaTemplate/instantiate-expr-3.cpp
index 696b58325cd7..41a96a32e0bf 100644
--- a/test/SemaTemplate/instantiate-expr-3.cpp
+++ b/test/SemaTemplate/instantiate-expr-3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// ---------------------------------------------------------------------
// Imaginary literals
diff --git a/test/SemaTemplate/instantiate-expr-4.cpp b/test/SemaTemplate/instantiate-expr-4.cpp
index b99ec3304c4d..c524e958f8a7 100644
--- a/test/SemaTemplate/instantiate-expr-4.cpp
+++ b/test/SemaTemplate/instantiate-expr-4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// ---------------------------------------------------------------------
// C++ Functional Casts
@@ -21,8 +21,8 @@ struct FunctionalCast0 {
template struct FunctionalCast0<5>;
-struct X { // expected-note 2 {{candidate function}}
- X(int, int); // expected-note 2 {{candidate function}}
+struct X { // expected-note 3 {{candidate function}}
+ X(int, int); // expected-note 3 {{candidate function}}
};
template<int N, int M>
@@ -84,6 +84,20 @@ template struct New2<X, int, float>;
template struct New2<X, int, int*>; // expected-note{{instantiation}}
// FIXME: template struct New2<int, int, float>;
+// PR5833
+struct New3 {
+ New3();
+
+ void *operator new[](__SIZE_TYPE__) __attribute__((unavailable)); // expected-note{{explicitly made unavailable}}
+};
+
+template<class C>
+void* object_creator() {
+ return new C(); // expected-error{{call to unavailable function 'operator new[]'}}
+}
+
+template void *object_creator<New3[4]>(); // expected-note{{instantiation}}
+
template<typename T>
struct Delete0 {
void f(T t) {
@@ -119,7 +133,7 @@ struct Throw1 {
}
};
-struct Incomplete; // expected-note{{forward}}
+struct Incomplete; // expected-note 2{{forward}}
template struct Throw1<int>;
template struct Throw1<int*>;
@@ -129,7 +143,6 @@ template struct Throw1<Incomplete*>; // expected-note{{instantiation}}
// typeid expressions
// ---------------------------------------------------------------------
-// FIXME: This should really include <typeinfo>, but we don't have that yet.
namespace std {
class type_info;
}
@@ -140,7 +153,7 @@ struct TypeId0 {
if (ptr)
return typeid(ptr);
else
- return typeid(T);
+ return typeid(T); // expected-error{{'typeid' of incomplete type 'struct Incomplete'}}
}
};
@@ -149,7 +162,7 @@ struct Abstract {
};
template struct TypeId0<int>;
-template struct TypeId0<Incomplete>;
+template struct TypeId0<Incomplete>; // expected-note{{instantiation of member function}}
template struct TypeId0<Abstract>;
// ---------------------------------------------------------------------
@@ -293,7 +306,7 @@ template struct NonDepMemberCall0<float&>; // expected-note{{instantiation}}
template<typename T>
struct QualifiedDeclRef0 {
T f() {
- return is_pod<X>::value; // expected-error{{initialized}}
+ return is_pod<X>::value; // expected-error{{non-const lvalue reference to type 'int' cannot bind to a value of unrelated type 'bool const'}}
}
};
diff --git a/test/SemaTemplate/instantiate-expr-5.cpp b/test/SemaTemplate/instantiate-expr-5.cpp
index b42c0fb2aaf8..941dae44829a 100644
--- a/test/SemaTemplate/instantiate-expr-5.cpp
+++ b/test/SemaTemplate/instantiate-expr-5.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
template <class A> int x(A x) { return x++; }
int y() { return x<int>(1); }
diff --git a/test/SemaTemplate/instantiate-expr-basic.cpp b/test/SemaTemplate/instantiate-expr-basic.cpp
index 2b5fcaeb0454..074fe6941490 100644
--- a/test/SemaTemplate/instantiate-expr-basic.cpp
+++ b/test/SemaTemplate/instantiate-expr-basic.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -Wno-unused-value -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -std=c++0x %s
template <typename T>
struct S {
diff --git a/test/SemaTemplate/instantiate-field.cpp b/test/SemaTemplate/instantiate-field.cpp
index 8e2a3758b0d7..d166e7e78e6a 100644
--- a/test/SemaTemplate/instantiate-field.cpp
+++ b/test/SemaTemplate/instantiate-field.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X {
diff --git a/test/SemaTemplate/instantiate-friend-class.cpp b/test/SemaTemplate/instantiate-friend-class.cpp
index 9a4a73cc8a52..c87b8d0bf9b2 100644
--- a/test/SemaTemplate/instantiate-friend-class.cpp
+++ b/test/SemaTemplate/instantiate-friend-class.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR4794
template <class T> class X
diff --git a/test/SemaTemplate/instantiate-function-1.cpp b/test/SemaTemplate/instantiate-function-1.cpp
index a6c269febea1..543b3cc19759 100644
--- a/test/SemaTemplate/instantiate-function-1.cpp
+++ b/test/SemaTemplate/instantiate-function-1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, typename U>
struct X0 {
void f(T x, U y) {
@@ -66,7 +66,7 @@ template<typename T, typename U, typename V> struct X6 {
return u;
else {
if (t < 0)
- return v; // expected-error{{incompatible type}}
+ return v; // expected-error{{cannot initialize return object of type}}
}
if (T x = t) {
diff --git a/test/SemaTemplate/instantiate-function-1.mm b/test/SemaTemplate/instantiate-function-1.mm
index aa4b941d39cf..c67b5985f63f 100644
--- a/test/SemaTemplate/instantiate-function-1.mm
+++ b/test/SemaTemplate/instantiate-function-1.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// XFAIL: *
template<typename T> struct Member0 {
diff --git a/test/SemaTemplate/instantiate-function-2.cpp b/test/SemaTemplate/instantiate-function-2.cpp
index 51a60146d46a..6318facfc0ea 100644
--- a/test/SemaTemplate/instantiate-function-2.cpp
+++ b/test/SemaTemplate/instantiate-function-2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template <typename T> struct S {
S() { }
S(T t);
diff --git a/test/SemaTemplate/instantiate-init.cpp b/test/SemaTemplate/instantiate-init.cpp
index 870b27537fce..8a10a87e610e 100644
--- a/test/SemaTemplate/instantiate-init.cpp
+++ b/test/SemaTemplate/instantiate-init.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X0 { // expected-note 4{{candidate}}
X0(int*, float*); // expected-note 4{{candidate}}
diff --git a/test/SemaTemplate/instantiate-member-class.cpp b/test/SemaTemplate/instantiate-member-class.cpp
index fab65cef2e45..8a19d74cdde4 100644
--- a/test/SemaTemplate/instantiate-member-class.cpp
+++ b/test/SemaTemplate/instantiate-member-class.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
class X {
@@ -36,3 +36,17 @@ void test_instantiation(X<double>::C *x,
X<void>::C *c3; // okay
X<void>::D::E *e1; // okay
X<void>::D::E e2; // expected-note{{in instantiation of member class 'struct X<void>::D::E' requested here}}
+
+// Redeclarations.
+namespace test1 {
+ template <typename T> struct Registry {
+ class node;
+ static node *Head;
+ class node {
+ node(int v) { Head = this; }
+ };
+ };
+ void test() {
+ Registry<int>::node node(0);
+ }
+}
diff --git a/test/SemaTemplate/instantiate-member-expr.cpp b/test/SemaTemplate/instantiate-member-expr.cpp
new file mode 100644
index 000000000000..db13624d4426
--- /dev/null
+++ b/test/SemaTemplate/instantiate-member-expr.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+template<typename T>
+struct S {
+ S() { }
+};
+
+template<typename T>
+struct vector {
+ void push_back(const T&) { int a[sizeof(T) ? -1: -1]; } // expected-error {{array size is negative}}
+};
+
+class GRExprEngine {
+public:
+ typedef vector<S<void *> >CheckersOrdered;
+ CheckersOrdered Checkers;
+
+ template <typename CHECKER>
+ void registerCheck(CHECKER *check) {
+ Checkers.push_back(S<void *>()); // expected-note {{in instantiation of member function 'vector<struct S<void *> >::push_back' requested here}}
+ }
+};
+
+class RetainReleaseChecker { };
+
+void f(GRExprEngine& Eng) {
+ Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'GRExprEngine::registerCheck<class RetainReleaseChecker>' requested here}}
+}
diff --git a/test/SemaTemplate/instantiate-member-initializers.cpp b/test/SemaTemplate/instantiate-member-initializers.cpp
index 6fc70429a9d3..f7b7e47e1e9b 100644
--- a/test/SemaTemplate/instantiate-member-initializers.cpp
+++ b/test/SemaTemplate/instantiate-member-initializers.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -Wall -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wall -verify %s
template<typename T> struct A {
A() : a(1) { } // expected-error{{incompatible type passing 'int', expected 'void *'}}
diff --git a/test/SemaTemplate/instantiate-member-pointers.cpp b/test/SemaTemplate/instantiate-member-pointers.cpp
index d2c9e6b5ed82..2308ac541b2e 100644
--- a/test/SemaTemplate/instantiate-member-pointers.cpp
+++ b/test/SemaTemplate/instantiate-member-pointers.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct Y {
int x;
};
diff --git a/test/SemaTemplate/instantiate-member-template.cpp b/test/SemaTemplate/instantiate-member-template.cpp
index 04ced926341a..b4f0a9c6509d 100644
--- a/test/SemaTemplate/instantiate-member-template.cpp
+++ b/test/SemaTemplate/instantiate-member-template.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct X0 {
@@ -50,7 +50,7 @@ struct X1 {
template<typename V>
V f1(T t, U u, V) {
- return t + u; // expected-error{{incompatible type}}
+ return t + u; // expected-error{{cannot initialize return object}}
}
};
@@ -75,7 +75,7 @@ template<typename T>
template<typename U>
template<typename V>
V X1<T>::Inner4<U>::f2(T t, U u, V) {
- return t + u; // expected-error{{incompatible type}}
+ return t + u; // expected-error{{cannot initialize return object}}
}
void test_X1(int *ip, int i, double *dp) {
@@ -90,7 +90,7 @@ void test_X1(int *ip, int i, double *dp) {
X1<int*>::Inner3<int> id3;
id3.f0(ip, i);
- id3.f0(dp, i); // expected-error{{incompatible type}}
+ id3.f0(dp, i); // expected-error{{cannot initialize a parameter of type 'int *' with an lvalue of type 'double *'}}
id3.f1(ip, i, ip);
id3.f1(ip, i, dp); // expected-note{{instantiation}}
diff --git a/test/SemaTemplate/instantiate-method.cpp b/test/SemaTemplate/instantiate-method.cpp
index 231e2812f666..a02fe5238c35 100644
--- a/test/SemaTemplate/instantiate-method.cpp
+++ b/test/SemaTemplate/instantiate-method.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
class X {
public:
@@ -79,7 +79,7 @@ template<class T> struct A1;
int *a(A0<int> &x0, A1<int> &x1) {
int *y0 = x0;
- int *y1 = x1; // expected-error{{initializing}}
+ int *y1 = x1; // expected-error{{no viable conversion}}
}
struct X0Base {
diff --git a/test/SemaTemplate/instantiate-non-type-template-parameter.cpp b/test/SemaTemplate/instantiate-non-type-template-parameter.cpp
index 32acbd0d8bdc..414e62b13a03 100644
--- a/test/SemaTemplate/instantiate-non-type-template-parameter.cpp
+++ b/test/SemaTemplate/instantiate-non-type-template-parameter.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR5311
template<typename T>
diff --git a/test/SemaTemplate/instantiate-objc-1.mm b/test/SemaTemplate/instantiate-objc-1.mm
index 093be4e27155..92d0d6c95080 100644
--- a/test/SemaTemplate/instantiate-objc-1.mm
+++ b/test/SemaTemplate/instantiate-objc-1.mm
@@ -1,4 +1,4 @@
-// RUN: clang -cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Obj-C string literal expressions
template <typename T> struct StringTest {
diff --git a/test/SemaTemplate/instantiate-overloaded-arrow.cpp b/test/SemaTemplate/instantiate-overloaded-arrow.cpp
index 7f0ef0c990ad..ee36427db87b 100644
--- a/test/SemaTemplate/instantiate-overloaded-arrow.cpp
+++ b/test/SemaTemplate/instantiate-overloaded-arrow.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR5488
struct X {
diff --git a/test/SemaTemplate/instantiate-static-var.cpp b/test/SemaTemplate/instantiate-static-var.cpp
index d4a7008b47bf..8a2f34d475a7 100644
--- a/test/SemaTemplate/instantiate-static-var.cpp
+++ b/test/SemaTemplate/instantiate-static-var.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, T Divisor>
class X {
public:
@@ -30,7 +30,7 @@ T Z<T>::value; // expected-error{{no matching constructor}}
struct DefCon {};
struct NoDefCon {
- NoDefCon(const NoDefCon&);
+ NoDefCon(const NoDefCon&); // expected-note{{candidate function}}
};
void test() {
diff --git a/test/SemaTemplate/instantiate-subscript.cpp b/test/SemaTemplate/instantiate-subscript.cpp
index 20e2c39d0cce..a7187516da39 100644
--- a/test/SemaTemplate/instantiate-subscript.cpp
+++ b/test/SemaTemplate/instantiate-subscript.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct Sub0 {
diff --git a/test/SemaTemplate/instantiate-template-template-parm.cpp b/test/SemaTemplate/instantiate-template-template-parm.cpp
index 30ba113e20d4..f48a0c7a7145 100644
--- a/test/SemaTemplate/instantiate-template-template-parm.cpp
+++ b/test/SemaTemplate/instantiate-template-template-parm.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<template<typename T> class MetaFun, typename Value>
struct apply {
typedef typename MetaFun<Value>::type type;
@@ -17,7 +17,7 @@ struct add_reference {
int i;
apply<add_pointer, int>::type ip = &i;
apply<add_reference, int>::type ir = i;
-apply<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a value of type 'int'}}
+apply<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot bind to a value of unrelated type 'int'}}
// Template template parameters
template<int> struct B; // expected-note{{has a different type 'int'}}
diff --git a/test/SemaTemplate/instantiate-try-catch.cpp b/test/SemaTemplate/instantiate-try-catch.cpp
index 074afa9d173d..aa809e4bf949 100644
--- a/test/SemaTemplate/instantiate-try-catch.cpp
+++ b/test/SemaTemplate/instantiate-try-catch.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
template<typename T> struct TryCatch0 {
void f() {
diff --git a/test/SemaTemplate/instantiate-type.cpp b/test/SemaTemplate/instantiate-type.cpp
index 48060c4e384e..f5d02707cb1f 100644
--- a/test/SemaTemplate/instantiate-type.cpp
+++ b/test/SemaTemplate/instantiate-type.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
int* f(int);
float *f(...);
diff --git a/test/SemaTemplate/instantiate-typedef.cpp b/test/SemaTemplate/instantiate-typedef.cpp
index e092b531582b..977fd08cc36d 100644
--- a/test/SemaTemplate/instantiate-typedef.cpp
+++ b/test/SemaTemplate/instantiate-typedef.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct add_pointer {
@@ -8,7 +8,7 @@ struct add_pointer {
add_pointer<int>::type test1(int * ptr) { return ptr; }
add_pointer<float>::type test2(int * ptr) {
- return ptr; // expected-error{{incompatible type returning 'int *', expected 'add_pointer<float>::type' (aka 'float *')}}
+ return ptr; // expected-error{{cannot initialize return object of type 'add_pointer<float>::type' (aka 'float *') with an lvalue of type 'int *'}}
}
add_pointer<int&>::type // expected-note{{in instantiation of template class 'struct add_pointer<int &>' requested here}} \
diff --git a/test/SemaTemplate/instantiate-using-decl.cpp b/test/SemaTemplate/instantiate-using-decl.cpp
index de66f79242fc..a4394aa21f6e 100644
--- a/test/SemaTemplate/instantiate-using-decl.cpp
+++ b/test/SemaTemplate/instantiate-using-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace test0 {
namespace N { }
@@ -47,3 +47,17 @@ namespace test1 {
Knot().Visit((struct Object3*) 0); // expected-error {{no matching member function for call}}
}
}
+
+// PR5847
+namespace test2 {
+ namespace ns {
+ void foo();
+ }
+
+ template <class T> void bar(T* ptr) {
+ using ns::foo;
+ foo();
+ }
+
+ template void bar(char *);
+}
diff --git a/test/SemaTemplate/instantiation-backtrace.cpp b/test/SemaTemplate/instantiation-backtrace.cpp
index 869662268dd2..93f9a3552aa0 100644
--- a/test/SemaTemplate/instantiation-backtrace.cpp
+++ b/test/SemaTemplate/instantiation-backtrace.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> struct A; // expected-note 4{{template is declared here}}
template<typename T> struct B : A<T*> { }; // expected-error{{implicit instantiation of undefined template}} \
diff --git a/test/SemaTemplate/instantiation-default-1.cpp b/test/SemaTemplate/instantiation-default-1.cpp
index f0ce0d3cc669..6f5a660d99f1 100644
--- a/test/SemaTemplate/instantiation-default-1.cpp
+++ b/test/SemaTemplate/instantiation-default-1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, typename U = const T> struct Def1;
template<> struct Def1<int> {
diff --git a/test/SemaTemplate/instantiation-default-2.cpp b/test/SemaTemplate/instantiation-default-2.cpp
index 4d9a0e2717bf..4d6756eca376 100644
--- a/test/SemaTemplate/instantiation-default-2.cpp
+++ b/test/SemaTemplate/instantiation-default-2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, T Value> struct Constant; // expected-note{{template parameter is declared here}} \
// FIXME: bad location expected-error{{a non-type template parameter cannot have type 'float'}}
diff --git a/test/SemaTemplate/instantiation-default-3.cpp b/test/SemaTemplate/instantiation-default-3.cpp
index 521edf66f24c..dae6b18f32c2 100644
--- a/test/SemaTemplate/instantiation-default-3.cpp
+++ b/test/SemaTemplate/instantiation-default-3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> struct A { };
diff --git a/test/SemaTemplate/instantiation-depth.cpp b/test/SemaTemplate/instantiation-depth.cpp
index 31abb40dd5b1..f48ede9c44cf 100644
--- a/test/SemaTemplate/instantiation-depth.cpp
+++ b/test/SemaTemplate/instantiation-depth.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -ftemplate-depth 5 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -ftemplate-depth 5 -verify %s
template<typename T> struct X : X<T*> { }; // expected-error{{recursive template instantiation exceeded maximum depth of 5}} \
// expected-note{{use -ftemplate-depth-N to increase recursive template instantiation depth}} \
diff --git a/test/SemaTemplate/member-access-expr.cpp b/test/SemaTemplate/member-access-expr.cpp
index ad0075f564b6..116e8377b366 100644
--- a/test/SemaTemplate/member-access-expr.cpp
+++ b/test/SemaTemplate/member-access-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
void call_f0(T x) {
x.Base::f0();
@@ -105,3 +105,17 @@ void test_X5(X5<X4> x5, X5<const X4> x5c, X4 *xp, const X4 *cxp) {
x5.f(xp);
x5c.g(cxp);
}
+
+// In theory we can do overload resolution at template-definition time on this.
+// We should at least not assert.
+namespace test4 {
+ struct Base {
+ template <class T> void foo() {}
+ };
+
+ template <class T> struct Foo : Base {
+ void test() {
+ foo<int>();
+ }
+ };
+}
diff --git a/test/SemaTemplate/member-function-template.cpp b/test/SemaTemplate/member-function-template.cpp
index 1d46d31e35d3..5ea8c1010e5c 100644
--- a/test/SemaTemplate/member-function-template.cpp
+++ b/test/SemaTemplate/member-function-template.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X {
template<typename T> T& f0(T);
diff --git a/test/SemaTemplate/member-initializers.cpp b/test/SemaTemplate/member-initializers.cpp
index 62077fabc721..40f56b34dae0 100644
--- a/test/SemaTemplate/member-initializers.cpp
+++ b/test/SemaTemplate/member-initializers.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> struct A {
A() : j(10), i(10) { }
diff --git a/test/SemaTemplate/member-template-access-expr.cpp b/test/SemaTemplate/member-template-access-expr.cpp
index 567c0d63b046..9edefe8b63e0 100644
--- a/test/SemaTemplate/member-template-access-expr.cpp
+++ b/test/SemaTemplate/member-template-access-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename U, typename T>
U f0(T t) {
return t.template get<U>();
diff --git a/test/SemaTemplate/metafun-apply.cpp b/test/SemaTemplate/metafun-apply.cpp
index 471b2ad3fae6..bb3c88ad3957 100644
--- a/test/SemaTemplate/metafun-apply.cpp
+++ b/test/SemaTemplate/metafun-apply.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct add_pointer {
template<typename T>
@@ -29,14 +29,12 @@ struct apply1 {
int i;
apply1<add_pointer, int>::type ip = &i;
apply1<add_reference, int>::type ir = i;
-apply1<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a value of type 'int'}}
+apply1<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot bind to a value of unrelated type 'int'}}
void test() {
- apply1<add_reference, void>::type t; // expected-note{{in instantiation of template class 'struct apply1<struct add_reference, void>' requested here}} \
- // FIXME: expected-error{{unexpected type name 'type': expected expression}}
+ apply1<add_reference, void>::type t; // expected-note{{in instantiation of template class 'struct apply1<struct add_reference, void>' requested here}}
- apply1<bogus, int>::type t2; // expected-note{{in instantiation of template class 'struct apply1<struct bogus, int>' requested here}} \
- // FIXME: expected-error{{unexpected type name 'type': expected expression}}
+ apply1<bogus, int>::type t2; // expected-note{{in instantiation of template class 'struct apply1<struct bogus, int>' requested here}}
}
diff --git a/test/SemaTemplate/nested-linkage.cpp b/test/SemaTemplate/nested-linkage.cpp
index ffe9adc927d6..6c0791c2efc8 100644
--- a/test/SemaTemplate/nested-linkage.cpp
+++ b/test/SemaTemplate/nested-linkage.cpp
@@ -1,3 +1,3 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
extern "C" { extern "C++" { template<class C> C x(); } }
diff --git a/test/SemaTemplate/nested-name-spec-template.cpp b/test/SemaTemplate/nested-name-spec-template.cpp
index 436732a828d7..704b8cfce128 100644
--- a/test/SemaTemplate/nested-name-spec-template.cpp
+++ b/test/SemaTemplate/nested-name-spec-template.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace N {
namespace M {
diff --git a/test/SemaTemplate/nested-template.cpp b/test/SemaTemplate/nested-template.cpp
index e18329c145d0..01ede32f9a08 100644
--- a/test/SemaTemplate/nested-template.cpp
+++ b/test/SemaTemplate/nested-template.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class A;
class S {
diff --git a/test/SemaTemplate/operator-function-id-template.cpp b/test/SemaTemplate/operator-function-id-template.cpp
index 92a8c84e3be6..9a0884e8136d 100644
--- a/test/SemaTemplate/operator-function-id-template.cpp
+++ b/test/SemaTemplate/operator-function-id-template.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct A {
diff --git a/test/SemaTemplate/operator-template.cpp b/test/SemaTemplate/operator-template.cpp
index dc44d04b6882..4300755cf711 100644
--- a/test/SemaTemplate/operator-template.cpp
+++ b/test/SemaTemplate/operator-template.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Make sure we accept this
template<class X>struct A{typedef X Y;};
diff --git a/test/SemaTemplate/overload-uneval.cpp b/test/SemaTemplate/overload-uneval.cpp
index 2e3bfede700a..632d1cd521d9 100644
--- a/test/SemaTemplate/overload-uneval.cpp
+++ b/test/SemaTemplate/overload-uneval.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Tests that overload resolution is treated as an unevaluated context.
// PR5541
diff --git a/test/SemaTemplate/partial-spec-instantiate.cpp b/test/SemaTemplate/partial-spec-instantiate.cpp
index 8d1ae238977c..3156892a7234 100644
--- a/test/SemaTemplate/partial-spec-instantiate.cpp
+++ b/test/SemaTemplate/partial-spec-instantiate.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
// PR4607
template <class T> struct X {};
diff --git a/test/SemaTemplate/qualified-id.cpp b/test/SemaTemplate/qualified-id.cpp
index ab57950acff2..655a80e2bfbf 100644
--- a/test/SemaTemplate/qualified-id.cpp
+++ b/test/SemaTemplate/qualified-id.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR5061
namespace a {
diff --git a/test/SemaTemplate/qualified-names-diag.cpp b/test/SemaTemplate/qualified-names-diag.cpp
index 1d53e5cb98ba..b2df47bfff4c 100644
--- a/test/SemaTemplate/qualified-names-diag.cpp
+++ b/test/SemaTemplate/qualified-names-diag.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace std {
template<typename T> class vector { }; // expected-note{{candidate}}
diff --git a/test/SemaTemplate/recursive-template-instantiation.cpp b/test/SemaTemplate/recursive-template-instantiation.cpp
index 7c88d5019fd5..0ddedaf2354a 100644
--- a/test/SemaTemplate/recursive-template-instantiation.cpp
+++ b/test/SemaTemplate/recursive-template-instantiation.cpp
@@ -1,6 +1,6 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
-template<typename T> void f(T* t) {
+template<typename T> void f(T* t) { // expected-note{{candidate function}}
f(*t); // expected-error{{no matching function}}\
// expected-note 3{{requested here}}
}
diff --git a/test/SemaTemplate/temp.cpp b/test/SemaTemplate/temp.cpp
index 8be4739a741b..961b9c873ab8 100644
--- a/test/SemaTemplate/temp.cpp
+++ b/test/SemaTemplate/temp.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// p3
diff --git a/test/SemaTemplate/temp_arg.cpp b/test/SemaTemplate/temp_arg.cpp
index e873b8e2a61d..3c9fcb506610 100644
--- a/test/SemaTemplate/temp_arg.cpp
+++ b/test/SemaTemplate/temp_arg.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T,
int I,
template<typename> class TT>
diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp
index 0c44651ccfee..133b8db9491a 100644
--- a/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/test/SemaTemplate/temp_arg_nontype.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c++98 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s
template<int N> struct A; // expected-note 5{{template parameter is declared here}}
A<0> *a0;
@@ -105,13 +105,23 @@ A7c<(&Z::int_member)> *a18_3; // expected-error{{non-type template argument cann
template<unsigned char C> struct Overflow; // expected-note{{template parameter is declared here}}
Overflow<5> *overflow1; // okay
-Overflow<256> *overflow2; // expected-error{{non-type template argument value '256' is too large for template parameter of type 'unsigned char'}}
+Overflow<255> *overflow2; // okay
+Overflow<256> *overflow3; // expected-error{{non-type template argument value '256' is too large for template parameter of type 'unsigned char'}}
template<unsigned> struct Signedness; // expected-note{{template parameter is declared here}}
Signedness<10> *signedness1; // okay
Signedness<-10> *signedness2; // expected-error{{non-type template argument provides negative value '-10' for unsigned template parameter of type 'unsigned int'}}
+template<signed char C> struct SignedOverflow; // expected-note 3 {{template parameter is declared here}}
+SignedOverflow<1> *signedoverflow1;
+SignedOverflow<-1> *signedoverflow2;
+SignedOverflow<-128> *signedoverflow3;
+SignedOverflow<-129> *signedoverflow4; // expected-error{{non-type template argument value '-129' is too large for template parameter of type 'signed char'}}
+SignedOverflow<127> *signedoverflow5;
+SignedOverflow<128> *signedoverflow6; // expected-error{{non-type template argument value '128' is too large for template parameter of type 'signed char'}}
+SignedOverflow<(unsigned char)128> *signedoverflow7; // expected-error{{non-type template argument value '128' is too large for template parameter of type 'signed char'}}
+
// Check canonicalization of template arguments.
template<int (*)(int, int)> struct FuncPtr0;
int func0(int, int);
diff --git a/test/SemaTemplate/temp_arg_template.cpp b/test/SemaTemplate/temp_arg_template.cpp
index ada244bb5de6..667122583fda 100644
--- a/test/SemaTemplate/temp_arg_template.cpp
+++ b/test/SemaTemplate/temp_arg_template.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<template<typename T> class X> struct A; // expected-note 2{{previous template template parameter is here}}
diff --git a/test/SemaTemplate/temp_arg_type.cpp b/test/SemaTemplate/temp_arg_type.cpp
index b322dae98b90..a376900666d8 100644
--- a/test/SemaTemplate/temp_arg_type.cpp
+++ b/test/SemaTemplate/temp_arg_type.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> class A; // expected-note 2 {{template parameter is declared here}}
// [temp.arg.type]p1
diff --git a/test/SemaTemplate/temp_class_order.cpp b/test/SemaTemplate/temp_class_order.cpp
index 4687ddf7d9e9..fcf0325b7bbc 100644
--- a/test/SemaTemplate/temp_class_order.cpp
+++ b/test/SemaTemplate/temp_class_order.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, typename U>
struct X1 {
diff --git a/test/SemaTemplate/temp_class_spec.cpp b/test/SemaTemplate/temp_class_spec.cpp
index dad857e8e66d..48026f913178 100644
--- a/test/SemaTemplate/temp_class_spec.cpp
+++ b/test/SemaTemplate/temp_class_spec.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
struct is_pointer {
static const bool value = false;
diff --git a/test/SemaTemplate/temp_class_spec_blocks.cpp b/test/SemaTemplate/temp_class_spec_blocks.cpp
index 920d9c8b0cbd..b7b96df69ba5 100644
--- a/test/SemaTemplate/temp_class_spec_blocks.cpp
+++ b/test/SemaTemplate/temp_class_spec_blocks.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -fblocks
+// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
template<typename T>
struct is_unary_block {
static const bool value = false;
diff --git a/test/SemaTemplate/temp_class_spec_neg.cpp b/test/SemaTemplate/temp_class_spec_neg.cpp
index a029f474fc58..c8e8a57f278b 100644
--- a/test/SemaTemplate/temp_class_spec_neg.cpp
+++ b/test/SemaTemplate/temp_class_spec_neg.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> struct vector;
// C++ [temp.class.spec]p6:
diff --git a/test/SemaTemplate/temp_explicit.cpp b/test/SemaTemplate/temp_explicit.cpp
index ae409aff662b..fbb41ff601a3 100644
--- a/test/SemaTemplate/temp_explicit.cpp
+++ b/test/SemaTemplate/temp_explicit.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
//
// Tests explicit instantiation of templates.
template<typename T, typename U = T> class X0 { };
diff --git a/test/SemaTemplate/temp_explicit_cxx0x.cpp b/test/SemaTemplate/temp_explicit_cxx0x.cpp
index 7045afc3032f..215d2cfa0820 100644
--- a/test/SemaTemplate/temp_explicit_cxx0x.cpp
+++ b/test/SemaTemplate/temp_explicit_cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
namespace N1 {
template<typename T> struct X0 { }; // expected-note{{here}}
diff --git a/test/SemaTemplate/temp_func_order.cpp b/test/SemaTemplate/temp_func_order.cpp
index 5fd7c8d74571..908354b58ed2 100644
--- a/test/SemaTemplate/temp_func_order.cpp
+++ b/test/SemaTemplate/temp_func_order.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
int &f0(T);
diff --git a/test/SemaTemplate/template-class-traits.cpp b/test/SemaTemplate/template-class-traits.cpp
index 7cf2004e727f..471029445256 100644
--- a/test/SemaTemplate/template-class-traits.cpp
+++ b/test/SemaTemplate/template-class-traits.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
#define T(b) (b) ? 1 : -1
#define F(b) (b) ? -1 : 1
diff --git a/test/SemaTemplate/template-decl-fail.cpp b/test/SemaTemplate/template-decl-fail.cpp
index b136f6279d52..a298c6d5a4ba 100644
--- a/test/SemaTemplate/template-decl-fail.cpp
+++ b/test/SemaTemplate/template-decl-fail.cpp
@@ -1,3 +1,3 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> typedef T X; // expected-error{{typedef cannot be a template}}
diff --git a/test/SemaTemplate/template-id-expr.cpp b/test/SemaTemplate/template-id-expr.cpp
index dd8694afa7ea..70a1062c2287 100644
--- a/test/SemaTemplate/template-id-expr.cpp
+++ b/test/SemaTemplate/template-id-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR5336
template<typename FromCl>
struct isa_impl_cl {
diff --git a/test/SemaTemplate/template-id-printing.cpp b/test/SemaTemplate/template-id-printing.cpp
index 13250943e92c..fcd4974a7611 100644
--- a/test/SemaTemplate/template-id-printing.cpp
+++ b/test/SemaTemplate/template-id-printing.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -ast-print %s | FileCheck %s
+// RUN: %clang_cc1 -fsyntax-only -ast-print %s | FileCheck %s
namespace N {
template<typename T, typename U> void f(U);
template<int> void f();
diff --git a/test/SemaTemplate/typename-specifier-2.cpp b/test/SemaTemplate/typename-specifier-2.cpp
index 99e628523158..551cac3168b2 100644
--- a/test/SemaTemplate/typename-specifier-2.cpp
+++ b/test/SemaTemplate/typename-specifier-2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename MetaFun, typename T>
struct bind_metafun {
@@ -18,7 +18,7 @@ int i;
// 'aka' telling us that we're dealing with an int**. Should we fix
// getDesugaredType to dig through pointers and such?
bind_metafun<add_pointer, int>::type::type ip = &i;
-bind_metafun<add_pointer, float>::type::type fp = &i; // expected-error{{incompatible type initializing 'int *', expected 'bind_metafun<add_pointer, float>::type::type' (aka 'float *')}}
+bind_metafun<add_pointer, float>::type::type fp = &i; // expected-error{{cannot initialize a variable of type 'bind_metafun<add_pointer, float>::type::type' (aka 'float *') with an rvalue of type 'int *'}}
template<typename T>
diff --git a/test/SemaTemplate/typename-specifier-3.cpp b/test/SemaTemplate/typename-specifier-3.cpp
index 8dde6095e533..a463d88752c9 100644
--- a/test/SemaTemplate/typename-specifier-3.cpp
+++ b/test/SemaTemplate/typename-specifier-3.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR4364
template<class T> struct a {
diff --git a/test/SemaTemplate/typename-specifier-4.cpp b/test/SemaTemplate/typename-specifier-4.cpp
index c7484c19fca7..7fd88f130fa6 100644
--- a/test/SemaTemplate/typename-specifier-4.cpp
+++ b/test/SemaTemplate/typename-specifier-4.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T, typename U>
struct is_same {
static const bool value = false;
diff --git a/test/SemaTemplate/typename-specifier.cpp b/test/SemaTemplate/typename-specifier.cpp
index 2501b8d048ff..b968ea6ad544 100644
--- a/test/SemaTemplate/typename-specifier.cpp
+++ b/test/SemaTemplate/typename-specifier.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace N {
struct A {
typedef int type;
diff --git a/test/SemaTemplate/value-dependent-null-pointer-constant.cpp b/test/SemaTemplate/value-dependent-null-pointer-constant.cpp
index 110c380c9aa2..223500eac48c 100644
--- a/test/SemaTemplate/value-dependent-null-pointer-constant.cpp
+++ b/test/SemaTemplate/value-dependent-null-pointer-constant.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s
template<typename T, int N>
struct X0 {
diff --git a/test/SemaTemplate/variadic-class-template-1.cpp b/test/SemaTemplate/variadic-class-template-1.cpp
index 6df905006692..6da64fb55f70 100644
--- a/test/SemaTemplate/variadic-class-template-1.cpp
+++ b/test/SemaTemplate/variadic-class-template-1.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
template<typename ... Args = int> struct S1 { }; // expected-error{{template parameter pack cannot have a default argument}}
template<typename ... Args, typename T> struct S2 { }; // expected-error{{template parameter pack must be the last template parameter}}
diff --git a/test/SemaTemplate/variadic-class-template-2.cpp b/test/SemaTemplate/variadic-class-template-2.cpp
index b1ac71b88bda..509977121f4b 100644
--- a/test/SemaTemplate/variadic-class-template-2.cpp
+++ b/test/SemaTemplate/variadic-class-template-2.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
// Type parameters packs
template <typename ...> struct TS1 {}; // expected-note{{template parameter is declared here}}
diff --git a/test/SemaTemplate/variadic-parse.cpp b/test/SemaTemplate/variadic-parse.cpp
index e1d1b1f98db2..d8b77b3f423e 100644
--- a/test/SemaTemplate/variadic-parse.cpp
+++ b/test/SemaTemplate/variadic-parse.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
// Parsing type parameter packs.
template <typename ... Args> struct T1 {};
diff --git a/test/SemaTemplate/variadic-unsupported.cpp b/test/SemaTemplate/variadic-unsupported.cpp
index 98f217c76891..9f2b0807d2d6 100644
--- a/test/SemaTemplate/variadic-unsupported.cpp
+++ b/test/SemaTemplate/variadic-unsupported.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Type parameter packs.
template <typename ... > struct T1 {}; // expected-error{{variadic templates are only allowed in C++0x}}
diff --git a/test/SemaTemplate/virtual-member-functions.cpp b/test/SemaTemplate/virtual-member-functions.cpp
index 486c8b205141..69ae0807b4c5 100644
--- a/test/SemaTemplate/virtual-member-functions.cpp
+++ b/test/SemaTemplate/virtual-member-functions.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace PR5557 {
template <class T> struct A {
diff --git a/test/lit.cfg b/test/lit.cfg
index 1421ec1a80cf..4d7a17a6b5d6 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -122,5 +122,15 @@ def inferClang(PATH):
config.clang = inferClang(config.environment['PATH'])
if not lit.quiet:
lit.note('using clang: %r' % config.clang)
-config.substitutions.append( (' clang ', ' ' + config.clang + ' ') )
-config.substitutions.append( (' clang-cc ', ' ' + config.clang + ' -cc1 ') )
+config.substitutions.append( ('%clang_cc1', config.clang + ' -cc1') )
+config.substitutions.append( ('%clang', ' ' + config.clang + ' ') )
+
+# FIXME: Find nicer way to prohibit this.
+config.substitutions.append(
+ (' clang ', """*** Do not use 'clang' in tests, use '%clang'. ***""") )
+config.substitutions.append(
+ (' clang-cc ',
+ """*** Do not use 'clang-cc' in tests, use '%clang_cc1'. ***""") )
+config.substitutions.append(
+ (' clang -cc1 ',
+ """*** Do not use 'clang -cc1' in tests, use '%clang_cc1'. ***""") )
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index fe3aa3769414..9b2355dc0a12 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -1114,6 +1114,8 @@ clang_getCompletionChunkKind(CXCompletionString completion_string,
return CXCompletionChunk_Placeholder;
case CodeCompletionString::CK_Informative:
return CXCompletionChunk_Informative;
+ case CodeCompletionString::CK_ResultType:
+ return CXCompletionChunk_ResultType;
case CodeCompletionString::CK_CurrentParameter:
return CXCompletionChunk_CurrentParameter;
case CodeCompletionString::CK_LeftParen:
@@ -1161,6 +1163,7 @@ const char *clang_getCompletionChunkText(CXCompletionString completion_string,
case CodeCompletionString::CK_LeftAngle:
case CodeCompletionString::CK_RightAngle:
case CodeCompletionString::CK_Comma:
+ case CodeCompletionString::CK_ResultType:
return (*CCStr)[chunk_number].Text;
case CodeCompletionString::CK_Optional:
@@ -1194,6 +1197,7 @@ clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
case CodeCompletionString::CK_LeftAngle:
case CodeCompletionString::CK_RightAngle:
case CodeCompletionString::CK_Comma:
+ case CodeCompletionString::CK_ResultType:
return 0;
case CodeCompletionString::CK_Optional:
@@ -1220,17 +1224,23 @@ static bool ReadUnsigned(const char *&Memory, const char *MemoryEnd,
return false;
}
-void clang_codeComplete(CXIndex CIdx,
- const char *source_filename,
- int num_command_line_args,
- const char **command_line_args,
- unsigned num_unsaved_files,
- struct CXUnsavedFile *unsaved_files,
- const char *complete_filename,
- unsigned complete_line,
- unsigned complete_column,
- CXCompletionIterator completion_iterator,
- CXClientData client_data) {
+/// \brief The CXCodeCompleteResults structure we allocate internally;
+/// the client only sees the initial CXCodeCompleteResults structure.
+struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults {
+ /// \brief The memory buffer from which we parsed the results. We
+ /// retain this buffer because the completion strings point into it.
+ llvm::MemoryBuffer *Buffer;
+};
+
+CXCodeCompleteResults *clang_codeComplete(CXIndex CIdx,
+ const char *source_filename,
+ int num_command_line_args,
+ const char **command_line_args,
+ unsigned num_unsaved_files,
+ struct CXUnsavedFile *unsaved_files,
+ const char *complete_filename,
+ unsigned complete_line,
+ unsigned complete_column) {
// The indexer, which is mainly used to determine where diagnostics go.
CIndexer *CXXIdx = static_cast<CIndexer *>(CIdx);
@@ -1353,7 +1363,9 @@ void clang_codeComplete(CXIndex CIdx,
// Parse the resulting source file to find code-completion results.
using llvm::MemoryBuffer;
using llvm::StringRef;
+ AllocatedCXCodeCompleteResults *Results = 0;
if (MemoryBuffer *F = MemoryBuffer::getFile(ResultsFile.c_str())) {
+ llvm::SmallVector<CXCompletionResult, 4> CompletionResults;
StringRef Buffer = F->getBuffer();
for (const char *Str = Buffer.data(), *StrEnd = Str + Buffer.size();
Str < StrEnd;) {
@@ -1371,17 +1383,41 @@ void clang_codeComplete(CXIndex CIdx,
CXCompletionResult Result;
Result.CursorKind = (CXCursorKind)KindValue;
Result.CompletionString = CCStr;
- if (completion_iterator)
- completion_iterator(&Result, client_data);
+ CompletionResults.push_back(Result);
}
-
- delete CCStr;
};
- delete F;
+
+ // Allocate the results.
+ Results = new AllocatedCXCodeCompleteResults;
+ Results->Results = new CXCompletionResult [CompletionResults.size()];
+ Results->NumResults = CompletionResults.size();
+ memcpy(Results->Results, CompletionResults.data(),
+ CompletionResults.size() * sizeof(CXCompletionResult));
+ Results->Buffer = F;
}
for (unsigned i = 0, e = TemporaryFiles.size(); i != e; ++i)
TemporaryFiles[i].eraseFromDisk();
+
+ return Results;
+}
+
+void clang_disposeCodeCompleteResults(CXCodeCompleteResults *ResultsIn) {
+ if (!ResultsIn)
+ return;
+
+ AllocatedCXCodeCompleteResults *Results
+ = static_cast<AllocatedCXCodeCompleteResults*>(ResultsIn);
+
+ for (unsigned I = 0, N = Results->NumResults; I != N; ++I)
+ delete (CXCompletionString *)Results->Results[I].CompletionString;
+ delete [] Results->Results;
+
+ Results->Results = 0;
+ Results->NumResults = 0;
+ delete Results->Buffer;
+ Results->Buffer = 0;
+ delete Results;
}
} // end extern "C"
diff --git a/tools/CIndex/CIndex.exports b/tools/CIndex/CIndex.exports
index 458ad1028359..e925df945d06 100644
--- a/tools/CIndex/CIndex.exports
+++ b/tools/CIndex/CIndex.exports
@@ -2,6 +2,7 @@ _clang_codeComplete
_clang_createIndex
_clang_createTranslationUnit
_clang_createTranslationUnitFromSourceFile
+_clang_disposeCodeCompleteResults
_clang_disposeIndex
_clang_disposeString
_clang_disposeTranslationUnit
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 7300585a1d88..33013f3b66b2 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -355,6 +355,7 @@ clang_getCompletionChunkKindSpelling(enum CXCompletionChunkKind Kind) {
case CXCompletionChunk_LeftAngle: return "LeftAngle";
case CXCompletionChunk_RightAngle: return "RightAngle";
case CXCompletionChunk_Comma: return "Comma";
+ case CXCompletionChunk_ResultType: return "ResultType";
}
return "Unknown";
@@ -461,7 +462,15 @@ int parse_remapped_files(int argc, const char **argv, int start_arg,
/* Read the contents of the file we're remapping to. */
contents = (char *)malloc(unsaved->Length + 1);
- fread(contents, 1, unsaved->Length, to_file);
+ if (fread(contents, 1, unsaved->Length, to_file) != unsaved->Length) {
+ fprintf(stderr, "error: unexpected %s reading 'to' file %s\n",
+ (feof(to_file) ? "EOF" : "error"), semi + 1);
+ fclose(to_file);
+ free_remapped_files(*unsaved_files, i);
+ *unsaved_files = 0;
+ *num_unsaved_files = 0;
+ return -1;
+ }
contents[unsaved->Length] = 0;
unsaved->Contents = contents;
@@ -488,6 +497,7 @@ int perform_code_completion(int argc, const char **argv) {
int errorCode;
struct CXUnsavedFile *unsaved_files = 0;
int num_unsaved_files = 0;
+ CXCodeCompleteResults *results = 0;
input += strlen("-code-completion-at=");
if ((errorCode = parse_file_line_column(input, &filename, &line, &column)))
@@ -497,10 +507,18 @@ int perform_code_completion(int argc, const char **argv) {
return -1;
CIdx = clang_createIndex(0, 0);
- clang_codeComplete(CIdx, argv[argc - 1], argc - num_unsaved_files - 3,
- argv + num_unsaved_files + 2,
- num_unsaved_files, unsaved_files,
- filename, line, column, &print_completion_result, stdout);
+ results = clang_codeComplete(CIdx,
+ argv[argc - 1], argc - num_unsaved_files - 3,
+ argv + num_unsaved_files + 2,
+ num_unsaved_files, unsaved_files,
+ filename, line, column);
+ if (results) {
+ unsigned i, n = results->NumResults;
+ for (i = 0; i != n; ++i)
+ print_completion_result(results->Results + i, stdout);
+ clang_disposeCodeCompleteResults(results);
+ }
+
clang_disposeIndex(CIdx);
free(filename);
diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp
index 6e82c51d3876..eb1f60ccb645 100644
--- a/tools/driver/cc1_main.cpp
+++ b/tools/driver/cc1_main.cpp
@@ -110,7 +110,6 @@ static FrontendAction *CreateFrontendAction(CompilerInstance &CI) {
case PrintDeclContext: return new DeclContextPrintAction();
case PrintPreprocessedInput: return new PrintPreprocessedAction();
- case RewriteBlocks: return new RewriteBlocksAction();
case RewriteMacros: return new RewriteMacrosAction();
case RewriteObjC: return new RewriteObjCAction();
case RewriteTest: return new RewriteTestAction();
@@ -187,8 +186,6 @@ static int cc1_test(Diagnostic &Diags,
int cc1_main(const char **ArgBegin, const char **ArgEnd,
const char *Argv0, void *MainAddr) {
- llvm::sys::PrintStackTraceOnErrorSignal();
- llvm::PrettyStackTraceProgram X(ArgBegin - ArgEnd, ArgBegin);
CompilerInstance Clang(&llvm::getGlobalContext(), false);
// Run clang -cc1 test.
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index cfdd9c342acb..b6fc981b1db7 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -225,8 +225,10 @@ int main(int argc, const char **argv) {
// We use *argv instead of argv[0] to work around a bogus g++ warning.
std::string ProgName(llvm::sys::Path(*argv).getBasename());
if (llvm::StringRef(ProgName).endswith("++") ||
- llvm::StringRef(ProgName).rsplit('-').first.endswith("++"))
+ llvm::StringRef(ProgName).rsplit('-').first.endswith("++")) {
TheDriver.CCCIsCXX = true;
+ TheDriver.CCCGenericGCCName = "g++";
+ }
llvm::OwningPtr<Compilation> C;
diff --git a/tools/scan-build/c++-analyzer b/tools/scan-build/c++-analyzer
new file mode 120000
index 000000000000..ca10bf547dc2
--- /dev/null
+++ b/tools/scan-build/c++-analyzer
@@ -0,0 +1 @@
+ccc-analyzer \ No newline at end of file
diff --git a/tools/scan-build/ccc-analyzer b/tools/scan-build/ccc-analyzer
index aca411f67ae8..f19dcb4718cb 100755
--- a/tools/scan-build/ccc-analyzer
+++ b/tools/scan-build/ccc-analyzer
@@ -66,7 +66,9 @@ END {
sub GetPPExt {
my $Lang = shift;
+ if ($Lang =~ /objective-c\+\+/) { return ".mii" };
if ($Lang =~ /objective-c/) { return ".mi"; }
+ if ($Lang =~ /c\+\+/) { return ".ii"; }
return ".i";
}
diff --git a/utils/C++Tests/LLVM-Code-Compile/lit.local.cfg b/utils/C++Tests/LLVM-Code-Compile/lit.local.cfg
index fc493e480fda..6676e311e3ec 100644
--- a/utils/C++Tests/LLVM-Code-Compile/lit.local.cfg
+++ b/utils/C++Tests/LLVM-Code-Compile/lit.local.cfg
@@ -10,11 +10,43 @@ def getRoot(config):
root = getRoot(config)
# testFormat: The test format to use to interpret tests.
+target_obj_root = root.llvm_obj_root
cxxflags = ['-D__STDC_LIMIT_MACROS',
'-D__STDC_CONSTANT_MACROS',
'-Wno-sign-compare',
'-I%s/include' % root.llvm_src_root,
- '-I%s/include' % root.llvm_obj_root]
+ '-I%s/include' % root.llvm_obj_root,
+ '-I%s/lib/Target/Alpha' % root.llvm_src_root,
+ '-I%s/lib/Target/ARM' % root.llvm_src_root,
+ '-I%s/lib/Target/Blackfin' % root.llvm_src_root,
+ '-I%s/lib/Target/CBackend' % root.llvm_src_root,
+ '-I%s/lib/Target/CellSPU' % root.llvm_src_root,
+ '-I%s/lib/Target/CppBackend' % root.llvm_src_root,
+ '-I%s/lib/Target/Mips' % root.llvm_src_root,
+ '-I%s/lib/Target/MSIL' % root.llvm_src_root,
+ '-I%s/lib/Target/MSP430' % root.llvm_src_root,
+ '-I%s/lib/Target/PIC16' % root.llvm_src_root,
+ '-I%s/lib/Target/PowerPC' % root.llvm_src_root,
+ '-I%s/lib/Target/Sparc' % root.llvm_src_root,
+ '-I%s/lib/Target/SystemZ' % root.llvm_src_root,
+ '-I%s/lib/Target/X86' % root.llvm_src_root,
+ '-I%s/lib/Target/XCore' % root.llvm_src_root,
+ '-I%s/lib/Target/Alpha' % target_obj_root,
+ '-I%s/lib/Target/ARM' % target_obj_root,
+ '-I%s/lib/Target/Blackfin' % target_obj_root,
+ '-I%s/lib/Target/CBackend' % target_obj_root,
+ '-I%s/lib/Target/CellSPU' % target_obj_root,
+ '-I%s/lib/Target/CppBackend' % target_obj_root,
+ '-I%s/lib/Target/Mips' % target_obj_root,
+ '-I%s/lib/Target/MSIL' % target_obj_root,
+ '-I%s/lib/Target/MSP430' % target_obj_root,
+ '-I%s/lib/Target/PIC16' % target_obj_root,
+ '-I%s/lib/Target/PowerPC' % target_obj_root,
+ '-I%s/lib/Target/Sparc' % target_obj_root,
+ '-I%s/lib/Target/SystemZ' % target_obj_root,
+ '-I%s/lib/Target/X86' % target_obj_root,
+ '-I%s/lib/Target/XCore' % target_obj_root];
+
config.test_format = \
lit.formats.OneCommandPerFileTest(command=[root.clang, '-emit-llvm', '-c',
'-o', '/dev/null'] + cxxflags,
diff --git a/utils/C++Tests/LLVM-Code-Symbols/check-symbols b/utils/C++Tests/LLVM-Code-Symbols/check-symbols
new file mode 100755
index 000000000000..cd54eed4a0d0
--- /dev/null
+++ b/utils/C++Tests/LLVM-Code-Symbols/check-symbols
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+import subprocess
+import difflib
+
+def capture_2(args0, args1):
+ import subprocess
+ p0 = subprocess.Popen(args0, stdin=None, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ p1 = subprocess.Popen(args1, stdin=p0.stdout, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ out,_ = p1.communicate()
+ return out
+
+def normalize_nm(data):
+ lines = data.split('\n')
+ lines.sort()
+
+ # FIXME: Ignore common symbols for now.
+ lines = [ln for ln in lines
+ if not ln.startswith(' C')]
+
+ return lines
+
+def main():
+ import sys
+ clang = sys.argv[1]
+ flags = sys.argv[2:]
+
+ # FIXME: Relax to include undefined symbols.
+ nm_args = ["llvm-nm", "-extern-only", "-defined-only"]
+
+ llvmgcc_args = ["llvm-gcc"] + flags + ["-emit-llvm","-c","-o","-"]
+ clang_args = [clang] + flags + ["-emit-llvm","-c","-o","-"]
+
+ llvmgcc_nm = capture_2(llvmgcc_args, nm_args)
+ clang_nm = capture_2(clang_args, nm_args)
+
+ llvmgcc_nm = normalize_nm(llvmgcc_nm)
+ clang_nm = normalize_nm(clang_nm)
+
+ if llvmgcc_nm == clang_nm:
+ sys.exit(0)
+
+ print ' '.join(llvmgcc_args), '|', ' '.join(nm_args)
+ print ' '.join(clang_args), '|', ' '.join(nm_args)
+ for line in difflib.unified_diff(llvmgcc_nm, clang_nm,
+ fromfile="llvm-gcc symbols",
+ tofile="clang symbols"):
+ print line
+ sys.exit(1)
+
+if __name__ == '__main__':
+ main()
diff --git a/utils/C++Tests/LLVM-Code-Symbols/lit.local.cfg b/utils/C++Tests/LLVM-Code-Symbols/lit.local.cfg
new file mode 100644
index 000000000000..c328a25127d9
--- /dev/null
+++ b/utils/C++Tests/LLVM-Code-Symbols/lit.local.cfg
@@ -0,0 +1,56 @@
+# -*- Python -*-
+
+# Configuration file for the 'lit' test runner.
+
+def getRoot(config):
+ if not config.parent:
+ return config
+ return getRoot(config.parent)
+
+root = getRoot(config)
+
+# testFormat: The test format to use to interpret tests.
+target_obj_root = root.llvm_obj_root
+cxxflags = ['-D__STDC_LIMIT_MACROS',
+ '-D__STDC_CONSTANT_MACROS',
+ '-Wno-sign-compare',
+ '-I%s/include' % root.llvm_src_root,
+ '-I%s/include' % root.llvm_obj_root,
+ '-I%s/lib/Target/Alpha' % root.llvm_src_root,
+ '-I%s/lib/Target/ARM' % root.llvm_src_root,
+ '-I%s/lib/Target/Blackfin' % root.llvm_src_root,
+ '-I%s/lib/Target/CBackend' % root.llvm_src_root,
+ '-I%s/lib/Target/CellSPU' % root.llvm_src_root,
+ '-I%s/lib/Target/CppBackend' % root.llvm_src_root,
+ '-I%s/lib/Target/Mips' % root.llvm_src_root,
+ '-I%s/lib/Target/MSIL' % root.llvm_src_root,
+ '-I%s/lib/Target/MSP430' % root.llvm_src_root,
+ '-I%s/lib/Target/PIC16' % root.llvm_src_root,
+ '-I%s/lib/Target/PowerPC' % root.llvm_src_root,
+ '-I%s/lib/Target/Sparc' % root.llvm_src_root,
+ '-I%s/lib/Target/SystemZ' % root.llvm_src_root,
+ '-I%s/lib/Target/X86' % root.llvm_src_root,
+ '-I%s/lib/Target/XCore' % root.llvm_src_root,
+ '-I%s/lib/Target/Alpha' % target_obj_root,
+ '-I%s/lib/Target/ARM' % target_obj_root,
+ '-I%s/lib/Target/Blackfin' % target_obj_root,
+ '-I%s/lib/Target/CBackend' % target_obj_root,
+ '-I%s/lib/Target/CellSPU' % target_obj_root,
+ '-I%s/lib/Target/CppBackend' % target_obj_root,
+ '-I%s/lib/Target/Mips' % target_obj_root,
+ '-I%s/lib/Target/MSIL' % target_obj_root,
+ '-I%s/lib/Target/MSP430' % target_obj_root,
+ '-I%s/lib/Target/PIC16' % target_obj_root,
+ '-I%s/lib/Target/PowerPC' % target_obj_root,
+ '-I%s/lib/Target/Sparc' % target_obj_root,
+ '-I%s/lib/Target/SystemZ' % target_obj_root,
+ '-I%s/lib/Target/X86' % target_obj_root,
+ '-I%s/lib/Target/XCore' % target_obj_root];
+
+kScript = os.path.join(os.path.dirname(__file__), "check-symbols")
+config.test_format = \
+ lit.formats.OneCommandPerFileTest(command=[kScript, root.clang] + cxxflags,
+ dir='%s/lib' % root.llvm_src_root,
+ recursive=True,
+ pattern='^(.*\\.cpp)$')
+
diff --git a/utils/C++Tests/LLVM-Code-Syntax/lit.local.cfg b/utils/C++Tests/LLVM-Code-Syntax/lit.local.cfg
index c90f4f3db488..6e679659c44c 100644
--- a/utils/C++Tests/LLVM-Code-Syntax/lit.local.cfg
+++ b/utils/C++Tests/LLVM-Code-Syntax/lit.local.cfg
@@ -18,8 +18,11 @@ cxxflags = ['-D__STDC_LIMIT_MACROS',
'-I%s/lib/Target/Alpha' % root.llvm_src_root,
'-I%s/lib/Target/ARM' % root.llvm_src_root,
'-I%s/lib/Target/Blackfin' % root.llvm_src_root,
+ '-I%s/lib/Target/CBackend' % root.llvm_src_root,
'-I%s/lib/Target/CellSPU' % root.llvm_src_root,
+ '-I%s/lib/Target/CppBackend' % root.llvm_src_root,
'-I%s/lib/Target/Mips' % root.llvm_src_root,
+ '-I%s/lib/Target/MSIL' % root.llvm_src_root,
'-I%s/lib/Target/MSP430' % root.llvm_src_root,
'-I%s/lib/Target/PIC16' % root.llvm_src_root,
'-I%s/lib/Target/PowerPC' % root.llvm_src_root,
@@ -30,8 +33,11 @@ cxxflags = ['-D__STDC_LIMIT_MACROS',
'-I%s/lib/Target/Alpha' % target_obj_root,
'-I%s/lib/Target/ARM' % target_obj_root,
'-I%s/lib/Target/Blackfin' % target_obj_root,
+ '-I%s/lib/Target/CBackend' % target_obj_root,
'-I%s/lib/Target/CellSPU' % target_obj_root,
+ '-I%s/lib/Target/CppBackend' % target_obj_root,
'-I%s/lib/Target/Mips' % target_obj_root,
+ '-I%s/lib/Target/MSIL' % target_obj_root,
'-I%s/lib/Target/MSP430' % target_obj_root,
'-I%s/lib/Target/PIC16' % target_obj_root,
'-I%s/lib/Target/PowerPC' % target_obj_root,
diff --git a/utils/C++Tests/lit.cfg b/utils/C++Tests/lit.cfg
index e61502b62edd..274ca103f4ae 100644
--- a/utils/C++Tests/lit.cfg
+++ b/utils/C++Tests/lit.cfg
@@ -24,3 +24,4 @@ if not lit.params.get('run_clang_all'):
config.excludes.append('Clang-Code-Compile')
config.excludes.append('LLVM-Code-Syntax')
config.excludes.append('LLVM-Code-Compile')
+ config.excludes.append('LLVM-Code-Symbols')
diff --git a/www/cxx_status.html b/www/cxx_status.html
index 0858db7567e9..fdddc2274a2b 100644
--- a/www/cxx_status.html
+++ b/www/cxx_status.html
@@ -24,11 +24,11 @@
<!--*************************************************************************-->
<h1>C++ Support in Clang</h1>
<!--*************************************************************************-->
-<p>Last updated: $Date: 2009-11-20 23:00:06 +0100 (Fri, 20 Nov 2009) $</p>
+<p>Last updated: $Date: 2009-12-19 21:59:13 +0100 (Sat, 19 Dec 2009) $</p>
<p>
This page tracks the status of C++ support in Clang.<br>
-Currently most of the C++ features are missing; here you can find features that are at least partially supported in Clang. If you are looking to <a href="get_involved.html">get involved with Clang development</a> to help work on support for C++, please also look at our <a href="OpenProjects.html">Open Projects</a> page for some specific ideas.</p>
+Clang implements the majority of C++ features, although there are many bugs remaining and Clang is not yet generally useful as a C++ compiler. If you are looking to <a href="get_involved.html">get involved with Clang development</a> to help work on support for C++, please also look at our <a href="OpenProjects.html">Open Projects</a> page and the <a href="http://llvm.org/bugs/">LLVM bug tracker</a> for some specific ideas.</p>
<!-- Within this table: The colors we're using to color-code our level
@@ -167,7 +167,7 @@ welcome!</p>
<td></td>
<td class="na">N/A</td>
<td class="na">N/A</td>
- <td>NDR "form feed or vtab in comment" is not diagnosed. No AST representation of comments.</td>
+ <td>NDR "form feed or vtab in comment" is not diagnosed.</td>
</tr>
<tr>
<td>&nbsp;&nbsp;2.8 [lex.header]</td>
@@ -1114,10 +1114,10 @@ welcome!</p>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;7.3.3 [namespace.udecl]</td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="basic" align="center"></td>
- <td></td>
+ <td class="complete" align="center"></td>
+ <td class="complete" align="center"></td>
+ <td class="complete" align="center"></td>
+ <td class="na">N/A</td>
<td></td>
</tr>
<tr>
@@ -1139,8 +1139,8 @@ welcome!</p>
<tr>
<td>&nbsp;&nbsp;7.5 [dcl.link]</td>
<td class="complete" align="center"></td>
- <td class="basic"></td>
- <td class="basic"></td>
+ <td class="medium"></td>
+ <td class="medium"></td>
<td></td>
<td></td>
</tr>
@@ -1278,10 +1278,10 @@ welcome!</p>
<tr>
<td>&nbsp;&nbsp;9.2 [class.mem]</td>
<td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="basic" align="center"></td>
- <td>Basic parser support for using declarations.</td>
+ <td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;9.3 [class.mfct]</td>
@@ -1376,15 +1376,15 @@ welcome!</p>
<td class="advanced" align="center"></td>
<td class="advanced" align="center"></td>
<td class="advanced" align="center"></td>
- <td class="broken" align="center"></td>
+ <td class="medium" align="center"></td>
<td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;10.1 [class.mi]</td>
<td class="advanced" align="center"></td>
<td class="advanced" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="basic" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="medium" align="center"></td>
<td></td>
</tr>
<tr>
@@ -1398,10 +1398,10 @@ welcome!</p>
<tr>
<td>&nbsp;&nbsp;10.3 [class.virtual]</td>
<td class="advanced" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="basic" align="center"></td>
- <td>Basic layout of classes with virtual functions.</td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="medium" align="center"></td>
+ <td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;10.4 [class.abstract]</td>
@@ -1487,18 +1487,18 @@ welcome!</p>
<tr>
<td>&nbsp;&nbsp;12.1 [class.ctor]</td>
<td class="advanced" align="center"></td>
- <td class="medium" align="center"></td>
<td class="advanced" align="center"></td>
<td class="advanced" align="center"></td>
- <td>Most of the semantics of constructors are implemented.</td>
+ <td class="advanced" align="center"></td>
+ <td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;12.2 [class.temporary]</td>
<td class="na" align="center">N/A</td>
- <td class="basic" align="center"></td>
- <td class="basic" align="center"></td>
- <td class="basic" align="center"></td>
- <td>Implementation of temporary objects is in its initial stages.</td>
+ <td class="medium" align="center"></td>
+ <td class="medium" align="center"></td>
+ <td class="medium" align="center"></td>
+ <td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;12.3 [class.conv]</td>
@@ -1530,7 +1530,7 @@ welcome!</p>
<td class="medium" align="center"></td>
<td class="medium" align="center"></td>
<td class="medium" align="center"></td>
- <td>Most of the semantics of destructors are implemented.</td>
+ <td></td>
</tr>
<tr><td>&nbsp;&nbsp;12.5 [class.free]</td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>&nbsp;&nbsp;12.6 [class.init]</td><td></td><td></td><td></td><td></td><td></td></tr>
@@ -1967,57 +1967,57 @@ welcome!</p>
</tr>
<tr>
<td>&nbsp;&nbsp;14.6 [temp.res]</td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td class="na" align="center"></td>
<td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;14.6.1 [temp.local]</td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td class="na" align="center"></td>
<td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;14.6.2 [temp.dep]</td>
<td class="na" align="center">N/A</td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td class="na" align="center"></td>
<td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14.6.2.1 [temp.dep.type]</td>
<td class="na" align="center">N/A</td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td class="na" align="center"></td>
<td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14.6.2.2 [temp.dep.expr]</td>
<td class="na" align="center">N/A</td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td class="na" align="center"></td>
<td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14.6.2.3 [temp.dep.constexpr]</td>
<td class="na" align="center">N/A</td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td class="na" align="center"></td>
<td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14.6.2.4 [temp.dep.temp]</td>
<td class="na" align="center">N/A</td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td class="na" align="center"></td>
<td></td>
</tr>
@@ -2032,24 +2032,24 @@ welcome!</p>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;14.6.4 [temp.dep.res]</td>
<td class="na" align="center">N/A</td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td class="na" align="center"></td>
<td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14.6.4.1 [temp.point]</td>
<td class="na" align="center">N/A</td>
- <td class="basic" align="center"></td>
- <td class="basic" align="center"></td>
- <td class="basic" align="center"></td>
+ <td class="medium" align="center"></td>
+ <td class="medium" align="center"></td>
+ <td class="medium" align="center"></td>
<td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14.6.4.2 [temp.dep.candidate]</td>
<td class="na" align="center">N/A</td>
- <td class="basic" align="center"></td>
- <td class="basic" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td class="na" align="center"></td>
<td>Not restricted to functions with external linkage</td>
</tr>
@@ -2063,18 +2063,18 @@ welcome!</p>
</tr>
<tr>
<td>&nbsp;&nbsp;14.7 [temp.spec]</td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="broken" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;14.7.1 [temp.inst]</td>
<td class="na" align="center">N/A</td>
<td class="na" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="basic" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td></td>
</tr>
<tr>
@@ -2096,10 +2096,10 @@ welcome!</p>
</tr>
<tr>
<td>&nbsp;&nbsp;14.8 [temp.fct.spec]</td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="medium" align="center"></td>
- <td class="broken" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
+ <td class="advanced" align="center"></td>
<td></td>
</tr>
<tr>
@@ -2172,7 +2172,7 @@ welcome!</p>
<td class="na" align="center">N/A</td>
<td class="advanced" align="center"></td>
<td></td>
- <td>Does not check for existence of copy constructor and destructor, and some other details</td>
+ <td></td>
</tr>
<tr>
<td>&nbsp;&nbsp;15.2 [except.ctor]</td>