[llvm-branch-commits] [cfe-branch] r152118 - in /cfe/branches/tooling: ./ bindings/python/clang/ docs/ examples/wpa/ include/clang/AST/ include/clang/Basic/ include/clang/Driver/ include/clang/Frontend/ include/clang/Index/ include/clang/Lex/ include/clang/Parse/ include/clang/Sema/ include/clang/Serialization/ include/clang/StaticAnalyzer/Core/BugReporter/ include/clang/StaticAnalyzer/Core/PathSensitive/ lib/ARCMigrate/ lib/AST/ lib/Analysis/ lib/Basic/ lib/CodeGen/ lib/Driver/ lib/Frontend/ lib/Index/ lib/Lex/ lib/Parse/ li...

Manuel Klimek klimek at google.com
Tue Mar 6 05:07:44 PST 2012


Author: klimek
Date: Tue Mar  6 07:07:43 2012
New Revision: 152118

URL: http://llvm.org/viewvc/llvm-project?rev=152118&view=rev
Log:
Merging mainline.

Added:
    cfe/branches/tooling/include/clang/Index/GlobalCallGraph.h
      - copied unchanged from r152117, cfe/trunk/include/clang/Index/GlobalCallGraph.h
    cfe/branches/tooling/lib/Index/GlobalCallGraph.cpp
      - copied unchanged from r152117, cfe/trunk/lib/Index/GlobalCallGraph.cpp
    cfe/branches/tooling/test/Analysis/html-diags-multifile.c
      - copied unchanged from r152117, cfe/trunk/test/Analysis/html-diags-multifile.c
    cfe/branches/tooling/test/Analysis/html-diags-multifile.h
      - copied unchanged from r152117, cfe/trunk/test/Analysis/html-diags-multifile.h
    cfe/branches/tooling/test/Analysis/html-diags.c
      - copied unchanged from r152117, cfe/trunk/test/Analysis/html-diags.c
    cfe/branches/tooling/test/Analysis/inline-plist.c
      - copied unchanged from r152117, cfe/trunk/test/Analysis/inline-plist.c
    cfe/branches/tooling/test/CXX/lex/lex.literal/lex.ext/p10.cpp
      - copied unchanged from r152117, cfe/trunk/test/CXX/lex/lex.literal/lex.ext/p10.cpp
    cfe/branches/tooling/test/CXX/lex/lex.literal/lex.ext/p8.cpp
      - copied unchanged from r152117, cfe/trunk/test/CXX/lex/lex.literal/lex.ext/p8.cpp
    cfe/branches/tooling/test/CXX/lex/lex.literal/lex.ext/p9.cpp
      - copied unchanged from r152117, cfe/trunk/test/CXX/lex/lex.literal/lex.ext/p9.cpp
    cfe/branches/tooling/test/CXX/over/over.oper/over.literal/p2.cpp
      - copied unchanged from r152117, cfe/trunk/test/CXX/over/over.oper/over.literal/p2.cpp
    cfe/branches/tooling/test/CXX/over/over.oper/over.literal/p3.cpp
      - copied unchanged from r152117, cfe/trunk/test/CXX/over/over.oper/over.literal/p3.cpp
    cfe/branches/tooling/test/CXX/over/over.oper/over.literal/p5.cpp
      - copied unchanged from r152117, cfe/trunk/test/CXX/over/over.oper/over.literal/p5.cpp
    cfe/branches/tooling/test/CXX/over/over.oper/over.literal/p6.cpp
      - copied unchanged from r152117, cfe/trunk/test/CXX/over/over.oper/over.literal/p6.cpp
    cfe/branches/tooling/test/CXX/over/over.oper/over.literal/p7.cpp
      - copied unchanged from r152117, cfe/trunk/test/CXX/over/over.oper/over.literal/p7.cpp
    cfe/branches/tooling/test/CXX/over/over.oper/over.literal/p8.cpp
      - copied unchanged from r152117, cfe/trunk/test/CXX/over/over.oper/over.literal/p8.cpp
    cfe/branches/tooling/test/CodeGen/decl-in-prototype.c
      - copied unchanged from r152117, cfe/trunk/test/CodeGen/decl-in-prototype.c
    cfe/branches/tooling/test/CodeGen/libcalls-fno-builtin.c
      - copied unchanged from r152117, cfe/trunk/test/CodeGen/libcalls-fno-builtin.c
    cfe/branches/tooling/test/CodeGenCXX/cxx0x-initializer-array.cpp
      - copied unchanged from r152117, cfe/trunk/test/CodeGenCXX/cxx0x-initializer-array.cpp
    cfe/branches/tooling/test/CodeGenCXX/cxx11-unrestricted-union.cpp
      - copied unchanged from r152117, cfe/trunk/test/CodeGenCXX/cxx11-unrestricted-union.cpp
    cfe/branches/tooling/test/CodeGenCXX/debug-lambda-expressions.cpp
      - copied unchanged from r152117, cfe/trunk/test/CodeGenCXX/debug-lambda-expressions.cpp
    cfe/branches/tooling/test/CodeGenCXX/mangle-std-externc.cpp
      - copied unchanged from r152117, cfe/trunk/test/CodeGenCXX/mangle-std-externc.cpp
    cfe/branches/tooling/test/CodeGenCXX/pr12104.cpp
      - copied unchanged from r152117, cfe/trunk/test/CodeGenCXX/pr12104.cpp
    cfe/branches/tooling/test/Driver/asan.c
      - copied unchanged from r152117, cfe/trunk/test/Driver/asan.c
    cfe/branches/tooling/test/Driver/tsan.c
      - copied unchanged from r152117, cfe/trunk/test/Driver/tsan.c
    cfe/branches/tooling/test/FixIt/atomic-property.m
      - copied unchanged from r152117, cfe/trunk/test/FixIt/atomic-property.m
    cfe/branches/tooling/test/Lexer/token-concat.cpp
      - copied unchanged from r152117, cfe/trunk/test/Lexer/token-concat.cpp
    cfe/branches/tooling/test/Parser/asm.cpp
      - copied unchanged from r152117, cfe/trunk/test/Parser/asm.cpp
    cfe/branches/tooling/test/Parser/cxx11-user-defined-literals.cpp
      - copied unchanged from r152117, cfe/trunk/test/Parser/cxx11-user-defined-literals.cpp
    cfe/branches/tooling/test/Parser/objcxx11-user-defined-literal.mm
      - copied unchanged from r152117, cfe/trunk/test/Parser/objcxx11-user-defined-literal.mm
    cfe/branches/tooling/test/Preprocessor/cxx_oper_keyword_ms_compat.cpp
      - copied unchanged from r152117, cfe/trunk/test/Preprocessor/cxx_oper_keyword_ms_compat.cpp
    cfe/branches/tooling/test/Preprocessor/has_attribute.c
      - copied unchanged from r152117, cfe/trunk/test/Preprocessor/has_attribute.c
    cfe/branches/tooling/test/Sema/block-missing-return-type-warning.c
      - copied unchanged from r152117, cfe/trunk/test/Sema/block-missing-return-type-warning.c
    cfe/branches/tooling/test/Sema/decl-in-prototype.c
      - copied unchanged from r152117, cfe/trunk/test/Sema/decl-in-prototype.c
    cfe/branches/tooling/test/Sema/fn-ptr-as-fn-prototype.c
      - copied unchanged from r152117, cfe/trunk/test/Sema/fn-ptr-as-fn-prototype.c
    cfe/branches/tooling/test/Sema/variadic-incomplete-arg-type.c
      - copied unchanged from r152117, cfe/trunk/test/Sema/variadic-incomplete-arg-type.c
    cfe/branches/tooling/test/SemaCXX/discrim-union.cpp
      - copied unchanged from r152117, cfe/trunk/test/SemaCXX/discrim-union.cpp
    cfe/branches/tooling/test/SemaCXX/string-plus-int.cpp
      - copied unchanged from r152117, cfe/trunk/test/SemaCXX/string-plus-int.cpp
    cfe/branches/tooling/test/SemaObjC/warn-forward-class-attr-deprecated.m
      - copied unchanged from r152117, cfe/trunk/test/SemaObjC/warn-forward-class-attr-deprecated.m
    cfe/branches/tooling/test/SemaTemplate/instantiate-sizeof.cpp
      - copied unchanged from r152117, cfe/trunk/test/SemaTemplate/instantiate-sizeof.cpp
    cfe/branches/tooling/test/SemaTemplate/instantiate-typeof.cpp
      - copied unchanged from r152117, cfe/trunk/test/SemaTemplate/instantiate-typeof.cpp
    cfe/branches/tooling/unittests/Lex/PreprocessingRecordTest.cpp
      - copied unchanged from r152117, cfe/trunk/unittests/Lex/PreprocessingRecordTest.cpp
Removed:
    cfe/branches/tooling/include/clang/AST/UsuallyTinyPtrVector.h
    cfe/branches/tooling/include/clang/Index/CallGraph.h
    cfe/branches/tooling/lib/Index/CallGraph.cpp
    cfe/branches/tooling/test/Lexer/has_attribute.cpp
    cfe/branches/tooling/test/Sema/many-logical-ops.c
Modified:
    cfe/branches/tooling/   (props changed)
    cfe/branches/tooling/bindings/python/clang/cindex.py
    cfe/branches/tooling/docs/LanguageExtensions.html
    cfe/branches/tooling/docs/ReleaseNotes.html
    cfe/branches/tooling/docs/UsersManual.html
    cfe/branches/tooling/examples/wpa/clang-wpa.cpp
    cfe/branches/tooling/include/clang/AST/ASTConsumer.h
    cfe/branches/tooling/include/clang/AST/ASTContext.h
    cfe/branches/tooling/include/clang/AST/Decl.h
    cfe/branches/tooling/include/clang/AST/DeclBase.h
    cfe/branches/tooling/include/clang/AST/DeclCXX.h
    cfe/branches/tooling/include/clang/AST/DeclObjC.h
    cfe/branches/tooling/include/clang/AST/Expr.h
    cfe/branches/tooling/include/clang/AST/Stmt.h
    cfe/branches/tooling/include/clang/Basic/DiagnosticCommonKinds.td
    cfe/branches/tooling/include/clang/Basic/DiagnosticDriverKinds.td
    cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td
    cfe/branches/tooling/include/clang/Basic/DiagnosticLexKinds.td
    cfe/branches/tooling/include/clang/Basic/DiagnosticParseKinds.td
    cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/branches/tooling/include/clang/Basic/IdentifierTable.h
    cfe/branches/tooling/include/clang/Basic/LangOptions.def
    cfe/branches/tooling/include/clang/Basic/LangOptions.h
    cfe/branches/tooling/include/clang/Basic/TargetInfo.h
    cfe/branches/tooling/include/clang/Basic/TokenKinds.def
    cfe/branches/tooling/include/clang/Basic/Version.h
    cfe/branches/tooling/include/clang/Driver/CC1Options.td
    cfe/branches/tooling/include/clang/Driver/Options.td
    cfe/branches/tooling/include/clang/Driver/ToolChain.h
    cfe/branches/tooling/include/clang/Frontend/AnalyzerOptions.h
    cfe/branches/tooling/include/clang/Frontend/CompilerInstance.h
    cfe/branches/tooling/include/clang/Frontend/MultiplexConsumer.h
    cfe/branches/tooling/include/clang/Frontend/PreprocessorOptions.h
    cfe/branches/tooling/include/clang/Lex/HeaderSearch.h
    cfe/branches/tooling/include/clang/Lex/Lexer.h
    cfe/branches/tooling/include/clang/Lex/LiteralSupport.h
    cfe/branches/tooling/include/clang/Lex/PPCallbacks.h
    cfe/branches/tooling/include/clang/Lex/PreprocessingRecord.h
    cfe/branches/tooling/include/clang/Lex/Preprocessor.h
    cfe/branches/tooling/include/clang/Lex/Token.h
    cfe/branches/tooling/include/clang/Parse/Parser.h
    cfe/branches/tooling/include/clang/Sema/DelayedDiagnostic.h
    cfe/branches/tooling/include/clang/Sema/Scope.h
    cfe/branches/tooling/include/clang/Sema/Sema.h
    cfe/branches/tooling/include/clang/Serialization/ASTWriter.h
    cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
    cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
    cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
    cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h
    cfe/branches/tooling/lib/ARCMigrate/TransBlockObjCVariable.cpp
    cfe/branches/tooling/lib/ARCMigrate/TransGCAttrs.cpp
    cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp
    cfe/branches/tooling/lib/ARCMigrate/Transforms.h
    cfe/branches/tooling/lib/AST/ASTContext.cpp
    cfe/branches/tooling/lib/AST/ASTImporter.cpp
    cfe/branches/tooling/lib/AST/Decl.cpp
    cfe/branches/tooling/lib/AST/DeclBase.cpp
    cfe/branches/tooling/lib/AST/DeclObjC.cpp
    cfe/branches/tooling/lib/AST/DeclPrinter.cpp
    cfe/branches/tooling/lib/AST/DumpXML.cpp
    cfe/branches/tooling/lib/AST/Expr.cpp
    cfe/branches/tooling/lib/AST/ExprConstant.cpp
    cfe/branches/tooling/lib/AST/ItaniumMangle.cpp
    cfe/branches/tooling/lib/AST/Stmt.cpp
    cfe/branches/tooling/lib/AST/StmtProfile.cpp
    cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp
    cfe/branches/tooling/lib/Analysis/CFG.cpp
    cfe/branches/tooling/lib/Analysis/ThreadSafety.cpp
    cfe/branches/tooling/lib/Analysis/UninitializedValues.cpp
    cfe/branches/tooling/lib/Basic/IdentifierTable.cpp
    cfe/branches/tooling/lib/Basic/Makefile
    cfe/branches/tooling/lib/Basic/Targets.cpp
    cfe/branches/tooling/lib/Basic/Version.cpp
    cfe/branches/tooling/lib/CodeGen/BackendUtil.cpp
    cfe/branches/tooling/lib/CodeGen/CGBlocks.cpp
    cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp
    cfe/branches/tooling/lib/CodeGen/CGClass.cpp
    cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp
    cfe/branches/tooling/lib/CodeGen/CGExprAgg.cpp
    cfe/branches/tooling/lib/CodeGen/CGExprCXX.cpp
    cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp
    cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp
    cfe/branches/tooling/lib/CodeGen/CGObjC.cpp
    cfe/branches/tooling/lib/CodeGen/CGRecordLayoutBuilder.cpp
    cfe/branches/tooling/lib/CodeGen/CodeGenAction.cpp
    cfe/branches/tooling/lib/CodeGen/CodeGenFunction.cpp
    cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h
    cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp
    cfe/branches/tooling/lib/CodeGen/CodeGenModule.h
    cfe/branches/tooling/lib/CodeGen/ModuleBuilder.cpp
    cfe/branches/tooling/lib/Driver/ToolChains.cpp
    cfe/branches/tooling/lib/Driver/ToolChains.h
    cfe/branches/tooling/lib/Driver/Tools.cpp
    cfe/branches/tooling/lib/Frontend/ASTUnit.cpp
    cfe/branches/tooling/lib/Frontend/CompilerInstance.cpp
    cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp
    cfe/branches/tooling/lib/Frontend/FrontendActions.cpp
    cfe/branches/tooling/lib/Frontend/InitHeaderSearch.cpp
    cfe/branches/tooling/lib/Frontend/MultiplexConsumer.cpp
    cfe/branches/tooling/lib/Frontend/SerializedDiagnosticPrinter.cpp
    cfe/branches/tooling/lib/Index/CMakeLists.txt
    cfe/branches/tooling/lib/Lex/Lexer.cpp
    cfe/branches/tooling/lib/Lex/LiteralSupport.cpp
    cfe/branches/tooling/lib/Lex/ModuleMap.cpp
    cfe/branches/tooling/lib/Lex/PPDirectives.cpp
    cfe/branches/tooling/lib/Lex/PPExpressions.cpp
    cfe/branches/tooling/lib/Lex/PPMacroExpansion.cpp
    cfe/branches/tooling/lib/Lex/Pragma.cpp
    cfe/branches/tooling/lib/Lex/PreprocessingRecord.cpp
    cfe/branches/tooling/lib/Lex/Preprocessor.cpp
    cfe/branches/tooling/lib/Lex/TokenConcatenation.cpp
    cfe/branches/tooling/lib/Parse/ParseAST.cpp
    cfe/branches/tooling/lib/Parse/ParseDecl.cpp
    cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp
    cfe/branches/tooling/lib/Parse/ParseExpr.cpp
    cfe/branches/tooling/lib/Parse/ParseExprCXX.cpp
    cfe/branches/tooling/lib/Parse/ParseObjc.cpp
    cfe/branches/tooling/lib/Parse/ParsePragma.cpp
    cfe/branches/tooling/lib/Parse/ParseStmt.cpp
    cfe/branches/tooling/lib/Parse/Parser.cpp
    cfe/branches/tooling/lib/Rewrite/HTMLRewrite.cpp
    cfe/branches/tooling/lib/Rewrite/RewriteMacros.cpp
    cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp
    cfe/branches/tooling/lib/Sema/DelayedDiagnostic.cpp
    cfe/branches/tooling/lib/Sema/IdentifierResolver.cpp
    cfe/branches/tooling/lib/Sema/Scope.cpp
    cfe/branches/tooling/lib/Sema/Sema.cpp
    cfe/branches/tooling/lib/Sema/SemaDecl.cpp
    cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp
    cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp
    cfe/branches/tooling/lib/Sema/SemaDeclObjC.cpp
    cfe/branches/tooling/lib/Sema/SemaExpr.cpp
    cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp
    cfe/branches/tooling/lib/Sema/SemaInit.cpp
    cfe/branches/tooling/lib/Sema/SemaLambda.cpp
    cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp
    cfe/branches/tooling/lib/Sema/SemaTemplateInstantiateDecl.cpp
    cfe/branches/tooling/lib/Sema/SemaTemplateVariadic.cpp
    cfe/branches/tooling/lib/Sema/TreeTransform.h
    cfe/branches/tooling/lib/Serialization/ASTReader.cpp
    cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp
    cfe/branches/tooling/lib/Serialization/ASTWriterDecl.cpp
    cfe/branches/tooling/lib/Serialization/ASTWriterStmt.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/AnalysisManager.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngine.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
    cfe/branches/tooling/runtime/compiler-rt/Makefile
    cfe/branches/tooling/test/ARCMT/rewrite-block-var.m
    cfe/branches/tooling/test/ARCMT/rewrite-block-var.m.result
    cfe/branches/tooling/test/Analysis/inline-unique-reports.c
    cfe/branches/tooling/test/Analysis/inline.c
    cfe/branches/tooling/test/Analysis/malloc-annotations.c
    cfe/branches/tooling/test/Analysis/malloc-interprocedural.c
    cfe/branches/tooling/test/Analysis/malloc.c
    cfe/branches/tooling/test/Analysis/malloc.mm
    cfe/branches/tooling/test/Analysis/misc-ps-region-store.m
    cfe/branches/tooling/test/Analysis/nullptr.cpp
    cfe/branches/tooling/test/Analysis/ptr-arith.c
    cfe/branches/tooling/test/Analysis/self-init.m
    cfe/branches/tooling/test/Analysis/stats.c
    cfe/branches/tooling/test/Analysis/system-header-simulator-objc.h
    cfe/branches/tooling/test/Analysis/system-header-simulator.h
    cfe/branches/tooling/test/Analysis/unreachable-code-path.c
    cfe/branches/tooling/test/CXX/dcl.dcl/p4-0x.cpp
    cfe/branches/tooling/test/CXX/expr/expr.ass/p9-cxx11.cpp
    cfe/branches/tooling/test/CXX/expr/expr.const/p2-0x.cpp
    cfe/branches/tooling/test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp
    cfe/branches/tooling/test/CXX/lex/lex.literal/lex.ext/p1.cpp
    cfe/branches/tooling/test/CXX/special/class.copy/p11.0x.copy.cpp
    cfe/branches/tooling/test/CXX/special/class.copy/p11.0x.move.cpp
    cfe/branches/tooling/test/CodeGen/builtin-memfns.c
    cfe/branches/tooling/test/CodeGenCXX/const-init-cxx11.cpp
    cfe/branches/tooling/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
    cfe/branches/tooling/test/CodeGenCXX/debug-info-pubtypes.cpp
    cfe/branches/tooling/test/CodeGenObjCXX/lambda-expressions.mm
    cfe/branches/tooling/test/Driver/arc.c
    cfe/branches/tooling/test/Index/complete-modules.m
    cfe/branches/tooling/test/Index/crash-recovery-modules.m
    cfe/branches/tooling/test/Lexer/has_feature_cxx0x.cpp
    cfe/branches/tooling/test/Misc/serialized-diags.c
    cfe/branches/tooling/test/Misc/warning-flags.c
    cfe/branches/tooling/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h
    cfe/branches/tooling/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h
    cfe/branches/tooling/test/Modules/Inputs/category_bottom.h
    cfe/branches/tooling/test/Modules/Inputs/category_left.h
    cfe/branches/tooling/test/Modules/Inputs/category_other.h
    cfe/branches/tooling/test/Modules/Inputs/category_right.h
    cfe/branches/tooling/test/Modules/Inputs/diamond.h
    cfe/branches/tooling/test/Modules/Inputs/diamond_bottom.h
    cfe/branches/tooling/test/Modules/Inputs/diamond_left.h
    cfe/branches/tooling/test/Modules/Inputs/diamond_right.h
    cfe/branches/tooling/test/Modules/Inputs/namespaces-left.h
    cfe/branches/tooling/test/Modules/Inputs/namespaces-right.h
    cfe/branches/tooling/test/Modules/Inputs/redecl-merge-bottom.h
    cfe/branches/tooling/test/Modules/Inputs/redecl-merge-left-left.h
    cfe/branches/tooling/test/Modules/Inputs/redecl-merge-left.h
    cfe/branches/tooling/test/Modules/Inputs/redecl-merge-right.h
    cfe/branches/tooling/test/Modules/Inputs/wildcard-submodule-exports/C_one.h
    cfe/branches/tooling/test/Modules/Inputs/wildcard-submodule-exports/C_two.h
    cfe/branches/tooling/test/Modules/compiler_builtins.m
    cfe/branches/tooling/test/Modules/cstd.m
    cfe/branches/tooling/test/Modules/cycles.c
    cfe/branches/tooling/test/Modules/decldef.mm
    cfe/branches/tooling/test/Modules/diamond.c
    cfe/branches/tooling/test/Modules/header-import.m
    cfe/branches/tooling/test/Modules/inferred-submodules.m
    cfe/branches/tooling/test/Modules/irgen.c
    cfe/branches/tooling/test/Modules/load_failure.c
    cfe/branches/tooling/test/Modules/lookup.cpp
    cfe/branches/tooling/test/Modules/lookup.m
    cfe/branches/tooling/test/Modules/macros.c
    cfe/branches/tooling/test/Modules/method_pool.m
    cfe/branches/tooling/test/Modules/module-private.cpp
    cfe/branches/tooling/test/Modules/namespaces.cpp
    cfe/branches/tooling/test/Modules/normal-module-map.cpp
    cfe/branches/tooling/test/Modules/objc-categories.m
    cfe/branches/tooling/test/Modules/on-demand-build-warnings.m
    cfe/branches/tooling/test/Modules/on-demand-build.m
    cfe/branches/tooling/test/Modules/on-demand-macros.m
    cfe/branches/tooling/test/Modules/redecl-merge.m
    cfe/branches/tooling/test/Modules/redeclarations.m
    cfe/branches/tooling/test/Modules/requires.m
    cfe/branches/tooling/test/Modules/subframeworks.m
    cfe/branches/tooling/test/Modules/submodules-preprocess.cpp
    cfe/branches/tooling/test/Modules/submodules.cpp
    cfe/branches/tooling/test/Modules/submodules.m
    cfe/branches/tooling/test/Modules/wildcard-submodule-exports.cpp
    cfe/branches/tooling/test/Parser/MicrosoftExtensions.c
    cfe/branches/tooling/test/Preprocessor/init.c
    cfe/branches/tooling/test/Preprocessor/pragma_microsoft.c
    cfe/branches/tooling/test/Sema/builtins.c
    cfe/branches/tooling/test/Sema/warn-unused-parameters.c
    cfe/branches/tooling/test/SemaCXX/array-bounds-ptr-arith.cpp
    cfe/branches/tooling/test/SemaCXX/constant-expression-cxx11.cpp
    cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-aggregates.cpp
    cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-constructor.cpp
    cfe/branches/tooling/test/SemaCXX/cxx0x-nontrivial-union.cpp
    cfe/branches/tooling/test/SemaCXX/cxx98-compat.cpp
    cfe/branches/tooling/test/SemaCXX/lambda-expressions.cpp
    cfe/branches/tooling/test/SemaCXX/literal-operators.cpp
    cfe/branches/tooling/test/SemaCXX/null_in_arithmetic_ops.cpp
    cfe/branches/tooling/test/SemaCXX/underlying_type.cpp
    cfe/branches/tooling/test/SemaCXX/warn-memset-bad-sizeof.cpp
    cfe/branches/tooling/test/SemaCXX/warn-thread-safety-analysis.cpp
    cfe/branches/tooling/test/SemaCXX/warn-thread-safety-parsing.cpp
    cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp   (props changed)
    cfe/branches/tooling/test/SemaCXX/warn-unused-parameters.cpp
    cfe/branches/tooling/test/SemaObjC/atomoic-property-synnthesis-rules.m
    cfe/branches/tooling/test/SemaObjC/category-1.m
    cfe/branches/tooling/test/SemaObjC/nsobject-attribute.m
    cfe/branches/tooling/test/SemaTemplate/constexpr-instantiate.cpp
    cfe/branches/tooling/tools/driver/cc1as_main.cpp
    cfe/branches/tooling/tools/libclang/CIndex.cpp
    cfe/branches/tooling/tools/libclang/CIndexDiagnostic.cpp
    cfe/branches/tooling/utils/TableGen/ClangDiagnosticsEmitter.cpp
    cfe/branches/tooling/www/cxx_status.html

Propchange: cfe/branches/tooling/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  6 07:07:43 2012
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:146581-151673
+/cfe/trunk:146581-152117
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/tooling/bindings/python/clang/cindex.py
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/bindings/python/clang/cindex.py?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/bindings/python/clang/cindex.py (original)
+++ cfe/branches/tooling/bindings/python/clang/cindex.py Tue Mar  6 07:07:43 2012
@@ -893,7 +893,7 @@
         return Cursor_eq(self, other)
 
     def __ne__(self, other):
-        return not Cursor_eq(self, other)
+        return not self.__eq__(other)
 
     def is_definition(self):
         """
@@ -1876,7 +1876,7 @@
 
 Cursor_eq = lib.clang_equalCursors
 Cursor_eq.argtypes = [Cursor, Cursor]
-Cursor_eq.restype = c_uint
+Cursor_eq.restype = bool
 
 Cursor_hash = lib.clang_hashCursor
 Cursor_hash.argtypes = [Cursor]

Modified: cfe/branches/tooling/docs/LanguageExtensions.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/LanguageExtensions.html?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/docs/LanguageExtensions.html (original)
+++ cfe/branches/tooling/docs/LanguageExtensions.html Tue Mar  6 07:07:43 2012
@@ -230,8 +230,8 @@
 
 <p>The feature name or extension name can also be specified with a preceding and
 following <code>__</code> (double underscore) to avoid interference from a macro
-with the same name. For instance, <code>__always_inline__</code> can be used
-instead of <code>always_inline</code>.</p>
+with the same name. For instance, <code>__cxx_rvalue_references__</code> can be
+used instead of <code>cxx_rvalue_references</code>.</p>
 
 <!-- ======================================================================= -->
 <h3><a name="__has_attribute">__has_attribute</a></h3>
@@ -257,6 +257,11 @@
 </pre>
 </blockquote>
 
+<p>The attribute name can also be specified with a preceding and
+following <code>__</code> (double underscore) to avoid interference from a macro
+with the same name. For instance, <code>__always_inline__</code> can be used
+instead of <code>always_inline</code>.</p>
+
 <!-- ======================================================================= -->
 <h2 id="has_include">Include File Checking Macros</h2>
 <!-- ======================================================================= -->
@@ -809,7 +814,7 @@
 
 <h4 id="cxx_unrestricted_unions">C++11 unrestricted unions</h4>
 
-<p>Use <tt>__has_feature(cxx_unrestricted_unions)</tt> to determine if support for unrestricted unions is enabled. Clang does not currently support this feature.</p>
+<p>Use <tt>__has_feature(cxx_unrestricted_unions)</tt> to determine if support for unrestricted unions is enabled.</p>
 
 <h4 id="cxx_user_literals">C++11 user-defined literals</h4>
 

Modified: cfe/branches/tooling/docs/ReleaseNotes.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/ReleaseNotes.html?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/docs/ReleaseNotes.html (original)
+++ cfe/branches/tooling/docs/ReleaseNotes.html Tue Mar  6 07:07:43 2012
@@ -29,7 +29,7 @@
       <li><a href="#majorfeatures">Major New Features</a></li>
       <li><a href="#cchanges">C Language Changes</a></li>
       <li><a href="#cxxchanges">C++ Language Changes</a></li>
-      <li><a href="#objchanges">Objective-C Language Changes</a></li>
+      <li><a href="#objcchanges">Objective-C Language Changes</a></li>
       <li><a href="#apichanges">Internal API Changes</a></li>
     </ul>
   </li>
@@ -123,6 +123,7 @@
   <li>Generalized constant expressions</li>
   <li>Lambda expressions</li>
   <li>Generalized initializers</li>
+  <li>Unrestricted unions</li>
 </ul>
 
 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->

Modified: cfe/branches/tooling/docs/UsersManual.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/UsersManual.html?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/docs/UsersManual.html (original)
+++ cfe/branches/tooling/docs/UsersManual.html Tue Mar  6 07:07:43 2012
@@ -830,6 +830,14 @@
 </ul>
 </dd>
 
+<dt id="opt_faddress-sanitizer"><b>-f[no-]address-sanitizer</b>:
+Turn on <a href="AddressSanitizer.html">AddressSanitizer</a>,
+a memory error detector.
+
+<dt id="opt_fthread-sanitizer"><b>-f[no-]thread-sanitizer</b>:
+Turn on ThreadSanitizer, an <em>experimental</em> data race detector.
+Not ready for widespread use.
+
 <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

Modified: cfe/branches/tooling/examples/wpa/clang-wpa.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/examples/wpa/clang-wpa.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/examples/wpa/clang-wpa.cpp (original)
+++ cfe/branches/tooling/examples/wpa/clang-wpa.cpp Tue Mar  6 07:07:43 2012
@@ -22,7 +22,7 @@
 #include "clang/StaticAnalyzer/Checkers/LocalCheckers.h"
 #include "clang/Frontend/ASTUnit.h"
 #include "clang/Frontend/CompilerInstance.h"
-#include "clang/Index/CallGraph.h"
+#include "clang/Index/GlobalCallGraph.h"
 #include "clang/Index/Indexer.h"
 #include "clang/Index/TranslationUnit.h"
 #include "clang/Index/DeclReferenceMap.h"
@@ -104,8 +104,8 @@
   }
 
   if (ViewCallGraph) {
-    OwningPtr<CallGraph> CG;
-    CG.reset(new CallGraph(Prog));
+    OwningPtr<clang::idx::CallGraph> CG;
+    CG.reset(new clang::idx::CallGraph(Prog));
 
     for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i)
       CG->addTU(ASTUnits[i]->getASTContext());

Modified: cfe/branches/tooling/include/clang/AST/ASTConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/ASTConsumer.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/ASTConsumer.h (original)
+++ cfe/branches/tooling/include/clang/AST/ASTConsumer.h Tue Mar  6 07:07:43 2012
@@ -90,6 +90,11 @@
   /// modified by the introduction of an implicit zero initializer.
   virtual void CompleteTentativeDefinition(VarDecl *D) {}
 
+  /// MarkVarRequired - Tell the consumer that this variable must be output.
+  /// This is needed when the definition is initially one that can be deferred,
+  /// but we then see an explicit template instantiation definition.
+  virtual void MarkVarRequired(VarDecl *D) {}
+
   /// \brief Callback involved at the end of a translation unit to
   /// notify the consumer that a vtable for the given C++ class is
   /// required.

Modified: cfe/branches/tooling/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/ASTContext.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/ASTContext.h (original)
+++ cfe/branches/tooling/include/clang/AST/ASTContext.h Tue Mar  6 07:07:43 2012
@@ -27,12 +27,12 @@
 #include "clang/AST/TemplateName.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/CanonicalType.h"
-#include "clang/AST/UsuallyTinyPtrVector.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/TinyPtrVector.h"
 #include "llvm/Support/Allocator.h"
 #include <vector>
 
@@ -322,7 +322,7 @@
   /// Since most C++ member functions aren't virtual and therefore
   /// don't override anything, we store the overridden functions in
   /// this map on the side rather than within the CXXMethodDecl structure.
-  typedef UsuallyTinyPtrVector<const CXXMethodDecl> CXXMethodVector;
+  typedef llvm::TinyPtrVector<const CXXMethodDecl*> CXXMethodVector;
   llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector> OverriddenMethods;
 
   /// \brief Mapping from each declaration context to its corresponding lambda 
@@ -480,7 +480,7 @@
                                   const FieldDecl *LastFD) const;
 
   // Access to the set of methods overridden by the given C++ method.
-  typedef CXXMethodVector::iterator overridden_cxx_method_iterator;
+  typedef CXXMethodVector::const_iterator overridden_cxx_method_iterator;
   overridden_cxx_method_iterator
   overridden_methods_begin(const CXXMethodDecl *Method) const;
 
@@ -1907,13 +1907,16 @@
 }  // end namespace clang
 
 // operator new and delete aren't allowed inside namespaces.
-// The throw specifications are mandated by the standard.
+
 /// @brief Placement new for using the ASTContext's allocator.
 ///
 /// This placement form of operator new uses the ASTContext's allocator for
-/// obtaining memory. It is a non-throwing new, which means that it returns
-/// null on error. (If that is what the allocator does. The current does, so if
-/// this ever changes, this operator will have to be changed, too.)
+/// obtaining memory.
+///
+/// We intentionally avoid using a nothrow specification here so that the calls
+/// to this operator will not perform a null check on the result -- the
+/// underlying allocator never returns null pointers.
+///
 /// Usage looks like this (assuming there's an ASTContext 'Context' in scope):
 /// @code
 /// // Default alignment (8)
@@ -1931,7 +1934,7 @@
 ///                  allocator supports it).
 /// @return The allocated memory. Could be NULL.
 inline void *operator new(size_t Bytes, const clang::ASTContext &C,
-                          size_t Alignment) throw () {
+                          size_t Alignment) {
   return C.Allocate(Bytes, Alignment);
 }
 /// @brief Placement delete companion to the new above.
@@ -1940,14 +1943,17 @@
 /// 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, const clang::ASTContext &C, size_t)
-              throw () {
+inline void operator delete(void *Ptr, const clang::ASTContext &C, size_t) {
   C.Deallocate(Ptr);
 }
 
 /// This placement form of operator new[] uses the ASTContext's allocator for
-/// obtaining memory. It is a non-throwing new[], which means that it returns
-/// null on error.
+/// obtaining memory.
+///
+/// We intentionally avoid using a nothrow specification here so that the calls
+/// to this operator will not perform a null check on the result -- the
+/// underlying allocator never returns null pointers.
+///
 /// Usage looks like this (assuming there's an ASTContext 'Context' in scope):
 /// @code
 /// // Default alignment (8)
@@ -1965,7 +1971,7 @@
 ///                  allocator supports it).
 /// @return The allocated memory. Could be NULL.
 inline void *operator new[](size_t Bytes, const clang::ASTContext& C,
-                            size_t Alignment = 8) throw () {
+                            size_t Alignment = 8) {
   return C.Allocate(Bytes, Alignment);
 }
 
@@ -1975,8 +1981,7 @@
 /// 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, const clang::ASTContext &C, size_t)
-              throw () {
+inline void operator delete[](void *Ptr, const clang::ASTContext &C, size_t) {
   C.Deallocate(Ptr);
 }
 

Modified: cfe/branches/tooling/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/Decl.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/Decl.h (original)
+++ cfe/branches/tooling/include/clang/AST/Decl.h Tue Mar  6 07:07:43 2012
@@ -1431,6 +1431,11 @@
   /// no formals.
   ParmVarDecl **ParamInfo;
 
+  /// DeclsInPrototypeScope - Array of pointers to NamedDecls for
+  /// decls defined in the function prototype that are not parameters. E.g.
+  /// 'enum Y' in 'void f(enum Y {AA} x) {}'.
+  llvm::ArrayRef<NamedDecl*> DeclsInPrototypeScope;
+
   LazyDeclStmtPtr Body;
 
   // FIXME: This can be packed into the bitfields in Decl.
@@ -1796,6 +1801,11 @@
     setParams(getASTContext(), NewParamInfo);
   }
 
+  const llvm::ArrayRef<NamedDecl*> &getDeclsInPrototypeScope() const {
+    return DeclsInPrototypeScope;
+  }
+  void setDeclsInPrototypeScope(llvm::ArrayRef<NamedDecl *> NewDecls);
+
   /// getMinRequiredArguments - Returns the minimum number of arguments
   /// needed to call this function. This may be fewer than the number of
   /// function parameters, if some of the parameters have default
@@ -3050,6 +3060,7 @@
   bool IsVariadic : 1;
   bool CapturesCXXThis : 1;
   bool BlockMissingReturnType : 1;
+  bool IsConversionFromLambda : 1;
   /// ParamInfo - new[]'d array of pointers to ParmVarDecls for the formal
   /// parameters of this function.  This is null if a prototype or if there are
   /// no formals.
@@ -3066,7 +3077,7 @@
   BlockDecl(DeclContext *DC, SourceLocation CaretLoc)
     : Decl(Block, DC, CaretLoc), DeclContext(Block),
       IsVariadic(false), CapturesCXXThis(false),
-      BlockMissingReturnType(true),
+      BlockMissingReturnType(true), IsConversionFromLambda(false),
       ParamInfo(0), NumParams(0), Body(0),
       SignatureAsWritten(0), Captures(0), NumCaptures(0) {}
 
@@ -3128,6 +3139,9 @@
   bool blockMissingReturnType() const { return BlockMissingReturnType; }
   void setBlockMissingReturnType(bool val) { BlockMissingReturnType = val; }
 
+  bool isConversionFromLambda() const { return IsConversionFromLambda; }
+  void setIsConversionFromLambda(bool val) { IsConversionFromLambda = val; }
+
   bool capturesVariable(const VarDecl *var) const;
 
   void setCaptures(ASTContext &Context,
@@ -3154,7 +3168,7 @@
 ///
 /// An import declaration imports the named module (or submodule). For example:
 /// \code
-///   @import std.vector;
+///   @__experimental_modules_import std.vector;
 /// \endcode
 ///
 /// Import declarations can also be implicitly generated from #include/#import 

Modified: cfe/branches/tooling/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/DeclBase.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/DeclBase.h (original)
+++ cfe/branches/tooling/include/clang/AST/DeclBase.h Tue Mar  6 07:07:43 2012
@@ -260,6 +260,9 @@
   /// are regarded as "referenced" but not "used".
   unsigned Referenced : 1;
 
+  /// \brief Whether statistic collection is enabled.
+  static bool StatisticsEnabled;
+
 protected:
   /// Access - Used by C++ decls for the access specifier.
   // NOTE: VC++ treats enums as signed, avoid using the AccessSpecifier enum
@@ -304,7 +307,7 @@
       IdentifierNamespace(getIdentifierNamespaceForKind(DK)),
       HasCachedLinkage(0)
   {
-    if (Decl::CollectingStats()) add(DK);
+    if (StatisticsEnabled) add(DK);
   }
 
   Decl(Kind DK, EmptyShell Empty)
@@ -314,7 +317,7 @@
       IdentifierNamespace(getIdentifierNamespaceForKind(DK)),
       HasCachedLinkage(0)
   {
-    if (Decl::CollectingStats()) add(DK);
+    if (StatisticsEnabled) add(DK);
   }
 
   virtual ~Decl();
@@ -761,7 +764,7 @@
 
   // global temp stats (until we have a per-module visitor)
   static void add(Kind k);
-  static bool CollectingStats(bool Enable = false);
+  static void EnableStatistics();
   static void PrintStats();
 
   /// isTemplateParameter - Determines whether this declaration is a

Modified: cfe/branches/tooling/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/DeclCXX.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/DeclCXX.h (original)
+++ cfe/branches/tooling/include/clang/AST/DeclCXX.h Tue Mar  6 07:07:43 2012
@@ -997,6 +997,14 @@
   void getCaptureFields(llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
                         FieldDecl *&ThisCapture) const;
 
+  typedef const LambdaExpr::Capture* capture_const_iterator;
+  capture_const_iterator captures_begin() const {
+    return isLambda() ? getLambdaData().Captures : NULL;
+  }
+  capture_const_iterator captures_end() const {
+    return isLambda() ? captures_begin() + getLambdaData().NumCaptures : NULL;
+  }
+
   /// getConversions - Retrieve the overload set containing all of the
   /// conversion functions in this class.
   UnresolvedSetImpl *getConversionFunctions() {
@@ -1593,7 +1601,7 @@
   ///
   void addOverriddenMethod(const CXXMethodDecl *MD);
 
-  typedef const CXXMethodDecl ** method_iterator;
+  typedef const CXXMethodDecl *const* method_iterator;
 
   method_iterator begin_overridden_methods() const;
   method_iterator end_overridden_methods() const;

Modified: cfe/branches/tooling/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/DeclObjC.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/DeclObjC.h (original)
+++ cfe/branches/tooling/include/clang/AST/DeclObjC.h Tue Mar  6 07:07:43 2012
@@ -1737,6 +1737,7 @@
   enum PropertyControl { None, Required, Optional };
 private:
   SourceLocation AtLoc;   // location of @property
+  SourceLocation LParenLoc; // location of '(' starting attribute list or null.
   TypeSourceInfo *DeclType;
   unsigned PropertyAttributes : NumPropertyAttrsBits;
   unsigned PropertyAttributesAsWritten : NumPropertyAttrsBits;
@@ -1751,8 +1752,10 @@
   ObjCIvarDecl *PropertyIvarDecl;   // Synthesize ivar for this property
 
   ObjCPropertyDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
-                   SourceLocation AtLocation, TypeSourceInfo *T)
-    : NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation), DeclType(T),
+                   SourceLocation AtLocation,  SourceLocation LParenLocation,
+                   TypeSourceInfo *T)
+    : NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation), 
+      LParenLoc(LParenLocation), DeclType(T),
       PropertyAttributes(OBJC_PR_noattr),
       PropertyAttributesAsWritten(OBJC_PR_noattr),
       PropertyImplementation(None),
@@ -1763,6 +1766,7 @@
   static ObjCPropertyDecl *Create(ASTContext &C, DeclContext *DC,
                                   SourceLocation L,
                                   IdentifierInfo *Id, SourceLocation AtLocation,
+                                  SourceLocation LParenLocation,
                                   TypeSourceInfo *T,
                                   PropertyControl propControl = None);
   
@@ -1770,6 +1774,9 @@
   
   SourceLocation getAtLoc() const { return AtLoc; }
   void setAtLoc(SourceLocation L) { AtLoc = L; }
+  
+  SourceLocation getLParenLoc() const { return LParenLoc; }
+  void setLParenLoc(SourceLocation L) { LParenLoc = L; }
 
   TypeSourceInfo *getTypeSourceInfo() const { return DeclType; }
   QualType getType() const { return DeclType->getType(); }

Modified: cfe/branches/tooling/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/Expr.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/Expr.h (original)
+++ cfe/branches/tooling/include/clang/AST/Expr.h Tue Mar  6 07:07:43 2012
@@ -21,7 +21,6 @@
 #include "clang/AST/OperationKinds.h"
 #include "clang/AST/ASTVector.h"
 #include "clang/AST/TemplateBase.h"
-#include "clang/AST/UsuallyTinyPtrVector.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/TypeTraits.h"
 #include "llvm/ADT/APSInt.h"

Modified: cfe/branches/tooling/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/Stmt.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/Stmt.h (original)
+++ cfe/branches/tooling/include/clang/AST/Stmt.h Tue Mar  6 07:07:43 2012
@@ -319,17 +319,21 @@
   /// de-serialization).
   struct EmptyShell { };
 
+private:
+  /// \brief Whether statistic collection is enabled.
+  static bool StatisticsEnabled;
+
 protected:
   /// \brief Construct an empty statement.
   explicit Stmt(StmtClass SC, EmptyShell) {
     StmtBits.sClass = SC;
-    if (Stmt::CollectingStats()) Stmt::addStmtClass(SC);
+    if (StatisticsEnabled) Stmt::addStmtClass(SC);
   }
 
 public:
   Stmt(StmtClass SC) {
     StmtBits.sClass = SC;
-    if (Stmt::CollectingStats()) Stmt::addStmtClass(SC);
+    if (StatisticsEnabled) Stmt::addStmtClass(SC);
   }
 
   StmtClass getStmtClass() const {
@@ -347,7 +351,7 @@
 
   // global temp stats (until we have a per-module visitor)
   static void addStmtClass(const StmtClass s);
-  static bool CollectingStats(bool Enable = false);
+  static void EnableStatistics();
   static void PrintStats();
 
   /// dump - This does a local dump of the specified AST fragment.  It dumps the

Removed: cfe/branches/tooling/include/clang/AST/UsuallyTinyPtrVector.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/UsuallyTinyPtrVector.h?rev=152117&view=auto
==============================================================================
--- cfe/branches/tooling/include/clang/AST/UsuallyTinyPtrVector.h (original)
+++ cfe/branches/tooling/include/clang/AST/UsuallyTinyPtrVector.h (removed)
@@ -1,114 +0,0 @@
-//===-- UsuallyTinyPtrVector.h - Pointer vector 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 UsuallyTinyPtrVector class, which is a vector that
-//  optimizes the case where there is only one element.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_AST_USUALLY_TINY_PTR_VECTOR_H
-#define LLVM_CLANG_AST_USUALLY_TINY_PTR_VECTOR_H
-
-#include <vector>
-
-namespace clang {
-
-/// \brief A vector class template that is optimized for storing a single 
-/// pointer element.
-template<typename T>
-class UsuallyTinyPtrVector {
-  /// \brief Storage for the vector.
-  ///
-  /// When the low bit is zero, this is a T *. When the
-  /// low bit is one, this is a std::vector<T *> *.
-  mutable uintptr_t Storage;
-
-  typedef std::vector<T*> vector_type;
-
-public:
-  UsuallyTinyPtrVector() : Storage(0) { }
-  explicit UsuallyTinyPtrVector(T *Element) 
-    : Storage(reinterpret_cast<uintptr_t>(Element)) { }
-  
-  bool empty() const { return !Storage; }
-
-  typedef const T **iterator;
-  iterator begin() const;
-  iterator end() const;
-  size_t size() const;
-
-  void push_back(T *Method);
-  void Destroy();
-};
-
-template<typename T>
-typename UsuallyTinyPtrVector<T>::iterator 
-UsuallyTinyPtrVector<T>::begin() const {
-  if ((Storage & 0x01) == 0)
-    return reinterpret_cast<iterator>(&Storage);
-
-  vector_type *Vec = reinterpret_cast<vector_type *>(Storage & ~0x01);
-  return &Vec->front();
-}
-
-template<typename T>
-typename UsuallyTinyPtrVector<T>::iterator 
-UsuallyTinyPtrVector<T>::end() const {
-  if ((Storage & 0x01) == 0) {
-    if (Storage == 0)
-      return reinterpret_cast<iterator>(&Storage);
-
-    return reinterpret_cast<iterator>(&Storage) + 1;
-  }
-
-  vector_type *Vec = reinterpret_cast<vector_type *>(Storage & ~0x01);
-  return &Vec->front() + Vec->size();
-}
-
-template<typename T>
-size_t UsuallyTinyPtrVector<T>::size() const {
-  if ((Storage & 0x01) == 0)
-    return (Storage == 0) ? 0 : 1;
-
-  vector_type *Vec = reinterpret_cast<vector_type *>(Storage & ~0x01);
-  return Vec->size();
-}
-
-template<typename T>
-void UsuallyTinyPtrVector<T>::push_back(T *Element) {
-  if (Storage == 0) {
-    // 0 -> 1 element.
-    Storage = reinterpret_cast<uintptr_t>(Element);
-    return;
-  }
-
-  vector_type *Vec;
-  if ((Storage & 0x01) == 0) {
-    // 1 -> 2 elements. Allocate a new vector and push the element into that
-    // vector.
-    Vec = new vector_type;
-    Vec->push_back(reinterpret_cast<T *>(Storage));
-    Storage = reinterpret_cast<uintptr_t>(Vec) | 0x01;
-  } else
-    Vec = reinterpret_cast<vector_type *>(Storage & ~0x01);
-
-  // Add the new element to the vector.
-  Vec->push_back(Element);
-}
-
-template<typename T>
-void UsuallyTinyPtrVector<T>::Destroy() {
-  if (Storage & 0x01)
-    delete reinterpret_cast<vector_type *>(Storage & ~0x01);
-  
-  Storage = 0;
-}
-
-}
-#endif 

Modified: cfe/branches/tooling/include/clang/Basic/DiagnosticCommonKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/DiagnosticCommonKinds.td?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticCommonKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticCommonKinds.td Tue Mar  6 07:07:43 2012
@@ -41,6 +41,8 @@
 def err_expected_colon_after_setter_name : Error<
   "method name referenced in property setter attribute "
   "must end with ':'">;
+def err_invalid_string_udl : Error<
+  "string literal with user-defined suffix cannot be used here">;
 
 // Parse && Sema
 def ext_no_declarators : ExtWarn<"declaration does not declare anything">,

Modified: cfe/branches/tooling/include/clang/Basic/DiagnosticDriverKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/DiagnosticDriverKinds.td?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticDriverKinds.td Tue Mar  6 07:07:43 2012
@@ -93,6 +93,8 @@
   "cannot specify both '-fobjc-arc' and '%0'">;
 def err_arc_nonfragile_abi : Error<
   "-fobjc-arc is not supported with fragile abi">;
+def err_arc_unsupported : Error<
+  "-fobjc-arc is not supported on current deployment target">;
 def err_drv_mg_requires_m_or_mm : Error<
   "option '-MG' requires '-M' or '-MM'">;
 

Modified: cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td Tue Mar  6 07:07:43 2012
@@ -27,6 +27,7 @@
 def Availability : DiagGroup<"availability">;
 def AutoImport : DiagGroup<"auto-import">;
 def BoolConversions : DiagGroup<"bool-conversions">;
+def IntConversions : DiagGroup<"int-conversions">;
 def BuiltinRequiresHeader : DiagGroup<"builtin-requires-header">;
 def CXXCompat: DiagGroup<"c++-compat">;
 def CastAlign : DiagGroup<"cast-align">;
@@ -133,6 +134,7 @@
 def ObjCPropertyImpl : DiagGroup<"objc-property-implementation">;
 def ObjCMissingSuperCalls : DiagGroup<"objc-missing-super-calls">;
 def ObjCRetainBlockProperty : DiagGroup<"objc-noncopy-retain-block-property">;
+def BlockMissingReturnType : DiagGroup<"block-missing-explicit-return-type">;
 def ObjCReadonlyPropertyHasSetter : DiagGroup<"objc-readonly-with-setter-property">;
 def Packed : DiagGroup<"packed">;
 def Padded : DiagGroup<"padded">;
@@ -160,6 +162,7 @@
 def : DiagGroup<"switch-default">;
 def : DiagGroup<"synth">;
 def SizeofArrayArgument : DiagGroup<"sizeof-array-argument">;
+def StringPlusInt : DiagGroup<"string-plus-int">;
 def StrncatSize : DiagGroup<"strncat-size">;
 def TautologicalCompare : DiagGroup<"tautological-compare">;
 def HeaderHygiene : DiagGroup<"header-hygiene">;
@@ -244,6 +247,7 @@
 def VexingParse : DiagGroup<"vexing-parse">;
 def VLA : DiagGroup<"vla">;
 def VolatileRegisterVar : DiagGroup<"volatile-register-var">;
+def Visibility : DiagGroup<"visibility">;
 
 // GCC calls -Wdeprecated-writable-strings -Wwrite-strings.
 def GCCWriteStrings : DiagGroup<"write-strings" , [DeprecatedWritableStr]>;
@@ -277,7 +281,8 @@
                             DiagGroup<"literal-conversion">,
                             DiagGroup<"string-conversion">,
                             DiagGroup<"sign-conversion">,
-                            BoolConversions]>,
+                            BoolConversions,
+                            IntConversions]>,
                  DiagCategory<"Value Conversion Issue">;
 
 def Unused : DiagGroup<"unused",
@@ -323,6 +328,7 @@
     ReturnType,
     SelfAssignment,
     SizeofArrayArgument,
+    StringPlusInt,
     Trigraphs,
     Uninitialized,
     UnknownPragmas,

Modified: cfe/branches/tooling/include/clang/Basic/DiagnosticLexKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/DiagnosticLexKinds.td?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticLexKinds.td Tue Mar  6 07:07:43 2012
@@ -133,6 +133,12 @@
   InGroup<CXX98Compat>, DefaultIgnore;
 def err_unsupported_string_concat : Error<
   "unsupported non-standard concatenation of string literals">;
+def err_string_concat_mixed_suffix : Error<
+  "differing user-defined suffixes ('%0' and '%1') in string literal "
+  "concatenation">;
+def err_pp_invalid_char_udl : Error<
+  "character literal with user-defined suffix cannot be used in preprocessor "
+  "constant expression">;
 def err_bad_string_encoding : Error<
   "illegal character encoding in string literal">;
 def warn_bad_string_encoding : ExtWarn<
@@ -292,6 +298,19 @@
    ExtWarn<"__has_warning expected option name (e.g. \"-Wundef\")">,
    InGroup<MalformedWarningCheck>;
 
+def warn_pragma_include_alias_mismatch_angle :
+   ExtWarn<"angle-bracketed include <%0> cannot be aliased to double-quoted "
+   "include \"%1\"">, InGroup<UnknownPragmas>;
+def warn_pragma_include_alias_mismatch_quote :
+   ExtWarn<"double-quoted include \"%0\" cannot be aliased to angle-bracketed "
+   "include <%1>">, InGroup<UnknownPragmas>;
+def warn_pragma_include_alias_expected :
+   ExtWarn<"pragma include_alias expected '%0'">,
+   InGroup<UnknownPragmas>;
+def warn_pragma_include_alias_expected_filename :
+   ExtWarn<"pragma include_alias expected include filename">,
+   InGroup<UnknownPragmas>;
+
 def err__Pragma_malformed : Error<
   "_Pragma takes a parenthesized string literal">;
 def err_pragma_comment_malformed : Error<

Modified: cfe/branches/tooling/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/DiagnosticParseKinds.td?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticParseKinds.td Tue Mar  6 07:07:43 2012
@@ -154,6 +154,9 @@
 def warn_attribute_on_function_definition : Warning<
   "GCC does not allow %0 attribute in this position on a function definition">, 
   InGroup<GccCompat>;
+def warn_attribute_no_decl : Warning<
+  "attribute %0 ignored, because it is not attached to a declaration">, 
+  InGroup<IgnoredAttributes>;
 def err_expected_method_body : Error<"expected method body">;
 def err_invalid_token_after_toplevel_declarator : Error<
   "expected ';' after top level declarator">;
@@ -197,7 +200,7 @@
   "use of address-of-label extension outside of a function body">;
 def err_expected_string_literal : Error<"expected string literal">;
 def err_asm_operand_wide_string_literal : Error<
-  "cannot use wide string literal in 'asm'">;
+  "cannot use %select{unicode|wide}0 string literal in 'asm'">;
 def err_expected_selector_for_method : Error<
   "expected selector for Objective-C method">;
 def err_expected_property_name : Error<"expected property name">;
@@ -229,6 +232,8 @@
 def warn_cxx98_compat_generalized_initializer_lists : Warning<
   "generalized initializer lists are incompatible with C++98">,
   InGroup<CXX98Compat>, DefaultIgnore;
+def err_init_list_bin_op : Error<"initializer list cannot be used on the "
+  "%select{left|right}0 hand side of operator '%1'">;
 def warn_cxx98_compat_trailing_return_type : Warning<
   "trailing return types are incompatible with C++98">,
   InGroup<CXX98Compat>, DefaultIgnore;
@@ -420,8 +425,11 @@
 def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">;
 
 // C++ operator overloading
-def err_operator_string_not_empty : Error<
+def err_literal_operator_string_not_empty : Error<
   "string literal after 'operator' must be '\"\"'">;
+def err_literal_operator_missing_space : Error<
+  "C++11 requires a space between the \"\" and the user-defined suffix in a "
+  "literal operator">;
 def warn_cxx98_compat_literal_operator : Warning<
   "literal operators are incompatible with C++98">,
   InGroup<CXX98Compat>, DefaultIgnore;

Modified: cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td Tue Mar  6 07:07:43 2012
@@ -132,7 +132,11 @@
 def warn_unused_exception_param : Warning<"unused exception parameter %0">,
   InGroup<UnusedExceptionParameter>, DefaultIgnore;
 def warn_decl_in_param_list : Warning<
-  "declaration of %0 will not be visible outside of this function">;
+  "declaration of %0 will not be visible outside of this function">,
+  InGroup<Visibility>;
+def warn_redefinition_in_param_list : Warning<
+  "redefinition of %0 will not be visible outside of this function">,
+  InGroup<Visibility>;
 def warn_empty_parens_are_function_decl : Warning<
   "empty parentheses interpreted as a function declaration">,
   InGroup<VexingParse>;
@@ -684,7 +688,7 @@
 // C++ declarations
 def err_static_assert_expression_is_not_constant : Error<
   "static_assert expression is not an integral constant expression">;
-def err_static_assert_failed : Error<"static_assert failed \"%0\"">;
+def err_static_assert_failed : Error<"static_assert failed %0">;
 
 def warn_inline_namespace_reopened_noninline : Warning<
   "inline namespace cannot be re-opened as a non-inline namespace">;
@@ -3426,6 +3430,12 @@
   "explicitly assigning a variable of type %0 to itself">,
   InGroup<SelfAssignment>, DefaultIgnore;
 
+def warn_string_plus_int : Warning<
+  "adding %0 to a string does not append to the string">,
+  InGroup<StringPlusInt>;
+def note_string_plus_int_silence : Note<
+  "use array indexing to silence this warning">;
+
 def warn_sizeof_array_param : Warning<
   "sizeof on array function parameter will return size of %0 instead of %1">,
   InGroup<SizeofArrayArgument>;
@@ -4197,7 +4207,8 @@
   "%select{|dereference with *|"
   "take the address with &|"
   "remove *|"
-  "remove &}3">;
+  "remove &}3">,
+  InGroup<IntConversions>;
 def ext_typecheck_convert_int_pointer : ExtWarn<
   "incompatible integer to pointer conversion "
   "%select{assigning to|passing|returning|converting|initializing|sending|casting}2"
@@ -4207,7 +4218,8 @@
   "%select{|dereference with *|"
   "take the address with &|"
   "remove *|"
-  "remove &}3">;
+  "remove &}3">,
+  InGroup<IntConversions>;
 def ext_typecheck_convert_pointer_void_func : Extension<
   "%select{assigning to|passing|returning|converting|initializing|sending|casting}2"
   " %0 "
@@ -4672,6 +4684,8 @@
 // FIXME: This diagnostic sucks
 def err_literal_operator_params : Error<
   "parameter declaration for literal operator %0 is not valid">;
+def err_literal_operator_extern_c : Error<
+  "literal operator must have C++ linkage">;
 def warn_user_literal_hexfloat : Warning<
   "user-defined literal with suffix '%0' is preempted by C99 hexfloat "
   "extension">, InGroup<UserDefinedLiterals>;
@@ -4939,6 +4953,9 @@
   " or pick a deployment target that supports them">;
 def err_block_returning_array_function : Error<
   "block cannot return %select{array|function}0 type %1">;
+def warn_block_missing_return_type : Warning<
+  "block literal is missing explicit return type and "
+  "returns non-void values">, InGroup<BlockMissingReturnType>, DefaultIgnore;
 
 // Builtin annotation string.
 def err_builtin_annotation_not_string_constant : Error<

Modified: cfe/branches/tooling/include/clang/Basic/IdentifierTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/IdentifierTable.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/IdentifierTable.h (original)
+++ cfe/branches/tooling/include/clang/Basic/IdentifierTable.h Tue Mar  6 07:07:43 2012
@@ -67,7 +67,7 @@
   bool OutOfDate              : 1; // True if there may be additional
                                    // information about this identifier
                                    // stored externally.
-  bool IsImport               : 1; // True if this is the 'import' contextual
+  bool IsModulesImport               : 1; // True if this is the 'import' contextual
                                    // keyword.
   // 1 bit left in 32-bit word.
   
@@ -283,12 +283,14 @@
       RecomputeNeedsHandleIdentifier();
   }
   
-  /// \brief Determine whether this is the contextual keyword 'import'.
-  bool isImport() const { return IsImport; }
-  
-  /// \brief Set whether this identifier is the contextual keyword 'import'.
-  void setImport(bool I) {
-    IsImport = I;
+  /// \brief Determine whether this is the contextual keyword
+  /// '__experimental_modules_import'.
+  bool isModulesImport() const { return IsModulesImport; }
+  
+  /// \brief Set whether this identifier is the contextual keyword 
+  /// '__experimental_modules_import'.
+  void setModulesImport(bool I) {
+    IsModulesImport = I;
     if (I)
       NeedsHandleIdentifier = true;
     else
@@ -307,7 +309,7 @@
     NeedsHandleIdentifier =
       (isPoisoned() | hasMacroDefinition() | isCPlusPlusOperatorKeyword() |
        isExtensionToken() | isCXX11CompatKeyword() || isOutOfDate() ||
-       isImport());
+       isModulesImport());
   }
 };
 
@@ -458,10 +460,6 @@
     // contents.
     II->Entry = &Entry;
 
-    // If this is the 'import' contextual keyword, mark it as such.
-    if (Name.equals("import"))
-      II->setImport(true);
-
     return *II;
   }
 
@@ -496,7 +494,7 @@
       
       // If this is the 'import' contextual keyword, mark it as such.
       if (Name.equals("import"))
-        II->setImport(true);
+        II->setModulesImport(true);
     }
 
     return *II;

Modified: cfe/branches/tooling/include/clang/Basic/LangOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/LangOptions.def?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/LangOptions.def (original)
+++ cfe/branches/tooling/include/clang/Basic/LangOptions.def Tue Mar  6 07:07:43 2012
@@ -125,6 +125,7 @@
 BENIGN_LANGOPT(DebuggerSupport , 1, 0, "debugger support")
 BENIGN_LANGOPT(DebuggerCastResultToId, 1, 0, "for 'po' in the debugger, cast the result to id if it is of unknown type")
 BENIGN_LANGOPT(AddressSanitizer , 1, 0, "AddressSanitizer enabled")
+BENIGN_LANGOPT(ThreadSanitizer , 1, 0, "ThreadSanitizer enabled")
 
 BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking")
 LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating point constants as single precision constants")

Modified: cfe/branches/tooling/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/LangOptions.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/LangOptions.h (original)
+++ cfe/branches/tooling/include/clang/Basic/LangOptions.h Tue Mar  6 07:07:43 2012
@@ -21,9 +21,27 @@
 
 namespace clang {
 
+/// Bitfields of LangOptions, split out from LangOptions in order to ensure that
+/// this large collection of bitfields is a trivial class type.
+class LangOptionsBase {
+public:
+  // Define simple language options (with no accessors).
+#define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits;
+#define ENUM_LANGOPT(Name, Type, Bits, Default, Description)
+#include "clang/Basic/LangOptions.def"
+
+protected:
+  // Define language options of enumeration type. These are private, and will
+  // have accessors (below).
+#define LANGOPT(Name, Bits, Default, Description)
+#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
+  unsigned Name : Bits;
+#include "clang/Basic/LangOptions.def"
+};
+
 /// LangOptions - This class keeps track of the various options that can be
 /// enabled, which controls the dialect of C that is accepted.
-class LangOptions : public RefCountedBase<LangOptions> {
+class LangOptions : public RefCountedBase<LangOptions>, public LangOptionsBase {
 public:
   typedef clang::Visibility Visibility;
   
@@ -36,19 +54,6 @@
     SOB_Trapping    // -ftrapv
   };
 
-  // Define simple language options (with no accessors).
-#define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits;
-#define ENUM_LANGOPT(Name, Type, Bits, Default, Description)
-#include "clang/Basic/LangOptions.def"
-  
-private:
-  // Define language options of enumeration type. These are private, and will
-  // have accessors (below).
-#define LANGOPT(Name, Bits, Default, Description) 
-#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
-  unsigned Name : Bits;
-#include "clang/Basic/LangOptions.def"
-  
 public:
   std::string ObjCConstantStringClass;
   

Modified: cfe/branches/tooling/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/TargetInfo.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/TargetInfo.h (original)
+++ cfe/branches/tooling/include/clang/Basic/TargetInfo.h Tue Mar  6 07:07:43 2012
@@ -587,7 +587,7 @@
   ///
   /// \return - False on error (invalid feature name).
   virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
-                                 const std::string &Name,
+                                 StringRef Name,
                                  bool Enabled) const {
     return false;
   }

Modified: cfe/branches/tooling/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/TokenKinds.def?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/TokenKinds.def (original)
+++ cfe/branches/tooling/include/clang/Basic/TokenKinds.def Tue Mar  6 07:07:43 2012
@@ -549,7 +549,7 @@
 OBJC2_AT_KEYWORD(optional)
 OBJC2_AT_KEYWORD(synthesize)
 OBJC2_AT_KEYWORD(dynamic)
-OBJC2_AT_KEYWORD(import)
+OBJC2_AT_KEYWORD(__experimental_modules_import)
 
 // TODO: What to do about context-sensitive keywords like:
 //       bycopy/byref/in/inout/oneway/out?

Modified: cfe/branches/tooling/include/clang/Basic/Version.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/Version.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/Version.h (original)
+++ cfe/branches/tooling/include/clang/Basic/Version.h Tue Mar  6 07:07:43 2012
@@ -47,10 +47,19 @@
   /// Clang was built.
   std::string getClangRepositoryPath();
 
+  /// \brief Retrieves the repository path from which LLVM was built. Supports
+  /// LLVM residing in a separate repository from clang.
+  std::string getLLVMRepositoryPath();
+
   /// \brief Retrieves the repository revision number (or identifer) from which
   ///  this Clang was built.
   std::string getClangRevision();
 
+  /// \brief Retrieves the repository revision number (or identifer) from which
+  /// LLVM was built. If Clang and LLVM are in the same repository, this returns
+  /// the same string as getClangRevision.
+  std::string getLLVMRevision();
+
   /// \brief Retrieves the full repository version that is an amalgamation of
   ///  the information in getClangRepositoryPath() and getClangRevision().
   std::string getClangFullRepositoryVersion();

Modified: cfe/branches/tooling/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Driver/CC1Options.td?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Driver/CC1Options.td (original)
+++ cfe/branches/tooling/include/clang/Driver/CC1Options.td Tue Mar  6 07:07:43 2012
@@ -81,7 +81,11 @@
 def analyzer_viz_egraph_ubigraph : Flag<"-analyzer-viz-egraph-ubigraph">,
   HelpText<"Display exploded graph using Ubigraph">;
 def analyzer_inline_call : Flag<"-analyzer-inline-call">,
-  HelpText<"Experimental transfer function inlining callees when its definition is available.">;
+  HelpText<"Experimental: Inline callees when their definitions are available">;
+def analyzer_inline_max_stack_depth : Separate<"-analyzer-inline-max-stack-depth">,
+  HelpText<"Bound on stack depth while inlining (4 by default)">;
+def analyzer_inline_max_function_size : Separate<"-analyzer-inline-max-function-size">,
+  HelpText<"Bound on the number of basic blocks in an inlined function (200 by default)">;
 def analyzer_max_nodes : Separate<"-analyzer-max-nodes">,
   HelpText<"The maximum number of nodes the analyzer can generate (150000 default, 0 = no limit)">;
 def analyzer_max_loop : Separate<"-analyzer-max-loop">,
@@ -127,6 +131,8 @@
   HelpText<"The string to embed in the Dwarf debug flags record.">;
 def faddress_sanitizer: Flag<"-faddress-sanitizer">,
   HelpText<"Enable AddressSanitizer instrumentation (memory error detection)">;
+def fthread_sanitizer: Flag<"-fthread-sanitizer">,
+  HelpText<"Enable ThreadSanitizer instrumentation (race detection)">;
 def fforbid_guard_variables : Flag<"-fforbid-guard-variables">,
   HelpText<"Emit an error if a C++ static local initializer would need a guard variable">;
 def g : Flag<"-g">, HelpText<"Generate source level debug information">;

Modified: cfe/branches/tooling/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Driver/Options.td?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Driver/Options.td (original)
+++ cfe/branches/tooling/include/clang/Driver/Options.td Tue Mar  6 07:07:43 2012
@@ -264,6 +264,8 @@
 def fapple_pragma_pack : Flag<"-fapple-pragma-pack">, Group<f_Group>;
 def faddress_sanitizer : Flag<"-faddress-sanitizer">, Group<f_Group>;
 def fno_address_sanitizer : Flag<"-fno-address-sanitizer">, Group<f_Group>;
+def fthread_sanitizer : Flag<"-fthread-sanitizer">, Group<f_Group>;
+def fno_thread_sanitizer : Flag<"-fno-thread-sanitizer">, Group<f_Group>;
 def fasm : Flag<"-fasm">, Group<f_Group>;
 
 def fasm_blocks : Flag<"-fasm-blocks">, Group<f_Group>;

Modified: cfe/branches/tooling/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Driver/ToolChain.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Driver/ToolChain.h (original)
+++ cfe/branches/tooling/include/clang/Driver/ToolChain.h Tue Mar  6 07:07:43 2012
@@ -184,6 +184,9 @@
   /// Does this tool chain support Objective-C garbage collection.
   virtual bool SupportsObjCGC() const { return true; }
 
+  /// Does this tool chain support Objective-C ARC.
+  virtual bool SupportsObjCARC() const { return true; }
+
   /// UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf
   /// compile unit information.
   virtual bool UseDwarfDebugFlags() const { return false; }

Modified: cfe/branches/tooling/include/clang/Frontend/AnalyzerOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/AnalyzerOptions.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/AnalyzerOptions.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/AnalyzerOptions.h Tue Mar  6 07:07:43 2012
@@ -85,6 +85,8 @@
   unsigned CFGAddInitializers : 1;
   unsigned EagerlyTrimEGraph : 1;
   unsigned PrintStats : 1;
+  unsigned InlineMaxStackDepth;
+  unsigned InlineMaxFunctionSize;
 
 public:
   AnalyzerOptions() {
@@ -100,12 +102,15 @@
     TrimGraph = 0;
     VisualizeEGDot = 0;
     VisualizeEGUbi = 0;
-    InlineCall = 0;
+    InlineCall = 1;
     UnoptimizedCFG = 0;
     CFGAddImplicitDtors = 0;
     CFGAddInitializers = 0;
     EagerlyTrimEGraph = 0;
     PrintStats = 0;
+    // Cap the stack depth at 4 calls (5 stack frames, base + 4 calls).
+    InlineMaxStackDepth = 5;
+    InlineMaxFunctionSize = 200;
   }
 };
 

Modified: cfe/branches/tooling/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/CompilerInstance.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/CompilerInstance.h Tue Mar  6 07:07:43 2012
@@ -572,6 +572,10 @@
   /// Create the default output file (from the invocation's options) and add it
   /// to the list of tracked output files.
   ///
+  /// The files created by this function always use temporary files to write to
+  /// their result (that is, the data is written to a temporary file which will
+  /// atomically replace the target output on success).
+  ///
   /// \return - Null on error.
   llvm::raw_fd_ostream *
   createDefaultOutputFile(bool Binary = true, StringRef BaseInput = "",
@@ -586,7 +590,8 @@
                    bool Binary = true, bool RemoveFileOnSignal = true,
                    StringRef BaseInput = "",
                    StringRef Extension = "",
-                   bool UseTemporary = false);
+                   bool UseTemporary = false,
+                   bool CreateMissingDirectories = false);
 
   /// Create a new output file, optionally deriving the output path name.
   ///
@@ -606,7 +611,9 @@
   /// llvm::sys::RemoveFileOnSignal. Note that this is not safe for
   /// multithreaded use, as the underlying signal mechanism is not reentrant
   /// \param UseTemporary - Create a new temporary file that must be renamed to
-  ///         OutputPath in the end
+  /// OutputPath in the end.
+  /// \param CreateMissingDirectories - When \arg UseTemporary is true, create
+  /// missing directories in the output path.
   /// \param ResultPathName [out] - If given, the result path name will be
   /// stored here on success.
   /// \param TempPathName [out] - If given, the temporary file path name
@@ -617,6 +624,7 @@
                    StringRef BaseInput = "",
                    StringRef Extension = "",
                    bool UseTemporary = false,
+                   bool CreateMissingDirectories = false,
                    std::string *ResultPathName = 0,
                    std::string *TempPathName = 0);
 

Modified: cfe/branches/tooling/include/clang/Frontend/MultiplexConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/MultiplexConsumer.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/MultiplexConsumer.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/MultiplexConsumer.h Tue Mar  6 07:07:43 2012
@@ -35,6 +35,7 @@
 
   // ASTConsumer
   virtual void Initialize(ASTContext &Context);
+  virtual void MarkVarRequired(VarDecl *VD);
   virtual bool HandleTopLevelDecl(DeclGroupRef D);
   virtual void HandleInterestingDecl(DeclGroupRef D);
   virtual void HandleTranslationUnit(ASTContext &Ctx);

Modified: cfe/branches/tooling/include/clang/Frontend/PreprocessorOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/PreprocessorOptions.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/PreprocessorOptions.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/PreprocessorOptions.h Tue Mar  6 07:07:43 2012
@@ -49,6 +49,10 @@
   unsigned DetailedRecord : 1; /// Whether we should maintain a detailed
                                /// record of all macro definitions and
                                /// expansions.
+  unsigned DetailedRecordConditionalDirectives : 1; /// Whether in the
+                               /// preprocessing record we should also keep
+                               /// track of locations of conditional directives
+                               /// in non-system files.
   
   /// The implicit PCH included at the start of the translation unit, or empty.
   std::string ImplicitPCHInclude;
@@ -158,6 +162,7 @@
   
 public:
   PreprocessorOptions() : UsePredefines(true), DetailedRecord(false),
+                          DetailedRecordConditionalDirectives(false),
                           DisablePCHValidation(false), DisableStatCache(false),
                           DumpDeserializedPCHDecls(false),
                           PrecompiledPreambleBytes(0, true),

Removed: cfe/branches/tooling/include/clang/Index/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Index/CallGraph.h?rev=152117&view=auto
==============================================================================
--- cfe/branches/tooling/include/clang/Index/CallGraph.h (original)
+++ cfe/branches/tooling/include/clang/Index/CallGraph.h (removed)
@@ -1,146 +0,0 @@
-//== CallGraph.cpp - Call graph building ------------------------*- C++ -*--==//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  This file defined the CallGraph and CallGraphNode classes.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_CALLGRAPH
-#define LLVM_CLANG_ANALYSIS_CALLGRAPH
-
-#include "clang/Index/ASTLocation.h"
-#include "clang/Index/Entity.h"
-#include "clang/Index/Program.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/GraphTraits.h"
-#include "llvm/ADT/STLExtras.h"
-#include <vector>
-#include <map>
-
-namespace clang {
-
-class CallGraphNode {
-  idx::Entity F;
-  typedef std::pair<idx::ASTLocation, CallGraphNode*> CallRecord;
-  std::vector<CallRecord> CalledFunctions;
-
-public:
-  CallGraphNode(idx::Entity f) : F(f) {}
-
-  typedef std::vector<CallRecord>::iterator iterator;
-  typedef std::vector<CallRecord>::const_iterator const_iterator;
-
-  iterator begin() { return CalledFunctions.begin(); }
-  iterator end()   { return CalledFunctions.end(); }
-  const_iterator begin() const { return CalledFunctions.begin(); }
-  const_iterator end()   const { return CalledFunctions.end();   }
-
-  void addCallee(idx::ASTLocation L, CallGraphNode *Node) {
-    CalledFunctions.push_back(std::make_pair(L, Node));
-  }
-
-  bool hasCallee() const { return begin() != end(); }
-
-  std::string getName() const { return F.getPrintableName(); }
-
-  Decl *getDecl(ASTContext &Ctx) const { return F.getDecl(Ctx); }
-};
-
-class CallGraph {
-  /// Program manages all Entities.
-  idx::Program &Prog;
-
-  typedef std::map<idx::Entity, CallGraphNode *> FunctionMapTy;
-
-  /// FunctionMap owns all CallGraphNodes.
-  FunctionMapTy FunctionMap;
-
-  /// CallerCtx maps a caller to its ASTContext.
-  llvm::DenseMap<CallGraphNode *, ASTContext *> CallerCtx;
-
-  /// Root node is the 'main' function or 0.
-  CallGraphNode *Root;
-
-  /// ExternalCallingNode has edges to all external functions.
-  CallGraphNode *ExternalCallingNode;
-
-public:
-  CallGraph(idx::Program &P);
-  ~CallGraph();
-
-  typedef FunctionMapTy::iterator iterator;
-  typedef FunctionMapTy::const_iterator const_iterator;
-
-  iterator begin() { return FunctionMap.begin(); }
-  iterator end()   { return FunctionMap.end();   }
-  const_iterator begin() const { return FunctionMap.begin(); }
-  const_iterator end()   const { return FunctionMap.end();   }
-
-  CallGraphNode *getRoot() { return Root; }
-
-  CallGraphNode *getExternalCallingNode() { return ExternalCallingNode; }
-
-  void addTU(ASTContext &AST);
-
-  idx::Program &getProgram() { return Prog; }
-
-  CallGraphNode *getOrInsertFunction(idx::Entity F);
-
-  Decl *getDecl(CallGraphNode *Node);
-
-  void print(raw_ostream &os);
-  void dump();
-
-  void ViewCallGraph() const;
-};
-
-} // end clang namespace
-
-namespace llvm {
-
-template <> struct GraphTraits<clang::CallGraph> {
-  typedef clang::CallGraph GraphType;
-  typedef clang::CallGraphNode NodeType;
-
-  typedef std::pair<clang::idx::ASTLocation, NodeType*> CGNPairTy;
-  typedef std::pointer_to_unary_function<CGNPairTy, NodeType*> CGNDerefFun;
-
-  typedef mapped_iterator<NodeType::iterator, CGNDerefFun> ChildIteratorType;
-
-  static NodeType *getEntryNode(GraphType *CG) {
-    return CG->getExternalCallingNode();
-  }
-
-  static ChildIteratorType child_begin(NodeType *N) {
-    return map_iterator(N->begin(), CGNDerefFun(CGNDeref));
-  }
-  static ChildIteratorType child_end(NodeType *N) {
-    return map_iterator(N->end(), CGNDerefFun(CGNDeref));
-  }
-
-  typedef std::pair<clang::idx::Entity, NodeType*> PairTy;
-  typedef std::pointer_to_unary_function<PairTy, NodeType*> DerefFun;
-
-  typedef mapped_iterator<GraphType::const_iterator, DerefFun> nodes_iterator;
-
-  static nodes_iterator nodes_begin(const GraphType &CG) {
-    return map_iterator(CG.begin(), DerefFun(CGDeref));
-  }
-  static nodes_iterator nodes_end(const GraphType &CG) {
-    return map_iterator(CG.end(), DerefFun(CGDeref));
-  }
-
-  static NodeType *CGNDeref(CGNPairTy P) { return P.second; }
-
-  static NodeType *CGDeref(PairTy P) { return P.second; }
-};
-
-} // end llvm namespace
-
-#endif

Modified: cfe/branches/tooling/include/clang/Lex/HeaderSearch.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Lex/HeaderSearch.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Lex/HeaderSearch.h (original)
+++ cfe/branches/tooling/include/clang/Lex/HeaderSearch.h Tue Mar  6 07:07:43 2012
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/ADT/OwningPtr.h"
 #include <vector>
 
 namespace clang {
@@ -154,6 +155,13 @@
   llvm::StringMap<const DirectoryEntry *, llvm::BumpPtrAllocator>
     FrameworkMap;
 
+  /// IncludeAliases - maps include file names (including the quotes or
+  /// angle brackets) to other include file names.  This is used to support the
+  /// include_alias pragma for Microsoft compatibility.
+  typedef llvm::StringMap<std::string, llvm::BumpPtrAllocator>
+    IncludeAliasMap;
+  OwningPtr<IncludeAliasMap> IncludeAliases;
+
   /// HeaderMaps - This is a mapping from FileEntry -> HeaderMap, uniquing
   /// headermaps.  This vector owns the headermap.
   std::vector<std::pair<const FileEntry*, const HeaderMap*> > HeaderMaps;
@@ -217,6 +225,34 @@
     SystemDirIdx++;
   }
 
+  /// HasIncludeAliasMap - Checks whether the map exists or not
+  bool HasIncludeAliasMap() const {
+    return IncludeAliases;
+  }
+
+  /// AddIncludeAlias - Map the source include name to the dest include name.
+  /// The Source should include the angle brackets or quotes, the dest 
+  /// should not.  This allows for distinction between <> and "" headers.
+  void AddIncludeAlias(StringRef Source, StringRef Dest) {
+    if (!IncludeAliases)
+      IncludeAliases.reset(new IncludeAliasMap);
+    (*IncludeAliases)[Source] = Dest;
+  }
+
+  /// MapHeaderToIncludeAlias - Maps one header file name to a different header
+  /// file name, for use with the include_alias pragma.  Note that the source
+  /// file name should include the angle brackets or quotes.  Returns StringRef
+  /// as null if the header cannot be mapped.
+  StringRef MapHeaderToIncludeAlias(StringRef Source) {
+    assert(IncludeAliases && "Trying to map headers when there's no map");
+
+    // Do any filename replacements before anything else
+    IncludeAliasMap::const_iterator Iter = IncludeAliases->find(Source);
+    if (Iter != IncludeAliases->end())
+      return Iter->second;
+    return StringRef();
+  }
+
   /// \brief Set the path to the module cache.
   void setModuleCachePath(StringRef CachePath) {
     ModuleCachePath = CachePath;

Modified: cfe/branches/tooling/include/clang/Lex/Lexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Lex/Lexer.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Lex/Lexer.h (original)
+++ cfe/branches/tooling/include/clang/Lex/Lexer.h Tue Mar  6 07:07:43 2012
@@ -530,6 +530,8 @@
   // Other lexer functions.
 
   void SkipBytes(unsigned Bytes, bool StartOfLine);
+
+  const char *LexUDSuffix(Token &Result, const char *CurPtr);
   
   // Helper functions to lex the remainder of a token of the specific type.
   void LexIdentifier         (Token &Result, const char *CurPtr);

Modified: cfe/branches/tooling/include/clang/Lex/LiteralSupport.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Lex/LiteralSupport.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Lex/LiteralSupport.h (original)
+++ cfe/branches/tooling/include/clang/Lex/LiteralSupport.h Tue Mar  6 07:07:43 2012
@@ -128,6 +128,7 @@
   tok::TokenKind Kind;
   bool IsMultiChar;
   bool HadError;
+  SmallString<32> UDSuffixBuf;
 public:
   CharLiteralParser(const char *begin, const char *end,
                     SourceLocation Loc, Preprocessor &PP,
@@ -140,6 +141,7 @@
   bool isUTF32() const { return Kind == tok::utf32_char_constant; }
   bool isMultiChar() const { return IsMultiChar; }
   uint64_t getValue() const { return Value; }
+  StringRef getUDSuffix() const { return UDSuffixBuf; }
 };
 
 /// StringLiteralParser - This decodes string escape characters and performs
@@ -157,6 +159,7 @@
   tok::TokenKind Kind;
   SmallString<512> ResultBuf;
   char *ResultPtr; // cursor
+  SmallString<32> UDSuffixBuf;
 public:
   StringLiteralParser(const Token *StringToks, unsigned NumStringToks,
                       Preprocessor &PP, bool Complain = true);
@@ -196,6 +199,8 @@
   bool isUTF32() const { return Kind == tok::utf32_string_literal; }
   bool isPascal() const { return Pascal; }
 
+  StringRef getUDSuffix() const { return UDSuffixBuf; }
+
 private:
   void init(const Token *StringToks, unsigned NumStringToks);
   bool CopyStringFragment(StringRef Fragment);

Modified: cfe/branches/tooling/include/clang/Lex/PPCallbacks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Lex/PPCallbacks.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Lex/PPCallbacks.h (original)
+++ cfe/branches/tooling/include/clang/Lex/PPCallbacks.h Tue Mar  6 07:07:43 2012
@@ -190,35 +190,43 @@
   }
 
   /// If -- This hook is called whenever an #if is seen.
-  /// \param Range The SourceRange of the expression being tested.
+  /// \param Loc the source location of the directive.
+  /// \param ConditionRange The SourceRange of the expression being tested.
   // FIXME: better to pass in a list (or tree!) of Tokens.
-  virtual void If(SourceRange Range) {
+  virtual void If(SourceLocation Loc, SourceRange ConditionRange) {
   }
 
   /// Elif -- This hook is called whenever an #elif is seen.
-  /// \param Range The SourceRange of the expression being tested.
+  /// \param Loc the source location of the directive.
+  /// \param ConditionRange The SourceRange of the expression being tested.
+  /// \param IfLoc the source location of the #if/#ifdef/#ifndef directive.
   // FIXME: better to pass in a list (or tree!) of Tokens.
-  virtual void Elif(SourceRange Range) {
+  virtual void Elif(SourceLocation Loc, SourceRange ConditionRange,
+                    SourceLocation IfLoc) {
   }
 
   /// Ifdef -- This hook is called whenever an #ifdef is seen.
-  /// \param Loc The location of the token being tested.
+  /// \param Loc the source location of the directive.
   /// \param II Information on the token being tested.
-  virtual void Ifdef(const Token &MacroNameTok) {
+  virtual void Ifdef(SourceLocation Loc, const Token &MacroNameTok) {
   }
 
   /// Ifndef -- This hook is called whenever an #ifndef is seen.
-  /// \param Loc The location of the token being tested.
+  /// \param Loc the source location of the directive.
   /// \param II Information on the token being tested.
-  virtual void Ifndef(const Token &MacroNameTok) {
+  virtual void Ifndef(SourceLocation Loc, const Token &MacroNameTok) {
   }
 
   /// Else -- This hook is called whenever an #else is seen.
-  virtual void Else() {
+  /// \param Loc the source location of the directive.
+  /// \param IfLoc the source location of the #if/#ifdef/#ifndef directive.
+  virtual void Else(SourceLocation Loc, SourceLocation IfLoc) {
   }
 
   /// Endif -- This hook is called whenever an #endif is seen.
-  virtual void Endif() {
+  /// \param Loc the source location of the directive.
+  /// \param IfLoc the source location of the #if/#ifdef/#ifndef directive.
+  virtual void Endif(SourceLocation Loc, SourceLocation IfLoc) {
   }
 };
 
@@ -335,39 +343,40 @@
   }
 
   /// If -- This hook is called whenever an #if is seen.
-  virtual void If(SourceRange Range) {
-    First->If(Range);
-    Second->If(Range);
+  virtual void If(SourceLocation Loc, SourceRange ConditionRange) {
+    First->If(Loc, ConditionRange);
+    Second->If(Loc, ConditionRange);
   }
 
   /// Elif -- This hook is called whenever an #if is seen.
-  virtual void Elif(SourceRange Range) {
-    First->Elif(Range);
-    Second->Elif(Range);
+  virtual void Elif(SourceLocation Loc, SourceRange ConditionRange,
+                    SourceLocation IfLoc) {
+    First->Elif(Loc, ConditionRange, IfLoc);
+    Second->Elif(Loc, ConditionRange, IfLoc);
   }
 
   /// Ifdef -- This hook is called whenever an #ifdef is seen.
-  virtual void Ifdef(const Token &MacroNameTok) {
-    First->Ifdef(MacroNameTok);
-    Second->Ifdef(MacroNameTok);
+  virtual void Ifdef(SourceLocation Loc, const Token &MacroNameTok) {
+    First->Ifdef(Loc, MacroNameTok);
+    Second->Ifdef(Loc, MacroNameTok);
   }
 
   /// Ifndef -- This hook is called whenever an #ifndef is seen.
-  virtual void Ifndef(const Token &MacroNameTok) {
-    First->Ifndef(MacroNameTok);
-    Second->Ifndef(MacroNameTok);
+  virtual void Ifndef(SourceLocation Loc, const Token &MacroNameTok) {
+    First->Ifndef(Loc, MacroNameTok);
+    Second->Ifndef(Loc, MacroNameTok);
   }
 
   /// Else -- This hook is called whenever an #else is seen.
-  virtual void Else() {
-    First->Else();
-    Second->Else();
+  virtual void Else(SourceLocation Loc, SourceLocation IfLoc) {
+    First->Else(Loc, IfLoc);
+    Second->Else(Loc, IfLoc);
   }
 
   /// Endif -- This hook is called whenever an #endif is seen.
-  virtual void Endif() {
-    First->Endif();
-    Second->Endif();
+  virtual void Endif(SourceLocation Loc, SourceLocation IfLoc) {
+    First->Endif(Loc, IfLoc);
+    Second->Endif(Loc, IfLoc);
   }
 };
 

Modified: cfe/branches/tooling/include/clang/Lex/PreprocessingRecord.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Lex/PreprocessingRecord.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Lex/PreprocessingRecord.h (original)
+++ cfe/branches/tooling/include/clang/Lex/PreprocessingRecord.h Tue Mar  6 07:07:43 2012
@@ -17,6 +17,7 @@
 #include "clang/Lex/PPCallbacks.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/IdentifierTable.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/Allocator.h"
@@ -299,6 +300,44 @@
     /// and are referenced by the iterator using negative indices.
     std::vector<PreprocessedEntity *> LoadedPreprocessedEntities;
 
+    bool RecordCondDirectives;
+    unsigned CondDirectiveNextIdx;
+    SmallVector<unsigned, 6> CondDirectiveStack; 
+
+    class CondDirectiveLoc {
+      SourceLocation Loc;
+      unsigned Idx;
+
+    public:
+      CondDirectiveLoc(SourceLocation Loc, unsigned Idx) : Loc(Loc), Idx(Idx) {}
+
+      SourceLocation getLoc() const { return Loc; }
+      unsigned getIdx() const { return Idx; }
+
+      class Comp {
+        SourceManager &SM;
+      public:
+        explicit Comp(SourceManager &SM) : SM(SM) {}
+        bool operator()(const CondDirectiveLoc &LHS,
+                        const CondDirectiveLoc &RHS) {
+          return SM.isBeforeInTranslationUnit(LHS.getLoc(), RHS.getLoc());
+        }
+        bool operator()(const CondDirectiveLoc &LHS, SourceLocation RHS) {
+          return SM.isBeforeInTranslationUnit(LHS.getLoc(), RHS);
+        }
+        bool operator()(SourceLocation LHS, const CondDirectiveLoc &RHS) {
+          return SM.isBeforeInTranslationUnit(LHS, RHS.getLoc());
+        }
+      };
+    };
+
+    typedef std::vector<CondDirectiveLoc> CondDirectiveLocsTy; 
+    /// \brief The locations of conditional directives in source order.
+    CondDirectiveLocsTy CondDirectiveLocs;
+
+    void addCondDirectiveLoc(CondDirectiveLoc DirLoc);
+    unsigned findCondDirectiveIdx(SourceLocation Loc) const;
+
     /// \brief Global (loaded or local) ID for a preprocessed entity.
     /// Negative values are used to indicate preprocessed entities
     /// loaded from the external source while non-negative values are used to
@@ -349,7 +388,7 @@
     
   public:
     /// \brief Construct a new preprocessing record.
-    explicit PreprocessingRecord(SourceManager &SM);
+    PreprocessingRecord(SourceManager &SM, bool RecordConditionalDirectives);
     
     /// \brief Allocate memory in the preprocessing record.
     void *Allocate(unsigned Size, unsigned Align = 8) {
@@ -517,7 +556,25 @@
 
     /// \brief Add a new preprocessed entity to this record.
     void addPreprocessedEntity(PreprocessedEntity *Entity);
-    
+
+    /// \brief Returns true if this PreprocessingRecord is keeping track of
+    /// conditional directives locations.
+    bool isRecordingConditionalDirectives() const {
+      return RecordCondDirectives;
+    }
+
+    /// \brief Returns true if the given range intersects with a conditional
+    /// directive. if a #if/#endif block is fully contained within the range,
+    /// this function will return false.
+    bool rangeIntersectsConditionalDirective(SourceRange Range) const;
+
+    /// \brief Returns true if the given locations are in different regions,
+    /// separated by conditional directive blocks.
+    bool areInDifferentConditionalDirectiveRegion(SourceLocation LHS,
+                                                  SourceLocation RHS) const {
+      return findCondDirectiveIdx(LHS) != findCondDirectiveIdx(RHS);
+    }
+
     /// \brief Set the external source for preprocessed entities.
     void SetExternalSource(ExternalPreprocessingRecordSource &Source);
 
@@ -530,6 +587,7 @@
     /// \c MacroInfo.
     MacroDefinition *findMacroDefinition(const MacroInfo *MI);
         
+  private:
     virtual void MacroExpands(const Token &Id, const MacroInfo* MI,
                               SourceRange Range);
     virtual void MacroDefined(const Token &Id, const MacroInfo *MI);
@@ -542,8 +600,14 @@
                                     SourceLocation EndLoc,
                                     StringRef SearchPath,
                                     StringRef RelativePath);
+    virtual void If(SourceLocation Loc, SourceRange ConditionRange);
+    virtual void Elif(SourceLocation Loc, SourceRange ConditionRange,
+                      SourceLocation IfLoc);
+    virtual void Ifdef(SourceLocation Loc, const Token &MacroNameTok);
+    virtual void Ifndef(SourceLocation Loc, const Token &MacroNameTok);
+    virtual void Else(SourceLocation Loc, SourceLocation IfLoc);
+    virtual void Endif(SourceLocation Loc, SourceLocation IfLoc);
 
-  private:
     /// \brief Cached result of the last \see getPreprocessedEntitiesInRange
     /// query.
     struct {

Modified: cfe/branches/tooling/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Lex/Preprocessor.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Lex/Preprocessor.h (original)
+++ cfe/branches/tooling/include/clang/Lex/Preprocessor.h Tue Mar  6 07:07:43 2012
@@ -512,7 +512,7 @@
 
   /// \brief Create a new preprocessing record, which will keep track of
   /// all macro expansions, macro definitions, etc.
-  void createPreprocessingRecord();
+  void createPreprocessingRecord(bool RecordConditionalDirectives);
 
   /// EnterMainSourceFile - Enter the specified FileID as the main source file,
   /// which implicitly adds the builtin defines etc.
@@ -815,8 +815,8 @@
   /// SmallVector. Note that the returned StringRef may not point to the
   /// supplied buffer if a copy can be avoided.
   StringRef getSpelling(const Token &Tok,
-                              SmallVectorImpl<char> &Buffer,
-                              bool *Invalid = 0) const;
+                        SmallVectorImpl<char> &Buffer,
+                        bool *Invalid = 0) const;
 
   /// getSpellingOfSingleCharacterNumericConstant - Tok is a numeric constant
   /// with length 1, return the character.
@@ -1262,6 +1262,7 @@
   void HandlePragmaMessage(Token &MessageTok);
   void HandlePragmaPushMacro(Token &Tok);
   void HandlePragmaPopMacro(Token &Tok);
+  void HandlePragmaIncludeAlias(Token &Tok);
   IdentifierInfo *ParsePragmaPushOrPopMacro(Token &Tok);
 
   // Return true and store the first token only if any CommentHandler

Modified: cfe/branches/tooling/include/clang/Lex/Token.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Lex/Token.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Lex/Token.h (original)
+++ cfe/branches/tooling/include/clang/Lex/Token.h Tue Mar  6 07:07:43 2012
@@ -75,7 +75,8 @@
     LeadingSpace  = 0x02,  // Whitespace exists before this token.
     DisableExpand = 0x04,  // This identifier may never be macro expanded.
     NeedsCleaning = 0x08,   // Contained an escaped newline or trigraph.
-    LeadingEmptyMacro = 0x10 // Empty macro exists before this token.
+    LeadingEmptyMacro = 0x10, // Empty macro exists before this token.
+    HasUDSuffix = 0x20     // This string or character literal has a ud-suffix.
   };
 
   tok::TokenKind getKind() const { return (tok::TokenKind)Kind; }
@@ -263,6 +264,9 @@
     return (Flags & LeadingEmptyMacro) ? true : false;
   }
 
+  /// \brief Return true if this token is a string or character literal which
+  /// has a ud-suffix.
+  bool hasUDSuffix() const { return (Flags & HasUDSuffix) ? true : false; }
 };
 
 /// PPConditionalInfo - Information about the conditional stack (#if directives)

Modified: cfe/branches/tooling/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Parse/Parser.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Parse/Parser.h (original)
+++ cfe/branches/tooling/include/clang/Parse/Parser.h Tue Mar  6 07:07:43 2012
@@ -796,15 +796,15 @@
     CachedTokens Toks;
     IdentifierInfo &AttrName;
     SourceLocation AttrNameLoc;
-    Decl *D;
+    SmallVector<Decl*, 2> Decls;
 
     explicit LateParsedAttribute(Parser *P, IdentifierInfo &Name,
                                  SourceLocation Loc)
-      : Self(P), AttrName(Name), AttrNameLoc(Loc), D(0)  {}
+      : Self(P), AttrName(Name), AttrNameLoc(Loc) {}
 
     virtual void ParseLexedAttributes();
 
-    void setDecl(Decl *Dec) { D = Dec; }
+    void addDecl(Decl *D) { Decls.push_back(D); }
   };
 
   /// A list of late parsed attributes.  Used by ParseGNUAttributes.
@@ -1359,7 +1359,7 @@
                                                   SourceLocation LParenLoc,
                                                   SourceLocation RParenLoc);
 
-  ExprResult ParseStringLiteralExpression();
+  ExprResult ParseStringLiteralExpression(bool AllowUserDefinedLiteral = false);
 
   ExprResult ParseGenericSelectionExpression();
 
@@ -1670,7 +1670,8 @@
   void ParseDeclarationSpecifiers(DeclSpec &DS,
                 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
                                   AccessSpecifier AS = AS_none,
-                                  DeclSpecContext DSC = DSC_normal);
+                                  DeclSpecContext DSC = DSC_normal,
+                                  LateParsedAttrList *LateAttrs = 0);
   bool ParseOptionalTypeSpecifier(DeclSpec &DS, bool &isInvalid,
                                   const char *&PrevSpec,
                                   unsigned &DiagID,

Modified: cfe/branches/tooling/include/clang/Sema/DelayedDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Sema/DelayedDiagnostic.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/DelayedDiagnostic.h (original)
+++ cfe/branches/tooling/include/clang/Sema/DelayedDiagnostic.h Tue Mar  6 07:07:43 2012
@@ -122,8 +122,9 @@
   void Destroy();
 
   static DelayedDiagnostic makeDeprecation(SourceLocation Loc,
-                                           const NamedDecl *D,
-                                           StringRef Msg);
+           const NamedDecl *D,
+           const ObjCInterfaceDecl *UnknownObjCClass,
+           StringRef Msg);
 
   static DelayedDiagnostic makeAccess(SourceLocation Loc,
                                       const AccessedEntity &Entity) {
@@ -187,12 +188,17 @@
     assert(Kind == ForbiddenType && "not a forbidden-type diagnostic");
     return QualType::getFromOpaquePtr(ForbiddenTypeData.OperandType);
   }
+  
+  const ObjCInterfaceDecl *getUnknownObjCClass() const {
+    return DeprecationData.UnknownObjCClass;
+  }
 
 private:
   union {
     /// Deprecation.
     struct {
       const NamedDecl *Decl;
+      const ObjCInterfaceDecl *UnknownObjCClass;
       const char *Message;
       size_t MessageLen;
     } DeprecationData;

Modified: cfe/branches/tooling/include/clang/Sema/Scope.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Sema/Scope.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/Scope.h (original)
+++ cfe/branches/tooling/include/clang/Sema/Scope.h Tue Mar  6 07:07:43 2012
@@ -297,6 +297,10 @@
   /// \brief Determine whether this scope is a C++ 'try' block.
   bool isTryScope() const { return getFlags() & Scope::TryScope; }
 
+  /// containedInPrototypeScope - Return true if this or a parent scope
+  /// is a FunctionPrototypeScope.
+  bool containedInPrototypeScope() const;
+
   typedef UsingDirectivesTy::iterator udir_iterator;
   typedef UsingDirectivesTy::const_iterator const_udir_iterator;
 

Modified: cfe/branches/tooling/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Sema/Sema.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/Sema.h (original)
+++ cfe/branches/tooling/include/clang/Sema/Sema.h Tue Mar  6 07:07:43 2012
@@ -902,6 +902,17 @@
   // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
   //
 
+  /// List of decls defined in a function prototype. This contains EnumConstants
+  /// that incorrectly end up in translation unit scope because there is no
+  /// function to pin them on. ActOnFunctionDeclarator reads this list and patches
+  /// them into the FunctionDecl.
+  std::vector<NamedDecl*> DeclsInPrototypeScope;
+  /// Nonzero if we are currently parsing a function declarator. This is a counter
+  /// as opposed to a boolean so we can deal with nested function declarators
+  /// such as:
+  ///     void f(void (*g)(), ...)
+  unsigned InFunctionDeclarator;
+
   DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = 0);
 
   void DiagnoseUseOfUnimplementedSelectors();
@@ -1048,6 +1059,8 @@
   // Returns true if the variable declaration is a redeclaration
   bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous);
   void CheckCompleteVariableDeclaration(VarDecl *var);
+  void ActOnStartFunctionDeclarator();
+  void ActOnEndFunctionDeclarator();
   NamedDecl* ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
                                      TypeSourceInfo *TInfo,
                                      LookupResult &Previous,
@@ -1944,6 +1957,7 @@
   ////  class extensions.
   Decl *HandlePropertyInClassExtension(Scope *S,
                                        SourceLocation AtLoc,
+                                       SourceLocation LParenLoc,
                                        FieldDeclarator &FD,
                                        Selector GetterSel,
                                        Selector SetterSel,
@@ -1960,6 +1974,7 @@
   ObjCPropertyDecl *CreatePropertyDecl(Scope *S,
                                        ObjCContainerDecl *CDecl,
                                        SourceLocation AtLoc,
+                                       SourceLocation LParenLoc,
                                        FieldDeclarator &FD,
                                        Selector GetterSel,
                                        Selector SetterSel,
@@ -2341,6 +2356,8 @@
   ExprResult TranformToPotentiallyEvaluated(Expr *E);
   ExprResult HandleExprEvaluationContextForTypeof(Expr *E);
 
+  ExprResult ActOnConstantExpression(ExprResult Res);
+
   // Functions for marking a declaration referenced.  These functions also
   // contain the relevant logic for marking if a reference to a function or
   // variable is an odr-use (in the C++11 sense).  There are separate variants
@@ -3637,7 +3654,12 @@
   /// block pointer conversion.
   void DefineImplicitLambdaToBlockPointerConversion(SourceLocation CurrentLoc,
                                                     CXXConversionDecl *Conv);
-  
+
+  ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation,
+                                           SourceLocation ConvLocation,
+                                           CXXConversionDecl *Conv,
+                                           Expr *Src);
+
   // ParseObjCStringLiteral - Parse Objective-C string literals.
   ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
                                     Expr **Strings,
@@ -3647,7 +3669,7 @@
                                   TypeSourceInfo *EncodedTypeInfo,
                                   SourceLocation RParenLoc);
   ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl,
-                                    CXXMethodDecl *Method,
+                                    CXXConversionDecl *Method,
                                     bool HadMultipleCandidates);
 
   ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc,
@@ -5549,6 +5571,7 @@
                    DeclGroupPtrTy *allTUVars = 0, unsigned tuvNum = 0);
 
   Decl *ActOnProperty(Scope *S, SourceLocation AtLoc,
+                      SourceLocation LParenLoc,
                       FieldDeclarator &FD, ObjCDeclSpec &ODS,
                       Selector GetterSel, Selector SetterSel,
                       bool *OverridingProperty,
@@ -6074,7 +6097,7 @@
     ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
     bool IsCompAssign = false);
   QualType CheckAdditionOperands( // C99 6.5.6
-    ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
+    ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, unsigned Opc,
     QualType* CompLHSTy = 0);
   QualType CheckSubtractionOperands( // C99 6.5.6
     ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,

Modified: cfe/branches/tooling/include/clang/Serialization/ASTWriter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Serialization/ASTWriter.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Serialization/ASTWriter.h (original)
+++ cfe/branches/tooling/include/clang/Serialization/ASTWriter.h Tue Mar  6 07:07:43 2012
@@ -207,6 +207,18 @@
   /// IdentifierInfo.
   llvm::DenseMap<const IdentifierInfo *, serialization::IdentID> IdentifierIDs;
 
+  /// @name FlushStmt Caches
+  /// @{
+
+  /// \brief Set of parent Stmts for the currently serializing sub stmt.
+  llvm::DenseSet<Stmt *> ParentStmts;
+
+  /// \brief Offsets of sub stmts already serialized. The offset points
+  /// just after the stmt record.
+  llvm::DenseMap<Stmt *, uint64_t> SubStmtEntries;
+
+  /// @}
+
   /// \brief Offsets of each of the identifier IDs into the identifier
   /// table.
   std::vector<uint32_t> IdentifierOffsets;
@@ -697,7 +709,7 @@
   raw_ostream *Out;
   Sema *SemaPtr;
   MemorizeStatCalls *StatCalls; // owned by the FileManager
-  std::vector<unsigned char> Buffer;
+  llvm::SmallVector<char, 128> Buffer;
   llvm::BitstreamWriter Stream;
   ASTWriter Writer;
 

Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Tue Mar  6 07:07:43 2012
@@ -387,6 +387,7 @@
   const Decl *Callee;
 public:
   PathDiagnosticLocation callEnter;
+  PathDiagnosticLocation callEnterWithin;
   PathDiagnosticLocation callReturn;  
   PathPieces path;
   
@@ -402,6 +403,8 @@
   }
   
   IntrusiveRefCntPtr<PathDiagnosticEventPiece> getCallEnterEvent() const;
+  IntrusiveRefCntPtr<PathDiagnosticEventPiece>
+    getCallEnterWithinCallerEvent() const;
   IntrusiveRefCntPtr<PathDiagnosticEventPiece> getCallExitEvent() const;
 
   virtual void flattenLocations() {

Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h Tue Mar  6 07:07:43 2012
@@ -53,29 +53,40 @@
 
   enum AnalysisScope { ScopeTU, ScopeDecl } AScope;
 
-  // The maximum number of exploded nodes the analyzer will generate.
+  /// \brief The maximum number of exploded nodes the analyzer will generate.
   unsigned MaxNodes;
 
-  // The maximum number of times the analyzer visit a block.
+  /// \brief The maximum number of times the analyzer visits a block.
   unsigned MaxVisit;
 
   bool VisualizeEGDot;
   bool VisualizeEGUbi;
   AnalysisPurgeMode PurgeDead;
 
-  /// EargerlyAssume - A flag indicating how the engine should handle
-  //   expressions such as: 'x = (y != 0)'.  When this flag is true then
-  //   the subexpression 'y != 0' will be eagerly assumed to be true or false,
-  //   thus evaluating it to the integers 0 or 1 respectively.  The upside
-  //   is that this can increase analysis precision until we have a better way
-  //   to lazily evaluate such logic.  The downside is that it eagerly
-  //   bifurcates paths.
+  /// \brief The flag regulates if we should eagerly assume evaluations of
+  /// conditionals, thus, bifurcating the path.
+  ///
+  /// EagerlyAssume - A flag indicating how the engine should handle
+  ///   expressions such as: 'x = (y != 0)'.  When this flag is true then
+  ///   the subexpression 'y != 0' will be eagerly assumed to be true or false,
+  ///   thus evaluating it to the integers 0 or 1 respectively.  The upside
+  ///   is that this can increase analysis precision until we have a better way
+  ///   to lazily evaluate such logic.  The downside is that it eagerly
+  ///   bifurcates paths.
   bool EagerlyAssume;
   bool TrimGraph;
   bool InlineCall;
   bool EagerlyTrimEGraph;
 
 public:
+  // Settings for inlining tuning.
+
+  /// \brief The inlining stack depth limit.
+  unsigned InlineMaxStackDepth;
+  /// \brief The max number of basic blocks in a function being inlined.
+  unsigned InlineMaxFunctionSize;
+
+public:
   AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags, 
                   const LangOptions &lang, PathDiagnosticConsumer *pd,
                   StoreManagerCreator storemgr,
@@ -87,7 +98,9 @@
                   bool eager, bool trim,
                   bool inlinecall, bool useUnoptimizedCFG,
                   bool addImplicitDtors, bool addInitializers,
-                  bool eagerlyTrimEGraph);
+                  bool eagerlyTrimEGraph,
+                  unsigned inlineMaxStack,
+                  unsigned inlineMaxFunctionSize);
 
   /// Construct a clone of the given AnalysisManager with the given ASTContext
   /// and DiagnosticsEngine.

Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h Tue Mar  6 07:07:43 2012
@@ -258,16 +258,6 @@
 
   /// VisitAsmStmt - Transfer function logic for inline asm.
   void VisitAsmStmt(const AsmStmt *A, ExplodedNode *Pred, ExplodedNodeSet &Dst);
-
-  void VisitAsmStmtHelperOutputs(const AsmStmt *A,
-                                 AsmStmt::const_outputs_iterator I,
-                                 AsmStmt::const_outputs_iterator E,
-                                 ExplodedNode *Pred, ExplodedNodeSet &Dst);
-
-  void VisitAsmStmtHelperInputs(const AsmStmt *A,
-                                AsmStmt::const_inputs_iterator I,
-                                AsmStmt::const_inputs_iterator E,
-                                ExplodedNode *Pred, ExplodedNodeSet &Dst);
   
   /// VisitBlockExpr - Transfer function logic for BlockExprs.
   void VisitBlockExpr(const BlockExpr *BE, ExplodedNode *Pred, 

Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h Tue Mar  6 07:07:43 2012
@@ -21,9 +21,11 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/Basic/SourceManager.h"
 #include "llvm/ADT/PointerUnion.h"
+#include "llvm/ADT/StringExtras.h"
 
 namespace clang {
 namespace ento {
+using llvm::StrInStrNoCase;
 
 /// \brief Represents both explicit ObjC message expressions and implicit
 /// messages that are sent for handling properties in dot syntax.
@@ -254,6 +256,33 @@
     assert(isObjCMessage());
     return Msg.getReceiverSourceRange();
   }
+
+  /// \brief Check if the name corresponds to a CoreFoundation or CoreGraphics 
+  /// function that allows objects to escape.
+  ///
+  /// Many methods allow a tracked object to escape.  For example:
+  ///
+  ///   CFMutableDictionaryRef x = CFDictionaryCreateMutable(..., customDeallocator);
+  ///   CFDictionaryAddValue(y, key, x);
+  ///
+  /// We handle this and similar cases with the following heuristic.  If the
+  /// function name contains "InsertValue", "SetValue", "AddValue",
+  /// "AppendValue", or "SetAttribute", then we assume that arguments may
+  /// escape.
+  //
+  // TODO: To reduce false negatives here, we should track the container
+  // allocation site and check if a proper deallocator was set there.
+  static bool isCFCGAllowingEscape(StringRef FName) {
+    if (FName[0] == 'C' && (FName[1] == 'F' || FName[1] == 'G'))
+           if (StrInStrNoCase(FName, "InsertValue") != StringRef::npos||
+               StrInStrNoCase(FName, "AddValue") != StringRef::npos ||
+               StrInStrNoCase(FName, "SetValue") != StringRef::npos ||
+               StrInStrNoCase(FName, "AppendValue") != StringRef::npos||
+               StrInStrNoCase(FName, "SetAttribute") != StringRef::npos) {
+         return true;
+       }
+    return false;
+  }
 };
 
 }

Modified: cfe/branches/tooling/lib/ARCMigrate/TransBlockObjCVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransBlockObjCVariable.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransBlockObjCVariable.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransBlockObjCVariable.cpp Tue Mar  6 07:07:43 2012
@@ -38,7 +38,7 @@
 class RootBlockObjCVarRewriter :
                           public RecursiveASTVisitor<RootBlockObjCVarRewriter> {
   MigrationPass &Pass;
-  llvm::DenseSet<VarDecl *> CheckedVars;
+  llvm::DenseSet<VarDecl *> &VarsToChange;
 
   class BlockVarChecker : public RecursiveASTVisitor<BlockVarChecker> {
     VarDecl *Var;
@@ -71,7 +71,9 @@
   };
 
 public:
-  RootBlockObjCVarRewriter(MigrationPass &pass) : Pass(pass) { }
+  RootBlockObjCVarRewriter(MigrationPass &pass,
+                           llvm::DenseSet<VarDecl *> &VarsToChange)
+    : Pass(pass), VarsToChange(VarsToChange) { }
 
   bool VisitBlockDecl(BlockDecl *block) {
     SmallVector<VarDecl *, 4> BlockVars;
@@ -80,7 +82,6 @@
            I = block->capture_begin(), E = block->capture_end(); I != E; ++I) {
       VarDecl *var = I->getVariable();
       if (I->isByRef() &&
-          !isAlreadyChecked(var) &&
           var->getType()->isObjCObjectPointerType() &&
           isImplicitStrong(var->getType())) {
         BlockVars.push_back(var);
@@ -89,32 +90,19 @@
 
     for (unsigned i = 0, e = BlockVars.size(); i != e; ++i) {
       VarDecl *var = BlockVars[i];
-      CheckedVars.insert(var);
 
       BlockVarChecker checker(var);
       bool onlyValueOfVarIsNeeded = checker.TraverseStmt(block->getBody());
-      if (onlyValueOfVarIsNeeded) {
-        BlocksAttr *attr = var->getAttr<BlocksAttr>();
-        if(!attr)
-          continue;
-        bool useWeak = canApplyWeak(Pass.Ctx, var->getType());
-        SourceManager &SM = Pass.Ctx.getSourceManager();
-        Transaction Trans(Pass.TA);
-        Pass.TA.replaceText(SM.getExpansionLoc(attr->getLocation()),
-                            "__block",
-                            useWeak ? "__weak" : "__unsafe_unretained");
-      }
-
+      if (onlyValueOfVarIsNeeded)
+        VarsToChange.insert(var);
+      else
+        VarsToChange.erase(var);
     }
 
     return true;
   }
 
 private:
-  bool isAlreadyChecked(VarDecl *VD) {
-    return CheckedVars.count(VD);
-  }
-
   bool isImplicitStrong(QualType ty) {
     if (isa<AttributedType>(ty.getTypePtr()))
       return false;
@@ -124,19 +112,39 @@
 
 class BlockObjCVarRewriter : public RecursiveASTVisitor<BlockObjCVarRewriter> {
   MigrationPass &Pass;
+  llvm::DenseSet<VarDecl *> &VarsToChange;
 
 public:
-  BlockObjCVarRewriter(MigrationPass &pass) : Pass(pass) { }
+  BlockObjCVarRewriter(MigrationPass &pass,
+                       llvm::DenseSet<VarDecl *> &VarsToChange)
+    : Pass(pass), VarsToChange(VarsToChange) { }
 
   bool TraverseBlockDecl(BlockDecl *block) {
-    RootBlockObjCVarRewriter(Pass).TraverseDecl(block);
+    RootBlockObjCVarRewriter(Pass, VarsToChange).TraverseDecl(block);
     return true;
   }
 };
 
 } // anonymous namespace
 
-void trans::rewriteBlockObjCVariable(MigrationPass &pass) {
-  BlockObjCVarRewriter trans(pass);
-  trans.TraverseDecl(pass.Ctx.getTranslationUnitDecl());
+void BlockObjCVariableTraverser::traverseBody(BodyContext &BodyCtx) {
+  MigrationPass &Pass = BodyCtx.getMigrationContext().Pass;
+  llvm::DenseSet<VarDecl *> VarsToChange;
+
+  BlockObjCVarRewriter trans(Pass, VarsToChange);
+  trans.TraverseStmt(BodyCtx.getTopStmt());
+
+  for (llvm::DenseSet<VarDecl *>::iterator
+         I = VarsToChange.begin(), E = VarsToChange.end(); I != E; ++I) {
+    VarDecl *var = *I;
+    BlocksAttr *attr = var->getAttr<BlocksAttr>();
+    if(!attr)
+      continue;
+    bool useWeak = canApplyWeak(Pass.Ctx, var->getType());
+    SourceManager &SM = Pass.Ctx.getSourceManager();
+    Transaction Trans(Pass.TA);
+    Pass.TA.replaceText(SM.getExpansionLoc(attr->getLocation()),
+                        "__block",
+                        useWeak ? "__weak" : "__unsafe_unretained");
+  }
 }

Modified: cfe/branches/tooling/lib/ARCMigrate/TransGCAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransGCAttrs.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransGCAttrs.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransGCAttrs.cpp Tue Mar  6 07:07:43 2012
@@ -11,7 +11,7 @@
 #include "Internals.h"
 #include "clang/Lex/Lexer.h"
 #include "clang/Basic/SourceManager.h"
-#include "llvm/ADT/SaveAndRestore.h"
+#include "llvm/Support/SaveAndRestore.h"
 #include "clang/Sema/SemaDiagnostic.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/TinyPtrVector.h"

Modified: cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp Tue Mar  6 07:07:43 2012
@@ -553,6 +553,7 @@
     MigrateCtx.addTraverser(new GCAttrsTraverser());
   }
   MigrateCtx.addTraverser(new PropertyRewriteTraverser());
+  MigrateCtx.addTraverser(new BlockObjCVariableTraverser());
 
   MigrateCtx.traverse(pass.Ctx.getTranslationUnitDecl());
 }
@@ -564,7 +565,6 @@
   removeZeroOutPropsInDeallocFinalize(pass);
   makeAssignARCSafe(pass);
   rewriteUnbridgedCasts(pass);
-  rewriteBlockObjCVariable(pass);
   checkAPIUses(pass);
   traverseAST(pass);
 }

Modified: cfe/branches/tooling/lib/ARCMigrate/Transforms.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/Transforms.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/Transforms.h (original)
+++ cfe/branches/tooling/lib/ARCMigrate/Transforms.h Tue Mar  6 07:07:43 2012
@@ -37,7 +37,6 @@
 void makeAssignARCSafe(MigrationPass &pass);
 void removeRetainReleaseDeallocFinalize(MigrationPass &pass);
 void removeZeroOutPropsInDeallocFinalize(MigrationPass &pass);
-void rewriteBlockObjCVariable(MigrationPass &pass);
 void rewriteUnusedInitDelegate(MigrationPass &pass);
 void checkAPIUses(MigrationPass &pass);
 
@@ -130,6 +129,11 @@
   virtual void traverseObjCImplementation(ObjCImplementationContext &ImplCtx);
 };
 
+class BlockObjCVariableTraverser : public ASTTraverser {
+public:
+  virtual void traverseBody(BodyContext &BodyCtx);
+};
+
 // GC transformations
 
 class GCAttrsTraverser : public ASTTraverser {

Modified: cfe/branches/tooling/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ASTContext.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ASTContext.cpp (original)
+++ cfe/branches/tooling/lib/AST/ASTContext.cpp Tue Mar  6 07:07:43 2012
@@ -259,12 +259,6 @@
   for (unsigned I = 0, N = Deallocations.size(); I != N; ++I)
     Deallocations[I].first(Deallocations[I].second);
   
-  // Release all of the memory associated with overridden C++ methods.
-  for (llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::iterator 
-         OM = OverriddenMethods.begin(), OMEnd = OverriddenMethods.end();
-       OM != OMEnd; ++OM)
-    OM->second.Destroy();
-  
   // ASTRecordLayout objects in ASTRecordLayouts must always be destroyed
   // because they can contain DenseMaps.
   for (llvm::DenseMap<const ObjCContainerDecl*,
@@ -2962,7 +2956,7 @@
     new (*this, TypeAlignment) UnaryTransformType (BaseType, UnderlyingType, 
                                                    Kind,
                                  UnderlyingType->isDependentType() ?
-                                    QualType() : UnderlyingType);
+                                 QualType() : getCanonicalType(UnderlyingType));
   Types.push_back(Ty);
   return QualType(Ty, 0);
 }
@@ -3376,26 +3370,13 @@
     // types, e.g.,
     //   typedef typename T::type T1;
     //   typedef typename T1::type T2;
-    if (const DependentNameType *DNT = T->getAs<DependentNameType>()) {
-      NestedNameSpecifier *Prefix
-        = getCanonicalNestedNameSpecifier(DNT->getQualifier());
-      return NestedNameSpecifier::Create(*this, Prefix, 
+    if (const DependentNameType *DNT = T->getAs<DependentNameType>())
+      return NestedNameSpecifier::Create(*this, DNT->getQualifier(), 
                            const_cast<IdentifierInfo *>(DNT->getIdentifier()));
-    }    
 
-    // Do the same thing as above, but with dependent-named specializations.
-    if (const DependentTemplateSpecializationType *DTST
-          = T->getAs<DependentTemplateSpecializationType>()) {
-      NestedNameSpecifier *Prefix
-        = getCanonicalNestedNameSpecifier(DTST->getQualifier());
-      
-      T = getDependentTemplateSpecializationType(DTST->getKeyword(),
-                                                 Prefix, DTST->getIdentifier(),
-                                                 DTST->getNumArgs(),
-                                                 DTST->getArgs());
-      T = getCanonicalType(T);
-    }
-    
+    // Otherwise, just canonicalize the type, and force it to be a TypeSpec.
+    // FIXME: Why are TypeSpec and TypeSpecWithTemplate distinct in the
+    // first place?
     return NestedNameSpecifier::Create(*this, 0, false,
                                        const_cast<Type*>(T.getTypePtr()));
   }

Modified: cfe/branches/tooling/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ASTImporter.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ASTImporter.cpp (original)
+++ cfe/branches/tooling/lib/AST/ASTImporter.cpp Tue Mar  6 07:07:43 2012
@@ -3544,6 +3544,7 @@
     = ObjCPropertyDecl::Create(Importer.getToContext(), DC, Loc,
                                Name.getAsIdentifierInfo(), 
                                Importer.Import(D->getAtLoc()),
+                               Importer.Import(D->getLParenLoc()),
                                T,
                                D->getPropertyImplementation());
   Importer.Imported(D, ToProperty);

Modified: cfe/branches/tooling/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/Decl.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/Decl.cpp (original)
+++ cfe/branches/tooling/lib/AST/Decl.cpp Tue Mar  6 07:07:43 2012
@@ -1372,11 +1372,18 @@
 bool VarDecl::isUsableInConstantExpressions() const {
   const LangOptions &Lang = getASTContext().getLangOptions();
 
-  // Only const variables can be used in constant expressions in C++. C++98 does
+  if (!Lang.CPlusPlus)
+    return false;
+
+  // In C++11, any variable of reference type can be used in a constant
+  // expression if it is initialized by a constant expression.
+  if (Lang.CPlusPlus0x && getType()->isReferenceType())
+    return true;
+
+  // Only const objects can be used in constant expressions in C++. C++98 does
   // not require the variable to be non-volatile, but we consider this to be a
   // defect.
-  if (!Lang.CPlusPlus ||
-      !getType().isConstQualified() || getType().isVolatileQualified())
+  if (!getType().isConstQualified() || getType().isVolatileQualified())
     return false;
 
   // In C++, const, non-volatile variables of integral or enumeration types
@@ -1384,9 +1391,9 @@
   if (getType()->isIntegralOrEnumerationType())
     return true;
 
-  // Additionally, in C++11, non-volatile constexpr variables and references can
-  // be used in constant expressions.
-  return Lang.CPlusPlus0x && (isConstexpr() || getType()->isReferenceType());
+  // Additionally, in C++11, non-volatile constexpr variables can be used in
+  // constant expressions.
+  return Lang.CPlusPlus0x && isConstexpr();
 }
 
 /// Convert the initializer for this declaration to the elaborated EvaluatedStmt
@@ -1847,6 +1854,16 @@
   }
 }
 
+void FunctionDecl::setDeclsInPrototypeScope(llvm::ArrayRef<NamedDecl *> NewDecls) {
+  assert(DeclsInPrototypeScope.empty() && "Already has prototype decls!");
+
+  if (!NewDecls.empty()) {
+    NamedDecl **A = new (getASTContext()) NamedDecl*[NewDecls.size()];
+    std::copy(NewDecls.begin(), NewDecls.end(), A);
+    DeclsInPrototypeScope = llvm::ArrayRef<NamedDecl*>(A, NewDecls.size());
+  }
+}
+
 /// getMinRequiredArguments - Returns the minimum number of arguments
 /// needed to call this function. This may be fewer than the number of
 /// function parameters, if some of the parameters have default

Modified: cfe/branches/tooling/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/DeclBase.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/DeclBase.cpp (original)
+++ cfe/branches/tooling/lib/AST/DeclBase.cpp Tue Mar  6 07:07:43 2012
@@ -39,8 +39,6 @@
 #define ABSTRACT_DECL(DECL)
 #include "clang/AST/DeclNodes.inc"
 
-static bool StatSwitch = false;
-
 void *Decl::AllocateDeserializedDecl(const ASTContext &Context, 
                                      unsigned ID,
                                      unsigned Size) {
@@ -88,9 +86,9 @@
   }
 }
 
-bool Decl::CollectingStats(bool Enable) {
-  if (Enable) StatSwitch = true;
-  return StatSwitch;
+bool Decl::StatisticsEnabled = false;
+void Decl::EnableStatistics() {
+  StatisticsEnabled = true;
 }
 
 void Decl::PrintStats() {

Modified: cfe/branches/tooling/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/DeclObjC.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/DeclObjC.cpp (original)
+++ cfe/branches/tooling/lib/AST/DeclObjC.cpp Tue Mar  6 07:07:43 2012
@@ -806,6 +806,10 @@
 ///
 ObjCCategoryDecl *
 ObjCInterfaceDecl::FindCategoryDeclaration(IdentifierInfo *CategoryId) const {
+  // FIXME: Should make sure no callers ever do this.
+  if (!hasDefinition())
+    return 0;
+
   if (data().ExternallyCompleted)
     LoadExternalDefinition();
 
@@ -1278,15 +1282,17 @@
                                            SourceLocation L,
                                            IdentifierInfo *Id,
                                            SourceLocation AtLoc,
+                                           SourceLocation LParenLoc,
                                            TypeSourceInfo *T,
                                            PropertyControl propControl) {
-  return new (C) ObjCPropertyDecl(DC, L, Id, AtLoc, T);
+  return new (C) ObjCPropertyDecl(DC, L, Id, AtLoc, LParenLoc, T);
 }
 
 ObjCPropertyDecl *ObjCPropertyDecl::CreateDeserialized(ASTContext &C, 
                                                        unsigned ID) {
   void * Mem = AllocateDeserializedDecl(C, ID, sizeof(ObjCPropertyDecl));
   return new (Mem) ObjCPropertyDecl(0, SourceLocation(), 0, SourceLocation(),
+                                    SourceLocation(),
                                     0);
 }
 

Modified: cfe/branches/tooling/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/DeclPrinter.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/DeclPrinter.cpp (original)
+++ cfe/branches/tooling/lib/AST/DeclPrinter.cpp Tue Mar  6 07:07:43 2012
@@ -650,7 +650,7 @@
 }
 
 void DeclPrinter::VisitImportDecl(ImportDecl *D) {
-  Out << "@import " << D->getImportedModule()->getFullModuleName()
+  Out << "@__experimental_modules_import " << D->getImportedModule()->getFullModuleName()
       << ";\n";
 }
 

Modified: cfe/branches/tooling/lib/AST/DumpXML.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/DumpXML.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/DumpXML.cpp (original)
+++ cfe/branches/tooling/lib/AST/DumpXML.cpp Tue Mar  6 07:07:43 2012
@@ -497,6 +497,10 @@
     for (FunctionDecl::param_iterator
            I = D->param_begin(), E = D->param_end(); I != E; ++I)
       dispatch(*I);
+    for (llvm::ArrayRef<NamedDecl*>::iterator
+           I = D->getDeclsInPrototypeScope().begin(), E = D->getDeclsInPrototypeScope().end();
+         I != E; ++I)
+      dispatch(*I);
     if (D->doesThisDeclarationHaveABody())
       dispatch(D->getBody());
   }

Modified: cfe/branches/tooling/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/Expr.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/Expr.cpp (original)
+++ cfe/branches/tooling/lib/AST/Expr.cpp Tue Mar  6 07:07:43 2012
@@ -500,7 +500,7 @@
 }
 
 int StringLiteral::mapCharByteWidth(TargetInfo const &target,StringKind k) {
-  int CharByteWidth;
+  int CharByteWidth = 0;
   switch(k) {
     case Ascii:
     case UTF8:
@@ -514,6 +514,7 @@
       break;
     case UTF32:
       CharByteWidth = target.getChar32Width();
+      break;
   }
   assert((CharByteWidth & 7) == 0 && "Assumes character size is byte multiple");
   CharByteWidth /= 8;

Modified: cfe/branches/tooling/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ExprConstant.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ExprConstant.cpp (original)
+++ cfe/branches/tooling/lib/AST/ExprConstant.cpp Tue Mar  6 07:07:43 2012
@@ -44,7 +44,7 @@
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/SaveAndRestore.h"
+#include "llvm/Support/SaveAndRestore.h"
 #include <cstring>
 #include <functional>
 
@@ -265,64 +265,6 @@
     }
   };
 
-  /// A core constant value. This can be the value of any constant expression,
-  /// or a pointer or reference to a non-static object or function parameter.
-  ///
-  /// For an LValue, the base and offset are stored in the APValue subobject,
-  /// but the other information is stored in the SubobjectDesignator. For all
-  /// other value kinds, the value is stored directly in the APValue subobject.
-  class CCValue : public APValue {
-    typedef llvm::APSInt APSInt;
-    typedef llvm::APFloat APFloat;
-    /// If the value is a reference or pointer, this is a description of how the
-    /// subobject was specified.
-    SubobjectDesignator Designator;
-  public:
-    struct GlobalValue {};
-
-    CCValue() {}
-    explicit CCValue(const APSInt &I) : APValue(I) {}
-    explicit CCValue(const APFloat &F) : APValue(F) {}
-    CCValue(const APValue *E, unsigned N) : APValue(E, N) {}
-    CCValue(const APSInt &R, const APSInt &I) : APValue(R, I) {}
-    CCValue(const APFloat &R, const APFloat &I) : APValue(R, I) {}
-    CCValue(const CCValue &V) : APValue(V), Designator(V.Designator) {}
-    CCValue(LValueBase B, const CharUnits &O, unsigned I,
-            const SubobjectDesignator &D) :
-      APValue(B, O, APValue::NoLValuePath(), I), Designator(D) {}
-    CCValue(ASTContext &Ctx, const APValue &V, GlobalValue) :
-      APValue(V), Designator(Ctx, V) {
-    }
-    CCValue(const ValueDecl *D, bool IsDerivedMember,
-            ArrayRef<const CXXRecordDecl*> Path) :
-      APValue(D, IsDerivedMember, Path) {}
-    CCValue(const AddrLabelExpr* LHSExpr, const AddrLabelExpr* RHSExpr) :
-      APValue(LHSExpr, RHSExpr) {}
-
-    SubobjectDesignator &getLValueDesignator() {
-      assert(getKind() == LValue);
-      return Designator;
-    }
-    const SubobjectDesignator &getLValueDesignator() const {
-      return const_cast<CCValue*>(this)->getLValueDesignator();
-    }
-    APValue toAPValue() const {
-      if (!isLValue())
-        return *this;
-
-      if (Designator.Invalid) {
-        // This is not a core constant expression. An appropriate diagnostic
-        // will have already been produced.
-        return APValue(getLValueBase(), getLValueOffset(),
-                       APValue::NoLValuePath(), getLValueCallIndex());
-      }
-
-      return APValue(getLValueBase(), getLValueOffset(),
-                     Designator.Entries, Designator.IsOnePastTheEnd,
-                     getLValueCallIndex());
-    }
-  };
-
   /// A stack frame in the constexpr call stack.
   struct CallStackFrame {
     EvalInfo &Info;
@@ -344,16 +286,16 @@
 
     /// ParmBindings - Parameter bindings for this function call, indexed by
     /// parameters' function scope indices.
-    const CCValue *Arguments;
+    const APValue *Arguments;
 
-    typedef llvm::DenseMap<const Expr*, CCValue> MapTy;
+    typedef llvm::DenseMap<const Expr*, APValue> MapTy;
     typedef MapTy::const_iterator temp_iterator;
     /// Temporaries - Temporary lvalues materialized within this stack frame.
     MapTy Temporaries;
 
     CallStackFrame(EvalInfo &Info, SourceLocation CallLoc,
                    const FunctionDecl *Callee, const LValue *This,
-                   const CCValue *Arguments);
+                   const APValue *Arguments);
     ~CallStackFrame();
   };
 
@@ -420,7 +362,7 @@
     /// NextCallIndex - The next call index to assign.
     unsigned NextCallIndex;
 
-    typedef llvm::DenseMap<const OpaqueValueExpr*, CCValue> MapTy;
+    typedef llvm::DenseMap<const OpaqueValueExpr*, APValue> MapTy;
     /// OpaqueValues - Values used as the common expression in a
     /// BinaryConditionalOperator.
     MapTy OpaqueValues;
@@ -459,7 +401,7 @@
         EvaluatingDecl(0), EvaluatingDeclValue(0), HasActiveDiagnostic(false),
         CheckingPotentialConstantExpression(false), IntExprEvaluatorDepth(0) {}
 
-    const CCValue *getOpaqueValue(const OpaqueValueExpr *e) const {
+    const APValue *getOpaqueValue(const OpaqueValueExpr *e) const {
       MapTy::const_iterator i = OpaqueValues.find(e);
       if (i == OpaqueValues.end()) return 0;
       return &i->second;
@@ -636,7 +578,7 @@
 
 CallStackFrame::CallStackFrame(EvalInfo &Info, SourceLocation CallLoc,
                                const FunctionDecl *Callee, const LValue *This,
-                               const CCValue *Arguments)
+                               const APValue *Arguments)
     : Info(Info), Caller(Info.CurrentCall), CallLoc(CallLoc), Callee(Callee),
       Index(Info.NextCallIndex++), This(This), Arguments(Arguments) {
   Info.CurrentCall = this;
@@ -665,17 +607,8 @@
       Out << ", ";
 
     const ParmVarDecl *Param = *I;
-    const CCValue &Arg = Frame->Arguments[ArgIndex];
-    if (!Arg.isLValue() || Arg.getLValueDesignator().Invalid)
-      Arg.printPretty(Out, Frame->Info.Ctx, Param->getType());
-    else {
-      // Convert the CCValue to an APValue without checking for constantness.
-      APValue Value(Arg.getLValueBase(), Arg.getLValueOffset(),
-                    Arg.getLValueDesignator().Entries,
-                    Arg.getLValueDesignator().IsOnePastTheEnd,
-                    Arg.getLValueCallIndex());
-      Value.printPretty(Out, Frame->Info.Ctx, Param->getType());
-    }
+    const APValue &Arg = Frame->Arguments[ArgIndex];
+    Arg.printPretty(Out, Frame->Info.Ctx, Param->getType());
 
     if (ArgIndex == 0 && IsMemberCall)
       Out << "->" << *Frame->Callee << '(';
@@ -735,13 +668,13 @@
     APSInt &getComplexIntReal() { return IntReal; }
     APSInt &getComplexIntImag() { return IntImag; }
 
-    void moveInto(CCValue &v) const {
+    void moveInto(APValue &v) const {
       if (isComplexFloat())
-        v = CCValue(FloatReal, FloatImag);
+        v = APValue(FloatReal, FloatImag);
       else
-        v = CCValue(IntReal, IntImag);
+        v = APValue(IntReal, IntImag);
     }
-    void setFrom(const CCValue &v) {
+    void setFrom(const APValue &v) {
       assert(v.isComplexFloat() || v.isComplexInt());
       if (v.isComplexFloat()) {
         makeComplexFloat();
@@ -768,15 +701,19 @@
     SubobjectDesignator &getLValueDesignator() { return Designator; }
     const SubobjectDesignator &getLValueDesignator() const { return Designator;}
 
-    void moveInto(CCValue &V) const {
-      V = CCValue(Base, Offset, CallIndex, Designator);
+    void moveInto(APValue &V) const {
+      if (Designator.Invalid)
+        V = APValue(Base, Offset, APValue::NoLValuePath(), CallIndex);
+      else
+        V = APValue(Base, Offset, Designator.Entries,
+                    Designator.IsOnePastTheEnd, CallIndex);
     }
-    void setFrom(const CCValue &V) {
+    void setFrom(ASTContext &Ctx, const APValue &V) {
       assert(V.isLValue());
       Base = V.getLValueBase();
       Offset = V.getLValueOffset();
       CallIndex = V.getLValueCallIndex();
-      Designator = V.getLValueDesignator();
+      Designator = SubobjectDesignator(Ctx, V);
     }
 
     void set(APValue::LValueBase B, unsigned I = 0) {
@@ -848,10 +785,10 @@
           DeclAndIsDerivedMember.getPointer()->getDeclContext());
     }
 
-    void moveInto(CCValue &V) const {
-      V = CCValue(getDecl(), isDerivedMember(), Path);
+    void moveInto(APValue &V) const {
+      V = APValue(getDecl(), isDerivedMember(), Path);
     }
-    void setFrom(const CCValue &V) {
+    void setFrom(const APValue &V) {
       assert(V.isMemberPointer());
       DeclAndIsDerivedMember.setPointer(V.getMemberPointerDecl());
       DeclAndIsDerivedMember.setInt(V.isMemberPointerToDerivedMember());
@@ -934,7 +871,7 @@
   };
 }
 
-static bool Evaluate(CCValue &Result, EvalInfo &Info, const Expr *E);
+static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E);
 static bool EvaluateInPlace(APValue &Result, EvalInfo &Info,
                             const LValue &This, const Expr *E,
                             CheckConstantExpressionKind CCEK = CCEK_Constant,
@@ -945,7 +882,7 @@
                                   EvalInfo &Info);
 static bool EvaluateTemporary(const Expr *E, LValue &Result, EvalInfo &Info);
 static bool EvaluateInteger(const Expr *E, APSInt  &Result, EvalInfo &Info);
-static bool EvaluateIntegerOrLValue(const Expr *E, CCValue &Result,
+static bool EvaluateIntegerOrLValue(const Expr *E, APValue &Result,
                                     EvalInfo &Info);
 static bool EvaluateFloat(const Expr *E, APFloat &Result, EvalInfo &Info);
 static bool EvaluateComplex(const Expr *E, ComplexValue &Res, EvalInfo &Info);
@@ -1023,9 +960,8 @@
 }
 
 /// Check that this reference or pointer core constant expression is a valid
-/// value for an address or reference constant expression. Type T should be
-/// either LValue or CCValue. Return true if we can fold this expression,
-/// whether or not it's a constant expression.
+/// value for an address or reference constant expression. Return true if we
+/// can fold this expression, whether or not it's a constant expression.
 static bool CheckLValueConstantExpression(EvalInfo &Info, SourceLocation Loc,
                                           QualType Type, const LValue &LVal) {
   bool IsReferenceType = Type->isReferenceType();
@@ -1136,9 +1072,8 @@
   }
 
   if (Value.isLValue()) {
-    CCValue Val(Info.Ctx, Value, CCValue::GlobalValue());
     LValue LVal;
-    LVal.setFrom(Val);
+    LVal.setFrom(Info.Ctx, Value);
     return CheckLValueConstantExpression(Info, DiagLoc, Type, LVal);
   }
 
@@ -1159,7 +1094,7 @@
   return Decl && Decl->isWeak();
 }
 
-static bool EvalPointerValueAsBool(const CCValue &Value, bool &Result) {
+static bool EvalPointerValueAsBool(const APValue &Value, bool &Result) {
   // A null base expression indicates a null pointer.  These are always
   // evaluatable, and they are false unless the offset is zero.
   if (!Value.getLValueBase()) {
@@ -1174,7 +1109,7 @@
   return !Decl || !Decl->isWeak();
 }
 
-static bool HandleConversionToBool(const CCValue &Val, bool &Result) {
+static bool HandleConversionToBool(const APValue &Val, bool &Result) {
   switch (Val.getKind()) {
   case APValue::Uninitialized:
     return false;
@@ -1211,7 +1146,7 @@
 static bool EvaluateAsBooleanCondition(const Expr *E, bool &Result,
                                        EvalInfo &Info) {
   assert(E->isRValue() && "missing lvalue-to-rvalue conv in bool condition");
-  CCValue Val;
+  APValue Val;
   if (!Evaluate(Val, Info, E))
     return false;
   return HandleConversionToBool(Val, Result);
@@ -1277,7 +1212,7 @@
 
 static bool EvalAndBitcastToAPInt(EvalInfo &Info, const Expr *E,
                                   llvm::APInt &Res) {
-  CCValue SVal;
+  APValue SVal;
   if (!Evaluate(SVal, Info, E))
     return false;
   if (SVal.isInt()) {
@@ -1470,7 +1405,7 @@
 /// Try to evaluate the initializer for a variable declaration.
 static bool EvaluateVarDeclInit(EvalInfo &Info, const Expr *E,
                                 const VarDecl *VD,
-                                CallStackFrame *Frame, CCValue &Result) {
+                                CallStackFrame *Frame, APValue &Result) {
   // If this is a parameter to an active constexpr function call, perform
   // argument substitution.
   if (const ParmVarDecl *PVD = dyn_cast<ParmVarDecl>(VD)) {
@@ -1499,8 +1434,7 @@
   // If we're currently evaluating the initializer of this declaration, use that
   // in-flight value.
   if (Info.EvaluatingDecl == VD) {
-    Result = CCValue(Info.Ctx, *Info.EvaluatingDeclValue,
-                     CCValue::GlobalValue());
+    Result = *Info.EvaluatingDeclValue;
     return !Result.isUninit();
   }
 
@@ -1527,7 +1461,7 @@
     Info.addNotes(Notes);
   }
 
-  Result = CCValue(Info.Ctx, *VD->getEvaluatedValue(), CCValue::GlobalValue());
+  Result = *VD->getEvaluatedValue();
   return true;
 }
 
@@ -1567,7 +1501,7 @@
 
 /// Extract the designated sub-object of an rvalue.
 static bool ExtractSubobject(EvalInfo &Info, const Expr *E,
-                             CCValue &Obj, QualType ObjType,
+                             APValue &Obj, QualType ObjType,
                              const SubobjectDesignator &Sub, QualType SubType) {
   if (Sub.Invalid)
     // A diagnostic will have already been produced.
@@ -1605,7 +1539,7 @@
       if (O->isLValue()) {
         assert(I == N - 1 && "extracting subobject of character?");
         assert(!O->hasLValuePath() || O->getLValuePath().empty());
-        Obj = CCValue(ExtractStringLiteralCharacter(
+        Obj = APValue(ExtractStringLiteralCharacter(
           Info, O->getLValueBase().get<const Expr*>(), Index));
         return true;
       } else if (O->getArrayInitializedElts() > Index)
@@ -1624,11 +1558,11 @@
       }
       assert(I == N - 1 && "extracting subobject of scalar?");
       if (O->isComplexInt()) {
-        Obj = CCValue(Index ? O->getComplexIntImag()
+        Obj = APValue(Index ? O->getComplexIntImag()
                             : O->getComplexIntReal());
       } else {
         assert(O->isComplexFloat());
-        Obj = CCValue(Index ? O->getComplexFloatImag()
+        Obj = APValue(Index ? O->getComplexFloatImag()
                             : O->getComplexFloatReal());
       }
       return true;
@@ -1682,7 +1616,7 @@
     }
   }
 
-  Obj = CCValue(Info.Ctx, *O, CCValue::GlobalValue());
+  Obj = APValue(*O);
   return true;
 }
 
@@ -1756,7 +1690,7 @@
 /// \param RVal - The produced value will be placed here.
 static bool HandleLValueToRValueConversion(EvalInfo &Info, const Expr *Conv,
                                            QualType Type,
-                                           const LValue &LVal, CCValue &RVal) {
+                                           const LValue &LVal, APValue &RVal) {
   // In C, an lvalue-to-rvalue conversion is never a constant expression.
   if (!Info.getLangOpts().CPlusPlus)
     Info.CCEDiag(Conv->getExprLoc(), diag::note_invalid_subexpr_in_const_expr);
@@ -1912,9 +1846,7 @@
     // We represent a string literal array as an lvalue pointing at the
     // corresponding expression, rather than building an array of chars.
     // FIXME: Support PredefinedExpr, ObjCEncodeExpr, MakeStringConstant
-    RVal = CCValue(Info.Ctx,
-                   APValue(Base, CharUnits::Zero(), APValue::NoLValuePath(), 0),
-                   CCValue::GlobalValue());
+    RVal = APValue(Base, CharUnits::Zero(), APValue::NoLValuePath(), 0);
   } else {
     Info.Diag(Conv->getExprLoc(), diag::note_invalid_subexpr_in_const_expr);
     return false;
@@ -2078,7 +2010,7 @@
 }
 
 // Evaluate a statement.
-static EvalStmtResult EvaluateStmt(CCValue &Result, EvalInfo &Info,
+static EvalStmtResult EvaluateStmt(APValue &Result, EvalInfo &Info,
                                    const Stmt *S) {
   switch (S->getStmtClass()) {
   default:
@@ -2165,7 +2097,7 @@
 }
 
 namespace {
-typedef SmallVector<CCValue, 8> ArgVector;
+typedef SmallVector<APValue, 8> ArgVector;
 }
 
 /// EvaluateArgs - Evaluate the arguments to a function call.
@@ -2189,7 +2121,7 @@
 static bool HandleFunctionCall(SourceLocation CallLoc,
                                const FunctionDecl *Callee, const LValue *This,
                                ArrayRef<const Expr*> Args, const Stmt *Body,
-                               EvalInfo &Info, CCValue &Result) {
+                               EvalInfo &Info, APValue &Result) {
   ArgVector ArgValues(Args.size());
   if (!EvaluateArgs(Args, ArgValues, Info))
     return false;
@@ -2234,16 +2166,9 @@
       ((Definition->isCopyConstructor() && Definition->isTrivial()) ||
        (Definition->isMoveConstructor() && Definition->isTrivial()))) {
     LValue RHS;
-    RHS.setFrom(ArgValues[0]);
-    CCValue Value;
-    if (!HandleLValueToRValueConversion(Info, Args[0], Args[0]->getType(),
-                                        RHS, Value))
-      return false;
-    assert((Value.isStruct() || Value.isUnion()) &&
-           "trivial copy/move from non-class type?");
-    // Any CCValue of class type must already be a constant expression.
-    Result = Value;
-    return true;
+    RHS.setFrom(Info.Ctx, ArgValues[0]);
+    return HandleLValueToRValueConversion(Info, Args[0], Args[0]->getType(),
+                                          RHS, Result);
   }
 
   // Reserve space for the struct members.
@@ -2446,7 +2371,7 @@
 class ExprEvaluatorBase
   : public ConstStmtVisitor<Derived, RetTy> {
 private:
-  RetTy DerivedSuccess(const CCValue &V, const Expr *E) {
+  RetTy DerivedSuccess(const APValue &V, const Expr *E) {
     return static_cast<Derived*>(this)->Success(V, E);
   }
   RetTy DerivedZeroInitialization(const Expr *E) {
@@ -2565,7 +2490,7 @@
       LValue Obj;
       if (!HandleMemberPointerAccess(Info, E, Obj))
         return false;
-      CCValue Result;
+      APValue Result;
       if (!HandleLValueToRValueConversion(Info, E, E->getType(), Obj, Result))
         return false;
       return DerivedSuccess(Result, E);
@@ -2610,7 +2535,7 @@
   }
 
   RetTy VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
-    const CCValue *Value = Info.getOpaqueValue(E);
+    const APValue *Value = Info.getOpaqueValue(E);
     if (!Value) {
       const Expr *Source = E->getSourceExpr();
       if (!Source)
@@ -2699,7 +2624,7 @@
 
     const FunctionDecl *Definition = 0;
     Stmt *Body = FD->getBody(Definition);
-    CCValue Result;
+    APValue Result;
 
     if (!CheckConstexprFunction(Info, E->getExprLoc(), FD, Definition) ||
         !HandleFunctionCall(E->getExprLoc(), Definition, This, Args, Body,
@@ -2733,7 +2658,7 @@
   RetTy VisitMemberExpr(const MemberExpr *E) {
     assert(!E->isArrow() && "missing call to bound member function?");
 
-    CCValue Val;
+    APValue Val;
     if (!Evaluate(Val, Info, E->getBase()))
       return false;
 
@@ -2767,7 +2692,7 @@
       LValue LVal;
       if (!EvaluateLValue(E->getSubExpr(), LVal, Info))
         return false;
-      CCValue RVal;
+      APValue RVal;
       // Note, we use the subexpression's type in order to retain cv-qualifiers.
       if (!HandleLValueToRValueConversion(Info, E, E->getSubExpr()->getType(),
                                           LVal, RVal))
@@ -2781,7 +2706,7 @@
 
   /// Visit a value which is evaluated, but whose value is ignored.
   void VisitIgnoredValue(const Expr *E) {
-    CCValue Scratch;
+    APValue Scratch;
     if (!Evaluate(Scratch, Info, E))
       Info.EvalStatus.HasSideEffects = true;
   }
@@ -2810,8 +2735,8 @@
   LValueExprEvaluatorBase(EvalInfo &Info, LValue &Result) :
     ExprEvaluatorBaseTy(Info), Result(Result) {}
 
-  bool Success(const CCValue &V, const Expr *E) {
-    Result.setFrom(V);
+  bool Success(const APValue &V, const Expr *E) {
+    Result.setFrom(this->Info.Ctx, V);
     return true;
   }
 
@@ -2845,7 +2770,7 @@
       return this->Error(E);
 
     if (MD->getType()->isReferenceType()) {
-      CCValue RefValue;
+      APValue RefValue;
       if (!HandleLValueToRValueConversion(this->Info, E, MD->getType(), Result,
                                           RefValue))
         return false;
@@ -2993,7 +2918,7 @@
     return Success(VD);
   }
 
-  CCValue V;
+  APValue V;
   if (!EvaluateVarDeclInit(Info, E, VD, Info.CurrentCall, V))
     return false;
   return Success(V, E);
@@ -3120,8 +3045,8 @@
   PointerExprEvaluator(EvalInfo &info, LValue &Result)
     : ExprEvaluatorBaseTy(info), Result(Result) {}
 
-  bool Success(const CCValue &V, const Expr *E) {
-    Result.setFrom(V);
+  bool Success(const APValue &V, const Expr *E) {
+    Result.setFrom(Info.Ctx, V);
     return true;
   }
   bool ZeroInitialization(const Expr *E) {
@@ -3251,7 +3176,7 @@
   case CK_IntegralToPointer: {
     CCEDiag(E, diag::note_constexpr_invalid_cast) << 2;
 
-    CCValue Value;
+    APValue Value;
     if (!EvaluateIntegerOrLValue(SubExpr, Value, Info))
       break;
 
@@ -3265,7 +3190,7 @@
       return true;
     } else {
       // Cast is of an lvalue, no need to change value.
-      Result.setFrom(Value);
+      Result.setFrom(Info.Ctx, Value);
       return true;
     }
   }
@@ -3319,7 +3244,7 @@
   MemberPointerExprEvaluator(EvalInfo &Info, MemberPtr &Result)
     : ExprEvaluatorBaseTy(Info), Result(Result) {}
 
-  bool Success(const CCValue &V, const Expr *E) {
+  bool Success(const APValue &V, const Expr *E) {
     Result.setFrom(V);
     return true;
   }
@@ -3402,7 +3327,7 @@
     RecordExprEvaluator(EvalInfo &info, const LValue &This, APValue &Result)
       : ExprEvaluatorBaseTy(info), This(This), Result(Result) {}
 
-    bool Success(const CCValue &V, const Expr *E) {
+    bool Success(const APValue &V, const Expr *E) {
       Result = V;
       return true;
     }
@@ -3498,7 +3423,7 @@
 
   case CK_DerivedToBase:
   case CK_UncheckedDerivedToBase: {
-    CCValue DerivedObject;
+    APValue DerivedObject;
     if (!Evaluate(DerivedObject, Info, E->getSubExpr()))
       return false;
     if (!DerivedObject.isStruct())
@@ -3696,7 +3621,7 @@
       Result = APValue(V.data(), V.size());
       return true;
     }
-    bool Success(const CCValue &V, const Expr *E) {
+    bool Success(const APValue &V, const Expr *E) {
       assert(V.isVector());
       Result = V;
       return true;
@@ -3920,7 +3845,7 @@
     LValue LV;
     if (!EvaluateLValue(E->getInit(0), LV, Info))
       return false;
-    CCValue Val;
+    APValue Val;
     LV.moveInto(Val);
     return Success(Val, E);
   }
@@ -4025,9 +3950,9 @@
 namespace {
 class IntExprEvaluator
   : public ExprEvaluatorBase<IntExprEvaluator, bool> {
-  CCValue &Result;
+  APValue &Result;
 public:
-  IntExprEvaluator(EvalInfo &info, CCValue &result)
+  IntExprEvaluator(EvalInfo &info, APValue &result)
     : ExprEvaluatorBaseTy(info), Result(result) {}
 
   bool Success(const llvm::APSInt &SI, const Expr *E) {
@@ -4037,7 +3962,7 @@
            "Invalid evaluation result.");
     assert(SI.getBitWidth() == Info.Ctx.getIntWidth(E->getType()) &&
            "Invalid evaluation result.");
-    Result = CCValue(SI);
+    Result = APValue(SI);
     return true;
   }
 
@@ -4046,7 +3971,7 @@
            "Invalid evaluation result.");
     assert(I.getBitWidth() == Info.Ctx.getIntWidth(E->getType()) &&
            "Invalid evaluation result.");
-    Result = CCValue(APSInt(I));
+    Result = APValue(APSInt(I));
     Result.getInt().setIsUnsigned(
                             E->getType()->isUnsignedIntegerOrEnumerationType());
     return true;
@@ -4055,7 +3980,7 @@
   bool Success(uint64_t Value, const Expr *E) {
     assert(E->getType()->isIntegralOrEnumerationType() && 
            "Invalid evaluation result.");
-    Result = CCValue(Info.Ctx.MakeIntValue(Value, E->getType()));
+    Result = APValue(Info.Ctx.MakeIntValue(Value, E->getType()));
     return true;
   }
 
@@ -4063,7 +3988,7 @@
     return Success(Size.getQuantity(), E);
   }
 
-  bool Success(const CCValue &V, const Expr *E) {
+  bool Success(const APValue &V, const Expr *E) {
     if (V.isLValue() || V.isAddrLabelDiff()) {
       Result = V;
       return true;
@@ -4174,14 +4099,14 @@
 /// an integer rvalue to produce a pointer (represented as an lvalue) instead.
 /// Some simple arithmetic on such values is supported (they are treated much
 /// like char*).
-static bool EvaluateIntegerOrLValue(const Expr *E, CCValue &Result,
+static bool EvaluateIntegerOrLValue(const Expr *E, APValue &Result,
                                     EvalInfo &Info) {
   assert(E->isRValue() && E->getType()->isIntegralOrEnumerationType());
   return IntExprEvaluator(Info, Result).Visit(E);
 }
 
 static bool EvaluateInteger(const Expr *E, APSInt &Result, EvalInfo &Info) {
-  CCValue Val;
+  APValue Val;
   if (!EvaluateIntegerOrLValue(E, Val, Info))
     return false;
   if (!Val.isInt()) {
@@ -4669,7 +4594,7 @@
           if (LHSAddrExpr->getLabel()->getDeclContext() !=
               RHSAddrExpr->getLabel()->getDeclContext())
             return false;
-          Result = CCValue(LHSAddrExpr, RHSAddrExpr);
+          Result = APValue(LHSAddrExpr, RHSAddrExpr);
           return true;
         }
         // Inequalities and subtractions between unrelated pointers have
@@ -4865,7 +4790,7 @@
   }
 
   // The LHS of a constant expr is always evaluated and needed.
-  CCValue LHSVal;
+  APValue LHSVal;
 
   bool LHSOK = EvaluateIntegerOrLValue(E->getLHS(), LHSVal, Info);
   if (!LHSOK && !Info.keepEvaluatingAfterFailure())
@@ -4874,7 +4799,7 @@
   if (!Visit(E->getRHS()) || !LHSOK)
     return false;
 
-  CCValue &RHSVal = Result;
+  APValue &RHSVal = Result;
 
   // Handle cases like (unsigned long)&a + 4.
   if (E->isAdditiveOp() && LHSVal.isLValue() && RHSVal.isInt()) {
@@ -4914,7 +4839,7 @@
     if (LHSAddrExpr->getLabel()->getDeclContext() !=
         RHSAddrExpr->getLabel()->getDeclContext())
       return false;
-    Result = CCValue(LHSAddrExpr, RHSAddrExpr);
+    Result = APValue(LHSAddrExpr, RHSAddrExpr);
     return true;
   }
 
@@ -5369,7 +5294,7 @@
   FloatExprEvaluator(EvalInfo &info, APFloat &result)
     : ExprEvaluatorBaseTy(info), Result(result) {}
 
-  bool Success(const CCValue &V, const Expr *e) {
+  bool Success(const APValue &V, const Expr *e) {
     Result = V.getFloat();
     return true;
   }
@@ -5602,7 +5527,7 @@
   ComplexExprEvaluator(EvalInfo &info, ComplexValue &Result)
     : ExprEvaluatorBaseTy(info), Result(Result) {}
 
-  bool Success(const CCValue &V, const Expr *e) {
+  bool Success(const APValue &V, const Expr *e) {
     Result.setFrom(V);
     return true;
   }
@@ -5981,7 +5906,7 @@
 public:
   VoidExprEvaluator(EvalInfo &Info) : ExprEvaluatorBaseTy(Info) {}
 
-  bool Success(const CCValue &V, const Expr *e) { return true; }
+  bool Success(const APValue &V, const Expr *e) { return true; }
 
   bool VisitCastExpr(const CastExpr *E) {
     switch (E->getCastKind()) {
@@ -6004,7 +5929,7 @@
 // Top level Expr::EvaluateAsRValue method.
 //===----------------------------------------------------------------------===//
 
-static bool Evaluate(CCValue &Result, EvalInfo &Info, const Expr *E) {
+static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E) {
   // In C, function designators are not lvalues, but we evaluate them as if they
   // are.
   if (E->isGLValue() || E->getType()->isFunctionType()) {
@@ -6027,7 +5952,7 @@
     llvm::APFloat F(0.0);
     if (!EvaluateFloat(E, F, Info))
       return false;
-    Result = CCValue(F);
+    Result = APValue(F);
   } else if (E->getType()->isAnyComplexType()) {
     ComplexValue C;
     if (!EvaluateComplex(E, C, Info))
@@ -6089,11 +6014,7 @@
   }
 
   // For any other type, in-place evaluation is unimportant.
-  CCValue CoreConstResult;
-  if (!Evaluate(CoreConstResult, Info, E))
-    return false;
-  Result = CoreConstResult.toAPValue();
-  return true;
+  return Evaluate(Result, Info, E);
 }
 
 /// EvaluateAsRValue - Try to evaluate this expression, performing an implicit
@@ -6102,20 +6023,17 @@
   if (!CheckLiteralType(Info, E))
     return false;
 
-  CCValue Value;
-  if (!::Evaluate(Value, Info, E))
+  if (!::Evaluate(Result, Info, E))
     return false;
 
   if (E->isGLValue()) {
     LValue LV;
-    LV.setFrom(Value);
-    if (!HandleLValueToRValueConversion(Info, E, E->getType(), LV, Value))
+    LV.setFrom(Info.Ctx, Result);
+    if (!HandleLValueToRValueConversion(Info, E, E->getType(), LV, Result))
       return false;
   }
 
-  // Check this core constant expression is a constant expression, and if so,
-  // convert it to one.
-  Result = Value.toAPValue();
+  // Check this core constant expression is a constant expression.
   return CheckConstantExpression(Info, E->getExprLoc(), E->getType(), Result);
 }
 
@@ -6147,9 +6065,7 @@
                                       const ASTContext &Ctx) const {
   EvalResult Scratch;
   return EvaluateAsRValue(Scratch, Ctx) &&
-         HandleConversionToBool(CCValue(const_cast<ASTContext&>(Ctx),
-                                        Scratch.Val, CCValue::GlobalValue()),
-                                Result);
+         HandleConversionToBool(Scratch.Val, Result);
 }
 
 bool Expr::EvaluateAsInt(APSInt &Result, const ASTContext &Ctx,
@@ -6175,9 +6091,7 @@
                                      Ctx.getLValueReferenceType(getType()), LV))
     return false;
 
-  CCValue Tmp;
-  LV.moveInto(Tmp);
-  Result.Val = Tmp.toAPValue();
+  LV.moveInto(Result.Val);
   return true;
 }
 
@@ -6752,14 +6666,12 @@
 
   SourceLocation Loc = FD->getLocation();
 
-  if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(FD)) {
-    APValue Scratch;
+  APValue Scratch;
+  if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(FD))
     HandleConstructorCall(Loc, This, Args, CD, Info, Scratch);
-  } else {
-    CCValue Scratch;
+  else
     HandleFunctionCall(Loc, FD, (MD && MD->isInstance()) ? &This : 0,
                        Args, FD->getBody(), Info, Scratch);
-  }
 
   return Diags.empty();
 }

Modified: cfe/branches/tooling/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ItaniumMangle.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/branches/tooling/lib/AST/ItaniumMangle.cpp Tue Mar  6 07:07:43 2012
@@ -553,8 +553,7 @@
     return;
   }
 
-  while (isa<LinkageSpecDecl>(DC))
-    DC = getEffectiveParentContext(DC);
+  DC = IgnoreLinkageSpecDecls(DC);
 
   if (DC->isTranslationUnit() || isStdNamespace(DC)) {
     // Check if we have a template.
@@ -594,7 +593,8 @@
 void CXXNameMangler::mangleUnscopedName(const NamedDecl *ND) {
   //  <unscoped-name> ::= <unqualified-name>
   //                  ::= St <unqualified-name>   # ::std::
-  if (isStdNamespace(getEffectiveDeclContext(ND)))
+
+  if (isStdNamespace(IgnoreLinkageSpecDecls(getEffectiveDeclContext(ND))))
     Out << "St";
 
   mangleUnqualifiedName(ND);
@@ -1393,8 +1393,7 @@
   //           ::= # empty
   //           ::= <substitution>
 
-  while (isa<LinkageSpecDecl>(DC))
-    DC = getEffectiveParentContext(DC);
+  DC = IgnoreLinkageSpecDecls(DC);
 
   if (DC->isTranslationUnit())
     return;

Modified: cfe/branches/tooling/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/Stmt.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/Stmt.cpp (original)
+++ cfe/branches/tooling/lib/AST/Stmt.cpp Tue Mar  6 07:07:43 2012
@@ -78,11 +78,9 @@
   ++getStmtInfoTableEntry(s).Counter;
 }
 
-static bool StatSwitch = false;
-
-bool Stmt::CollectingStats(bool Enable) {
-  if (Enable) StatSwitch = true;
-  return StatSwitch;
+bool Stmt::StatisticsEnabled = false;
+void Stmt::EnableStatistics() {
+  StatisticsEnabled = true;
 }
 
 Stmt *Stmt::IgnoreImplicit() {

Modified: cfe/branches/tooling/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/StmtProfile.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/StmtProfile.cpp (original)
+++ cfe/branches/tooling/lib/AST/StmtProfile.cpp Tue Mar  6 07:07:43 2012
@@ -69,8 +69,12 @@
 
 void StmtProfiler::VisitStmt(const Stmt *S) {
   ID.AddInteger(S->getStmtClass());
-  for (Stmt::const_child_range C = S->children(); C; ++C)
-    Visit(*C);
+  for (Stmt::const_child_range C = S->children(); C; ++C) {
+    if (*C)
+      Visit(*C);
+    else
+      ID.AddInteger(0);
+  }
 }
 
 void StmtProfiler::VisitDeclStmt(const DeclStmt *S) {

Modified: cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp (original)
+++ cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp Tue Mar  6 07:07:43 2012
@@ -24,7 +24,7 @@
 #include "clang/Analysis/CFG.h"
 #include "clang/Analysis/CFGStmtMap.h"
 #include "clang/Analysis/Support/BumpVector.h"
-#include "llvm/ADT/SaveAndRestore.h"
+#include "llvm/Support/SaveAndRestore.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/Support/ErrorHandling.h"
 

Modified: cfe/branches/tooling/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Analysis/CFG.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Analysis/CFG.cpp (original)
+++ cfe/branches/tooling/lib/Analysis/CFG.cpp Tue Mar  6 07:07:43 2012
@@ -12,7 +12,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/ADT/SaveAndRestore.h"
+#include "llvm/Support/SaveAndRestore.h"
 #include "clang/Analysis/CFG.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/StmtVisitor.h"

Modified: cfe/branches/tooling/lib/Analysis/ThreadSafety.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Analysis/ThreadSafety.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Analysis/ThreadSafety.cpp (original)
+++ cfe/branches/tooling/lib/Analysis/ThreadSafety.cpp Tue Mar  6 07:07:43 2012
@@ -126,12 +126,56 @@
         DeclSeq.push_back(0);  // Use 0 to represent 'this'.
         return;  // mutexID is still valid in this case
       }
-    } else if (UnaryOperator *UOE = dyn_cast<UnaryOperator>(Exp))
+    } else if (CXXMemberCallExpr *CMCE = dyn_cast<CXXMemberCallExpr>(Exp)) {
+      DeclSeq.push_back(CMCE->getMethodDecl()->getCanonicalDecl());
+      buildMutexID(CMCE->getImplicitObjectArgument(),
+                   D, Parent, NumArgs, FunArgs);
+      unsigned NumCallArgs = CMCE->getNumArgs();
+      Expr** CallArgs = CMCE->getArgs();
+      for (unsigned i = 0; i < NumCallArgs; ++i) {
+        buildMutexID(CallArgs[i], D, Parent, NumArgs, FunArgs);
+      }
+    } else if (CallExpr *CE = dyn_cast<CallExpr>(Exp)) {
+      buildMutexID(CE->getCallee(), D, Parent, NumArgs, FunArgs);
+      unsigned NumCallArgs = CE->getNumArgs();
+      Expr** CallArgs = CE->getArgs();
+      for (unsigned i = 0; i < NumCallArgs; ++i) {
+        buildMutexID(CallArgs[i], D, Parent, NumArgs, FunArgs);
+      }
+    } else if (BinaryOperator *BOE = dyn_cast<BinaryOperator>(Exp)) {
+      buildMutexID(BOE->getLHS(), D, Parent, NumArgs, FunArgs);
+      buildMutexID(BOE->getRHS(), D, Parent, NumArgs, FunArgs);
+    } else if (UnaryOperator *UOE = dyn_cast<UnaryOperator>(Exp)) {
       buildMutexID(UOE->getSubExpr(), D, Parent, NumArgs, FunArgs);
-    else if (CastExpr *CE = dyn_cast<CastExpr>(Exp))
+    } else if (ArraySubscriptExpr *ASE = dyn_cast<ArraySubscriptExpr>(Exp)) {
+      buildMutexID(ASE->getBase(), D, Parent, NumArgs, FunArgs);
+      buildMutexID(ASE->getIdx(), D, Parent, NumArgs, FunArgs);
+    } else if (AbstractConditionalOperator *CE =
+                 dyn_cast<AbstractConditionalOperator>(Exp)) {
+      buildMutexID(CE->getCond(), D, Parent, NumArgs, FunArgs);
+      buildMutexID(CE->getTrueExpr(), D, Parent, NumArgs, FunArgs);
+      buildMutexID(CE->getFalseExpr(), D, Parent, NumArgs, FunArgs);
+    } else if (ChooseExpr *CE = dyn_cast<ChooseExpr>(Exp)) {
+      buildMutexID(CE->getCond(), D, Parent, NumArgs, FunArgs);
+      buildMutexID(CE->getLHS(), D, Parent, NumArgs, FunArgs);
+      buildMutexID(CE->getRHS(), D, Parent, NumArgs, FunArgs);
+    } else if (CastExpr *CE = dyn_cast<CastExpr>(Exp)) {
       buildMutexID(CE->getSubExpr(), D, Parent, NumArgs, FunArgs);
-    else
-      DeclSeq.clear(); // Mark as invalid lock expression.
+    } else if (ParenExpr *PE = dyn_cast<ParenExpr>(Exp)) {
+      buildMutexID(PE->getSubExpr(), D, Parent, NumArgs, FunArgs);
+    } else if (isa<CharacterLiteral>(Exp) ||
+             isa<CXXNullPtrLiteralExpr>(Exp) ||
+             isa<GNUNullExpr>(Exp) ||
+             isa<CXXBoolLiteralExpr>(Exp) ||
+             isa<FloatingLiteral>(Exp) ||
+             isa<ImaginaryLiteral>(Exp) ||
+             isa<IntegerLiteral>(Exp) ||
+             isa<StringLiteral>(Exp) ||
+             isa<ObjCStringLiteral>(Exp)) {
+      return;  // FIXME: Ignore literals for now
+    } else {
+      // Ignore.  FIXME: mark as invalid expression?
+    }
   }
 
   /// \brief Construct a MutexID from an expression.
@@ -233,11 +277,11 @@
   /// The caret will point unambiguously to the lock expression, so using this
   /// name in diagnostics is a way to get simple, and consistent, mutex names.
   /// We do not want to output the entire expression text for security reasons.
-  StringRef getName() const {
+  std::string getName() const {
     assert(isValid());
     if (!DeclSeq.front())
       return "this";  // Use 0 to represent 'this'.
-    return DeclSeq.front()->getName();
+    return DeclSeq.front()->getNameAsString();
   }
 
   void Profile(llvm::FoldingSetNodeID &ID) const {
@@ -1526,6 +1570,10 @@
       if (*PI == 0 || !VisitedBlocks.alreadySet(*PI))
         continue;
 
+      // Ignore edges from blocks that can't return.
+      if ((*PI)->hasNoReturnElement())
+        continue;
+
       // If the previous block ended in a 'continue' or 'break' statement, then
       // a difference in locksets is probably due to a bug in that block, rather
       // than in some other predecessor. In that case, keep the other

Modified: cfe/branches/tooling/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Analysis/UninitializedValues.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/branches/tooling/lib/Analysis/UninitializedValues.cpp Tue Mar  6 07:07:43 2012
@@ -21,7 +21,7 @@
 #include "clang/Analysis/AnalysisContext.h"
 #include "clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h"
 #include "clang/Analysis/Analyses/UninitializedValues.h"
-#include "llvm/ADT/SaveAndRestore.h"
+#include "llvm/Support/SaveAndRestore.h"
 
 using namespace clang;
 

Modified: cfe/branches/tooling/lib/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/IdentifierTable.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/IdentifierTable.cpp (original)
+++ cfe/branches/tooling/lib/Basic/IdentifierTable.cpp Tue Mar  6 07:07:43 2012
@@ -41,7 +41,7 @@
   ChangedAfterLoad = false;
   RevertedTokenID = false;
   OutOfDate = false;
-  IsImport = false;
+  IsModulesImport = false;
   FETokenInfo = 0;
   Entry = 0;
 }
@@ -78,6 +78,10 @@
   // Populate the identifier table with info about keywords for the current
   // language.
   AddKeywords(LangOpts);
+      
+
+  // Add the '_experimental_modules_import' contextual keyword.
+  get("__experimental_modules_import").setModulesImport(true);
 }
 
 //===----------------------------------------------------------------------===//

Modified: cfe/branches/tooling/lib/Basic/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/Makefile?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/Makefile (original)
+++ cfe/branches/tooling/lib/Basic/Makefile Tue Mar  6 07:07:43 2012
@@ -1,10 +1,10 @@
 ##===- clang/lib/Basic/Makefile ----------------------------*- Makefile -*-===##
-# 
+#
 #                     The LLVM Compiler Infrastructure
 #
 # This file is distributed under the University of Illinois Open Source
 # License. See LICENSE.TXT for details.
-# 
+#
 ##===----------------------------------------------------------------------===##
 #
 #  This implements the Basic library for the C-Language front-end.
@@ -17,17 +17,24 @@
 include $(CLANG_LEVEL)/Makefile
 
 SVN_REVISION := $(strip \
-	$(shell $(LLVM_SRC_ROOT)/utils/GetSourceVersion $(PROJ_SRC_DIR)/../..))
+        $(shell $(LLVM_SRC_ROOT)/utils/GetSourceVersion $(PROJ_SRC_DIR)/../..))
 
 SVN_REPOSITORY := $(strip \
-	$(shell $(LLVM_SRC_ROOT)/utils/GetRepositoryPath $(PROJ_SRC_DIR)/../..))
+        $(shell $(LLVM_SRC_ROOT)/utils/GetRepositoryPath $(PROJ_SRC_DIR)/../..))
+
+LLVM_REVISION := $(strip \
+        $(shell $(LLVM_SRC_ROOT)/utils/GetSourceVersion $(LLVM_SRC_ROOT)))
+
+LLVM_REPOSITORY := $(strip \
+        $(shell $(LLVM_SRC_ROOT)/utils/GetRepositoryPath $(LLVM_SRC_ROOT)))
 
 CPP.Defines += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include \
-         -DSVN_REVISION='"$(SVN_REVISION)"' -DSVN_REPOSITORY='"$(SVN_REPOSITORY)"'
+         -DSVN_REVISION='"$(SVN_REVISION)"' -DSVN_REPOSITORY='"$(SVN_REPOSITORY)"' \
+         -DLLVM_REVISION='"$(LLVM_REVISION)"' -DLLVM_REPOSITORY='"$(LLVM_REPOSITORY)"'
 
 $(ObjDir)/.ver-svn .ver: $(ObjDir)/.dir
-	@if [ '$(SVN_REVISION)' != '$(shell cat $(ObjDir)/.ver-svn 2>/dev/null)' ]; then\
-		echo '$(SVN_REVISION)' > $(ObjDir)/.ver-svn;			\
+	@if [ '$(SVN_REVISION) $(LLVM_REVISION)' != '$(shell cat $(ObjDir)/.ver-svn 2>/dev/null)' ]; then\
+		echo '$(SVN_REVISION) $(LLVM_REVISION)' > $(ObjDir)/.ver-svn;                    \
 	fi
 $(ObjDir)/.ver-svn: .ver
 $(ObjDir)/Version.o: $(ObjDir)/.ver-svn

Modified: cfe/branches/tooling/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/Targets.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/Targets.cpp (original)
+++ cfe/branches/tooling/lib/Basic/Targets.cpp Tue Mar  6 07:07:43 2012
@@ -498,7 +498,7 @@
       Builder.defineMacro("_XOPEN_SOURCE", "600");
     else
       Builder.defineMacro("_XOPEN_SOURCE", "500");
-    if (Opts.CPlusPlus0x)
+    if (Opts.CPlusPlus)
       Builder.defineMacro("__C99FEATURES__");
     Builder.defineMacro("_LARGEFILE_SOURCE");
     Builder.defineMacro("_LARGEFILE64_SOURCE");
@@ -865,6 +865,8 @@
     case llvm::Triple::FreeBSD:
     case llvm::Triple::NetBSD:
       SizeType = UnsignedInt;
+      PtrDiffType = SignedInt;
+      IntPtrType = SignedInt;
       break;
     default:
       break;
@@ -1005,7 +1007,7 @@
     }
 
     virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
-                                   const std::string &Name,
+                                   StringRef Name,
                                    bool Enabled) const;
   };
 
@@ -1027,7 +1029,7 @@
   }
 
   bool PTXTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
-                                        const std::string &Name,
+                                        StringRef Name,
                                         bool Enabled) const {
     if(std::binary_search(AvailableFeatures.begin(), AvailableFeatures.end(),
                           Name)) {
@@ -1420,7 +1422,7 @@
   virtual void getTargetDefines(const LangOptions &Opts,
                                 MacroBuilder &Builder) const;
   virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
-                                 const std::string &Name,
+                                 StringRef Name,
                                  bool Enabled) const;
   virtual void getDefaultFeatures(llvm::StringMap<bool> &Features) const;
   virtual bool hasFeature(StringRef Feature) const;
@@ -1699,7 +1701,7 @@
 }
 
 bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
-                                      const std::string &Name,
+                                      StringRef Name,
                                       bool Enabled) const {
   // FIXME: This *really* should not be here.  We need some way of translating
   // options into llvm subtarget features.
@@ -1813,38 +1815,40 @@
     if (Features[i][0] == '-')
       continue;
 
-    if (Features[i].substr(1) == "aes") {
+    StringRef Feature = StringRef(Features[i]).substr(1);
+
+    if (Feature == "aes") {
       HasAES = true;
       continue;
     }
 
-    if (Features[i].substr(1) == "lzcnt") {
+    if (Feature == "lzcnt") {
       HasLZCNT = true;
       continue;
     }
 
-    if (Features[i].substr(1) == "bmi") {
+    if (Feature == "bmi") {
       HasBMI = true;
       continue;
     }
 
-    if (Features[i].substr(1) == "bmi2") {
+    if (Feature == "bmi2") {
       HasBMI2 = true;
       continue;
     }
 
-    if (Features[i].substr(1) == "popcnt") {
+    if (Feature == "popcnt") {
       HasPOPCNT = true;
       continue;
     }
 
-    if (Features[i].substr(1) == "fma4") {
+    if (Feature == "fma4") {
       HasFMA4 = true;
       continue;
     }
 
     assert(Features[i][0] == '+' && "Invalid target feature!");
-    X86SSEEnum Level = llvm::StringSwitch<X86SSEEnum>(Features[i].substr(1))
+    X86SSEEnum Level = llvm::StringSwitch<X86SSEEnum>(Feature)
       .Case("avx2", AVX2)
       .Case("avx", AVX)
       .Case("sse42", SSE42)
@@ -1857,7 +1861,7 @@
     SSELevel = std::max(SSELevel, Level);
 
     MMX3DNowEnum ThreeDNowLevel =
-      llvm::StringSwitch<MMX3DNowEnum>(Features[i].substr(1))
+      llvm::StringSwitch<MMX3DNowEnum>(Feature)
         .Case("3dnowa", AMD3DNowAthlon)
         .Case("3dnow", AMD3DNow)
         .Case("mmx", MMX)
@@ -2711,7 +2715,7 @@
   }
 
   virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
-                                 const std::string &Name,
+                                 StringRef Name,
                                  bool Enabled) const {
     if (Name == "soft-float" || Name == "soft-float-abi" ||
         Name == "vfp2" || Name == "vfp3" || Name == "neon" || Name == "d16") {
@@ -3146,7 +3150,7 @@
                         "i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32";
   }
   virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
-                                 const std::string &Name,
+                                 StringRef Name,
                                  bool Enabled) const {
     if (Name == "soft-float")
       Features[Name] = Enabled;
@@ -4115,8 +4119,7 @@
   Opts.Features.clear();
   for (llvm::StringMap<bool>::const_iterator it = Features.begin(),
          ie = Features.end(); it != ie; ++it)
-    Opts.Features.push_back(std::string(it->second ? "+" : "-") +
-                            it->first().str());
+    Opts.Features.push_back((it->second ? "+" : "-") + it->first().str());
   Target->HandleTargetFeatures(Opts.Features);
 
   return Target.take();

Modified: cfe/branches/tooling/lib/Basic/Version.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/Version.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/Version.cpp (original)
+++ cfe/branches/tooling/lib/Basic/Version.cpp Tue Mar  6 07:07:43 2012
@@ -19,7 +19,7 @@
 #include <cstdlib>
 
 namespace clang {
-  
+
 std::string getClangRepositoryPath() {
 #if defined(CLANG_REPOSITORY_STRING)
   return CLANG_REPOSITORY_STRING;
@@ -50,6 +50,21 @@
 #endif
 }
 
+std::string getLLVMRepositoryPath() {
+#ifdef LLVM_REPOSITORY
+  StringRef URL(LLVM_REPOSITORY);
+#else
+  StringRef URL("");
+#endif
+
+  // Trim path prefix off, assuming path came from standard llvm path.
+  size_t Start = URL.find("llvm/");
+  if (Start != StringRef::npos)
+    URL = URL.substr(Start + 5);
+
+  return URL;
+}
+
 std::string getClangRevision() {
 #ifdef SVN_REVISION
   return SVN_REVISION;
@@ -58,6 +73,14 @@
 #endif
 }
 
+std::string getLLVMRevision() {
+#ifdef LLVM_REVISION
+  return LLVM_REVISION;
+#else
+  return "";
+#endif
+}
+
 std::string getClangFullRepositoryVersion() {
   std::string buf;
   llvm::raw_string_ostream OS(buf);
@@ -70,9 +93,17 @@
       OS << ' ';
     OS << Revision;
   }
+  // Support LLVM in a separate repository.
+  std::string LLVMRev = getLLVMRevision();
+  if (!LLVMRev.empty() && LLVMRev != Revision) {
+    std::string LLVMRepo = getLLVMRepositoryPath();
+    if (!LLVMRepo.empty())
+      OS << ' ' << LLVMRepo;
+    OS << ' ' << LLVMRev;
+  }
   return OS.str();
 }
-  
+
 std::string getClangFullVersion() {
   std::string buf;
   llvm::raw_string_ostream OS(buf);

Modified: cfe/branches/tooling/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/BackendUtil.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/BackendUtil.cpp Tue Mar  6 07:07:43 2012
@@ -126,6 +126,11 @@
   PM.add(createAddressSanitizerPass());
 }
 
+static void addThreadSanitizerPass(const PassManagerBuilder &Builder,
+                                   PassManagerBase &PM) {
+  PM.add(createThreadSanitizerPass());
+}
+
 void EmitAssemblyHelper::CreatePasses() {
   unsigned OptLevel = CodeGenOpts.OptimizationLevel;
   CodeGenOptions::InliningMethod Inlining = CodeGenOpts.Inlining;
@@ -161,7 +166,14 @@
     PMBuilder.addExtension(PassManagerBuilder::EP_EnabledOnOptLevel0,
                            addAddressSanitizerPass);
   }
-  
+
+  if (LangOpts.ThreadSanitizer) {
+    PMBuilder.addExtension(PassManagerBuilder::EP_ScalarOptimizerLate,
+                           addThreadSanitizerPass);
+    PMBuilder.addExtension(PassManagerBuilder::EP_EnabledOnOptLevel0,
+                           addThreadSanitizerPass);
+  }
+
   // Figure out TargetLibraryInfo.
   Triple TargetTriple(TheModule->getTargetTriple());
   PMBuilder.LibraryInfo = new TargetLibraryInfo(TargetTriple);
@@ -351,6 +363,12 @@
   // Create the code generator passes.
   PassManager *PM = getCodeGenPasses();
 
+  // Add LibraryInfo.
+  TargetLibraryInfo *TLI = new TargetLibraryInfo();
+  if (!CodeGenOpts.SimplifyLibCalls)
+    TLI->disableAllFunctions();
+  PM->add(TLI);
+
   // Normal mode, emit a .s or .o file by running the code generator. Note,
   // this also adds codegenerator level optimization passes.
   TargetMachine::CodeGenFileType CGFT = TargetMachine::CGFT_AssemblyFile;

Modified: cfe/branches/tooling/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGBlocks.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGBlocks.cpp Tue Mar  6 07:07:43 2012
@@ -622,10 +622,11 @@
 
 llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) {
   // Using the computed layout, generate the actual block function.
+  bool isLambdaConv = blockInfo.getBlockDecl()->isConversionFromLambda();
   llvm::Constant *blockFn
     = CodeGenFunction(CGM).GenerateBlockFunction(CurGD, blockInfo,
                                                  CurFuncDecl, LocalDeclMap,
-                                                 InLambdaConversionToBlock);
+                                                 isLambdaConv);
   blockFn = llvm::ConstantExpr::getBitCast(blockFn, VoidPtrTy);
 
   // If there is nothing to capture, we can emit this as a global block.
@@ -700,11 +701,10 @@
       src = Builder.CreateStructGEP(LoadBlockStruct(),
                                     enclosingCapture.getIndex(),
                                     "block.capture.addr");
-    } else if (InLambdaConversionToBlock) {
+    } else if (blockDecl->isConversionFromLambda()) {
       // The lambda capture in a lambda's conversion-to-block-pointer is
-      // special; we know its argument is an lvalue we can simply emit.
-      CXXConstructExpr *CE = cast<CXXConstructExpr>(ci->getCopyExpr());
-      src = EmitLValue(CE->getArg(0)).getAddress();
+      // special; we'll simply emit it directly.
+      src = 0;
     } else {
       // This is a [[type]]*.
       src = LocalDeclMap[variable];
@@ -726,7 +726,19 @@
 
     // If we have a copy constructor, evaluate that into the block field.
     } else if (const Expr *copyExpr = ci->getCopyExpr()) {
-      EmitSynthesizedCXXCopyCtor(blockField, src, copyExpr);
+      if (blockDecl->isConversionFromLambda()) {
+        // If we have a lambda conversion, emit the expression
+        // directly into the block instead.
+        CharUnits Align = getContext().getTypeAlignInChars(type);
+        AggValueSlot Slot =
+            AggValueSlot::forAddr(blockField, Align, Qualifiers(),
+                                  AggValueSlot::IsDestructed,
+                                  AggValueSlot::DoesNotNeedGCBarriers,
+                                  AggValueSlot::IsNotAliased);
+        EmitAggExpr(copyExpr, Slot);
+      } else {
+        EmitSynthesizedCXXCopyCtor(blockField, src, copyExpr);
+      }
 
     // If it's a reference variable, copy the reference into the block field.
     } else if (type->isReferenceType()) {

Modified: cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp Tue Mar  6 07:07:43 2012
@@ -540,7 +540,8 @@
   case Builtin::BI__builtin_bzero: {
     Value *Address = EmitScalarExpr(E->getArg(0));
     Value *SizeVal = EmitScalarExpr(E->getArg(1));
-    Builder.CreateMemSet(Address, Builder.getInt8(0), SizeVal, 1, false);
+    unsigned Align = GetPointeeAlignment(E->getArg(0));
+    Builder.CreateMemSet(Address, Builder.getInt8(0), SizeVal, Align, false);
     return RValue::get(Address);
   }
   case Builtin::BImemcpy:
@@ -548,7 +549,9 @@
     Value *Address = EmitScalarExpr(E->getArg(0));
     Value *SrcAddr = EmitScalarExpr(E->getArg(1));
     Value *SizeVal = EmitScalarExpr(E->getArg(2));
-    Builder.CreateMemCpy(Address, SrcAddr, SizeVal, 1, false);
+    unsigned Align = std::min(GetPointeeAlignment(E->getArg(0)),
+                              GetPointeeAlignment(E->getArg(1)));
+    Builder.CreateMemCpy(Address, SrcAddr, SizeVal, Align, false);
     return RValue::get(Address);
   }
       
@@ -563,7 +566,9 @@
     Value *Dest = EmitScalarExpr(E->getArg(0));
     Value *Src = EmitScalarExpr(E->getArg(1));
     Value *SizeVal = llvm::ConstantInt::get(Builder.getContext(), Size);
-    Builder.CreateMemCpy(Dest, Src, SizeVal, 1, false);
+    unsigned Align = std::min(GetPointeeAlignment(E->getArg(0)),
+                              GetPointeeAlignment(E->getArg(1)));
+    Builder.CreateMemCpy(Dest, Src, SizeVal, Align, false);
     return RValue::get(Dest);
   }
       
@@ -587,7 +592,9 @@
     Value *Dest = EmitScalarExpr(E->getArg(0));
     Value *Src = EmitScalarExpr(E->getArg(1));
     Value *SizeVal = llvm::ConstantInt::get(Builder.getContext(), Size);
-    Builder.CreateMemMove(Dest, Src, SizeVal, 1, false);
+    unsigned Align = std::min(GetPointeeAlignment(E->getArg(0)),
+                              GetPointeeAlignment(E->getArg(1)));
+    Builder.CreateMemMove(Dest, Src, SizeVal, Align, false);
     return RValue::get(Dest);
   }
 
@@ -596,7 +603,9 @@
     Value *Address = EmitScalarExpr(E->getArg(0));
     Value *SrcAddr = EmitScalarExpr(E->getArg(1));
     Value *SizeVal = EmitScalarExpr(E->getArg(2));
-    Builder.CreateMemMove(Address, SrcAddr, SizeVal, 1, false);
+    unsigned Align = std::min(GetPointeeAlignment(E->getArg(0)),
+                              GetPointeeAlignment(E->getArg(1)));
+    Builder.CreateMemMove(Address, SrcAddr, SizeVal, Align, false);
     return RValue::get(Address);
   }
   case Builtin::BImemset:
@@ -605,7 +614,8 @@
     Value *ByteVal = Builder.CreateTrunc(EmitScalarExpr(E->getArg(1)),
                                          Builder.getInt8Ty());
     Value *SizeVal = EmitScalarExpr(E->getArg(2));
-    Builder.CreateMemSet(Address, ByteVal, SizeVal, 1, false);
+    unsigned Align = GetPointeeAlignment(E->getArg(0));
+    Builder.CreateMemSet(Address, ByteVal, SizeVal, Align, false);
     return RValue::get(Address);
   }
   case Builtin::BI__builtin___memset_chk: {
@@ -620,7 +630,8 @@
     Value *ByteVal = Builder.CreateTrunc(EmitScalarExpr(E->getArg(1)),
                                          Builder.getInt8Ty());
     Value *SizeVal = llvm::ConstantInt::get(Builder.getContext(), Size);
-    Builder.CreateMemSet(Address, ByteVal, SizeVal, 1, false);
+    unsigned Align = GetPointeeAlignment(E->getArg(0));
+    Builder.CreateMemSet(Address, ByteVal, SizeVal, Align, false);
     
     return RValue::get(Address);
   }
@@ -1248,14 +1259,18 @@
 /// GetPointeeAlignment - Given an expression with a pointer type, find the
 /// alignment of the type referenced by the pointer.  Skip over implicit
 /// casts.
-static Value *GetPointeeAlignment(CodeGenFunction &CGF, const Expr *Addr) {
+unsigned CodeGenFunction::GetPointeeAlignment(const Expr *Addr) {
   unsigned Align = 1;
   // Check if the type is a pointer.  The implicit cast operand might not be.
   while (Addr->getType()->isPointerType()) {
     QualType PtTy = Addr->getType()->getPointeeType();
-    unsigned NewA = CGF.getContext().getTypeAlignInChars(PtTy).getQuantity();
-    if (NewA > Align)
-      Align = NewA;
+    
+    // Can't get alignment of incomplete types.
+    if (!PtTy->isIncompleteType()) {
+      unsigned NewA = getContext().getTypeAlignInChars(PtTy).getQuantity();
+      if (NewA > Align)
+        Align = NewA;
+    }
 
     // If the address is an implicit cast, repeat with the cast operand.
     if (const ImplicitCastExpr *CastAddr = dyn_cast<ImplicitCastExpr>(Addr)) {
@@ -1264,7 +1279,14 @@
     }
     break;
   }
-  return llvm::ConstantInt::get(CGF.Int32Ty, Align);
+  return Align;
+}
+
+/// GetPointeeAlignmentValue - Given an expression with a pointer type, find
+/// the alignment of the type referenced by the pointer.  Skip over implicit
+/// casts.  Return the alignment as an llvm::Value.
+Value *CodeGenFunction::GetPointeeAlignmentValue(const Expr *Addr) {
+  return llvm::ConstantInt::get(Int32Ty, GetPointeeAlignment(Addr));
 }
 
 Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
@@ -1510,7 +1532,7 @@
     return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vhsub");
   case ARM::BI__builtin_neon_vld1_v:
   case ARM::BI__builtin_neon_vld1q_v:
-    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
+    Ops.push_back(GetPointeeAlignmentValue(E->getArg(0)));
     return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vld1, Ty),
                         Ops, "vld1");
   case ARM::BI__builtin_neon_vld1_lane_v:
@@ -1519,7 +1541,7 @@
     Ty = llvm::PointerType::getUnqual(VTy->getElementType());
     Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
     LoadInst *Ld = Builder.CreateLoad(Ops[0]);
-    Value *Align = GetPointeeAlignment(*this, E->getArg(0));
+    Value *Align = GetPointeeAlignmentValue(E->getArg(0));
     Ld->setAlignment(cast<ConstantInt>(Align)->getZExtValue());
     return Builder.CreateInsertElement(Ops[1], Ld, Ops[2], "vld1_lane");
   }
@@ -1529,7 +1551,7 @@
     Ty = llvm::PointerType::getUnqual(VTy->getElementType());
     Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
     LoadInst *Ld = Builder.CreateLoad(Ops[0]);
-    Value *Align = GetPointeeAlignment(*this, E->getArg(0));
+    Value *Align = GetPointeeAlignmentValue(E->getArg(0));
     Ld->setAlignment(cast<ConstantInt>(Align)->getZExtValue());
     llvm::Constant *CI = ConstantInt::get(Int32Ty, 0);
     Ops[0] = Builder.CreateInsertElement(V, Ld, CI);
@@ -1538,7 +1560,7 @@
   case ARM::BI__builtin_neon_vld2_v:
   case ARM::BI__builtin_neon_vld2q_v: {
     Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vld2, Ty);
-    Value *Align = GetPointeeAlignment(*this, E->getArg(1));
+    Value *Align = GetPointeeAlignmentValue(E->getArg(1));
     Ops[1] = Builder.CreateCall2(F, Ops[1], Align, "vld2");
     Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
     Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
@@ -1547,7 +1569,7 @@
   case ARM::BI__builtin_neon_vld3_v:
   case ARM::BI__builtin_neon_vld3q_v: {
     Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vld3, Ty);
-    Value *Align = GetPointeeAlignment(*this, E->getArg(1));
+    Value *Align = GetPointeeAlignmentValue(E->getArg(1));
     Ops[1] = Builder.CreateCall2(F, Ops[1], Align, "vld3");
     Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
     Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
@@ -1556,7 +1578,7 @@
   case ARM::BI__builtin_neon_vld4_v:
   case ARM::BI__builtin_neon_vld4q_v: {
     Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vld4, Ty);
-    Value *Align = GetPointeeAlignment(*this, E->getArg(1));
+    Value *Align = GetPointeeAlignmentValue(E->getArg(1));
     Ops[1] = Builder.CreateCall2(F, Ops[1], Align, "vld4");
     Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
     Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
@@ -1567,7 +1589,7 @@
     Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vld2lane, Ty);
     Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
     Ops[3] = Builder.CreateBitCast(Ops[3], Ty);
-    Ops.push_back(GetPointeeAlignment(*this, E->getArg(1)));
+    Ops.push_back(GetPointeeAlignmentValue(E->getArg(1)));
     Ops[1] = Builder.CreateCall(F, makeArrayRef(Ops).slice(1), "vld2_lane");
     Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
     Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
@@ -1579,7 +1601,7 @@
     Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
     Ops[3] = Builder.CreateBitCast(Ops[3], Ty);
     Ops[4] = Builder.CreateBitCast(Ops[4], Ty);
-    Ops.push_back(GetPointeeAlignment(*this, E->getArg(1)));
+    Ops.push_back(GetPointeeAlignmentValue(E->getArg(1)));
     Ops[1] = Builder.CreateCall(F, makeArrayRef(Ops).slice(1), "vld3_lane");
     Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
     Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
@@ -1592,7 +1614,7 @@
     Ops[3] = Builder.CreateBitCast(Ops[3], Ty);
     Ops[4] = Builder.CreateBitCast(Ops[4], Ty);
     Ops[5] = Builder.CreateBitCast(Ops[5], Ty);
-    Ops.push_back(GetPointeeAlignment(*this, E->getArg(1)));
+    Ops.push_back(GetPointeeAlignmentValue(E->getArg(1)));
     Ops[1] = Builder.CreateCall(F, makeArrayRef(Ops).slice(1), "vld3_lane");
     Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
     Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
@@ -1616,7 +1638,7 @@
       default: llvm_unreachable("unknown vld_dup intrinsic?");
       }
       Function *F = CGM.getIntrinsic(Int, Ty);
-      Value *Align = GetPointeeAlignment(*this, E->getArg(1));
+      Value *Align = GetPointeeAlignmentValue(E->getArg(1));
       Ops[1] = Builder.CreateCall2(F, Ops[1], Align, "vld_dup");
       Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
       Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
@@ -1643,7 +1665,7 @@
 
     llvm::Constant *CI = ConstantInt::get(Int32Ty, 0);
     Args.push_back(CI);
-    Args.push_back(GetPointeeAlignment(*this, E->getArg(1)));
+    Args.push_back(GetPointeeAlignmentValue(E->getArg(1)));
     
     Ops[1] = Builder.CreateCall(F, Args, "vld_dup");
     // splat lane 0 to all elts in each vector of the result.
@@ -1876,7 +1898,7 @@
     return Builder.CreateAdd(Ops[0], Ops[1]);
   case ARM::BI__builtin_neon_vst1_v:
   case ARM::BI__builtin_neon_vst1q_v:
-    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
+    Ops.push_back(GetPointeeAlignmentValue(E->getArg(0)));
     return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst1, Ty),
                         Ops, "");
   case ARM::BI__builtin_neon_vst1_lane_v:
@@ -1886,38 +1908,38 @@
     Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
     StoreInst *St = Builder.CreateStore(Ops[1],
                                         Builder.CreateBitCast(Ops[0], Ty));
-    Value *Align = GetPointeeAlignment(*this, E->getArg(0));
+    Value *Align = GetPointeeAlignmentValue(E->getArg(0));
     St->setAlignment(cast<ConstantInt>(Align)->getZExtValue());
     return St;
   }
   case ARM::BI__builtin_neon_vst2_v:
   case ARM::BI__builtin_neon_vst2q_v:
-    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
+    Ops.push_back(GetPointeeAlignmentValue(E->getArg(0)));
     return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst2, Ty),
                         Ops, "");
   case ARM::BI__builtin_neon_vst2_lane_v:
   case ARM::BI__builtin_neon_vst2q_lane_v:
-    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
+    Ops.push_back(GetPointeeAlignmentValue(E->getArg(0)));
     return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst2lane, Ty),
                         Ops, "");
   case ARM::BI__builtin_neon_vst3_v:
   case ARM::BI__builtin_neon_vst3q_v:
-    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
+    Ops.push_back(GetPointeeAlignmentValue(E->getArg(0)));
     return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst3, Ty),
                         Ops, "");
   case ARM::BI__builtin_neon_vst3_lane_v:
   case ARM::BI__builtin_neon_vst3q_lane_v:
-    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
+    Ops.push_back(GetPointeeAlignmentValue(E->getArg(0)));
     return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst3lane, Ty),
                         Ops, "");
   case ARM::BI__builtin_neon_vst4_v:
   case ARM::BI__builtin_neon_vst4q_v:
-    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
+    Ops.push_back(GetPointeeAlignmentValue(E->getArg(0)));
     return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst4, Ty),
                         Ops, "");
   case ARM::BI__builtin_neon_vst4_lane_v:
   case ARM::BI__builtin_neon_vst4q_lane_v:
-    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
+    Ops.push_back(GetPointeeAlignmentValue(E->getArg(0)));
     return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst4lane, Ty),
                         Ops, "");
   case ARM::BI__builtin_neon_vsubhn_v:

Modified: cfe/branches/tooling/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGClass.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGClass.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGClass.cpp Tue Mar  6 07:07:43 2012
@@ -1795,9 +1795,7 @@
     return;
   }
 
-  InLambdaConversionToBlock = true;
   EmitFunctionBody(Args);
-  InLambdaConversionToBlock = false;
 }
 
 void CodeGenFunction::EmitLambdaDelegatingInvokeBody(const CXXMethodDecl *MD) {

Modified: cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp Tue Mar  6 07:07:43 2012
@@ -749,44 +749,75 @@
                     SmallVectorImpl<llvm::Value *> &elements,
                     llvm::DIType RecordTy) {
   unsigned fieldNo = 0;
-  const FieldDecl *LastFD = 0;
-  bool IsMsStruct = record->hasAttr<MsStructAttr>();
-  
   const ASTRecordLayout &layout = CGM.getContext().getASTRecordLayout(record);
-  for (RecordDecl::field_iterator I = record->field_begin(),
-                                  E = record->field_end();
-       I != E; ++I, ++fieldNo) {
-    FieldDecl *field = *I;
-    if (IsMsStruct) {
-      // Zero-length bitfields following non-bitfield members are ignored
-      if (CGM.getContext().ZeroBitfieldFollowsNonBitfield((field), LastFD)) {
-        --fieldNo;
-        continue;
+  const CXXRecordDecl *CXXDecl = dyn_cast<CXXRecordDecl>(record);
+
+  // For C++11 Lambdas a Fields will be the same as a Capture, but the Capture
+  // has the name and the location of the variable so we should iterate over
+  // both concurrently.
+  if (CXXDecl && CXXDecl->isLambda()) {
+    RecordDecl::field_iterator Field = CXXDecl->field_begin();
+    unsigned fieldno = 0;
+    for (CXXRecordDecl::capture_const_iterator I = CXXDecl->captures_begin(),
+           E = CXXDecl->captures_end(); I != E; ++I, ++Field, ++fieldno) {
+      const LambdaExpr::Capture C = *I;
+      // TODO: Need to handle 'this' in some way by probably renaming the
+      // this of the lambda class and having a field member of 'this'.
+      if (C.capturesVariable()) {
+        VarDecl *V = C.getCapturedVar();
+        llvm::DIFile VUnit = getOrCreateFile(C.getLocation());
+        StringRef VName = V->getName();
+        uint64_t SizeInBitsOverride = 0;
+        if (Field->isBitField()) {
+          SizeInBitsOverride = Field->getBitWidthValue(CGM.getContext());
+          assert(SizeInBitsOverride && "found named 0-width bitfield");
+        }
+        llvm::DIType fieldType
+          = createFieldType(VName, Field->getType(), SizeInBitsOverride, C.getLocation(),
+                            Field->getAccess(), layout.getFieldOffset(fieldno),
+                            VUnit, RecordTy);
+        elements.push_back(fieldType);
       }
-      LastFD = field;
     }
+  } else {
+    bool IsMsStruct = record->hasAttr<MsStructAttr>();
+    const FieldDecl *LastFD = 0;
+    for (RecordDecl::field_iterator I = record->field_begin(),
+           E = record->field_end();
+         I != E; ++I, ++fieldNo) {
+      FieldDecl *field = *I;
+
+      if (IsMsStruct) {
+        // Zero-length bitfields following non-bitfield members are ignored
+        if (CGM.getContext().ZeroBitfieldFollowsNonBitfield((field), LastFD)) {
+          --fieldNo;
+          continue;
+        }
+        LastFD = field;
+      }
 
-    StringRef name = field->getName();
-    QualType type = field->getType();
+      StringRef name = field->getName();
+      QualType type = field->getType();
 
-    // Ignore unnamed fields unless they're anonymous structs/unions.
-    if (name.empty() && !type->isRecordType()) {
-      LastFD = field;
-      continue;
-    }
+      // Ignore unnamed fields unless they're anonymous structs/unions.
+      if (name.empty() && !type->isRecordType()) {
+        LastFD = field;
+        continue;
+      }
 
-    uint64_t SizeInBitsOverride = 0;
-    if (field->isBitField()) {
-      SizeInBitsOverride = field->getBitWidthValue(CGM.getContext());
-      assert(SizeInBitsOverride && "found named 0-width bitfield");
-    }
+      uint64_t SizeInBitsOverride = 0;
+      if (field->isBitField()) {
+        SizeInBitsOverride = field->getBitWidthValue(CGM.getContext());
+        assert(SizeInBitsOverride && "found named 0-width bitfield");
+      }
 
-    llvm::DIType fieldType
-      = createFieldType(name, type, SizeInBitsOverride,
-                        field->getLocation(), field->getAccess(),
-                        layout.getFieldOffset(fieldNo), tunit, RecordTy);
+      llvm::DIType fieldType
+        = createFieldType(name, type, SizeInBitsOverride,
+                          field->getLocation(), field->getAccess(),
+                          layout.getFieldOffset(fieldNo), tunit, RecordTy);
 
-    elements.push_back(fieldType);
+      elements.push_back(fieldType);
+    }
   }
 }
 

Modified: cfe/branches/tooling/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGExprAgg.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGExprAgg.cpp Tue Mar  6 07:07:43 2012
@@ -898,7 +898,7 @@
     return;
   }
 
-  llvm::Value *DestPtr = Dest.getAddr();
+  llvm::Value *DestPtr = EnsureSlot(E->getType()).getAddr();
 
   // Handle initialization of an array.
   if (E->getType()->isArrayType()) {

Modified: cfe/branches/tooling/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGExprCXX.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGExprCXX.cpp Tue Mar  6 07:07:43 2012
@@ -1819,7 +1819,7 @@
   CXXRecordDecl::field_iterator CurField = E->getLambdaClass()->field_begin();
   for (LambdaExpr::capture_init_iterator i = E->capture_init_begin(),
                                          e = E->capture_init_end();
-      i != e; ++i, ++CurField) {
+       i != e; ++i, ++CurField) {
     // Emit initialization
     LValue LV = EmitLValueForFieldInitialization(Slot.getAddr(), *CurField, 0);
     ArrayRef<VarDecl *> ArrayIndexes;

Modified: cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp Tue Mar  6 07:07:43 2012
@@ -511,7 +511,7 @@
     const APValue &FieldValue =
       RD->isUnion() ? Val.getUnionValue() : Val.getStructField(FieldNo);
     llvm::Constant *EltInit =
-      CGM.EmitConstantValue(FieldValue, Field->getType(), CGF);
+      CGM.EmitConstantValueForMemory(FieldValue, Field->getType(), CGF);
     assert(EltInit && "EmitConstantValue can't fail");
 
     if (!Field->isBitField()) {
@@ -1015,7 +1015,7 @@
 llvm::Constant *CodeGenModule::EmitConstantInit(const VarDecl &D,
                                                 CodeGenFunction *CGF) {
   if (const APValue *Value = D.evaluateValue())
-    return EmitConstantValue(*Value, D.getType(), CGF);
+    return EmitConstantValueForMemory(*Value, D.getType(), CGF);
 
   // FIXME: Implement C++11 [basic.start.init]p2: if the initializer of a
   // reference is a constant expression, and the reference binds to a temporary,
@@ -1049,10 +1049,12 @@
   else
     Success = E->EvaluateAsRValue(Result, Context);
 
+  llvm::Constant *C = 0;
   if (Success && !Result.HasSideEffects)
-    return EmitConstantValue(Result.Val, DestType, CGF);
+    C = EmitConstantValue(Result.Val, DestType, CGF);
+  else
+    C = ConstExprEmitter(*this, CGF).Visit(const_cast<Expr*>(E));
 
-  llvm::Constant* C = ConstExprEmitter(*this, CGF).Visit(const_cast<Expr*>(E));
   if (C && C->getType()->isIntegerTy(1)) {
     llvm::Type *BoolTy = getTypes().ConvertTypeForMem(E->getType());
     C = llvm::ConstantExpr::getZExt(C, BoolTy);
@@ -1110,16 +1112,8 @@
       return C;
     }
   }
-  case APValue::Int: {
-    llvm::Constant *C = llvm::ConstantInt::get(VMContext,
-                                               Value.getInt());
-
-    if (C->getType()->isIntegerTy(1)) {
-      llvm::Type *BoolTy = getTypes().ConvertTypeForMem(DestType);
-      C = llvm::ConstantExpr::getZExt(C, BoolTy);
-    }
-    return C;
-  }
+  case APValue::Int:
+    return llvm::ConstantInt::get(VMContext, Value.getInt());
   case APValue::ComplexInt: {
     llvm::Constant *Complex[2];
 
@@ -1199,16 +1193,16 @@
     // Emit array filler, if there is one.
     llvm::Constant *Filler = 0;
     if (Value.hasArrayFiller())
-      Filler = EmitConstantValue(Value.getArrayFiller(),
-                                 CAT->getElementType(), CGF);
+      Filler = EmitConstantValueForMemory(Value.getArrayFiller(),
+                                          CAT->getElementType(), CGF);
 
     // Emit initializer elements.
     llvm::Type *CommonElementType = 0;
     for (unsigned I = 0; I < NumElements; ++I) {
       llvm::Constant *C = Filler;
       if (I < NumInitElts)
-        C = EmitConstantValue(Value.getArrayInitializedElt(I),
-                              CAT->getElementType(), CGF);
+        C = EmitConstantValueForMemory(Value.getArrayInitializedElt(I),
+                                       CAT->getElementType(), CGF);
       if (I == 0)
         CommonElementType = C->getType();
       else if (C->getType() != CommonElementType)
@@ -1237,6 +1231,18 @@
 }
 
 llvm::Constant *
+CodeGenModule::EmitConstantValueForMemory(const APValue &Value,
+                                          QualType DestType,
+                                          CodeGenFunction *CGF) {
+  llvm::Constant *C = EmitConstantValue(Value, DestType, CGF);
+  if (C->getType()->isIntegerTy(1)) {
+    llvm::Type *BoolTy = getTypes().ConvertTypeForMem(DestType);
+    C = llvm::ConstantExpr::getZExt(C, BoolTy);
+  }
+  return C;
+}
+
+llvm::Constant *
 CodeGenModule::GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *E) {
   assert(E->isFileScope() && "not a file-scope compound literal expr");
   return ConstExprEmitter(*this, 0).EmitLValue(E);

Modified: cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp Tue Mar  6 07:07:43 2012
@@ -212,18 +212,21 @@
   // l-values.
   Value *VisitDeclRefExpr(DeclRefExpr *E) {
     Expr::EvalResult Result;
-    if (!E->EvaluateAsRValue(Result, CGF.getContext()))
-      return EmitLoadOfLValue(E);
+    bool IsReferenceConstant = false;
+    QualType EvalTy = E->getType();
+    if (!E->EvaluateAsRValue(Result, CGF.getContext())) {
+      // If this is a reference, try to determine what it is bound to.
+      if (!E->getDecl()->getType()->isReferenceType() ||
+          !E->EvaluateAsLValue(Result, CGF.getContext()))
+        return EmitLoadOfLValue(E);
+
+      IsReferenceConstant = true;
+      EvalTy = E->getDecl()->getType();
+    }
 
     assert(!Result.HasSideEffects && "Constant declref with side-effect?!");
 
-    llvm::Constant *C;
-    if (Result.Val.isInt())
-      C = Builder.getInt(Result.Val.getInt());
-    else if (Result.Val.isFloat())
-      C = llvm::ConstantFP::get(VMContext, Result.Val.getFloat());
-    else
-      return EmitLoadOfLValue(E);
+    llvm::Constant *C = CGF.CGM.EmitConstantValue(Result.Val, EvalTy, &CGF);
 
     // Make sure we emit a debug reference to the global variable.
     if (VarDecl *VD = dyn_cast<VarDecl>(E->getDecl())) {
@@ -233,6 +236,9 @@
       CGF.EmitDeclRefExprDbgValue(E, C);
     }
 
+    if (IsReferenceConstant)
+      return EmitLoadOfLValue(CGF.MakeNaturalAlignAddrLValue(C, E->getType()));
+
     return C;
   }
   Value *VisitObjCSelectorExpr(ObjCSelectorExpr *E) {

Modified: cfe/branches/tooling/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGObjC.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGObjC.cpp Tue Mar  6 07:07:43 2012
@@ -2777,9 +2777,9 @@
 llvm::Value *
 CodeGenFunction::EmitBlockCopyAndAutorelease(llvm::Value *Block, QualType Ty) {
   // Get selectors for retain/autorelease.
-  IdentifierInfo *RetainID = &getContext().Idents.get("retain");
-  Selector RetainSelector =
-      getContext().Selectors.getNullarySelector(RetainID);
+  IdentifierInfo *CopyID = &getContext().Idents.get("copy");
+  Selector CopySelector =
+      getContext().Selectors.getNullarySelector(CopyID);
   IdentifierInfo *AutoreleaseID = &getContext().Idents.get("autorelease");
   Selector AutoreleaseSelector =
       getContext().Selectors.getNullarySelector(AutoreleaseID);
@@ -2789,7 +2789,7 @@
   llvm::Value *Val = Block;
   RValue Result;
   Result = Runtime.GenerateMessageSend(*this, ReturnValueSlot(),
-                                       Ty, RetainSelector,
+                                       Ty, CopySelector,
                                        Val, CallArgList(), 0, 0);
   Val = Result.getScalarVal();
   Result = Runtime.GenerateMessageSend(*this, ReturnValueSlot(),

Modified: cfe/branches/tooling/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGRecordLayoutBuilder.cpp Tue Mar  6 07:07:43 2012
@@ -576,6 +576,7 @@
     }
   }
   if (unionAlign.isZero()) {
+    (void)hasOnlyZeroSizedBitFields;
     assert(hasOnlyZeroSizedBitFields &&
            "0-align record did not have all zero-sized bit-fields!");
     unionAlign = CharUnits::One();

Modified: cfe/branches/tooling/lib/CodeGen/CodeGenAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CodeGenAction.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CodeGenAction.cpp Tue Mar  6 07:07:43 2012
@@ -73,6 +73,10 @@
     llvm::Module *takeModule() { return TheModule.take(); }
     llvm::Module *takeLinkModule() { return LinkModule.take(); }
 
+    virtual void MarkVarRequired(VarDecl *VD) {
+      Gen->MarkVarRequired(VD);
+    }
+
     virtual void Initialize(ASTContext &Ctx) {
       Context = &Ctx;
 

Modified: cfe/branches/tooling/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CodeGenFunction.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CodeGenFunction.cpp Tue Mar  6 07:07:43 2012
@@ -32,8 +32,7 @@
     Target(CGM.getContext().getTargetInfo()),
     Builder(cgm.getModule().getContext()),
     AutoreleaseResult(false), BlockInfo(0), BlockPointer(0),
-    LambdaThisCaptureField(0), InLambdaConversionToBlock(false),
-    NormalCleanupDest(0), NextCleanupDestIndex(1),
+    LambdaThisCaptureField(0), NormalCleanupDest(0), NextCleanupDestIndex(1),
     FirstBlockInfo(0), EHResumeBlock(0), ExceptionSlot(0), EHSelectorSlot(0),
     DebugInfo(0), DisableDebugInfo(false), DidCallStackSave(false),
     IndirectBranch(0), SwitchInsn(0), CaseRangeBlock(0), UnreachableBlock(0),

Modified: cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h Tue Mar  6 07:07:43 2012
@@ -601,7 +601,6 @@
 
   llvm::DenseMap<const VarDecl *, FieldDecl *> LambdaCaptureFields;
   FieldDecl *LambdaThisCaptureField;
-  bool InLambdaConversionToBlock;
 
   /// \brief A mapping from NRVO variables to the flags used to indicate
   /// when the NRVO has been applied to this variable.
@@ -2582,6 +2581,16 @@
                     const AutoVarEmission &emission);
 
   void AddObjCARCExceptionMetadata(llvm::Instruction *Inst);
+
+  /// GetPointeeAlignment - Given an expression with a pointer type, find the
+  /// alignment of the type referenced by the pointer.  Skip over implicit
+  /// casts.
+  unsigned GetPointeeAlignment(const Expr *Addr);
+
+  /// GetPointeeAlignmentValue - Given an expression with a pointer type, find
+  /// the alignment of the type referenced by the pointer.  Skip over implicit
+  /// casts.  Return the alignment as an llvm::Value.
+  llvm::Value *GetPointeeAlignmentValue(const Expr *Addr);
 };
 
 /// Helper class with most of the code for saving a value for a

Modified: cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp Tue Mar  6 07:07:43 2012
@@ -1472,7 +1472,8 @@
   }
 
   // Emit the constant for the initializer_list.
-  llvm::Constant *llvmInit = EmitConstantValue(initListValue, D->getType());
+  llvm::Constant *llvmInit =
+      EmitConstantValueForMemory(initListValue, D->getType());
   assert(llvmInit && "failed to initialize as constant");
   return llvmInit;
 }
@@ -1721,6 +1722,9 @@
   }
 }
 
+void CodeGenModule::MarkVarRequired(VarDecl *VD) {
+  GetAddrOfGlobalVar(VD);
+}
 
 void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) {
   const FunctionDecl *D = cast<FunctionDecl>(GD.getDecl());

Modified: cfe/branches/tooling/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CodeGenModule.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/branches/tooling/lib/CodeGen/CodeGenModule.h Tue Mar  6 07:07:43 2012
@@ -658,6 +658,11 @@
   /// EmitTopLevelDecl - Emit code for a single top level declaration.
   void EmitTopLevelDecl(Decl *D);
 
+  /// MarkVarRequired - Tell the consumer that this variable must be output.
+  /// This is needed when the definition is initially one that can be deferred,
+  /// but we then see an explicit template instantiation definition.
+  void MarkVarRequired(VarDecl *VD);
+
   /// AddUsedGlobal - Add a global which should be forced to be
   /// present in the object file; these are emitted to the llvm.used
   /// metadata global.
@@ -706,11 +711,17 @@
   llvm::Constant *EmitConstantExpr(const Expr *E, QualType DestType,
                                    CodeGenFunction *CGF = 0);
 
-  /// EmitConstantValue - Try to emit the given constant value as a
-  /// constant; returns 0 if the value cannot be emitted as a constant.
+  /// EmitConstantValue - Emit the given constant value as a constant, in the
+  /// type's scalar representation.
   llvm::Constant *EmitConstantValue(const APValue &Value, QualType DestType,
                                     CodeGenFunction *CGF = 0);
 
+  /// EmitConstantValueForMemory - Emit the given constant value as a constant,
+  /// in the type's memory representation.
+  llvm::Constant *EmitConstantValueForMemory(const APValue &Value,
+                                             QualType DestType,
+                                             CodeGenFunction *CGF = 0);
+
   /// EmitNullConstant - Return the result of value-initializing the given
   /// type, i.e. a null expression of the given type.  This is usually,
   /// but not always, an LLVM null constant.

Modified: cfe/branches/tooling/lib/CodeGen/ModuleBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/ModuleBuilder.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/ModuleBuilder.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/ModuleBuilder.cpp Tue Mar  6 07:07:43 2012
@@ -59,6 +59,10 @@
                                                *M, *TD, Diags));
     }
 
+    virtual void MarkVarRequired(VarDecl *VD) {
+      Builder->MarkVarRequired(VD);
+    }
+
     virtual bool HandleTopLevelDecl(DeclGroupRef DG) {
       // Make sure to emit all elements of a Decl.
       for (DeclGroupRef::iterator I = DG.begin(), E = DG.end(); I != E; ++I)

Modified: cfe/branches/tooling/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/ToolChains.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/ToolChains.cpp (original)
+++ cfe/branches/tooling/lib/Driver/ToolChains.cpp Tue Mar  6 07:07:43 2012
@@ -1019,6 +1019,10 @@
   return !isTargetIPhoneOS();
 }
 
+bool Darwin::SupportsObjCARC() const {
+  return isTargetIPhoneOS() || !isMacosxVersionLT(10, 6);
+}
+
 std::string
 Darwin_Generic_GCC::ComputeEffectiveClangTriple(const ArgList &Args,
                                                 types::ID InputType) const {

Modified: cfe/branches/tooling/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/ToolChains.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/ToolChains.h (original)
+++ cfe/branches/tooling/lib/Driver/ToolChains.h Tue Mar  6 07:07:43 2012
@@ -379,6 +379,8 @@
 
   virtual bool SupportsObjCGC() const;
 
+  virtual bool SupportsObjCARC() const;
+
   virtual bool UseDwarfDebugFlags() const;
 
   virtual bool UseSjLjExceptions() const;

Modified: cfe/branches/tooling/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/Tools.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/Tools.cpp (original)
+++ cfe/branches/tooling/lib/Driver/Tools.cpp Tue Mar  6 07:07:43 2012
@@ -1339,6 +1339,8 @@
 
     CmdArgs.push_back("-analyzer-eagerly-assume");
 
+    CmdArgs.push_back("-analyzer-inline-call");
+
     // Add default argument set.
     if (!Args.hasArg(options::OPT__analyzer_no_default_checks)) {
       CmdArgs.push_back("-analyzer-checker=core");
@@ -1928,6 +1930,10 @@
                    options::OPT_fno_address_sanitizer, false))
     CmdArgs.push_back("-faddress-sanitizer");
 
+  if (Args.hasFlag(options::OPT_fthread_sanitizer,
+                   options::OPT_fno_thread_sanitizer, false))
+    CmdArgs.push_back("-fthread-sanitizer");
+
   // -flax-vector-conversions is default.
   if (!Args.hasFlag(options::OPT_flax_vector_conversions,
                     options::OPT_fno_lax_vector_conversions))
@@ -2225,6 +2231,9 @@
   // NOTE: This logic is duplicated in ToolChains.cpp.
   bool ARC = isObjCAutoRefCount(Args);
   if (ARC) {
+    if (!getToolChain().SupportsObjCARC())
+      D.Diag(diag::err_arc_unsupported);
+
     CmdArgs.push_back("-fobjc-arc");
 
     // FIXME: It seems like this entire block, and several around it should be
@@ -4217,6 +4226,9 @@
 
   ArgStringList CmdArgs;
 
+  // Demangle C++ names in errors
+  CmdArgs.push_back("-C");
+
   if ((!Args.hasArg(options::OPT_nostdlib)) &&
       (!Args.hasArg(options::OPT_shared))) {
     CmdArgs.push_back("-e");

Modified: cfe/branches/tooling/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/ASTUnit.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/ASTUnit.cpp Tue Mar  6 07:07:43 2012
@@ -2423,7 +2423,7 @@
   if (getDiagnostics().hasErrorOccurred())
     return true;
 
-  std::vector<unsigned char> Buffer;
+  SmallString<128> Buffer;
   llvm::BitstreamWriter Stream(Buffer);
   ASTWriter Writer(Stream);
   // FIXME: Handle modules

Modified: cfe/branches/tooling/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/CompilerInstance.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/CompilerInstance.cpp Tue Mar  6 07:07:43 2012
@@ -257,7 +257,7 @@
   }
 
   if (PPOpts.DetailedRecord)
-    PP->createPreprocessingRecord();
+    PP->createPreprocessingRecord(PPOpts.DetailedRecordConditionalDirectives);
 
   InitializePreprocessor(*PP, PPOpts, getHeaderSearchOpts(), getFrontendOpts());
 
@@ -470,7 +470,8 @@
                                           StringRef InFile,
                                           StringRef Extension) {
   return createOutputFile(getFrontendOpts().OutputFile, Binary,
-                          /*RemoveFileOnSignal=*/true, InFile, Extension);
+                          /*RemoveFileOnSignal=*/true, InFile, Extension,
+                          /*UseTemporary=*/true);
 }
 
 llvm::raw_fd_ostream *
@@ -478,12 +479,14 @@
                                    bool Binary, bool RemoveFileOnSignal,
                                    StringRef InFile,
                                    StringRef Extension,
-                                   bool UseTemporary) {
+                                   bool UseTemporary,
+                                   bool CreateMissingDirectories) {
   std::string Error, OutputPathName, TempPathName;
   llvm::raw_fd_ostream *OS = createOutputFile(OutputPath, Error, Binary,
                                               RemoveFileOnSignal,
                                               InFile, Extension,
                                               UseTemporary,
+                                              CreateMissingDirectories,
                                               &OutputPathName,
                                               &TempPathName);
   if (!OS) {
@@ -508,8 +511,12 @@
                                    StringRef InFile,
                                    StringRef Extension,
                                    bool UseTemporary,
+                                   bool CreateMissingDirectories,
                                    std::string *ResultPathName,
                                    std::string *TempPathName) {
+  assert((!CreateMissingDirectories || UseTemporary) &&
+         "CreateMissingDirectories is only allowed when using temporary files");
+
   std::string OutFile, TempFile;
   if (!OutputPath.empty()) {
     OutFile = OutputPath;
@@ -528,12 +535,20 @@
   std::string OSFile;
 
   if (UseTemporary && OutFile != "-") {
-    llvm::sys::Path OutPath(OutFile);
-    // Only create the temporary if we can actually write to OutPath, otherwise
-    // we want to fail early.
+    // Only create the temporary if the parent directory exists (or create
+    // missing directories is true) and we can actually write to OutPath,
+    // otherwise we want to fail early.
+    SmallString<256> AbsPath(OutputPath);
+    llvm::sys::fs::make_absolute(AbsPath);
+    llvm::sys::Path OutPath(AbsPath);
+    bool ParentExists = false;
+    if (llvm::sys::fs::exists(llvm::sys::path::parent_path(AbsPath.str()),
+                              ParentExists))
+      ParentExists = false;
     bool Exists;
-    if ((llvm::sys::fs::exists(OutPath.str(), Exists) || !Exists) ||
-        (OutPath.isRegularFile() && OutPath.canWrite())) {
+    if ((CreateMissingDirectories || ParentExists) &&
+        ((llvm::sys::fs::exists(AbsPath.str(), Exists) || !Exists) ||
+         (OutPath.isRegularFile() && OutPath.canWrite()))) {
       // Create a temporary file.
       SmallString<128> TempPath;
       TempPath = OutFile;

Modified: cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp Tue Mar  6 07:07:43 2012
@@ -684,6 +684,8 @@
     Res.push_back("-fcatch-undefined-behavior");
   if (Opts.AddressSanitizer)
     Res.push_back("-faddress-sanitizer");
+  if (Opts.ThreadSanitizer)
+    Res.push_back("-fthread-sanitizer");
   if (Opts.WritableStrings)
     Res.push_back("-fwritable-strings");
   if (Opts.ConstStrings)
@@ -1042,8 +1044,15 @@
   Opts.MaxNodes = Args.getLastArgIntValue(OPT_analyzer_max_nodes, 150000,Diags);
   Opts.MaxLoop = Args.getLastArgIntValue(OPT_analyzer_max_loop, 4, Diags);
   Opts.EagerlyTrimEGraph = !Args.hasArg(OPT_analyzer_no_eagerly_trim_egraph);
-  Opts.InlineCall = Args.hasArg(OPT_analyzer_inline_call);
+  if (Args.hasArg(OPT_analyzer_inline_call))
+    Opts.InlineCall = 1;
   Opts.PrintStats = Args.hasArg(OPT_analyzer_stats);
+  Opts.InlineMaxStackDepth =
+    Args.getLastArgIntValue(OPT_analyzer_inline_max_stack_depth,
+                            Opts.InlineMaxStackDepth, Diags);
+  Opts.InlineMaxFunctionSize =
+    Args.getLastArgIntValue(OPT_analyzer_inline_max_function_size,
+                            Opts.InlineMaxFunctionSize, Diags);
 
   Opts.CheckersControlList.clear();
   for (arg_iterator it = Args.filtered_begin(OPT_analyzer_checker,
@@ -1888,6 +1897,7 @@
   Opts.DebuggerSupport = Args.hasArg(OPT_fdebugger_support);
   Opts.DebuggerCastResultToId = Args.hasArg(OPT_fdebugger_cast_result_to_id);
   Opts.AddressSanitizer = Args.hasArg(OPT_faddress_sanitizer);
+  Opts.ThreadSanitizer = Args.hasArg(OPT_fthread_sanitizer);
   Opts.ApplePragmaPack = Args.hasArg(OPT_fapple_pragma_pack);
   Opts.CurrentModule = Args.getLastArgValue(OPT_fmodule_name);
 

Modified: cfe/branches/tooling/lib/Frontend/FrontendActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/FrontendActions.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/FrontendActions.cpp Tue Mar  6 07:07:43 2012
@@ -340,7 +340,8 @@
   // We use a temporary to avoid race conditions.
   OS = CI.createOutputFile(CI.getFrontendOpts().OutputFile, /*Binary=*/true,
                            /*RemoveFileOnSignal=*/false, InFile,
-                           /*Extension=*/"", /*useTemporary=*/true);
+                           /*Extension=*/"", /*useTemporary=*/true,
+                           /*CreateMissingDirectories=*/true);
   if (!OS)
     return true;
   

Modified: cfe/branches/tooling/lib/Frontend/InitHeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/InitHeaderSearch.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/InitHeaderSearch.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/InitHeaderSearch.cpp Tue Mar  6 07:07:43 2012
@@ -461,6 +461,11 @@
           AddPath(P.str(), CXXSystem, true, false, false, true);
         }
       }
+      // On Solaris, include the support directory for things like xlocale and
+      // fudged system headers.
+      if (triple.getOS() == llvm::Triple::Solaris) 
+        AddPath("/usr/include/c++/v1/support/solaris", CXXSystem, true, false,
+            false);
       
       AddPath("/usr/include/c++/v1", CXXSystem, true, false, false);
     } else {

Modified: cfe/branches/tooling/lib/Frontend/MultiplexConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/MultiplexConsumer.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/MultiplexConsumer.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/MultiplexConsumer.cpp Tue Mar  6 07:07:43 2012
@@ -209,6 +209,11 @@
   return Continue;
 }
 
+void  MultiplexConsumer::MarkVarRequired(VarDecl *VD) {
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->MarkVarRequired(VD);
+}
+
 void MultiplexConsumer::HandleInterestingDecl(DeclGroupRef D) {
   for (size_t i = 0, e = Consumers.size(); i != e; ++i)
     Consumers[i]->HandleInterestingDecl(D);

Modified: cfe/branches/tooling/lib/Frontend/SerializedDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/SerializedDiagnosticPrinter.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/SerializedDiagnosticPrinter.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/SerializedDiagnosticPrinter.cpp Tue Mar  6 07:07:43 2012
@@ -159,7 +159,7 @@
   const DiagnosticOptions &DiagOpts;
   
   /// \brief The byte buffer for the serialized content.
-  std::vector<unsigned char> Buffer;
+  SmallString<1024> Buffer;
 
   /// \brief The BitStreamWriter for the serialized diagnostics.
   llvm::BitstreamWriter Stream;

Modified: cfe/branches/tooling/lib/Index/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Index/CMakeLists.txt?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Index/CMakeLists.txt (original)
+++ cfe/branches/tooling/lib/Index/CMakeLists.txt Tue Mar  6 07:07:43 2012
@@ -3,7 +3,7 @@
 add_clang_library(clangIndex
   ASTLocation.cpp
   Analyzer.cpp
-  CallGraph.cpp
+  GlobalCallGraph.cpp
   DeclReferenceMap.cpp
   Entity.cpp
   GlobalSelector.cpp

Removed: cfe/branches/tooling/lib/Index/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Index/CallGraph.cpp?rev=152117&view=auto
==============================================================================
--- cfe/branches/tooling/lib/Index/CallGraph.cpp (original)
+++ cfe/branches/tooling/lib/Index/CallGraph.cpp (removed)
@@ -1,150 +0,0 @@
-//== CallGraph.cpp - Call graph building ------------------------*- C++ -*--==//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  This file defined the CallGraph and CGBuilder classes.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Index/CallGraph.h"
-
-#include "clang/AST/ASTContext.h"
-#include "clang/AST/StmtVisitor.h"
-
-#include "llvm/Support/GraphWriter.h"
-
-using namespace clang;
-using namespace idx;
-
-namespace {
-class CGBuilder : public StmtVisitor<CGBuilder> {
-
-  CallGraph &G;
-  FunctionDecl *FD;
-
-  Entity CallerEnt;
-
-  CallGraphNode *CallerNode;
-
-public:
-  CGBuilder(CallGraph &g, FunctionDecl *fd, Entity E, CallGraphNode *N)
-    : G(g), FD(fd), CallerEnt(E), CallerNode(N) {}
-
-  void VisitStmt(Stmt *S) { VisitChildren(S); }
-
-  void VisitCallExpr(CallExpr *CE);
-
-  void VisitChildren(Stmt *S) {
-    for (Stmt::child_range I = S->children(); I; ++I)
-      if (*I)
-        static_cast<CGBuilder*>(this)->Visit(*I);
-  }
-};
-}
-
-void CGBuilder::VisitCallExpr(CallExpr *CE) {
-  if (FunctionDecl *CalleeDecl = CE->getDirectCallee()) {
-    Entity Ent = Entity::get(CalleeDecl, G.getProgram());
-    CallGraphNode *CalleeNode = G.getOrInsertFunction(Ent);
-    CallerNode->addCallee(ASTLocation(FD, CE), CalleeNode);
-  }
-}
-
-CallGraph::CallGraph(Program &P) : Prog(P), Root(0) {
-  ExternalCallingNode = getOrInsertFunction(Entity());
-}
-
-CallGraph::~CallGraph() {
-  if (!FunctionMap.empty()) {
-    for (FunctionMapTy::iterator I = FunctionMap.begin(), E = FunctionMap.end();
-        I != E; ++I)
-      delete I->second;
-    FunctionMap.clear();
-  }
-}
-
-void CallGraph::addTU(ASTContext& Ctx) {
-  DeclContext *DC = Ctx.getTranslationUnitDecl();
-  for (DeclContext::decl_iterator I = DC->decls_begin(), E = DC->decls_end();
-       I != E; ++I) {
-
-    if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*I)) {
-      if (FD->doesThisDeclarationHaveABody()) {
-        // Set caller's ASTContext.
-        Entity Ent = Entity::get(FD, Prog);
-        CallGraphNode *Node = getOrInsertFunction(Ent);
-        CallerCtx[Node] = &Ctx;
-
-        // If this function has external linkage, anything could call it.
-        if (FD->isGlobal())
-          ExternalCallingNode->addCallee(idx::ASTLocation(), Node);
-
-        // Set root node to 'main' function.
-        if (FD->getNameAsString() == "main")
-          Root = Node;
-
-        CGBuilder builder(*this, FD, Ent, Node);
-        builder.Visit(FD->getBody());
-      }
-    }
-  }
-}
-
-CallGraphNode *CallGraph::getOrInsertFunction(Entity F) {
-  CallGraphNode *&Node = FunctionMap[F];
-  if (Node)
-    return Node;
-
-  return Node = new CallGraphNode(F);
-}
-
-Decl *CallGraph::getDecl(CallGraphNode *Node) {
-  // Get the function's context.
-  ASTContext *Ctx = CallerCtx[Node];
-
-  return Node->getDecl(*Ctx);
-}
-
-void CallGraph::print(raw_ostream &os) {
-  for (iterator I = begin(), E = end(); I != E; ++I) {
-    if (I->second->hasCallee()) {
-      os << "function: " << I->first.getPrintableName()
-         << " calls:\n";
-      for (CallGraphNode::iterator CI = I->second->begin(),
-             CE = I->second->end(); CI != CE; ++CI) {
-        os << "    " << CI->second->getName();
-      }
-      os << '\n';
-    }
-  }
-}
-
-void CallGraph::dump() {
-  print(llvm::errs());
-}
-
-void CallGraph::ViewCallGraph() const {
-  llvm::ViewGraph(*this, "CallGraph");
-}
-
-namespace llvm {
-
-template <>
-struct DOTGraphTraits<CallGraph> : public DefaultDOTGraphTraits {
-
-  DOTGraphTraits (bool isSimple=false) : DefaultDOTGraphTraits(isSimple) {}
-
-  static std::string getNodeLabel(const CallGraphNode *Node,
-                                  const CallGraph &CG) {
-    return Node->getName();
-
-  }
-
-};
-
-}

Modified: cfe/branches/tooling/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/Lexer.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/Lexer.cpp (original)
+++ cfe/branches/tooling/lib/Lex/Lexer.cpp Tue Mar  6 07:07:43 2012
@@ -1078,6 +1078,12 @@
 }
 
 
+/// isIdentifierHead - Return true if this is the first character of an
+/// identifier, which is [a-zA-Z_].
+static inline bool isIdentifierHead(unsigned char c) {
+  return (CharInfo[c] & (CHAR_LETTER|CHAR_UNDER)) ? true : false;
+}
+
 /// isIdentifierBody - Return true if this is the body character of an
 /// identifier, which is [a-zA-Z0-9_].
 static inline bool isIdentifierBody(unsigned char c) {
@@ -1543,7 +1549,7 @@
   unsigned Size;
   char C = getCharAndSize(CurPtr, Size);
   char PrevCh = 0;
-  while (isNumberBody(C)) { // FIXME: UCNs?
+  while (isNumberBody(C)) { // FIXME: UCNs.
     CurPtr = ConsumeChar(CurPtr, Size, Result);
     PrevCh = C;
     C = getCharAndSize(CurPtr, Size);
@@ -1567,6 +1573,24 @@
   Result.setLiteralData(TokStart);
 }
 
+/// LexUDSuffix - Lex the ud-suffix production for user-defined literal suffixes
+/// in C++11.
+const char *Lexer::LexUDSuffix(Token &Result, const char *CurPtr) {
+  assert(getFeatures().CPlusPlus0x && "ud-suffix only exists in C++11");
+
+  // Maximally munch an identifier. FIXME: UCNs.
+  unsigned Size;
+  char C = getCharAndSize(CurPtr, Size);
+  if (isIdentifierHead(C)) {
+    Result.setFlag(Token::HasUDSuffix);
+    do {
+      CurPtr = ConsumeChar(CurPtr, Size, Result);
+      C = getCharAndSize(CurPtr, Size);
+    } while (isIdentifierBody(C));
+  }
+  return CurPtr;
+}
+
 /// LexStringLiteral - Lex the remainder of a string literal, after having lexed
 /// either " or L" or u8" or u" or U".
 void Lexer::LexStringLiteral(Token &Result, const char *CurPtr,
@@ -1606,6 +1630,10 @@
     C = getAndAdvanceChar(CurPtr, Result);
   }
 
+  // If we are in C++11, lex the optional ud-suffix.
+  if (getFeatures().CPlusPlus0x)
+    CurPtr = LexUDSuffix(Result, CurPtr);
+
   // If a nul character existed in the string, warn about it.
   if (NulCharacter && !isLexingRawMode())
     Diag(NulCharacter, diag::null_in_string);
@@ -1685,6 +1713,10 @@
     }
   }
 
+  // If we are in C++11, lex the optional ud-suffix.
+  if (getFeatures().CPlusPlus0x)
+    CurPtr = LexUDSuffix(Result, CurPtr);
+
   // Update the location of token as well as BufferPtr.
   const char *TokStart = BufferPtr;
   FormTokenWithChars(Result, CurPtr, Kind);
@@ -1768,6 +1800,10 @@
     C = getAndAdvanceChar(CurPtr, Result);
   }
 
+  // If we are in C++11, lex the optional ud-suffix.
+  if (getFeatures().CPlusPlus0x)
+    CurPtr = LexUDSuffix(Result, CurPtr);
+
   // If a nul character existed in the character, warn about it.
   if (NulCharacter && !isLexingRawMode())
     Diag(NulCharacter, diag::null_in_char);

Modified: cfe/branches/tooling/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/LiteralSupport.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/branches/tooling/lib/Lex/LiteralSupport.cpp Tue Mar  6 07:07:43 2012
@@ -731,7 +731,11 @@
 }
 
 
-///       character-literal: [C++0x lex.ccon]
+///       user-defined-character-literal: [C++11 lex.ext]
+///         character-literal ud-suffix
+///       ud-suffix:
+///         identifier
+///       character-literal: [C++11 lex.ccon]
 ///         ' c-char-sequence '
 ///         u' c-char-sequence '
 ///         U' c-char-sequence '
@@ -744,7 +748,7 @@
 ///           backslash \, or new-line character
 ///         escape-sequence
 ///         universal-character-name
-///       escape-sequence: [C++0x lex.ccon]
+///       escape-sequence:
 ///         simple-escape-sequence
 ///         octal-escape-sequence
 ///         hexadecimal-escape-sequence
@@ -757,7 +761,7 @@
 ///       hexadecimal-escape-sequence:
 ///         \x hexadecimal-digit
 ///         hexadecimal-escape-sequence hexadecimal-digit
-///       universal-character-name:
+///       universal-character-name: [C++11 lex.charset]
 ///         \u hex-quad
 ///         \U hex-quad hex-quad
 ///       hex-quad:
@@ -780,8 +784,17 @@
   assert(begin[0] == '\'' && "Invalid token lexed");
   ++begin;
 
+  // Remove an optional ud-suffix.
+  if (end[-1] != '\'') {
+    const char *UDSuffixEnd = end;
+    do {
+      --end;
+    } while (end[-1] != '\'');
+    UDSuffixBuf.assign(end, UDSuffixEnd);
+  }
+
   // Trim the ending quote.
-  assert(end[-1] == '\'' && "Invalid token lexed");
+  assert(end != begin && "Invalid token lexed");
   --end;
 
   // FIXME: The "Value" is an uint64_t so we can handle char literals of
@@ -1071,6 +1084,8 @@
 
   Pascal = false;
 
+  SourceLocation UDSuffixTokLoc;
+
   for (unsigned i = 0, e = NumStringToks; i != e; ++i) {
     const char *ThisTokBuf = &TokenBuf[0];
     // Get the spelling of the token, which eliminates trigraphs, etc.  We know
@@ -1085,7 +1100,39 @@
       continue;
     }
 
-    const char *ThisTokEnd = ThisTokBuf+ThisTokLen-1;  // Skip end quote.
+    const char *ThisTokEnd = ThisTokBuf+ThisTokLen;
+
+    // Remove an optional ud-suffix.
+    if (ThisTokEnd[-1] != '"') {
+      const char *UDSuffixEnd = ThisTokEnd;
+      do {
+        --ThisTokEnd;
+      } while (ThisTokEnd[-1] != '"');
+
+      StringRef UDSuffix(ThisTokEnd, UDSuffixEnd - ThisTokEnd);
+
+      if (UDSuffixBuf.empty()) {
+        UDSuffixBuf.assign(UDSuffix);
+        UDSuffixTokLoc = StringToks[i].getLocation();
+      } else if (!UDSuffixBuf.equals(UDSuffix)) {
+        // C++11 [lex.ext]p8: At the end of phase 6, if a string literal is the
+        // result of a concatenation involving at least one user-defined-string-
+        // literal, all the participating user-defined-string-literals shall
+        // have the same ud-suffix.
+        if (Diags) {
+          SourceLocation TokLoc = StringToks[i].getLocation();
+          Diags->Report(TokLoc, diag::err_string_concat_mixed_suffix)
+            << UDSuffixBuf << UDSuffix
+            << SourceRange(UDSuffixTokLoc, UDSuffixTokLoc)
+            << SourceRange(TokLoc, TokLoc);
+        }
+        hadError = true;
+      }
+    }
+
+    // Strip the end quote.
+    --ThisTokEnd;
+
     // TODO: Input character set mapping support.
 
     // Skip marker for wide or unicode strings.

Modified: cfe/branches/tooling/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/ModuleMap.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/ModuleMap.cpp (original)
+++ cfe/branches/tooling/lib/Lex/ModuleMap.cpp Tue Mar  6 07:07:43 2012
@@ -617,6 +617,12 @@
     break;
       
   case tok::string_literal: {
+    if (LToken.hasUDSuffix()) {
+      Diags.Report(LToken.getLocation(), diag::err_invalid_string_udl);
+      HadError = true;
+      goto retry;
+    }
+
     // Parse the string literal.
     LangOptions LangOpts;
     StringLiteralParser StringLiteral(&LToken, 1, SourceMgr, LangOpts, *Target);

Modified: cfe/branches/tooling/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/PPDirectives.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/PPDirectives.cpp (original)
+++ cfe/branches/tooling/lib/Lex/PPDirectives.cpp Tue Mar  6 07:07:43 2012
@@ -120,8 +120,15 @@
     std::string Spelling = getSpelling(MacroNameTok, &Invalid);
     if (Invalid)
       return;
-    
+
     const IdentifierInfo &Info = Identifiers.get(Spelling);
+
+    // Allow #defining |and| and friends in microsoft mode.
+    if (Info.isCPlusPlusOperatorKeyword() && getLangOptions().MicrosoftMode) {
+      MacroNameTok.setIdentifierInfo(getIdentifierInfo(Spelling));
+      return;
+    }
+
     if (Info.isCPlusPlusOperatorKeyword())
       // C++ 2.5p2: Alternative tokens behave the same as its primary token
       // except for their spellings.
@@ -306,9 +313,6 @@
         CurPPLexer->pushConditionalLevel(Tok.getLocation(), /*wasskipping*/true,
                                        /*foundnonskip*/false,
                                        /*foundelse*/false);
-
-        if (Callbacks)
-          Callbacks->Endif();
       }
     } else if (Directive[0] == 'e') {
       StringRef Sub = Directive.substr(1);
@@ -321,8 +325,11 @@
         assert(!InCond && "Can't be skipping if not in a conditional!");
 
         // If we popped the outermost skipping block, we're done skipping!
-        if (!CondInfo.WasSkipping)
+        if (!CondInfo.WasSkipping) {
+          if (Callbacks)
+            Callbacks->Endif(Tok.getLocation(), CondInfo.IfLoc);
           break;
+        }
       } 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
@@ -335,14 +342,13 @@
         // Note that we've seen a #else in this conditional.
         CondInfo.FoundElse = true;
 
-        if (Callbacks)
-          Callbacks->Else();
-
         // If the conditional is at the top level, and the #if block wasn't
         // entered, enter the #else block now.
         if (!CondInfo.WasSkipping && !CondInfo.FoundNonSkip) {
           CondInfo.FoundNonSkip = true;
           CheckEndOfDirective("else");
+          if (Callbacks)
+            Callbacks->Else(Tok.getLocation(), CondInfo.IfLoc);
           break;
         } else {
           DiscardUntilEndOfDirective();  // C99 6.10p4.
@@ -371,12 +377,13 @@
         // If this is a #elif with a #else before it, report the error.
         if (CondInfo.FoundElse) Diag(Tok, diag::pp_err_elif_after_else);
 
-        if (Callbacks)
-          Callbacks->Elif(SourceRange(ConditionalBegin, ConditionalEnd));
-
         // If this condition is true, enter it!
         if (ShouldEnter) {
           CondInfo.FoundNonSkip = true;
+          if (Callbacks)
+            Callbacks->Elif(Tok.getLocation(),
+                            SourceRange(ConditionalBegin, ConditionalEnd),
+                            CondInfo.IfLoc);
           break;
         }
       }
@@ -815,8 +822,10 @@
     ; // ok
   else if (StrTok.isNot(tok::string_literal)) {
     Diag(StrTok, diag::err_pp_line_invalid_filename);
-    DiscardUntilEndOfDirective();
-    return;
+    return DiscardUntilEndOfDirective();
+  } else if (StrTok.hasUDSuffix()) {
+    Diag(StrTok, diag::err_invalid_string_udl);
+    return DiscardUntilEndOfDirective();
   } else {
     // Parse and validate the string, converting it into a unique ID.
     StringLiteralParser Literal(&StrTok, 1, *this);
@@ -950,6 +959,9 @@
   else if (StrTok.isNot(tok::string_literal)) {
     Diag(StrTok, diag::err_pp_linemarker_invalid_filename);
     return DiscardUntilEndOfDirective();
+  } else if (StrTok.hasUDSuffix()) {
+    Diag(StrTok, diag::err_invalid_string_udl);
+    return DiscardUntilEndOfDirective();
   } else {
     // Parse and validate the string, converting it into a unique ID.
     StringLiteralParser Literal(&StrTok, 1, *this);
@@ -1040,6 +1052,11 @@
     return;
   }
 
+  if (StrTok.hasUDSuffix()) {
+    Diag(StrTok, diag::err_invalid_string_udl);
+    return DiscardUntilEndOfDirective();
+  }
+
   // Verify that there is nothing after the string, other than EOD.
   CheckEndOfDirective("ident");
 
@@ -1267,6 +1284,7 @@
     return;
   }
 
+  StringRef OriginalFilename = Filename;
   bool isAngled =
     GetIncludeFilenameSpelling(FilenameTok.getLocation(), Filename);
   // If GetIncludeFilenameSpelling set the start ptr to null, there was an
@@ -1297,6 +1315,15 @@
     PragmaARCCFCodeAuditedLoc = SourceLocation();
   }
 
+  if (HeaderInfo.HasIncludeAliasMap()) {
+    // Map the filename with the brackets still attached.  If the name doesn't 
+    // map to anything, fall back on the filename we've already gotten the 
+    // spelling for.
+    StringRef NewName = HeaderInfo.MapHeaderToIncludeAlias(OriginalFilename);
+    if (!NewName.empty())
+      Filename = NewName;
+  }
+
   // Search include directories.
   const DirectoryLookup *CurDir;
   SmallString<1024> SearchPath;
@@ -1394,7 +1421,7 @@
       Diag(HashLoc, diag::warn_auto_module_import)
         << IncludeKind << PathString 
         << FixItHint::CreateReplacement(ReplaceRange,
-             "@import " + PathString.str().str() + ";");
+             "@__experimental_modules_import " + PathString.str().str() + ";");
     }
     
     // Load the module.
@@ -1880,6 +1907,13 @@
   if (MI)  // Mark it used.
     markMacroAsUsed(MI);
 
+  if (Callbacks) {
+    if (isIfndef)
+      Callbacks->Ifndef(DirectiveTok.getLocation(), MacroNameTok);
+    else
+      Callbacks->Ifdef(DirectiveTok.getLocation(), MacroNameTok);
+  }
+
   // Should we include the stuff contained by this directive?
   if (!MI == isIfndef) {
     // Yes, remember that we are inside a conditional, then lex the next token.
@@ -1892,13 +1926,6 @@
                                  /*Foundnonskip*/false,
                                  /*FoundElse*/false);
   }
-
-  if (Callbacks) {
-    if (isIfndef)
-      Callbacks->Ifndef(MacroNameTok);
-    else
-      Callbacks->Ifdef(MacroNameTok);
-  }
 }
 
 /// HandleIfDirective - Implements the #if directive.
@@ -1922,6 +1949,10 @@
       CurPPLexer->MIOpt.EnterTopLevelConditional();
   }
 
+  if (Callbacks)
+    Callbacks->If(IfToken.getLocation(),
+                  SourceRange(ConditionalBegin, ConditionalEnd));
+
   // Should we include the stuff contained by this directive?
   if (ConditionalTrue) {
     // Yes, remember that we are inside a conditional, then lex the next token.
@@ -1932,9 +1963,6 @@
     SkipExcludedConditionalBlock(IfToken.getLocation(), /*Foundnonskip*/false,
                                  /*FoundElse*/false);
   }
-
-  if (Callbacks)
-    Callbacks->If(SourceRange(ConditionalBegin, ConditionalEnd));
 }
 
 /// HandleEndifDirective - Implements the #endif directive.
@@ -1960,7 +1988,7 @@
          "This code should only be reachable in the non-skipping case!");
 
   if (Callbacks)
-    Callbacks->Endif();
+    Callbacks->Endif(EndifToken.getLocation(), CondInfo.IfLoc);
 }
 
 /// HandleElseDirective - Implements the #else directive.
@@ -1984,12 +2012,12 @@
   // If this is a #else with a #else before it, report the error.
   if (CI.FoundElse) Diag(Result, diag::pp_err_else_after_else);
 
+  if (Callbacks)
+    Callbacks->Else(Result.getLocation(), CI.IfLoc);
+
   // Finally, skip the rest of the contents of this block.
   SkipExcludedConditionalBlock(CI.IfLoc, /*Foundnonskip*/true,
                                /*FoundElse*/true, Result.getLocation());
-
-  if (Callbacks)
-    Callbacks->Else();
 }
 
 /// HandleElifDirective - Implements the #elif directive.
@@ -2016,12 +2044,13 @@
 
   // If this is a #elif with a #else before it, report the error.
   if (CI.FoundElse) Diag(ElifToken, diag::pp_err_elif_after_else);
+  
+  if (Callbacks)
+    Callbacks->Elif(ElifToken.getLocation(),
+                    SourceRange(ConditionalBegin, ConditionalEnd), CI.IfLoc);
 
   // Finally, skip the rest of the contents of this block.
   SkipExcludedConditionalBlock(CI.IfLoc, /*Foundnonskip*/true,
                                /*FoundElse*/CI.FoundElse,
                                ElifToken.getLocation());
-
-  if (Callbacks)
-    Callbacks->Elif(SourceRange(ConditionalBegin, ConditionalEnd));
 }

Modified: cfe/branches/tooling/lib/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/PPExpressions.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/PPExpressions.cpp (original)
+++ cfe/branches/tooling/lib/Lex/PPExpressions.cpp Tue Mar  6 07:07:43 2012
@@ -251,6 +251,10 @@
   case tok::wide_char_constant: {   // L'x'
   case tok::utf16_char_constant:    // u'x'
   case tok::utf32_char_constant:    // U'x'
+    // Complain about, and drop, any ud-suffix.
+    if (PeekTok.hasUDSuffix())
+      PP.Diag(PeekTok, diag::err_pp_invalid_char_udl);
+
     SmallString<32> CharBuffer;
     bool CharInvalid = false;
     StringRef ThisTok = PP.getSpelling(PeekTok, CharBuffer, &CharInvalid);

Modified: cfe/branches/tooling/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/PPMacroExpansion.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/branches/tooling/lib/Lex/PPMacroExpansion.cpp Tue Mar  6 07:07:43 2012
@@ -667,7 +667,7 @@
            .Case("cxx_static_assert", LangOpts.CPlusPlus0x)
            .Case("cxx_trailing_return", LangOpts.CPlusPlus0x)
            .Case("cxx_unicode_literals", LangOpts.CPlusPlus0x)
-         //.Case("cxx_unrestricted_unions", false)
+           .Case("cxx_unrestricted_unions", LangOpts.CPlusPlus0x)
          //.Case("cxx_user_literals", false)
            .Case("cxx_variadic_templates", LangOpts.CPlusPlus0x)
            // Type traits
@@ -760,7 +760,12 @@
 /// HasAttribute -  Return true if we recognize and implement the attribute
 /// specified by the given identifier.
 static bool HasAttribute(const IdentifierInfo *II) {
-    return llvm::StringSwitch<bool>(II->getName())
+  StringRef Name = II->getName();
+  // Normalize the attribute name, __foo__ becomes foo.
+  if (Name.startswith("__") && Name.endswith("__") && Name.size() >= 4)
+    Name = Name.substr(2, Name.size() - 4);
+
+  return llvm::StringSwitch<bool>(Name)
 #include "clang/Lex/AttrSpellings.inc"
         .Default(false);
 }
@@ -820,6 +825,16 @@
     return false;
   }
 
+  // Get ')'.
+  PP.LexNonComment(Tok);
+
+  // Ensure we have a trailing ).
+  if (Tok.isNot(tok::r_paren)) {
+    PP.Diag(Tok.getLocation(), diag::err_pp_missing_rparen) << II->getName();
+    PP.Diag(LParenLoc, diag::note_matching) << "(";
+    return false;
+  }
+
   bool isAngled = PP.GetIncludeFilenameSpelling(Tok.getLocation(), Filename);
   // If GetIncludeFilenameSpelling set the start ptr to null, there was an
   // error.
@@ -831,20 +846,8 @@
   const FileEntry *File =
       PP.LookupFile(Filename, isAngled, LookupFrom, CurDir, NULL, NULL, NULL);
 
-  // Get the result value.  Result = true means the file exists.
-  bool Result = File != 0;
-
-  // Get ')'.
-  PP.LexNonComment(Tok);
-
-  // Ensure we have a trailing ).
-  if (Tok.isNot(tok::r_paren)) {
-    PP.Diag(Tok.getLocation(), diag::err_pp_missing_rparen) << II->getName();
-    PP.Diag(LParenLoc, diag::note_matching) << "(";
-    return false;
-  }
-
-  return Result;
+  // Get the result value.  A result of true means the file exists.
+  return File != 0;
 }
 
 /// EvaluateHasInclude - Process a '__has_include("path")' expression.
@@ -1086,6 +1089,9 @@
         // from macro expansion.
         SmallVector<Token, 4> StrToks;
         while (Tok.is(tok::string_literal)) {
+          // Complain about, and drop, any ud-suffix.
+          if (Tok.hasUDSuffix())
+            Diag(Tok, diag::err_invalid_string_udl);
           StrToks.push_back(Tok);
           LexUnexpandedToken(Tok);
         }

Modified: cfe/branches/tooling/lib/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/Pragma.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/Pragma.cpp (original)
+++ cfe/branches/tooling/lib/Lex/Pragma.cpp Tue Mar  6 07:07:43 2012
@@ -133,6 +133,20 @@
   Lex(Tok);
   if (Tok.isNot(tok::string_literal) && Tok.isNot(tok::wide_string_literal)) {
     Diag(PragmaLoc, diag::err__Pragma_malformed);
+    // Skip this token, and the ')', if present.
+    if (Tok.isNot(tok::r_paren))
+      Lex(Tok);
+    if (Tok.is(tok::r_paren))
+      Lex(Tok);
+    return;
+  }
+
+  if (Tok.hasUDSuffix()) {
+    Diag(Tok, diag::err_invalid_string_udl);
+    // Skip this token, and the ')', if present.
+    Lex(Tok);
+    if (Tok.is(tok::r_paren))
+      Lex(Tok);
     return;
   }
 
@@ -442,6 +456,8 @@
     // "foo " "bar" "Baz"
     SmallVector<Token, 4> StrToks;
     while (Tok.is(tok::string_literal)) {
+      if (Tok.hasUDSuffix())
+        Diag(Tok, diag::err_invalid_string_udl);
       StrToks.push_back(Tok);
       Lex(Tok);
     }
@@ -518,6 +534,8 @@
   // "foo " "bar" "Baz"
   SmallVector<Token, 4> StrToks;
   while (Tok.is(tok::string_literal)) {
+    if (Tok.hasUDSuffix())
+      Diag(Tok, diag::err_invalid_string_udl);
     StrToks.push_back(Tok);
     Lex(Tok);
   }
@@ -577,6 +595,11 @@
     return 0;
   }
 
+  if (Tok.hasUDSuffix()) {
+    Diag(Tok, diag::err_invalid_string_udl);
+    return 0;
+  }
+
   // Remember the macro string.
   std::string StrVal = getSpelling(Tok);
 
@@ -663,6 +686,111 @@
   }
 }
 
+void Preprocessor::HandlePragmaIncludeAlias(Token &Tok) {
+  // We will either get a quoted filename or a bracketed filename, and we 
+  // have to track which we got.  The first filename is the source name,
+  // and the second name is the mapped filename.  If the first is quoted,
+  // the second must be as well (cannot mix and match quotes and brackets).
+
+  // Get the open paren
+  Lex(Tok);
+  if (Tok.isNot(tok::l_paren)) {
+    Diag(Tok, diag::warn_pragma_include_alias_expected) << "(";
+    return;
+  }
+
+  // We expect either a quoted string literal, or a bracketed name
+  Token SourceFilenameTok;
+  CurPPLexer->LexIncludeFilename(SourceFilenameTok);
+  if (SourceFilenameTok.is(tok::eod)) {
+    // The diagnostic has already been handled
+    return;
+  }
+
+  StringRef SourceFileName;
+  SmallString<128> FileNameBuffer;
+  if (SourceFilenameTok.is(tok::string_literal) || 
+      SourceFilenameTok.is(tok::angle_string_literal)) {
+    SourceFileName = getSpelling(SourceFilenameTok, FileNameBuffer);
+  } else if (SourceFilenameTok.is(tok::less)) {
+    // This could be a path instead of just a name
+    FileNameBuffer.push_back('<');
+    SourceLocation End;
+    if (ConcatenateIncludeName(FileNameBuffer, End))
+      return; // Diagnostic already emitted
+    SourceFileName = FileNameBuffer.str();
+  } else {
+    Diag(Tok, diag::warn_pragma_include_alias_expected_filename);
+    return;
+  }
+  FileNameBuffer.clear();
+
+  // Now we expect a comma, followed by another include name
+  Lex(Tok);
+  if (Tok.isNot(tok::comma)) {
+    Diag(Tok, diag::warn_pragma_include_alias_expected) << ",";
+    return;
+  }
+
+  Token ReplaceFilenameTok;
+  CurPPLexer->LexIncludeFilename(ReplaceFilenameTok);
+  if (ReplaceFilenameTok.is(tok::eod)) {
+    // The diagnostic has already been handled
+    return;
+  }
+
+  StringRef ReplaceFileName;
+  if (ReplaceFilenameTok.is(tok::string_literal) || 
+      ReplaceFilenameTok.is(tok::angle_string_literal)) {
+    ReplaceFileName = getSpelling(ReplaceFilenameTok, FileNameBuffer);
+  } else if (ReplaceFilenameTok.is(tok::less)) {
+    // This could be a path instead of just a name
+    FileNameBuffer.push_back('<');
+    SourceLocation End;
+    if (ConcatenateIncludeName(FileNameBuffer, End))
+      return; // Diagnostic already emitted
+    ReplaceFileName = FileNameBuffer.str();
+  } else {
+    Diag(Tok, diag::warn_pragma_include_alias_expected_filename);
+    return;
+  }
+
+  // Finally, we expect the closing paren
+  Lex(Tok);
+  if (Tok.isNot(tok::r_paren)) {
+    Diag(Tok, diag::warn_pragma_include_alias_expected) << ")";
+    return;
+  }
+
+  // Now that we have the source and target filenames, we need to make sure
+  // they're both of the same type (angled vs non-angled)
+  StringRef OriginalSource = SourceFileName;
+
+  bool SourceIsAngled = 
+    GetIncludeFilenameSpelling(SourceFilenameTok.getLocation(), 
+                                SourceFileName);
+  bool ReplaceIsAngled =
+    GetIncludeFilenameSpelling(ReplaceFilenameTok.getLocation(),
+                                ReplaceFileName);
+  if (!SourceFileName.empty() && !ReplaceFileName.empty() &&
+      (SourceIsAngled != ReplaceIsAngled)) {
+    unsigned int DiagID;
+    if (SourceIsAngled)
+      DiagID = diag::warn_pragma_include_alias_mismatch_angle;
+    else
+      DiagID = diag::warn_pragma_include_alias_mismatch_quote;
+
+    Diag(SourceFilenameTok.getLocation(), DiagID)
+      << SourceFileName 
+      << ReplaceFileName;
+
+    return;
+  }
+
+  // Now we can let the include handler know about this mapping
+  getHeaderSearchInfo().AddIncludeAlias(OriginalSource, ReplaceFileName);
+}
+
 /// AddPragmaHandler - Add the specified pragma handler to the preprocessor.
 /// If 'Namespace' is non-null, then it is a token required to exist on the
 /// pragma line before the pragma string starts, e.g. "STDC" or "GCC".
@@ -943,6 +1071,15 @@
   }
 };
 
+/// PragmaIncludeAliasHandler - "#pragma include_alias("...")".
+struct PragmaIncludeAliasHandler : public PragmaHandler {
+  PragmaIncludeAliasHandler() : PragmaHandler("include_alias") {}
+  virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
+                            Token &IncludeAliasTok) {
+      PP.HandlePragmaIncludeAlias(IncludeAliasTok);
+  }
+};
+
 /// PragmaMessageHandler - "#pragma message("...")".
 struct PragmaMessageHandler : public PragmaHandler {
   PragmaMessageHandler() : PragmaHandler("message") {}
@@ -1095,5 +1232,6 @@
   // MS extensions.
   if (Features.MicrosoftExt) {
     AddPragmaHandler(new PragmaCommentHandler());
+    AddPragmaHandler(new PragmaIncludeAliasHandler());
   }
 }

Modified: cfe/branches/tooling/lib/Lex/PreprocessingRecord.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/PreprocessingRecord.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/PreprocessingRecord.cpp (original)
+++ cfe/branches/tooling/lib/Lex/PreprocessingRecord.cpp Tue Mar  6 07:07:43 2012
@@ -37,9 +37,14 @@
   this->FileName = StringRef(Memory, FileName.size());
 }
 
-PreprocessingRecord::PreprocessingRecord(SourceManager &SM)
-  : SourceMgr(SM), ExternalSource(0)
+PreprocessingRecord::PreprocessingRecord(SourceManager &SM,
+                                         bool RecordConditionalDirectives)
+  : SourceMgr(SM),
+    RecordCondDirectives(RecordConditionalDirectives), CondDirectiveNextIdx(0),
+    ExternalSource(0)
 {
+  if (RecordCondDirectives)
+    CondDirectiveStack.push_back(CondDirectiveNextIdx++);
 }
 
 /// \brief Returns a pair of [Begin, End) iterators of preprocessed entities
@@ -397,6 +402,95 @@
   addPreprocessedEntity(ID);
 }
 
+bool PreprocessingRecord::rangeIntersectsConditionalDirective(
+                                                      SourceRange Range) const {
+  if (Range.isInvalid())
+    return false;
+
+  CondDirectiveLocsTy::const_iterator
+    low = std::lower_bound(CondDirectiveLocs.begin(), CondDirectiveLocs.end(),
+                           Range.getBegin(), CondDirectiveLoc::Comp(SourceMgr));
+  if (low == CondDirectiveLocs.end())
+    return false;
+
+  if (SourceMgr.isBeforeInTranslationUnit(Range.getEnd(), low->getLoc()))
+    return false;
+
+  CondDirectiveLocsTy::const_iterator
+    upp = std::upper_bound(low, CondDirectiveLocs.end(),
+                           Range.getEnd(), CondDirectiveLoc::Comp(SourceMgr));
+  unsigned uppIdx;
+  if (upp != CondDirectiveLocs.end())
+    uppIdx = upp->getIdx();
+  else
+    uppIdx = 0;
+
+  return low->getIdx() != uppIdx;
+}
+
+unsigned PreprocessingRecord::findCondDirectiveIdx(SourceLocation Loc) const {
+  if (Loc.isInvalid())
+    return 0;
+
+  CondDirectiveLocsTy::const_iterator
+    low = std::lower_bound(CondDirectiveLocs.begin(), CondDirectiveLocs.end(),
+                           Loc, CondDirectiveLoc::Comp(SourceMgr));
+  if (low == CondDirectiveLocs.end())
+    return 0;
+  return low->getIdx();
+}
+
+void PreprocessingRecord::addCondDirectiveLoc(CondDirectiveLoc DirLoc) {
+  // Ignore directives in system headers.
+  if (SourceMgr.isInSystemHeader(DirLoc.getLoc()))
+    return;
+
+  assert(CondDirectiveLocs.empty() ||
+         SourceMgr.isBeforeInTranslationUnit(CondDirectiveLocs.back().getLoc(),
+                                             DirLoc.getLoc()));
+  CondDirectiveLocs.push_back(DirLoc);
+}
+
+void PreprocessingRecord::If(SourceLocation Loc, SourceRange ConditionRange) {
+  if (RecordCondDirectives) {
+    addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
+    CondDirectiveStack.push_back(CondDirectiveNextIdx++);
+  }
+}
+
+void PreprocessingRecord::Ifdef(SourceLocation Loc, const Token &MacroNameTok) {
+  if (RecordCondDirectives) {
+    addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
+    CondDirectiveStack.push_back(CondDirectiveNextIdx++);
+  }
+}
+
+void PreprocessingRecord::Ifndef(SourceLocation Loc,const Token &MacroNameTok) {
+  if (RecordCondDirectives) {
+    addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
+    CondDirectiveStack.push_back(CondDirectiveNextIdx++);
+  }
+}
+
+void PreprocessingRecord::Elif(SourceLocation Loc, SourceRange ConditionRange,
+                               SourceLocation IfLoc) {
+  if (RecordCondDirectives)
+    addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
+}
+
+void PreprocessingRecord::Else(SourceLocation Loc, SourceLocation IfLoc) {
+  if (RecordCondDirectives)
+    addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
+}
+
+void PreprocessingRecord::Endif(SourceLocation Loc, SourceLocation IfLoc) {
+  if (RecordCondDirectives) {
+    addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
+    assert(!CondDirectiveStack.empty());
+    CondDirectiveStack.pop_back();
+  }
+}
+
 size_t PreprocessingRecord::getTotalMemory() const {
   return BumpAlloc.getTotalMemory()
     + llvm::capacity_in_bytes(MacroDefinitions)

Modified: cfe/branches/tooling/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/Preprocessor.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/Preprocessor.cpp (original)
+++ cfe/branches/tooling/lib/Lex/Preprocessor.cpp Tue Mar  6 07:07:43 2012
@@ -565,13 +565,13 @@
   if (II.isExtensionToken() && !DisableMacroExpansion)
     Diag(Identifier, diag::ext_token_used);
   
-  // If this is the 'import' contextual keyword, note that the next token 
-  // indicates a module name.
+  // If this is the '__experimental_modules_import' contextual keyword, note
+  // that the next token indicates a module name.
   //
-  // Note that we do not treat 'import' as a contextual keyword when we're
-  // in a caching lexer, because caching lexers only get used in contexts where
-  // import declarations are disallowed.
-  if (II.isImport() && !InMacroArgs && !DisableMacroExpansion &&
+  // Note that we do not treat '__experimental_modules_import' as a contextual
+  // keyword when we're in a caching lexer, because caching lexers only get
+  // used in contexts where import declarations are disallowed.
+  if (II.isModulesImport() && !InMacroArgs && !DisableMacroExpansion &&
       getLangOptions().Modules && CurLexerKind != CLK_CachingLexer) {
     ModuleImportLoc = Identifier.getLocation();
     ModuleImportPath.clear();
@@ -654,10 +654,11 @@
 
 CodeCompletionHandler::~CodeCompletionHandler() { }
 
-void Preprocessor::createPreprocessingRecord() {
+void Preprocessor::createPreprocessingRecord(bool RecordConditionalDirectives) {
   if (Record)
     return;
   
-  Record = new PreprocessingRecord(getSourceManager());
+  Record = new PreprocessingRecord(getSourceManager(),
+                                   RecordConditionalDirectives);
   addPPCallbacks(Record);
 }

Modified: cfe/branches/tooling/lib/Lex/TokenConcatenation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/TokenConcatenation.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/TokenConcatenation.cpp (original)
+++ cfe/branches/tooling/lib/Lex/TokenConcatenation.cpp Tue Mar  6 07:07:43 2012
@@ -85,6 +85,19 @@
   TokenInfo[tok::hash            ] |= aci_custom_firstchar;
   TokenInfo[tok::arrow           ] |= aci_custom_firstchar;
 
+  // These tokens have custom code in C++11 mode.
+  if (PP.getLangOptions().CPlusPlus0x) {
+    TokenInfo[tok::string_literal      ] |= aci_custom;
+    TokenInfo[tok::wide_string_literal ] |= aci_custom;
+    TokenInfo[tok::utf8_string_literal ] |= aci_custom;
+    TokenInfo[tok::utf16_string_literal] |= aci_custom;
+    TokenInfo[tok::utf32_string_literal] |= aci_custom;
+    TokenInfo[tok::char_constant       ] |= aci_custom;
+    TokenInfo[tok::wide_char_constant  ] |= aci_custom;
+    TokenInfo[tok::utf16_char_constant ] |= aci_custom;
+    TokenInfo[tok::utf32_char_constant ] |= aci_custom;
+  }
+
   // These tokens change behavior if followed by an '='.
   TokenInfo[tok::amp         ] |= aci_avoid_equal;           // &=
   TokenInfo[tok::plus        ] |= aci_avoid_equal;           // +=
@@ -183,6 +196,28 @@
   case tok::raw_identifier:
     llvm_unreachable("tok::raw_identifier in non-raw lexing mode!");
 
+  case tok::string_literal:
+  case tok::wide_string_literal:
+  case tok::utf8_string_literal:
+  case tok::utf16_string_literal:
+  case tok::utf32_string_literal:
+  case tok::char_constant:
+  case tok::wide_char_constant:
+  case tok::utf16_char_constant:
+  case tok::utf32_char_constant:
+    if (!PP.getLangOptions().CPlusPlus0x)
+      return false;
+
+    // In C++11, a string or character literal followed by an identifier is a
+    // single token.
+    if (Tok.getIdentifierInfo())
+      return true;
+
+    // A ud-suffix is an identifier. If the previous token ends with one, treat
+    // it as an identifier.
+    if (!PrevTok.hasUDSuffix())
+      return false;
+    // FALL THROUGH.
   case tok::identifier:   // id+id or id+number or id+L"foo".
     // id+'.'... will not append.
     if (Tok.is(tok::numeric_constant))
@@ -201,9 +236,11 @@
     // Otherwise, this is a narrow character or string.  If the *identifier*
     // is a literal 'L', 'u8', 'u' or 'U', avoid pasting L "foo" -> L"foo".
     return IsIdentifierStringPrefix(PrevTok);
+
   case tok::numeric_constant:
     return isalnum(FirstChar) || Tok.is(tok::numeric_constant) ||
-    FirstChar == '+' || FirstChar == '-' || FirstChar == '.';
+           FirstChar == '+' || FirstChar == '-' || FirstChar == '.' ||
+           (PP.getLangOptions().CPlusPlus0x && FirstChar == '_');
   case tok::period:          // ..., .*, .1234
     return (FirstChar == '.' && PrevPrevTok.is(tok::period)) ||
     isdigit(FirstChar) ||

Modified: cfe/branches/tooling/lib/Parse/ParseAST.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseAST.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseAST.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseAST.cpp Tue Mar  6 07:07:43 2012
@@ -53,8 +53,8 @@
 void clang::ParseAST(Sema &S, bool PrintStats) {
   // Collect global stats on Decls/Stmts (until we have a module streamer).
   if (PrintStats) {
-    Decl::CollectingStats(true);
-    Stmt::CollectingStats(true);
+    Decl::EnableStatistics();
+    Stmt::EnableStatistics();
   }
 
   // Also turn on collection of stats inside of the Sema object.

Modified: cfe/branches/tooling/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseDecl.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseDecl.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseDecl.cpp Tue Mar  6 07:07:43 2012
@@ -742,7 +742,7 @@
 void Parser::ParseLexedAttributeList(LateParsedAttrList &LAs, Decl *D,
                                      bool EnterScope, bool OnDefinition) {
   for (unsigned i = 0, ni = LAs.size(); i < ni; ++i) {
-    LAs[i]->setDecl(D);
+    LAs[i]->addDecl(D);
     ParseLexedAttribute(*LAs[i], EnterScope, OnDefinition);
   }
   LAs.clear();
@@ -774,33 +774,41 @@
   ParsedAttributes Attrs(AttrFactory);
   SourceLocation endLoc;
 
-  // If the Decl is templatized, add template parameters to scope.
-  bool HasTemplateScope = EnterScope && LA.D && LA.D->isTemplateDecl();
-  ParseScope TempScope(this, Scope::TemplateParamScope, HasTemplateScope);
-  if (HasTemplateScope)
-    Actions.ActOnReenterTemplateScope(Actions.CurScope, LA.D);
-
-  // If the Decl is on a function, add function parameters to the scope.
-  bool HasFunctionScope = EnterScope && LA.D &&
-                          LA.D->isFunctionOrFunctionTemplate();
-  ParseScope FnScope(this, Scope::FnScope|Scope::DeclScope, HasFunctionScope);
-  if (HasFunctionScope)
-    Actions.ActOnReenterFunctionContext(Actions.CurScope, LA.D);
-
-  ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs, &endLoc);
-
-  if (HasFunctionScope) {
-    Actions.ActOnExitFunctionContext();
-    FnScope.Exit();  // Pop scope, and remove Decls from IdResolver
-  }
-  if (HasTemplateScope) {
-    TempScope.Exit();
-  }
-
-  // Late parsed attributes must be attached to Decls by hand.  If the
-  // LA.D is not set, then this was not done properly.
-  assert(LA.D && "No decl attached to late parsed attribute");
-  Actions.ActOnFinishDelayedAttribute(getCurScope(), LA.D, Attrs);
+  if (LA.Decls.size() == 1) {
+    Decl *D = LA.Decls[0];
+
+    // If the Decl is templatized, add template parameters to scope.
+    bool HasTemplateScope = EnterScope && D->isTemplateDecl();
+    ParseScope TempScope(this, Scope::TemplateParamScope, HasTemplateScope);
+    if (HasTemplateScope)
+      Actions.ActOnReenterTemplateScope(Actions.CurScope, D);
+
+    // If the Decl is on a function, add function parameters to the scope.
+    bool HasFunctionScope = EnterScope && D->isFunctionOrFunctionTemplate();
+    ParseScope FnScope(this, Scope::FnScope|Scope::DeclScope, HasFunctionScope);
+    if (HasFunctionScope)
+      Actions.ActOnReenterFunctionContext(Actions.CurScope, D);
+
+    ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs, &endLoc);
+
+    if (HasFunctionScope) {
+      Actions.ActOnExitFunctionContext();
+      FnScope.Exit();  // Pop scope, and remove Decls from IdResolver
+    }
+    if (HasTemplateScope) {
+      TempScope.Exit();
+    }
+  } else if (LA.Decls.size() > 0) {
+    // If there are multiple decls, then the decl cannot be within the
+    // function scope.
+    ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs, &endLoc);
+  } else {
+    Diag(Tok, diag::warn_attribute_no_decl) << LA.AttrName.getName();
+  }
+
+  for (unsigned i = 0, ni = LA.Decls.size(); i < ni; ++i) {
+    Actions.ActOnFinishDelayedAttribute(getCurScope(), LA.Decls[i], Attrs);
+  }
 
   if (Tok.getLocation() != OrigLoc) {
     // Due to a parsing error, we either went over the cached tokens or
@@ -1702,7 +1710,8 @@
 void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
                                         const ParsedTemplateInfo &TemplateInfo,
                                         AccessSpecifier AS,
-                                        DeclSpecContext DSContext) { 
+                                        DeclSpecContext DSContext,
+                                        LateParsedAttrList *LateAttrs) {
   if (DS.getSourceRange().isInvalid()) {
     DS.SetRangeStart(Tok.getLocation());
     DS.SetRangeEnd(Tok.getLocation());
@@ -2033,7 +2042,7 @@
 
     // GNU attributes support.
     case tok::kw___attribute:
-      ParseGNUAttributes(DS.getAttributes());
+      ParseGNUAttributes(DS.getAttributes(), 0, LateAttrs);
       continue;
 
     // Microsoft declspec support.
@@ -2871,6 +2880,8 @@
 ///[C99/C++]'enum' identifier[opt] '{' enumerator-list ',' '}'
 /// [GNU]   'enum' attributes[opt] identifier[opt] '{' enumerator-list ',' [opt]
 ///                                                 '}' attributes[opt]
+/// [MS]    'enum' __declspec[opt] identifier[opt] '{' enumerator-list ',' [opt]
+///                                                 '}'
 ///         'enum' identifier
 /// [GNU]   'enum' attributes[opt] identifier
 ///
@@ -2916,6 +2927,10 @@
   ParsedAttributes attrs(AttrFactory);
   MaybeParseGNUAttributes(attrs);
 
+  // If declspecs exist after tag, parse them.
+  while (Tok.is(tok::kw___declspec))
+    ParseMicrosoftDeclSpec(attrs);
+
   bool AllowFixedUnderlyingType 
     = getLang().CPlusPlus0x || getLang().MicrosoftExt || getLang().ObjC2;
 
@@ -4226,6 +4241,8 @@
   ExprResult NoexceptExpr;
   ParsedType TrailingReturnType;
   
+  Actions.ActOnStartFunctionDeclarator();
+
   SourceLocation EndLoc;
   if (isFunctionDeclaratorIdentifierList()) {
     if (RequiresArg)
@@ -4308,6 +4325,8 @@
                                              EndLoc, D,
                                              TrailingReturnType),
                 attrs, EndLoc);
+
+  Actions.ActOnEndFunctionDeclarator();
 }
 
 /// isFunctionDeclaratorIdentifierList - This parameter list may have an

Modified: cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp Tue Mar  6 07:07:43 2012
@@ -272,6 +272,11 @@
   if (Invalid)
     return 0;
 
+  // FIXME: This is incorrect: linkage-specifiers are parsed in translation
+  // phase 7, so string-literal concatenation is supposed to occur.
+  //   extern "" "C" "" "+" "+" { } is legal.
+  if (Tok.hasUDSuffix())
+    Diag(Tok, diag::err_invalid_string_udl);
   SourceLocation Loc = ConsumeStringToken();
 
   ParseScope LinkageScope(this, Scope::DeclScope);
@@ -610,15 +615,17 @@
   if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "", tok::semi))
     return 0;
 
-  if (Tok.isNot(tok::string_literal)) {
+  if (!isTokenStringLiteral()) {
     Diag(Tok, diag::err_expected_string_literal);
     SkipUntil(tok::semi);
     return 0;
   }
 
   ExprResult AssertMessage(ParseStringLiteralExpression());
-  if (AssertMessage.isInvalid())
+  if (AssertMessage.isInvalid()) {
+    SkipUntil(tok::semi);
     return 0;
+  }
 
   T.consumeClose();
 
@@ -1782,11 +1789,15 @@
     return;
   }
 
+  // Hold late-parsed attributes so we can attach a Decl to them later.
+  LateParsedAttrList CommonLateParsedAttrs;
+
   // decl-specifier-seq:
   // Parse the common declaration-specifiers piece.
   ParsingDeclSpec DS(*this, TemplateDiags);
   DS.takeAttributesFrom(attrs);
-  ParseDeclarationSpecifiers(DS, TemplateInfo, AS, DSC_class);
+  ParseDeclarationSpecifiers(DS, TemplateInfo, AS, DSC_class,
+                             &CommonLateParsedAttrs);
 
   MultiTemplateParamsArg TemplateParams(Actions,
       TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->data() : 0,
@@ -1893,8 +1904,11 @@
         ParseCXXInlineMethodDef(AS, AccessAttrs, DeclaratorInfo, TemplateInfo,
                                 VS, DefinitionKind, Init);
 
+      for (unsigned i = 0, ni = CommonLateParsedAttrs.size(); i < ni; ++i) {
+        CommonLateParsedAttrs[i]->addDecl(FunDecl);
+      }
       for (unsigned i = 0, ni = LateParsedAttrs.size(); i < ni; ++i) {
-        LateParsedAttrs[i]->setDecl(FunDecl);
+        LateParsedAttrs[i]->addDecl(FunDecl);
       }
       LateParsedAttrs.clear();
 
@@ -1981,8 +1995,11 @@
     }
     
     // Set the Decl for any late parsed attributes
+    for (unsigned i = 0, ni = CommonLateParsedAttrs.size(); i < ni; ++i) {
+      CommonLateParsedAttrs[i]->addDecl(ThisDecl);
+    }
     for (unsigned i = 0, ni = LateParsedAttrs.size(); i < ni; ++i) {
-      LateParsedAttrs[i]->setDecl(ThisDecl);
+      LateParsedAttrs[i]->addDecl(ThisDecl);
     }
     LateParsedAttrs.clear();
 

Modified: cfe/branches/tooling/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseExpr.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseExpr.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseExpr.cpp Tue Mar  6 07:07:43 2012
@@ -258,7 +258,8 @@
                                                Sema::ConstantEvaluated);
 
   ExprResult LHS(ParseCastExpression(false, false, isTypeCast));
-  return ParseRHSOfBinaryExpression(LHS, prec::Conditional);
+  ExprResult Res(ParseRHSOfBinaryExpression(LHS, prec::Conditional));
+  return Actions.ActOnConstantExpression(Res);
 }
 
 /// ParseRHSOfBinaryExpression - Parse a binary expression that starts with
@@ -352,22 +353,18 @@
     // Therefore we need some special-casing here.
     // Also note that the third operand of the conditional operator is
     // an assignment-expression in C++, and in C++11, we can have a
-    // braced-init-list on the RHS of an assignment.
+    // braced-init-list on the RHS of an assignment. For better diagnostics,
+    // parse as if we were allowed braced-init-lists everywhere, and check that
+    // they only appear on the RHS of assignments later.
     ExprResult RHS;
-    if (getLang().CPlusPlus0x && MinPrec == prec::Assignment &&
-        Tok.is(tok::l_brace)) {
-      Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
+    bool RHSIsInitList = false;
+    if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) {
       RHS = ParseBraceInitializer();
-      if (LHS.isInvalid() || RHS.isInvalid())
-        return ExprError();
-      // A braced-init-list can never be followed by more operators.
-      return Actions.ActOnBinOp(getCurScope(), OpToken.getLocation(),
-                                OpToken.getKind(), LHS.take(), RHS.take());
-    } else if (getLang().CPlusPlus && NextTokPrec <= prec::Conditional) {
+      RHSIsInitList = true;
+    } else if (getLang().CPlusPlus && NextTokPrec <= prec::Conditional)
       RHS = ParseAssignmentExpression();
-    } else {
+    else
       RHS = ParseCastExpression(false);
-    }
 
     if (RHS.isInvalid())
       LHS = ExprError();
@@ -386,6 +383,11 @@
     // more tightly with RHS than we do, evaluate it completely first.
     if (ThisPrec < NextTokPrec ||
         (ThisPrec == NextTokPrec && isRightAssoc)) {
+      if (!RHS.isInvalid() && RHSIsInitList) {
+        Diag(Tok, diag::err_init_list_bin_op)
+          << /*LHS*/0 << PP.getSpelling(Tok) << Actions.getExprRange(RHS.get());
+        RHS = ExprError();
+      }
       // If this is left-associative, only parse things on the RHS that bind
       // more tightly than the current operator.  If it is left-associative, it
       // is okay, to bind exactly as tightly.  For example, compile A=B=C=D as
@@ -393,6 +395,7 @@
       // The function takes ownership of the RHS.
       RHS = ParseRHSOfBinaryExpression(RHS, 
                             static_cast<prec::Level>(ThisPrec + !isRightAssoc));
+      RHSIsInitList = false;
 
       if (RHS.isInvalid())
         LHS = ExprError();
@@ -402,6 +405,18 @@
     }
     assert(NextTokPrec <= ThisPrec && "Recursion didn't work!");
 
+    if (!RHS.isInvalid() && RHSIsInitList) {
+      if (ThisPrec == prec::Assignment) {
+        Diag(OpToken, diag::warn_cxx98_compat_generalized_initializer_lists)
+          << Actions.getExprRange(RHS.get());
+      } else {
+        Diag(OpToken, diag::err_init_list_bin_op)
+          << /*RHS*/1 << PP.getSpelling(OpToken)
+          << Actions.getExprRange(RHS.get());
+        LHS = ExprError();
+      }
+    }
+
     if (!LHS.isInvalid()) {
       // Combine the LHS and RHS into the LHS (e.g. build AST).
       if (TernaryMiddle.isInvalid()) {
@@ -482,14 +497,14 @@
 ///         unary-operator cast-expression
 ///         'sizeof' unary-expression
 ///         'sizeof' '(' type-name ')'
-/// [C++0x] 'sizeof' '...' '(' identifier ')'
+/// [C++11] 'sizeof' '...' '(' identifier ')'
 /// [GNU]   '__alignof' unary-expression
 /// [GNU]   '__alignof' '(' type-name ')'
-/// [C++0x] 'alignof' '(' type-id ')'
+/// [C++11] 'alignof' '(' type-id ')'
 /// [GNU]   '&&' identifier
+/// [C++11] 'noexcept' '(' expression ')' [C++11 5.3.7]
 /// [C++]   new-expression
 /// [C++]   delete-expression
-/// [C++0x] 'noexcept' '(' expression ')'
 ///
 ///       unary-operator: one of
 ///         '&'  '*'  '+'  '-'  '~'  '!'
@@ -501,7 +516,8 @@
 ///         constant
 ///         string-literal
 /// [C++]   boolean-literal  [C++ 2.13.5]
-/// [C++0x] 'nullptr'        [C++0x 2.14.7]
+/// [C++11] 'nullptr'        [C++11 2.14.7]
+/// [C++11] user-defined-literal
 ///         '(' expression ')'
 /// [C11]   generic-selection
 ///         '__func__'        [C99 6.4.2.2]
@@ -520,9 +536,9 @@
 /// [OBJC]  '@encode' '(' type-name ')'
 /// [OBJC]  objc-string-literal
 /// [C++]   simple-type-specifier '(' expression-list[opt] ')'      [C++ 5.2.3]
-/// [C++0x] simple-type-specifier braced-init-list                  [C++ 5.2.3]
+/// [C++11] simple-type-specifier braced-init-list                  [C++11 5.2.3]
 /// [C++]   typename-specifier '(' expression-list[opt] ')'         [C++ 5.2.3]
-/// [C++0x] typename-specifier braced-init-list                     [C++ 5.2.3]
+/// [C++11] typename-specifier braced-init-list                     [C++11 5.2.3]
 /// [C++]   'const_cast' '<' type-name '>' '(' expression ')'       [C++ 5.2p1]
 /// [C++]   'dynamic_cast' '<' type-name '>' '(' expression ')'     [C++ 5.2p1]
 /// [C++]   'reinterpret_cast' '<' type-name '>' '(' expression ')' [C++ 5.2p1]
@@ -835,7 +851,7 @@
   case tok::utf8_string_literal:
   case tok::utf16_string_literal:
   case tok::utf32_string_literal:
-    Res = ParseStringLiteralExpression();
+    Res = ParseStringLiteralExpression(true);
     break;
   case tok::kw__Generic:   // primary-expression: generic-selection [C11 6.5.1]
     Res = ParseGenericSelectionExpression();
@@ -2087,7 +2103,7 @@
 ///
 ///       primary-expression: [C99 6.5.1]
 ///         string-literal
-ExprResult Parser::ParseStringLiteralExpression() {
+ExprResult Parser::ParseStringLiteralExpression(bool AllowUserDefinedLiteral) {
   assert(isTokenStringLiteral() && "Not a string literal!");
 
   // String concat.  Note that keywords like __func__ and __FUNCTION__ are not
@@ -2095,6 +2111,12 @@
   SmallVector<Token, 4> StringToks;
 
   do {
+    if (!AllowUserDefinedLiteral && Tok.hasUDSuffix()) {
+      Diag(Tok, diag::err_invalid_string_udl);
+      do ConsumeStringToken(); while (isTokenStringLiteral());
+      return ExprError();
+    }
+
     StringToks.push_back(Tok);
     ConsumeStringToken();
   } while (isTokenStringLiteral());

Modified: cfe/branches/tooling/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseExprCXX.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseExprCXX.cpp Tue Mar  6 07:07:43 2012
@@ -1905,8 +1905,13 @@
 
   if (getLang().CPlusPlus0x && Tok.is(tok::string_literal)) {
     Diag(Tok.getLocation(), diag::warn_cxx98_compat_literal_operator);
+    // FIXME: Add a FixIt to insert a space before the suffix, and recover.
+    if (Tok.hasUDSuffix()) {
+      Diag(Tok.getLocation(), diag::err_literal_operator_missing_space);
+      return true;
+    }
     if (Tok.getLength() != 2)
-      Diag(Tok.getLocation(), diag::err_operator_string_not_empty);
+      Diag(Tok.getLocation(), diag::err_literal_operator_string_not_empty);
     ConsumeStringToken();
 
     if (Tok.isNot(tok::identifier)) {

Modified: cfe/branches/tooling/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseObjc.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseObjc.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseObjc.cpp Tue Mar  6 07:07:43 2012
@@ -64,7 +64,7 @@
   case tok::objc_dynamic:
     SingleDecl = ParseObjCPropertyDynamic(AtLoc);
     break;
-  case tok::objc_import:
+  case tok::objc___experimental_modules_import:
     if (getLang().Modules)
       return ParseModuleImport(AtLoc);
       
@@ -295,13 +295,15 @@
   SmallVectorImpl<Decl *> &Props;
   ObjCDeclSpec &OCDS;
   SourceLocation AtLoc;
+  SourceLocation LParenLoc;
   tok::ObjCKeywordKind MethodImplKind;
         
   ObjCPropertyCallback(Parser &P, 
                        SmallVectorImpl<Decl *> &Props,
                        ObjCDeclSpec &OCDS, SourceLocation AtLoc,
+                       SourceLocation LParenLoc,
                        tok::ObjCKeywordKind MethodImplKind) :
-    P(P), Props(Props), OCDS(OCDS), AtLoc(AtLoc),
+    P(P), Props(Props), OCDS(OCDS), AtLoc(AtLoc), LParenLoc(LParenLoc),
     MethodImplKind(MethodImplKind) {
   }
 
@@ -333,7 +335,8 @@
                                                      FD.D.getIdentifier());
     bool isOverridingProperty = false;
     Decl *Property =
-      P.Actions.ActOnProperty(P.getCurScope(), AtLoc, FD, OCDS,
+      P.Actions.ActOnProperty(P.getCurScope(), AtLoc, LParenLoc,
+                              FD, OCDS,
                               GetterSel, SetterSel, 
                               &isOverridingProperty,
                               MethodImplKind);
@@ -478,12 +481,15 @@
         Diag(AtLoc, diag::err_objc_properties_require_objc2);
 
       ObjCDeclSpec OCDS;
+      SourceLocation LParenLoc;
       // Parse property attribute list, if any.
-      if (Tok.is(tok::l_paren))
+      if (Tok.is(tok::l_paren)) {
+        LParenLoc = Tok.getLocation();
         ParseObjCPropertyAttribute(OCDS);
+      }
 
       ObjCPropertyCallback Callback(*this, allProperties,
-                                    OCDS, AtLoc, MethodImplKind);
+                                    OCDS, AtLoc, LParenLoc, MethodImplKind);
 
       // Parse all the comma separated declarators.
       DeclSpec DS(AttrFactory);
@@ -2005,6 +2011,8 @@
 
   case tok::string_literal:    // primary-expression: string-literal
   case tok::wide_string_literal:
+    if (Tok.hasUDSuffix())
+      return ExprError(Diag(Tok, diag::err_invalid_string_udl));
     return ParsePostfixExpressionSuffix(ParseObjCStringLiteral(AtLoc));
   default:
     if (Tok.getIdentifierInfo() == 0)

Modified: cfe/branches/tooling/lib/Parse/ParsePragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParsePragma.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParsePragma.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParsePragma.cpp Tue Mar  6 07:07:43 2012
@@ -52,7 +52,6 @@
   SourceLocation PragmaLoc = ConsumeToken();
   Actions.ActOnPragmaPack(Info->Kind, Info->Name, Info->Alignment, PragmaLoc,
                           Info->LParenLoc, Info->RParenLoc);
-  delete Info;
 }
 
 // #pragma GCC visibility comes in two variants:
@@ -214,20 +213,26 @@
     return;
   }
 
-  PragmaPackInfo *Info = new PragmaPackInfo;
+  PragmaPackInfo *Info = 
+    (PragmaPackInfo*) PP.getPreprocessorAllocator().Allocate(
+      sizeof(PragmaPackInfo), llvm::alignOf<PragmaPackInfo>());
+  new (Info) PragmaPackInfo();
   Info->Kind = Kind;
   Info->Name = Name;
   Info->Alignment = Alignment.release();
   Info->LParenLoc = LParenLoc;
   Info->RParenLoc = RParenLoc;
 
-  Token *Toks = new Token[1];
+  Token *Toks = 
+    (Token*) PP.getPreprocessorAllocator().Allocate(
+      sizeof(Token) * 1, llvm::alignOf<Token>());
+  new (Toks) Token();
   Toks[0].startToken();
   Toks[0].setKind(tok::annot_pragma_pack);
   Toks[0].setLocation(PackLoc);
   Toks[0].setAnnotationValue(static_cast<void*>(Info));
   PP.EnterTokenStream(Toks, 1, /*DisableMacroExpansion=*/true,
-                      /*OwnsTokens=*/true);
+                      /*OwnsTokens=*/false);
 }
 
 // #pragma ms_struct on
@@ -256,7 +261,8 @@
   }
   
   if (Tok.isNot(tok::eod)) {
-    PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) << "ms_struct";
+    PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
+      << "ms_struct";
     return;
   }
   Actions.ActOnPragmaMSStruct(Kind);
@@ -401,7 +407,9 @@
   // This allows us to cache a "#pragma unused" that occurs inside an inline
   // C++ member function.
 
-  Token *Toks = new Token[2*Identifiers.size()];
+  Token *Toks = 
+    (Token*) PP.getPreprocessorAllocator().Allocate(
+      sizeof(Token) * 2 * Identifiers.size(), llvm::alignOf<Token>());
   for (unsigned i=0; i != Identifiers.size(); i++) {
     Token &pragmaUnusedTok = Toks[2*i], &idTok = Toks[2*i+1];
     pragmaUnusedTok.startToken();
@@ -409,7 +417,8 @@
     pragmaUnusedTok.setLocation(UnusedLoc);
     idTok = Identifiers[i];
   }
-  PP.EnterTokenStream(Toks, 2*Identifiers.size(), /*DisableMacroExpansion=*/true, /*OwnsTokens=*/true);
+  PP.EnterTokenStream(Toks, 2*Identifiers.size(),
+                      /*DisableMacroExpansion=*/true, /*OwnsTokens=*/false);
 }
 
 // #pragma weak identifier

Modified: cfe/branches/tooling/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseStmt.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseStmt.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseStmt.cpp Tue Mar  6 07:07:43 2012
@@ -1797,10 +1797,8 @@
 
   ExprResult AsmString(ParseAsmStringLiteral());
   if (AsmString.isInvalid()) {
-    // If the reason we are recovering is because of an improper string
-    // literal, it makes the most sense just to consume to the ')'.
-    if (isTokenStringLiteral())
-      T.skipToEnd();
+    // Consume up to and including the closing paren.
+    T.skipToEnd();
     return StmtError();
   }
 

Modified: cfe/branches/tooling/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/Parser.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/Parser.cpp (original)
+++ cfe/branches/tooling/lib/Parse/Parser.cpp Tue Mar  6 07:07:43 2012
@@ -1127,9 +1127,13 @@
   switch (Tok.getKind()) {
     case tok::string_literal:
       break;
+    case tok::utf8_string_literal:
+    case tok::utf16_string_literal:
+    case tok::utf32_string_literal:
     case tok::wide_string_literal: {
       SourceLocation L = Tok.getLocation();
       Diag(Tok, diag::err_asm_operand_wide_string_literal)
+        << (Tok.getKind() == tok::wide_string_literal)
         << SourceRange(L, L);
       return ExprError();
     }
@@ -1138,10 +1142,7 @@
       return ExprError();
   }
 
-  ExprResult Res(ParseStringLiteralExpression());
-  if (Res.isInvalid()) return move(Res);
-
-  return move(Res);
+  return ParseStringLiteralExpression();
 }
 
 /// ParseSimpleAsm
@@ -1609,7 +1610,7 @@
 }
 
 Parser::DeclGroupPtrTy Parser::ParseModuleImport(SourceLocation AtLoc) {
-  assert(Tok.isObjCAtKeyword(tok::objc_import) && 
+  assert(Tok.isObjCAtKeyword(tok::objc___experimental_modules_import) && 
          "Improper start to module import");
   SourceLocation ImportLoc = ConsumeToken();
   

Modified: cfe/branches/tooling/lib/Rewrite/HTMLRewrite.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Rewrite/HTMLRewrite.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Rewrite/HTMLRewrite.cpp (original)
+++ cfe/branches/tooling/lib/Rewrite/HTMLRewrite.cpp Tue Mar  6 07:07:43 2012
@@ -409,6 +409,7 @@
       --TokLen;
       // FALL THROUGH.
     case tok::string_literal:
+      // FIXME: Exclude the optional ud-suffix from the highlighted range.
       HighlightRange(RB, TokOffs, TokOffs+TokLen, BufferStart,
                      "<span class='string_literal'>", "</span>");
       break;

Modified: cfe/branches/tooling/lib/Rewrite/RewriteMacros.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Rewrite/RewriteMacros.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Rewrite/RewriteMacros.cpp (original)
+++ cfe/branches/tooling/lib/Rewrite/RewriteMacros.cpp Tue Mar  6 07:07:43 2012
@@ -167,7 +167,7 @@
       // Comment out a whole run of tokens instead of bracketing each one with
       // comments.  Add a leading space if RawTok didn't have one.
       bool HasSpace = RawTok.hasLeadingSpace();
-      RB.InsertTextAfter(RawOffs, " /*"+HasSpace);
+      RB.InsertTextAfter(RawOffs, &" /*"[HasSpace]);
       unsigned EndPos;
 
       do {

Modified: cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp Tue Mar  6 07:07:43 2012
@@ -6533,14 +6533,14 @@
                                               SourceLocation(),
                                               addExpr);
       QualType IvarT = D->getType();
-      convertBlockPointerToFunctionPointer(IvarT);
+      convertObjCTypeToCStyleType(IvarT);
       QualType castT = Context->getPointerType(IvarT);
       
       castExpr = NoTypeInfoCStyleCastExpr(Context, 
                                           castT,
                                           CK_BitCast,
                                           PE);
-      Expr *Exp = new (Context) UnaryOperator(castExpr, UO_Deref, castT,
+      Expr *Exp = new (Context) UnaryOperator(castExpr, UO_Deref, IvarT,
                                               VK_LValue, OK_Ordinary,
                                               SourceLocation());
       PE = new (Context) ParenExpr(OldRange.getBegin(),

Modified: cfe/branches/tooling/lib/Sema/DelayedDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/DelayedDiagnostic.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/DelayedDiagnostic.cpp (original)
+++ cfe/branches/tooling/lib/Sema/DelayedDiagnostic.cpp Tue Mar  6 07:07:43 2012
@@ -20,13 +20,15 @@
 using namespace sema;
 
 DelayedDiagnostic DelayedDiagnostic::makeDeprecation(SourceLocation Loc,
-                                                     const NamedDecl *D,
-                                                     StringRef Msg) {
+                                    const NamedDecl *D,
+                                    const ObjCInterfaceDecl *UnknownObjCClass,
+                                    StringRef Msg) {
   DelayedDiagnostic DD;
   DD.Kind = Deprecation;
   DD.Triggered = false;
   DD.Loc = Loc;
   DD.DeprecationData.Decl = D;
+  DD.DeprecationData.UnknownObjCClass = UnknownObjCClass;
   char *MessageData = 0;
   if (Msg.size()) {
     MessageData = new char [Msg.size()];

Modified: cfe/branches/tooling/lib/Sema/IdentifierResolver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/IdentifierResolver.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/IdentifierResolver.cpp (original)
+++ cfe/branches/tooling/lib/Sema/IdentifierResolver.cpp Tue Mar  6 07:07:43 2012
@@ -113,7 +113,7 @@
                              bool ExplicitInstantiationOrSpecialization) const {
   Ctx = Ctx->getRedeclContext();
 
-  if (Ctx->isFunctionOrMethod()) {
+  if (Ctx->isFunctionOrMethod() || S->isFunctionPrototypeScope()) {
     // Ignore the scopes associated within transparent declaration contexts.
     while (S->getEntity() &&
            ((DeclContext *)S->getEntity())->isTransparentContext())

Modified: cfe/branches/tooling/lib/Sema/Scope.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/Scope.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/Scope.cpp (original)
+++ cfe/branches/tooling/lib/Sema/Scope.cpp Tue Mar  6 07:07:43 2012
@@ -59,3 +59,13 @@
   Entity = 0;
   ErrorTrap.reset();
 }
+
+bool Scope::containedInPrototypeScope() const {
+  const Scope *S = this;
+  while (S) {
+    if (S->isFunctionPrototypeScope())
+      return true;
+    S = S->getParent();
+  }
+  return false;
+}

Modified: cfe/branches/tooling/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/Sema.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/Sema.cpp (original)
+++ cfe/branches/tooling/lib/Sema/Sema.cpp Tue Mar  6 07:07:43 2012
@@ -94,7 +94,7 @@
     ObjCShouldCallSuperDealloc(false),
     ObjCShouldCallSuperFinalize(false),
     TUKind(TUKind),
-    NumSFINAEErrors(0), SuppressAccessChecking(false), 
+    NumSFINAEErrors(0), InFunctionDeclarator(0), SuppressAccessChecking(false), 
     AccessCheckingSFINAE(false), InNonInstantiationSFINAEContext(false),
     NonInstantiationEntries(0), ArgumentPackSubstitutionIndex(-1),
     CurrentInstantiationScope(0), TyposCorrected(0),

Modified: cfe/branches/tooling/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDecl.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDecl.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDecl.cpp Tue Mar  6 07:07:43 2012
@@ -1249,6 +1249,15 @@
   }
 }
 
+void Sema::ActOnStartFunctionDeclarator() {
+  ++InFunctionDeclarator;
+}
+
+void Sema::ActOnEndFunctionDeclarator() {
+  assert(InFunctionDeclarator);
+  --InFunctionDeclarator;
+}
+
 /// \brief Look for an Objective-C class in the translation unit.
 ///
 /// \param Id The name of the Objective-C class we're looking for. If
@@ -5241,6 +5250,15 @@
   // Finally, we know we have the right number of parameters, install them.
   NewFD->setParams(Params);
 
+  // Find all anonymous symbols defined during the declaration of this function
+  // and add to NewFD. This lets us track decls such 'enum Y' in:
+  //
+  //   void f(enum Y {AA} x) {}
+  //
+  // which would otherwise incorrectly end up in the translation unit scope.
+  NewFD->setDeclsInPrototypeScope(DeclsInPrototypeScope);
+  DeclsInPrototypeScope.clear();
+
   // Process the non-inheritable attributes on this declaration.
   ProcessDeclAttributes(S, NewFD, D,
                         /*NonInheritable=*/true, /*Inheritable=*/false);
@@ -7225,6 +7243,43 @@
     }
   }
 
+  // If we had any tags defined in the function prototype,
+  // introduce them into the function scope.
+  if (FnBodyScope) {
+    for (llvm::ArrayRef<NamedDecl*>::iterator I = FD->getDeclsInPrototypeScope().begin(),
+           E = FD->getDeclsInPrototypeScope().end(); I != E; ++I) {
+      NamedDecl *D = *I;
+
+      // Some of these decls (like enums) may have been pinned to the translation unit
+      // for lack of a real context earlier. If so, remove from the translation unit
+      // and reattach to the current context.
+      if (D->getLexicalDeclContext() == Context.getTranslationUnitDecl()) {
+        // Is the decl actually in the context?
+        for (DeclContext::decl_iterator DI = Context.getTranslationUnitDecl()->decls_begin(),
+               DE = Context.getTranslationUnitDecl()->decls_end(); DI != DE; ++DI) {
+          if (*DI == D) {  
+            Context.getTranslationUnitDecl()->removeDecl(D);
+            break;
+          }
+        }
+        // Either way, reassign the lexical decl context to our FunctionDecl.
+        D->setLexicalDeclContext(CurContext);
+      }
+
+      // If the decl has a non-null name, make accessible in the current scope.
+      if (!D->getName().empty())
+        PushOnScopeChains(D, FnBodyScope, /*AddToContext=*/false);
+
+      // Similarly, dive into enums and fish their constants out, making them
+      // accessible in this scope.
+      if (EnumDecl *ED = dyn_cast<EnumDecl>(D)) {
+        for (EnumDecl::enumerator_iterator EI = ED->enumerator_begin(),
+               EE = ED->enumerator_end(); EI != EE; ++EI)
+          PushOnScopeChains(*EI, FnBodyScope, /*AddToContext=*/false);
+      }
+    }
+  }
+
   // Checking attributes of current function definition
   // dllimport attribute.
   DLLImportAttr *DA = FD->getAttr<DLLImportAttr>();
@@ -8177,7 +8232,12 @@
                   !isa<CXXRecordDecl>(Def) ||
                   cast<CXXRecordDecl>(Def)->getTemplateSpecializationKind() 
                                                == TSK_ExplicitSpecialization) {
-                Diag(NameLoc, diag::err_redefinition) << Name;
+                // A redeclaration in function prototype scope in C isn't
+                // visible elsewhere, so merely issue a warning.
+                if (!getLangOptions().CPlusPlus && S->containedInPrototypeScope())
+                  Diag(NameLoc, diag::warn_redefinition_in_param_list) << Name;
+                else
+                  Diag(NameLoc, diag::err_redefinition) << Name;
                 Diag(Def->getLocation(), diag::note_previous_definition);
                 // If this is a redefinition, recover by making this
                 // struct be anonymous, which will make any later
@@ -8459,6 +8519,12 @@
         II->isStr("FILE"))
       Context.setFILEDecl(New);
 
+  // If we were in function prototype scope (and not in C++ mode), add this
+  // tag to the list of decls to inject into the function definition scope.
+  if (S->isFunctionPrototypeScope() && !getLangOptions().CPlusPlus &&
+      InFunctionDeclarator && Name)
+    DeclsInPrototypeScope.push_back(New);
+
   OwnedDecl = true;
   return New;
 }
@@ -10142,6 +10208,12 @@
 
   Enum->completeDefinition(BestType, BestPromotionType,
                            NumPositiveBits, NumNegativeBits);
+
+  // If we're declaring a function, ensure this decl isn't forgotten about -
+  // it needs to go into the function scope.
+  if (InFunctionDeclarator)
+    DeclsInPrototypeScope.push_back(Enum);
+
 }
 
 Decl *Sema::ActOnFileScopeAsmDecl(Expr *expr,

Modified: cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp Tue Mar  6 07:07:43 2012
@@ -1794,8 +1794,15 @@
       return;
     }
   }
-  else 
+  else if (!isa<ObjCPropertyDecl>(D)) {
+    // It is okay to include this attribute on properties, e.g.:
+    //
+    //  @property (retain, nonatomic) struct Bork *Q __attribute__((NSObject));
+    //
+    // In this case it follows tradition and suppresses an error in the above
+    // case.    
     S.Diag(D->getLocation(), diag::warn_nsobject_attribute);
+  }
   D->addAttr(::new (S.Context) ObjCNSObjectAttr(Attr.getRange(), S.Context));
 }
 
@@ -4114,6 +4121,11 @@
     Diag(DD.Loc, diag::warn_deprecated_message)
       << DD.getDeprecationDecl()->getDeclName()
       << DD.getDeprecationMessage();
+  else if (DD.getUnknownObjCClass()) {
+    Diag(DD.Loc, diag::warn_deprecated_fwdclass_message) 
+      << DD.getDeprecationDecl()->getDeclName();
+    Diag(DD.getUnknownObjCClass()->getLocation(), diag::note_forward_class);
+  }
   else
     Diag(DD.Loc, diag::warn_deprecated)
       << DD.getDeprecationDecl()->getDeclName();
@@ -4124,7 +4136,9 @@
                                   const ObjCInterfaceDecl *UnknownObjCClass) {
   // Delay if we're currently parsing a declaration.
   if (DelayedDiagnostics.shouldDelayDiagnostics()) {
-    DelayedDiagnostics.add(DelayedDiagnostic::makeDeprecation(Loc, D, Message));
+    DelayedDiagnostics.add(DelayedDiagnostic::makeDeprecation(Loc, D, 
+                                                              UnknownObjCClass,
+                                                              Message));
     return;
   }
 

Modified: cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp Tue Mar  6 07:07:43 2012
@@ -1128,13 +1128,15 @@
     QualType NewBaseType
       = Context.getCanonicalType(Bases[idx]->getType());
     NewBaseType = NewBaseType.getLocalUnqualifiedType();
-    if (KnownBaseTypes[NewBaseType]) {
+
+    CXXBaseSpecifier *&KnownBase = KnownBaseTypes[NewBaseType];
+    if (KnownBase) {
       // C++ [class.mi]p3:
       //   A class shall not be specified as a direct base class of a
       //   derived class more than once.
       Diag(Bases[idx]->getSourceRange().getBegin(),
            diag::err_duplicate_base_class)
-        << KnownBaseTypes[NewBaseType]->getType()
+        << KnownBase->getType()
         << Bases[idx]->getSourceRange();
 
       // Delete the duplicate base class specifier; we're going to
@@ -1144,7 +1146,7 @@
       Invalid = true;
     } else {
       // Okay, add this new base class.
-      KnownBaseTypes[NewBaseType] = Bases[idx];
+      KnownBase = Bases[idx];
       Bases[NumGoodBases++] = Bases[idx];
       if (const RecordType *Record = NewBaseType->getAs<RecordType>())
         if (const CXXRecordDecl *RD = cast<CXXRecordDecl>(Record->getDecl()))
@@ -8825,15 +8827,6 @@
        SourceLocation CurrentLocation,
        CXXConversionDecl *Conv) 
 {
-  CXXRecordDecl *Lambda = Conv->getParent();
-  
-  // Make sure that the lambda call operator is marked used.
-  CXXMethodDecl *CallOperator 
-    = cast<CXXMethodDecl>(
-        *Lambda->lookup(
-          Context.DeclarationNames.getCXXOperatorName(OO_Call)).first);
-  CallOperator->setReferenced();
-  CallOperator->setUsed();
   Conv->setUsed();
   
   ImplicitlyDefinedFunctionScope Scope(*this, Conv);
@@ -8842,79 +8835,29 @@
   // Copy-initialize the lambda object as needed to capture it.
   Expr *This = ActOnCXXThis(CurrentLocation).take();
   Expr *DerefThis =CreateBuiltinUnaryOp(CurrentLocation, UO_Deref, This).take();
-  ExprResult Init = PerformCopyInitialization(
-                      InitializedEntity::InitializeBlock(CurrentLocation, 
-                                                         DerefThis->getType(), 
-                                                         /*NRVO=*/false),
-                      CurrentLocation, DerefThis);
-  if (!Init.isInvalid())
-    Init = ActOnFinishFullExpr(Init.take());
   
-  if (Init.isInvalid()) {
+  ExprResult BuildBlock = BuildBlockForLambdaConversion(CurrentLocation,
+                                                        Conv->getLocation(),
+                                                        Conv, DerefThis);
+
+  // If we're not under ARC, make sure we still get the _Block_copy/autorelease
+  // behavior.  Note that only the general conversion function does this
+  // (since it's unusable otherwise); in the case where we inline the
+  // block literal, it has block literal lifetime semantics.
+  if (!BuildBlock.isInvalid() && !getLangOptions().ObjCAutoRefCount)
+    BuildBlock = ImplicitCastExpr::Create(Context, BuildBlock.get()->getType(),
+                                          CK_CopyAndAutoreleaseBlockObject,
+                                          BuildBlock.get(), 0, VK_RValue);
+
+  if (BuildBlock.isInvalid()) {
     Diag(CurrentLocation, diag::note_lambda_to_block_conv);
     Conv->setInvalidDecl();
     return;
   }
-  
-  // Create the new block to be returned.
-  BlockDecl *Block = BlockDecl::Create(Context, Conv, Conv->getLocation());
-  
-  // Set the type information.
-  Block->setSignatureAsWritten(CallOperator->getTypeSourceInfo());
-  Block->setIsVariadic(CallOperator->isVariadic());
-  Block->setBlockMissingReturnType(false);
-  
-  // Add parameters.
-  SmallVector<ParmVarDecl *, 4> BlockParams;
-  for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I) {
-    ParmVarDecl *From = CallOperator->getParamDecl(I);
-    BlockParams.push_back(ParmVarDecl::Create(Context, Block,
-                                              From->getLocStart(),
-                                              From->getLocation(),
-                                              From->getIdentifier(),
-                                              From->getType(),
-                                              From->getTypeSourceInfo(),
-                                              From->getStorageClass(),
-                                            From->getStorageClassAsWritten(),
-                                              /*DefaultArg=*/0));
-  }
-  Block->setParams(BlockParams);
-  
-  // Add capture. The capture uses a fake variable, which doesn't correspond
-  // to any actual memory location. However, the initializer copy-initializes
-  // the lambda object.
-  TypeSourceInfo *CapVarTSI =
-      Context.getTrivialTypeSourceInfo(DerefThis->getType());
-  VarDecl *CapVar = VarDecl::Create(Context, Block, Conv->getLocation(),
-                                    Conv->getLocation(), 0,
-                                    DerefThis->getType(), CapVarTSI,
-                                    SC_None, SC_None);
-  BlockDecl::Capture Capture(/*Variable=*/CapVar, /*ByRef=*/false,
-                             /*Nested=*/false, /*Copy=*/Init.take());
-  Block->setCaptures(Context, &Capture, &Capture + 1, 
-                     /*CapturesCXXThis=*/false);
-  
-  // Add a fake function body to the block. IR generation is responsible
-  // for filling in the actual body, which cannot be expressed as an AST.
-  Block->setBody(new (Context) CompoundStmt(Context, 0, 0, 
-                                            Conv->getLocation(),
-                                            Conv->getLocation()));
-
-  // Create the block literal expression.
-  Expr *BuildBlock = new (Context) BlockExpr(Block, Conv->getConversionType());
-  ExprCleanupObjects.push_back(Block);
-  ExprNeedsCleanups = true;
 
-  // If we're not under ARC, make sure we still get the _Block_copy/autorelease
-  // behavior.
-  if (!getLangOptions().ObjCAutoRefCount)
-    BuildBlock = ImplicitCastExpr::Create(Context, BuildBlock->getType(),
-                                          CK_CopyAndAutoreleaseBlockObject,
-                                          BuildBlock, 0, VK_RValue);
-  
   // Create the return statement that returns the block from the conversion
   // function.
-  StmtResult Return = ActOnReturnStmt(Conv->getLocation(), BuildBlock);
+  StmtResult Return = ActOnReturnStmt(Conv->getLocation(), BuildBlock.get());
   if (Return.isInvalid()) {
     Diag(CurrentLocation, diag::note_lambda_to_block_conv);
     Conv->setInvalidDecl();
@@ -9356,12 +9299,17 @@
     return true;
   }
 
+  if (FnDecl->isExternC()) {
+    Diag(FnDecl->getLocation(), diag::err_literal_operator_extern_c);
+    return true;
+  }
+
   bool Valid = false;
 
   // template <char...> type operator "" name() is the only valid template
   // signature, and the only valid signature with no parameters.
-  if (FnDecl->param_size() == 0) {
-    if (FunctionTemplateDecl *TpDecl = FnDecl->getDescribedFunctionTemplate()) {
+  if (FunctionTemplateDecl *TpDecl = FnDecl->getDescribedFunctionTemplate()) {
+    if (FnDecl->param_size() == 0) {
       // Must have only one template parameter
       TemplateParameterList *Params = TpDecl->getTemplateParameters();
       if (Params->size() == 1) {
@@ -9374,11 +9322,11 @@
           Valid = true;
       }
     }
-  } else {
+  } else if (FnDecl->param_size()) {
     // Check the first parameter
     FunctionDecl::param_iterator Param = FnDecl->param_begin();
 
-    QualType T = (*Param)->getType();
+    QualType T = (*Param)->getType().getUnqualifiedType();
 
     // unsigned long long int, long double, and any character type are allowed
     // as the only parameters.
@@ -9398,7 +9346,7 @@
     if (!PT)
       goto FinishedParams;
     T = PT->getPointeeType();
-    if (!T.isConstQualified())
+    if (!T.isConstQualified() || T.isVolatileQualified())
       goto FinishedParams;
     T = T.getUnqualifiedType();
 
@@ -9698,9 +9646,13 @@
           /*AllowFold=*/false).isInvalid())
       return 0;
 
-    if (!Cond)
+    if (!Cond) {
+      llvm::SmallString<256> MsgBuffer;
+      llvm::raw_svector_ostream Msg(MsgBuffer);
+      AssertMessage->printPretty(Msg, Context, 0, getPrintingPolicy());
       Diag(StaticAssertLoc, diag::err_static_assert_failed)
-        << AssertMessage->getString() << AssertExpr->getSourceRange();
+        << Msg.str() << AssertExpr->getSourceRange();
+    }
   }
 
   if (DiagnoseUnexpandedParameterPack(AssertExpr, UPPC_StaticAssertExpression))

Modified: cfe/branches/tooling/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDeclObjC.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDeclObjC.cpp Tue Mar  6 07:07:43 2012
@@ -820,7 +820,7 @@
                       IdentifierInfo *CatName, SourceLocation CatLoc) {
   ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName, ClassLoc, true);
   ObjCCategoryDecl *CatIDecl = 0;
-  if (IDecl) {
+  if (IDecl && IDecl->hasDefinition()) {
     CatIDecl = IDecl->FindCategoryDeclaration(CatName);
     if (!CatIDecl) {
       // Category @implementation with no corresponding @interface.
@@ -2504,10 +2504,11 @@
 /// A helper class for searching for methods which a particular method
 /// overrides.
 class OverrideSearch {
+public:
   Sema &S;
   ObjCMethodDecl *Method;
-  llvm::SmallPtrSet<ObjCContainerDecl*, 8> Searched;
-  llvm::SmallPtrSet<ObjCMethodDecl*, 8> Overridden;
+  llvm::SmallPtrSet<ObjCContainerDecl*, 128> Searched;
+  llvm::SmallPtrSet<ObjCMethodDecl*, 4> Overridden;
   bool Recursive;
 
 public:
@@ -2539,7 +2540,7 @@
     searchFromContainer(container);
   }
 
-  typedef llvm::SmallPtrSet<ObjCMethodDecl*,8>::iterator iterator;
+  typedef llvm::SmallPtrSet<ObjCMethodDecl*, 128>::iterator iterator;
   iterator begin() const { return Overridden.begin(); }
   iterator end() const { return Overridden.end(); }
 

Modified: cfe/branches/tooling/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExpr.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExpr.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExpr.cpp Tue Mar  6 07:07:43 2012
@@ -587,6 +587,11 @@
       E = Comma.get();
     }
   }
+  // c++ rules are enforced elsewhere.
+  if (!getLangOptions().CPlusPlus &&
+      RequireCompleteType(E->getExprLoc(), E->getType(),
+                          diag::err_call_incomplete_argument))
+    return ExprError();
   
   return Owned(E);
 }
@@ -5943,6 +5948,46 @@
   return false;
 }
 
+/// diagnoseStringPlusInt - Emit a warning when adding an integer to a string
+/// literal.
+static void diagnoseStringPlusInt(Sema &Self, SourceLocation OpLoc,
+                                  Expr *LHSExpr, Expr *RHSExpr) {
+  StringLiteral* StrExpr = dyn_cast<StringLiteral>(LHSExpr->IgnoreImpCasts());
+  Expr* IndexExpr = RHSExpr;
+  if (!StrExpr) {
+    StrExpr = dyn_cast<StringLiteral>(RHSExpr->IgnoreImpCasts());
+    IndexExpr = LHSExpr;
+  }
+
+  bool IsStringPlusInt = StrExpr &&
+      IndexExpr->getType()->isIntegralOrUnscopedEnumerationType();
+  if (!IsStringPlusInt)
+    return;
+
+  llvm::APSInt index;
+  if (IndexExpr->EvaluateAsInt(index, Self.getASTContext())) {
+    unsigned StrLenWithNull = StrExpr->getLength() + 1;
+    if (index.isNonNegative() &&
+        index <= llvm::APSInt(llvm::APInt(index.getBitWidth(), StrLenWithNull),
+                              index.isUnsigned()))
+      return;
+  }
+
+  SourceRange DiagRange(LHSExpr->getLocStart(), RHSExpr->getLocEnd());
+  Self.Diag(OpLoc, diag::warn_string_plus_int)
+      << DiagRange << IndexExpr->IgnoreImpCasts()->getType();
+
+  // Only print a fixit for "str" + int, not for int + "str".
+  if (IndexExpr == RHSExpr) {
+    SourceLocation EndLoc = Self.PP.getLocForEndOfToken(RHSExpr->getLocEnd());
+    Self.Diag(OpLoc, diag::note_string_plus_int_silence)
+        << FixItHint::CreateInsertion(LHSExpr->getLocStart(), "&")
+        << FixItHint::CreateReplacement(SourceRange(OpLoc), "[")
+        << FixItHint::CreateInsertion(EndLoc, "]");
+  } else
+    Self.Diag(OpLoc, diag::note_string_plus_int_silence);
+}
+
 /// \brief Emit error when two pointers are incompatible.
 static void diagnosePointerIncompatibility(Sema &S, SourceLocation Loc,
                                            Expr *LHSExpr, Expr *RHSExpr) {
@@ -5954,7 +5999,8 @@
 }
 
 QualType Sema::CheckAdditionOperands( // C99 6.5.6
-  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, QualType* CompLHSTy) {
+    ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, unsigned Opc,
+    QualType* CompLHSTy) {
   checkArithmeticNull(*this, LHS, RHS, Loc, /*isCompare=*/false);
 
   if (LHS.get()->getType()->isVectorType() ||
@@ -5968,6 +6014,10 @@
   if (LHS.isInvalid() || RHS.isInvalid())
     return QualType();
 
+  // Diagnose "string literal" '+' int.
+  if (Opc == BO_Add)
+    diagnoseStringPlusInt(*this, Loc, LHS.get(), RHS.get());
+
   // handle the common case first (both operands are arithmetic).
   if (LHS.get()->getType()->isArithmeticType() &&
       RHS.get()->getType()->isArithmeticType()) {
@@ -7664,7 +7714,7 @@
     ResultTy = CheckRemainderOperands(LHS, RHS, OpLoc);
     break;
   case BO_Add:
-    ResultTy = CheckAdditionOperands(LHS, RHS, OpLoc);
+    ResultTy = CheckAdditionOperands(LHS, RHS, OpLoc, Opc);
     break;
   case BO_Sub:
     ResultTy = CheckSubtractionOperands(LHS, RHS, OpLoc);
@@ -7707,7 +7757,7 @@
       ResultTy = CheckAssignmentOperands(LHS.get(), RHS, OpLoc, CompResultTy);
     break;
   case BO_AddAssign:
-    CompResultTy = CheckAdditionOperands(LHS, RHS, OpLoc, &CompLHSTy);
+    CompResultTy = CheckAdditionOperands(LHS, RHS, OpLoc, Opc, &CompLHSTy);
     if (!CompResultTy.isNull() && !LHS.isInvalid() && !RHS.isInvalid())
       ResultTy = CheckAssignmentOperands(LHS.get(), RHS, OpLoc, CompResultTy);
     break;
@@ -8852,7 +8902,12 @@
     ExprCleanupObjects.push_back(Result->getBlockDecl());
     ExprNeedsCleanups = true;
   }
-
+  
+  if (BSI->TheDecl->blockMissingReturnType() &&
+      !RetTy->isDependentType() &&
+      !Context.getCanonicalType(RetTy)->isVoidType())
+    Diag(CaretLoc, diag::warn_block_missing_return_type);
+  
   return Owned(Result);
 }
 
@@ -9000,7 +9055,7 @@
   // Decode the result (notice that AST's are still created for extensions).
   bool CheckInferredResultType = false;
   bool isInvalid = false;
-  unsigned DiagKind;
+  unsigned DiagKind = 0;
   FixItHint Hint;
   ConversionFixItGenerator ConvHints;
   bool MayHaveConvFixit = false;
@@ -9308,6 +9363,8 @@
 }
 
 ExprResult Sema::TranformToPotentiallyEvaluated(Expr *E) {
+  assert(ExprEvalContexts.back().Context == Unevaluated &&
+         "Should only transform unevaluated expressions");
   ExprEvalContexts.back().Context =
       ExprEvalContexts[ExprEvalContexts.size()-2].Context;
   if (ExprEvalContexts.back().Context == Unevaluated)
@@ -9628,6 +9685,7 @@
   //   An entity captured by a lambda-expression is odr-used (3.2) in
   //   the scope containing the lambda-expression.
   Expr *Ref = new (S.Context) DeclRefExpr(Var, DeclRefType, VK_LValue, Loc);
+  Var->setReferenced(true);
   Var->setUsed(true);
 
   // When the field has array type, create index variables for each
@@ -10023,6 +10081,18 @@
   MaybeODRUseExprs.erase(E->IgnoreParens());
 }
 
+ExprResult Sema::ActOnConstantExpression(ExprResult Res) {
+  if (!Res.isUsable())
+    return Res;
+
+  // If a constant-expression is a reference to a variable where we delay
+  // deciding whether it is an odr-use, just assume we will apply the
+  // lvalue-to-rvalue conversion.  In the one case where this doesn't happen
+  // (a non-type template argument), we have special handling anyway.
+  UpdateMarkingForLValueToRValue(Res.get());
+  return Res;
+}
+
 void Sema::CleanupVarDeclMarking() {
   for (llvm::SmallPtrSetIterator<Expr*> i = MaybeODRUseExprs.begin(),
                                         e = MaybeODRUseExprs.end();
@@ -10087,9 +10157,10 @@
   // is immediately applied."  We check the first part here, and
   // Sema::UpdateMarkingForLValueToRValue deals with the second part.
   // Note that we use the C++11 definition everywhere because nothing in
-  // C++03 depends on whether we get the C++03 version correct.
+  // C++03 depends on whether we get the C++03 version correct. This does not
+  // apply to references, since they are not objects.
   const VarDecl *DefVD;
-  if (E && !isa<ParmVarDecl>(Var) &&
+  if (E && !isa<ParmVarDecl>(Var) && !Var->getType()->isReferenceType() &&
       Var->isUsableInConstantExpressions() &&
       Var->getAnyInitializer(DefVD) && DefVD->checkInitIsICE())
     SemaRef.MaybeODRUseExprs.insert(E);

Modified: cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp Tue Mar  6 07:07:43 2012
@@ -641,8 +641,7 @@
   if (RD->hasIrrelevantDestructor())
     return Owned(E);
 
-  CXXDestructorDecl *Destructor
-    = const_cast<CXXDestructorDecl*>(LookupDestructor(RD));
+  CXXDestructorDecl *Destructor = LookupDestructor(RD);
   if (!Destructor)
     return Owned(E);
 
@@ -787,20 +786,6 @@
   SourceRange FullRange = SourceRange(TyBeginLoc,
       ListInitialization ? Exprs[0]->getSourceRange().getEnd() : RParenLoc);
 
-  if (Ty->isArrayType())
-    return ExprError(Diag(TyBeginLoc,
-                          diag::err_value_init_for_array_type) << FullRange);
-  if (!Ty->isVoidType() &&
-      RequireCompleteType(TyBeginLoc, Ty,
-                          PDiag(diag::err_invalid_incomplete_type_use)
-                            << FullRange))
-    return ExprError();
-
-  if (RequireNonAbstractType(TyBeginLoc, Ty,
-                             diag::err_allocation_of_abstract_type))
-    return ExprError();
-
-
   // C++ [expr.type.conv]p1:
   // If the expression list is a single expression, the type conversion
   // expression is equivalent (in definedness, and if defined in meaning) to the
@@ -811,6 +796,24 @@
     return BuildCXXFunctionalCastExpr(TInfo, LParenLoc, Arg, RParenLoc);
   }
 
+  QualType ElemTy = Ty;
+  if (Ty->isArrayType()) {
+    if (!ListInitialization)
+      return ExprError(Diag(TyBeginLoc,
+                            diag::err_value_init_for_array_type) << FullRange);
+    ElemTy = Context.getBaseElementType(Ty);
+  }
+
+  if (!Ty->isVoidType() &&
+      RequireCompleteType(TyBeginLoc, ElemTy,
+                          PDiag(diag::err_invalid_incomplete_type_use)
+                            << FullRange))
+    return ExprError();
+
+  if (RequireNonAbstractType(TyBeginLoc, Ty,
+                             diag::err_allocation_of_abstract_type))
+    return ExprError();
+
   InitializedEntity Entity = InitializedEntity::InitializeTemporary(TInfo);
   InitializationKind Kind
     = NumExprs ? ListInitialization
@@ -2288,7 +2291,8 @@
     assert(!From->getType()->isPointerType() && "Arg can't have pointer type!");
 
     // Create an implicit call expr that calls it.
-    ExprResult Result = S.BuildCXXMemberCallExpr(From, FoundDecl, Method,
+    CXXConversionDecl *Conv = cast<CXXConversionDecl>(Method);
+    ExprResult Result = S.BuildCXXMemberCallExpr(From, FoundDecl, Conv,
                                                  HadMultipleCandidates);
     if (Result.isInvalid())
       return ExprError();
@@ -4455,11 +4459,8 @@
     // For message sends and property references, we try to find an
     // actual method.  FIXME: we should infer retention by selector in
     // cases where we don't have an actual method.
-    } else {
-      ObjCMethodDecl *D = 0;
-      if (ObjCMessageExpr *Send = dyn_cast<ObjCMessageExpr>(E)) {
-        D = Send->getMethodDecl();
-      }
+    } else if (ObjCMessageExpr *Send = dyn_cast<ObjCMessageExpr>(E)) {
+      ObjCMethodDecl *D = Send->getMethodDecl();
 
       ReturnsRetained = (D && D->hasAttr<NSReturnsRetainedAttr>());
 
@@ -4469,6 +4470,13 @@
       if (!ReturnsRetained &&
           D && D->getMethodFamily() == OMF_performSelector)
         return Owned(E);
+    } else if (isa<CastExpr>(E) &&
+               isa<BlockExpr>(cast<CastExpr>(E)->getSubExpr())) {
+      // We hit this case with the lambda conversion-to-block optimization;
+      // we don't want any extra casts here.
+      return Owned(E);
+    } else {
+      ReturnsRetained = false;
     }
 
     // Don't reclaim an object of Class type.
@@ -5082,8 +5090,36 @@
 }
 
 ExprResult Sema::BuildCXXMemberCallExpr(Expr *E, NamedDecl *FoundDecl,
-                                        CXXMethodDecl *Method,
+                                        CXXConversionDecl *Method,
                                         bool HadMultipleCandidates) {
+  if (Method->getParent()->isLambda() &&
+      Method->getConversionType()->isBlockPointerType()) {
+    // This is a lambda coversion to block pointer; check if the argument
+    // is a LambdaExpr.
+    Expr *SubE = E;
+    CastExpr *CE = dyn_cast<CastExpr>(SubE);
+    if (CE && CE->getCastKind() == CK_NoOp)
+      SubE = CE->getSubExpr();
+    SubE = SubE->IgnoreParens();
+    if (CXXBindTemporaryExpr *BE = dyn_cast<CXXBindTemporaryExpr>(SubE))
+      SubE = BE->getSubExpr();
+    if (isa<LambdaExpr>(SubE)) {
+      // For the conversion to block pointer on a lambda expression, we
+      // construct a special BlockLiteral instead; this doesn't really make
+      // a difference in ARC, but outside of ARC the resulting block literal
+      // follows the normal lifetime rules for block literals instead of being
+      // autoreleased.
+      DiagnosticErrorTrap Trap(Diags);
+      ExprResult Exp = BuildBlockForLambdaConversion(E->getExprLoc(),
+                                                     E->getExprLoc(),
+                                                     Method, E);
+      if (Exp.isInvalid())
+        Diag(E->getExprLoc(), diag::note_lambda_to_block_conv);
+      return Exp;
+    }
+  }
+      
+
   ExprResult Exp = PerformObjectArgumentInitialization(E, /*Qualifier=*/0,
                                           FoundDecl, Method);
   if (Exp.isInvalid())

Modified: cfe/branches/tooling/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaInit.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaInit.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaInit.cpp Tue Mar  6 07:07:43 2012
@@ -2795,7 +2795,7 @@
                            DeclContext::lookup_iterator ConEnd,
                            OverloadCandidateSet::iterator &Best,
                            bool CopyInitializing, bool AllowExplicit,
-                           bool OnlyListConstructors) {
+                           bool OnlyListConstructors, bool InitListSyntax) {
   CandidateSet.clear();
 
   for (; Con != ConEnd; ++Con) {
@@ -2813,9 +2813,10 @@
       Constructor = cast<CXXConstructorDecl>(D);
 
       // If we're performing copy initialization using a copy constructor, we
-      // suppress user-defined conversions on the arguments.
-      // FIXME: Move constructors?
-      if (CopyInitializing && Constructor->isCopyConstructor())
+      // suppress user-defined conversions on the arguments. We do the same for
+      // move constructors.
+      if ((CopyInitializing || (InitListSyntax && NumArgs == 1)) &&
+          Constructor->isCopyOrMoveConstructor())
         SuppressUserConversions = true;
     }
 
@@ -2825,8 +2826,8 @@
       if (ConstructorTmpl)
         S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
                                        /*ExplicitArgs*/ 0,
-                                       llvm::makeArrayRef(Args, NumArgs), CandidateSet,
-                                       SuppressUserConversions);
+                                       llvm::makeArrayRef(Args, NumArgs),
+                                       CandidateSet, SuppressUserConversions);
       else {
         // C++ [over.match.copy]p1:
         //   - When initializing a temporary to be bound to the first parameter 
@@ -2919,7 +2920,8 @@
     Result = ResolveConstructorOverload(S, Kind.getLocation(), Args, NumArgs,
                                         CandidateSet, ConStart, ConEnd, Best,
                                         CopyInitialization, AllowExplicit,
-                                        /*OnlyListConstructor=*/true);
+                                        /*OnlyListConstructor=*/true,
+                                        InitListSyntax);
 
     // Time to unwrap the init list.
     InitListExpr *ILE = cast<InitListExpr>(Args[0]);
@@ -2937,7 +2939,8 @@
     Result = ResolveConstructorOverload(S, Kind.getLocation(), Args, NumArgs,
                                         CandidateSet, ConStart, ConEnd, Best,
                                         CopyInitialization, AllowExplicit,
-                                        /*OnlyListConstructors=*/false);
+                                        /*OnlyListConstructors=*/false,
+                                        InitListSyntax);
   }
   if (Result) {
     Sequence.SetOverloadFailure(InitListSyntax ?
@@ -5306,6 +5309,19 @@
       bool Success = S.isStdInitializerList(Dest, &E);
       (void)Success;
       assert(Success && "Destination type changed?");
+
+      // If the element type has a destructor, check it.
+      if (CXXRecordDecl *RD = E->getAsCXXRecordDecl()) {
+        if (!RD->hasIrrelevantDestructor()) {
+          if (CXXDestructorDecl *Destructor = S.LookupDestructor(RD)) {
+            S.MarkFunctionReferenced(Kind.getLocation(), Destructor);
+            S.CheckDestructorAccess(Kind.getLocation(), Destructor,
+                                    S.PDiag(diag::err_access_dtor_temp) << E);
+            S.DiagnoseUseOfDecl(Destructor, Kind.getLocation());
+          }
+        }
+      }
+
       InitListExpr *ILE = cast<InitListExpr>(CurInit.take());
       unsigned NumInits = ILE->getNumInits();
       SmallVector<Expr*, 16> Converted(NumInits);

Modified: cfe/branches/tooling/lib/Sema/SemaLambda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaLambda.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaLambda.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaLambda.cpp Tue Mar  6 07:07:43 2012
@@ -740,3 +740,81 @@
   
   return MaybeBindToTemporary(Lambda);
 }
+
+ExprResult Sema::BuildBlockForLambdaConversion(SourceLocation CurrentLocation,
+                                               SourceLocation ConvLocation,
+                                               CXXConversionDecl *Conv,
+                                               Expr *Src) {
+  // Make sure that the lambda call operator is marked used.
+  CXXRecordDecl *Lambda = Conv->getParent();
+  CXXMethodDecl *CallOperator 
+    = cast<CXXMethodDecl>(
+        *Lambda->lookup(
+          Context.DeclarationNames.getCXXOperatorName(OO_Call)).first);
+  CallOperator->setReferenced();
+  CallOperator->setUsed();
+
+  ExprResult Init = PerformCopyInitialization(
+                      InitializedEntity::InitializeBlock(ConvLocation, 
+                                                         Src->getType(), 
+                                                         /*NRVO=*/false),
+                      CurrentLocation, Src);
+  if (!Init.isInvalid())
+    Init = ActOnFinishFullExpr(Init.take());
+  
+  if (Init.isInvalid())
+    return ExprError();
+  
+  // Create the new block to be returned.
+  BlockDecl *Block = BlockDecl::Create(Context, CurContext, ConvLocation);
+
+  // Set the type information.
+  Block->setSignatureAsWritten(CallOperator->getTypeSourceInfo());
+  Block->setIsVariadic(CallOperator->isVariadic());
+  Block->setBlockMissingReturnType(false);
+
+  // Add parameters.
+  SmallVector<ParmVarDecl *, 4> BlockParams;
+  for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I) {
+    ParmVarDecl *From = CallOperator->getParamDecl(I);
+    BlockParams.push_back(ParmVarDecl::Create(Context, Block,
+                                              From->getLocStart(),
+                                              From->getLocation(),
+                                              From->getIdentifier(),
+                                              From->getType(),
+                                              From->getTypeSourceInfo(),
+                                              From->getStorageClass(),
+                                            From->getStorageClassAsWritten(),
+                                              /*DefaultArg=*/0));
+  }
+  Block->setParams(BlockParams);
+
+  Block->setIsConversionFromLambda(true);
+
+  // Add capture. The capture uses a fake variable, which doesn't correspond
+  // to any actual memory location. However, the initializer copy-initializes
+  // the lambda object.
+  TypeSourceInfo *CapVarTSI =
+      Context.getTrivialTypeSourceInfo(Src->getType());
+  VarDecl *CapVar = VarDecl::Create(Context, Block, ConvLocation,
+                                    ConvLocation, 0,
+                                    Src->getType(), CapVarTSI,
+                                    SC_None, SC_None);
+  BlockDecl::Capture Capture(/*Variable=*/CapVar, /*ByRef=*/false,
+                             /*Nested=*/false, /*Copy=*/Init.take());
+  Block->setCaptures(Context, &Capture, &Capture + 1, 
+                     /*CapturesCXXThis=*/false);
+
+  // Add a fake function body to the block. IR generation is responsible
+  // for filling in the actual body, which cannot be expressed as an AST.
+  Block->setBody(new (Context) CompoundStmt(Context, 0, 0, 
+                                            ConvLocation,
+                                            ConvLocation));
+
+  // Create the block literal expression.
+  Expr *BuildBlock = new (Context) BlockExpr(Block, Conv->getConversionType());
+  ExprCleanupObjects.push_back(Block);
+  ExprNeedsCleanups = true;
+
+  return BuildBlock;
+}

Modified: cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp Tue Mar  6 07:07:43 2012
@@ -101,6 +101,7 @@
 }
 
 Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
+                          SourceLocation LParenLoc,
                           FieldDeclarator &FD,
                           ObjCDeclSpec &ODS,
                           Selector GetterSel,
@@ -135,7 +136,7 @@
 
   if (ObjCCategoryDecl *CDecl = dyn_cast<ObjCCategoryDecl>(ClassDecl))
     if (CDecl->IsClassExtension()) {
-      Decl *Res = HandlePropertyInClassExtension(S, AtLoc,
+      Decl *Res = HandlePropertyInClassExtension(S, AtLoc, LParenLoc,
                                            FD, GetterSel, SetterSel,
                                            isAssign, isReadWrite,
                                            Attributes,
@@ -150,7 +151,7 @@
       return Res;
     }
   
-  ObjCPropertyDecl *Res = CreatePropertyDecl(S, ClassDecl, AtLoc, FD,
+  ObjCPropertyDecl *Res = CreatePropertyDecl(S, ClassDecl, AtLoc, LParenLoc, FD,
                                              GetterSel, SetterSel,
                                              isAssign, isReadWrite,
                                              Attributes,
@@ -201,7 +202,9 @@
 
 Decl *
 Sema::HandlePropertyInClassExtension(Scope *S,
-                                     SourceLocation AtLoc, FieldDeclarator &FD,
+                                     SourceLocation AtLoc,
+                                     SourceLocation LParenLoc,
+                                     FieldDeclarator &FD,
                                      Selector GetterSel, Selector SetterSel,
                                      const bool isAssign,
                                      const bool isReadWrite,
@@ -235,7 +238,7 @@
   // FIXME. We should really be using CreatePropertyDecl for this.
   ObjCPropertyDecl *PDecl =
     ObjCPropertyDecl::Create(Context, DC, FD.D.getIdentifierLoc(),
-                             PropertyId, AtLoc, T);
+                             PropertyId, AtLoc, LParenLoc, T);
   PDecl->setPropertyAttributesAsWritten(
                           makePropertyAttributesAsWritten(AttributesAsWritten));
   if (Attributes & ObjCDeclSpec::DQ_PR_readonly)
@@ -264,7 +267,7 @@
     // No matching property found in the primary class. Just fall thru
     // and add property to continuation class's primary class.
     ObjCPropertyDecl *PrimaryPDecl =
-      CreatePropertyDecl(S, CCPrimary, AtLoc,
+      CreatePropertyDecl(S, CCPrimary, AtLoc, LParenLoc,
                          FD, GetterSel, SetterSel, isAssign, isReadWrite,
                          Attributes,AttributesAsWritten, T, MethodImplKind, DC);
 
@@ -329,7 +332,7 @@
       ContextRAII SavedContext(*this, CCPrimary);
       
       Decl *ProtocolPtrTy =
-        ActOnProperty(S, AtLoc, FD, ProtocolPropertyODS,
+        ActOnProperty(S, AtLoc, LParenLoc, FD, ProtocolPropertyODS,
                       PIDecl->getGetterName(),
                       PIDecl->getSetterName(),
                       isOverridingProperty,
@@ -372,6 +375,7 @@
 ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,
                                            ObjCContainerDecl *CDecl,
                                            SourceLocation AtLoc,
+                                           SourceLocation LParenLoc,
                                            FieldDeclarator &FD,
                                            Selector GetterSel,
                                            Selector SetterSel,
@@ -404,7 +408,7 @@
   DeclContext *DC = cast<DeclContext>(CDecl);
   ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC,
                                                      FD.D.getIdentifierLoc(),
-                                                     PropertyId, AtLoc, TInfo);
+                                                     PropertyId, AtLoc, LParenLoc, TInfo);
 
   if (ObjCPropertyDecl *prevDecl =
         ObjCPropertyDecl::findPropertyDecl(DC, PropertyId)) {
@@ -1530,7 +1534,34 @@
         Diag(MethodLoc, diag::warn_atomic_property_rule)
           << Property->getIdentifier() << (GetterMethod != 0)
           << (SetterMethod != 0);
-        Diag(MethodLoc, diag::note_atomic_property_fixup_suggest);
+        // fixit stuff.
+        if (!AttributesAsWritten) {
+          if (Property->getLParenLoc().isValid()) {
+            // @property () ... case.
+            SourceRange PropSourceRange(Property->getAtLoc(), 
+                                        Property->getLParenLoc());
+            Diag(Property->getLocation(), diag::note_atomic_property_fixup_suggest) <<
+              FixItHint::CreateReplacement(PropSourceRange, "@property (nonatomic");
+          }
+          else {
+            //@property id etc.
+            SourceLocation endLoc = 
+              Property->getTypeSourceInfo()->getTypeLoc().getBeginLoc();
+            endLoc = endLoc.getLocWithOffset(-1);
+            SourceRange PropSourceRange(Property->getAtLoc(), endLoc);
+            Diag(Property->getLocation(), diag::note_atomic_property_fixup_suggest) <<
+              FixItHint::CreateReplacement(PropSourceRange, "@property (nonatomic) ");
+          }
+        }
+        else if (!(AttributesAsWritten & ObjCPropertyDecl::OBJC_PR_atomic)) {
+          // @property () ... case.
+          SourceLocation endLoc = Property->getLParenLoc();
+          SourceRange PropSourceRange(Property->getAtLoc(), endLoc);
+          Diag(Property->getLocation(), diag::note_atomic_property_fixup_suggest) <<
+           FixItHint::CreateReplacement(PropSourceRange, "@property (nonatomic, ");
+        }
+        else
+          Diag(MethodLoc, diag::note_atomic_property_fixup_suggest);
         Diag(Property->getLocation(), diag::note_property_declare);
       }
     }

Modified: cfe/branches/tooling/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaTemplateInstantiateDecl.cpp Tue Mar  6 07:07:43 2012
@@ -2596,21 +2596,25 @@
     return;
   }
 
+  TemplateSpecializationKind TSK = Var->getTemplateSpecializationKind();
+
   // Never instantiate an explicit specialization.
-  if (Var->getTemplateSpecializationKind() == TSK_ExplicitSpecialization)
+  if (TSK == TSK_ExplicitSpecialization)
     return;
 
   // C++0x [temp.explicit]p9:
   //   Except for inline functions, other explicit instantiation declarations
   //   have the effect of suppressing the implicit instantiation of the entity
   //   to which they refer.
-  if (Var->getTemplateSpecializationKind()
-        == TSK_ExplicitInstantiationDeclaration)
+  if (TSK == TSK_ExplicitInstantiationDeclaration)
     return;
 
   // If we already have a definition, we're done.
-  if (Var->getDefinition())
+  if (Var->getDefinition()) {
+    if (TSK == TSK_ExplicitInstantiationDefinition)
+      Consumer.MarkVarRequired(Var);
     return;
+  }
 
   InstantiatingTemplate Inst(*this, PointOfInstantiation, Var);
   if (Inst)

Modified: cfe/branches/tooling/lib/Sema/SemaTemplateVariadic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaTemplateVariadic.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaTemplateVariadic.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaTemplateVariadic.cpp Tue Mar  6 07:07:43 2012
@@ -779,6 +779,8 @@
     return ExprError();
   }
 
+  MarkAnyDeclReferenced(OpLoc, ParameterPack);
+
   return new (Context) SizeOfPackExpr(Context.getSizeType(), OpLoc, 
                                       ParameterPack, NameLoc, RParenLoc);
 }

Modified: cfe/branches/tooling/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/TreeTransform.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/TreeTransform.h (original)
+++ cfe/branches/tooling/lib/Sema/TreeTransform.h Tue Mar  6 07:07:43 2012
@@ -2950,6 +2950,7 @@
       EnterExpressionEvaluationContext Unevaluated(getSema(),
                                                    Sema::ConstantEvaluated);
       ExprResult E = getDerived().TransformExpr(SourceExpr);
+      E = SemaRef.ActOnConstantExpression(E);
       SourceExpr = (E.isInvalid() ? 0 : E.take());
     }
 
@@ -2990,6 +2991,7 @@
     if (!InputExpr) InputExpr = Input.getArgument().getAsExpr();
 
     ExprResult E = getDerived().TransformExpr(InputExpr);
+    E = SemaRef.ActOnConstantExpression(E);
     if (E.isInvalid()) return true;
     Output = TemplateArgumentLoc(TemplateArgument(E.take()), E.take());
     return false;
@@ -3654,6 +3656,7 @@
     EnterExpressionEvaluationContext Unevaluated(SemaRef,
                                                  Sema::ConstantEvaluated);
     Size = getDerived().TransformExpr(Size).template takeAs<Expr>();
+    Size = SemaRef.ActOnConstantExpression(Size).take();
   }
   NewTL.setSizeExpr(Size);
 
@@ -3744,6 +3747,7 @@
 
   ExprResult sizeResult
     = getDerived().TransformExpr(origSize);
+  sizeResult = SemaRef.ActOnConstantExpression(sizeResult);
   if (sizeResult.isInvalid())
     return QualType();
 
@@ -3788,6 +3792,7 @@
                                                Sema::ConstantEvaluated);
 
   ExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
+  Size = SemaRef.ActOnConstantExpression(Size);
   if (Size.isInvalid())
     return QualType();
 
@@ -4269,6 +4274,10 @@
   if (E.isInvalid())
     return QualType();
 
+  E = SemaRef.HandleExprEvaluationContextForTypeof(E.get());
+  if (E.isInvalid())
+    return QualType();
+
   QualType Result = TL.getType();
   if (getDerived().AlwaysRebuild() ||
       E.get() != TL.getUnderlyingExpr()) {
@@ -5061,11 +5070,13 @@
 
     // Transform the left-hand case value.
     LHS = getDerived().TransformExpr(S->getLHS());
+    LHS = SemaRef.ActOnConstantExpression(LHS);
     if (LHS.isInvalid())
       return StmtError();
 
     // Transform the right-hand case value (for the GNU case-range extension).
     RHS = getDerived().TransformExpr(S->getRHS());
+    RHS = SemaRef.ActOnConstantExpression(RHS);
     if (RHS.isInvalid())
       return StmtError();
   }
@@ -6227,20 +6238,17 @@
                                                     E->getSourceRange());
   }
 
-  ExprResult SubExpr;
-  {
-    // C++0x [expr.sizeof]p1:
-    //   The operand is either an expression, which is an unevaluated operand
-    //   [...]
-    EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
+  // C++0x [expr.sizeof]p1:
+  //   The operand is either an expression, which is an unevaluated operand
+  //   [...]
+  EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
 
-    SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
-    if (SubExpr.isInvalid())
-      return ExprError();
+  ExprResult SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
+  if (SubExpr.isInvalid())
+    return ExprError();
 
-    if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
-      return SemaRef.Owned(E);
-  }
+  if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
+    return SemaRef.Owned(E);
 
   return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
                                                   E->getOperatorLoc(),

Modified: cfe/branches/tooling/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTReader.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTReader.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTReader.cpp Tue Mar  6 07:07:43 2012
@@ -27,7 +27,7 @@
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLocVisitor.h"
-#include "llvm/ADT/SaveAndRestore.h"
+#include "llvm/Support/SaveAndRestore.h"
 #include "clang/Lex/MacroInfo.h"
 #include "clang/Lex/PreprocessingRecord.h"
 #include "clang/Lex/Preprocessor.h"
@@ -1744,7 +1744,7 @@
           = F.PreprocessorDetailCursor.GetCurrentBitNo();
           
         if (!PP.getPreprocessingRecord())
-          PP.createPreprocessingRecord();
+          PP.createPreprocessingRecord(/*RecordConditionalDirectives=*/false);
         if (!PP.getPreprocessingRecord()->getExternalSource())
           PP.getPreprocessingRecord()->SetExternalSource(*this);
         break;
@@ -2288,7 +2288,7 @@
       
       unsigned StartingID;
       if (!PP.getPreprocessingRecord())
-        PP.createPreprocessingRecord();
+        PP.createPreprocessingRecord(/*RecordConditionalDirectives=*/false);
       if (!PP.getPreprocessingRecord()->getExternalSource())
         PP.getPreprocessingRecord()->SetExternalSource(*this);
       StartingID 

Modified: cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp Tue Mar  6 07:07:43 2012
@@ -801,6 +801,7 @@
 void ASTDeclReader::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
   VisitNamedDecl(D);
   D->setAtLoc(ReadSourceLocation(Record, Idx));
+  D->setLParenLoc(ReadSourceLocation(Record, Idx));
   D->setType(GetTypeSourceInfo(Record, Idx));
   // FIXME: stable encoding
   D->setPropertyAttributes(

Modified: cfe/branches/tooling/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTWriterDecl.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTWriterDecl.cpp Tue Mar  6 07:07:43 2012
@@ -565,6 +565,7 @@
 void ASTDeclWriter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
   VisitNamedDecl(D);
   Writer.AddSourceLocation(D->getAtLoc(), Record);
+  Writer.AddSourceLocation(D->getLParenLoc(), Record);
   Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record);
   // FIXME: stable encoding
   Record.push_back((unsigned)D->getPropertyAttributes());

Modified: cfe/branches/tooling/lib/Serialization/ASTWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTWriterStmt.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTWriterStmt.cpp Tue Mar  6 07:07:43 2012
@@ -1586,11 +1586,10 @@
 void ASTWriter::FlushStmts() {
   RecordData Record;
 
-  /// \brief Set of parent Stmts for the currently serializing sub stmt.
-  llvm::DenseSet<Stmt *> ParentStmts;
-  /// \brief Offsets of sub stmts already serialized. The offset points
-  /// just after the stmt record.
-  llvm::DenseMap<Stmt *, uint64_t> SubStmtEntries;
+  // We expect to be the only consumer of the two temporary statement maps,
+  // assert that they are empty.
+  assert(SubStmtEntries.empty() && "unexpected entries in sub stmt map");
+  assert(ParentStmts.empty() && "unexpected entries in parent stmt map");
 
   for (unsigned I = 0, N = StmtsToEmit.size(); I != N; ++I) {
     WriteSubStmt(StmtsToEmit[I], SubStmtEntries, ParentStmts);

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp Tue Mar  6 07:07:43 2012
@@ -44,7 +44,10 @@
   static void PreVisitProcessArgs(CheckerContext &C,CallOrObjCMessage callOrMsg,
                              const char *BT_desc, OwningPtr<BugType> &BT);
   static bool PreVisitProcessArg(CheckerContext &C, SVal V,SourceRange argRange,
-          const Expr *argEx, const char *BT_desc, OwningPtr<BugType> &BT);
+                                 const Expr *argEx,
+                                 const bool checkUninitFields,
+                                 const char *BT_desc,
+                                 OwningPtr<BugType> &BT);
 
   static void EmitBadCall(BugType *BT, CheckerContext &C, const CallExpr *CE);
   void emitNilReceiverBug(CheckerContext &C, const ObjCMessage &msg,
@@ -77,9 +80,19 @@
                                                 CallOrObjCMessage callOrMsg,
                                                 const char *BT_desc,
                                                 OwningPtr<BugType> &BT) {
+  // Don't check for uninitialized field values in arguments if the
+  // caller has a body that is available and we have the chance to inline it.
+  // This is a hack, but is a reasonable compromise betweens sometimes warning
+  // and sometimes not depending on if we decide to inline a function.
+  const Decl *D = callOrMsg.getDecl();
+  const bool checkUninitFields =
+    !(C.getAnalysisManager().shouldInlineCall() &&
+      (D && D->getBody()));
+  
   for (unsigned i = 0, e = callOrMsg.getNumArgs(); i != e; ++i)
     if (PreVisitProcessArg(C, callOrMsg.getArgSVal(i),
                            callOrMsg.getArgSourceRange(i), callOrMsg.getArg(i),
+                           checkUninitFields,
                            BT_desc, BT))
       return;
 }
@@ -87,9 +100,9 @@
 bool CallAndMessageChecker::PreVisitProcessArg(CheckerContext &C,
                                                SVal V, SourceRange argRange,
                                                const Expr *argEx,
+                                               const bool checkUninitFields,
                                                const char *BT_desc,
                                                OwningPtr<BugType> &BT) {
-
   if (V.isUndef()) {
     if (ExplodedNode *N = C.generateSink()) {
       LazyInit_BT(BT_desc, BT);
@@ -104,6 +117,9 @@
     return true;
   }
 
+  if (!checkUninitFields)
+    return false;
+  
   if (const nonloc::LazyCompoundVal *LV =
         dyn_cast<nonloc::LazyCompoundVal>(&V)) {
 

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Tue Mar  6 07:07:43 2012
@@ -42,10 +42,8 @@
   RefState(Kind k, const Stmt *s) : K(k), S(s) {}
 
   bool isAllocated() const { return K == AllocateUnchecked; }
-  //bool isFailed() const { return K == AllocateFailed; }
   bool isReleased() const { return K == Released; }
-  //bool isEscaped() const { return K == Escaped; }
-  //bool isRelinquished() const { return K == Relinquished; }
+
   const Stmt *getStmt() const { return S; }
 
   bool operator==(const RefState &X) const {
@@ -101,8 +99,6 @@
   mutable IdentifierInfo *II_malloc, *II_free, *II_realloc, *II_calloc,
                          *II_valloc, *II_reallocf, *II_strndup, *II_strdup;
 
-  static const unsigned InvalidArgIndex = UINT_MAX;
-
 public:
   MallocChecker() : II_malloc(0), II_free(0), II_realloc(0), II_calloc(0),
                     II_valloc(0), II_reallocf(0), II_strndup(0), II_strdup(0) {}
@@ -444,12 +440,16 @@
   if (Att->getModule() != "malloc")
     return 0;
 
+  ProgramStateRef State = C.getState();
+
   for (OwnershipAttr::args_iterator I = Att->args_begin(), E = Att->args_end();
        I != E; ++I) {
-    return FreeMemAux(C, CE, C.getState(), *I,
-                      Att->getOwnKind() == OwnershipAttr::Holds);
+    ProgramStateRef StateI = FreeMemAux(C, CE, State, *I,
+                               Att->getOwnKind() == OwnershipAttr::Holds);
+    if (StateI)
+      State = StateI;
   }
-  return 0;
+  return State;
 }
 
 ProgramStateRef MallocChecker::FreeMemAux(CheckerContext &C,
@@ -1084,7 +1084,7 @@
   ASTContext &ASTC = State->getStateManager().getContext();
 
   // If it's one of the allocation functions we can reason about, we model
-  // it's behavior explicitly.
+  // its behavior explicitly.
   if (isa<FunctionDecl>(D) && isMemFunction(cast<FunctionDecl>(D), ASTC)) {
     return true;
   }
@@ -1095,7 +1095,7 @@
     return false;
 
   // Process C/ObjC functions.
-  if (const FunctionDecl *FD  = dyn_cast_or_null<FunctionDecl>(D)) {
+  if (const FunctionDecl *FD  = dyn_cast<FunctionDecl>(D)) {
     // White list the system functions whose arguments escape.
     const IdentifierInfo *II = FD->getIdentifier();
     if (!II)
@@ -1106,7 +1106,7 @@
     if (FName.equals("pthread_setspecific"))
       return false;
 
-    // White list the 'XXXNoCopy' ObjC Methods.
+    // White list the 'XXXNoCopy' ObjC functions.
     if (FName.endswith("NoCopy")) {
       // Look for the deallocator argument. We know that the memory ownership
       // is not transfered only if the deallocator argument is
@@ -1122,6 +1122,43 @@
       return false;
     }
 
+    // PR12101
+    // Many CoreFoundation and CoreGraphics might allow a tracked object 
+    // to escape.
+    if (Call->isCFCGAllowingEscape(FName))
+      return false;
+
+    // Associating streams with malloced buffers. The pointer can escape if
+    // 'closefn' is specified (and if that function does free memory).
+    // Currently, we do not inspect the 'closefn' function (PR12101).
+    if (FName == "funopen")
+      if (Call->getNumArgs() >= 4 && !Call->getArgSVal(4).isConstant(0))
+        return false;
+
+    // Do not warn on pointers passed to 'setbuf' when used with std streams,
+    // these leaks might be intentional when setting the buffer for stdio.
+    // http://stackoverflow.com/questions/2671151/who-frees-setvbuf-buffer
+    if (FName == "setbuf" || FName =="setbuffer" ||
+        FName == "setlinebuf" || FName == "setvbuf") {
+      if (Call->getNumArgs() >= 1)
+        if (const DeclRefExpr *Arg =
+              dyn_cast<DeclRefExpr>(Call->getArg(0)->IgnoreParenCasts()))
+          if (const VarDecl *D = dyn_cast<VarDecl>(Arg->getDecl()))
+              if (D->getCanonicalDecl()->getName().find("std")
+                                                   != StringRef::npos)
+                return false;
+    }
+
+    // A bunch of other functions, which take ownership of a pointer (See retain
+    // release checker). Not all the parameters here are invalidated, but the
+    // Malloc checker cannot differentiate between them. The right way of doing
+    // this would be to implement a pointer escapes callback.
+    if (FName == "CVPixelBufferCreateWithBytes" ||
+        FName == "CGBitmapContextCreateWithData" ||
+        FName == "CVPixelBufferCreateWithPlanarBytes") {
+      return false;
+    }
+
     // Otherwise, assume that the function does not free memory.
     // Most system calls, do not free the memory.
     return true;
@@ -1137,9 +1174,18 @@
       if (S.getNameForSlot(i).equals("freeWhenDone")) {
         if (Call->getArgSVal(i).isConstant(1))
           return false;
+        else
+          return true;
       }
     }
 
+    // If the first selector ends with NoCopy, assume that the ownership is
+    // transfered as well.
+    // Ex:  [NSData dataWithBytesNoCopy:bytes length:10];
+    if (S.getNameForSlot(0).endswith("NoCopy")) {
+      return false;
+    }
+
     // Otherwise, assume that the function does not free memory.
     // Most system calls, do not free the memory.
     return true;

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp Tue Mar  6 07:07:43 2012
@@ -54,7 +54,7 @@
 static bool isSelfVar(SVal location, CheckerContext &C);
 
 namespace {
-class ObjCSelfInitChecker : public Checker<
+class ObjCSelfInitChecker : public Checker<  check::PreObjCMessage,
                                              check::PostObjCMessage,
                                              check::PostStmt<ObjCIvarRefExpr>,
                                              check::PreStmt<ReturnStmt>,
@@ -62,6 +62,7 @@
                                              check::PostStmt<CallExpr>,
                                              check::Location > {
 public:
+  void checkPreObjCMessage(ObjCMessage msg, CheckerContext &C) const;
   void checkPostObjCMessage(ObjCMessage msg, CheckerContext &C) const;
   void checkPostStmt(const ObjCIvarRefExpr *E, CheckerContext &C) const;
   void checkPreStmt(const ReturnStmt *S, CheckerContext &C) const;
@@ -69,6 +70,10 @@
   void checkPostStmt(const CallExpr *CE, CheckerContext &C) const;
   void checkLocation(SVal location, bool isLoad, const Stmt *S,
                      CheckerContext &C) const;
+
+  void checkPreStmt(const CallOrObjCMessage &CE, CheckerContext &C) const;
+  void checkPostStmt(const CallOrObjCMessage &CE, CheckerContext &C) const;
+
 };
 } // end anonymous namespace
 
@@ -178,6 +183,9 @@
 
 void ObjCSelfInitChecker::checkPostObjCMessage(ObjCMessage msg,
                                                CheckerContext &C) const {
+  CallOrObjCMessage MsgWrapper(msg, C.getState(), C.getLocationContext());
+  checkPostStmt(MsgWrapper, C);
+
   // When encountering a message that does initialization (init rule),
   // tag the return value so that we know later on that if self has this value
   // then it is properly initialized.
@@ -249,10 +257,28 @@
 
 void ObjCSelfInitChecker::checkPreStmt(const CallExpr *CE,
                                        CheckerContext &C) const {
+  CallOrObjCMessage CEWrapper(CE, C.getState(), C.getLocationContext());
+  checkPreStmt(CEWrapper, C);
+}
+
+void ObjCSelfInitChecker::checkPostStmt(const CallExpr *CE,
+                                        CheckerContext &C) const {
+  CallOrObjCMessage CEWrapper(CE, C.getState(), C.getLocationContext());
+  checkPostStmt(CEWrapper, C);
+}
+
+void ObjCSelfInitChecker::checkPreObjCMessage(ObjCMessage Msg,
+                                              CheckerContext &C) const {
+  CallOrObjCMessage MsgWrapper(Msg, C.getState(), C.getLocationContext());
+  checkPreStmt(MsgWrapper, C);
+}
+
+void ObjCSelfInitChecker::checkPreStmt(const CallOrObjCMessage &CE,
+                                       CheckerContext &C) const {
   ProgramStateRef state = C.getState();
-  for (CallExpr::const_arg_iterator
-         I = CE->arg_begin(), E = CE->arg_end(); I != E; ++I) {
-    SVal argV = state->getSVal(*I, C.getLocationContext());
+  unsigned NumArgs = CE.getNumArgs();
+  for (unsigned i = 0; i < NumArgs; ++i) {
+    SVal argV = CE.getArgSVal(i);
     if (isSelfVar(argV, C)) {
       unsigned selfFlags = getSelfFlags(state->getSVal(cast<Loc>(argV)), C);
       C.addTransition(state->set<PreCallSelfFlags>(selfFlags));
@@ -265,13 +291,12 @@
   }
 }
 
-void ObjCSelfInitChecker::checkPostStmt(const CallExpr *CE,
+void ObjCSelfInitChecker::checkPostStmt(const CallOrObjCMessage &CE,
                                         CheckerContext &C) const {
   ProgramStateRef state = C.getState();
-  const LocationContext *LCtx = C.getLocationContext();
-  for (CallExpr::const_arg_iterator
-         I = CE->arg_begin(), E = CE->arg_end(); I != E; ++I) {
-    SVal argV = state->getSVal(*I, LCtx);
+  unsigned NumArgs = CE.getNumArgs();
+  for (unsigned i = 0; i < NumArgs; ++i) {
+    SVal argV = CE.getArgSVal(i);
     if (isSelfVar(argV, C)) {
       SelfFlagEnum prevFlags = (SelfFlagEnum)state->get<PreCallSelfFlags>();
       state = state->remove<PreCallSelfFlags>();
@@ -280,7 +305,7 @@
     } else if (hasSelfFlag(argV, SelfFlag_Self, C)) {
       SelfFlagEnum prevFlags = (SelfFlagEnum)state->get<PreCallSelfFlags>();
       state = state->remove<PreCallSelfFlags>();
-      addSelfFlag(state, state->getSVal(CE, LCtx), prevFlags, C);
+      addSelfFlag(state, state->getSVal(cast<Loc>(argV)), prevFlags, C);
       return;
     }
   }

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp Tue Mar  6 07:07:43 2012
@@ -113,7 +113,7 @@
 }
 
 void StackAddrEscapeChecker::checkPreStmt(const ReturnStmt *RS,
-                                        CheckerContext &C) const {
+                                          CheckerContext &C) const {
   
   const Expr *RetE = RS->getRetValue();
   if (!RetE)
@@ -122,18 +122,26 @@
   SVal V = C.getState()->getSVal(RetE, C.getLocationContext());
   const MemRegion *R = V.getAsRegion();
 
-  if (!R || !R->hasStackStorage())
-    return;  
+  if (!R)
+    return;
   
-  if (R->hasStackStorage()) {
-    // Automatic reference counting automatically copies blocks.
-    if (C.getASTContext().getLangOptions().ObjCAutoRefCount &&
-        isa<BlockDataRegion>(R))
-      return;
+  const StackSpaceRegion *SS =
+    dyn_cast_or_null<StackSpaceRegion>(R->getMemorySpace());
+    
+  if (!SS)
+    return;
 
-    EmitStackError(C, R, RetE);
+  // Return stack memory in an ancestor stack frame is fine.
+  const StackFrameContext *SFC = SS->getStackFrame();
+  if (SFC != C.getLocationContext()->getCurrentStackFrame())
     return;
-  }
+
+  // Automatic reference counting automatically copies blocks.
+  if (C.getASTContext().getLangOptions().ObjCAutoRefCount &&
+      isa<BlockDataRegion>(R))
+    return;
+
+  EmitStackError(C, R, RetE);
 }
 
 void StackAddrEscapeChecker::checkEndPath(CheckerContext &Ctx) const {

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp Tue Mar  6 07:07:43 2012
@@ -116,6 +116,14 @@
     if (CB->size() > 0 && isInvalidPath(CB, *PM))
       continue;
 
+    // It is good practice to always have a "default" label in a "switch", even
+    // if we should never get there. It can be used to detect errors, for
+    // instance. Unreachable code directly under a "default" label is therefore
+    // likely to be a false positive.
+    if (const Stmt *label = CB->getLabel())
+      if (label->getStmtClass() == Stmt::DefaultStmtClass)
+        continue;
+
     // Special case for __builtin_unreachable.
     // FIXME: This should be extended to include other unreachable markers,
     // such as llvm_unreachable.

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp Tue Mar  6 07:07:43 2012
@@ -15,7 +15,7 @@
 #include "ClangSACheckers.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/StmtVisitor.h"
-#include "llvm/ADT/SaveAndRestore.h"
+#include "llvm/Support/SaveAndRestore.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
 #include "clang/StaticAnalyzer/Core/Checker.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/AnalysisManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/AnalysisManager.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/AnalysisManager.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/AnalysisManager.cpp Tue Mar  6 07:07:43 2012
@@ -29,7 +29,9 @@
                                  bool eager, bool trim,
                                  bool inlinecall, bool useUnoptimizedCFG,
                                  bool addImplicitDtors, bool addInitializers,
-                                 bool eagerlyTrimEGraph)
+                                 bool eagerlyTrimEGraph,
+                                 unsigned inlineMaxStack,
+                                 unsigned inlineMaxFunctionSize)
   : AnaCtxMgr(useUnoptimizedCFG, addImplicitDtors, addInitializers),
     Ctx(ctx), Diags(diags), LangInfo(lang), PD(pd),
     CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),
@@ -37,7 +39,9 @@
     AScope(ScopeDecl), MaxNodes(maxnodes), MaxVisit(maxvisit),
     VisualizeEGDot(vizdot), VisualizeEGUbi(vizubi), PurgeDead(purge),
     EagerlyAssume(eager), TrimGraph(trim), InlineCall(inlinecall),
-    EagerlyTrimEGraph(eagerlyTrimEGraph)
+    EagerlyTrimEGraph(eagerlyTrimEGraph),
+    InlineMaxStackDepth(inlineMaxStack),
+    InlineMaxFunctionSize(inlineMaxFunctionSize)
 {
   AnaCtxMgr.getCFGBuildOptions().setAllAlwaysAdd();
 }
@@ -62,7 +66,9 @@
     EagerlyAssume(ParentAM.EagerlyAssume),
     TrimGraph(ParentAM.TrimGraph),
     InlineCall(ParentAM.InlineCall),
-    EagerlyTrimEGraph(ParentAM.EagerlyTrimEGraph)
+    EagerlyTrimEGraph(ParentAM.EagerlyTrimEGraph),
+    InlineMaxStackDepth(ParentAM.InlineMaxStackDepth),
+    InlineMaxFunctionSize(ParentAM.InlineMaxFunctionSize)
 {
   AnaCtxMgr.getCFGBuildOptions().setAllAlwaysAdd();
 }

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp Tue Mar  6 07:07:43 2012
@@ -127,26 +127,33 @@
     IntrusiveRefCntPtr<PathDiagnosticPiece> piece(pieces.front());
     pieces.pop_front();
     
-    if (PathDiagnosticCallPiece *call =
-        dyn_cast<PathDiagnosticCallPiece>(piece)) {      
-      // Recursively clean out the subclass.  Keep this call around if
-      // it contains any informative diagnostics.
-      if (!RemoveUneededCalls(call->path))
-        continue;
-      containsSomethingInteresting = true;
-    }
-    else if (PathDiagnosticMacroPiece *macro =
-             dyn_cast<PathDiagnosticMacroPiece>(piece)) {
-      if (!RemoveUneededCalls(macro->subPieces))
-        continue;
-      containsSomethingInteresting = true;
-    }
-    else if (PathDiagnosticEventPiece *event =
-             dyn_cast<PathDiagnosticEventPiece>(piece)) {
-      // We never throw away an event, but we do throw it away wholesale
-      // as part of a path if we throw the entire path away.
-      if (!event->isPrunable())
+    switch (piece->getKind()) {
+      case PathDiagnosticPiece::Call: {
+        PathDiagnosticCallPiece *call = cast<PathDiagnosticCallPiece>(piece);
+        // Recursively clean out the subclass.  Keep this call around if
+        // it contains any informative diagnostics.
+        if (!RemoveUneededCalls(call->path))
+          continue;
         containsSomethingInteresting = true;
+        break;
+      }
+      case PathDiagnosticPiece::Macro: {
+        PathDiagnosticMacroPiece *macro = cast<PathDiagnosticMacroPiece>(piece);
+        if (!RemoveUneededCalls(macro->subPieces))
+          continue;
+        containsSomethingInteresting = true;
+        break;
+      }
+      case PathDiagnosticPiece::Event: {
+        PathDiagnosticEventPiece *event = cast<PathDiagnosticEventPiece>(piece);
+        // We never throw away an event, but we do throw it away wholesale
+        // as part of a path if we throw the entire path away.
+        if (!event->isPrunable())
+          containsSomethingInteresting = true;
+        break;
+      }
+      case PathDiagnosticPiece::ControlFlow:
+        break;
     }
     
     pieces.push_back(piece);
@@ -557,7 +564,7 @@
 // "Minimal" path diagnostic generation algorithm.
 //===----------------------------------------------------------------------===//
 
-static void CompactPathDiagnostic(PathDiagnostic &PD, const SourceManager& SM);
+static void CompactPathDiagnostic(PathPieces &path, const SourceManager& SM);
 
 static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
                                           PathDiagnosticBuilder &PDB,
@@ -870,7 +877,7 @@
 
   // After constructing the full PathDiagnostic, do a pass over it to compact
   // PathDiagnosticPieces that occur within a macro.
-  CompactPathDiagnostic(PD, PDB.getSourceManager());
+  CompactPathDiagnostic(PD.getMutablePieces(), PDB.getSourceManager());
 }
 
 //===----------------------------------------------------------------------===//
@@ -1222,17 +1229,22 @@
         PD.pushActivePath(&C->path);
         break;
       }
-
-      // Note that is important that we update the LocationContext
-      // after looking at CallExits.  CallExit basically adds an
-      // edge in the *caller*, so we don't want to update the LocationContext
-      // too soon.
-      PDB.LC = N->getLocationContext();
-
+      
       // Pop the call hierarchy if we are done walking the contents
       // of a function call.
       if (const CallEnter *CE = dyn_cast<CallEnter>(&P)) {
+        // Add an edge to the start of the function.
+        const Decl *D = CE->getCalleeContext()->getDecl();
+        PathDiagnosticLocation pos =
+          PathDiagnosticLocation::createBegin(D, SM);
+        EB.addEdge(pos);
+        
+        // Flush all locations, and pop the active path.
+        EB.flushLocations();
         PD.popActivePath();
+        assert(!PD.getActivePath().empty());
+        PDB.LC = N->getLocationContext();
+
         // The current active path should never be empty.  Either we
         // just added a bunch of stuff to the top-level path, or
         // we have a previous CallExit.  If the front of the active
@@ -1240,16 +1252,20 @@
         // path terminated within a function call.  We must then take the
         // current contents of the active path and place it within
         // a new PathDiagnosticCallPiece.
-        assert(!PD.getActivePath().empty());
-        PathDiagnosticCallPiece *C = 
+        PathDiagnosticCallPiece *C =
           dyn_cast<PathDiagnosticCallPiece>(PD.getActivePath().front());
         if (!C)
           C = PathDiagnosticCallPiece::construct(PD.getActivePath());
         C->setCallee(*CE, SM);
-        EB.flushLocations();
         EB.addContext(CE->getCallExpr());
         break;
       }
+      
+      // Note that is important that we update the LocationContext
+      // after looking at CallExits.  CallExit basically adds an
+      // edge in the *caller*, so we don't want to update the LocationContext
+      // too soon.
+      PDB.LC = N->getLocationContext();
 
       // Block edges.
       if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) {        
@@ -1271,6 +1287,7 @@
           PathDiagnosticEventPiece *p =
             new PathDiagnosticEventPiece(L,
                                         "Looping back to the head of the loop");
+          p->setPrunable(true);
 
           EB.addEdge(p->getLocation(), true);
           PD.getActivePath().push_front(p);
@@ -1645,7 +1662,7 @@
 
 /// CompactPathDiagnostic - This function postprocesses a PathDiagnostic object
 ///  and collapses PathDiagosticPieces that are expanded by macros.
-static void CompactPathDiagnostic(PathDiagnostic &PD, const SourceManager& SM) {
+static void CompactPathDiagnostic(PathPieces &path, const SourceManager& SM) {
   typedef std::vector<std::pair<IntrusiveRefCntPtr<PathDiagnosticMacroPiece>,
                                 SourceLocation> > MacroStackTy;
 
@@ -1655,10 +1672,18 @@
   MacroStackTy MacroStack;
   PiecesTy Pieces;
 
-  for (PathPieces::const_iterator I = PD.path.begin(), E = PD.path.end();
+  for (PathPieces::const_iterator I = path.begin(), E = path.end();
        I!=E; ++I) {
+    
+    PathDiagnosticPiece *piece = I->getPtr();
+
+    // Recursively compact calls.
+    if (PathDiagnosticCallPiece *call=dyn_cast<PathDiagnosticCallPiece>(piece)){
+      CompactPathDiagnostic(call->path, SM);
+    }
+    
     // Get the location of the PathDiagnosticPiece.
-    const FullSourceLoc Loc = (*I)->getLocation().asLocation();
+    const FullSourceLoc Loc = piece->getLocation().asLocation();
 
     // Determine the instantiation location, which is the location we group
     // related PathDiagnosticPieces.
@@ -1668,7 +1693,7 @@
 
     if (Loc.isFileID()) {
       MacroStack.clear();
-      Pieces.push_back(*I);
+      Pieces.push_back(piece);
       continue;
     }
 
@@ -1676,7 +1701,7 @@
 
     // Is the PathDiagnosticPiece within the same macro group?
     if (!MacroStack.empty() && InstantiationLoc == MacroStack.back().second) {
-      MacroStack.back().first->subPieces.push_back(*I);
+      MacroStack.back().first->subPieces.push_back(piece);
       continue;
     }
 
@@ -1707,7 +1732,7 @@
       // Create a new macro group and add it to the stack.
       PathDiagnosticMacroPiece *NewGroup =
         new PathDiagnosticMacroPiece(
-          PathDiagnosticLocation::createSingleLocation((*I)->getLocation()));
+          PathDiagnosticLocation::createSingleLocation(piece->getLocation()));
 
       if (MacroGroup)
         MacroGroup->subPieces.push_back(NewGroup);
@@ -1721,18 +1746,14 @@
     }
 
     // Finally, add the PathDiagnosticPiece to the group.
-    MacroGroup->subPieces.push_back(*I);
+    MacroGroup->subPieces.push_back(piece);
   }
 
   // Now take the pieces and construct a new PathDiagnostic.
-  PD.getMutablePieces().clear();
+  path.clear();
 
-  for (PiecesTy::iterator I=Pieces.begin(), E=Pieces.end(); I!=E; ++I) {
-    if (PathDiagnosticMacroPiece *MP = dyn_cast<PathDiagnosticMacroPiece>(*I))
-      if (!MP->containsEvent())
-        continue;
-    PD.getMutablePieces().push_back(*I);
-  }
+  for (PiecesTy::iterator I=Pieces.begin(), E=Pieces.end(); I!=E; ++I)
+    path.push_back(*I);
 }
 
 void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngine.cpp Tue Mar  6 07:07:43 2012
@@ -480,7 +480,6 @@
   switch (S->getStmtClass()) {
     // C++ and ARC stuff we don't support yet.
     case Expr::ObjCIndirectCopyRestoreExprClass:
-    case Stmt::CXXBindTemporaryExprClass:
     case Stmt::CXXCatchStmtClass:
     case Stmt::CXXDependentScopeMemberExprClass:
     case Stmt::CXXPseudoDestructorExprClass:
@@ -607,6 +606,7 @@
     case Stmt::SizeOfPackExprClass:
     case Stmt::StringLiteralClass:
     case Stmt::ObjCStringLiteralClass:
+    case Stmt::CXXBindTemporaryExprClass:
     case Stmt::CXXNullPtrLiteralExprClass: {
       Bldr.takeNodes(Pred);
       ExplodedNodeSet preVisit;
@@ -1642,67 +1642,29 @@
 }
 
 void ExprEngine::VisitAsmStmt(const AsmStmt *A, ExplodedNode *Pred,
-                                ExplodedNodeSet &Dst) {
-  VisitAsmStmtHelperOutputs(A, A->begin_outputs(), A->end_outputs(), Pred, Dst);
-}
-
-void ExprEngine::VisitAsmStmtHelperOutputs(const AsmStmt *A,
-                                             AsmStmt::const_outputs_iterator I,
-                                             AsmStmt::const_outputs_iterator E,
-                                     ExplodedNode *Pred, ExplodedNodeSet &Dst) {
-  if (I == E) {
-    VisitAsmStmtHelperInputs(A, A->begin_inputs(), A->end_inputs(), Pred, Dst);
-    return;
-  }
-
-  ExplodedNodeSet Tmp;
-  Visit(*I, Pred, Tmp);
-  ++I;
-
-  for (ExplodedNodeSet::iterator NI = Tmp.begin(), NE = Tmp.end();NI != NE;++NI)
-    VisitAsmStmtHelperOutputs(A, I, E, *NI, Dst);
-}
-
-void ExprEngine::VisitAsmStmtHelperInputs(const AsmStmt *A,
-                                            AsmStmt::const_inputs_iterator I,
-                                            AsmStmt::const_inputs_iterator E,
-                                            ExplodedNode *Pred,
-                                            ExplodedNodeSet &Dst) {
-  if (I == E) {
-    StmtNodeBuilder Bldr(Pred, Dst, *currentBuilderContext);
-    // We have processed both the inputs and the outputs.  All of the outputs
-    // should evaluate to Locs.  Nuke all of their values.
-
-    // FIXME: Some day in the future it would be nice to allow a "plug-in"
-    // which interprets the inline asm and stores proper results in the
-    // outputs.
-
-    ProgramStateRef state = Pred->getState();
+                              ExplodedNodeSet &Dst) {
+  StmtNodeBuilder Bldr(Pred, Dst, *currentBuilderContext);
+  // We have processed both the inputs and the outputs.  All of the outputs
+  // should evaluate to Locs.  Nuke all of their values.
 
-    for (AsmStmt::const_outputs_iterator OI = A->begin_outputs(),
-                                   OE = A->end_outputs(); OI != OE; ++OI) {
+  // FIXME: Some day in the future it would be nice to allow a "plug-in"
+  // which interprets the inline asm and stores proper results in the
+  // outputs.
 
-      SVal X = state->getSVal(*OI, Pred->getLocationContext());
-      assert (!isa<NonLoc>(X));  // Should be an Lval, or unknown, undef.
+  ProgramStateRef state = Pred->getState();
 
-      if (isa<Loc>(X))
-        state = state->bindLoc(cast<Loc>(X), UnknownVal());
-    }
+  for (AsmStmt::const_outputs_iterator OI = A->begin_outputs(),
+       OE = A->end_outputs(); OI != OE; ++OI) {
+    SVal X = state->getSVal(*OI, Pred->getLocationContext());
+    assert (!isa<NonLoc>(X));  // Should be an Lval, or unknown, undef.
 
-    Bldr.generateNode(A, Pred, state);
-    return;
+    if (isa<Loc>(X))
+      state = state->bindLoc(cast<Loc>(X), UnknownVal());
   }
 
-  ExplodedNodeSet Tmp;
-  Visit(*I, Pred, Tmp);
-
-  ++I;
-
-  for (ExplodedNodeSet::iterator NI = Tmp.begin(), NE = Tmp.end(); NI!=NE; ++NI)
-    VisitAsmStmtHelperInputs(A, I, E, *NI, Dst);
+  Bldr.generateNode(A, Pred, state);
 }
 
-
 //===----------------------------------------------------------------------===//
 // Visualization.
 //===----------------------------------------------------------------------===//

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp Tue Mar  6 07:07:43 2012
@@ -335,15 +335,9 @@
 
 void ExprEngine::VisitCXXDeleteExpr(const CXXDeleteExpr *CDE, 
                                     ExplodedNode *Pred, ExplodedNodeSet &Dst) {
-  // Should do more checking.
-  ExplodedNodeSet Argevaluated;
-  Visit(CDE->getArgument(), Pred, Argevaluated);
-  StmtNodeBuilder Bldr(Argevaluated, Dst, *currentBuilderContext);
-  for (ExplodedNodeSet::iterator I = Argevaluated.begin(), 
-                                 E = Argevaluated.end(); I != E; ++I) {
-    ProgramStateRef state = (*I)->getState();
-    Bldr.generateNode(CDE, *I, state);
-  }
+  StmtNodeBuilder Bldr(Pred, Dst, *currentBuilderContext);
+  ProgramStateRef state = Pred->getState();
+  Bldr.generateNode(CDE, Pred, state);
 }
 
 void ExprEngine::VisitCXXThisExpr(const CXXThisExpr *TE, ExplodedNode *Pred,

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp Tue Mar  6 07:07:43 2012
@@ -14,7 +14,7 @@
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h"
-#include "llvm/ADT/SaveAndRestore.h"
+#include "llvm/Support/SaveAndRestore.h"
 #include "clang/AST/DeclCXX.h"
 
 using namespace clang;
@@ -142,13 +142,16 @@
       // FIXME: Handle C++.
       break;
     case Stmt::CallExprClass: {
-      // Cap the stack depth at 4 calls (5 stack frames, base + 4 calls).
-      // These heuristics are a WIP.
-      if (getNumberStackFrames(Pred->getLocationContext()) == 5)
+      if (getNumberStackFrames(Pred->getLocationContext())
+            == AMgr.InlineMaxStackDepth)
         return false;
-      
-      // Construct a new stack frame for the callee.
+
       AnalysisDeclContext *CalleeADC = AMgr.getAnalysisDeclContext(FD);
+      const CFG *CalleeCFG = CalleeADC->getCFG();
+      if (CalleeCFG->getNumBlockIDs() > AMgr.InlineMaxFunctionSize)
+        return false;
+
+      // Construct a new stack frame for the callee.
       const StackFrameContext *CallerSFC =
       Pred->getLocationContext()->getCurrentStackFrame();
       const StackFrameContext *CalleeSFC =
@@ -197,10 +200,15 @@
       // value into thread local storage. The value can later be retrieved with
       // 'void *ptheread_getspecific(pthread_key)'. So even thought the
       // parameter is 'const void *', the region escapes through the call.
+      //  - funopen - sets a buffer for future IO calls.
       //  - ObjC functions that end with "NoCopy" can free memory, of the passed
       // in buffer.
+      // - Many CF containers allow objects to escape through custom
+      // allocators/deallocators upon container construction.
       if (FName == "pthread_setspecific" ||
-          FName.endswith("NoCopy"))
+          FName == "funopen" ||
+          FName.endswith("NoCopy") ||
+          Call.isCFCGAllowingEscape(FName))
         return;
     }
 

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp Tue Mar  6 07:07:43 2012
@@ -95,7 +95,8 @@
   }
 }
 
-static void flattenPath(PathPieces &path, const PathPieces &oldPath) {
+static void flattenPath(PathPieces &primaryPath, PathPieces &currentPath,
+                        const PathPieces &oldPath) {
   for (PathPieces::const_iterator it = oldPath.begin(), et = oldPath.end();
        it != et; ++it ) {
     PathDiagnosticPiece *piece = it->getPtr();
@@ -104,16 +105,24 @@
       IntrusiveRefCntPtr<PathDiagnosticEventPiece> callEnter =
         call->getCallEnterEvent();
       if (callEnter)
-        path.push_back(callEnter);
-      flattenPath(path, call->path);
+        currentPath.push_back(callEnter);
+      flattenPath(primaryPath, primaryPath, call->path);
       IntrusiveRefCntPtr<PathDiagnosticEventPiece> callExit =
         call->getCallExitEvent();
       if (callExit)
-        path.push_back(callExit);
+        currentPath.push_back(callExit);
       continue;
     }
-
-    path.push_back(piece);
+    if (PathDiagnosticMacroPiece *macro =
+        dyn_cast<PathDiagnosticMacroPiece>(piece)) {
+      currentPath.push_back(piece);
+      PathPieces newPath;
+      flattenPath(primaryPath, newPath, macro->subPieces);
+      macro->subPieces = newPath;
+      continue;
+    }
+    
+    currentPath.push_back(piece);
   }
 }
 
@@ -144,7 +153,7 @@
 
   // First flatten out the entire path to make it easier to use.
   PathPieces path;
-  flattenPath(path, D.path);
+  flattenPath(path, path, D.path);
 
   // The path as already been prechecked that all parts of the path are
   // from the same file and that it is non-empty.

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Tue Mar  6 07:07:43 2012
@@ -93,26 +93,43 @@
     // Verify that the entire path is from the same FileID.
     FileID FID;
     const SourceManager &SMgr = (*D->path.begin())->getLocation().getManager();
+    llvm::SmallVector<const PathPieces *, 5> WorkList;
+    WorkList.push_back(&D->path);
 
-    for (PathPieces::const_iterator I = D->path.begin(), E = D->path.end();
-         I != E; ++I) {
-      FullSourceLoc L = (*I)->getLocation().asLocation().getExpansionLoc();
+    while (!WorkList.empty()) {
+      const PathPieces &path = *WorkList.back();
+      WorkList.pop_back();
+
+      for (PathPieces::const_iterator I = path.begin(), E = path.end();
+           I != E; ++I) {
+        const PathDiagnosticPiece *piece = I->getPtr();
+        FullSourceLoc L = piece->getLocation().asLocation().getExpansionLoc();
       
-      if (FID.isInvalid()) {
-        FID = SMgr.getFileID(L);
-      } else if (SMgr.getFileID(L) != FID)
-        return; // FIXME: Emit a warning?
-      
-      // Check the source ranges.
-      for (PathDiagnosticPiece::range_iterator RI = (*I)->ranges_begin(),
-           RE = (*I)->ranges_end();
-           RI != RE; ++RI) {
-        SourceLocation L = SMgr.getExpansionLoc(RI->getBegin());
-        if (!L.isFileID() || SMgr.getFileID(L) != FID)
-          return; // FIXME: Emit a warning?
-        L = SMgr.getExpansionLoc(RI->getEnd());
-        if (!L.isFileID() || SMgr.getFileID(L) != FID)
+        if (FID.isInvalid()) {
+          FID = SMgr.getFileID(L);
+        } else if (SMgr.getFileID(L) != FID)
           return; // FIXME: Emit a warning?
+      
+        // Check the source ranges.
+        for (PathDiagnosticPiece::range_iterator RI = piece->ranges_begin(),
+             RE = piece->ranges_end();
+             RI != RE; ++RI) {
+          SourceLocation L = SMgr.getExpansionLoc(RI->getBegin());
+          if (!L.isFileID() || SMgr.getFileID(L) != FID)
+            return; // FIXME: Emit a warning?
+          L = SMgr.getExpansionLoc(RI->getEnd());
+          if (!L.isFileID() || SMgr.getFileID(L) != FID)
+            return; // FIXME: Emit a warning?
+        }
+        
+        if (const PathDiagnosticCallPiece *call =
+            dyn_cast<PathDiagnosticCallPiece>(piece)) {
+          WorkList.push_back(&call->path);
+        }
+        else if (const PathDiagnosticMacroPiece *macro =
+                 dyn_cast<PathDiagnosticMacroPiece>(piece)) {
+          WorkList.push_back(&macro->subPieces);
+        }
       }
     }
     
@@ -510,7 +527,8 @@
   const Decl *D = CE.getCalleeContext()->getDecl();
   Callee = D;
   callEnter = PathDiagnosticLocation(CE.getCallExpr(), SM,
-                                     CE.getLocationContext());  
+                                     CE.getLocationContext());
+  callEnterWithin = PathDiagnosticLocation::createBegin(D, SM);
 }
 
 IntrusiveRefCntPtr<PathDiagnosticEventPiece>
@@ -520,16 +538,32 @@
   SmallString<256> buf;
   llvm::raw_svector_ostream Out(buf);
   if (isa<BlockDecl>(Callee))
-    Out << "Entering call to block";
+    Out << "Calling anonymous block";
   else if (const NamedDecl *ND = dyn_cast<NamedDecl>(Callee))
-    Out << "Entering call to '" << *ND << "'";
+    Out << "Calling '" << *ND << "'";
   StringRef msg = Out.str();
   if (msg.empty())
     return 0;
   return new PathDiagnosticEventPiece(callEnter, msg);
 }
 
-IntrusiveRefCntPtr<PathDiagnosticEventPiece> 
+IntrusiveRefCntPtr<PathDiagnosticEventPiece>
+PathDiagnosticCallPiece::getCallEnterWithinCallerEvent() const {
+  if (!Callee)
+    return 0;
+  SmallString<256> buf;
+  llvm::raw_svector_ostream Out(buf);
+  if (isa<BlockDecl>(Callee))
+    Out << "Entered call to block";
+  else if (const NamedDecl *ND = dyn_cast<NamedDecl>(Callee))
+    Out << "Entered call to '" << *ND << "'";
+  StringRef msg = Out.str();
+  if (msg.empty())
+    return 0;
+  return new PathDiagnosticEventPiece(callEnterWithin, msg);
+}
+
+IntrusiveRefCntPtr<PathDiagnosticEventPiece>
 PathDiagnosticCallPiece::getCallExitEvent() const {
   if (!Caller)
     return 0;

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp Tue Mar  6 07:07:43 2012
@@ -255,15 +255,23 @@
   
   IntrusiveRefCntPtr<PathDiagnosticEventPiece> callEnter =
     P.getCallEnterEvent();  
+
   if (callEnter)
     ReportPiece(o, *callEnter, FM, SM, LangOpts, indent, true);
 
+  IntrusiveRefCntPtr<PathDiagnosticEventPiece> callEnterWithinCaller =
+    P.getCallEnterWithinCallerEvent();
+  
+  if (callEnterWithinCaller)
+    ReportPiece(o, *callEnterWithinCaller, FM, SM, LangOpts, indent, true);
+  
   for (PathPieces::const_iterator I = P.path.begin(), E = P.path.end();I!=E;++I)
     ReportPiece(o, **I, FM, SM, LangOpts, indent, true);
   
   IntrusiveRefCntPtr<PathDiagnosticEventPiece> callExit =
     P.getCallExitEvent();
-  if (callExit)  
+
+  if (callExit)
     ReportPiece(o, *callExit, FM, SM, LangOpts, indent, true);
 }
 
@@ -324,19 +332,38 @@
   if (!Diags.empty())
     SM = &(*(*Diags.begin())->path.begin())->getLocation().getManager();
 
+  
   for (std::vector<const PathDiagnostic*>::iterator DI = Diags.begin(),
        DE = Diags.end(); DI != DE; ++DI) {
 
     const PathDiagnostic *D = *DI;
 
-    for (PathPieces::const_iterator I = D->path.begin(), E = D->path.end();
-         I!=E; ++I) {
-      AddFID(FM, Fids, SM, (*I)->getLocation().asLocation());
-
-      for (PathDiagnosticPiece::range_iterator RI = (*I)->ranges_begin(),
-           RE= (*I)->ranges_end(); RI != RE; ++RI) {
-        AddFID(FM, Fids, SM, RI->getBegin());
-        AddFID(FM, Fids, SM, RI->getEnd());
+    llvm::SmallVector<const PathPieces *, 5> WorkList;
+    WorkList.push_back(&D->path);
+
+    while (!WorkList.empty()) {
+      const PathPieces &path = *WorkList.back();
+      WorkList.pop_back();
+    
+      for (PathPieces::const_iterator I = path.begin(), E = path.end();
+           I!=E; ++I) {
+        const PathDiagnosticPiece *piece = I->getPtr();
+        AddFID(FM, Fids, SM, piece->getLocation().asLocation());
+
+        for (PathDiagnosticPiece::range_iterator RI = piece->ranges_begin(),
+             RE= piece->ranges_end(); RI != RE; ++RI) {
+          AddFID(FM, Fids, SM, RI->getBegin());
+          AddFID(FM, Fids, SM, RI->getEnd());
+        }
+
+        if (const PathDiagnosticCallPiece *call =
+            dyn_cast<PathDiagnosticCallPiece>(piece)) {
+          WorkList.push_back(&call->path);
+        }
+        else if (const PathDiagnosticMacroPiece *macro =
+                 dyn_cast<PathDiagnosticMacroPiece>(piece)) {
+          WorkList.push_back(&macro->subPieces);
+        }
       }
     }
   }

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp Tue Mar  6 07:07:43 2012
@@ -714,6 +714,24 @@
 
     // The two regions are from the same base region. See if they're both a
     // type of region we know how to compare.
+    const MemSpaceRegion *LeftMS = LeftBase->getMemorySpace();
+    const MemSpaceRegion *RightMS = RightBase->getMemorySpace();
+
+    // Heuristic: assume that no symbolic region (whose memory space is
+    // unknown) is on the stack.
+    // FIXME: we should be able to be more precise once we can do better
+    // aliasing constraints for symbolic regions, but this is a reasonable,
+    // albeit unsound, assumption that holds most of the time.
+    if (isa<StackSpaceRegion>(LeftMS) ^ isa<StackSpaceRegion>(RightMS)) {
+      switch (op) {
+        default:
+          break;
+        case BO_EQ:
+          return makeTruthVal(false, resultTy);
+        case BO_NE:
+          return makeTruthVal(true, resultTy);
+      }
+    }
 
     // FIXME: If/when there is a getAsRawOffset() for FieldRegions, this
     // ElementRegion path and the FieldRegion path below should be unified.

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Tue Mar  6 07:07:43 2012
@@ -34,6 +34,7 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Program.h"
+#include "llvm/Support/Timer.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/Statistic.h"
 
@@ -77,12 +78,24 @@
   OwningPtr<CheckerManager> checkerMgr;
   OwningPtr<AnalysisManager> Mgr;
 
+  /// Time the analyzes time of each translation unit.
+  static llvm::Timer* TUTotalTimer;
+
   AnalysisConsumer(const Preprocessor& pp,
                    const std::string& outdir,
                    const AnalyzerOptions& opts,
                    ArrayRef<std::string> plugins)
     : Ctx(0), PP(pp), OutDir(outdir), Opts(opts), Plugins(plugins), PD(0) {
     DigestAnalyzerOptions();
+    if (Opts.PrintStats) {
+      llvm::EnableStatistics();
+      TUTotalTimer = new llvm::Timer("Analyzer Total Time");
+    }
+  }
+
+  ~AnalysisConsumer() {
+    if (Opts.PrintStats)
+      delete TUTotalTimer;
   }
 
   void DigestAnalyzerOptions() {
@@ -157,9 +170,9 @@
                                   Opts.TrimGraph, Opts.InlineCall,
                                   Opts.UnoptimizedCFG, Opts.CFGAddImplicitDtors,
                                   Opts.CFGAddInitializers,
-                                  Opts.EagerlyTrimEGraph));
-    if (Opts.PrintStats)
-      llvm::EnableStatistics();
+                                  Opts.EagerlyTrimEGraph,
+                                  Opts.InlineMaxStackDepth,
+                                  Opts.InlineMaxFunctionSize));
   }
 
   virtual void HandleTranslationUnit(ASTContext &C);
@@ -173,6 +186,7 @@
 //===----------------------------------------------------------------------===//
 // AnalysisConsumer implementation.
 //===----------------------------------------------------------------------===//
+llvm::Timer* AnalysisConsumer::TUTotalTimer = 0;
 
 void AnalysisConsumer::HandleDeclContext(ASTContext &C, DeclContext *dc) {
   for (DeclContext::decl_iterator I = dc->decls_begin(), E = dc->decls_end();
@@ -240,6 +254,8 @@
 
 void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) {
   {
+    if (TUTotalTimer) TUTotalTimer->startTimer();
+
     // Introduce a scope to destroy BR before Mgr.
     BugReporter BR(*Mgr);
     TranslationUnitDecl *TU = C.getTranslationUnitDecl();
@@ -255,6 +271,8 @@
   // side-effects in PathDiagnosticConsumer's destructor. This is required when
   // used with option -disable-free.
   Mgr.reset(NULL);
+
+  if (TUTotalTimer) TUTotalTimer->stopTimer();
 }
 
 static void FindBlocks(DeclContext *D, SmallVectorImpl<Decl*> &WL) {

Modified: cfe/branches/tooling/runtime/compiler-rt/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/runtime/compiler-rt/Makefile?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/runtime/compiler-rt/Makefile (original)
+++ cfe/branches/tooling/runtime/compiler-rt/Makefile Tue Mar  6 07:07:43 2012
@@ -28,12 +28,6 @@
 # Expect compiler-rt to be in llvm/projects/compiler-rt
 COMPILERRT_SRC_ROOT := $(LLVM_SRC_ROOT)/projects/compiler-rt
 
-# Additional flags to pass to Clang.
-CLANG_CCFLAGS :=
-ifeq ($(ARCH), arm)
-CLANG_CCFLAGS += -no-integrated-as
-endif
-
 # We don't currently support building runtime libraries when we are
 # cross-compiling. The issue is that we really want to be set up so that the
 # available compiler targets are independent of the current build.
@@ -82,11 +76,6 @@
 RuntimeLibrary.darwin.Configs := \
 	eprintf 10.4 osx ios cc_kext \
 	asan_osx profile_osx profile_ios
-
-# On Darwin, fake Clang into using the iOS assembler (since compiler-rt wants to
-# build ARM bits).
-CLANG_CCFLAGS += -ccc-install-dir \
-	/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/
 endif
 
 # On Linux, include a library which has all the runtime functions.
@@ -119,7 +108,7 @@
 	$(Verb) $(MAKE) -C $(COMPILERRT_SRC_ROOT) \
 	  ProjSrcRoot=$(COMPILERRT_SRC_ROOT) \
 	  ProjObjRoot=$(PROJ_OBJ_DIR) \
-	  CC="$(ToolDir)/clang $(CLANG_CCFLAGS)" \
+	  CC="$(ToolDir)/clang" \
 	  $(RuntimeDirs:%=clang_%)
 .PHONY: BuildRuntimeLibraries
 CleanRuntimeLibraries:

Modified: cfe/branches/tooling/test/ARCMT/rewrite-block-var.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/rewrite-block-var.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/rewrite-block-var.m (original)
+++ cfe/branches/tooling/test/ARCMT/rewrite-block-var.m Tue Mar  6 07:07:43 2012
@@ -23,3 +23,23 @@
     x = [p something];
   });
 }
+
+void test3(Foo *p) {
+  __block Foo *x; // __block used as output variable.
+  bar(^{
+    [x something];
+  });
+  bar(^{
+    x = 0;
+  });
+}
+
+void test4(Foo *p) {
+  __block Foo *x = p; // __block used just to break cycle.
+  bar(^{
+    [x something];
+  });
+  bar(^{
+    [x something];
+  });
+}

Modified: cfe/branches/tooling/test/ARCMT/rewrite-block-var.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/rewrite-block-var.m.result?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/rewrite-block-var.m.result (original)
+++ cfe/branches/tooling/test/ARCMT/rewrite-block-var.m.result Tue Mar  6 07:07:43 2012
@@ -23,3 +23,23 @@
     x = [p something];
   });
 }
+
+void test3(Foo *p) {
+  __block Foo *x; // __block used as output variable.
+  bar(^{
+    [x something];
+  });
+  bar(^{
+    x = 0;
+  });
+}
+
+void test4(Foo *p) {
+  __weak Foo *x = p; // __block used just to break cycle.
+  bar(^{
+    [x something];
+  });
+  bar(^{
+    [x something];
+  });
+}

Modified: cfe/branches/tooling/test/Analysis/inline-unique-reports.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/inline-unique-reports.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/inline-unique-reports.c (original)
+++ cfe/branches/tooling/test/Analysis/inline-unique-reports.c Tue Mar  6 07:07:43 2012
@@ -84,9 +84,56 @@
 // CHECK:        </array>
 // CHECK:      </array>
 // CHECK:      <key>extended_message</key>
-// CHECK:      <string>Entering call to 'bug'</string>
+// CHECK:      <string>Calling 'bug'</string>
 // CHECK:      <key>message</key>
-// CHECK: <string>Entering call to 'bug'</string>
+// CHECK: <string>Calling 'bug'</string>
+// CHECK:     </dict>
+// CHECK:     <dict>
+// CHECK:      <key>kind</key><string>event</string>
+// CHECK:      <key>location</key>
+// CHECK:      <dict>
+// CHECK:       <key>line</key><integer>4</integer>
+// CHECK:       <key>col</key><integer>1</integer>
+// CHECK:       <key>file</key><integer>0</integer>
+// CHECK:      </dict>
+// CHECK:      <key>extended_message</key>
+// CHECK:      <string>Entered call to 'bug'</string>
+// CHECK:      <key>message</key>
+// CHECK: <string>Entered call to 'bug'</string>
+// CHECK:     </dict>
+// CHECK:     <dict>
+// CHECK:      <key>kind</key><string>control</string>
+// CHECK:      <key>edges</key>
+// CHECK:       <array>
+// CHECK:        <dict>
+// CHECK:         <key>start</key>
+// CHECK:          <array>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>4</integer>
+// CHECK:            <key>col</key><integer>1</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>4</integer>
+// CHECK:            <key>col</key><integer>1</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:          </array>
+// CHECK:         <key>end</key>
+// CHECK:          <array>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>5</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>5</integer>
+// CHECK:            <key>col</key><integer>4</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:          </array>
+// CHECK:        </dict>
+// CHECK:       </array>
 // CHECK:     </dict>
 // CHECK:     <dict>
 // CHECK:      <key>kind</key><string>event</string>

Modified: cfe/branches/tooling/test/Analysis/inline.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/inline.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/inline.c (original)
+++ cfe/branches/tooling/test/Analysis/inline.c Tue Mar  6 07:07:43 2012
@@ -58,3 +58,35 @@
     *p = 0xDEADBEEF; // no-warning
   }
 }
+
+// Test that returning stack memory from a parent stack frame does
+// not trigger a warning.
+static char *return_buf(char *buf) {
+  return buf + 10;
+}
+
+void test_return_stack_memory_ok() {
+  char stack_buf[100];
+  char *pos = return_buf(stack_buf);
+  (void) pos;
+}
+
+char *test_return_stack_memory_bad() {
+  char stack_buf[100];
+  char *x = stack_buf;
+  return x; // expected-warning {{stack memory associated}}
+}
+
+// Test that passing a struct value with an uninitialized field does
+// not trigger a warning if we are inlining and the body is available.
+struct rdar10977037 { int x, y; };
+int test_rdar10977037_aux(struct rdar10977037 v) { return v.y; }
+int test_rdar10977037_aux_2(struct rdar10977037 v);
+int test_rdar10977037() {
+  struct rdar10977037 v;
+  v.y = 1;
+  v. y += test_rdar10977037_aux(v); // no-warning
+  return test_rdar10977037_aux_2(v); // expected-warning {{Passed-by-value struct argument contains uninitialized data}}
+}
+
+

Modified: cfe/branches/tooling/test/Analysis/malloc-annotations.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/malloc-annotations.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/malloc-annotations.c (original)
+++ cfe/branches/tooling/test/Analysis/malloc-annotations.c Tue Mar  6 07:07:43 2012
@@ -6,6 +6,8 @@
 void *calloc(size_t nmemb, size_t size);
 void __attribute((ownership_returns(malloc))) *my_malloc(size_t);
 void __attribute((ownership_takes(malloc, 1))) my_free(void *);
+void my_freeBoth(void *, void *)
+       __attribute((ownership_holds(malloc, 1, 2)));
 void __attribute((ownership_returns(malloc, 1))) *my_malloc2(size_t);
 void __attribute((ownership_holds(malloc, 1))) my_hold(void *);
 
@@ -260,3 +262,10 @@
   }
   return result; // expected-warning{{never released}}
 }
+
+void testMultipleFreeAnnotations() {
+  int *p = malloc(12);
+  int *q = malloc(12);
+  my_freeBoth(p, q);
+}
+

Modified: cfe/branches/tooling/test/Analysis/malloc-interprocedural.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/malloc-interprocedural.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/malloc-interprocedural.c (original)
+++ cfe/branches/tooling/test/Analysis/malloc-interprocedural.c Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=unix.Malloc -analyzer-inline-call -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=unix.Malloc -analyzer-inline-call -analyzer-inline-max-stack-depth 5 -analyzer-inline-max-function-size 6 -analyzer-store=region -verify %s
 
 #include "system-header-simulator.h"
 

Modified: cfe/branches/tooling/test/Analysis/malloc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/malloc.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/malloc.c (original)
+++ cfe/branches/tooling/test/Analysis/malloc.c Tue Mar  6 07:07:43 2012
@@ -677,7 +677,9 @@
   free(s2);
 }
 
+// ----------------------------------------------------------------------------
 // Test the system library functions to which the pointer can escape.
+// This tests false positive suppression.
 
 // For now, we assume memory passed to pthread_specific escapes.
 // TODO: We could check that if a new pthread binding is set, the existing
@@ -687,6 +689,78 @@
   pthread_setspecific(key, buf); // no warning
 }
 
+// PR12101: Test funopen().
+static int releasePtr(void *_ctx) {
+    free(_ctx);
+    return 0;
+}
+FILE *useFunOpen() {
+    void *ctx = malloc(sizeof(int));
+    FILE *f = funopen(ctx, 0, 0, 0, releasePtr); // no warning
+    if (f == 0) {
+        free(ctx);
+    }
+    return f;
+}
+FILE *useFunOpenNoReleaseFunction() {
+    void *ctx = malloc(sizeof(int));
+    FILE *f = funopen(ctx, 0, 0, 0, 0);
+    if (f == 0) {
+        free(ctx);
+    }
+    return f; // expected-warning{{leak}}
+}
+
+// Test setbuf, setvbuf.
+int my_main_no_warning() {
+    char *p = malloc(100);
+    setvbuf(stdout, p, 0, 100);
+    return 0;
+}
+int my_main_no_warning2() {
+    char *p = malloc(100);
+    setbuf(__stdoutp, p);
+    return 0;
+}
+int my_main_warn(FILE *f) {
+    char *p = malloc(100);
+    setvbuf(f, p, 0, 100);
+    return 0;// expected-warning {{leak}}
+}
+
+// <rdar://problem/10978247>.
+// some people use stack allocated memory as an optimization to avoid
+// a heap allocation for small work sizes.  This tests the analyzer's
+// understanding that the malloc'ed memory is not the same as stackBuffer.
+void radar10978247(int myValueSize) {
+  char stackBuffer[128];
+  char *buffer;
+
+  if (myValueSize <= sizeof(stackBuffer))
+    buffer = stackBuffer;
+  else 
+    buffer = malloc(myValueSize);
+
+  // do stuff with the buffer
+  if (buffer != stackBuffer)
+    free(buffer);
+}
+
+void radar10978247_positive(int myValueSize) {
+  char stackBuffer[128];
+  char *buffer;
+
+  if (myValueSize <= sizeof(stackBuffer))
+    buffer = stackBuffer;
+  else 
+    buffer = malloc(myValueSize);
+
+  // do stuff with the buffer
+  if (buffer == stackBuffer) // expected-warning {{leak}}
+    return;
+}
+
+// ----------------------------------------------------------------------------
 // Below are the known false positives.
 
 // TODO: There should be no warning here. This one might be difficult to get rid of.
@@ -706,6 +780,7 @@
   return;
 }
 
+// ----------------------------------------------------------------------------
 // False negatives.
 
 // TODO: This requires tracking symbols stored inside the structs/arrays.

Modified: cfe/branches/tooling/test/Analysis/malloc.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/malloc.mm?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/malloc.mm (original)
+++ cfe/branches/tooling/test/Analysis/malloc.mm Tue Mar  6 07:07:43 2012
@@ -62,8 +62,7 @@
   free(data); // false negative
 }
 
-// Test CF/NS...NoCopy. PR12100.
-
+// Test CF/NS...NoCopy. PR12100: Pointers can escape when custom deallocators are provided.
 void testNSDatafFreeWhenDone(NSUInteger dataLength) {
   CFStringRef str;
   char *bytes = (char*)malloc(12);
@@ -83,3 +82,18 @@
     CFRelease(mutStr);
     //free(myBuffer);
 }
+
+// PR12101 : pointers can escape through custom deallocators set on creation of a container.
+void TestCallbackReleasesMemory(CFDictionaryKeyCallBacks keyCallbacks) {
+  void *key = malloc(12);
+  void *val = malloc(12);
+  CFMutableDictionaryRef x = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &keyCallbacks, &kCFTypeDictionaryValueCallBacks);
+  CFDictionarySetValue(x, key, val); 
+  return;// no-warning
+}
+
+NSData *radar10976702() {
+  void *bytes = malloc(10);
+  return [NSData dataWithBytesNoCopy:bytes length:10]; // no-warning
+}
+

Modified: cfe/branches/tooling/test/Analysis/misc-ps-region-store.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/misc-ps-region-store.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/misc-ps-region-store.m (original)
+++ cfe/branches/tooling/test/Analysis/misc-ps-region-store.m Tue Mar  6 07:07:43 2012
@@ -294,9 +294,11 @@
 struct ArrayWrapper { unsigned char y[16]; };
 struct WrappedStruct { unsigned z; };
 
+void test_handle_array_wrapper_helper();
+
 int test_handle_array_wrapper() {
   struct ArrayWrapper x;
-  test_handle_array_wrapper(&x);
+  test_handle_array_wrapper_helper(&x);
   struct WrappedStruct *p = (struct WrappedStruct*) x.y; // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption.}}
   return p->z;  // no-warning
 }

Modified: cfe/branches/tooling/test/Analysis/nullptr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/nullptr.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/nullptr.cpp (original)
+++ cfe/branches/tooling/test/Analysis/nullptr.cpp Tue Mar  6 07:07:43 2012
@@ -39,7 +39,6 @@
     *np = 0;  // no-warning
 }
 
-
 int pr10372(void *& x) {
   // GNU null is a pointer-sized integer, not a pointer.
   x = __null;
@@ -47,3 +46,16 @@
   return __null;
 }
 
+void zoo1() {
+  char **p = 0;
+  delete *(p + 0); // expected-warning{{Dereference of null pointer}}
+}
+
+void zoo2() {
+  int **a = 0;
+  int **b = 0;
+  asm ("nop"
+      :"=a"(*a)
+      :"0"(*b) // expected-warning{{Dereference of null pointer}}
+      );
+}

Modified: cfe/branches/tooling/test/Analysis/ptr-arith.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/ptr-arith.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/ptr-arith.c (original)
+++ cfe/branches/tooling/test/Analysis/ptr-arith.c Tue Mar  6 07:07:43 2012
@@ -269,7 +269,7 @@
   int a;
 
   if (&a == p)
-    WARN; // expected-warning{{}}
+    WARN; // no-warning
   if (&a != p)
     WARN; // expected-warning{{}}
   if (&a > p)

Modified: cfe/branches/tooling/test/Analysis/self-init.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/self-init.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/self-init.m (original)
+++ cfe/branches/tooling/test/Analysis/self-init.m Tue Mar  6 07:07:43 2012
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -analyze -analyzer-checker=osx.cocoa.SelfInit %s -verify
 
 @class NSZone, NSCoder;
- at protocol NSObject
- at end 
+ at protocol NSObject- (id)self;
+ at end
 @protocol NSCopying  - (id)copyWithZone:(NSZone *)zone;
 @end 
 @protocol NSMutableCopying  - (id)mutableCopyWithZone:(NSZone *)zone;
@@ -22,9 +22,14 @@
 
 //#import "Foundation/NSObject.h"
 typedef unsigned NSUInteger;
-typedef int NSInteger;
+typedef long NSInteger;
+
+ at interface NSInvocation : NSObject {}
+- (void)getArgument:(void *)argumentLocation atIndex:(NSInteger)idx;
+- (void)setArgument:(void *)argumentLocation atIndex:(NSInteger)idx;
+ at end
 
- at class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+ at class NSMethodSignature, NSCoder, NSString, NSEnumerator;
 @interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding>
 - (NSUInteger)length;
 + (id)stringWithUTF8String:(const char *)nullTerminatedCString;
@@ -180,3 +185,19 @@
 - (id)init { return self; }
 
 @end
+
+
+// Test for radar://10973514 : self should not be invalidated by a method call.
+ at interface Test : NSObject {
+    NSInvocation *invocation_;
+}
+ at end
+ at implementation Test
+-(id) initWithTarget:(id) rec selector:(SEL) cb {
+  if (self=[super init]) {
+    [invocation_ setArgument:&self atIndex:2];
+  }   
+  return self;
+}
+ at end
+

Modified: cfe/branches/tooling/test/Analysis/stats.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/stats.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/stats.c (original)
+++ cfe/branches/tooling/test/Analysis/stats.c Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-stats %s > FileCheck %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-stats %s 2>&1 | FileCheck %s
 
 void foo() {
   int x;

Modified: cfe/branches/tooling/test/Analysis/system-header-simulator-objc.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/system-header-simulator-objc.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/system-header-simulator-objc.h (original)
+++ cfe/branches/tooling/test/Analysis/system-header-simulator-objc.h Tue Mar  6 07:07:43 2012
@@ -92,6 +92,19 @@
 - (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)b;
 @end
 
+typedef struct {
+}
+CFDictionaryKeyCallBacks;
+extern const CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks;
+typedef struct {
+}
+CFDictionaryValueCallBacks;
+extern const CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks;
+typedef const struct __CFDictionary * CFDictionaryRef;
+typedef struct __CFDictionary * CFMutableDictionaryRef;
+extern CFMutableDictionaryRef CFDictionaryCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFDictionaryKeyCallBacks *keyCallBacks, const CFDictionaryValueCallBacks *valueCallBacks);
+void CFDictionarySetValue(CFMutableDictionaryRef, const void *, const void *);
+
 
 extern void CFRelease(CFTypeRef cf);
 

Modified: cfe/branches/tooling/test/Analysis/system-header-simulator.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/system-header-simulator.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/system-header-simulator.h (original)
+++ cfe/branches/tooling/test/Analysis/system-header-simulator.h Tue Mar  6 07:07:43 2012
@@ -2,16 +2,37 @@
 
 typedef struct _FILE FILE;
 extern FILE *stdin;
-int fscanf(FILE *restrict stream, const char *restrict format, ...);
+extern FILE *stdout;
+extern FILE *stderr;
+// Include a variant of standard streams that occur in the pre-processed file.
+extern FILE *__stdinp;
+extern FILE *__stdoutp;
+extern FILE *__stderrp;
+
+
+int fscanf(FILE *restrict, const char *restrict, ...);
 
 // Note, on some platforms errno macro gets replaced with a function call.
 extern int errno;
 
 unsigned long strlen(const char *);
 
-char *strcpy(char *restrict s1, const char *restrict s2);
+char *strcpy(char *restrict, const char *restrict);
 
 typedef unsigned long __darwin_pthread_key_t;
 typedef __darwin_pthread_key_t pthread_key_t;
-int pthread_setspecific(pthread_key_t ,
-         const void *);
+int pthread_setspecific(pthread_key_t, const void *);
+
+typedef long long __int64_t;
+typedef __int64_t __darwin_off_t;
+typedef __darwin_off_t fpos_t;
+
+void setbuf(FILE * restrict, char * restrict);
+int setvbuf(FILE * restrict, char * restrict, int, size_t);
+
+FILE *funopen(const void *,
+                 int (*)(void *, char *, int),
+                 int (*)(void *, const char *, int),
+                 fpos_t (*)(void *, fpos_t, int),
+                 int (*)(void *));
+

Modified: cfe/branches/tooling/test/Analysis/unreachable-code-path.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/unreachable-code-path.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/unreachable-code-path.c (original)
+++ cfe/branches/tooling/test/Analysis/unreachable-code-path.c Tue Mar  6 07:07:43 2012
@@ -122,3 +122,20 @@
   goto d;
   f: ;
 }
+
+// test11: we can actually end up in the default case, even if it is not
+// obvious: there might be something wrong with the given argument.
+enum foobar { FOO, BAR };
+extern void error();
+void test11(enum foobar fb) {
+  switch (fb) {
+    case FOO:
+      break;
+    case BAR:
+      break;
+    default:
+      error(); // no-warning
+      return;
+      error(); // expected-warning {{never executed}}
+  }
+}

Modified: cfe/branches/tooling/test/CXX/dcl.dcl/p4-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/dcl.dcl/p4-0x.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/dcl.dcl/p4-0x.cpp (original)
+++ cfe/branches/tooling/test/CXX/dcl.dcl/p4-0x.cpp Tue Mar  6 07:07:43 2012
@@ -17,3 +17,5 @@
 static_assert(S(false), "not so fast"); // expected-error {{not so fast}}
 static_assert(T(), "");
 static_assert(U(), ""); // expected-error {{ambiguous}}
+
+static_assert(false, L"\x14hi" "!" R"x(")x"); // expected-error {{static_assert failed L"\024hi!\""}}

Modified: cfe/branches/tooling/test/CXX/expr/expr.ass/p9-cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/expr/expr.ass/p9-cxx11.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/expr/expr.ass/p9-cxx11.cpp (original)
+++ cfe/branches/tooling/test/CXX/expr/expr.ass/p9-cxx11.cpp Tue Mar  6 07:07:43 2012
@@ -13,7 +13,10 @@
 
   int a, b;
   a = b = { 1 };
-  a = { 1 } = b;
+  a = { 1 } = b; // expected-error {{initializer list cannot be used on the left hand side of operator '='}}
+  a = a + { 4 }; // expected-error {{initializer list cannot be used on the right hand side of operator '+'}}
+  a = { 3 } * { 4 }; // expected-error {{initializer list cannot be used on the left hand side of operator '*'}} \
+                        expected-error {{initializer list cannot be used on the right hand side of operator '*'}}
 }
 
 struct S {
@@ -27,5 +30,5 @@
 static_assert((T() = {4, 9}) == 4, "");
 static_assert((T() += {4, 9}) == 9, "");
 
-int k1 = T() = { 1, 2 } = { 3, 4 }; // expected-error {{expected ';'}}
-int k2 = T() = { 1, 2 } + 1; // expected-error {{expected ';'}}
+int k1 = T() = { 1, 2 } = { 3, 4 }; // expected-error {{initializer list cannot be used on the left hand side of operator '='}}
+int k2 = T() = { 1, 2 } + 1; // expected-error {{initializer list cannot be used on the left hand side of operator '+'}}

Modified: cfe/branches/tooling/test/CXX/expr/expr.const/p2-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/expr/expr.const/p2-0x.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/expr/expr.const/p2-0x.cpp (original)
+++ cfe/branches/tooling/test/CXX/expr/expr.const/p2-0x.cpp Tue Mar  6 07:07:43 2012
@@ -362,8 +362,8 @@
   constexpr int e = 42;
   int &f = const_cast<int&>(e);
   extern int &g;
-  constexpr int &h(); // expected-note 2{{here}}
-  int &i = h(); // expected-note {{here}} expected-note {{undefined function 'h' cannot be used in a constant expression}}
+  constexpr int &h(); // expected-note {{here}}
+  int &i = h(); // expected-note {{here}}
   constexpr int &j() { return b; }
   int &k = j();
 

Modified: cfe/branches/tooling/test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp (original)
+++ cfe/branches/tooling/test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp Tue Mar  6 07:07:43 2012
@@ -52,9 +52,8 @@
   auto m1 = [=]{
     int const M = 30;
     auto m2 = [i]{
-      // FIXME: We odr-use here, but we shouldn't.
-      //      int x[N][M];
-      //      x[0][0] = i;
+      int x[N][M];
+      x[0][0] = i;
     }; 
     (void)N;
     (void)M;

Modified: cfe/branches/tooling/test/CXX/lex/lex.literal/lex.ext/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/lex/lex.literal/lex.ext/p1.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/lex/lex.literal/lex.ext/p1.cpp (original)
+++ cfe/branches/tooling/test/CXX/lex/lex.literal/lex.ext/p1.cpp Tue Mar  6 07:07:43 2012
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
 
-int * operator "" p31(long double); // expected-warning{{user-defined literal with suffix 'p31' is preempted by C99 hexfloat extension}}
-long double operator "" _p31(long double);
+void operator "" p31(long double); // expected-warning{{user-defined literal with suffix 'p31' is preempted by C99 hexfloat extension}}
+void operator "" _p31(long double);
 long double operator "" pi(long double); // expected-warning{{user-defined literals not starting with '_' are reserved by the implementation}}
 
 float hexfloat = 0x1p31; // allow hexfloats

Modified: cfe/branches/tooling/test/CXX/special/class.copy/p11.0x.copy.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/special/class.copy/p11.0x.copy.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/special/class.copy/p11.0x.copy.cpp (original)
+++ cfe/branches/tooling/test/CXX/special/class.copy/p11.0x.copy.cpp Tue Mar  6 07:07:43 2012
@@ -4,6 +4,9 @@
   NonTrivial(const NonTrivial&);
 };
 
+// A defaulted copy constructor for a class X is defined as deleted if X has:
+
+// -- a variant member with a non-trivial corresponding constructor
 union DeletedNTVariant { // expected-note{{here}}
   NonTrivial NT;
   DeletedNTVariant();
@@ -20,6 +23,9 @@
 DeletedNTVariant2 DV2a;
 DeletedNTVariant2 DV2b(DV2a); // expected-error{{call to implicitly-deleted copy constructor}}
 
+// -- a non-static data member of class type M (or array thereof) that cannot be
+//    copied because overload resolution results in an ambiguity or a function
+//    that is deleted or inaccessible
 struct NoAccess {
   NoAccess() = default;
 private:
@@ -63,6 +69,25 @@
 Deleted Da;
 Deleted Db(Da); // expected-error{{call to implicitly-deleted copy constructor}}
 
+// -- a direct or virtual base class B that cannot be copied because overload
+//    resolution results in an ambiguity or a function that is deleted or
+//    inaccessible
+struct AmbiguousCopyBase : Ambiguity { // expected-note {{here}}
+  NonConst NC;
+};
+extern AmbiguousCopyBase ACBa;
+AmbiguousCopyBase ACBb(ACBa); // expected-error {{deleted copy constructor}}
+
+struct DeletedCopyBase : AmbiguousCopyBase {}; // expected-note {{here}}
+extern DeletedCopyBase DCBa;
+DeletedCopyBase DCBb(DCBa); // expected-error {{deleted copy constructor}}
+
+struct InaccessibleCopyBase : NoAccess {}; // expected-note {{here}}
+extern InaccessibleCopyBase ICBa;
+InaccessibleCopyBase ICBb(ICBa); // expected-error {{deleted copy constructor}}
+
+// -- any direct or virtual base class or non-static data member of a type with
+//    a destructor that is deleted or inaccessible
 struct NoAccessDtor {
 private:
   ~NoAccessDtor();
@@ -83,6 +108,12 @@
 HasAccessDtor HADa;
 HasAccessDtor HADb(HADa);
 
+struct HasNoAccessDtorBase : NoAccessDtor { // expected-note{{here}}
+};
+extern HasNoAccessDtorBase HNADBa;
+HasNoAccessDtorBase HNADBb(HNADBa); // expected-error{{implicitly-deleted copy constructor}}
+
+// -- a non-static data member of rvalue reference type
 struct RValue { // expected-note{{here}}
   int && ri = 1;
 };

Modified: cfe/branches/tooling/test/CXX/special/class.copy/p11.0x.move.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/special/class.copy/p11.0x.move.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/special/class.copy/p11.0x.move.cpp (original)
+++ cfe/branches/tooling/test/CXX/special/class.copy/p11.0x.move.cpp Tue Mar  6 07:07:43 2012
@@ -4,6 +4,9 @@
   NonTrivial(NonTrivial&&);
 };
 
+// A defaulted move constructor for a class X is defined as deleted if X has:
+
+// -- a variant member with a non-trivial corresponding constructor
 union DeletedNTVariant {
   NonTrivial NT;
   DeletedNTVariant(DeletedNTVariant&&);
@@ -18,6 +21,9 @@
 };
 DeletedNTVariant2::DeletedNTVariant2(DeletedNTVariant2&&) = default; // expected-error{{would delete}}
 
+// -- a non-static data member of class type M (or array thereof) that cannot be
+//    copied because overload resolution results in an ambiguity or a function
+//    that is deleted or inaccessible
 struct NoAccess {
   NoAccess() = default;
 private:
@@ -38,6 +44,43 @@
 };
 HasAccess::HasAccess(HasAccess&&) = default;
 
+struct Ambiguity {
+  Ambiguity(const Ambiguity&&);
+  Ambiguity(volatile Ambiguity&&);
+};
+
+struct IsAmbiguous {
+  Ambiguity A;
+  IsAmbiguous(IsAmbiguous&&);
+};
+IsAmbiguous::IsAmbiguous(IsAmbiguous&&) = default; // expected-error{{would delete}}
+
+struct Deleted {
+  IsAmbiguous IA;
+  Deleted(Deleted&&);
+};
+Deleted::Deleted(Deleted&&) = default; // expected-error{{would delete}}
+
+// -- a direct or virtual base class B that cannot be moved because overload
+//    resolution results in an ambiguity or a function that is deleted or
+//    inaccessible
+struct AmbiguousMoveBase : Ambiguity {
+  AmbiguousMoveBase(AmbiguousMoveBase&&);
+};
+AmbiguousMoveBase::AmbiguousMoveBase(AmbiguousMoveBase&&) = default; // expected-error{{would delete}}
+
+struct DeletedMoveBase : AmbiguousMoveBase {
+  DeletedMoveBase(DeletedMoveBase&&);
+};
+DeletedMoveBase::DeletedMoveBase(DeletedMoveBase&&) = default; // expected-error{{would delete}}
+
+struct InaccessibleMoveBase : NoAccess {
+  InaccessibleMoveBase(InaccessibleMoveBase&&);
+};
+InaccessibleMoveBase::InaccessibleMoveBase(InaccessibleMoveBase&&) = default; // expected-error{{would delete}}
+
+// -- any direct or virtual base class or non-static data member of a type with
+//    a destructor that is deleted or inaccessible
 struct NoAccessDtor {
   NoAccessDtor(NoAccessDtor&&);
 private:
@@ -57,12 +100,21 @@
 };
 HasAccessDtor::HasAccessDtor(HasAccessDtor&&) = default;
 
+struct HasNoAccessDtorBase : NoAccessDtor { // expected-note{{here}}
+};
+extern HasNoAccessDtorBase HNADBa;
+HasNoAccessDtorBase HNADBb(HNADBa); // expected-error{{implicitly-deleted copy constructor}}
+
+// The restriction on rvalue reference members applies to only the copy
+// constructor.
 struct RValue {
   int &&ri = 1;
   RValue(RValue&&);
 };
 RValue::RValue(RValue&&) = default;
 
+// -- a non-static data member or direct or virtual base class with a type that
+//    does not have a move constructor and is not trivially copyable
 struct CopyOnly {
   CopyOnly(const CopyOnly&);
 };

Modified: cfe/branches/tooling/test/CodeGen/builtin-memfns.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGen/builtin-memfns.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGen/builtin-memfns.c (original)
+++ cfe/branches/tooling/test/CodeGen/builtin-memfns.c Tue Mar  6 07:07:43 2012
@@ -48,3 +48,18 @@
 int test6(char *X) {
   return __builtin___memcpy_chk(X, X, 42, 42) != 0;
 }
+
+// CHECK: @test7
+// PR12094
+int test7(int *p) {
+  struct snd_pcm_hw_params_t* hwparams;  // incomplete type.
+  
+  // CHECK: call void @llvm.memset{{.*}}256, i32 4, i1 false)
+  __builtin_memset(p, 0, 256);  // Should be alignment = 4
+
+  // CHECK: call void @llvm.memset{{.*}}256, i32 1, i1 false)
+  __builtin_memset((char*)p, 0, 256);  // Should be alignment = 1
+
+  __builtin_memset(hwparams, 0, 256);  // No crash alignment = 1
+  // CHECK: call void @llvm.memset{{.*}}256, i32 1, i1 false)
+}

Modified: cfe/branches/tooling/test/CodeGenCXX/const-init-cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCXX/const-init-cxx11.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCXX/const-init-cxx11.cpp (original)
+++ cfe/branches/tooling/test/CodeGenCXX/const-init-cxx11.cpp Tue Mar  6 07:07:43 2012
@@ -337,3 +337,75 @@
   X<D> x;
   // CHECK: call {{.*}}@_ZN11VirtualBase1XINS_1DEEC1Ev
 }
+
+// PR12145
+namespace Unreferenced {
+  int n;
+  constexpr int *p = &n;
+  // We must not emit a load of 'p' here, since it's not odr-used.
+  int q = *p;
+  // CHECK-NOT: _ZN12Unreferenced1pE
+  // CHECK: = load i32* @_ZN12Unreferenced1nE
+  // CHECK-NEXT: store i32 {{.*}}, i32* @_ZN12Unreferenced1qE
+  // CHECK-NOT: _ZN12Unreferenced1pE
+
+  // Technically, we are not required to substitute variables of reference types
+  // initialized by constant expressions, because the special case for odr-use
+  // of variables in [basic.def.odr]p2 only applies to objects. But we do so
+  // anyway.
+
+  constexpr int &r = n;
+  // CHECK-NOT: _ZN12Unreferenced1rE
+  int s = r;
+
+  const int t = 1;
+  const int &rt = t;
+  int f(int);
+  int u = f(rt);
+  // CHECK: call i32 @_ZN12Unreferenced1fEi(i32 1)
+}
+
+namespace InitFromConst {
+  template<typename T> void consume(T);
+
+  const bool b = true;
+  const int n = 5;
+  const double d = 4.3;
+
+  struct S { int n = 7; S *p = 0; };
+  constexpr S s = S();
+  const S &r = s;
+  constexpr const S *p = &r;
+  constexpr int S::*mp = &S::n;
+  constexpr int a[3] = { 1, 4, 9 };
+
+  void test() {
+    // CHECK: call void @_ZN13InitFromConst7consumeIbEEvT_(i1 zeroext true)
+    consume(b);
+
+    // CHECK: call void @_ZN13InitFromConst7consumeIiEEvT_(i32 5)
+    consume(n);
+
+    // CHECK: call void @_ZN13InitFromConst7consumeIdEEvT_(double 4.300000e+00)
+    consume(d);
+
+    // CHECK: call void @_ZN13InitFromConst7consumeIRKNS_1SEEEvT_(%"struct.InitFromConst::S"* @_ZN13InitFromConstL1sE)
+    consume<const S&>(s);
+
+    // FIXME CHECK-NOT: call void @_ZN13InitFromConst7consumeIRKNS_1SEEEvT_(%"struct.InitFromConst::S"* @_ZN13InitFromConstL1sE)
+    // There's no lvalue-to-rvalue conversion here, so 'r' is odr-used, and
+    // we're permitted to emit a load of it. This seems likely to be a defect
+    // in the standard. If we start emitting a direct reference to 's', update
+    // this test.
+    consume<const S&>(r);
+
+    // CHECK: call void @_ZN13InitFromConst7consumeIPKNS_1SEEEvT_(%"struct.InitFromConst::S"* @_ZN13InitFromConstL1sE)
+    consume(p);
+
+    // CHECK: call void @_ZN13InitFromConst7consumeIMNS_1SEiEEvT_(i64 0)
+    consume(mp);
+
+    // CHECK: call void @_ZN13InitFromConst7consumeIPKiEEvT_(i32* getelementptr inbounds ([3 x i32]* @_ZN13InitFromConstL1aE, i32 0, i32 0))
+    consume(a);
+  }
+}

Modified: cfe/branches/tooling/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp (original)
+++ cfe/branches/tooling/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp Tue Mar  6 07:07:43 2012
@@ -232,3 +232,21 @@
   destroyme2 dm2;
   // CHECK: call void @_ZN10destroyme2D1Ev
 }
+
+namespace PR12178 {
+  struct string {
+    string(int);
+    ~string();
+  };
+
+  struct pair {
+    string a;
+    int b;
+  };
+
+  struct map {
+    map(std::initializer_list<pair>);
+  };
+
+  map m{ {1, 2}, {3, 4} };
+}

Modified: cfe/branches/tooling/test/CodeGenCXX/debug-info-pubtypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCXX/debug-info-pubtypes.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCXX/debug-info-pubtypes.cpp (original)
+++ cfe/branches/tooling/test/CodeGenCXX/debug-info-pubtypes.cpp Tue Mar  6 07:07:43 2012
@@ -2,6 +2,8 @@
 // RUN: %clang -cc1 -triple x86_64-apple-darwin10  -g -fno-limit-debug-info -S %s -o %t
 // RUN: FileCheck %s < %t
 
+// FIXME: This testcase shouldn't rely on assembly emission.
+//CHECK: Lpubtypes_begin1:
 //CHECK:         .asciz   "G"
 //CHECK-NEXT:    .long   0
 //CHECK-NEXT: Lpubtypes_end1:

Modified: cfe/branches/tooling/test/CodeGenObjCXX/lambda-expressions.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenObjCXX/lambda-expressions.mm?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenObjCXX/lambda-expressions.mm (original)
+++ cfe/branches/tooling/test/CodeGenObjCXX/lambda-expressions.mm Tue Mar  6 07:07:43 2012
@@ -4,6 +4,9 @@
 typedef int (^fp)();
 fp f() { auto x = []{ return 3; }; return x; }
 
+// MRC: @"\01L_OBJC_METH_VAR_NAME{{.*}}" = internal global [5 x i8] c"copy\00"
+// MRC: @"\01L_OBJC_METH_VAR_NAME{{.*}}" = internal global [12 x i8] c"autorelease\00"
+// MRC: define i32 ()* @_Z1fv(
 // MRC: define internal i32 ()* @"_ZZ1fvENK3$_0cvU13block_pointerFivEEv"
 // MRC: store i8* bitcast (i8** @_NSConcreteStackBlock to i8*)
 // MRC: store i8* bitcast (i32 (i8*)* @"___ZZ1fvENK3$_0cvU13block_pointerFivEEv_block_invoke_0" to i8*)
@@ -11,8 +14,26 @@
 // MRC: call i32 ()* (i8*, i8*)* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 ()* (i8*, i8*)*)
 // MRC: ret i32 ()*
 
+// ARC: define i32 ()* @_Z1fv(
 // ARC: define internal i32 ()* @"_ZZ1fvENK3$_0cvU13block_pointerFivEEv"
 // ARC: store i8* bitcast (i8** @_NSConcreteStackBlock to i8*)
 // ARC: store i8* bitcast (i32 (i8*)* @"___ZZ1fvENK3$_0cvU13block_pointerFivEEv_block_invoke_0" to i8*)
 // ARC: call i8* @objc_retainBlock
 // ARC: call i8* @objc_autoreleaseReturnValue
+
+typedef int (^fp)();
+fp global;
+void f2() { global = []{ return 3; }; }
+
+// MRC: define void @_Z2f2v() nounwind {
+// MRC: store i8* bitcast (i32 (i8*)* @__f2_block_invoke_0 to i8*),
+// MRC-NOT: call
+// MRC: ret void
+// ("global" contains a dangling pointer after this function runs.)
+
+// ARC: define void @_Z2f2v() nounwind {
+// ARC: store i8* bitcast (i32 (i8*)* @__f2_block_invoke_0 to i8*),
+// ARC: call i8* @objc_retainBlock
+// ARC: call void @objc_release
+// ARC: define internal i32 @__f2_block_invoke_0
+// ARC: call i32 @"_ZZ2f2vENK3$_1clEv

Modified: cfe/branches/tooling/test/Driver/arc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Driver/arc.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Driver/arc.c (original)
+++ cfe/branches/tooling/test/Driver/arc.c Tue Mar  6 07:07:43 2012
@@ -1,8 +1,9 @@
-// RUN: %clang -ObjC -target i386-apple-darwin9 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -x objective-c -target i386-apple-darwin9 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -x objective-c++ -target i386-apple-darwin9 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -x c -target i386-apple-darwin9 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix NOTOBJC %s
-// RUN: %clang -x c++ -target i386-apple-darwin9 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix NOTOBJC %s
+// RUN: %clang -ObjC -target i386-apple-darwin10 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -x objective-c -target i386-apple-darwin10 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -x objective-c++ -target i386-apple-darwin10 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -x c -target i386-apple-darwin10 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix NOTOBJC %s
+// RUN: %clang -x c++ -target i386-apple-darwin10 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix NOTOBJC %s
+// RUN: %clang -x objective-c -target x86_64-apple-darwin11 -mmacosx-version-min=10.5 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix UNSUPPORTED %s
 
 // Just to test clang is working.
 # foo
@@ -12,3 +13,5 @@
 
 // NOTOBJC-NOT: error: -fobjc-arc is not supported with fragile abi
 // NOTOBJC: invalid preprocessing directive
+
+// UNSUPPORTED: error: -fobjc-arc is not supported on current deployment target

Modified: cfe/branches/tooling/test/Index/complete-modules.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Index/complete-modules.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Index/complete-modules.m (original)
+++ cfe/branches/tooling/test/Index/complete-modules.m Tue Mar  6 07:07:43 2012
@@ -1,14 +1,14 @@
 // Note: the run lines follow their respective tests, since line/column
 // matter in this test.
 
- at import LibA.Extensions;
+ at __experimental_modules_import LibA.Extensions;
 
 // RUN: rm -rf %t
-// RUN: c-index-test -code-completion-at=%s:4:9 -fmodule-cache-path %t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-TOP-LEVEL %s
+// RUN: c-index-test -code-completion-at=%s:4:32 -fmodule-cache-path %t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-TOP-LEVEL %s
 // CHECK-TOP-LEVEL: NotImplemented:{TypedText Framework} (50)
 // CHECK-TOP-LEVEL: NotImplemented:{TypedText LibA} (50)
 // CHECK-TOP-LEVEL: NotImplemented:{TypedText nested} (50)
 
-// RUN: c-index-test -code-completion-at=%s:4:14 -fmodule-cache-path %t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-LIBA %s
+// RUN: c-index-test -code-completion-at=%s:4:37 -fmodule-cache-path %t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-LIBA %s
 // CHECK-LIBA: NotImplemented:{TypedText Extensions} (50)
 

Modified: cfe/branches/tooling/test/Index/crash-recovery-modules.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Index/crash-recovery-modules.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Index/crash-recovery-modules.m (original)
+++ cfe/branches/tooling/test/Index/crash-recovery-modules.m Tue Mar  6 07:07:43 2012
@@ -4,7 +4,7 @@
 // Parse the file, such that building the module will cause Clang to crash.
 // RUN: not env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodule-cache-path %t -Xclang -fdisable-module-hash -I %S/Inputs/Headers -DCRASH %s 2> %t.err
 // RUN: FileCheck < %t.err -check-prefix=CHECK-CRASH %s
-// CHECK-CRASH: crash-recovery-modules.m:16:9:{16:2-16:14}: fatal error: could not build module 'Crash'
+// CHECK-CRASH: crash-recovery-modules.m:16:32:{16:2-16:37}: fatal error: could not build module 'Crash'
 
 // Parse the file again, without crashing, to make sure that
 // subsequent parses do the right thing.
@@ -13,7 +13,7 @@
 // REQUIRES: crash-recovery
 // REQUIRES: shell
 
- at import Crash;
+ at __experimental_modules_import Crash;
 
 void test() {
   const char* error = getCrashString();

Removed: cfe/branches/tooling/test/Lexer/has_attribute.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Lexer/has_attribute.cpp?rev=152117&view=auto
==============================================================================
--- cfe/branches/tooling/test/Lexer/has_attribute.cpp (original)
+++ cfe/branches/tooling/test/Lexer/has_attribute.cpp (removed)
@@ -1,12 +0,0 @@
-// RUN: %clang_cc1 -E %s -o - | FileCheck %s
-
-// CHECK: always_inline
-#if __has_attribute(always_inline)
-int always_inline();
-#endif
-
-// CHECK: no_dummy_attribute
-#if !__has_attribute(dummy_attribute)
-int no_dummy_attribute();
-#endif
-

Modified: cfe/branches/tooling/test/Lexer/has_feature_cxx0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Lexer/has_feature_cxx0x.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Lexer/has_feature_cxx0x.cpp (original)
+++ cfe/branches/tooling/test/Lexer/has_feature_cxx0x.cpp Tue Mar  6 07:07:43 2012
@@ -235,3 +235,12 @@
 
 // CHECK-0X: has_generalized_initializers
 // CHECK-NO-0X: no_generalized_initializers
+
+#if __has_feature(cxx_unrestricted_unions)
+int has_unrestricted_unions();
+#else
+int no_unrestricted_unions();
+#endif
+
+// CHECK-0X: has_unrestricted_unions
+// CHECK-NO-0X: no_unrestricted_unions

Modified: cfe/branches/tooling/test/Misc/serialized-diags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Misc/serialized-diags.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Misc/serialized-diags.c (original)
+++ cfe/branches/tooling/test/Misc/serialized-diags.c Tue Mar  6 07:07:43 2012
@@ -52,7 +52,7 @@
 // CHECK: +-Range: {{.*[/\\]}}serialized-diags.c:22:3 {{.*[/\\]}}serialized-diags.c:22:6
 // CHECK: +-Range: {{.*[/\\]}}serialized-diags.c:20:15 {{.*[/\\]}}serialized-diags.c:20:16
 // CHECK: +-{{.*[/\\]}}serialized-diags.c:19:1: note: 'taz' declared here []
-// CHECK: {{.*[/\\]}}serialized-diags.h:5:7: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int';  []
+// CHECK: {{.*[/\\]}}serialized-diags.h:5:7: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int';  [-Wint-conversions]
 // CHECK: Range: {{.*[/\\]}}serialized-diags.h:5:16 {{.*[/\\]}}serialized-diags.h:5:17
 // CHECK: +-{{.*[/\\]}}serialized-diags.c:26:10: note: in file included from {{.*[/\\]}}serialized-diags.c:26: []
 // CHECK: Number of diagnostics: 5

Modified: cfe/branches/tooling/test/Misc/warning-flags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Misc/warning-flags.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Misc/warning-flags.c (original)
+++ cfe/branches/tooling/test/Misc/warning-flags.c Tue Mar  6 07:07:43 2012
@@ -17,7 +17,7 @@
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (257):
+CHECK: Warnings without flags (254):
 CHECK-NEXT:   ext_anonymous_struct_union_qualified
 CHECK-NEXT:   ext_binary_literal
 CHECK-NEXT:   ext_cast_fn_obj
@@ -77,8 +77,6 @@
 CHECK-NEXT:   ext_typecheck_cond_incompatible_operands
 CHECK-NEXT:   ext_typecheck_cond_incompatible_operands_nonstandard
 CHECK-NEXT:   ext_typecheck_cond_one_void
-CHECK-NEXT:   ext_typecheck_convert_int_pointer
-CHECK-NEXT:   ext_typecheck_convert_pointer_int
 CHECK-NEXT:   ext_typecheck_convert_pointer_void_func
 CHECK-NEXT:   ext_typecheck_ordered_comparison_of_function_pointers
 CHECK-NEXT:   ext_typecheck_ordered_comparison_of_pointer_and_zero
@@ -137,7 +135,6 @@
 CHECK-NEXT:   warn_conv_to_self_not_used
 CHECK-NEXT:   warn_conv_to_void_not_used
 CHECK-NEXT:   warn_cxx0x_right_shift_in_template_arg
-CHECK-NEXT:   warn_decl_in_param_list
 CHECK-NEXT:   warn_delete_array_type
 CHECK-NEXT:   warn_division_by_zero
 CHECK-NEXT:   warn_double_const_requires_fp64

Modified: cfe/branches/tooling/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h Tue Mar  6 07:07:43 2012
@@ -1,3 +1,3 @@
 
- at import MutuallyRecursive2;
+ at __experimental_modules_import MutuallyRecursive2;
 

Modified: cfe/branches/tooling/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h Tue Mar  6 07:07:43 2012
@@ -1,6 +1,6 @@
 
 
- at import MutuallyRecursive1;
+ at __experimental_modules_import MutuallyRecursive1;
 
 
 

Modified: cfe/branches/tooling/test/Modules/Inputs/category_bottom.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/category_bottom.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/category_bottom.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/category_bottom.h Tue Mar  6 07:07:43 2012
@@ -1,10 +1,10 @@
- at import category_left;
+ at __experimental_modules_import category_left;
 
 @interface Foo(Bottom)
 -(void)bottom;
 @end
 
- at import category_right;
+ at __experimental_modules_import category_right;
 
 @interface LeftFoo(Bottom)
 -(void)bottom;

Modified: cfe/branches/tooling/test/Modules/Inputs/category_left.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/category_left.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/category_left.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/category_left.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import category_top;
+ at __experimental_modules_import category_top;
 
 @interface Foo(Left)
 -(void)left;

Modified: cfe/branches/tooling/test/Modules/Inputs/category_other.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/category_other.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/category_other.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/category_other.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import category_top;
+ at __experimental_modules_import category_top;
 
 @interface Foo(Other)
 -(void)other;

Modified: cfe/branches/tooling/test/Modules/Inputs/category_right.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/category_right.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/category_right.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/category_right.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import category_top;
+ at __experimental_modules_import category_top;
 
 @interface Foo(Right1)
 -(void)right1;

Modified: cfe/branches/tooling/test/Modules/Inputs/diamond.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/diamond.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/diamond.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/diamond.h Tue Mar  6 07:07:43 2012
@@ -1 +1 @@
- at import diamond_bottom;
+ at __experimental_modules_import diamond_bottom;

Modified: cfe/branches/tooling/test/Modules/Inputs/diamond_bottom.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/diamond_bottom.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/diamond_bottom.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/diamond_bottom.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import diamond_left;
- at import diamond_right;
+ at __experimental_modules_import diamond_left;
+ at __experimental_modules_import diamond_right;
 
 char bottom(char *x);

Modified: cfe/branches/tooling/test/Modules/Inputs/diamond_left.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/diamond_left.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/diamond_left.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/diamond_left.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import diamond_top;
+ at __experimental_modules_import diamond_top;
 
 float left(float *);
 

Modified: cfe/branches/tooling/test/Modules/Inputs/diamond_right.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/diamond_right.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/diamond_right.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/diamond_right.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import diamond_top;
+ at __experimental_modules_import diamond_top;
 
 double right(double *);
 

Modified: cfe/branches/tooling/test/Modules/Inputs/namespaces-left.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/namespaces-left.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/namespaces-left.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/namespaces-left.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import namespaces_top;
+ at __experimental_modules_import namespaces_top;
 
 namespace N1 { }
 

Modified: cfe/branches/tooling/test/Modules/Inputs/namespaces-right.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/namespaces-right.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/namespaces-right.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/namespaces-right.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import namespaces_top;
+ at __experimental_modules_import namespaces_top;
 
 namespace N2 { }
 

Modified: cfe/branches/tooling/test/Modules/Inputs/redecl-merge-bottom.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/redecl-merge-bottom.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/redecl-merge-bottom.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/redecl-merge-bottom.h Tue Mar  6 07:07:43 2012
@@ -1,11 +1,11 @@
- at import redecl_merge_left;
+ at __experimental_modules_import redecl_merge_left;
 
 @class C4;
 @class C4;
 @protocol P4;
 @protocol P4;
 @protocol P4;
- at import redecl_merge_right;
+ at __experimental_modules_import redecl_merge_right;
 
 @class B;
 

Modified: cfe/branches/tooling/test/Modules/Inputs/redecl-merge-left-left.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/redecl-merge-left-left.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/redecl-merge-left-left.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/redecl-merge-left-left.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import redecl_merge_left;
+ at __experimental_modules_import redecl_merge_left;
 
 @class C4;
 void accept_a_C4(C4*);

Modified: cfe/branches/tooling/test/Modules/Inputs/redecl-merge-left.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/redecl-merge-left.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/redecl-merge-left.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/redecl-merge-left.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import redecl_merge_top;
+ at __experimental_modules_import redecl_merge_top;
 
 @class A;
 

Modified: cfe/branches/tooling/test/Modules/Inputs/redecl-merge-right.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/redecl-merge-right.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/redecl-merge-right.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/redecl-merge-right.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import redecl_merge_top;
+ at __experimental_modules_import redecl_merge_top;
 
 @interface Super
 @end
@@ -86,7 +86,7 @@
 #endif
 
 int ONE;
- at import redecl_merge_top.Explicit;
+ at __experimental_modules_import redecl_merge_top.Explicit;
 const int one = ONE;
 
 @interface ClassWithDef 

Modified: cfe/branches/tooling/test/Modules/Inputs/wildcard-submodule-exports/C_one.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/wildcard-submodule-exports/C_one.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/wildcard-submodule-exports/C_one.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/wildcard-submodule-exports/C_one.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import A.One;
- at import B.One;
+ at __experimental_modules_import A.One;
+ at __experimental_modules_import B.One;
 
 long *C1;

Modified: cfe/branches/tooling/test/Modules/Inputs/wildcard-submodule-exports/C_two.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/Inputs/wildcard-submodule-exports/C_two.h?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/Inputs/wildcard-submodule-exports/C_two.h (original)
+++ cfe/branches/tooling/test/Modules/Inputs/wildcard-submodule-exports/C_two.h Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
- at import A.Two;
- at import B.Two;
+ at __experimental_modules_import A.Two;
+ at __experimental_modules_import B.Two;
 
 unsigned long *C2;

Modified: cfe/branches/tooling/test/Modules/compiler_builtins.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/compiler_builtins.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/compiler_builtins.m (original)
+++ cfe/branches/tooling/test/Modules/compiler_builtins.m Tue Mar  6 07:07:43 2012
@@ -2,9 +2,9 @@
 // RUN: %clang -fsyntax-only -fmodules -fmodule-cache-path %t -D__need_wint_t %s -Xclang -verify
 
 #ifdef __SSE__
- at import _Builtin_intrinsics.intel.sse;
+ at __experimental_modules_import _Builtin_intrinsics.intel.sse;
 #endif
 
 #ifdef __AVX2__
- at import _Builtin_intrinsics.intel.avx2;
+ at __experimental_modules_import _Builtin_intrinsics.intel.avx2;
 #endif

Modified: cfe/branches/tooling/test/Modules/cstd.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/cstd.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/cstd.m (original)
+++ cfe/branches/tooling/test/Modules/cstd.m Tue Mar  6 07:07:43 2012
@@ -2,24 +2,24 @@
 // RUN: %clang -fsyntax-only -isystem %S/Inputs/System/usr/include -fmodules -fmodule-cache-path %t -D__need_wint_t -Werror=implicit-function-declaration %s
 
 // Supplied by compiler, but referenced from the "/usr/include" module map.
- at import cstd.float_constants;
+ at __experimental_modules_import cstd.float_constants;
 
 float getFltMax() { return FLT_MAX; }
 
 // Supplied by the "/usr/include" module map.
- at import cstd.stdio;
+ at __experimental_modules_import cstd.stdio;
 
 void test_fprintf(FILE *file) {
   fprintf(file, "Hello, modules\n");
 }
 
 // Supplied by compiler, which forwards to the the "/usr/include" version.
- at import cstd.stdint;
+ at __experimental_modules_import cstd.stdint;
 
 my_awesome_nonstandard_integer_type value;
 
 // Supplied by the compiler; that version wins.
- at import cstd.stdbool;
+ at __experimental_modules_import cstd.stdbool;
 
 #ifndef bool
 #  error "bool was not defined!"

Modified: cfe/branches/tooling/test/Modules/cycles.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/cycles.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/cycles.c (original)
+++ cfe/branches/tooling/test/Modules/cycles.c Tue Mar  6 07:07:43 2012
@@ -1,12 +1,12 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -F %S/Inputs %s 2>&1 | FileCheck %s
 // FIXME: When we have a syntax for modules in C, use that.
- at import MutuallyRecursive1;
+ at __experimental_modules_import MutuallyRecursive1;
 
 // FIXME: Lots of redundant diagnostics here, because the preprocessor
 // can't currently tell the parser not to try to load the module again.
 
-// CHECK: MutuallyRecursive2.h:3:9: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1
-// CHECK: MutuallyRecursive1.h:2:9: fatal error: could not build module 'MutuallyRecursive2'
-// CHECK: cycles.c:4:9: fatal error: could not build module 'MutuallyRecursive1'
+// CHECK: MutuallyRecursive2.h:3:32: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1
+// CHECK: MutuallyRecursive1.h:2:32: fatal error: could not build module 'MutuallyRecursive2'
+// CHECK: cycles.c:4:32: fatal error: could not build module 'MutuallyRecursive1'
 

Modified: cfe/branches/tooling/test/Modules/decldef.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/decldef.mm?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/decldef.mm (original)
+++ cfe/branches/tooling/test/Modules/decldef.mm Tue Mar  6 07:07:43 2012
@@ -10,10 +10,10 @@
 
 // in other file: expected-note{{previous definition is here}}
 
- at import decldef;
+ at __experimental_modules_import decldef;
 A *a1; // expected-error{{unknown type name 'A'}}
 B *b1; // expected-error{{unknown type name 'B'}}
- at import decldef.Decl;
+ at __experimental_modules_import decldef.Decl;
 
 A *a2;
 B *b;

Modified: cfe/branches/tooling/test/Modules/diamond.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/diamond.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/diamond.c (original)
+++ cfe/branches/tooling/test/Modules/diamond.c Tue Mar  6 07:07:43 2012
@@ -3,7 +3,7 @@
 
 // in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}}
 
- at import diamond_bottom;
+ at __experimental_modules_import diamond_bottom;
 
 void test_diamond(int i, float f, double d, char c) {
   top(&i);

Modified: cfe/branches/tooling/test/Modules/header-import.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/header-import.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/header-import.m (original)
+++ cfe/branches/tooling/test/Modules/header-import.m Tue Mar  6 07:07:43 2012
@@ -2,6 +2,6 @@
 // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s
 
 #import "point.h"
- at import Module;
+ at __experimental_modules_import Module;
 #import "point.h"
 

Modified: cfe/branches/tooling/test/Modules/inferred-submodules.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/inferred-submodules.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/inferred-submodules.m (original)
+++ cfe/branches/tooling/test/Modules/inferred-submodules.m Tue Mar  6 07:07:43 2012
@@ -1,13 +1,13 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -x objective-c -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify
 
- at import Module.Sub;
+ at __experimental_modules_import Module.Sub;
 
 void test_Module_Sub() {
   int *ip = Module_Sub;
 }
 
- at import Module.Buried.Treasure;
+ at __experimental_modules_import Module.Buried.Treasure;
 
 void dig() {
   unsigned *up = Buried_Treasure;

Modified: cfe/branches/tooling/test/Modules/irgen.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/irgen.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/irgen.c (original)
+++ cfe/branches/tooling/test/Modules/irgen.c Tue Mar  6 07:07:43 2012
@@ -3,7 +3,7 @@
 // RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
 // FIXME: When we have a syntax for modules in C, use that.
 
- at import irgen;
+ at __experimental_modules_import irgen;
 
 // CHECK: define void @triple_value
 void triple_value(int *px) {

Modified: cfe/branches/tooling/test/Modules/load_failure.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/load_failure.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/load_failure.c (original)
+++ cfe/branches/tooling/test/Modules/load_failure.c Tue Mar  6 07:07:43 2012
@@ -1,15 +1,15 @@
 #ifdef NONEXISTENT
- at import load_nonexistent;
+ at __experimental_modules_import load_nonexistent;
 #endif
 
 #ifdef FAILURE
- at import load_failure;
+ at __experimental_modules_import load_failure;
 #endif
 
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -fdisable-module-hash -emit-module -fmodule-name=load_failure %S/Inputs/module.map
 // RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s
-// CHECK-NONEXISTENT: load_failure.c:2:9: fatal error: module 'load_nonexistent' not found
+// CHECK-NONEXISTENT: load_failure.c:2:32: fatal error: module 'load_nonexistent' not found
 
 // RUN: not %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -fdisable-module-hash %s -DFAILURE 2> %t.out
 // RUN: FileCheck -check-prefix=CHECK-FAILURE %s < %t.out

Modified: cfe/branches/tooling/test/Modules/lookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/lookup.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/lookup.cpp (original)
+++ cfe/branches/tooling/test/Modules/lookup.cpp Tue Mar  6 07:07:43 2012
@@ -1,8 +1,8 @@
 
-#define import @import
+#define import @__experimental_modules_import
 import lookup_left_cxx;
 #undef import
-#define IMPORT(X) @import X
+#define IMPORT(X) @__experimental_modules_import X
 IMPORT(lookup_right_cxx);
 
 void test(int i, float f) {

Modified: cfe/branches/tooling/test/Modules/lookup.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/lookup.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/lookup.m (original)
+++ cfe/branches/tooling/test/Modules/lookup.m Tue Mar  6 07:07:43 2012
@@ -1,8 +1,8 @@
 
 // lookup_left.h: expected-note{{using}}
 // lookup_right.h: expected-note{{also found}}
- at import lookup_left_objc;
- at import lookup_right_objc;
+ at __experimental_modules_import lookup_left_objc;
+ at __experimental_modules_import lookup_right_objc;
 
 void test(id x) {
   [x method]; // expected-warning{{multiple methods named 'method' found}}

Modified: cfe/branches/tooling/test/Modules/macros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/macros.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/macros.c (original)
+++ cfe/branches/tooling/test/Modules/macros.c Tue Mar  6 07:07:43 2012
@@ -4,7 +4,7 @@
 // RUN: %clang_cc1 -E -fmodules -x objective-c -fmodule-cache-path %t %s | FileCheck -check-prefix CHECK-PREPROCESSED %s
 // FIXME: When we have a syntax for modules in C, use that.
 
- at import macros;
+ at __experimental_modules_import macros;
 
 #ifndef INTEGER
 #  error INTEGER macro should be visible

Modified: cfe/branches/tooling/test/Modules/method_pool.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/method_pool.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/method_pool.m (original)
+++ cfe/branches/tooling/test/Modules/method_pool.m Tue Mar  6 07:07:43 2012
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -I %S/Inputs %s -verify
 
- at import MethodPoolA;
+ at __experimental_modules_import MethodPoolA;
 
 
 // in other file: // expected-note{{using}}
@@ -19,7 +19,7 @@
   [object method2:1];
 } 
 
- at import MethodPoolB;
+ at __experimental_modules_import MethodPoolB;
 
 void testMethod1Again(id object) {
   [object method1];

Modified: cfe/branches/tooling/test/Modules/module-private.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/module-private.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/module-private.cpp (original)
+++ cfe/branches/tooling/test/Modules/module-private.cpp Tue Mar  6 07:07:43 2012
@@ -4,8 +4,8 @@
 // RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t %s -verify
 // FIXME: When we have a syntax for modules in C++, use that.
 
- at import module_private_left;
- at import module_private_right;
+ at __experimental_modules_import module_private_left;
+ at __experimental_modules_import module_private_right;
 
 void test() {
   int &ir = f0(1.0); // okay: f0() from 'right' is not visible

Modified: cfe/branches/tooling/test/Modules/namespaces.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/namespaces.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/namespaces.cpp (original)
+++ cfe/branches/tooling/test/Modules/namespaces.cpp Tue Mar  6 07:07:43 2012
@@ -7,8 +7,8 @@
 
 namespace N8 { }
 
- at import namespaces_left;
- at import namespaces_right;
+ at __experimental_modules_import namespaces_left;
+ at __experimental_modules_import namespaces_right;
 
 void test() {
   int &ir1 = N1::f(1);

Modified: cfe/branches/tooling/test/Modules/normal-module-map.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/normal-module-map.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/normal-module-map.cpp (original)
+++ cfe/branches/tooling/test/Modules/normal-module-map.cpp Tue Mar  6 07:07:43 2012
@@ -8,7 +8,7 @@
   return umbrella + umbrella_sub; 
 }
 
- at import Umbrella2;
+ at __experimental_modules_import Umbrella2;
 
 #include "a1.h"
 #include "b1.h"
@@ -18,7 +18,7 @@
   return a1 + b1 + nested2;
 }
 
- at import nested_umbrella.a;
+ at __experimental_modules_import nested_umbrella.a;
 
 int testNestedUmbrellaA() {
   return nested_umbrella_a;
@@ -28,7 +28,7 @@
   return nested_umbrella_b; // expected-error{{use of undeclared identifier 'nested_umbrella_b'; did you mean 'nested_umbrella_a'?}}
 }
 
- at import nested_umbrella.b;
+ at __experimental_modules_import nested_umbrella.b;
 
 int testNestedUmbrellaB() {
   return nested_umbrella_b;

Modified: cfe/branches/tooling/test/Modules/objc-categories.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/objc-categories.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/objc-categories.m (original)
+++ cfe/branches/tooling/test/Modules/objc-categories.m Tue Mar  6 07:07:43 2012
@@ -6,7 +6,7 @@
 // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_other -emit-module %S/Inputs/module.map
 // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t %s -verify
 
- at import category_bottom;
+ at __experimental_modules_import category_bottom;
 
 
 
@@ -33,7 +33,7 @@
 
 // Load another module that also adds categories to Foo, verify that
 // we see those categories.
- at import category_other;
+ at __experimental_modules_import category_other;
 
 void test_other(Foo *foo) {
   [foo other];

Modified: cfe/branches/tooling/test/Modules/on-demand-build-warnings.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/on-demand-build-warnings.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/on-demand-build-warnings.m (original)
+++ cfe/branches/tooling/test/Modules/on-demand-build-warnings.m Tue Mar  6 07:07:43 2012
@@ -1,5 +1,5 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Wmodule-build -fmodule-cache-path %t -F %S/Inputs -verify %s
 
- at import Module; // expected-warning{{building module 'Module' from source}}
+ at __experimental_modules_import Module; // expected-warning{{building module 'Module' from source}}
 

Modified: cfe/branches/tooling/test/Modules/on-demand-build.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/on-demand-build.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/on-demand-build.m (original)
+++ cfe/branches/tooling/test/Modules/on-demand-build.m Tue Mar  6 07:07:43 2012
@@ -3,7 +3,7 @@
 // RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -x objective-c++ -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s
 // RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s
 #define FOO
- at import Module;
+ at __experimental_modules_import Module;
 @interface OtherClass
 @end
 
@@ -22,6 +22,6 @@
 #  error MODULE_SUBFRAMEWORK_H should be hidden
 #endif
 
- at import subdir;
+ at __experimental_modules_import subdir;
 
 const char *getSubdirTest() { return getSubdir(); }

Modified: cfe/branches/tooling/test/Modules/on-demand-macros.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/on-demand-macros.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/on-demand-macros.m (original)
+++ cfe/branches/tooling/test/Modules/on-demand-macros.m Tue Mar  6 07:07:43 2012
@@ -2,7 +2,7 @@
 // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -DFOO_RETURNS_INT_PTR -verify %s
 // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -verify %s
 
- at import CmdLine;
+ at __experimental_modules_import CmdLine;
 
 void test() {
 #ifdef FOO_RETURNS_INT_PTR

Modified: cfe/branches/tooling/test/Modules/redecl-merge.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/redecl-merge.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/redecl-merge.m (original)
+++ cfe/branches/tooling/test/Modules/redecl-merge.m Tue Mar  6 07:07:43 2012
@@ -4,12 +4,12 @@
 @class C2;
 @class C3;
 @class C3;
- at import redecl_merge_left;
+ at __experimental_modules_import redecl_merge_left;
 typedef struct my_struct_type *my_struct_ref;
 @protocol P4;
 @class C3;
 @class C3;
- at import redecl_merge_right;
+ at __experimental_modules_import redecl_merge_right;
 
 @implementation A
 - (Super*)init { return self; }
@@ -113,7 +113,7 @@
 
 ClassWithDef *cwd1;
 
- at import redecl_merge_left_left;
+ at __experimental_modules_import redecl_merge_left_left;
 
 void test_C4a(C4 *c4) {
   global_C4 = c4 = get_a_C4();
@@ -124,7 +124,7 @@
   [cwd method];
 }
 
- at import redecl_merge_bottom;
+ at __experimental_modules_import redecl_merge_bottom;
 
 void test_C4b() {
   if (&refers_to_C4) {

Modified: cfe/branches/tooling/test/Modules/redeclarations.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/redeclarations.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/redeclarations.m (original)
+++ cfe/branches/tooling/test/Modules/redeclarations.m Tue Mar  6 07:07:43 2012
@@ -1,5 +1,5 @@
- at import redeclarations_left;
- at import redeclarations_right;
+ at __experimental_modules_import redeclarations_left;
+ at __experimental_modules_import redeclarations_right;
 
 @interface MyObject : NSObject
 @end

Modified: cfe/branches/tooling/test/Modules/requires.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/requires.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/requires.m (original)
+++ cfe/branches/tooling/test/Modules/requires.m Tue Mar  6 07:07:43 2012
@@ -1,5 +1,5 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify
 
- at import DependsOnModule.CXX; // expected-error{{module 'DependsOnModule.CXX' requires feature 'cplusplus'}}
+ at __experimental_modules_import DependsOnModule.CXX; // expected-error{{module 'DependsOnModule.CXX' requires feature 'cplusplus'}}
 

Modified: cfe/branches/tooling/test/Modules/subframeworks.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/subframeworks.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/subframeworks.m (original)
+++ cfe/branches/tooling/test/Modules/subframeworks.m Tue Mar  6 07:07:43 2012
@@ -2,13 +2,13 @@
 // RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify
 // RUN: %clang_cc1 -x objective-c++ -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify
 
- at import DependsOnModule;
+ at __experimental_modules_import DependsOnModule;
 
 void testSubFramework() {
   float *sf1 = sub_framework; // expected-error{{use of undeclared identifier 'sub_framework'}}
 }
 
- at import DependsOnModule.SubFramework;
+ at __experimental_modules_import DependsOnModule.SubFramework;
 
 void testSubFrameworkAgain() {
   float *sf2 = sub_framework;
@@ -16,7 +16,7 @@
 }
 
 #ifdef __cplusplus
- at import DependsOnModule.CXX;
+ at __experimental_modules_import DependsOnModule.CXX;
 
 CXXOnly cxxonly;
 #endif

Modified: cfe/branches/tooling/test/Modules/submodules-preprocess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/submodules-preprocess.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/submodules-preprocess.cpp (original)
+++ cfe/branches/tooling/test/Modules/submodules-preprocess.cpp Tue Mar  6 07:07:43 2012
@@ -2,7 +2,7 @@
 // RUN: %clang_cc1 -fmodules -x objective-c++ -Eonly -fmodule-cache-path %t -I %S/Inputs/submodules %s -verify
 // FIXME: When we have a syntax for modules in C++, use that.
 
- at import std.vector;
+ at __experimental_modules_import std.vector;
 
 #ifndef HAVE_VECTOR
 #  error HAVE_VECTOR macro is not available (but should be)
@@ -16,7 +16,7 @@
 #  error HAVE_HASH_MAP macro is available (but shouldn't be)
 #endif
 
- at import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
+ at __experimental_modules_import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
 
 #ifndef HAVE_VECTOR
 #  error HAVE_VECTOR macro is not available (but should be)
@@ -30,9 +30,9 @@
 #  error HAVE_HASH_MAP macro is available (but shouldn't be)
 #endif
 
- at import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
+ at __experimental_modules_import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
 
- at import std; // import everything in 'std'
+ at __experimental_modules_import std; // import everything in 'std'
 
 #ifndef HAVE_VECTOR
 #  error HAVE_VECTOR macro is not available (but should be)
@@ -46,7 +46,7 @@
 #  error HAVE_HASH_MAP macro is available (but shouldn't be)
 #endif
 
- at import std.hash_map;
+ at __experimental_modules_import std.hash_map;
 
 #ifndef HAVE_VECTOR
 #  error HAVE_VECTOR macro is not available (but should be)

Modified: cfe/branches/tooling/test/Modules/submodules.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/submodules.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/submodules.cpp (original)
+++ cfe/branches/tooling/test/Modules/submodules.cpp Tue Mar  6 07:07:43 2012
@@ -2,7 +2,7 @@
 // RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -fmodules -I %S/Inputs/submodules %s -verify
 // FIXME: When we have a syntax for modules in C++, use that.
 
- at import std.vector;
+ at __experimental_modules_import std.vector;
 
 vector<int> vi;
 
@@ -10,20 +10,20 @@
 remove_reference<int&>::type *int_ptr = 0; // expected-error{{unknown type name 'remove_reference'}} \
 // expected-error{{expected unqualified-id}}
 
- at import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
+ at __experimental_modules_import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
 
 vector<float> vf;
 remove_reference<int&>::type *int_ptr2 = 0;
 
- at import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
+ at __experimental_modules_import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
 
- at import std; // import everything in 'std'
+ at __experimental_modules_import std; // import everything in 'std'
 
 // hash_map still isn't available.
 hash_map<int, float> ints_to_floats; // expected-error{{unknown type name 'hash_map'}} \
 // expected-error{{expected unqualified-id}}
 
- at import std.hash_map;
+ at __experimental_modules_import std.hash_map;
 
 hash_map<int, float> ints_to_floats2;
 

Modified: cfe/branches/tooling/test/Modules/submodules.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/submodules.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/submodules.m (original)
+++ cfe/branches/tooling/test/Modules/submodules.m Tue Mar  6 07:07:43 2012
@@ -3,7 +3,7 @@
 // RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify
 
 // Note: transitively imports Module.Sub2.
- at import Module.Sub;
+ at __experimental_modules_import Module.Sub;
 
 int getValue() { 
   return *Module_Sub + *Module_Sub2;

Modified: cfe/branches/tooling/test/Modules/wildcard-submodule-exports.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Modules/wildcard-submodule-exports.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Modules/wildcard-submodule-exports.cpp (original)
+++ cfe/branches/tooling/test/Modules/wildcard-submodule-exports.cpp Tue Mar  6 07:07:43 2012
@@ -2,7 +2,7 @@
 // RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -fmodules -I %S/Inputs/wildcard-submodule-exports %s -verify
 // FIXME: When we have a syntax for modules in C++, use that.
 
- at import C.One;
+ at __experimental_modules_import C.One;
 
 void test_C_One() {
   int *A1_ptr = A1;
@@ -10,7 +10,7 @@
   (void)B1; // expected-error{{use of undeclared identifier 'B1'}}
 }
 
- at import C.Two;
+ at __experimental_modules_import C.Two;
 
 void test_C_Two() {
   unsigned int *A2_ptr = A2;
@@ -18,7 +18,7 @@
   unsigned long *C2_ptr = C2;
 }
 
- at import B.One;
+ at __experimental_modules_import B.One;
 
 void test_B_One() {
   short *B1_ptr = B1;

Modified: cfe/branches/tooling/test/Parser/MicrosoftExtensions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Parser/MicrosoftExtensions.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Parser/MicrosoftExtensions.c (original)
+++ cfe/branches/tooling/test/Parser/MicrosoftExtensions.c Tue Mar  6 07:07:43 2012
@@ -49,8 +49,8 @@
 typedef enum E { e1 };
 
 
-
-
+enum __declspec(deprecated) E2 { i, j, k };
+__declspec(deprecated) enum E3 { a, b, c } e;
 
 
 /* Microsoft attribute tests */

Modified: cfe/branches/tooling/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Preprocessor/init.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Preprocessor/init.c (original)
+++ cfe/branches/tooling/test/Preprocessor/init.c Tue Mar  6 07:07:43 2012
@@ -852,7 +852,7 @@
 // PPC-LINUX:#define __INTMAX_MAX__ 9223372036854775807LL
 // PPC-LINUX:#define __INTMAX_TYPE__ long long int
 // PPC-LINUX:#define __INTMAX_WIDTH__ 64
-// PPC-LINUX:#define __INTPTR_TYPE__ long int
+// PPC-LINUX:#define __INTPTR_TYPE__ int
 // PPC-LINUX:#define __INTPTR_WIDTH__ 32
 // PPC-LINUX:#define __INT_MAX__ 2147483647
 // PPC-LINUX:#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L
@@ -875,7 +875,7 @@
 // PPC-LINUX:#define __NO_INLINE__ 1
 // PPC-LINUX:#define __POINTER_WIDTH__ 32
 // PPC-LINUX:#define __POWERPC__ 1
-// PPC-LINUX:#define __PTRDIFF_TYPE__ long int
+// PPC-LINUX:#define __PTRDIFF_TYPE__ int
 // PPC-LINUX:#define __PTRDIFF_WIDTH__ 32
 // PPC-LINUX:#define __REGISTER_PREFIX__
 // PPC-LINUX:#define __SCHAR_MAX__ 127

Modified: cfe/branches/tooling/test/Preprocessor/pragma_microsoft.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Preprocessor/pragma_microsoft.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Preprocessor/pragma_microsoft.c (original)
+++ cfe/branches/tooling/test/Preprocessor/pragma_microsoft.c Tue Mar  6 07:07:43 2012
@@ -38,3 +38,46 @@
   // this warning should go away.
   MACRO_WITH__PRAGMA // expected-warning {{expression result unused}}
 }
+
+
+// This should include macro_arg_directive even though the include
+// is looking for test.h  This allows us to assign to "n"
+#pragma include_alias("test.h", "macro_arg_directive.h" )
+#include "test.h"
+void test( void ) {
+  n = 12;
+}
+
+#pragma include_alias(<bar.h>, "bar.h") // expected-warning {{angle-bracketed include <bar.h> cannot be aliased to double-quoted include "bar.h"}}
+#pragma include_alias("foo.h", <bar.h>) // expected-warning {{double-quoted include "foo.h" cannot be aliased to angle-bracketed include <bar.h>}}
+#pragma include_alias("test.h") // expected-warning {{pragma include_alias expected ','}}
+
+// Make sure that the names match exactly for a replacement, including path information.  If
+// this were to fail, we would get a file not found error
+#pragma include_alias(".\pp-record.h", "does_not_exist.h")
+#include "pp-record.h"
+
+#pragma include_alias(12) // expected-warning {{pragma include_alias expected include filename}}
+
+// It's expected that we can map "bar" and <bar> separately
+#define test
+// We can't actually look up stdio.h because we're using cc1 without header paths, but this will ensure
+// that we get the right bar.h, because the "bar.h" will undef test for us, where <bar.h> won't
+#pragma include_alias(<bar.h>, <stdio.h>)
+#pragma include_alias("bar.h", "pr2086.h")  // This should #undef test
+
+#include "bar.h"
+#if defined(test)
+// This should not warn because test should not be defined
+#pragma include_alias("test.h")
+#endif
+
+// Test to make sure there are no use-after-free problems
+#define B "pp-record.h"
+#pragma include_alias("quux.h", B)
+void g() {}
+#include "quux.h"
+
+// Make sure that empty includes don't work
+#pragma include_alias("", "foo.h")  // expected-error {{empty filename}}
+#pragma include_alias(<foo.h>, <>)  // expected-error {{empty filename}}

Modified: cfe/branches/tooling/test/Sema/builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Sema/builtins.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Sema/builtins.c (original)
+++ cfe/branches/tooling/test/Sema/builtins.c Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic -triple=i686-apple-darwin9
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic -Wno-string-plus-int -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) {

Removed: cfe/branches/tooling/test/Sema/many-logical-ops.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Sema/many-logical-ops.c?rev=152117&view=auto
==============================================================================
--- cfe/branches/tooling/test/Sema/many-logical-ops.c (original)
+++ cfe/branches/tooling/test/Sema/many-logical-ops.c (removed)
@@ -1,2011 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -Wconstant-conversion -verify %s
-
-// rdar://10913206
-// Check that we don't get stack overflow trying to evaluate a huge number of
-// logical operators.
-
-int foo(int x) {
-  return
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    // FIXME: error is temporary.
-    x && // expected-error {{integer expression evaluation exceeded maximum sub-expression dept}}
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x &&
-    x;
-}

Modified: cfe/branches/tooling/test/Sema/warn-unused-parameters.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Sema/warn-unused-parameters.c?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/Sema/warn-unused-parameters.c (original)
+++ cfe/branches/tooling/test/Sema/warn-unused-parameters.c Tue Mar  6 07:07:43 2012
@@ -24,7 +24,7 @@
 // RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything %s 2>&1 | FileCheck -check-prefix=CHECK-everything %s
 // RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything -Werror %s 2>&1 | FileCheck -check-prefix=CHECK-everything-error %s
 // RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything -Wno-unused %s 2>&1 | FileCheck -check-prefix=CHECK-everything-no-unused %s
-// CHECK-everything: 6 warnings generated
-// CHECK-everything-error: 5 errors generated
-// CHECK-everything-no-unused: 5 warnings generated
+// CHECK-everything: 7 warnings generated
+// CHECK-everything-error: 6 errors generated
+// CHECK-everything-no-unused: 6 warnings generated
 

Modified: cfe/branches/tooling/test/SemaCXX/array-bounds-ptr-arith.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/array-bounds-ptr-arith.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/array-bounds-ptr-arith.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/array-bounds-ptr-arith.cpp Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -Warray-bounds-pointer-arithmetic %s
+// RUN: %clang_cc1 -verify -Wno-string-plus-int -Warray-bounds-pointer-arithmetic %s
 
 void swallow (const char *x) { (void)x; }
 void test_pointer_arithmetic(int n) {

Modified: cfe/branches/tooling/test/SemaCXX/constant-expression-cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/constant-expression-cxx11.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/constant-expression-cxx11.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/constant-expression-cxx11.cpp Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i686-linux -fsyntax-only -verify -std=c++11 -pedantic %s -Wno-comment
+// RUN: %clang_cc1 -triple i686-linux -Wno-string-plus-int -fsyntax-only -verify -std=c++11 -pedantic %s -Wno-comment
 
 namespace StaticAssertFoldTest {
 
@@ -100,8 +100,8 @@
 }
 
 extern int &Recurse1;
-int &Recurse2 = Recurse1; // expected-note 2{{declared here}} expected-note {{initializer of 'Recurse1' is not a constant expression}}
-int &Recurse1 = Recurse2; // expected-note {{declared here}} expected-note {{initializer of 'Recurse2' is not a constant expression}}
+int &Recurse2 = Recurse1; // expected-note {{declared here}}
+int &Recurse1 = Recurse2;
 constexpr int &Recurse3 = Recurse2; // expected-error {{must be initialized by a constant expression}} expected-note {{initializer of 'Recurse2' is not a constant expression}}
 
 extern const int RecurseA;

Modified: cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-aggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-aggregates.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-aggregates.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-aggregates.cpp Tue Mar  6 07:07:43 2012
@@ -73,3 +73,17 @@
 
   struct C { int a[2]; C():a({1, 2}) { } }; // expected-error {{parenthesized initialization of a member array is a GNU extension}}
 }
+
+namespace array_explicit_conversion {
+  typedef int test1[2];
+  typedef int test2[];
+  template<int x> struct A { int a[x]; }; // expected-error {{'a' declared as an array with a negative size}}
+  typedef A<1> test3[];
+  typedef A<-1> test4[];
+  void f() {
+    (void)test1{1};
+    (void)test2{1};
+    (void)test3{{{1}}};
+    (void)test4{{{1}}}; // expected-note {{in instantiation of template class 'array_explicit_conversion::A<-1>' requested here}}
+  }
+}

Modified: cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-constructor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-constructor.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-constructor.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-constructor.cpp Tue Mar  6 07:07:43 2012
@@ -212,3 +212,9 @@
   }
 
 }
+
+namespace PR12117 {
+  struct A { A(int); }; 
+  struct B { B(A); } b{{0}};
+  struct C { C(int); } c{0};
+}

Modified: cfe/branches/tooling/test/SemaCXX/cxx0x-nontrivial-union.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/cxx0x-nontrivial-union.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/cxx0x-nontrivial-union.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/cxx0x-nontrivial-union.cpp Tue Mar  6 07:07:43 2012
@@ -10,6 +10,12 @@
 union u {
   non_trivial nt;
 };
+union u2 {
+  non_trivial nt;
+  int k;
+  u2(int k) : k(k) {}
+  u2() : nt() {}
+};
 
 union static_data_member {
   static int i;
@@ -29,3 +35,90 @@
 // Don't crash on this.
 struct TemplateCtor { template<typename T> TemplateCtor(T); };
 union TemplateCtorMember { TemplateCtor s; };
+
+template<typename T> struct remove_ref { typedef T type; };
+template<typename T> struct remove_ref<T&> { typedef T type; };
+template<typename T> struct remove_ref<T&&> { typedef T type; };
+template<typename T> T &&forward(typename remove_ref<T>::type &&t);
+template<typename T> T &&forward(typename remove_ref<T>::type &t);
+template<typename T> typename remove_ref<T>::type &&move(T &&t);
+
+using size_t = decltype(sizeof(int));
+void *operator new(size_t, void *p) noexcept { return p; }
+
+namespace disabled_dtor {
+  template<typename T>
+  union disable_dtor {
+    T val;
+    template<typename...U>
+    disable_dtor(U &&...u) : val(forward<U>(u)...) {}
+    ~disable_dtor() {}
+  };
+
+  struct deleted_dtor {
+    deleted_dtor(int n, char c) : n(n), c(c) {}
+    int n;
+    char c;
+    ~deleted_dtor() = delete;
+  };
+
+  disable_dtor<deleted_dtor> dd(4, 'x');
+}
+
+namespace optional {
+  template<typename T> struct optional {
+    bool has;
+    union { T value; };
+
+    optional() : has(false) {}
+    template<typename...U>
+    optional(U &&...u) : has(true), value(forward<U>(u)...) {}
+
+    optional(const optional &o) : has(o.has) {
+      if (has) new (&value) T(o.value);
+    }
+    optional(optional &&o) : has(o.has) {
+      if (has) new (&value) T(move(o.value));
+    }
+
+    optional &operator=(const optional &o) {
+      if (has) {
+        if (o.has)
+          value = o.value;
+        else
+          value.~T();
+      } else if (o.has) {
+        new (&value) T(o.value);
+      }
+      has = o.has;
+    }
+    optional &operator=(optional &&o) {
+      if (has) {
+        if (o.has)
+          value = move(o.value);
+        else
+          value.~T();
+      } else if (o.has) {
+        new (&value) T(move(o.value));
+      }
+      has = o.has;
+    }
+
+    ~optional() {
+      if (has)
+        value.~T();
+    }
+
+    explicit operator bool() const { return has; }
+    T &operator*() const { return value; }
+  };
+
+  optional<non_trivial> o1;
+  optional<non_trivial> o2{non_trivial()};
+  optional<non_trivial> o3{*o2};
+  void f() {
+    if (o2)
+      o1 = o2;
+    o2 = optional<non_trivial>();
+  }
+}

Modified: cfe/branches/tooling/test/SemaCXX/cxx98-compat.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/cxx98-compat.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/cxx98-compat.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/cxx98-compat.cpp Tue Mar  6 07:07:43 2012
@@ -50,7 +50,7 @@
   return { 0 }; // expected-warning {{generalized initializer lists are incompatible with C++98}}
 }
 
-int operator""_hello(const char *); // expected-warning {{literal operators are incompatible with C++98}}
+int operator"" _hello(const char *); // expected-warning {{literal operators are incompatible with C++98}}
 
 enum EnumFixed : int { // expected-warning {{enumeration types with a fixed underlying type are incompatible with C++98}}
 };

Modified: cfe/branches/tooling/test/SemaCXX/lambda-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/lambda-expressions.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/lambda-expressions.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/lambda-expressions.cpp Tue Mar  6 07:07:43 2012
@@ -85,6 +85,13 @@
 
     const int h = a; // expected-note {{declared}}
     []() { return h; }; // expected-error {{variable 'h' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} 
+
+    // The exemption for variables which can appear in constant expressions
+    // applies only to objects (and not to references).
+    // FIXME: This might be a bug in the standard.
+    static int i;
+    constexpr int &ref_i = i; // expected-note {{declared}}
+    [] { return ref_i; }; // expected-error {{variable 'ref_i' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}}
   }
 }
 

Modified: cfe/branches/tooling/test/SemaCXX/literal-operators.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/literal-operators.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/literal-operators.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/literal-operators.cpp Tue Mar  6 07:07:43 2012
@@ -35,9 +35,9 @@
 void operator "" _good (c*);
 
 // Check extra cv-qualifiers
-void operator "" _cv_good (volatile const char *, const size_t);
+void operator "" _cv_good (volatile const char *, const size_t); // expected-error {{parameter declaration for literal operator 'operator "" _cv_good' is not valid}}
 
-// Template delcaration (not implemented yet)
-// template <char...> void operator "" good ();
+// Template declaration
+template <char...> void operator "" _good ();
 
 // FIXME: Test some invalid decls that might crop up.

Modified: cfe/branches/tooling/test/SemaCXX/null_in_arithmetic_ops.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/null_in_arithmetic_ops.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/null_in_arithmetic_ops.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/null_in_arithmetic_ops.cpp Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -fblocks -Wnull-arithmetic -verify %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -fblocks -Wnull-arithmetic -verify -Wno-string-plus-int %s
 #include <stddef.h>
 
 void f() {

Modified: cfe/branches/tooling/test/SemaCXX/underlying_type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/underlying_type.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/underlying_type.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/underlying_type.cpp Tue Mar  6 07:07:43 2012
@@ -35,3 +35,9 @@
               "f has the wrong underlying type in the template");
 
 underlying_type<int>::type e; // expected-note {{requested here}}
+
+using uint = unsigned;
+enum class foo : uint { bar };
+ 
+static_assert(is_same_type<underlying_type<foo>::type, unsigned>::value,
+              "foo has the wrong underlying type");

Modified: cfe/branches/tooling/test/SemaCXX/warn-memset-bad-sizeof.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/warn-memset-bad-sizeof.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/warn-memset-bad-sizeof.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/warn-memset-bad-sizeof.cpp Tue Mar  6 07:07:43 2012
@@ -104,6 +104,14 @@
   // Copy to raw buffer shouldn't warn either
   memcpy(&foo, &arr, sizeof(Foo));
   memcpy(&arr, &foo, sizeof(Foo));
+
+  // Shouldn't warn, and shouldn't crash either.
+  memset(({
+    if (0) {}
+    while (0) {}
+    for (;;) {}
+    &s;
+  }), 0, sizeof(s));
 }
 
 namespace ns {

Modified: cfe/branches/tooling/test/SemaCXX/warn-thread-safety-analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/warn-thread-safety-analysis.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/warn-thread-safety-analysis.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/warn-thread-safety-analysis.cpp Tue Mar  6 07:07:43 2012
@@ -766,27 +766,7 @@
 // Unparseable lock expressions
 // ----------------------------------------------//
 
-Mutex UPmu;
-// FIXME: add support for lock expressions involving arrays.
-Mutex mua[5];
-
-int x __attribute__((guarded_by(UPmu = sls_mu)));
-int y __attribute__((guarded_by(mua[0])));
-
-
-void testUnparse() {
-  x = 5; // \
-    // expected-warning{{cannot resolve lock expression}}
-  y = 5; // \
-    // expected-warning{{cannot resolve lock expression}}
-}
-
-void testUnparse2() {
-  mua[0].Lock(); // \
-    // expected-warning{{cannot resolve lock expression}}
-  (&(mua[0]) + 4)->Lock(); // \
-    // expected-warning{{cannot resolve lock expression}}
-}
+// FIXME -- derive new tests for unhandled expressions
 
 
 //----------------------------------------------------------------------------//
@@ -2114,3 +2094,150 @@
 
 }  // end namespace InvalidNonStatic
 
+
+namespace NoReturnTest {
+
+bool condition();
+void fatal() __attribute__((noreturn));
+
+Mutex mu_;
+
+void test1() {
+  MutexLock lock(&mu_);
+  if (condition()) {
+    fatal();
+    return;
+  }
+}
+
+} // end namespace NoReturnTest
+
+
+namespace TestMultiDecl {
+
+class Foo {
+public:
+  int GUARDED_BY(mu_) a;
+  int GUARDED_BY(mu_) b, c;
+
+  void foo() {
+    a = 0; // \
+      // expected-warning {{writing variable 'a' requires locking 'mu_' exclusively}}
+    b = 0; // \
+      // expected-warning {{writing variable 'b' requires locking 'mu_' exclusively}}
+    c = 0; // \
+      // expected-warning {{writing variable 'c' requires locking 'mu_' exclusively}}
+  }
+
+private:
+  Mutex mu_;
+};
+
+} // end namespace TestMultiDecl
+
+
+namespace WarnNoDecl {
+
+class Foo {
+  void foo(int a);  __attribute__(( // \
+    // expected-warning {{declaration does not declare anything}}
+    exclusive_locks_required(a))); // \
+    // expected-warning {{attribute exclusive_locks_required ignored}}
+};
+
+} // end namespace WarnNoDecl
+
+
+
+namespace MoreLockExpressions {
+
+class Foo {
+public:
+  Mutex mu_;
+  int a GUARDED_BY(mu_);
+};
+
+class Bar {
+public:
+  int b;
+  Foo* f;
+
+  Foo& getFoo()              { return *f; }
+  Foo& getFoo2(int c)        { return *f; }
+  Foo& getFoo3(int c, int d) { return *f; }
+
+  Foo& getFooey() { return *f; }
+};
+
+Foo& getBarFoo(Bar &bar, int c) { return bar.getFoo2(c); }
+
+void test() {
+  Foo foo;
+  Foo *fooArray;
+  Bar bar;
+  int a;
+  int b;
+  int c;
+
+  bar.getFoo().mu_.Lock();
+  bar.getFoo().a = 0;
+  bar.getFoo().mu_.Unlock();
+
+  (bar.getFoo().mu_).Lock();   // test parenthesis
+  bar.getFoo().a = 0;
+  (bar.getFoo().mu_).Unlock();
+
+  bar.getFoo2(a).mu_.Lock();
+  bar.getFoo2(a).a = 0;
+  bar.getFoo2(a).mu_.Unlock();
+
+  bar.getFoo3(a, b).mu_.Lock();
+  bar.getFoo3(a, b).a = 0;
+  bar.getFoo3(a, b).mu_.Unlock();
+
+  getBarFoo(bar, a).mu_.Lock();
+  getBarFoo(bar, a).a = 0;
+  getBarFoo(bar, a).mu_.Unlock();
+
+  bar.getFoo2(10).mu_.Lock();
+  bar.getFoo2(10).a = 0;
+  bar.getFoo2(10).mu_.Unlock();
+
+  bar.getFoo2(a + 1).mu_.Lock();
+  bar.getFoo2(a + 1).a = 0;
+  bar.getFoo2(a + 1).mu_.Unlock();
+
+  (a > 0 ? fooArray[1] : fooArray[b]).mu_.Lock();
+  (a > 0 ? fooArray[1] : fooArray[b]).a = 0;
+  (a > 0 ? fooArray[1] : fooArray[b]).mu_.Unlock();
+
+  bar.getFoo().mu_.Lock();
+  bar.getFooey().a = 0; // \
+    // expected-warning {{writing variable 'a' requires locking 'mu_' exclusively}}
+  bar.getFoo().mu_.Unlock();
+
+  bar.getFoo2(a).mu_.Lock();
+  bar.getFoo2(b).a = 0; // \
+    // expected-warning {{writing variable 'a' requires locking 'mu_' exclusively}}
+  bar.getFoo2(a).mu_.Unlock();
+
+  bar.getFoo3(a, b).mu_.Lock();
+  bar.getFoo3(a, c).a = 0;  // \
+    // expected-warning {{writing variable 'a' requires locking 'mu_' exclusively}}
+  bar.getFoo3(a, b).mu_.Unlock();
+
+  getBarFoo(bar, a).mu_.Lock();
+  getBarFoo(bar, b).a = 0;  // \
+    // expected-warning {{writing variable 'a' requires locking 'mu_' exclusively}}
+  getBarFoo(bar, a).mu_.Unlock();
+
+  (a > 0 ? fooArray[1] : fooArray[b]).mu_.Lock();
+  (a > 0 ? fooArray[b] : fooArray[c]).a = 0; // \
+    // expected-warning {{writing variable 'a' requires locking 'mu_' exclusively}}
+  (a > 0 ? fooArray[1] : fooArray[b]).mu_.Unlock();
+}
+
+
+} // end namespace
+
+

Modified: cfe/branches/tooling/test/SemaCXX/warn-thread-safety-parsing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/warn-thread-safety-parsing.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/warn-thread-safety-parsing.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/warn-thread-safety-parsing.cpp Tue Mar  6 07:07:43 2012
@@ -1287,5 +1287,21 @@
 void Bar<T>::bar() __attribute__((exclusive_locks_required(mu_))) { }
 
 void baz(Foo *f) __attribute__((exclusive_locks_required(f->mu_))) { }
+
+} // end namespace
+
+
+namespace TestMultiDecl {
+
+class Foo {
+public:
+  int __attribute__((guarded_by(mu_))) a;
+  int __attribute__((guarded_by(mu_))) b, c;
+
+private:
+  Mu mu_;
 };
 
+
+} // end namespace TestMultiDecl
+

Propchange: cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  6 07:07:43 2012
@@ -1,2 +1,2 @@
 /cfe/branches/type-system-rewrite/test/SemaCXX/warn-unreachable.cpp:134693-134817
-/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,146581-151673
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,146581-152117

Modified: cfe/branches/tooling/test/SemaCXX/warn-unused-parameters.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/warn-unused-parameters.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/warn-unused-parameters.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/warn-unused-parameters.cpp Tue Mar  6 07:07:43 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -verify -std=c++11 %s
 template<typename T>
 struct X {
   T f0(T x);
@@ -24,3 +24,11 @@
   x.f4(i);
   x.f5(i);
 }
+
+// Make sure both parameters aren't considered unused.
+template <typename... T>
+static int test_pack(T... t, T... s)
+{
+  auto l = [&t...]() { return sizeof...(s); };
+  return l();
+}

Modified: cfe/branches/tooling/test/SemaObjC/atomoic-property-synnthesis-rules.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/atomoic-property-synnthesis-rules.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/atomoic-property-synnthesis-rules.m (original)
+++ cfe/branches/tooling/test/SemaObjC/atomoic-property-synnthesis-rules.m Tue Mar  6 07:07:43 2012
@@ -107,8 +107,10 @@
 
 // read-write - might warn
 @property int GetSet;
- at property int Get;	// expected-note {{property declared here}}
- at property int Set;	// expected-note {{property declared here}}
+ at property int Get;	// expected-note {{property declared here}} \
+                        // expected-note {{setter and getter must both be synthesized}}
+ at property int Set;	// expected-note {{property declared here}} \
+                        // expected-note {{setter and getter must both be synthesized}}
 @property int None;
 @property(nonatomic) int GetSet_Nonatomic;
 @property(nonatomic) int Get_Nonatomic;
@@ -127,8 +129,10 @@
 
 // read-only in class, read-write in class extension - might warn
 @property(readonly) int GetSet_ReadWriteInExt;
- at property(readonly) int Get_ReadWriteInExt;	// expected-note {{property declared here}}
- at property(readonly) int Set_ReadWriteInExt;	// expected-note {{property declared here}}
+ at property(readonly) int Get_ReadWriteInExt;	// expected-note {{property declared here}} \
+                                                // expected-note {{setter and getter must both be synthesized}}
+ at property(readonly) int Set_ReadWriteInExt;	// expected-note {{property declared here}} \
+                                                // expected-note {{setter and getter must both be synthesized}}
 @property(readonly) int None_ReadWriteInExt;
 @property(nonatomic,readonly) int GetSet_Nonatomic_ReadWriteInExt;
 @property(nonatomic,readonly) int Get_Nonatomic_ReadWriteInExt;
@@ -138,8 +142,10 @@
 
 // same as above, but @synthesize follows the hand-written methods - might warn
 @property int GetSet_LateSynthesize;
- at property int Get_LateSynthesize;	// expected-note {{property declared here}}
- at property int Set_LateSynthesize;	// expected-note {{property declared here}}
+ at property int Get_LateSynthesize;	// expected-note {{property declared here}} \
+                                        // expected-note {{setter and getter must both be synthesized}}
+ at property int Set_LateSynthesize;	// expected-note {{property declared here}} \
+                                        // expected-note {{setter and getter must both be synthesized}}
 @property int None_LateSynthesize;
 @property(nonatomic) int GetSet_Nonatomic_LateSynthesize;
 @property(nonatomic) int Get_Nonatomic_LateSynthesize;
@@ -156,8 +162,10 @@
 @property(nonatomic,readonly) int None_Nonatomic_ReadOnly_LateSynthesize;
 
 @property(readonly) int GetSet_ReadWriteInExt_LateSynthesize;
- at property(readonly) int Get_ReadWriteInExt_LateSynthesize;	// expected-note {{property declared here}}
- at property(readonly) int Set_ReadWriteInExt_LateSynthesize;	// expected-note {{property declared here}}
+ at property(readonly) int Get_ReadWriteInExt_LateSynthesize;	// expected-note {{property declared here}} \
+                                                                // expected-note {{setter and getter must both be synthesized}}
+ at property(readonly) int Set_ReadWriteInExt_LateSynthesize;	// expected-note {{property declared here}} \
+                                                                // expected-note {{setter and getter must both be synthesized}}
 @property(readonly) int None_ReadWriteInExt_LateSynthesize;
 @property(nonatomic,readonly) int GetSet_Nonatomic_ReadWriteInExt_LateSynthesize;
 @property(nonatomic,readonly) int Get_Nonatomic_ReadWriteInExt_LateSynthesize;
@@ -240,10 +248,8 @@
 
 GET(GetSet)
 SET(GetSet)
-GET(Get) // expected-warning {{writable atomic property 'Get' cannot pair a synthesized setter with a user defined getter}} \
-         // expected-note {{setter and getter must both be synthesized}}
-SET(Set) // expected-warning {{writable atomic property 'Set' cannot pair a synthesized getter with a user defined setter}} \
-         // expected-note {{setter and getter must both be synthesized}}
+GET(Get) // expected-warning {{writable atomic property 'Get' cannot pair a synthesized setter with a user defined getter}} 
+SET(Set) // expected-warning {{writable atomic property 'Set' cannot pair a synthesized getter with a user defined setter}}
 GET(GetSet_Nonatomic)
 SET(GetSet_Nonatomic)
 GET(Get_Nonatomic)
@@ -260,10 +266,8 @@
 
 GET(GetSet_ReadWriteInExt)
 SET(GetSet_ReadWriteInExt)
-GET(Get_ReadWriteInExt) // expected-warning {{writable atomic property 'Get_ReadWriteInExt' cannot pair a synthesized setter with a user defined getter}} \
-         // expected-note {{setter and getter must both be synthesized}}
-SET(Set_ReadWriteInExt) // expected-warning {{writable atomic property 'Set_ReadWriteInExt' cannot pair a synthesized getter with a user defined setter}} \
-         // expected-note {{setter and getter must both be synthesized}}
+GET(Get_ReadWriteInExt) // expected-warning {{writable atomic property 'Get_ReadWriteInExt' cannot pair a synthesized setter with a user defined getter}} 
+SET(Set_ReadWriteInExt) // expected-warning {{writable atomic property 'Set_ReadWriteInExt' cannot pair a synthesized getter with a user defined setter}}
 GET(GetSet_Nonatomic_ReadWriteInExt)
 SET(GetSet_Nonatomic_ReadWriteInExt)
 GET(Get_Nonatomic_ReadWriteInExt)
@@ -272,10 +276,8 @@
 
 GET(GetSet_LateSynthesize)
 SET(GetSet_LateSynthesize)
-GET(Get_LateSynthesize) // expected-warning {{writable atomic property 'Get_LateSynthesize' cannot pair a synthesized setter with a user defined getter}} \
-         // expected-note {{setter and getter must both be synthesized}}
-SET(Set_LateSynthesize) // expected-warning {{writable atomic property 'Set_LateSynthesize' cannot pair a synthesized getter with a user defined setter}} \
-         // expected-note {{setter and getter must both be synthesized}}
+GET(Get_LateSynthesize) // expected-warning {{writable atomic property 'Get_LateSynthesize' cannot pair a synthesized setter with a user defined getter}} 
+SET(Set_LateSynthesize) // expected-warning {{writable atomic property 'Set_LateSynthesize' cannot pair a synthesized getter with a user defined setter}}
 GET(GetSet_Nonatomic_LateSynthesize)
 SET(GetSet_Nonatomic_LateSynthesize)
 GET(Get_Nonatomic_LateSynthesize)
@@ -292,10 +294,8 @@
 
 GET(GetSet_ReadWriteInExt_LateSynthesize)
 SET(GetSet_ReadWriteInExt_LateSynthesize)
-GET(Get_ReadWriteInExt_LateSynthesize) // expected-warning {{writable atomic property 'Get_ReadWriteInExt_LateSynthesize' cannot pair a synthesized setter with a user defined getter}} \
-         // expected-note {{setter and getter must both be synthesized}}
-SET(Set_ReadWriteInExt_LateSynthesize) // expected-warning {{writable atomic property 'Set_ReadWriteInExt_LateSynthesize' cannot pair a synthesized getter with a user defined setter}} \
-         // expected-note {{setter and getter must both be synthesized}}
+GET(Get_ReadWriteInExt_LateSynthesize) // expected-warning {{writable atomic property 'Get_ReadWriteInExt_LateSynthesize' cannot pair a synthesized setter with a user defined getter}}
+SET(Set_ReadWriteInExt_LateSynthesize) // expected-warning {{writable atomic property 'Set_ReadWriteInExt_LateSynthesize' cannot pair a synthesized getter with a user defined setter}}
 GET(GetSet_Nonatomic_ReadWriteInExt_LateSynthesize)
 SET(GetSet_Nonatomic_ReadWriteInExt_LateSynthesize)
 GET(Get_Nonatomic_ReadWriteInExt_LateSynthesize)

Modified: cfe/branches/tooling/test/SemaObjC/category-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/category-1.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/category-1.m (original)
+++ cfe/branches/tooling/test/SemaObjC/category-1.m Tue Mar  6 07:07:43 2012
@@ -95,3 +95,7 @@
 @synthesize name = _name;
 @end
 
+// rdar://10968158
+ at class I; // expected-note {{forward declaration}}
+ at implementation I(cat) // expected-error{{cannot find interface declaration}}
+ at end

Modified: cfe/branches/tooling/test/SemaObjC/nsobject-attribute.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/nsobject-attribute.m?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/nsobject-attribute.m (original)
+++ cfe/branches/tooling/test/SemaObjC/nsobject-attribute.m Tue Mar  6 07:07:43 2012
@@ -45,7 +45,8 @@
 {
    __attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}}
 }
- at property (nonatomic, retain) __attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}}
+  // <rdar://problem/10930507>
+ at property (nonatomic, retain) __attribute__((NSObject)) void * color; // // no-warning
 @end
 void test_10453342() {
     char* __attribute__((NSObject)) string2 = 0; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}}

Modified: cfe/branches/tooling/test/SemaTemplate/constexpr-instantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaTemplate/constexpr-instantiate.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaTemplate/constexpr-instantiate.cpp (original)
+++ cfe/branches/tooling/test/SemaTemplate/constexpr-instantiate.cpp Tue Mar  6 07:07:43 2012
@@ -65,3 +65,13 @@
   constexpr int m = S<int>::k; // ok
   constexpr int o = n; // expected-error {{constant expression}} expected-note {{initializer of 'n'}}
 }
+
+namespace Reference {
+  const int k = 5;
+  template<typename T> struct S {
+    static volatile int &r;
+  };
+  template<typename T> volatile int &S<T>::r = const_cast<volatile int&>(k);
+  constexpr int n = const_cast<int&>(S<int>::r);
+  static_assert(n == 5, "");
+}

Modified: cfe/branches/tooling/tools/driver/cc1as_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/driver/cc1as_main.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/tools/driver/cc1as_main.cpp (original)
+++ cfe/branches/tooling/tools/driver/cc1as_main.cpp Tue Mar  6 07:07:43 2012
@@ -323,7 +323,7 @@
   // FIXME: There is a bit of code duplication with addPassesToEmitFile.
   if (Opts.OutputType == AssemblerInvocation::FT_Asm) {
     MCInstPrinter *IP =
-      TheTarget->createMCInstPrinter(Opts.OutputAsmVariant, *MAI, *STI);
+      TheTarget->createMCInstPrinter(Opts.OutputAsmVariant, *MAI, *MRI, *STI);
     MCCodeEmitter *CE = 0;
     MCAsmBackend *MAB = 0;
     if (Opts.ShowEncoding) {

Modified: cfe/branches/tooling/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/libclang/CIndex.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/tools/libclang/CIndex.cpp (original)
+++ cfe/branches/tooling/tools/libclang/CIndex.cpp Tue Mar  6 07:07:43 2012
@@ -35,7 +35,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringSwitch.h"
-#include "llvm/ADT/SaveAndRestore.h"
+#include "llvm/Support/SaveAndRestore.h"
 #include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/MemoryBuffer.h"

Modified: cfe/branches/tooling/tools/libclang/CIndexDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/libclang/CIndexDiagnostic.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/tools/libclang/CIndexDiagnostic.cpp (original)
+++ cfe/branches/tooling/tools/libclang/CIndexDiagnostic.cpp Tue Mar  6 07:07:43 2012
@@ -130,7 +130,7 @@
   virtual void emitCodeContext(SourceLocation Loc,
                                DiagnosticsEngine::Level Level,
                                SmallVectorImpl<CharSourceRange>& Ranges,
-                               ArrayRef<FixItHint> Hints) {};
+                               ArrayRef<FixItHint> Hints) {}
   
   virtual void emitNote(SourceLocation Loc, StringRef Message) {
     CXSourceLocation L = translateSourceLocation(SM, LangOpts, Loc);

Modified: cfe/branches/tooling/utils/TableGen/ClangDiagnosticsEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/utils/TableGen/ClangDiagnosticsEmitter.cpp?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/utils/TableGen/ClangDiagnosticsEmitter.cpp (original)
+++ cfe/branches/tooling/utils/TableGen/ClangDiagnosticsEmitter.cpp Tue Mar  6 07:07:43 2012
@@ -50,7 +50,6 @@
 };
 } // end anonymous namespace.
 
-
 static std::string
 getCategoryFromDiagGroup(const Record *Group,
                          DiagGroupParentMap &DiagGroupParents) {
@@ -119,8 +118,44 @@
     iterator begin() { return CategoryStrings.begin(); }
     iterator end() { return CategoryStrings.end(); }
   };
+
+  struct GroupInfo {
+    std::vector<const Record*> DiagsInGroup;
+    std::vector<std::string> SubGroups;
+    unsigned IDNo;
+  };
 } // end anonymous namespace.
 
+/// \brief Invert the 1-[0/1] mapping of diags to group into a one to many
+/// mapping of groups to diags in the group.
+static void groupDiagnostics(const std::vector<Record*> &Diags,
+                             const std::vector<Record*> &DiagGroups,
+                             std::map<std::string, GroupInfo> &DiagsInGroup) {
+  for (unsigned i = 0, e = Diags.size(); i != e; ++i) {
+    const Record *R = Diags[i];
+    DefInit *DI = dynamic_cast<DefInit*>(R->getValueInit("Group"));
+    if (DI == 0) continue;
+    std::string GroupName = DI->getDef()->getValueAsString("GroupName");
+    DiagsInGroup[GroupName].DiagsInGroup.push_back(R);
+  }
+  
+  // Add all DiagGroup's to the DiagsInGroup list to make sure we pick up empty
+  // groups (these are warnings that GCC supports that clang never produces).
+  for (unsigned i = 0, e = DiagGroups.size(); i != e; ++i) {
+    Record *Group = DiagGroups[i];
+    GroupInfo &GI = DiagsInGroup[Group->getValueAsString("GroupName")];
+    
+    std::vector<Record*> SubGroups = Group->getValueAsListOfDefs("SubGroups");
+    for (unsigned j = 0, e = SubGroups.size(); j != e; ++j)
+      GI.SubGroups.push_back(SubGroups[j]->getValueAsString("GroupName"));
+  }
+  
+  // Assign unique ID numbers to the groups.
+  unsigned IDNo = 0;
+  for (std::map<std::string, GroupInfo>::iterator
+       I = DiagsInGroup.begin(), E = DiagsInGroup.end(); I != E; ++I, ++IDNo)
+    I->second.IDNo = IDNo;
+}
 
 //===----------------------------------------------------------------------===//
 // Warning Tables (.inc file) generation.
@@ -140,19 +175,11 @@
   const std::vector<Record*> &Diags =
     Records.getAllDerivedDefinitions("Diagnostic");
 
-  // Make a sorted set of all warning opts so we can get the index.
-  std::set<std::string> WarningOpts;
-  for (unsigned i = 0, e = Diags.size(); i != e; ++i) {
-    const Record *R = Diags[i];
-    DefInit *DI = dynamic_cast<DefInit*>(R->getValueInit("Group"));
-    if (DI)
-      WarningOpts.insert(DI->getDef()->getValueAsString("GroupName"));
-  }
-
   std::vector<Record*> DiagGroups
     = Records.getAllDerivedDefinitions("DiagGroup");
-  for (unsigned i = 0, e = DiagGroups.size(); i != e; ++i)
-    WarningOpts.insert(DiagGroups[i]->getValueAsString("GroupName"));
+
+  std::map<std::string, GroupInfo> DiagsInGroup;
+  groupDiagnostics(Diags, DiagGroups, DiagsInGroup);
 
   DiagCategoryIDMap CategoryIDs(Records);
   DiagGroupParentMap DGParentMap(Records);
@@ -174,10 +201,10 @@
     // Warning associated with the diagnostic. This is stored as an index into
     // the alphabetically sorted warning table.
     if (DefInit *DI = dynamic_cast<DefInit*>(R.getValueInit("Group"))) {
-      std::set<std::string>::iterator I =
-        WarningOpts.find(DI->getDef()->getValueAsString("GroupName"));
-      assert(I != WarningOpts.end());
-      OS << ", " << std::distance(WarningOpts.begin(), I);
+      std::map<std::string, GroupInfo>::iterator I =
+          DiagsInGroup.find(DI->getDef()->getValueAsString("GroupName"));
+      assert(I != DiagsInGroup.end());
+      OS << ", " << I->second.IDNo;
     } else {
       OS << ", 0";
     }
@@ -229,50 +256,18 @@
   return enumName.str();
 }
 
-namespace {
-struct GroupInfo {
-  std::vector<const Record*> DiagsInGroup;
-  std::vector<std::string> SubGroups;
-  unsigned IDNo;
-};
-} // end anonymous namespace.
-
 void ClangDiagGroupsEmitter::run(raw_ostream &OS) {
   // Compute a mapping from a DiagGroup to all of its parents.
   DiagGroupParentMap DGParentMap(Records);
   
-  // Invert the 1-[0/1] mapping of diags to group into a one to many mapping of
-  // groups to diags in the group.
-  std::map<std::string, GroupInfo> DiagsInGroup;
-  
   std::vector<Record*> Diags =
     Records.getAllDerivedDefinitions("Diagnostic");
-  for (unsigned i = 0, e = Diags.size(); i != e; ++i) {
-    const Record *R = Diags[i];
-    DefInit *DI = dynamic_cast<DefInit*>(R->getValueInit("Group"));
-    if (DI == 0) continue;
-    std::string GroupName = DI->getDef()->getValueAsString("GroupName");
-    DiagsInGroup[GroupName].DiagsInGroup.push_back(R);
-  }
   
-  // Add all DiagGroup's to the DiagsInGroup list to make sure we pick up empty
-  // groups (these are warnings that GCC supports that clang never produces).
   std::vector<Record*> DiagGroups
     = Records.getAllDerivedDefinitions("DiagGroup");
-  for (unsigned i = 0, e = DiagGroups.size(); i != e; ++i) {
-    Record *Group = DiagGroups[i];
-    GroupInfo &GI = DiagsInGroup[Group->getValueAsString("GroupName")];
-    
-    std::vector<Record*> SubGroups = Group->getValueAsListOfDefs("SubGroups");
-    for (unsigned j = 0, e = SubGroups.size(); j != e; ++j)
-      GI.SubGroups.push_back(SubGroups[j]->getValueAsString("GroupName"));
-  }
-  
-  // Assign unique ID numbers to the groups.
-  unsigned IDNo = 0;
-  for (std::map<std::string, GroupInfo>::iterator
-       I = DiagsInGroup.begin(), E = DiagsInGroup.end(); I != E; ++I, ++IDNo)
-    I->second.IDNo = IDNo;
+
+  std::map<std::string, GroupInfo> DiagsInGroup;
+  groupDiagnostics(Diags, DiagGroups, DiagsInGroup);
   
   // Walk through the groups emitting an array for each diagnostic of the diags
   // that are mapped to.

Modified: cfe/branches/tooling/www/cxx_status.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/www/cxx_status.html?rev=152118&r1=152117&r2=152118&view=diff
==============================================================================
--- cfe/branches/tooling/www/cxx_status.html (original)
+++ cfe/branches/tooling/www/cxx_status.html Tue Mar  6 07:07:43 2012
@@ -249,7 +249,7 @@
     <tr>
       <td>Unrestricted unions</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf">N2544</a></td>
-      <td class="none" align="center">No</td>
+      <td class="svn" align="center">SVN</td>
     </tr>
     <tr>
       <td>Local and unnamed types as template arguments</td>





More information about the llvm-branch-commits mailing list