[llvm-branch-commits] [cfe-branch] r157942 - in /cfe/branches/tooling: ./ docs/ include/clang-c/ include/clang/AST/ include/clang/Analysis/ include/clang/Basic/ include/clang/Driver/ include/clang/Frontend/ include/clang/Parse/ include/clang/Sema/ include/clang/StaticAnalyzer/Core/BugReporter/ include/clang/StaticAnalyzer/Core/PathSensitive/ include/clang/Tooling/ lib/ARCMigrate/ lib/AST/ lib/Analysis/ lib/Basic/ lib/CodeGen/ lib/Driver/ lib/Frontend/ lib/Headers/ lib/Lex/ lib/Parse/ lib/Rewrite/ lib/Sema/ lib/StaticAnalyzer/...

Manuel Klimek klimek at google.com
Mon Jun 4 11:40:32 PDT 2012


Author: klimek
Date: Mon Jun  4 13:40:31 2012
New Revision: 157942

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

Added:
    cfe/branches/tooling/lib/Headers/ammintrin.h
      - copied unchanged from r157940, cfe/trunk/lib/Headers/ammintrin.h
    cfe/branches/tooling/lib/Headers/fmaintrin.h
      - copied unchanged from r157940, cfe/trunk/lib/Headers/fmaintrin.h
    cfe/branches/tooling/test/Analysis/engine/
      - copied from r157940, cfe/trunk/test/Analysis/engine/
    cfe/branches/tooling/test/Analysis/engine/replay-without-inlining.c
      - copied unchanged from r157940, cfe/trunk/test/Analysis/engine/replay-without-inlining.c
    cfe/branches/tooling/test/CodeGen/fma-builtins.c
      - copied unchanged from r157940, cfe/trunk/test/CodeGen/fma-builtins.c
    cfe/branches/tooling/test/CodeGen/pclmul-builtins.c
      - copied unchanged from r157940, cfe/trunk/test/CodeGen/pclmul-builtins.c
    cfe/branches/tooling/test/CodeGen/sse4a-builtins.c
      - copied unchanged from r157940, cfe/trunk/test/CodeGen/sse4a-builtins.c
    cfe/branches/tooling/test/CodeGenObjC/getter-property-type-mismatch.m
      - copied unchanged from r157940, cfe/trunk/test/CodeGenObjC/getter-property-type-mismatch.m
    cfe/branches/tooling/test/Driver/Inputs/montavista_i686_tree/
      - copied from r157940, cfe/trunk/test/Driver/Inputs/montavista_i686_tree/
    cfe/branches/tooling/test/Driver/Inputs/montavista_i686_tree/usr/
      - copied from r157940, cfe/trunk/test/Driver/Inputs/montavista_i686_tree/usr/
    cfe/branches/tooling/test/Driver/Inputs/montavista_i686_tree/usr/lib/
      - copied from r157940, cfe/trunk/test/Driver/Inputs/montavista_i686_tree/usr/lib/
    cfe/branches/tooling/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/
      - copied from r157940, cfe/trunk/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/
    cfe/branches/tooling/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/
      - copied from r157940, cfe/trunk/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/
    cfe/branches/tooling/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/
      - copied from r157940, cfe/trunk/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/
    cfe/branches/tooling/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/crtbegin.o
      - copied unchanged from r157940, cfe/trunk/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/crtbegin.o
    cfe/branches/tooling/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/libgcc.a
      - copied unchanged from r157940, cfe/trunk/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/libgcc.a
    cfe/branches/tooling/test/Driver/montavista-gcc-toolchain.c
      - copied unchanged from r157940, cfe/trunk/test/Driver/montavista-gcc-toolchain.c
    cfe/branches/tooling/test/FixIt/format-no-fixit.m
      - copied unchanged from r157940, cfe/trunk/test/FixIt/format-no-fixit.m
    cfe/branches/tooling/test/FixIt/format.m
      - copied unchanged from r157940, cfe/trunk/test/FixIt/format.m
    cfe/branches/tooling/test/Index/create-tu-fail.c
      - copied unchanged from r157940, cfe/trunk/test/Index/create-tu-fail.c
    cfe/branches/tooling/test/Misc/warning-flags-enabled.c
      - copied unchanged from r157940, cfe/trunk/test/Misc/warning-flags-enabled.c
    cfe/branches/tooling/test/SemaCXX/anonymous-union-cxx11.cpp
      - copied unchanged from r157940, cfe/trunk/test/SemaCXX/anonymous-union-cxx11.cpp
    cfe/branches/tooling/test/SemaCXX/switch-implicit-fallthrough-per-method.cpp
      - copied unchanged from r157940, cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-per-method.cpp
    cfe/branches/tooling/test/SemaCXX/warn-unique-enum.cpp
      - copied unchanged from r157940, cfe/trunk/test/SemaCXX/warn-unique-enum.cpp
    cfe/branches/tooling/tools/diagtool/DiagnosticNames.cpp
      - copied unchanged from r157940, cfe/trunk/tools/diagtool/DiagnosticNames.cpp
    cfe/branches/tooling/tools/diagtool/DiagnosticNames.h
      - copied unchanged from r157940, cfe/trunk/tools/diagtool/DiagnosticNames.h
    cfe/branches/tooling/tools/diagtool/ShowEnabledWarnings.cpp
      - copied unchanged from r157940, cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp
Modified:
    cfe/branches/tooling/   (props changed)
    cfe/branches/tooling/docs/AutomaticReferenceCounting.html
    cfe/branches/tooling/docs/ThreadSanitizer.html
    cfe/branches/tooling/docs/Tooling.html
    cfe/branches/tooling/docs/UsersManual.html
    cfe/branches/tooling/include/clang-c/Index.h
    cfe/branches/tooling/include/clang/AST/RecursiveASTVisitor.h
    cfe/branches/tooling/include/clang/Analysis/AnalysisContext.h
    cfe/branches/tooling/include/clang/Basic/BuiltinsX86.def
    cfe/branches/tooling/include/clang/Basic/DiagnosticDriverKinds.td
    cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td
    cfe/branches/tooling/include/clang/Basic/DiagnosticParseKinds.td
    cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/branches/tooling/include/clang/Basic/TargetInfo.h
    cfe/branches/tooling/include/clang/Driver/ArgList.h
    cfe/branches/tooling/include/clang/Driver/Driver.h
    cfe/branches/tooling/include/clang/Frontend/TextDiagnostic.h
    cfe/branches/tooling/include/clang/Parse/Parser.h
    cfe/branches/tooling/include/clang/Sema/Sema.h
    cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
    cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
    cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h
    cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
    cfe/branches/tooling/include/clang/Tooling/Refactoring.h
    cfe/branches/tooling/include/clang/Tooling/Tooling.h
    cfe/branches/tooling/lib/ARCMigrate/Internals.h
    cfe/branches/tooling/lib/ARCMigrate/TransUnbridgedCasts.cpp
    cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp
    cfe/branches/tooling/lib/AST/ItaniumMangle.cpp
    cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp
    cfe/branches/tooling/lib/Analysis/PrintfFormatString.cpp
    cfe/branches/tooling/lib/Basic/Targets.cpp
    cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp
    cfe/branches/tooling/lib/CodeGen/CGObjC.cpp
    cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h
    cfe/branches/tooling/lib/Driver/ArgList.cpp
    cfe/branches/tooling/lib/Driver/CMakeLists.txt
    cfe/branches/tooling/lib/Driver/Tools.cpp
    cfe/branches/tooling/lib/Frontend/FrontendAction.cpp
    cfe/branches/tooling/lib/Headers/CMakeLists.txt
    cfe/branches/tooling/lib/Headers/immintrin.h
    cfe/branches/tooling/lib/Headers/wmmintrin.h
    cfe/branches/tooling/lib/Headers/x86intrin.h
    cfe/branches/tooling/lib/Lex/Preprocessor.cpp
    cfe/branches/tooling/lib/Parse/ParseObjc.cpp
    cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp
    cfe/branches/tooling/lib/Rewrite/RewriteObjC.cpp
    cfe/branches/tooling/lib/Sema/AnalysisBasedWarnings.cpp
    cfe/branches/tooling/lib/Sema/SemaChecking.cpp
    cfe/branches/tooling/lib/Sema/SemaDecl.cpp
    cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp
    cfe/branches/tooling/lib/Sema/SemaExpr.cpp
    cfe/branches/tooling/lib/Sema/SemaExprMember.cpp
    cfe/branches/tooling/lib/Sema/SemaExprObjC.cpp
    cfe/branches/tooling/lib/Sema/SemaLookup.cpp
    cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp
    cfe/branches/tooling/lib/Sema/SemaOverload.cpp
    cfe/branches/tooling/lib/Sema/SemaType.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngine.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/MemRegion.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/ProgramState.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/RegionStore.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
    cfe/branches/tooling/lib/Tooling/Refactoring.cpp
    cfe/branches/tooling/lib/Tooling/Tooling.cpp
    cfe/branches/tooling/test/ARCMT/Common.h
    cfe/branches/tooling/test/ARCMT/autoreleases.m.result
    cfe/branches/tooling/test/ARCMT/nonobjc-to-objc-cast.m.result
    cfe/branches/tooling/test/Analysis/blocks.m
    cfe/branches/tooling/test/Analysis/coverage.c
    cfe/branches/tooling/test/Analysis/inline-plist.c
    cfe/branches/tooling/test/Analysis/retain-release.m
    cfe/branches/tooling/test/CodeGen/fma4-builtins.c
    cfe/branches/tooling/test/CodeGenCXX/debug-info-enum-class.cpp
    cfe/branches/tooling/test/Driver/mips-as.c
    cfe/branches/tooling/test/FixIt/fixit-interface-as-param.m
    cfe/branches/tooling/test/Misc/tabstop.c
    cfe/branches/tooling/test/Preprocessor/predefined-arch-macros.c
    cfe/branches/tooling/test/Sema/switch.c
    cfe/branches/tooling/test/Sema/thread-specifier.c
    cfe/branches/tooling/test/SemaCXX/overloaded-builtin-operators.cpp
    cfe/branches/tooling/test/SemaCXX/typo-correction.cpp
    cfe/branches/tooling/test/SemaCXX/warn-memset-bad-sizeof.cpp
    cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp   (props changed)
    cfe/branches/tooling/test/SemaObjC/nsobject-attribute.m
    cfe/branches/tooling/test/SemaObjC/property-impl-misuse.m
    cfe/branches/tooling/test/SemaObjC/property-typecheck-1.m
    cfe/branches/tooling/test/SemaObjC/property-user-setter.m
    cfe/branches/tooling/tools/diagtool/CMakeLists.txt
    cfe/branches/tooling/tools/diagtool/ListWarnings.cpp
    cfe/branches/tooling/tools/diagtool/Makefile
    cfe/branches/tooling/tools/diagtool/diagtool_main.cpp
    cfe/branches/tooling/unittests/Tooling/RecursiveASTVisitorTest.cpp
    cfe/branches/tooling/unittests/Tooling/ToolingTest.cpp
    cfe/branches/tooling/utils/TableGen/NeonEmitter.cpp
    cfe/branches/tooling/utils/analyzer/SATestAdd.py
    cfe/branches/tooling/utils/analyzer/SATestBuild.py
    cfe/branches/tooling/utils/clangVisualizers.txt
    cfe/branches/tooling/www/analyzer/latest_checker.html.incl
    cfe/branches/tooling/www/analyzer/release_notes.html

Propchange: cfe/branches/tooling/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun  4 13:40:31 2012
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:146581-157609
+/cfe/trunk:146581-157940
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/tooling/docs/AutomaticReferenceCounting.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/AutomaticReferenceCounting.html?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/docs/AutomaticReferenceCounting.html (original)
+++ cfe/branches/tooling/docs/AutomaticReferenceCounting.html Mon Jun  4 13:40:31 2012
@@ -1863,7 +1863,7 @@
 same function with both <tt>cf_audited_transfer</tt>
 and <tt>cf_unknown_transfer</tt>.</p>
 
-<p>A pragma is provided to faciliate the mass annotation of interfaces:</p>
+<p>A pragma is provided to facilitate the mass annotation of interfaces:</p>
 
 <pre>#pragma arc_cf_code_audited begin
 ...

Modified: cfe/branches/tooling/docs/ThreadSanitizer.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/ThreadSanitizer.html?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/docs/ThreadSanitizer.html (original)
+++ cfe/branches/tooling/docs/ThreadSanitizer.html Mon Jun  4 13:40:31 2012
@@ -34,7 +34,7 @@
 ThreadSanitizer is a tool that detects data races. <BR>
 It consists of a compiler instrumentation module and a run-time library. <BR>
 Typical slowdown introduced by ThreadSanitizer is <b>5x-15x</b> (TODO: these numbers are
-aproximate so far).
+approximate so far).
 
 <h2 id="howtobuild">How to build</h2>
 Follow the <a href="../get_started.html">clang build instructions</a>. <BR>

Modified: cfe/branches/tooling/docs/Tooling.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/Tooling.html?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/docs/Tooling.html (original)
+++ cfe/branches/tooling/docs/Tooling.html Mon Jun  4 13:40:31 2012
@@ -33,7 +33,7 @@
 <ul>
   <li>want to interface with clang from other languages than C++</li>
   <li>need a stable interface that takes care to be backwards compatible</li>
-  <li>want powerful high-level abstractions, like iterating throught an AST 
+  <li>want powerful high-level abstractions, like iterating through an AST
 with a cursor, and don't want to learn all the nitty gritty details of Clang's 
 AST.</li>
 </ul>

Modified: cfe/branches/tooling/docs/UsersManual.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/UsersManual.html?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/docs/UsersManual.html (original)
+++ cfe/branches/tooling/docs/UsersManual.html Mon Jun  4 13:40:31 2012
@@ -49,6 +49,7 @@
   </li>
   <li><a href="#precompiledheaders">Precompiled Headers</a></li>
   <li><a href="#codegen">Controlling Code Generation</a></li>
+  <li><a href="#debuginfosize">Controlling Size of Debug Information</a></li>
  </ul>
 </li>
 <li><a href="#c">C Language Features</a>
@@ -857,6 +858,29 @@
 handled, or when some custom behavior is desired.</dd>
 </dl>
 
+<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
+<h3 id="debuginfosize">Controlling Size of Debug Information</h3>
+<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
+
+<p>Debug info kind generated by Clang can be set by one of the flags listed
+below. If multiple flags are present, the last one is used.</p>
+
+<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+<dl>
+<dt id="opt_g0"><b>-g0</b>: Don't generate any debug info (default).
+
+<dt id="opt_gline-tables-only"><b>-gline-tables-only</b>:
+Generate line number tables only.
+<dd>
+This kind of debug info allows to obtain stack traces with function
+names, file names and line numbers (by such tools as
+gdb or addr2line). It doesn't contain any other data (e.g.
+description of local variables or function parameters).
+</dd>
+
+<dt id="opt_g"><b>-g</b>: Generate complete debug info.
+</dl>
+
 <!-- ======================================================================= -->
 <h2 id="c">C Language Features</h2>
 <!-- ======================================================================= -->

Modified: cfe/branches/tooling/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang-c/Index.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang-c/Index.h (original)
+++ cfe/branches/tooling/include/clang-c/Index.h Mon Jun  4 13:40:31 2012
@@ -3260,7 +3260,7 @@
  * \param PieceIndex For contiguous names or when passing the flag 
  * CXNameRange_WantSinglePiece, only one piece with index 0 is 
  * available. When the CXNameRange_WantSinglePiece flag is not passed for a
- * non-contiguous names, this index can be used to retreive the individual
+ * non-contiguous names, this index can be used to retrieve the individual
  * pieces of the name. See also CXNameRange_WantSinglePiece.
  *
  * \returns The piece of the name pointed to by the given cursor. If there is no

Modified: cfe/branches/tooling/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/RecursiveASTVisitor.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/branches/tooling/include/clang/AST/RecursiveASTVisitor.h Mon Jun  4 13:40:31 2012
@@ -1486,7 +1486,7 @@
     // D is the "T" in something like
     //   template <template <typename> class T> class container { };
     TRY_TO(TraverseDecl(D->getTemplatedDecl()));
-    if (D->hasDefaultArgument()) {
+    if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited()) {
       TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
     }
     TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
@@ -1496,7 +1496,7 @@
     // D is the "T" in something like "template<typename T> class vector;"
     if (D->getTypeForDecl())
       TRY_TO(TraverseType(QualType(D->getTypeForDecl(), 0)));
-    if (D->hasDefaultArgument())
+    if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
       TRY_TO(TraverseTypeLoc(D->getDefaultArgumentInfo()->getTypeLoc()));
   })
 
@@ -1766,7 +1766,8 @@
 DEF_TRAVERSE_DECL(NonTypeTemplateParmDecl, {
     // A non-type template parameter, e.g. "S" in template<int S> class Foo ...
     TRY_TO(TraverseDeclaratorHelper(D));
-    TRY_TO(TraverseStmt(D->getDefaultArgument()));
+    if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
+      TRY_TO(TraverseStmt(D->getDefaultArgument()));
   })
 
 DEF_TRAVERSE_DECL(ParmVarDecl, {

Modified: cfe/branches/tooling/include/clang/Analysis/AnalysisContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Analysis/AnalysisContext.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Analysis/AnalysisContext.h (original)
+++ cfe/branches/tooling/include/clang/Analysis/AnalysisContext.h Mon Jun  4 13:40:31 2012
@@ -38,6 +38,7 @@
 class ImplicitParamDecl;
 class LocationContextManager;
 class StackFrameContext;
+class BlockInvocationContext;
 class AnalysisDeclContextManager;
 class LocationContext;
 
@@ -162,6 +163,11 @@
                                          const Stmt *S,
                                          const CFGBlock *Blk,
                                          unsigned Idx);
+  
+  const BlockInvocationContext *
+  getBlockInvocationContext(const LocationContext *parent,
+                            const BlockDecl *BD,
+                            const void *ContextData);
 
   /// Return the specified analysis object, lazily running the analysis if
   /// necessary.  Return NULL if the analysis could not run.
@@ -227,8 +233,6 @@
   }
 
   const StackFrameContext *getCurrentStackFrame() const;
-  const StackFrameContext *
-    getStackFrameForDeclContext(const DeclContext *DC) const;
 
   virtual void Profile(llvm::FoldingSetNodeID &ID) = 0;
 
@@ -307,27 +311,32 @@
 };
 
 class BlockInvocationContext : public LocationContext {
-  // FIXME: Add back context-sensivity (we don't want libAnalysis to know
-  //  about MemRegion).
   const BlockDecl *BD;
+  
+  // FIXME: Come up with a more type-safe way to model context-sensitivity.
+  const void *ContextData;
 
   friend class LocationContextManager;
 
   BlockInvocationContext(AnalysisDeclContext *ctx,
                          const LocationContext *parent,
-                         const BlockDecl *bd)
-    : LocationContext(Block, ctx, parent), BD(bd) {}
+                         const BlockDecl *bd, const void *contextData)
+    : LocationContext(Block, ctx, parent), BD(bd), ContextData(contextData) {}
 
 public:
   ~BlockInvocationContext() {}
 
   const BlockDecl *getBlockDecl() const { return BD; }
+  
+  const void *getContextData() const { return ContextData; }
 
   void Profile(llvm::FoldingSetNodeID &ID);
 
   static void Profile(llvm::FoldingSetNodeID &ID, AnalysisDeclContext *ctx,
-                      const LocationContext *parent, const BlockDecl *bd) {
+                      const LocationContext *parent, const BlockDecl *bd,
+                      const void *contextData) {
     ProfileCommon(ID, Block, ctx, parent, bd);
+    ID.AddPointer(contextData);
   }
 
   static bool classof(const LocationContext *Ctx) {
@@ -348,6 +357,12 @@
   const ScopeContext *getScope(AnalysisDeclContext *ctx,
                                const LocationContext *parent,
                                const Stmt *s);
+  
+  const BlockInvocationContext *
+  getBlockInvocationContext(AnalysisDeclContext *ctx,
+                            const LocationContext *parent,
+                            const BlockDecl *BD,
+                            const void *ContextData);
 
   /// Discard all previously created LocationContext objects.
   void clear();
@@ -404,7 +419,6 @@
     return LocContexts.getStackFrame(getContext(D), Parent, S, Blk, Idx);
   }
 
-
   /// Discard all previously created AnalysisDeclContexts.
   void clear();
 

Modified: cfe/branches/tooling/include/clang/Basic/BuiltinsX86.def
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/BuiltinsX86.def?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/branches/tooling/include/clang/Basic/BuiltinsX86.def Mon Jun  4 13:40:31 2012
@@ -369,6 +369,14 @@
 BUILTIN(__builtin_ia32_crc32si, "UiUiUi", "")
 BUILTIN(__builtin_ia32_crc32di, "ULLiULLiULLi", "")
 
+// SSE4a
+BUILTIN(__builtin_ia32_extrqi, "V2LLiV2LLiIcIc", "")
+BUILTIN(__builtin_ia32_extrq, "V2LLiV2LLiV16c", "")
+BUILTIN(__builtin_ia32_insertqi, "V2LLiV2LLiV2LLiIcIc", "")
+BUILTIN(__builtin_ia32_insertq, "V2LLiV2LLiV2LLi", "")
+BUILTIN(__builtin_ia32_movntsd, "vd*V2d", "")
+BUILTIN(__builtin_ia32_movntss, "vf*V4f", "")
+
 // AES
 BUILTIN(__builtin_ia32_aesenc128, "V2LLiV2LLiV2LLi", "")
 BUILTIN(__builtin_ia32_aesenclast128, "V2LLiV2LLiV2LLi", "")
@@ -377,6 +385,9 @@
 BUILTIN(__builtin_ia32_aesimc128, "V2LLiV2LLi", "")
 BUILTIN(__builtin_ia32_aeskeygenassist128, "V2LLiV2LLiIc", "")
 
+// CLMUL
+BUILTIN(__builtin_ia32_pclmulqdq128, "V2LLiV2LLiV2LLiIc", "")
+
 // AVX
 BUILTIN(__builtin_ia32_addsubpd256, "V4dV4dV4d", "")
 BUILTIN(__builtin_ia32_addsubps256, "V8fV8fV8f", "")

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticDriverKinds.td Mon Jun  4 13:40:31 2012
@@ -97,6 +97,8 @@
   "-fobjc-arc is not supported on current deployment target">;
 def err_drv_mg_requires_m_or_mm : Error<
   "option '-MG' requires '-M' or '-MM'">;
+def err_drv_asan_android_requires_pie : Error<
+  "AddressSanitizer on Android requires '-pie'">;
 
 def warn_c_kext : Warning<
   "ignoring -fapple-kext which is valid for c++ and objective-c++ only">;

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td Mon Jun  4 13:40:31 2012
@@ -209,7 +209,9 @@
 def CoveredSwitchDefault : DiagGroup<"covered-switch-default">;
 def SwitchEnum     : DiagGroup<"switch-enum">;
 def Switch         : DiagGroup<"switch">;
-def ImplicitFallthrough  : DiagGroup<"implicit-fallthrough">;
+def ImplicitFallthroughPerMethod : DiagGroup<"implicit-fallthrough-per-method">;
+def ImplicitFallthrough  : DiagGroup<"implicit-fallthrough",
+                                     [ImplicitFallthroughPerMethod]>;
 def Trigraphs      : DiagGroup<"trigraphs">;
 
 def : DiagGroup<"type-limits">;

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticParseKinds.td Mon Jun  4 13:40:31 2012
@@ -37,7 +37,7 @@
   "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
 def ext_integer_complex : Extension<
   "complex integer types are an extension">;
-def ext_thread_before : Extension<"'__thread' before 'static'">;
+def ext_thread_before : Extension<"'__thread' before '%0'">;
 
 def ext_empty_struct_union : Extension<
   "empty %select{struct|union}0 is a GNU extension">, InGroup<GNU>;

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td Mon Jun  4 13:40:31 2012
@@ -20,6 +20,10 @@
   "used in loop condition not modified in loop body">,
   InGroup<DiagGroup<"loop-analysis">>, DefaultIgnore;
 
+def warn_identical_enum_values : Warning<
+  "all elements of %0 are initialized with literals to value %1">,
+  InGroup<DiagGroup<"unique-enum">>;
+
 // Constant expressions
 def err_expr_not_ice : Error<
   "expression is not an %select{integer|integral}0 constant expression">;
@@ -331,10 +335,14 @@
 def note_bad_memaccess_silence : Note<
   "explicitly cast the pointer to silence this warning">;
 def warn_sizeof_pointer_expr_memaccess : Warning<
-  "argument to 'sizeof' in %0 call is the same expression as the "
-  "%select{destination|source}1; did you mean to "
-  "%select{dereference it|remove the addressof|provide an explicit length}2?">,
+  "'%0' call operates on objects of type %1 while the size is based on a " 
+  "different type %2">, 
   InGroup<DiagGroup<"sizeof-pointer-memaccess">>;
+def warn_sizeof_pointer_expr_memaccess_note : Note<
+  "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
+  "it by the number of elements)|remove the addressof in the argument to "
+  "'sizeof' (and multiply it by the number of elements)|provide an explicit "
+  "length}0?">;
 def warn_sizeof_pointer_type_memaccess : Warning<
   "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
   "%select{destination|source}2; expected %3 or an explicit length">,
@@ -5289,6 +5297,9 @@
 def warn_unannotated_fallthrough : Warning<
   "unannotated fall-through between switch labels">,
   InGroup<ImplicitFallthrough>, DefaultIgnore;
+def warn_unannotated_fallthrough_per_method : Warning<
+  "unannotated fall-through between switch labels in partly annotated method">,
+  InGroup<ImplicitFallthroughPerMethod>, DefaultIgnore;
 def note_insert_fallthrough_fixit : Note<
   "insert '[[clang::fallthrough]];' to silence this warning">;
 def note_insert_break_fixit : Note<

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/TargetInfo.h (original)
+++ cfe/branches/tooling/include/clang/Basic/TargetInfo.h Mon Jun  4 13:40:31 2012
@@ -501,7 +501,7 @@
   /// something like "default" (meaning that the symbol is visible
   /// outside this shared object) and "hidden" (meaning that it isn't)
   /// visibilities, but "protected" is really an ELF-specific concept
-  /// with wierd semantics designed around the convenience of dynamic
+  /// with weird semantics designed around the convenience of dynamic
   /// linker implementations.  Which is not to suggest that there's
   /// consistent target-independent semantics for "default" visibility
   /// either; the entire thing is pretty badly mangled.

Modified: cfe/branches/tooling/include/clang/Driver/ArgList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Driver/ArgList.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Driver/ArgList.h (original)
+++ cfe/branches/tooling/include/clang/Driver/ArgList.h Mon Jun  4 13:40:31 2012
@@ -187,6 +187,14 @@
                     OptSpecifier Id3) const;
     Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2,
                     OptSpecifier Id3, OptSpecifier Id4) const;
+    Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2,
+                    OptSpecifier Id3, OptSpecifier Id4, OptSpecifier Id5) const;
+    Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2,
+                    OptSpecifier Id3, OptSpecifier Id4, OptSpecifier Id5,
+                    OptSpecifier Id6) const;
+    Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2,
+                    OptSpecifier Id3, OptSpecifier Id4, OptSpecifier Id5,
+                    OptSpecifier Id6, OptSpecifier Id7) const;
 
     /// getArgString - Return the input argument string at \arg Index.
     virtual const char *getArgString(unsigned Index) const = 0;

Modified: cfe/branches/tooling/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Driver/Driver.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Driver/Driver.h (original)
+++ cfe/branches/tooling/include/clang/Driver/Driver.h Mon Jun  4 13:40:31 2012
@@ -177,7 +177,7 @@
   /// \brief Cache of all the ToolChains in use by the driver.
   ///
   /// This maps from the string representation of a triple to a ToolChain
-  /// created targetting that triple. The driver owns all the ToolChain objects
+  /// created targeting that triple. The driver owns all the ToolChain objects
   /// stored in it, and will clean them up when torn down.
   mutable llvm::StringMap<ToolChain *> ToolChains;
 

Modified: cfe/branches/tooling/include/clang/Frontend/TextDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/TextDiagnostic.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/TextDiagnostic.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/TextDiagnostic.h Mon Jun  4 13:40:31 2012
@@ -59,7 +59,7 @@
   ///
   /// This is a static helper to handle the line wrapping, colorizing, and
   /// rendering of a diagnostic message to a particular ostream. It is
-  /// publically visible so that clients which do not have sufficient state to
+  /// publicly visible so that clients which do not have sufficient state to
   /// build a complete TextDiagnostic object can still get consistent
   /// formatting of their diagnostic messages.
   ///

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Parse/Parser.h (original)
+++ cfe/branches/tooling/include/clang/Parse/Parser.h Mon Jun  4 13:40:31 2012
@@ -455,7 +455,7 @@
       }
     }
     
-    enum { MaxDepth = 512 };
+    enum { MaxDepth = 256 };
     
     bool diagnoseOverflow();
     bool diagnoseMissingClose();

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/Sema.h (original)
+++ cfe/branches/tooling/include/clang/Sema/Sema.h Mon Jun  4 13:40:31 2012
@@ -2107,6 +2107,7 @@
   LiteralOperatorLookupResult LookupLiteralOperator(Scope *S, LookupResult &R,
                                                     ArrayRef<QualType> ArgTys,
                                                     bool AllowRawAndTemplate);
+  bool isKnownName(StringRef name);
 
   void ArgumentDependentLookup(DeclarationName Name, bool Operator,
                                SourceLocation Loc,
@@ -2691,7 +2692,7 @@
   /// this variable in the innermost block or lambda. Only valid when the
   /// variable can be captured.
   ///
-  /// \param DeclRefType Will be set to the type of a refernce to the capture
+  /// \param DeclRefType Will be set to the type of a reference to the capture
   /// from within the current scope. Only valid when the variable can be 
   /// captured.
   ///

Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Mon Jun  4 13:40:31 2012
@@ -101,20 +101,27 @@
   /// Used for clients to tell if the report's configuration has changed
   /// since the last time they checked.
   unsigned ConfigurationChangeToken;
+  
+  /// When set, this flag disables all callstack pruning from a diagnostic
+  /// path.  This is useful for some reports that want maximum fidelty
+  /// when reporting an issue.
+  bool DoNotPrunePath;
 
 public:
   BugReport(BugType& bt, StringRef desc, const ExplodedNode *errornode)
     : BT(bt), DeclWithIssue(0), Description(desc), ErrorNode(errornode),
-      ConfigurationChangeToken(0) {}
+      ConfigurationChangeToken(0), DoNotPrunePath(false) {}
 
   BugReport(BugType& bt, StringRef shortDesc, StringRef desc,
             const ExplodedNode *errornode)
     : BT(bt), DeclWithIssue(0), ShortDescription(shortDesc), Description(desc),
-      ErrorNode(errornode), ConfigurationChangeToken(0) {}
+      ErrorNode(errornode), ConfigurationChangeToken(0),
+      DoNotPrunePath(false) {}
 
   BugReport(BugType& bt, StringRef desc, PathDiagnosticLocation l)
     : BT(bt), DeclWithIssue(0), Description(desc), Location(l), ErrorNode(0),
-      ConfigurationChangeToken(0) {}
+      ConfigurationChangeToken(0),
+      DoNotPrunePath(false) {}
 
   /// \brief Create a BugReport with a custom uniqueing location.
   ///
@@ -142,6 +149,13 @@
     return ShortDescription.empty() ? Description : ShortDescription;
   }
 
+  /// Indicates whether or not any path pruning should take place
+  /// when generating a PathDiagnostic from this BugReport.
+  bool shouldPrunePath() const { return !DoNotPrunePath; }
+
+  /// Disable all path pruning when generating a PathDiagnostic.
+  void disablePathPruning() { DoNotPrunePath = true; }
+  
   void markInteresting(SymbolRef sym);
   void markInteresting(const MemRegion *R);
   void markInteresting(SVal V);

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h Mon Jun  4 13:40:31 2012
@@ -494,7 +494,7 @@
                     ProgramStateRef St, SVal location,
                     const ProgramPointTag *tag, bool isLoad);
 
-  bool shouldInlineDecl(const FunctionDecl *FD, ExplodedNode *Pred);
+  bool shouldInlineDecl(const Decl *D, ExplodedNode *Pred);
   bool InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE, ExplodedNode *Pred);
 
   bool replayWithoutInlining(ExplodedNode *P, const LocationContext *CalleeLC);

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h Mon Jun  4 13:40:31 2012
@@ -281,6 +281,11 @@
   // 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);
+
+  // Check if this kind of expression can be inlined by the analyzer.
+  static bool canBeInlined(const Stmt *S) {
+    return isa<CallExpr>(S);
+  }
 };
 
 }

Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h Mon Jun  4 13:40:31 2012
@@ -572,7 +572,7 @@
 
   RegionSetTy RegionRoots;
   
-  const LocationContext *LCtx;
+  const StackFrameContext *LCtx;
   const Stmt *Loc;
   SymbolManager& SymMgr;
   StoreRef reapedStore;
@@ -586,7 +586,8 @@
   /// considered live.
   SymbolReaper(const LocationContext *ctx, const Stmt *s, SymbolManager& symmgr,
                StoreManager &storeMgr)
-   : LCtx(ctx), Loc(s), SymMgr(symmgr), reapedStore(0, storeMgr) {}
+   : LCtx(ctx->getCurrentStackFrame()), Loc(s), SymMgr(symmgr),
+     reapedStore(0, storeMgr) {}
 
   ~SymbolReaper() {}
 

Modified: cfe/branches/tooling/include/clang/Tooling/Refactoring.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Tooling/Refactoring.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Tooling/Refactoring.h (original)
+++ cfe/branches/tooling/include/clang/Tooling/Refactoring.h Mon Jun  4 13:40:31 2012
@@ -16,6 +16,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+#ifndef LLVM_CLANG_TOOLING_REFACTORING_H
+#define LLVM_CLANG_TOOLING_REFACTORING_H
+
 #include "llvm/ADT/StringRef.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Tooling/Tooling.h"
@@ -76,6 +79,9 @@
   /// \brief Applies the replacement on the Rewriter.
   bool apply(Rewriter &Rewrite) const;
 
+  /// \brief Returns a human readable string representation.
+  std::string toString() const;
+
   /// \brief Comparator to be able to use Replacement in std::set for uniquing.
   class Less {
   public:
@@ -140,3 +146,6 @@
 
 } // end namespace tooling
 } // end namespace clang
+
+#endif // end namespace LLVM_CLANG_TOOLING_REFACTORING_H
+

Modified: cfe/branches/tooling/include/clang/Tooling/Tooling.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Tooling/Tooling.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Tooling/Tooling.h (original)
+++ cfe/branches/tooling/include/clang/Tooling/Tooling.h Mon Jun  4 13:40:31 2012
@@ -126,8 +126,7 @@
   bool runInvocation(const char *BinaryName,
                      clang::driver::Compilation *Compilation,
                      clang::CompilerInvocation *Invocation,
-                     const clang::driver::ArgStringList &CC1Args,
-                     clang::FrontendAction *ToolAction);
+                     const clang::driver::ArgStringList &CC1Args);
 
   std::vector<std::string> CommandLine;
   llvm::OwningPtr<FrontendAction> ToolAction;

Modified: cfe/branches/tooling/lib/ARCMigrate/Internals.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/Internals.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/Internals.h (original)
+++ cfe/branches/tooling/lib/ARCMigrate/Internals.h Mon Jun  4 13:40:31 2012
@@ -12,6 +12,7 @@
 
 #include "clang/ARCMigrate/ARCMT.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Optional.h"
 
 namespace clang {
   class Sema;
@@ -144,6 +145,7 @@
   Sema &SemaRef;
   TransformActions &TA;
   std::vector<SourceLocation> &ARCMTMacroLocs;
+  llvm::Optional<bool> EnableCFBridgeFns;
 
   MigrationPass(ASTContext &Ctx, LangOptions::GCMode OrigGCMode,
                 Sema &sema, TransformActions &TA,
@@ -157,6 +159,8 @@
   void setNSAllocReallocError(bool val) { MigOptions.NoNSAllocReallocError = val; }
   bool noFinalizeRemoval() const { return MigOptions.NoFinalizeRemoval; }
   void setNoFinalizeRemoval(bool val) {MigOptions.NoFinalizeRemoval = val; }
+
+  bool CFBridgingFunctionsDefined();
 };
 
 static inline StringRef getARCMTMacroName() {

Modified: cfe/branches/tooling/lib/ARCMigrate/TransUnbridgedCasts.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransUnbridgedCasts.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransUnbridgedCasts.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransUnbridgedCasts.cpp Mon Jun  4 13:40:31 2012
@@ -12,7 +12,7 @@
 // A cast of non-objc pointer to an objc one is checked. If the non-objc pointer
 // is from a file-level variable, __bridge cast is used to convert it.
 // For the result of a function call that we know is +1/+0,
-// __bridge/__bridge_transfer is used.
+// __bridge/CFBridgingRelease is used.
 //
 //  NSString *str = (NSString *)kUTTypePlainText;
 //  str = b ? kUTTypeRTF : kUTTypePlainText;
@@ -21,8 +21,8 @@
 // ---->
 //  NSString *str = (__bridge NSString *)kUTTypePlainText;
 //  str = (__bridge NSString *)(b ? kUTTypeRTF : kUTTypePlainText);
-// NSString *_uuidString = (__bridge_transfer NSString *)
-//                               CFUUIDCreateString(kCFAllocatorDefault, _uuid);
+// NSString *_uuidString = (NSString *)
+//            CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, _uuid));
 //
 // For a C pointer to ObjC, for casting 'self', __bridge is used.
 //
@@ -191,22 +191,42 @@
     TA.clearDiagnostic(diag::err_arc_mismatched_cast,
                        diag::err_arc_cast_requires_bridge,
                        E->getLocStart());
-    if (CStyleCastExpr *CCE = dyn_cast<CStyleCastExpr>(E)) {
-      TA.insertAfterToken(CCE->getLParenLoc(), bridge);
-    } else {
-      SourceLocation insertLoc = E->getSubExpr()->getLocStart();
-      SmallString<128> newCast;
-      newCast += '(';
-      newCast += bridge;
-      newCast += E->getType().getAsString(Pass.Ctx.getPrintingPolicy());
-      newCast += ')';
-
-      if (isa<ParenExpr>(E->getSubExpr())) {
-        TA.insert(insertLoc, newCast.str());
+    if (Kind == OBC_Bridge || !Pass.CFBridgingFunctionsDefined()) {
+      if (CStyleCastExpr *CCE = dyn_cast<CStyleCastExpr>(E)) {
+        TA.insertAfterToken(CCE->getLParenLoc(), bridge);
       } else {
+        SourceLocation insertLoc = E->getSubExpr()->getLocStart();
+        SmallString<128> newCast;
         newCast += '(';
-        TA.insert(insertLoc, newCast.str());
-        TA.insertAfterToken(E->getLocEnd(), ")");
+        newCast += bridge;
+        newCast += E->getType().getAsString(Pass.Ctx.getPrintingPolicy());
+        newCast += ')';
+
+        if (isa<ParenExpr>(E->getSubExpr())) {
+          TA.insert(insertLoc, newCast.str());
+        } else {
+          newCast += '(';
+          TA.insert(insertLoc, newCast.str());
+          TA.insertAfterToken(E->getLocEnd(), ")");
+        }
+      }
+    } else {
+      assert(Kind == OBC_BridgeTransfer || Kind == OBC_BridgeRetained);
+      StringRef cfBridging;
+      if (Kind == OBC_BridgeTransfer)
+        cfBridging = "CFBridgingRelease";
+      else
+        cfBridging = "CFBridgingRetain";
+
+      Expr *WrapE = E->getSubExpr();
+      SourceLocation insertLoc = WrapE->getLocStart();
+      if (isa<ParenExpr>(WrapE)) {
+        TA.insert(insertLoc, cfBridging);
+      } else {
+        std::string withParens = cfBridging;
+        withParens += '(';
+        TA.insert(insertLoc, withParens);
+        TA.insertAfterToken(WrapE->getLocEnd(), ")");
       }
     }
   }

Modified: cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp Mon Jun  4 13:40:31 2012
@@ -10,6 +10,7 @@
 #include "Transforms.h"
 #include "Internals.h"
 #include "clang/Sema/SemaDiagnostic.h"
+#include "clang/Sema/Sema.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/Lex/Lexer.h"
@@ -25,6 +26,13 @@
 
 ASTTraverser::~ASTTraverser() { }
 
+bool MigrationPass::CFBridgingFunctionsDefined() {
+  if (!EnableCFBridgeFns.hasValue())
+    EnableCFBridgeFns = SemaRef.isKnownName("CFBridgingRetain") &&
+                        SemaRef.isKnownName("CFBridgingRelease");
+  return *EnableCFBridgeFns;
+}
+
 //===----------------------------------------------------------------------===//
 // Helpers.
 //===----------------------------------------------------------------------===//

Modified: cfe/branches/tooling/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ItaniumMangle.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/branches/tooling/lib/AST/ItaniumMangle.cpp Mon Jun  4 13:40:31 2012
@@ -657,7 +657,7 @@
   // mistake; see the discussion on cxx-abi-dev beginning on
   // 2012-01-16.
 
-  // Our requirements here are just barely wierd enough to justify
+  // Our requirements here are just barely weird enough to justify
   // using a custom algorithm instead of post-processing APInt::toString().
 
   llvm::APInt valueBits = f.bitcastToAPInt();
@@ -2992,7 +2992,7 @@
 
   // Top-level qualifiers.  We don't have to worry about arrays here,
   // because parameters declared as arrays should already have been
-  // tranformed to have pointer type. FIXME: apparently these don't
+  // transformed to have pointer type. FIXME: apparently these don't
   // get mangled if used as an rvalue of a known non-class type?
   assert(!parm->getType()->isArrayType()
          && "parameter's type is still an array type?");

Modified: cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp (original)
+++ cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp Mon Jun  4 13:40:31 2012
@@ -204,6 +204,14 @@
   return getLocationContextManager().getStackFrame(this, Parent, S, Blk, Idx);
 }
 
+const BlockInvocationContext *
+AnalysisDeclContext::getBlockInvocationContext(const LocationContext *parent,
+                                               const clang::BlockDecl *BD,
+                                               const void *ContextData) {
+  return getLocationContextManager().getBlockInvocationContext(this, parent,
+                                                               BD, ContextData);
+}
+
 LocationContextManager & AnalysisDeclContext::getLocationContextManager() {
   assert(Manager &&
          "Cannot create LocationContexts without an AnalysisDeclContextManager!");
@@ -234,7 +242,7 @@
 }
 
 void BlockInvocationContext::Profile(llvm::FoldingSetNodeID &ID) {
-  Profile(ID, getAnalysisDeclContext(), getParent(), BD);
+  Profile(ID, getAnalysisDeclContext(), getParent(), BD, ContextData);
 }
 
 //===----------------------------------------------------------------------===//
@@ -283,6 +291,24 @@
   return getLocationContext<ScopeContext, Stmt>(ctx, parent, s);
 }
 
+const BlockInvocationContext *
+LocationContextManager::getBlockInvocationContext(AnalysisDeclContext *ctx,
+                                                  const LocationContext *parent,
+                                                  const BlockDecl *BD,
+                                                  const void *ContextData) {
+  llvm::FoldingSetNodeID ID;
+  BlockInvocationContext::Profile(ID, ctx, parent, BD, ContextData);
+  void *InsertPos;
+  BlockInvocationContext *L =
+    cast_or_null<BlockInvocationContext>(Contexts.FindNodeOrInsertPos(ID,
+                                                                    InsertPos));
+  if (!L) {
+    L = new BlockInvocationContext(ctx, parent, BD, ContextData);
+    Contexts.InsertNode(L, InsertPos);
+  }
+  return L;
+}
+
 //===----------------------------------------------------------------------===//
 // LocationContext methods.
 //===----------------------------------------------------------------------===//
@@ -297,19 +323,6 @@
   return NULL;
 }
 
-const StackFrameContext *
-LocationContext::getStackFrameForDeclContext(const DeclContext *DC) const {
-  const LocationContext *LC = this;
-  while (LC) {
-    if (const StackFrameContext *SFC = dyn_cast<StackFrameContext>(LC)) {
-      if (cast<DeclContext>(SFC->getDecl()) == DC)
-        return SFC;
-    }
-    LC = LC->getParent();
-  }
-  return NULL;
-}
-
 bool LocationContext::isParentOf(const LocationContext *LC) const {
   do {
     const LocationContext *Parent = LC->getParent();

Modified: cfe/branches/tooling/lib/Analysis/PrintfFormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Analysis/PrintfFormatString.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Analysis/PrintfFormatString.cpp (original)
+++ cfe/branches/tooling/lib/Analysis/PrintfFormatString.cpp Mon Jun  4 13:40:31 2012
@@ -342,7 +342,29 @@
 
 bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt,
                               ASTContext &Ctx, bool IsObjCLiteral) {
-  // Handle strings first (char *, wchar_t *)
+  // Handle Objective-C objects first. Note that while the '%@' specifier will
+  // not warn for structure pointer or void pointer arguments (because that's
+  // how CoreFoundation objects are implemented), we only show a fixit for '%@'
+  // if we know it's an object (block, id, class, or __attribute__((NSObject))).
+  if (QT->isObjCRetainableType()) {
+    if (!IsObjCLiteral)
+      return false;
+
+    CS.setKind(ConversionSpecifier::ObjCObjArg);
+
+    // Disable irrelevant flags
+    HasThousandsGrouping = false;
+    HasPlusPrefix = false;
+    HasSpacePrefix = false;
+    HasAlternativeForm = false;
+    HasLeadingZeroes = false;
+    Precision.setHowSpecified(OptionalAmount::NotSpecified);
+    LM.setKind(LengthModifier::None);
+
+    return true;
+  }
+
+  // Handle strings next (char *, wchar_t *)
   if (QT->isPointerType() && (QT->getPointeeType()->isAnyCharacterType())) {
     CS.setKind(ConversionSpecifier::sArg);
 

Modified: cfe/branches/tooling/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/Targets.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/Targets.cpp (original)
+++ cfe/branches/tooling/lib/Basic/Targets.cpp Mon Jun  4 13:40:31 2012
@@ -1238,11 +1238,14 @@
   } MMX3DNowLevel;
 
   bool HasAES;
+  bool HasPCLMUL;
   bool HasLZCNT;
   bool HasBMI;
   bool HasBMI2;
   bool HasPOPCNT;
+  bool HasSSE4a;
   bool HasFMA4;
+  bool HasFMA;
 
   /// \brief Enumeration of all of the X86 CPUs supported by Clang.
   ///
@@ -1387,8 +1390,9 @@
 public:
   X86TargetInfo(const std::string& triple)
     : TargetInfo(triple), SSELevel(NoSSE), MMX3DNowLevel(NoMMX3DNow),
-      HasAES(false), HasLZCNT(false), HasBMI(false), HasBMI2(false),
-      HasPOPCNT(false), HasFMA4(false), CPU(CK_Generic) {
+      HasAES(false), HasPCLMUL(false), HasLZCNT(false), HasBMI(false),
+      HasBMI2(false), HasPOPCNT(false), HasSSE4a(false), HasFMA4(false),
+      HasFMA(false), CPU(CK_Generic) {
     BigEndian = false;
     LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
   }
@@ -1570,6 +1574,7 @@
   Features["sse42"] = false;
   Features["sse4a"] = false;
   Features["aes"] = false;
+  Features["pclmul"] = false;
   Features["avx"] = false;
   Features["avx2"] = false;
   Features["lzcnt"] = false;
@@ -1577,6 +1582,7 @@
   Features["bmi2"] = false;
   Features["popcnt"] = false;
   Features["fma4"] = false;
+  Features["fma"] = false;
 
   // FIXME: This *really* should not be here.
 
@@ -1630,21 +1636,23 @@
   case CK_Corei7:
     setFeatureEnabled(Features, "mmx", true);
     setFeatureEnabled(Features, "sse4", true);
-    setFeatureEnabled(Features, "aes", true);
     break;
   case CK_Corei7AVX:
   case CK_CoreAVXi:
     setFeatureEnabled(Features, "mmx", true);
     setFeatureEnabled(Features, "avx", true);
     setFeatureEnabled(Features, "aes", true);
+    setFeatureEnabled(Features, "pclmul", true);
     break;
   case CK_CoreAVX2:
     setFeatureEnabled(Features, "mmx", true);
     setFeatureEnabled(Features, "avx2", true);
     setFeatureEnabled(Features, "aes", true);
+    setFeatureEnabled(Features, "pclmul", true);
     setFeatureEnabled(Features, "lzcnt", true);
     setFeatureEnabled(Features, "bmi", true);
     setFeatureEnabled(Features, "bmi2", true);
+    setFeatureEnabled(Features, "fma", true);
     break;
   case CK_K6:
   case CK_WinChipC6:
@@ -1688,11 +1696,13 @@
   case CK_BTVER1:
     setFeatureEnabled(Features, "ssse3", true);
     setFeatureEnabled(Features, "sse4a", true);
+    break;
   case CK_BDVER1:
   case CK_BDVER2:
     setFeatureEnabled(Features, "avx", true);
     setFeatureEnabled(Features, "sse4a", true);
     setFeatureEnabled(Features, "aes", true);
+    setFeatureEnabled(Features, "pclmul", true);
     break;
   case CK_C3_2:
     setFeatureEnabled(Features, "mmx", true);
@@ -1737,7 +1747,9 @@
     else if (Name == "3dnowa")
       Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = true;
     else if (Name == "aes")
-      Features["aes"] = true;
+      Features["sse"] = Features["sse2"] = Features["aes"] = true;
+    else if (Name == "pclmul")
+      Features["sse"] = Features["sse2"] = Features["pclmul"] = true;
     else if (Name == "avx")
       Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] =
         Features["ssse3"] = Features["sse41"] = Features["sse42"] =
@@ -1746,13 +1758,18 @@
       Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] =
         Features["ssse3"] = Features["sse41"] = Features["sse42"] =
         Features["popcnt"] = Features["avx"] = Features["avx2"] = true;
+    else if (Name == "fma")
+      Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] =
+        Features["ssse3"] = Features["sse41"] = Features["sse42"] =
+        Features["popcnt"] = Features["avx"] = Features["fma"] = true;
     else if (Name == "fma4")
         Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] =
         Features["ssse3"] = Features["sse41"] = Features["sse42"] =
-        Features["popcnt"] = Features["avx"] = Features["fma4"] = true;
+        Features["popcnt"] = Features["avx"] = Features["sse4a"] =
+        Features["fma4"] = true;
     else if (Name == "sse4a")
       Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] =
-        Features["lzcnt"] = Features["popcnt"] = Features["sse4a"] = true;
+        Features["sse4a"] = true;
     else if (Name == "lzcnt")
       Features["lzcnt"] = true;
     else if (Name == "bmi")
@@ -1767,31 +1784,44 @@
     else if (Name == "sse")
       Features["sse"] = Features["sse2"] = Features["sse3"] =
         Features["ssse3"] = Features["sse41"] = Features["sse42"] =
-        Features["sse4a"] = false;
+        Features["sse4a"] = Features["avx"] = Features["avx2"] =
+        Features["fma"] = Features["fma4"] = Features["aes"] =
+        Features["pclmul"] = false;
     else if (Name == "sse2")
       Features["sse2"] = Features["sse3"] = Features["ssse3"] =
-        Features["sse41"] = Features["sse42"] = Features["sse4a"] = false;
+        Features["sse41"] = Features["sse42"] = Features["sse4a"] =
+        Features["avx"] = Features["avx2"] = Features["fma"] =
+        Features["fma4"] = Features["aes"] = Features["pclmul"] = false;
     else if (Name == "sse3")
       Features["sse3"] = Features["ssse3"] = Features["sse41"] =
-        Features["sse42"] = Features["sse4a"] = false;
+        Features["sse42"] = Features["sse4a"] = Features["avx"] =
+        Features["avx2"] = Features["fma"] = Features["fma4"] = false;
     else if (Name == "ssse3")
-      Features["ssse3"] = Features["sse41"] = Features["sse42"] = false;
+      Features["ssse3"] = Features["sse41"] = Features["sse42"] =
+        Features["avx"] = Features["avx2"] = Features["fma"] = false;
     else if (Name == "sse4" || Name == "sse4.1")
-      Features["sse41"] = Features["sse42"] = false;
+      Features["sse41"] = Features["sse42"] = Features["avx"] =
+        Features["avx2"] = Features["fma"] = false;
     else if (Name == "sse4.2")
-      Features["sse42"] = false;
+      Features["sse42"] = Features["avx"] = Features["avx2"] =
+        Features["fma"] = false;
     else if (Name == "3dnow")
       Features["3dnow"] = Features["3dnowa"] = false;
     else if (Name == "3dnowa")
       Features["3dnowa"] = false;
     else if (Name == "aes")
       Features["aes"] = false;
+    else if (Name == "pclmul")
+      Features["pclmul"] = false;
     else if (Name == "avx")
-      Features["avx"] = Features["avx2"] = Features["fma4"] = false;
+      Features["avx"] = Features["avx2"] = Features["fma"] =
+        Features["fma4"] = false;
     else if (Name == "avx2")
       Features["avx2"] = false;
+    else if (Name == "fma")
+      Features["fma"] = false;
     else if (Name == "sse4a")
-      Features["sse4a"] = false;
+      Features["sse4a"] = Features["fma4"] = false;
     else if (Name == "lzcnt")
       Features["lzcnt"] = false;
     else if (Name == "bmi")
@@ -1823,6 +1853,11 @@
       continue;
     }
 
+    if (Feature == "pclmul") {
+      HasPCLMUL = true;
+      continue;
+    }
+
     if (Feature == "lzcnt") {
       HasLZCNT = true;
       continue;
@@ -1843,11 +1878,21 @@
       continue;
     }
 
+    if (Feature == "sse4a") {
+      HasSSE4a = true;
+      continue;
+    }
+
     if (Feature == "fma4") {
       HasFMA4 = true;
       continue;
     }
 
+    if (Feature == "fma") {
+      HasFMA = true;
+      continue;
+    }
+
     assert(Features[i][0] == '+' && "Invalid target feature!");
     X86SSEEnum Level = llvm::StringSwitch<X86SSEEnum>(Feature)
       .Case("avx2", AVX2)
@@ -2030,6 +2075,9 @@
   if (HasAES)
     Builder.defineMacro("__AES__");
 
+  if (HasPCLMUL)
+    Builder.defineMacro("__PCLMUL__");
+
   if (HasLZCNT)
     Builder.defineMacro("__LZCNT__");
 
@@ -2042,9 +2090,15 @@
   if (HasPOPCNT)
     Builder.defineMacro("__POPCNT__");
 
+  if (HasSSE4a)
+    Builder.defineMacro("__SSE4A__");
+
   if (HasFMA4)
     Builder.defineMacro("__FMA4__");
 
+  if (HasFMA)
+    Builder.defineMacro("__FMA__");
+
   // Each case falls through to the previous one here.
   switch (SSELevel) {
   case AVX2:
@@ -2108,11 +2162,13 @@
       .Case("avx2", SSELevel >= AVX2)
       .Case("bmi", HasBMI)
       .Case("bmi2", HasBMI2)
+      .Case("fma", HasFMA)
       .Case("fma4", HasFMA4)
       .Case("lzcnt", HasLZCNT)
       .Case("mm3dnow", MMX3DNowLevel >= AMD3DNow)
       .Case("mm3dnowa", MMX3DNowLevel >= AMD3DNowAthlon)
       .Case("mmx", MMX3DNowLevel >= MMX)
+      .Case("pclmul", HasPCLMUL)
       .Case("popcnt", HasPOPCNT)
       .Case("sse", SSELevel >= SSE1)
       .Case("sse2", SSELevel >= SSE2)
@@ -2120,6 +2176,7 @@
       .Case("ssse3", SSELevel >= SSSE3)
       .Case("sse41", SSELevel >= SSE41)
       .Case("sse42", SSELevel >= SSE42)
+      .Case("sse4a", HasSSE4a)
       .Case("x86", true)
       .Case("x86_32", PointerWidth == 32)
       .Case("x86_64", PointerWidth == 64)
@@ -3159,7 +3216,6 @@
 public:
   SparcV8TargetInfo(const std::string& triple) : TargetInfo(triple) {
     // FIXME: Support Sparc quad-precision long double?
-    BigEndian = false;
     DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
                         "i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32";
   }

Modified: cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp Mon Jun  4 13:40:31 2012
@@ -1588,10 +1588,11 @@
     getContextDescriptor(cast<Decl>(ED->getDeclContext()));
   llvm::DIType ClassTy = ED->isScopedUsingClassTag() ?
     getOrCreateType(ED->getIntegerType(), DefUnit) : llvm::DIType();
+  unsigned Flags = !ED->isCompleteDefinition() ? llvm::DIDescriptor::FlagFwdDecl : 0;
   llvm::DIType DbgTy = 
     DBuilder.createEnumerationType(EnumContext, ED->getName(), DefUnit, Line,
                                    Size, Align, EltArray,
-                                   ClassTy);
+                                   ClassTy, Flags);
   return DbgTy;
 }
 

Modified: cfe/branches/tooling/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGObjC.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGObjC.cpp Mon Jun  4 13:40:31 2012
@@ -30,7 +30,7 @@
 static TryEmitResult
 tryEmitARCRetainScalarExpr(CodeGenFunction &CGF, const Expr *e);
 static RValue AdjustRelatedResultType(CodeGenFunction &CGF,
-                                      const Expr *E,
+                                      QualType ET,
                                       const ObjCMethodDecl *Method,
                                       RValue Result);
 
@@ -202,20 +202,20 @@
 /// \brief Adjust the type of the result of an Objective-C message send 
 /// expression when the method has a related result type.
 static RValue AdjustRelatedResultType(CodeGenFunction &CGF,
-                                      const Expr *E,
+                                      QualType ExpT,
                                       const ObjCMethodDecl *Method,
                                       RValue Result) {
   if (!Method)
     return Result;
 
   if (!Method->hasRelatedResultType() ||
-      CGF.getContext().hasSameType(E->getType(), Method->getResultType()) ||
+      CGF.getContext().hasSameType(ExpT, Method->getResultType()) ||
       !Result.isScalar())
     return Result;
   
   // We have applied a related result type. Cast the rvalue appropriately.
   return RValue::get(CGF.Builder.CreateBitCast(Result.getScalarVal(),
-                                               CGF.ConvertType(E->getType())));
+                                               CGF.ConvertType(ExpT)));
 }
 
 /// Decide whether to extend the lifetime of the receiver of a
@@ -401,7 +401,7 @@
     Builder.CreateStore(newSelf, selfAddr);
   }
 
-  return AdjustRelatedResultType(*this, E, method, result);
+  return AdjustRelatedResultType(*this, E->getType(), method, result);
 }
 
 namespace {
@@ -710,7 +710,7 @@
   assert(OMD && "Invalid call to generate getter (empty method)");
   StartObjCMethod(OMD, IMP->getClassInterface(), OMD->getLocStart());
 
-  generateObjCGetterBody(IMP, PID, AtomicHelperFn);
+  generateObjCGetterBody(IMP, PID, OMD, AtomicHelperFn);
 
   FinishFunction();
 }
@@ -772,6 +772,7 @@
 void
 CodeGenFunction::generateObjCGetterBody(const ObjCImplementationDecl *classImpl,
                                         const ObjCPropertyImplDecl *propImpl,
+                                        const ObjCMethodDecl *GetterMethodDecl,
                                         llvm::Constant *AtomicHelperFn) {
   // If there's a non-trivial 'get' expression, we just have to emit that.
   if (!hasTrivialGetExpr(propImpl)) {
@@ -905,6 +906,8 @@
         }
 
         value = Builder.CreateBitCast(value, ConvertType(propType));
+        value = Builder.CreateBitCast(value, 
+                  ConvertType(GetterMethodDecl->getResultType()));
       }
       
       EmitReturnOfRValue(RValue::get(value), propType);

Modified: cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/branches/tooling/lib/CodeGen/CodeGenFunction.h Mon Jun  4 13:40:31 2012
@@ -1310,6 +1310,7 @@
                           const ObjCPropertyImplDecl *PID);
   void generateObjCGetterBody(const ObjCImplementationDecl *classImpl,
                               const ObjCPropertyImplDecl *propImpl,
+                              const ObjCMethodDecl *GetterMothodDecl,
                               llvm::Constant *AtomicHelperFn);
 
   void GenerateObjCCtorDtorMethod(ObjCImplementationDecl *IMP,

Modified: cfe/branches/tooling/lib/Driver/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/ArgList.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/ArgList.cpp (original)
+++ cfe/branches/tooling/lib/Driver/ArgList.cpp Mon Jun  4 13:40:31 2012
@@ -140,6 +140,68 @@
   return Res;
 }
 
+Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1,
+                         OptSpecifier Id2, OptSpecifier Id3,
+                         OptSpecifier Id4, OptSpecifier Id5) const {
+  Arg *Res = 0;
+  for (const_iterator it = begin(), ie = end(); it != ie; ++it) {
+    if ((*it)->getOption().matches(Id0) ||
+        (*it)->getOption().matches(Id1) ||
+        (*it)->getOption().matches(Id2) ||
+        (*it)->getOption().matches(Id3) ||
+        (*it)->getOption().matches(Id4) ||
+        (*it)->getOption().matches(Id5)) {
+      Res = *it;
+      Res->claim();
+    }
+  }
+
+  return Res;
+}
+
+Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1,
+                         OptSpecifier Id2, OptSpecifier Id3,
+                         OptSpecifier Id4, OptSpecifier Id5,
+                         OptSpecifier Id6) const {
+  Arg *Res = 0;
+  for (const_iterator it = begin(), ie = end(); it != ie; ++it) {
+    if ((*it)->getOption().matches(Id0) ||
+        (*it)->getOption().matches(Id1) ||
+        (*it)->getOption().matches(Id2) ||
+        (*it)->getOption().matches(Id3) ||
+        (*it)->getOption().matches(Id4) ||
+        (*it)->getOption().matches(Id5) ||
+        (*it)->getOption().matches(Id6)) {
+      Res = *it;
+      Res->claim();
+    }
+  }
+
+  return Res;
+}
+
+Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1,
+                         OptSpecifier Id2, OptSpecifier Id3,
+                         OptSpecifier Id4, OptSpecifier Id5,
+                         OptSpecifier Id6, OptSpecifier Id7) const {
+  Arg *Res = 0;
+  for (const_iterator it = begin(), ie = end(); it != ie; ++it) {
+    if ((*it)->getOption().matches(Id0) ||
+        (*it)->getOption().matches(Id1) ||
+        (*it)->getOption().matches(Id2) ||
+        (*it)->getOption().matches(Id3) ||
+        (*it)->getOption().matches(Id4) ||
+        (*it)->getOption().matches(Id5) ||
+        (*it)->getOption().matches(Id6) ||
+        (*it)->getOption().matches(Id7)) {
+      Res = *it;
+      Res->claim();
+    }
+  }
+
+  return Res;
+}
+
 bool ArgList::hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default) const {
   if (Arg *A = getLastArg(Pos, Neg))
     return A->getOption().matches(Pos);

Modified: cfe/branches/tooling/lib/Driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/CMakeLists.txt?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/CMakeLists.txt (original)
+++ cfe/branches/tooling/lib/Driver/CMakeLists.txt Mon Jun  4 13:40:31 2012
@@ -1,4 +1,4 @@
-set(LLVM_USED_LIBS clangBasic clangAST clangParse)
+set(LLVM_USED_LIBS clangBasic)
 
 add_clang_library(clangDriver
   Action.cpp

Modified: cfe/branches/tooling/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/Tools.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/Tools.cpp (original)
+++ cfe/branches/tooling/lib/Driver/Tools.cpp Mon Jun  4 13:40:31 2012
@@ -828,19 +828,9 @@
     ABIName = getMipsABIFromArch(ArchName);
 }
 
-void Clang::AddMIPSTargetArgs(const ArgList &Args,
-                             ArgStringList &CmdArgs) const {
-  const Driver &D = getToolChain().getDriver();
-  StringRef CPUName;
-  StringRef ABIName;
-  getMipsCPUAndABI(Args, getToolChain(), CPUName, ABIName);
-
-  CmdArgs.push_back("-target-cpu");
-  CmdArgs.push_back(CPUName.data());
-
-  CmdArgs.push_back("-target-abi");
-  CmdArgs.push_back(ABIName.data());
-
+// Select the MIPS float ABI as determined by -msoft-float, -mhard-float,
+// and -mfloat-abi=.
+static StringRef getMipsFloatABI(const Driver &D, const ArgList &Args) {
   // Select the float ABI as determined by -msoft-float, -mhard-float,
   // and -mfloat-abi=.
   StringRef FloatABI;
@@ -854,8 +844,7 @@
     else {
       FloatABI = A->getValue(Args);
       if (FloatABI != "soft" && FloatABI != "single" && FloatABI != "hard") {
-        D.Diag(diag::err_drv_invalid_mfloat_abi)
-          << A->getAsString(Args);
+        D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args);
         FloatABI = "hard";
       }
     }
@@ -869,6 +858,24 @@
     FloatABI = "hard";
   }
 
+  return FloatABI;
+}
+
+void Clang::AddMIPSTargetArgs(const ArgList &Args,
+                             ArgStringList &CmdArgs) const {
+  const Driver &D = getToolChain().getDriver();
+  StringRef CPUName;
+  StringRef ABIName;
+  getMipsCPUAndABI(Args, getToolChain(), CPUName, ABIName);
+
+  CmdArgs.push_back("-target-cpu");
+  CmdArgs.push_back(CPUName.data());
+
+  CmdArgs.push_back("-target-abi");
+  CmdArgs.push_back(ABIName.data());
+
+  StringRef FloatABI = getMipsFloatABI(D, Args);
+
   if (FloatABI == "soft") {
     // Floating point operations and argument passing are soft.
     CmdArgs.push_back("-msoft-float");
@@ -1283,6 +1290,8 @@
     return;
   if(TC.getTriple().getEnvironment() == llvm::Triple::ANDROIDEABI) {
     if (!Args.hasArg(options::OPT_shared)) {
+      if (!Args.hasArg(options::OPT_pie))
+        TC.getDriver().Diag(diag::err_drv_asan_android_requires_pie);
       // For an executable, we add a .preinit_array stub.
       CmdArgs.push_back("-u");
       CmdArgs.push_back("__asan_preinit");
@@ -1529,22 +1538,11 @@
 
   // This comes from the default translation the driver + cc1
   // would do to enable flag_pic.
-  //
-  // FIXME: Centralize this code.
-  Arg *LastPICArg = 0;
-  for (ArgList::const_iterator I = Args.begin(), E = Args.end(); I != E; ++I) {
-    if ((*I)->getOption().matches(options::OPT_fPIC) ||
-        (*I)->getOption().matches(options::OPT_fno_PIC) ||
-        (*I)->getOption().matches(options::OPT_fpic) ||
-        (*I)->getOption().matches(options::OPT_fno_pic) ||
-        (*I)->getOption().matches(options::OPT_fPIE) ||
-        (*I)->getOption().matches(options::OPT_fno_PIE) ||
-        (*I)->getOption().matches(options::OPT_fpie) ||
-        (*I)->getOption().matches(options::OPT_fno_pie)) {
-      LastPICArg = *I;
-      (*I)->claim();
-    }
-  }
+
+  Arg *LastPICArg = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC,
+                                    options::OPT_fpic, options::OPT_fno_pic,
+                                    options::OPT_fPIE, options::OPT_fno_PIE,
+                                    options::OPT_fpie, options::OPT_fno_pie);
   bool PICDisabled = false;
   bool PICEnabled = false;
   bool PICForPIE = false;
@@ -5148,6 +5146,18 @@
       CmdArgs.push_back("-EB");
     else
       CmdArgs.push_back("-EL");
+
+    Arg *LastPICArg = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC,
+                                      options::OPT_fpic, options::OPT_fno_pic,
+                                      options::OPT_fPIE, options::OPT_fno_PIE,
+                                      options::OPT_fpie, options::OPT_fno_pie);
+    if (LastPICArg &&
+        (LastPICArg->getOption().matches(options::OPT_fPIC) ||
+         LastPICArg->getOption().matches(options::OPT_fpic) ||
+         LastPICArg->getOption().matches(options::OPT_fPIE) ||
+         LastPICArg->getOption().matches(options::OPT_fpie))) {
+      CmdArgs.push_back("-KPIC");
+    }
   }
 
   Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,

Modified: cfe/branches/tooling/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/FrontendAction.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/FrontendAction.cpp Mon Jun  4 13:40:31 2012
@@ -83,31 +83,31 @@
   }
 };
 
-  /// \brief Checks deserialized declarations and emits error if a name
-  /// matches one given in command-line using -error-on-deserialized-decl.
-  class DeserializedDeclsChecker : public DelegatingDeserializationListener {
-    ASTContext &Ctx;
-    std::set<std::string> NamesToCheck;
-
-  public:
-    DeserializedDeclsChecker(ASTContext &Ctx,
-                             const std::set<std::string> &NamesToCheck, 
-                             ASTDeserializationListener *Previous)
-      : DelegatingDeserializationListener(Previous),
-        Ctx(Ctx), NamesToCheck(NamesToCheck) { }
-
-    virtual void DeclRead(serialization::DeclID ID, const Decl *D) {
-      if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
-        if (NamesToCheck.find(ND->getNameAsString()) != NamesToCheck.end()) {
-          unsigned DiagID
-            = Ctx.getDiagnostics().getCustomDiagID(DiagnosticsEngine::Error,
-                                                   "%0 was deserialized");
-          Ctx.getDiagnostics().Report(Ctx.getFullLoc(D->getLocation()), DiagID)
-              << ND->getNameAsString();
-        }
+/// \brief Checks deserialized declarations and emits error if a name
+/// matches one given in command-line using -error-on-deserialized-decl.
+class DeserializedDeclsChecker : public DelegatingDeserializationListener {
+  ASTContext &Ctx;
+  std::set<std::string> NamesToCheck;
+
+public:
+  DeserializedDeclsChecker(ASTContext &Ctx,
+                           const std::set<std::string> &NamesToCheck,
+                           ASTDeserializationListener *Previous)
+    : DelegatingDeserializationListener(Previous),
+      Ctx(Ctx), NamesToCheck(NamesToCheck) { }
+
+  virtual void DeclRead(serialization::DeclID ID, const Decl *D) {
+    if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
+      if (NamesToCheck.find(ND->getNameAsString()) != NamesToCheck.end()) {
+        unsigned DiagID
+          = Ctx.getDiagnostics().getCustomDiagID(DiagnosticsEngine::Error,
+                                                 "%0 was deserialized");
+        Ctx.getDiagnostics().Report(Ctx.getFullLoc(D->getLocation()), DiagID)
+            << ND->getNameAsString();
+      }
 
-      DelegatingDeserializationListener::DeclRead(ID, D);
-    }
+    DelegatingDeserializationListener::DeclRead(ID, D);
+  }
 };
 
 } // end anonymous namespace

Modified: cfe/branches/tooling/lib/Headers/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Headers/CMakeLists.txt?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Headers/CMakeLists.txt (original)
+++ cfe/branches/tooling/lib/Headers/CMakeLists.txt Mon Jun  4 13:40:31 2012
@@ -1,5 +1,6 @@
 set(files
   altivec.h
+  ammintrin.h
   avxintrin.h
   avx2intrin.h
   bmiintrin.h
@@ -7,6 +8,7 @@
   emmintrin.h
   float.h
   fma4intrin.h
+  fmaintrin.h
   immintrin.h
   iso646.h
   limits.h

Modified: cfe/branches/tooling/lib/Headers/immintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Headers/immintrin.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Headers/immintrin.h (original)
+++ cfe/branches/tooling/lib/Headers/immintrin.h Mon Jun  4 13:40:31 2012
@@ -72,4 +72,8 @@
 #include <lzcntintrin.h>
 #endif
 
+#ifdef __FMA__
+#include <fmaintrin.h>
+#endif
+
 #endif /* __IMMINTRIN_H */

Modified: cfe/branches/tooling/lib/Headers/wmmintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Headers/wmmintrin.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Headers/wmmintrin.h (original)
+++ cfe/branches/tooling/lib/Headers/wmmintrin.h Mon Jun  4 13:40:31 2012
@@ -24,11 +24,13 @@
 #ifndef _WMMINTRIN_H
 #define _WMMINTRIN_H
 
-#if !defined (__AES__)
-# error "AES instructions not enabled"
+#include <emmintrin.h>
+
+#if !defined (__AES__) && !defined (__PCLMUL__)
+# error "AES/PCLMUL instructions not enabled"
 #else
 
-#include <xmmintrin.h>
+#ifdef __AES__
 
 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
 _mm_aesenc_si128(__m128i __V, __m128i __R)
@@ -64,4 +66,14 @@
   __builtin_ia32_aeskeygenassist128((C), (R))
 
 #endif /* __AES__ */
+
+#ifdef __PCLMUL__
+
+#define _mm_clmulepi64_si128(__X, __Y, __I) \
+  ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(__X), \
+                                        (__v2di)(__m128i)(__Y), (char)(__I)))
+
+#endif /* __PCLMUL__ */
+
+#endif /* __AES__ || __PCLMUL__ */
 #endif /* _WMMINTRIN_H */

Modified: cfe/branches/tooling/lib/Headers/x86intrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Headers/x86intrin.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Headers/x86intrin.h (original)
+++ cfe/branches/tooling/lib/Headers/x86intrin.h Mon Jun  4 13:40:31 2012
@@ -46,10 +46,14 @@
 #include <popcntintrin.h>
 #endif
 
+#ifdef __SSE4A__
+#include <ammintrin.h>
+#endif
+
 #ifdef __FMA4__
 #include <fma4intrin.h>
 #endif
 
-// FIXME: SSE4A, XOP, LWP, ABM
+// FIXME: XOP, LWP
 
 #endif /* __X86INTRIN_H */

Modified: cfe/branches/tooling/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Lex/Preprocessor.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Lex/Preprocessor.cpp (original)
+++ cfe/branches/tooling/lib/Lex/Preprocessor.cpp Mon Jun  4 13:40:31 2012
@@ -66,54 +66,6 @@
     Record(0), MIChainHead(0), MICache(0) 
 {
   OwnsHeaderSearch = OwnsHeaders;
-
-  if (!DelayInitialization) {
-    assert(Target && "Must provide target information for PP initialization");
-    Initialize(*Target);
-  }
-}
-
-Preprocessor::~Preprocessor() {
-  assert(BacktrackPositions.empty() && "EnableBacktrack/Backtrack imbalance!");
-
-  while (!IncludeMacroStack.empty()) {
-    delete IncludeMacroStack.back().TheLexer;
-    delete IncludeMacroStack.back().TheTokenLexer;
-    IncludeMacroStack.pop_back();
-  }
-
-  // Free any macro definitions.
-  for (MacroInfoChain *I = MIChainHead ; I ; I = I->Next)
-    I->MI.Destroy();
-
-  // Free any cached macro expanders.
-  for (unsigned i = 0, e = NumCachedTokenLexers; i != e; ++i)
-    delete TokenLexerCache[i];
-
-  // Free any cached MacroArgs.
-  for (MacroArgs *ArgList = MacroArgCache; ArgList; )
-    ArgList = ArgList->deallocate();
-
-  // Release pragma information.
-  delete PragmaHandlers;
-
-  // Delete the scratch buffer info.
-  delete ScratchBuf;
-
-  // Delete the header search info, if we own it.
-  if (OwnsHeaderSearch)
-    delete &HeaderInfo;
-
-  delete Callbacks;
-}
-
-void Preprocessor::Initialize(const TargetInfo &Target) {
-  assert((!this->Target || this->Target == &Target) &&
-         "Invalid override of target information");
-  this->Target = &Target;
-  
-  // Initialize information about built-ins.
-  BuiltinInfo.InitializeTarget(Target);
   
   ScratchBuf = new ScratchBuffer(SourceMgr);
   CounterValue = 0; // __COUNTER__ starts at 0.
@@ -170,7 +122,54 @@
     Ident___exception_info = Ident___exception_code = Ident___abnormal_termination = 0;
     Ident_GetExceptionInfo = Ident_GetExceptionCode = Ident_AbnormalTermination = 0;
   }
+
+  if (!DelayInitialization) {
+    assert(Target && "Must provide target information for PP initialization");
+    Initialize(*Target);
+  }
+}
+
+Preprocessor::~Preprocessor() {
+  assert(BacktrackPositions.empty() && "EnableBacktrack/Backtrack imbalance!");
+
+  while (!IncludeMacroStack.empty()) {
+    delete IncludeMacroStack.back().TheLexer;
+    delete IncludeMacroStack.back().TheTokenLexer;
+    IncludeMacroStack.pop_back();
+  }
+
+  // Free any macro definitions.
+  for (MacroInfoChain *I = MIChainHead ; I ; I = I->Next)
+    I->MI.Destroy();
+
+  // Free any cached macro expanders.
+  for (unsigned i = 0, e = NumCachedTokenLexers; i != e; ++i)
+    delete TokenLexerCache[i];
+
+  // Free any cached MacroArgs.
+  for (MacroArgs *ArgList = MacroArgCache; ArgList; )
+    ArgList = ArgList->deallocate();
+
+  // Release pragma information.
+  delete PragmaHandlers;
+
+  // Delete the scratch buffer info.
+  delete ScratchBuf;
+
+  // Delete the header search info, if we own it.
+  if (OwnsHeaderSearch)
+    delete &HeaderInfo;
+
+  delete Callbacks;
+}
+
+void Preprocessor::Initialize(const TargetInfo &Target) {
+  assert((!this->Target || this->Target == &Target) &&
+         "Invalid override of target information");
+  this->Target = &Target;
   
+  // Initialize information about built-ins.
+  BuiltinInfo.InitializeTarget(Target);
   HeaderInfo.setTarget(Target);
 }
 

Modified: cfe/branches/tooling/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseObjc.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseObjc.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseObjc.cpp Mon Jun  4 13:40:31 2012
@@ -894,7 +894,7 @@
     DeclSpec declSpec(AttrFactory);
     declSpec.setObjCQualifiers(&DS);
     ParseSpecifierQualifierList(declSpec);
-    declSpec.SetRangeEnd(Tok.getLocation().getLocWithOffset(-1));
+    declSpec.SetRangeEnd(Tok.getLocation());
     Declarator declarator(declSpec, context);
     ParseDeclarator(declarator);
 

Modified: cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp Mon Jun  4 13:40:31 2012
@@ -361,7 +361,7 @@
     
     virtual void Initialize(ASTContext &context);
     
-    // Misc. AST transformation routines. Somtimes they end up calling
+    // Misc. AST transformation routines. Sometimes they end up calling
     // rewriting routines on the new ASTs.
     CallExpr *SynthesizeCallToFunctionDecl(FunctionDecl *FD,
                                            Expr **args, unsigned nargs,

Modified: cfe/branches/tooling/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Rewrite/RewriteObjC.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/branches/tooling/lib/Rewrite/RewriteObjC.cpp Mon Jun  4 13:40:31 2012
@@ -349,7 +349,7 @@
     virtual void RewriteIvarOffsetComputation(ObjCIvarDecl *ivar,
                                          std::string &Result) = 0;
     
-    // Misc. AST transformation routines. Somtimes they end up calling
+    // Misc. AST transformation routines. Sometimes they end up calling
     // rewriting routines on the new ASTs.
     CallExpr *SynthesizeCallToFunctionDecl(FunctionDecl *FD,
                                            Expr **args, unsigned nargs,

Modified: cfe/branches/tooling/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/AnalysisBasedWarnings.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/branches/tooling/lib/Sema/AnalysisBasedWarnings.cpp Mon Jun  4 13:40:31 2012
@@ -814,13 +814,17 @@
   };
 }
 
-static void DiagnoseSwitchLabelsFallthrough(Sema &S, AnalysisDeclContext &AC) {
+static void DiagnoseSwitchLabelsFallthrough(Sema &S, AnalysisDeclContext &AC,
+                                            bool PerMethod) {
   FallthroughMapper FM(S);
   FM.TraverseStmt(AC.getBody());
 
   if (!FM.foundSwitchStatements())
     return;
 
+  if (PerMethod && FM.getFallthroughStmts().empty())
+    return;
+
   CFG *Cfg = AC.getCFG();
 
   if (!Cfg)
@@ -838,7 +842,9 @@
     if (!FM.checkFallThroughIntoBlock(B, AnnotatedCnt))
       continue;
 
-    S.Diag(Label->getLocStart(), diag::warn_unannotated_fallthrough);
+    S.Diag(Label->getLocStart(),
+        PerMethod ? diag::warn_unannotated_fallthrough_per_method
+                  : diag::warn_unannotated_fallthrough);
 
     if (!AnnotatedCnt) {
       SourceLocation L = Label->getLocStart();
@@ -1324,9 +1330,14 @@
     }
   }
 
-  if (Diags.getDiagnosticLevel(diag::warn_unannotated_fallthrough,
-                              D->getLocStart()) != DiagnosticsEngine::Ignored) {
-    DiagnoseSwitchLabelsFallthrough(S, AC);
+  bool FallThroughDiagFull =
+      Diags.getDiagnosticLevel(diag::warn_unannotated_fallthrough,
+                               D->getLocStart()) != DiagnosticsEngine::Ignored;
+  bool FallThroughDiagPerMethod =
+      Diags.getDiagnosticLevel(diag::warn_unannotated_fallthrough_per_method,
+                               D->getLocStart()) != DiagnosticsEngine::Ignored;
+  if (FallThroughDiagFull || FallThroughDiagPerMethod) {
+    DiagnoseSwitchLabelsFallthrough(S, AC, !FallThroughDiagFull);
   }
 
   // Collect statistics about the CFG if it was built.

Modified: cfe/branches/tooling/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaChecking.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaChecking.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaChecking.cpp Mon Jun  4 13:40:31 2012
@@ -2755,19 +2755,43 @@
           // TODO: For strncpy() and friends, this could suggest sizeof(dst)
           //       over sizeof(src) as well.
           unsigned ActionIdx = 0; // Default is to suggest dereferencing.
+          StringRef ReadableName = FnName->getName();
+
           if (const UnaryOperator *UnaryOp = dyn_cast<UnaryOperator>(Dest))
             if (UnaryOp->getOpcode() == UO_AddrOf)
               ActionIdx = 1; // If its an address-of operator, just remove it.
           if (Context.getTypeSize(PointeeTy) == Context.getCharWidth())
             ActionIdx = 2; // If the pointee's size is sizeof(char),
                            // suggest an explicit length.
-          unsigned DestSrcSelect =
-            (BId == Builtin::BIstrndup ? 1 : ArgIdx);
-          DiagRuntimeBehavior(SizeOfArg->getExprLoc(), Dest,
+
+          // If the function is defined as a builtin macro, do not show macro
+          // expansion.
+          SourceLocation SL = SizeOfArg->getExprLoc();
+          SourceRange DSR = Dest->getSourceRange();
+          SourceRange SSR = SizeOfArg->getSourceRange();
+          SourceManager &SM  = PP.getSourceManager();
+
+          if (SM.isMacroArgExpansion(SL)) {
+            ReadableName = Lexer::getImmediateMacroName(SL, SM, LangOpts);
+            SL = SM.getSpellingLoc(SL);
+            DSR = SourceRange(SM.getSpellingLoc(DSR.getBegin()),
+                             SM.getSpellingLoc(DSR.getEnd()));
+            SSR = SourceRange(SM.getSpellingLoc(SSR.getBegin()),
+                             SM.getSpellingLoc(SSR.getEnd()));
+          }
+
+          DiagRuntimeBehavior(SL, SizeOfArg,
                               PDiag(diag::warn_sizeof_pointer_expr_memaccess)
-                                << FnName << DestSrcSelect << ActionIdx
-                                << Dest->getSourceRange()
-                                << SizeOfArg->getSourceRange());
+                                << ReadableName
+                                << PointeeTy
+                                << DestTy
+                                << DSR
+                                << SSR);
+          DiagRuntimeBehavior(SL, SizeOfArg,
+                         PDiag(diag::warn_sizeof_pointer_expr_memaccess_note)
+                                << ActionIdx
+                                << SSR);
+
           break;
         }
       }

Modified: cfe/branches/tooling/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDecl.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDecl.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDecl.cpp Mon Jun  4 13:40:31 2012
@@ -10232,6 +10232,50 @@
   return New;
 }
 
+// Emits a warning if every element in the enum is the same value and if
+// every element is initialized with a integer or boolean literal.
+static void CheckForUniqueEnumValues(Sema &S, Decl **Elements,
+                                     unsigned NumElements, EnumDecl *Enum,
+                                     QualType EnumType) {
+  if (S.Diags.getDiagnosticLevel(diag::warn_identical_enum_values,
+                                 Enum->getLocation()) ==
+      DiagnosticsEngine::Ignored)
+    return;
+
+  if (NumElements < 2)
+    return;
+
+  if (!Enum->getIdentifier())
+    return;
+
+  llvm::APSInt FirstVal;
+
+  for (unsigned i = 0; i != NumElements; ++i) {
+    EnumConstantDecl *ECD = cast_or_null<EnumConstantDecl>(Elements[i]);
+    if (!ECD)
+      return;
+
+    Expr *InitExpr = ECD->getInitExpr();
+    if (!InitExpr)
+      return;
+    InitExpr = InitExpr->IgnoreImpCasts();
+    if (!isa<IntegerLiteral>(InitExpr) && !isa<CXXBoolLiteralExpr>(InitExpr))
+      return;
+
+    if (i == 0) {
+      FirstVal = ECD->getInitVal();
+      continue;
+    }
+
+    if (FirstVal != ECD->getInitVal())
+      return;
+  }
+
+  S.Diag(Enum->getLocation(), diag::warn_identical_enum_values)
+      << EnumType << FirstVal.toString(10)
+      << Enum->getSourceRange();
+}
+
 void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
                          SourceLocation RBraceLoc, Decl *EnumDeclX,
                          Decl **Elements, unsigned NumElements,
@@ -10455,6 +10499,7 @@
   if (InFunctionDeclarator)
     DeclsInPrototypeScope.push_back(Enum);
 
+  CheckForUniqueEnumValues(*this, Elements, NumElements, Enum, EnumType);
 }
 
 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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp Mon Jun  4 13:40:31 2012
@@ -2085,7 +2085,15 @@
       return;
     }
   }
-  else if (!isa<ObjCPropertyDecl>(D)) {
+  else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D)) {
+    QualType T = PD->getType();
+    if (!T->isPointerType() ||
+        !T->getAs<PointerType>()->getPointeeType()->isRecordType()) {
+      S.Diag(PD->getLocation(), diag::err_nsobject_attribute);
+      return;
+    }
+  }
+  else {
     // It is okay to include this attribute on properties, e.g.:
     //
     //  @property (retain, nonatomic) struct Bork *Q __attribute__((NSObject));
@@ -4367,7 +4375,7 @@
   }
   if (S.getLangOpts().ObjCAutoRefCount)
     if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(decl)) {
-      // FIXME. we may want to supress diagnostics for all
+      // FIXME: we may want to suppress diagnostics for all
       // kind of forbidden type messages on unavailable functions. 
       if (FD->hasAttr<UnavailableAttr>() &&
           diag.getForbiddenTypeDiagnostic() == 

Modified: cfe/branches/tooling/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExpr.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExpr.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExpr.cpp Mon Jun  4 13:40:31 2012
@@ -3795,20 +3795,19 @@
   // Make the call expr early, before semantic checks.  This guarantees cleanup
   // of arguments and function on error.
   CallExpr *TheCall;
-  if (Config) {
+  if (Config)
     TheCall = new (Context) CUDAKernelCallExpr(Context, Fn,
                                                cast<CallExpr>(Config),
                                                Args, NumArgs,
                                                Context.BoolTy,
                                                VK_RValue,
                                                RParenLoc);
-  } else {
+  else
     TheCall = new (Context) CallExpr(Context, Fn,
                                      Args, NumArgs,
                                      Context.BoolTy,
                                      VK_RValue,
                                      RParenLoc);
-  }
 
   unsigned BuiltinID = (FDecl ? FDecl->getBuiltinID() : 0);
 
@@ -8093,7 +8092,7 @@
     << DiagRange << BinOp::getOpcodeStr(Opc) << OpStr;
   SuggestParentheses(Self, OpLoc,
     Self.PDiag(diag::note_precedence_bitwise_silence) << OpStr,
-    RHSExpr->getSourceRange());
+    (isLeftComp ? LHSExpr : RHSExpr)->getSourceRange());
   SuggestParentheses(Self, OpLoc,
     Self.PDiag(diag::note_precedence_bitwise_first) << BinOp::getOpcodeStr(Opc),
     ParensRange);

Modified: cfe/branches/tooling/lib/Sema/SemaExprMember.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExprMember.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExprMember.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExprMember.cpp Mon Jun  4 13:40:31 2012
@@ -115,7 +115,7 @@
     NamedDecl *D = *I;
 
     if (D->isCXXInstanceMember()) {
-      if (dyn_cast<FieldDecl>(D))
+      if (dyn_cast<FieldDecl>(D) || dyn_cast<IndirectFieldDecl>(D))
         isField = true;
 
       CXXRecordDecl *R = cast<CXXRecordDecl>(D->getDeclContext());

Modified: cfe/branches/tooling/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExprObjC.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExprObjC.cpp Mon Jun  4 13:40:31 2012
@@ -1483,10 +1483,6 @@
     SelectorTable::constructSetterName(PP.getIdentifierTable(),
                                        PP.getSelectorTable(), Member);
   ObjCMethodDecl *Setter = IFace->lookupInstanceMethod(SetterSel);
-  if (Setter && Setter->isSynthesized())
-    // Check for corner case of: @property int p; ... self.P = 0;
-    // setter name is synthesized "setP" but there is no property name 'P'.
-    Setter = 0;
       
   // May be founf in property's qualified list.
   if (!Setter)
@@ -2775,11 +2771,12 @@
   };
 }
 
-static bool
-KnownName(Sema &S, const char *name) {
-  LookupResult R(S, &S.Context.Idents.get(name), SourceLocation(),
+bool Sema::isKnownName(StringRef name) {
+  if (name.empty())
+    return false;
+  LookupResult R(*this, &Context.Idents.get(name), SourceLocation(),
                  Sema::LookupOrdinaryName);
-  return S.LookupName(R, S.TUScope, false);
+  return LookupName(R, TUScope, false);
 }
 
 static void addFixitForObjCARCConversion(Sema &S,
@@ -2888,7 +2885,7 @@
       << castType
       << castRange
       << castExpr->getSourceRange();
-    bool br = KnownName(S, "CFBridgingRelease");
+    bool br = S.isKnownName("CFBridgingRelease");
     {
       DiagnosticBuilder DiagB = S.Diag(noteLoc, diag::note_arc_bridge);
       addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
@@ -2907,7 +2904,7 @@
     
   // Bridge from a CF type to an ARC type.
   if (exprACTC == ACTC_retainable && isAnyRetainable(castACTC)) {
-    bool br = KnownName(S, "CFBridgingRetain");
+    bool br = S.isKnownName("CFBridgingRetain");
     S.Diag(loc, diag::err_arc_cast_requires_bridge)
       << unsigned(CCK == Sema::CCK_ImplicitConversion) // cast|implicit
       << unsigned(castExprType->isBlockPointerType()) // of ObjC|block type
@@ -3160,7 +3157,7 @@
       break;
       
     case OBC_BridgeRetained: {
-      bool br = KnownName(*this, "CFBridgingRelease");
+      bool br = isKnownName("CFBridgingRelease");
       Diag(BridgeKeywordLoc, diag::err_arc_bridge_cast_wrong_kind)
         << 2
         << FromType
@@ -3203,7 +3200,7 @@
       break;
       
     case OBC_BridgeTransfer: {
-      bool br = KnownName(*this, "CFBridgingRetain");
+      bool br = isKnownName("CFBridgingRetain");
       Diag(BridgeKeywordLoc, diag::err_arc_bridge_cast_wrong_kind)
         << (FromType->isBlockPointerType()? 1 : 0)
         << FromType

Modified: cfe/branches/tooling/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaLookup.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaLookup.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaLookup.cpp Mon Jun  4 13:40:31 2012
@@ -3147,7 +3147,8 @@
 
 namespace {
 
-typedef llvm::StringMap<TypoCorrection, llvm::BumpPtrAllocator> TypoResultsMap;
+typedef llvm::SmallVector<TypoCorrection, 1> TypoResultList;
+typedef llvm::StringMap<TypoResultList, llvm::BumpPtrAllocator> TypoResultsMap;
 typedef std::map<unsigned, TypoResultsMap> TypoEditDistanceMap;
 
 static const unsigned MaxTypoDistanceResultSets = 5;
@@ -3161,7 +3162,7 @@
   ///
   /// The pointer value being set to the current DeclContext indicates
   /// whether there is a keyword with this name.
-  TypoEditDistanceMap BestResults;
+  TypoEditDistanceMap CorrectionResults;
 
   Sema &SemaRef;
 
@@ -3180,23 +3181,28 @@
 
   typedef TypoResultsMap::iterator result_iterator;
   typedef TypoEditDistanceMap::iterator distance_iterator;
-  distance_iterator begin() { return BestResults.begin(); }
-  distance_iterator end()  { return BestResults.end(); }
-  void erase(distance_iterator I) { BestResults.erase(I); }
-  unsigned size() const { return BestResults.size(); }
-  bool empty() const { return BestResults.empty(); }
+  distance_iterator begin() { return CorrectionResults.begin(); }
+  distance_iterator end()  { return CorrectionResults.end(); }
+  void erase(distance_iterator I) { CorrectionResults.erase(I); }
+  unsigned size() const { return CorrectionResults.size(); }
+  bool empty() const { return CorrectionResults.empty(); }
 
-  TypoCorrection &operator[](StringRef Name) {
-    return BestResults.begin()->second[Name];
+  TypoResultList &operator[](StringRef Name) {
+    return CorrectionResults.begin()->second[Name];
   }
 
   unsigned getBestEditDistance(bool Normalized) {
-    if (BestResults.empty())
+    if (CorrectionResults.empty())
       return (std::numeric_limits<unsigned>::max)();
 
-    unsigned BestED = BestResults.begin()->first;
+    unsigned BestED = CorrectionResults.begin()->first;
     return Normalized ? TypoCorrection::NormalizeEditDistance(BestED) : BestED;
   }
+
+  TypoResultsMap &getBestResults() {
+    return CorrectionResults.begin()->second;
+  }
+
 };
 
 }
@@ -3251,19 +3257,31 @@
 
 void TypoCorrectionConsumer::addCorrection(TypoCorrection Correction) {
   StringRef Name = Correction.getCorrectionAsIdentifierInfo()->getName();
-  TypoResultsMap &Map = BestResults[Correction.getEditDistance(false)];
+  TypoResultList &CList =
+      CorrectionResults[Correction.getEditDistance(false)][Name];
 
-  TypoCorrection &CurrentCorrection = Map[Name];
-  if (!CurrentCorrection ||
-      // FIXME: The following should be rolled up into an operator< on
-      // TypoCorrection with a more principled definition.
-      CurrentCorrection.isKeyword() < Correction.isKeyword() ||
-      Correction.getAsString(SemaRef.getLangOpts()) <
-      CurrentCorrection.getAsString(SemaRef.getLangOpts()))
-    CurrentCorrection = Correction;
+  if (!CList.empty() && !CList.back().isResolved())
+    CList.pop_back();
+  if (NamedDecl *NewND = Correction.getCorrectionDecl()) {
+    std::string CorrectionStr = Correction.getAsString(SemaRef.getLangOpts());
+    for (TypoResultList::iterator RI = CList.begin(), RIEnd = CList.end();
+         RI != RIEnd; ++RI) {
+      // If the Correction refers to a decl already in the result list,
+      // replace the existing result if the string representation of Correction
+      // comes before the current result alphabetically, then stop as there is
+      // nothing more to be done to add Correction to the candidate set.
+      if (RI->getCorrectionDecl() == NewND) {
+        if (CorrectionStr < RI->getAsString(SemaRef.getLangOpts()))
+          *RI = Correction;
+        return;
+      }
+    }
+  }
+  if (CList.empty() || Correction.isResolved())
+    CList.push_back(Correction);
 
-  while (BestResults.size() > MaxTypoDistanceResultSets)
-    erase(llvm::prior(BestResults.end()));
+  while (CorrectionResults.size() > MaxTypoDistanceResultSets)
+    erase(llvm::prior(CorrectionResults.end()));
 }
 
 // Fill the supplied vector with the IdentifierInfo pointers for each piece of
@@ -3348,7 +3366,7 @@
       getNestedNameSpecifierIdentifiers(CurScopeSpec->getScopeRep(),
                                         CurNameSpecifierIdentifiers);
     // Build the list of identifiers that would be used for an absolute
-    // (from the global context) NestedNameSpecifier refering to the current
+    // (from the global context) NestedNameSpecifier referring to the current
     // context.
     for (DeclContextList::reverse_iterator C = CurContextChain.rbegin(),
                                         CEnd = CurContextChain.rend();
@@ -3857,16 +3875,30 @@
       // If the item already has been looked up or is a keyword, keep it.
       // If a validator callback object was given, drop the correction
       // unless it passes validation.
-      if (I->second.isResolved()) {
+      bool Viable = false;
+      for (TypoResultList::iterator RI = I->second.begin(), RIEnd = I->second.end();
+           RI != RIEnd; /* Increment in loop. */) {
+        TypoResultList::iterator Prev = RI;
+        ++RI;
+        if (Prev->isResolved()) {
+          if (!isCandidateViable(CCC, *Prev))
+            I->second.erase(Prev);
+          else
+            Viable = true;
+        }
+      }
+      if (Viable || I->second.empty()) {
         TypoCorrectionConsumer::result_iterator Prev = I;
         ++I;
-        if (!isCandidateViable(CCC, Prev->second))
+        if (!Viable)
           DI->second.erase(Prev);
         continue;
       }
+      assert(I->second.size() == 1 && "Expected a single unresolved candidate");
 
       // Perform name lookup on this name.
-      IdentifierInfo *Name = I->second.getCorrectionAsIdentifierInfo();
+      TypoCorrection &Candidate = I->second.front();
+      IdentifierInfo *Name = Candidate.getCorrectionAsIdentifierInfo();
       LookupPotentialTypoResult(*this, TmpRes, Name, S, SS, MemberContext,
                                 EnteringContext, CCC.IsObjCIvarLookup);
 
@@ -3874,7 +3906,7 @@
       case LookupResult::NotFound:
       case LookupResult::NotFoundInCurrentInstantiation:
       case LookupResult::FoundUnresolvedValue:
-        QualifiedResults.push_back(I->second);
+        QualifiedResults.push_back(Candidate);
         // We didn't find this name in our scope, or didn't like what we found;
         // ignore it.
         {
@@ -3895,18 +3927,18 @@
         for (LookupResult::iterator TRD = TmpRes.begin(),
                                  TRDEnd = TmpRes.end();
              TRD != TRDEnd; ++TRD)
-          I->second.addCorrectionDecl(*TRD);
+          Candidate.addCorrectionDecl(*TRD);
         ++I;
-        if (!isCandidateViable(CCC, Prev->second))
+        if (!isCandidateViable(CCC, Candidate))
           DI->second.erase(Prev);
         break;
       }
 
       case LookupResult::Found: {
         TypoCorrectionConsumer::result_iterator Prev = I;
-        I->second.setCorrectionDecl(TmpRes.getAsSingle<NamedDecl>());
+        Candidate.setCorrectionDecl(TmpRes.getAsSingle<NamedDecl>());
         ++I;
-        if (!isCandidateViable(CCC, Prev->second))
+        if (!isCandidateViable(CCC, Candidate))
           DI->second.erase(Prev);
         break;
       }
@@ -3978,8 +4010,8 @@
   // No corrections remain...
   if (Consumer.empty()) return TypoCorrection();
 
-  TypoResultsMap &BestResults = Consumer.begin()->second;
-  ED = TypoCorrection::NormalizeEditDistance(Consumer.begin()->first);
+  TypoResultsMap &BestResults = Consumer.getBestResults();
+  ED = Consumer.getBestEditDistance(true);
 
   if (ED > 0 && Typo->getName().size() / ED < 3) {
     // If this was an unqualified lookup and we believe the callback
@@ -3993,8 +4025,9 @@
 
   // If only a single name remains, return that result.
   if (BestResults.size() == 1) {
-    const llvm::StringMapEntry<TypoCorrection> &Correction = *(BestResults.begin());
-    const TypoCorrection &Result = Correction.second;
+    const TypoResultList &CorrectionList = BestResults.begin()->second;
+    const TypoCorrection &Result = CorrectionList.front();
+    if (CorrectionList.size() != 1) return TypoCorrection();
 
     // Don't correct to a keyword that's the same as the typo; the keyword
     // wasn't actually in scope.
@@ -4012,7 +4045,7 @@
            // some instances of CTC_Unknown, while WantRemainingKeywords is true
            // for CTC_Unknown but not for CTC_ObjCMessageReceiver.
            && CCC.WantObjCSuper && !CCC.WantRemainingKeywords
-           && BestResults["super"].isKeyword()) {
+           && BestResults["super"].front().isKeyword()) {
     // Prefer 'super' when we're completing in a message-receiver
     // context.
 
@@ -4022,9 +4055,9 @@
 
     // Record the correction for unqualified lookup.
     if (IsUnqualifiedLookup)
-      UnqualifiedTyposCorrected[Typo] = BestResults["super"];
+      UnqualifiedTyposCorrected[Typo] = BestResults["super"].front();
 
-    return BestResults["super"];
+    return BestResults["super"].front();
   }
 
   // If this was an unqualified lookup and we believe the callback object did

Modified: cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp Mon Jun  4 13:40:31 2012
@@ -1114,9 +1114,9 @@
         isa<ObjCObjectPointerType>(GetterType))
       compat =
         Context.canAssignObjCInterfaces(
-                                      PropertyIvarType->getAs<ObjCObjectPointerType>(),
-                                      GetterType->getAs<ObjCObjectPointerType>());
-    else if (CheckAssignmentConstraints(Loc, PropertyIvarType, GetterType) 
+                                      GetterType->getAs<ObjCObjectPointerType>(),
+                                      PropertyIvarType->getAs<ObjCObjectPointerType>());
+    else if (CheckAssignmentConstraints(Loc, GetterType, PropertyIvarType) 
               != Compatible) {
           Diag(Loc, diag::error_property_accessor_type)
             << property->getDeclName() << PropertyIvarType

Modified: cfe/branches/tooling/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaOverload.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaOverload.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaOverload.cpp Mon Jun  4 13:40:31 2012
@@ -6120,40 +6120,49 @@
   const PointerType *PointerTy = Ty->getAs<PointerType>();
   bool buildObjCPtr = false;
   if (!PointerTy) {
-    if (const ObjCObjectPointerType *PTy = Ty->getAs<ObjCObjectPointerType>()) {
-      PointeeTy = PTy->getPointeeType();
-      buildObjCPtr = true;
-    }
-    else
-      llvm_unreachable("type was not a pointer type!");
-  }
-  else
+    const ObjCObjectPointerType *PTy = Ty->castAs<ObjCObjectPointerType>();
+    PointeeTy = PTy->getPointeeType();
+    buildObjCPtr = true;
+  } else {
     PointeeTy = PointerTy->getPointeeType();
-
+  }
+  
   // Don't add qualified variants of arrays. For one, they're not allowed
   // (the qualifier would sink to the element type), and for another, the
   // only overload situation where it matters is subscript or pointer +- int,
   // and those shouldn't have qualifier variants anyway.
   if (PointeeTy->isArrayType())
     return true;
+  
   unsigned BaseCVR = PointeeTy.getCVRQualifiers();
-  if (const ConstantArrayType *Array =Context.getAsConstantArrayType(PointeeTy))
-    BaseCVR = Array->getElementType().getCVRQualifiers();
   bool hasVolatile = VisibleQuals.hasVolatile();
   bool hasRestrict = VisibleQuals.hasRestrict();
 
   // Iterate through all strict supersets of BaseCVR.
   for (unsigned CVR = BaseCVR+1; CVR <= Qualifiers::CVRMask; ++CVR) {
     if ((CVR | BaseCVR) != CVR) continue;
-    // Skip over Volatile/Restrict if no Volatile/Restrict found anywhere
-    // in the types.
+    // Skip over volatile if no volatile found anywhere in the types.
     if ((CVR & Qualifiers::Volatile) && !hasVolatile) continue;
-    if ((CVR & Qualifiers::Restrict) && !hasRestrict) continue;
+    
+    // Skip over restrict if no restrict found anywhere in the types, or if
+    // the type cannot be restrict-qualified.
+    if ((CVR & Qualifiers::Restrict) &&
+        (!hasRestrict ||
+         (!(PointeeTy->isAnyPointerType() || PointeeTy->isReferenceType()))))
+      continue;
+  
+    // Build qualified pointee type.
     QualType QPointeeTy = Context.getCVRQualifiedType(PointeeTy, CVR);
+    
+    // Build qualified pointer type.
+    QualType QPointerTy;
     if (!buildObjCPtr)
-      PointerTypes.insert(Context.getPointerType(QPointeeTy));
+      QPointerTy = Context.getPointerType(QPointeeTy);
     else
-      PointerTypes.insert(Context.getObjCObjectPointerType(QPointeeTy));
+      QPointerTy = Context.getObjCObjectPointerType(QPointeeTy);
+    
+    // Insert qualified pointer type.
+    PointerTypes.insert(QPointerTy);
   }
 
   return true;
@@ -6350,6 +6359,8 @@
         // as see them.
         bool done = false;
         while (!done) {
+          if (CanTy.isRestrictQualified())
+            VRQuals.addRestrict();
           if (const PointerType *ResTypePtr = CanTy->getAs<PointerType>())
             CanTy = ResTypePtr->getPointeeType();
           else if (const MemberPointerType *ResTypeMPtr =
@@ -6359,8 +6370,6 @@
             done = true;
           if (CanTy.isVolatileQualified())
             VRQuals.addVolatile();
-          if (CanTy.isRestrictQualified())
-            VRQuals.addRestrict();
           if (VRQuals.hasRestrict() && VRQuals.hasVolatile())
             return VRQuals;
         }
@@ -6488,7 +6497,8 @@
   /// \brief Helper method to factor out the common pattern of adding overloads
   /// for '++' and '--' builtin operators.
   void addPlusPlusMinusMinusStyleOverloads(QualType CandidateTy,
-                                           bool HasVolatile) {
+                                           bool HasVolatile,
+                                           bool HasRestrict) {
     QualType ParamTypes[2] = {
       S.Context.getLValueReferenceType(CandidateTy),
       S.Context.IntTy
@@ -6511,6 +6521,33 @@
       else
         S.AddBuiltinCandidate(CandidateTy, ParamTypes, Args, 2, CandidateSet);
     }
+    
+    // Add restrict version only if there are conversions to a restrict type
+    // and our candidate type is a non-restrict-qualified pointer.
+    if (HasRestrict && CandidateTy->isAnyPointerType() &&
+        !CandidateTy.isRestrictQualified()) {
+      ParamTypes[0]
+        = S.Context.getLValueReferenceType(
+            S.Context.getCVRQualifiedType(CandidateTy, Qualifiers::Restrict));
+      if (NumArgs == 1)
+        S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 1, CandidateSet);
+      else
+        S.AddBuiltinCandidate(CandidateTy, ParamTypes, Args, 2, CandidateSet);
+      
+      if (HasVolatile) {
+        ParamTypes[0]
+          = S.Context.getLValueReferenceType(
+              S.Context.getCVRQualifiedType(CandidateTy,
+                                            (Qualifiers::Volatile |
+                                             Qualifiers::Restrict)));
+        if (NumArgs == 1)
+          S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 1,
+                                CandidateSet);
+        else
+          S.AddBuiltinCandidate(CandidateTy, ParamTypes, Args, 2, CandidateSet);
+      }
+    }
+
   }
 
 public:
@@ -6565,7 +6602,8 @@
          Arith < NumArithmeticTypes; ++Arith) {
       addPlusPlusMinusMinusStyleOverloads(
         getArithmeticType(Arith),
-        VisibleTypeConversionsQuals.hasVolatile());
+        VisibleTypeConversionsQuals.hasVolatile(),
+        VisibleTypeConversionsQuals.hasRestrict());
     }
   }
 
@@ -6589,8 +6627,10 @@
         continue;
 
       addPlusPlusMinusMinusStyleOverloads(*Ptr,
-        (!S.Context.getCanonicalType(*Ptr).isVolatileQualified() &&
-         VisibleTypeConversionsQuals.hasVolatile()));
+        (!(*Ptr).isVolatileQualified() &&
+         VisibleTypeConversionsQuals.hasVolatile()),
+        (!(*Ptr).isRestrictQualified() &&
+         VisibleTypeConversionsQuals.hasRestrict()));
     }
   }
 
@@ -7048,14 +7088,36 @@
       S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 2, CandidateSet,
                             /*IsAssigmentOperator=*/ isEqualOp);
 
-      if (!S.Context.getCanonicalType(*Ptr).isVolatileQualified() &&
-          VisibleTypeConversionsQuals.hasVolatile()) {
+      bool NeedVolatile = !(*Ptr).isVolatileQualified() &&
+                          VisibleTypeConversionsQuals.hasVolatile();
+      if (NeedVolatile) {
         // volatile version
         ParamTypes[0] =
           S.Context.getLValueReferenceType(S.Context.getVolatileType(*Ptr));
         S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 2, CandidateSet,
                               /*IsAssigmentOperator=*/isEqualOp);
       }
+      
+      if (!(*Ptr).isRestrictQualified() &&
+          VisibleTypeConversionsQuals.hasRestrict()) {
+        // restrict version
+        ParamTypes[0]
+          = S.Context.getLValueReferenceType(S.Context.getRestrictType(*Ptr));
+        S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 2, CandidateSet,
+                              /*IsAssigmentOperator=*/isEqualOp);
+        
+        if (NeedVolatile) {
+          // volatile restrict version
+          ParamTypes[0]
+            = S.Context.getLValueReferenceType(
+                S.Context.getCVRQualifiedType(*Ptr,
+                                              (Qualifiers::Volatile |
+                                               Qualifiers::Restrict)));
+          S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 2,
+                                CandidateSet,
+                                /*IsAssigmentOperator=*/isEqualOp);
+        }
+      }
     }
 
     if (isEqualOp) {
@@ -7076,14 +7138,36 @@
         S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 2, CandidateSet,
                               /*IsAssigmentOperator=*/true);
 
-        if (!S.Context.getCanonicalType(*Ptr).isVolatileQualified() &&
-            VisibleTypeConversionsQuals.hasVolatile()) {
+        bool NeedVolatile = !(*Ptr).isVolatileQualified() &&
+                           VisibleTypeConversionsQuals.hasVolatile();
+        if (NeedVolatile) {
           // volatile version
           ParamTypes[0] =
             S.Context.getLValueReferenceType(S.Context.getVolatileType(*Ptr));
           S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 2,
                                 CandidateSet, /*IsAssigmentOperator=*/true);
         }
+      
+        if (!(*Ptr).isRestrictQualified() &&
+            VisibleTypeConversionsQuals.hasRestrict()) {
+          // restrict version
+          ParamTypes[0]
+            = S.Context.getLValueReferenceType(S.Context.getRestrictType(*Ptr));
+          S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 2,
+                                CandidateSet, /*IsAssigmentOperator=*/true);
+          
+          if (NeedVolatile) {
+            // volatile restrict version
+            ParamTypes[0]
+              = S.Context.getLValueReferenceType(
+                  S.Context.getCVRQualifiedType(*Ptr,
+                                                (Qualifiers::Volatile |
+                                                 Qualifiers::Restrict)));
+            S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 2,
+                                  CandidateSet, /*IsAssigmentOperator=*/true);
+            
+          }
+        }
       }
     }
   }

Modified: cfe/branches/tooling/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaType.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaType.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaType.cpp Mon Jun  4 13:40:31 2012
@@ -2736,7 +2736,7 @@
   // TODO: mark whether we did this inference?
 }
 
-/// \brief Used for transfering ownership in casts resulting in l-values.
+/// \brief Used for transferring ownership in casts resulting in l-values.
 static void transferARCOwnership(TypeProcessingState &state,
                                  QualType &declSpecTy,
                                  Qualifiers::ObjCLifetime ownership) {

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp Mon Jun  4 13:40:31 2012
@@ -88,6 +88,7 @@
         new BugReport(*BT_undef, BT_undef->getDescription(), N);
       report->addVisitor(bugreporter::getTrackNullOrUndefValueVisitor(N,
                                         bugreporter::GetDerefExpr(N), report));
+      report->disablePathPruning();
       C.EmitReport(report);
     }
     return;

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp Mon Jun  4 13:40:31 2012
@@ -273,7 +273,7 @@
 
   // Skipping the following functions, since they might be used for cleansing
   // or smart memory copy:
-  // - memccpy - copying untill hitting a special character.
+  // - memccpy - copying until hitting a special character.
 
   return TaintPropagationRule();
 }

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp Mon Jun  4 13:40:31 2012
@@ -106,6 +106,7 @@
   typedef llvm::DenseMap<const BinaryOperator *, BinaryOperatorData>
       AssumptionMap;
   mutable AssumptionMap hash;
+  mutable OwningPtr<BugType> BT;
 };
 }
 
@@ -343,7 +344,9 @@
 void IdempotentOperationChecker::checkEndAnalysis(ExplodedGraph &G,
                                                   BugReporter &BR,
                                                   ExprEngine &Eng) const {
-  BugType *BT = new BugType("Idempotent operation", "Dead code");
+  if (!BT)
+    BT.reset(new BugType("Idempotent operation", "Dead code"));
+
   // Iterate over the hash to see if we have any paths with definite
   // idempotent operations.
   for (AssumptionMap::const_iterator i = hash.begin(); i != hash.end(); ++i) {

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Mon Jun  4 13:40:31 2012
@@ -1286,7 +1286,7 @@
     // 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
+      // is not transferred only if the deallocator argument is
       // 'kCFAllocatorNull'.
       for (unsigned i = 1; i < Call->getNumArgs(); ++i) {
         const Expr *ArgE = Call->getArg(i)->IgnoreParenCasts();
@@ -1368,7 +1368,7 @@
     }
 
     // If the first selector ends with NoCopy, assume that the ownership is
-    // transfered as well.
+    // transferred as well.
     // Ex:  [NSData dataWithBytesNoCopy:bytes length:10];
     if (S.getNameForSlot(0).endswith("NoCopy")) {
       return false;

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp Mon Jun  4 13:40:31 2012
@@ -53,6 +53,7 @@
   BugReport *report = 
     new BugReport(*BT, BT->getDescription(), N);
 
+  report->disablePathPruning();
   report->addRange(RetE->getSourceRange());
   report->addVisitor(bugreporter::getTrackNullOrUndefValueVisitor(N, RetE,
                                                                   report));

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp Mon Jun  4 13:40:31 2012
@@ -101,6 +101,7 @@
       BugReport *R = new BugReport(*BT, BT->getDescription(), N);
       R->addVisitor(bugreporter::getTrackNullOrUndefValueVisitor(N, Ex, R));
       R->addRange(Ex->getSourceRange());
+      R->disablePathPruning();
 
       Ctx.EmitReport(R);
     }

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp Mon Jun  4 13:40:31 2012
@@ -94,6 +94,7 @@
         if (const Expr *Ex = FindBlockDeclRefExpr(BE->getBody(), VD))
           R->addRange(Ex->getSourceRange());
         R->addVisitor(new FindLastStoreBRVisitor(VRVal, VR));
+        R->disablePathPruning();
         // need location of block
         C.EmitReport(R);
       }

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp Mon Jun  4 13:40:31 2012
@@ -80,6 +80,7 @@
     R->addRange(ex->getSourceRange());
     R->addVisitor(bugreporter::getTrackNullOrUndefValueVisitor(N, ex, R));
   }
+  R->disablePathPruning();
   C.EmitReport(R);
 }
 

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/BugReporter.cpp Mon Jun  4 13:40:31 2012
@@ -1861,9 +1861,11 @@
   } while(finalReportConfigToken != originalReportConfigToken);
 
   // Finally, prune the diagnostic path of uninteresting stuff.
-  bool hasSomethingInteresting = RemoveUneededCalls(PD.getMutablePieces());
-  assert(hasSomethingInteresting);
-  (void) hasSomethingInteresting;
+  if (R->shouldPrunePath()) {
+    bool hasSomethingInteresting = RemoveUneededCalls(PD.getMutablePieces());
+    assert(hasSomethingInteresting);
+    (void) hasSomethingInteresting;
+  }
 }
 
 void BugReporter::Register(BugType *BT) {

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/ExplodedGraph.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ExplodedGraph.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ExplodedGraph.cpp Mon Jun  4 13:40:31 2012
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/ParentMap.h"
@@ -67,6 +68,8 @@
   // (6) The 'GDM' is the same as the predecessor.
   // (7) The LocationContext is the same as the predecessor.
   // (8) The PostStmt is for a non-consumed Stmt or Expr.
+  // (9) The successor is a CallExpr StmtPoint (so that we would be able to
+  //     find it when retrying a call with no inlining).
 
   // Conditions 1 and 2.
   if (node->pred_size() != 1 || node->succ_size() != 1)
@@ -109,7 +112,13 @@
       return false;
   }
   
-  return true; 
+  // Condition 9.
+  const ProgramPoint SuccLoc = succ->getLocation();
+  if (const StmtPoint *SP = dyn_cast<StmtPoint>(&SuccLoc))
+    if (CallOrObjCMessage::canBeInlined(SP->getStmt()))
+      return false;
+
+  return true;
 }
 
 void ExplodedGraph::collectNode(ExplodedNode *node) {

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngine.cpp Mon Jun  4 13:40:31 2012
@@ -250,7 +250,7 @@
     return true;
     
   // Run before processing a call.
-  if (isa<CallExpr>(S.getStmt()))
+  if (CallOrObjCMessage::canBeInlined(S.getStmt()))
     return true;
 
   // Is this an expression that is consumed by another expression?  If so,

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp Mon Jun  4 13:40:31 2012
@@ -103,7 +103,12 @@
 
   const StackFrameContext *calleeCtx =
       CEBNode->getLocationContext()->getCurrentStackFrame();
-  const LocationContext *callerCtx = calleeCtx->getParent();
+  
+  // The parent context might not be a stack frame, so make sure we
+  // look up the first enclosing stack frame.
+  const StackFrameContext *callerCtx =
+    calleeCtx->getParent()->getCurrentStackFrame();
+  
   const Stmt *CE = calleeCtx->getCallSite();
   ProgramStateRef state = CEBNode->getState();
   // Find the last statement in the function and the corresponding basic block.
@@ -154,6 +159,8 @@
     removeDead(BindedRetNode, CleanedNodes, 0, callerCtx, LastSt,
                ProgramPoint::PostStmtPurgeDeadSymbolsKind);
     currentBuilderContext = 0;
+  } else {
+    CleanedNodes.Add(CEBNode);
   }
 
   for (ExplodedNodeSet::iterator I = CleanedNodes.begin(),
@@ -199,8 +206,8 @@
 }
 
 // Determine if we should inline the call.
-bool ExprEngine::shouldInlineDecl(const FunctionDecl *FD, ExplodedNode *Pred) {
-  AnalysisDeclContext *CalleeADC = AMgr.getAnalysisDeclContext(FD);
+bool ExprEngine::shouldInlineDecl(const Decl *D, ExplodedNode *Pred) {
+  AnalysisDeclContext *CalleeADC = AMgr.getAnalysisDeclContext(D);
   const CFG *CalleeCFG = CalleeADC->getCFG();
 
   // It is possible that the CFG cannot be constructed.
@@ -212,7 +219,7 @@
         == AMgr.InlineMaxStackDepth)
     return false;
 
-  if (Engine.FunctionSummaries->hasReachedMaxBlockCount(FD))
+  if (Engine.FunctionSummaries->hasReachedMaxBlockCount(D))
     return false;
 
   if (CalleeCFG->getNumBlockIDs() > AMgr.InlineMaxFunctionSize)
@@ -231,10 +238,7 @@
   if (const PointerType *PT = callee->getAs<PointerType>())
     FT = dyn_cast<FunctionProtoType>(PT->getPointeeType());
   else if (const BlockPointerType *BT = callee->getAs<BlockPointerType>()) {
-    // FIXME: inline blocks.
-    // FT = dyn_cast<FunctionProtoType>(BT->getPointeeType());
-    (void) BT;
-    return false;
+    FT = dyn_cast<FunctionProtoType>(BT->getPointeeType());
   }
   // If we have no prototype, assume the function is okay.
   if (!FT)
@@ -250,41 +254,64 @@
   if (!shouldInlineCallExpr(CE, this))
     return false;
 
+  const StackFrameContext *CallerSFC =
+    Pred->getLocationContext()->getCurrentStackFrame();
+
   ProgramStateRef state = Pred->getState();
   const Expr *Callee = CE->getCallee();
-  const FunctionDecl *FD =
-    state->getSVal(Callee, Pred->getLocationContext()).getAsFunctionDecl();
-  if (!FD || !FD->hasBody(FD))
-    return false;
+  SVal CalleeVal = state->getSVal(Callee, Pred->getLocationContext());
+  const Decl *D = 0;
+  const LocationContext *ParentOfCallee = 0;
+  
+  if (const FunctionDecl *FD = CalleeVal.getAsFunctionDecl()) {
+    if (!FD->hasBody(FD))
+      return false;
   
-  switch (CE->getStmtClass()) {
-    default:
-      // FIXME: Handle C++.
-      break;
-    case Stmt::CallExprClass: {
-      if (!shouldInlineDecl(FD, Pred))
-        return false;
-
-      // Construct a new stack frame for the callee.
-      AnalysisDeclContext *CalleeADC = AMgr.getAnalysisDeclContext(FD);
-      const StackFrameContext *CallerSFC =
-      Pred->getLocationContext()->getCurrentStackFrame();
-      const StackFrameContext *CalleeSFC =
-      CalleeADC->getStackFrame(CallerSFC, CE,
-                               currentBuilderContext->getBlock(),
-                               currentStmtIdx);
-      
-      CallEnter Loc(CE, CalleeSFC, Pred->getLocationContext());
-      bool isNew;
-      if (ExplodedNode *N = G.getNode(Loc, state, false, &isNew)) {
-        N->addPredecessor(Pred, G);
-        if (isNew)
-          Engine.getWorkList()->enqueue(N);
+    switch (CE->getStmtClass()) {
+      default:
+        // FIXME: Handle C++.
+        break;
+      case Stmt::CallExprClass: {
+        D = FD;
+        break;
+        
       }
-      return true;
     }
+  } else if (const BlockDataRegion *BR =
+              dyn_cast_or_null<BlockDataRegion>(CalleeVal.getAsRegion())) {
+    assert(CE->getStmtClass() == Stmt::CallExprClass);
+    const BlockDecl *BD = BR->getDecl();
+    D = BD;
+    AnalysisDeclContext *BlockCtx = AMgr.getAnalysisDeclContext(BD);
+    ParentOfCallee = BlockCtx->getBlockInvocationContext(CallerSFC,
+                                                         BD,
+                                                         BR);
+  } else {
+    // This is case we don't handle yet.
+    return false;
   }
-  return false;
+  
+  if (!D || !shouldInlineDecl(D, Pred))
+    return false;
+  
+  if (!ParentOfCallee)
+    ParentOfCallee = CallerSFC;
+
+  // Construct a new stack frame for the callee.
+  AnalysisDeclContext *CalleeADC = AMgr.getAnalysisDeclContext(D);
+  const StackFrameContext *CalleeSFC =
+    CalleeADC->getStackFrame(ParentOfCallee, CE,
+                             currentBuilderContext->getBlock(),
+                             currentStmtIdx);
+  
+  CallEnter Loc(CE, CalleeSFC, Pred->getLocationContext());
+  bool isNew;
+  if (ExplodedNode *N = G.getNode(Loc, state, false, &isNew)) {
+    N->addPredecessor(Pred, G);
+    if (isNew)
+      Engine.getWorkList()->enqueue(N);
+  }
+  return true;
 }
 
 static bool isPointerToConst(const ParmVarDecl *ParamDecl) {

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/MemRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/MemRegion.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/MemRegion.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/MemRegion.cpp Mon Jun  4 13:40:31 2012
@@ -643,6 +643,37 @@
   return getSubRegion<ObjCStringRegion>(Str, getGlobalsRegion());
 }
 
+/// Look through a chain of LocationContexts to either find the
+/// StackFrameContext that matches a DeclContext, or find a VarRegion
+/// for a variable captured by a block.
+static llvm::PointerUnion<const StackFrameContext *, const VarRegion *>
+getStackOrCaptureRegionForDeclContext(const LocationContext *LC,
+                                      const DeclContext *DC,
+                                      const VarDecl *VD) {
+  while (LC) {
+    if (const StackFrameContext *SFC = dyn_cast<StackFrameContext>(LC)) {
+      if (cast<DeclContext>(SFC->getDecl()) == DC)
+        return SFC;
+    }
+    if (const BlockInvocationContext *BC =
+        dyn_cast<BlockInvocationContext>(LC)) {
+      const BlockDataRegion *BR =
+        static_cast<const BlockDataRegion*>(BC->getContextData());
+      // FIXME: This can be made more efficient.
+      for (BlockDataRegion::referenced_vars_iterator
+           I = BR->referenced_vars_begin(),
+           E = BR->referenced_vars_end(); I != E; ++I) {
+        if (const VarRegion *VR = dyn_cast<VarRegion>(I.getOriginalRegion()))
+          if (VR->getDecl() == VD)
+            return cast<VarRegion>(I.getCapturedRegion());
+      }
+    }
+    
+    LC = LC->getParent();
+  }
+  return (const StackFrameContext*)0;
+}
+
 const VarRegion* MemRegionManager::getVarRegion(const VarDecl *D,
                                                 const LocationContext *LC) {
   const MemRegion *sReg = 0;
@@ -675,7 +706,13 @@
     // FIXME: Once we implement scope handling, we will need to properly lookup
     // 'D' to the proper LocationContext.
     const DeclContext *DC = D->getDeclContext();
-    const StackFrameContext *STC = LC->getStackFrameForDeclContext(DC);
+    llvm::PointerUnion<const StackFrameContext *, const VarRegion *> V =
+      getStackOrCaptureRegionForDeclContext(LC, DC, D);
+    
+    if (V.is<const VarRegion*>())
+      return V.get<const VarRegion*>();
+    
+    const StackFrameContext *STC = V.get<const StackFrameContext*>();
 
     if (!STC)
       sReg = getUnknownRegion();

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/ProgramState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/ProgramState.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ProgramState.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ProgramState.cpp Mon Jun  4 13:40:31 2012
@@ -568,6 +568,16 @@
     if (!scan(SR->getSuperRegion()))
       return false;
 
+  // Regions captured by a block are also implicitly reachable.
+  if (const BlockDataRegion *BDR = dyn_cast<BlockDataRegion>(R)) {
+    BlockDataRegion::referenced_vars_iterator I = BDR->referenced_vars_begin(),
+                                              E = BDR->referenced_vars_end();
+    for ( ; I != E; ++I) {
+      if (!scan(I.getCapturedRegion()))
+        return false;
+    }
+  }
+
   // Now look at the binding to this region (if any).
   if (!scan(state->getSValAsScalarOrLoc(R)))
     return false;

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/RegionStore.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/RegionStore.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/RegionStore.cpp Mon Jun  4 13:40:31 2012
@@ -394,6 +394,12 @@
                            const LocationContext *callerCtx,
                            const StackFrameContext *calleeCtx);
 
+  StoreRef enterStackFrame(ProgramStateRef state,
+                           const FunctionDecl *FD,
+                           const LocationContext *callerCtx,
+                           const StackFrameContext *calleeCtx);
+
+  
   //===------------------------------------------------------------------===//
   // Region "extents".
   //===------------------------------------------------------------------===//
@@ -1944,8 +1950,18 @@
   }
 
   // If V is a region, then add it to the worklist.
-  if (const MemRegion *R = V.getAsRegion())
+  if (const MemRegion *R = V.getAsRegion()) {
     AddToWorkList(R);
+    
+    // All regions captured by a block are also live.
+    if (const BlockDataRegion *BR = dyn_cast<BlockDataRegion>(R)) {
+      BlockDataRegion::referenced_vars_iterator I = BR->referenced_vars_begin(),
+                                                E = BR->referenced_vars_end();
+        for ( ; I != E; ++I)
+          AddToWorkList(I.getCapturedRegion());
+    }
+  }
+    
 
   // Update the set of live symbols.
   for (SymExpr::symbol_iterator SI = V.symbol_begin(), SE = V.symbol_end();
@@ -1964,21 +1980,6 @@
     // should continue to track that symbol.
     if (const SymbolicRegion *SymR = dyn_cast<SymbolicRegion>(R))
       SymReaper.markLive(SymR->getSymbol());
-
-    // For BlockDataRegions, enqueue the VarRegions for variables marked
-    // with __block (passed-by-reference).
-    // via BlockDeclRefExprs.
-    if (const BlockDataRegion *BD = dyn_cast<BlockDataRegion>(R)) {
-      for (BlockDataRegion::referenced_vars_iterator
-           RI = BD->referenced_vars_begin(), RE = BD->referenced_vars_end();
-           RI != RE; ++RI) {
-        if ((*RI)->getDecl()->getAttr<BlocksAttr>())
-          AddToWorkList(*RI);
-      }
-
-      // No possible data bindings on a BlockDataRegion.
-      return;
-    }
   }
 
   // Visit the data binding for K.
@@ -2045,12 +2046,37 @@
   return StoreRef(B.getRootWithoutRetain(), *this);
 }
 
+StoreRef RegionStoreManager::enterStackFrame(ProgramStateRef state,
+                                             const LocationContext *callerCtx,
+                                             const StackFrameContext *calleeCtx)
+{
+  const Decl *D = calleeCtx->getDecl();
+  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
+    return enterStackFrame(state, FD, callerCtx, calleeCtx);
+  
+  // FIXME: when we handle more cases, this will need to be expanded.
+  
+  const BlockDecl *BD = cast<BlockDecl>(D);
+  BlockDecl::param_const_iterator PI = BD->param_begin(),
+                                  PE = BD->param_end();
+  StoreRef store = StoreRef(state->getStore(), *this);
+  const CallExpr *CE = cast<CallExpr>(calleeCtx->getCallSite());
+  CallExpr::const_arg_iterator AI = CE->arg_begin(), AE = CE->arg_end();
+  for (; AI != AE && PI != PE; ++AI, ++PI) {
+    SVal ArgVal = state->getSVal(*AI, callerCtx);
+    store = Bind(store.getStore(),
+                 svalBuilder.makeLoc(MRMgr.getVarRegion(*PI, calleeCtx)),
+                 ArgVal);
+  }
+  
+  return store;
+}
 
 StoreRef RegionStoreManager::enterStackFrame(ProgramStateRef state,
+                                             const FunctionDecl *FD,
                                              const LocationContext *callerCtx,
                                              const StackFrameContext *calleeCtx)
 {
-  FunctionDecl const *FD = cast<FunctionDecl>(calleeCtx->getDecl());
   FunctionDecl::param_const_iterator PI = FD->param_begin(), 
                                      PE = FD->param_end();
   StoreRef store = StoreRef(state->getStore(), *this);

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Mon Jun  4 13:40:31 2012
@@ -230,7 +230,7 @@
 
   /// \brief Build the call graph for all the top level decls of this TU and
   /// use it to define the order in which the functions should be visited.
-  void HandleDeclsGallGraph();
+  void HandleDeclsGallGraph(const unsigned LocalTUDeclsSize);
 
   /// \brief Run analyzes(syntax or path sensitive) on the given function.
   /// \param Mode - determines if we are requesting syntax only or path
@@ -311,14 +311,18 @@
   }
 }
 
-void AnalysisConsumer::HandleDeclsGallGraph() {
+void AnalysisConsumer::HandleDeclsGallGraph(const unsigned LocalTUDeclsSize) {
   // Otherwise, use the Callgraph to derive the order.
   // Build the Call Graph.
   CallGraph CG;
+
   // Add all the top level declarations to the graph.
-  for (SetOfDecls::iterator I = LocalTUDecls.begin(),
-                            E = LocalTUDecls.end(); I != E; ++I)
-    CG.addToCallGraph(*I);
+  // Note: CallGraph can trigger deserialization of more items from a pch
+  // (though HandleInterestingDecl); triggering additions to LocalTUDecls.
+  // We rely on random access to add the initially processed Decls to CG.
+  for (unsigned i = 0 ; i < LocalTUDeclsSize ; ++i) {
+    CG.addToCallGraph(LocalTUDecls[i]);
+  }
 
   // Find the top level nodes - children of root + the unreachable (parentless)
   // nodes.
@@ -408,13 +412,13 @@
     // entries.  Thus we don't use an iterator, but rely on LocalTUDecls
     // random access.  By doing so, we automatically compensate for iterators
     // possibly being invalidated, although this is a bit slower.
-    const unsigned n = LocalTUDecls.size();
-    for (unsigned i = 0 ; i < n ; ++i) {
+    const unsigned LocalTUDeclsSize = LocalTUDecls.size();
+    for (unsigned i = 0 ; i < LocalTUDeclsSize ; ++i) {
       TraverseDecl(LocalTUDecls[i]);
     }
 
     if (Mgr->shouldInlineCall())
-      HandleDeclsGallGraph();
+      HandleDeclsGallGraph(LocalTUDeclsSize);
 
     // After all decls handled, run checkers on the entire TranslationUnit.
     checkerMgr->runCheckersOnEndOfTranslationUnit(TU, *Mgr, BR);

Modified: cfe/branches/tooling/lib/Tooling/Refactoring.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Tooling/Refactoring.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Tooling/Refactoring.cpp (original)
+++ cfe/branches/tooling/lib/Tooling/Refactoring.cpp Mon Jun  4 13:40:31 2012
@@ -71,6 +71,14 @@
   return RewriteSucceeded;
 }
 
+std::string Replacement::toString() const {
+  std::string result;
+  llvm::raw_string_ostream stream(result);
+  stream << FilePath << ": " << Offset << ":+" << Length
+         << ":\"" << ReplacementText << "\"";
+  return result;
+}
+
 bool Replacement::Less::operator()(const Replacement &R1,
                                    const Replacement &R2) const {
   if (R1.FilePath != R2.FilePath) return R1.FilePath < R2.FilePath;

Modified: cfe/branches/tooling/lib/Tooling/Tooling.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Tooling/Tooling.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Tooling/Tooling.cpp (original)
+++ cfe/branches/tooling/lib/Tooling/Tooling.cpp Mon Jun  4 13:40:31 2012
@@ -166,7 +166,9 @@
 }
 
 void ToolInvocation::mapVirtualFile(StringRef FilePath, StringRef Content) {
-  MappedFileContents[FilePath] = Content;
+  SmallString<1024> PathStorage;
+  llvm::sys::path::native(FilePath, PathStorage);
+  MappedFileContents[PathStorage] = Content;
 }
 
 bool ToolInvocation::run() {
@@ -193,17 +195,15 @@
   }
   llvm::OwningPtr<clang::CompilerInvocation> Invocation(
       newInvocation(&Diagnostics, *CC1Args));
-  return runInvocation(BinaryName, Compilation.get(),
-                       Invocation.take(), *CC1Args, ToolAction.take());
+  return runInvocation(BinaryName, Compilation.get(), Invocation.take(),
+                       *CC1Args);
 }
 
 bool ToolInvocation::runInvocation(
     const char *BinaryName,
     clang::driver::Compilation *Compilation,
     clang::CompilerInvocation *Invocation,
-    const clang::driver::ArgStringList &CC1Args,
-    clang::FrontendAction *ToolAction) {
-  llvm::OwningPtr<clang::FrontendAction> ScopedToolAction(ToolAction);
+    const clang::driver::ArgStringList &CC1Args) {
   // Show the invocation, with -v.
   if (Invocation->getHeaderSearchOpts().Verbose) {
     llvm::errs() << "clang Invocation:\n";
@@ -217,6 +217,11 @@
   Compiler.setFileManager(Files);
   // FIXME: What about LangOpts?
 
+  // ToolAction can have lifetime requirements for Compiler or its members, and
+  // we need to ensure it's deleted earlier than Compiler. So we pass it to an
+  // OwningPtr declared after the Compiler variable.
+  llvm::OwningPtr<FrontendAction> ScopedToolAction(ToolAction.take());
+
   // Create the compilers actual diagnostics engine.
   Compiler.createDiagnostics(CC1Args.size(),
                              const_cast<char**>(CC1Args.data()));
@@ -235,7 +240,7 @@
         clang::CompilerInvocation::GetResourcesPath(BinaryName, SymbolAddr);
   }
 
-  const bool Success = Compiler.ExecuteAction(*ToolAction);
+  const bool Success = Compiler.ExecuteAction(*ScopedToolAction);
 
   Compiler.resetAndLeakFileManager();
   return Success;
@@ -251,8 +256,7 @@
     // FIXME: figure out what '0' stands for.
     const FileEntry *FromFile = Files->getVirtualFile(
         It->getKey(), Input->getBufferSize(), 0);
-    // FIXME: figure out memory management ('true').
-    Sources.overrideFileContents(FromFile, Input, true);
+    Sources.overrideFileContents(FromFile, Input);
   }
 }
 

Modified: cfe/branches/tooling/test/ARCMT/Common.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/Common.h?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/Common.h (original)
+++ cfe/branches/tooling/test/ARCMT/Common.h Mon Jun  4 13:40:31 2012
@@ -6,6 +6,7 @@
 
 #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
 #define CF_CONSUMED __attribute__((cf_consumed))
+#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
 
 #define NS_INLINE static __inline__ __attribute__((always_inline))
 #define nil ((void*) 0)
@@ -21,7 +22,7 @@
 
 typedef const void * CFTypeRef;
 CFTypeRef CFRetain(CFTypeRef cf);
-id CFBridgingRelease(CFTypeRef CF_CONSUMED X);
+CFTypeRef CFMakeCollectable(CFTypeRef cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
 
 NS_INLINE NS_RETURNS_RETAINED id NSMakeCollectable(CFTypeRef CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
 
@@ -79,3 +80,25 @@
 
 void _dispatch_object_validate(dispatch_object_t object);
 void _xpc_object_validate(xpc_object_t object);
+
+#if __has_feature(objc_arc)
+
+NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) {
+    return (__bridge_retained CFTypeRef)X;
+}
+
+NS_INLINE id CFBridgingRelease(CFTypeRef CF_CONSUMED X) {
+    return (__bridge_transfer id)X;
+}
+
+#else
+
+NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) {
+    return X ? CFRetain((CFTypeRef)X) : NULL;
+}
+
+NS_INLINE id CFBridgingRelease(CFTypeRef CF_CONSUMED X) {
+    return [(id)CFMakeCollectable(X) autorelease];
+}
+
+#endif

Modified: cfe/branches/tooling/test/ARCMT/autoreleases.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/autoreleases.m.result?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/autoreleases.m.result (original)
+++ cfe/branches/tooling/test/ARCMT/autoreleases.m.result Mon Jun  4 13:40:31 2012
@@ -35,7 +35,7 @@
   _prop = newVal;
 }
 -(void) setProp2:(CFTypeRef) newVal {
-  _prop = (__bridge_transfer id)CFRetain(newVal);
+  _prop = (id)CFBridgingRelease(CFRetain(newVal));
 }
 
 -(id) xpc_prop {

Modified: cfe/branches/tooling/test/ARCMT/nonobjc-to-objc-cast.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/nonobjc-to-objc-cast.m.result?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/nonobjc-to-objc-cast.m.result (original)
+++ cfe/branches/tooling/test/ARCMT/nonobjc-to-objc-cast.m.result Mon Jun  4 13:40:31 2012
@@ -28,9 +28,9 @@
   str = (NSString *)p; // no change.
 
   CFUUIDRef   _uuid;
-  NSString *_uuidString = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid);
-  _uuidString = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid);
-  _uuidString = (__bridge_transfer NSString *)(CFRetain(_uuid));
+  NSString *_uuidString = (NSString *)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, _uuid));
+  _uuidString = (NSString *)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, _uuid));
+  _uuidString = CFBridgingRelease(CFRetain(_uuid));
 }
 
 @implementation NSString (StrExt)
@@ -47,16 +47,16 @@
   CFStringRef ref = (__bridge CFStringRef)([s string]);
   ref = (__bridge CFStringRef)[s string];
   ref = (__bridge CFStringRef)(s.string);
-  ref = (__bridge_retained CFStringRef)([NSString new]);
-  ref = (__bridge_retained CFStringRef)([s newString]);
-  ref = (__bridge_retained CFStringRef)[NSString new];
-  ref = (__bridge_retained CFStringRef)([[NSString alloc] init]);
-  ref = (__bridge_retained CFStringRef)([s string]);
-  ref = (__bridge_retained CFStringRef)[s string];
-  ref = (__bridge_retained CFTypeRef)([s string]);
-  ref = (__bridge_retained CFTypeRef)(s);
-  ref = (__bridge_retained CFStringRef)(s);
+  ref = CFBridgingRetain([NSString new]);
+  ref = CFBridgingRetain([s newString]);
+  ref = (CFStringRef)CFBridgingRetain([NSString new]);
+  ref = CFBridgingRetain([[NSString alloc] init]);
+  ref = CFBridgingRetain([s string]);
+  ref = (CFStringRef)CFBridgingRetain([s string]);
+  ref = CFBridgingRetain([s string]);
+  ref = CFBridgingRetain(s);
+  ref = CFBridgingRetain(s);
 
-  consumeParam((__bridge_retained CFStringRef)s);
-  consumeParam((__bridge_retained CFStringRef)(s));
+  consumeParam((CFStringRef)CFBridgingRetain(s));
+  consumeParam(CFBridgingRetain(s));
 }

Modified: cfe/branches/tooling/test/Analysis/blocks.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/blocks.m?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/blocks.m (original)
+++ cfe/branches/tooling/test/Analysis/blocks.m Mon Jun  4 13:40:31 2012
@@ -79,9 +79,7 @@
 void test2_b() {
   static int y = 0;
   __block int x;
-  // This is also a bug, but should be found not by checking the value
-  // 'x' is bound at block creation.
-  ^{ y = x + 1; }(); // no-warning
+  ^{ y = x + 1; }(); // expected-warning {{left operand of '+' is a garbage value}}
 }
 
 void test2_c() {

Modified: cfe/branches/tooling/test/Analysis/coverage.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/coverage.c?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/coverage.c (original)
+++ cfe/branches/tooling/test/Analysis/coverage.c Mon Jun  4 13:40:31 2012
@@ -92,3 +92,11 @@
   function_which_gives_up_settonull(&x);
   y = (*x);  // no warning
 }
+
+static void empty_function(){
+}
+int use_empty_function(int x) {
+    x = 0;
+    empty_function();
+    return 5/x; //expected-warning {{Division by zero}}
+}

Modified: cfe/branches/tooling/test/Analysis/inline-plist.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/inline-plist.c?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/inline-plist.c (original)
+++ cfe/branches/tooling/test/Analysis/inline-plist.c Mon Jun  4 13:40:31 2012
@@ -1,4 +1,4 @@
-// RUN: %clang --analyze %s -Xclang -analyzer-ipa=inlining -o %t
+// RUN: %clang --analyze %s -Xclang -analyzer-ipa=inlining -fblocks -o %t
 // RUN: FileCheck -input-file %t %s
 
 // <rdar://problem/10967815>
@@ -37,6 +37,32 @@
     triggers_bug(p);
 }
 
+// ========================================================================== //
+// Test inlining of blocks.
+// ========================================================================== //
+
+void test_block__capture_null() {
+  int *p = 0;
+  ^(){ *p = 1; }();
+}
+
+void test_block_ret() {
+  int *p = ^(){ int *q = 0; return q; }();
+  *p = 1;
+}
+
+void test_block_blockvar() {
+  __block int *p;
+  ^(){ p = 0; }();
+  *p = 1;
+}
+
+void test_block_arg() {
+  int *p;
+  ^(int **q){ *q = 0; }(&p);
+  *p = 1;
+}
+
 // CHECK: <?xml version="1.0" encoding="UTF-8"?>
 // CHECK: <plist version="1.0">
 // CHECK: <dict>
@@ -630,6 +656,528 @@
 // CHECK:    <key>file</key><integer>0</integer>
 // CHECK:   </dict>
 // CHECK:   </dict>
+// CHECK:   <dict>
+// CHECK:    <key>path</key>
+// CHECK:    <array>
+// CHECK:     <dict>
+// CHECK:      <key>kind</key><string>event</string>
+// CHECK:      <key>location</key>
+// CHECK:      <dict>
+// CHECK:       <key>line</key><integer>45</integer>
+// CHECK:       <key>col</key><integer>3</integer>
+// CHECK:       <key>file</key><integer>0</integer>
+// CHECK:      </dict>
+// CHECK:      <key>ranges</key>
+// CHECK:      <array>
+// CHECK:        <array>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>45</integer>
+// CHECK:          <key>col</key><integer>3</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>45</integer>
+// CHECK:          <key>col</key><integer>8</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:        </array>
+// CHECK:      </array>
+// CHECK:      <key>depth</key><integer>0</integer>
+// CHECK:      <key>extended_message</key>
+// CHECK:      <string>Variable 'p' initialized to a null pointer value</string>
+// CHECK:      <key>message</key>
+// CHECK: <string>Variable 'p' initialized to a null pointer value</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>45</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>45</integer>
+// CHECK:            <key>col</key><integer>8</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>46</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>46</integer>
+// CHECK:            <key>col</key><integer>3</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>
+// CHECK:      <key>location</key>
+// CHECK:      <dict>
+// CHECK:       <key>line</key><integer>46</integer>
+// CHECK:       <key>col</key><integer>3</integer>
+// CHECK:       <key>file</key><integer>0</integer>
+// CHECK:      </dict>
+// CHECK:      <key>ranges</key>
+// CHECK:      <array>
+// CHECK:        <array>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>46</integer>
+// CHECK:          <key>col</key><integer>3</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>46</integer>
+// CHECK:          <key>col</key><integer>18</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:        </array>
+// CHECK:      </array>
+// CHECK:      <key>depth</key><integer>0</integer>
+// CHECK:      <key>extended_message</key>
+// CHECK:      <string>Calling anonymous block</string>
+// CHECK:      <key>message</key>
+// CHECK: <string>Calling anonymous block</string>
+// CHECK:     </dict>
+// CHECK:     <dict>
+// CHECK:      <key>kind</key><string>event</string>
+// CHECK:      <key>location</key>
+// CHECK:      <dict>
+// CHECK:       <key>line</key><integer>46</integer>
+// CHECK:       <key>col</key><integer>3</integer>
+// CHECK:       <key>file</key><integer>0</integer>
+// CHECK:      </dict>
+// CHECK:      <key>depth</key><integer>1</integer>
+// CHECK:      <key>extended_message</key>
+// CHECK:      <string>Entered call from 'test_block__capture_null'</string>
+// CHECK:      <key>message</key>
+// CHECK: <string>Entered call from 'test_block__capture_null'</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>46</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>46</integer>
+// CHECK:            <key>col</key><integer>3</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>46</integer>
+// CHECK:            <key>col</key><integer>8</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>46</integer>
+// CHECK:            <key>col</key><integer>8</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>
+// CHECK:      <key>location</key>
+// CHECK:      <dict>
+// CHECK:       <key>line</key><integer>46</integer>
+// CHECK:       <key>col</key><integer>8</integer>
+// CHECK:       <key>file</key><integer>0</integer>
+// CHECK:      </dict>
+// CHECK:      <key>ranges</key>
+// CHECK:      <array>
+// CHECK:        <array>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>46</integer>
+// CHECK:          <key>col</key><integer>9</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>46</integer>
+// CHECK:          <key>col</key><integer>9</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:        </array>
+// CHECK:      </array>
+// CHECK:      <key>depth</key><integer>1</integer>
+// CHECK:      <key>extended_message</key>
+// CHECK:      <string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:      <key>message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:     </dict>
+// CHECK:    </array>
+// CHECK:    <key>description</key><string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:    <key>category</key><string>Logic error</string>
+// CHECK:    <key>type</key><string>Dereference of null pointer</string>
+// CHECK:   <key>location</key>
+// CHECK:   <dict>
+// CHECK:    <key>line</key><integer>46</integer>
+// CHECK:    <key>col</key><integer>8</integer>
+// CHECK:    <key>file</key><integer>0</integer>
+// CHECK:   </dict>
+// CHECK:   </dict>
+// CHECK:   <dict>
+// CHECK:    <key>path</key>
+// CHECK:    <array>
+// 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>50</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>50</integer>
+// CHECK:            <key>col</key><integer>3</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>50</integer>
+// CHECK:            <key>col</key><integer>12</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>50</integer>
+// CHECK:            <key>col</key><integer>12</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>control</string>
+// CHECK:      <key>edges</key>
+// CHECK:       <array>
+// CHECK:        <dict>
+// CHECK:         <key>start</key>
+// CHECK:          <array>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>50</integer>
+// CHECK:            <key>col</key><integer>12</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>50</integer>
+// CHECK:            <key>col</key><integer>41</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>51</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>51</integer>
+// CHECK:            <key>col</key><integer>3</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>
+// CHECK:      <key>location</key>
+// CHECK:      <dict>
+// CHECK:       <key>line</key><integer>51</integer>
+// CHECK:       <key>col</key><integer>3</integer>
+// CHECK:       <key>file</key><integer>0</integer>
+// CHECK:      </dict>
+// CHECK:      <key>ranges</key>
+// CHECK:      <array>
+// CHECK:        <array>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>51</integer>
+// CHECK:          <key>col</key><integer>4</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>51</integer>
+// CHECK:          <key>col</key><integer>4</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:        </array>
+// CHECK:      </array>
+// CHECK:      <key>depth</key><integer>0</integer>
+// CHECK:      <key>extended_message</key>
+// CHECK:      <string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:      <key>message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:     </dict>
+// CHECK:    </array>
+// CHECK:    <key>description</key><string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:    <key>category</key><string>Logic error</string>
+// CHECK:    <key>type</key><string>Dereference of null pointer</string>
+// CHECK:   <key>issue_context_kind</key><string>function</string>
+// CHECK:   <key>issue_context</key><string>test_block_ret</string>
+// CHECK:   <key>location</key>
+// CHECK:   <dict>
+// CHECK:    <key>line</key><integer>51</integer>
+// CHECK:    <key>col</key><integer>3</integer>
+// CHECK:    <key>file</key><integer>0</integer>
+// CHECK:   </dict>
+// CHECK:   </dict>
+// CHECK:   <dict>
+// CHECK:    <key>path</key>
+// CHECK:    <array>
+// 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>55</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>55</integer>
+// CHECK:            <key>col</key><integer>3</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>56</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>56</integer>
+// CHECK:            <key>col</key><integer>3</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>control</string>
+// CHECK:      <key>edges</key>
+// CHECK:       <array>
+// CHECK:        <dict>
+// CHECK:         <key>start</key>
+// CHECK:          <array>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>56</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>56</integer>
+// CHECK:            <key>col</key><integer>17</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>57</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>57</integer>
+// CHECK:            <key>col</key><integer>3</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>
+// CHECK:      <key>location</key>
+// CHECK:      <dict>
+// CHECK:       <key>line</key><integer>57</integer>
+// CHECK:       <key>col</key><integer>3</integer>
+// CHECK:       <key>file</key><integer>0</integer>
+// CHECK:      </dict>
+// CHECK:      <key>ranges</key>
+// CHECK:      <array>
+// CHECK:        <array>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>57</integer>
+// CHECK:          <key>col</key><integer>4</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>57</integer>
+// CHECK:          <key>col</key><integer>4</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:        </array>
+// CHECK:      </array>
+// CHECK:      <key>depth</key><integer>0</integer>
+// CHECK:      <key>extended_message</key>
+// CHECK:      <string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:      <key>message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:     </dict>
+// CHECK:    </array>
+// CHECK:    <key>description</key><string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:    <key>category</key><string>Logic error</string>
+// CHECK:    <key>type</key><string>Dereference of null pointer</string>
+// CHECK:   <key>issue_context_kind</key><string>function</string>
+// CHECK:   <key>issue_context</key><string>test_block_blockvar</string>
+// CHECK:   <key>location</key>
+// CHECK:   <dict>
+// CHECK:    <key>line</key><integer>57</integer>
+// CHECK:    <key>col</key><integer>3</integer>
+// CHECK:    <key>file</key><integer>0</integer>
+// CHECK:   </dict>
+// CHECK:   </dict>
+// CHECK:   <dict>
+// CHECK:    <key>path</key>
+// CHECK:    <array>
+// 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>61</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>61</integer>
+// CHECK:            <key>col</key><integer>3</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>62</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>62</integer>
+// CHECK:            <key>col</key><integer>3</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>control</string>
+// CHECK:      <key>edges</key>
+// CHECK:       <array>
+// CHECK:        <dict>
+// CHECK:         <key>start</key>
+// CHECK:          <array>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>62</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>62</integer>
+// CHECK:            <key>col</key><integer>27</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>63</integer>
+// CHECK:            <key>col</key><integer>3</integer>
+// CHECK:            <key>file</key><integer>0</integer>
+// CHECK:           </dict>
+// CHECK:           <dict>
+// CHECK:            <key>line</key><integer>63</integer>
+// CHECK:            <key>col</key><integer>3</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>
+// CHECK:      <key>location</key>
+// CHECK:      <dict>
+// CHECK:       <key>line</key><integer>63</integer>
+// CHECK:       <key>col</key><integer>3</integer>
+// CHECK:       <key>file</key><integer>0</integer>
+// CHECK:      </dict>
+// CHECK:      <key>ranges</key>
+// CHECK:      <array>
+// CHECK:        <array>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>63</integer>
+// CHECK:          <key>col</key><integer>4</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:         <dict>
+// CHECK:          <key>line</key><integer>63</integer>
+// CHECK:          <key>col</key><integer>4</integer>
+// CHECK:          <key>file</key><integer>0</integer>
+// CHECK:         </dict>
+// CHECK:        </array>
+// CHECK:      </array>
+// CHECK:      <key>depth</key><integer>0</integer>
+// CHECK:      <key>extended_message</key>
+// CHECK:      <string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:      <key>message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:     </dict>
+// CHECK:    </array>
+// CHECK:    <key>description</key><string>Dereference of null pointer (loaded from variable 'p')</string>
+// CHECK:    <key>category</key><string>Logic error</string>
+// CHECK:    <key>type</key><string>Dereference of null pointer</string>
+// CHECK:   <key>issue_context_kind</key><string>function</string>
+// CHECK:   <key>issue_context</key><string>test_block_arg</string>
+// CHECK:   <key>location</key>
+// CHECK:   <dict>
+// CHECK:    <key>line</key><integer>63</integer>
+// CHECK:    <key>col</key><integer>3</integer>
+// CHECK:    <key>file</key><integer>0</integer>
+// CHECK:   </dict>
+// CHECK:   </dict>
 // CHECK:  </array>
 // CHECK: </dict>
 // CHECK: </plist>

Modified: cfe/branches/tooling/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/retain-release.m?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/retain-release.m (original)
+++ cfe/branches/tooling/test/Analysis/retain-release.m Mon Jun  4 13:40:31 2012
@@ -1452,8 +1452,7 @@
 }
 
 void test_blocks_1_indirect_retain_via_call(void) {
-  // Eventually this should be reported as a leak.
-  NSNumber *number = [[NSNumber alloc] initWithInt:5]; // no-warning
+  NSNumber *number = [[NSNumber alloc] initWithInt:5]; // expected-warning {{leak}}
   ^(NSObject *o){ [o retain]; }(number);
 }
 

Modified: cfe/branches/tooling/test/CodeGen/fma4-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGen/fma4-builtins.c?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGen/fma4-builtins.c (original)
+++ cfe/branches/tooling/test/CodeGen/fma4-builtins.c Mon Jun  4 13:40:31 2012
@@ -6,161 +6,161 @@
 #include <x86intrin.h>
 
 __m128 test_mm_macc_ps(__m128 a, __m128 b, __m128 c) {
-  // CHECK: @llvm.x86.fma4.vfmadd.ps
+  // CHECK: @llvm.x86.fma.vfmadd.ps
   return _mm_macc_ps(a, b, c);
 }
 
 __m128d test_mm_macc_pd(__m128d a, __m128d b, __m128d c) {
-  // CHECK: @llvm.x86.fma4.vfmadd.pd
+  // CHECK: @llvm.x86.fma.vfmadd.pd
   return _mm_macc_pd(a, b, c);
 }
 
 __m128 test_mm_macc_ss(__m128 a, __m128 b, __m128 c) {
-  // CHECK: @llvm.x86.fma4.vfmadd.ss
+  // CHECK: @llvm.x86.fma.vfmadd.ss
   return _mm_macc_ss(a, b, c);
 }
 
 __m128d test_mm_macc_sd(__m128d a, __m128d b, __m128d c) {
-  // CHECK: @llvm.x86.fma4.vfmadd.sd
+  // CHECK: @llvm.x86.fma.vfmadd.sd
   return _mm_macc_sd(a, b, c);
 }
 
 __m128 test_mm_msub_ps(__m128 a, __m128 b, __m128 c) {
-  // CHECK: @llvm.x86.fma4.vfmsub.ps
+  // CHECK: @llvm.x86.fma.vfmsub.ps
   return _mm_msub_ps(a, b, c);
 }
 
 __m128d test_mm_msub_pd(__m128d a, __m128d b, __m128d c) {
-  // CHECK: @llvm.x86.fma4.vfmsub.pd
+  // CHECK: @llvm.x86.fma.vfmsub.pd
   return _mm_msub_pd(a, b, c);
 }
 
 __m128 test_mm_msub_ss(__m128 a, __m128 b, __m128 c) {
-  // CHECK: @llvm.x86.fma4.vfmsub.ss
+  // CHECK: @llvm.x86.fma.vfmsub.ss
   return _mm_msub_ss(a, b, c);
 }
 
 __m128d test_mm_msub_sd(__m128d a, __m128d b, __m128d c) {
-  // CHECK: @llvm.x86.fma4.vfmsub.sd
+  // CHECK: @llvm.x86.fma.vfmsub.sd
   return _mm_msub_sd(a, b, c);
 }
 
 __m128 test_mm_nmacc_ps(__m128 a, __m128 b, __m128 c) {
-  // CHECK: @llvm.x86.fma4.vfnmadd.ps
+  // CHECK: @llvm.x86.fma.vfnmadd.ps
   return _mm_nmacc_ps(a, b, c);
 }
 
 __m128d test_mm_nmacc_pd(__m128d a, __m128d b, __m128d c) {
-  // CHECK: @llvm.x86.fma4.vfnmadd.pd
+  // CHECK: @llvm.x86.fma.vfnmadd.pd
   return _mm_nmacc_pd(a, b, c);
 }
 
 __m128 test_mm_nmacc_ss(__m128 a, __m128 b, __m128 c) {
-  // CHECK: @llvm.x86.fma4.vfnmadd.ss
+  // CHECK: @llvm.x86.fma.vfnmadd.ss
   return _mm_nmacc_ss(a, b, c);
 }
 
 __m128d test_mm_nmacc_sd(__m128d a, __m128d b, __m128d c) {
-  // CHECK: @llvm.x86.fma4.vfnmadd.sd
+  // CHECK: @llvm.x86.fma.vfnmadd.sd
   return _mm_nmacc_sd(a, b, c);
 }
 
 __m128 test_mm_nmsub_ps(__m128 a, __m128 b, __m128 c) {
-  // CHECK: @llvm.x86.fma4.vfnmsub.ps
+  // CHECK: @llvm.x86.fma.vfnmsub.ps
   return _mm_nmsub_ps(a, b, c);
 }
 
 __m128d test_mm_nmsub_pd(__m128d a, __m128d b, __m128d c) {
-  // CHECK: @llvm.x86.fma4.vfnmsub.pd
+  // CHECK: @llvm.x86.fma.vfnmsub.pd
   return _mm_nmsub_pd(a, b, c);
 }
 
 __m128 test_mm_nmsub_ss(__m128 a, __m128 b, __m128 c) {
-  // CHECK: @llvm.x86.fma4.vfnmsub.ss
+  // CHECK: @llvm.x86.fma.vfnmsub.ss
   return _mm_nmsub_ss(a, b, c);
 }
 
 __m128d test_mm_nmsub_sd(__m128d a, __m128d b, __m128d c) {
-  // CHECK: @llvm.x86.fma4.vfnmsub.sd
+  // CHECK: @llvm.x86.fma.vfnmsub.sd
   return _mm_nmsub_sd(a, b, c);
 }
 
 __m128 test_mm_maddsub_ps(__m128 a, __m128 b, __m128 c) {
-  // CHECK: @llvm.x86.fma4.vfmaddsub.ps
+  // CHECK: @llvm.x86.fma.vfmaddsub.ps
   return _mm_maddsub_ps(a, b, c);
 }
 
 __m128d test_mm_maddsub_pd(__m128d a, __m128d b, __m128d c) {
-  // CHECK: @llvm.x86.fma4.vfmaddsub.pd
+  // CHECK: @llvm.x86.fma.vfmaddsub.pd
   return _mm_maddsub_pd(a, b, c);
 }
 
 __m128 test_mm_msubadd_ps(__m128 a, __m128 b, __m128 c) {
-  // CHECK: @llvm.x86.fma4.vfmsubadd.ps
+  // CHECK: @llvm.x86.fma.vfmsubadd.ps
   return _mm_msubadd_ps(a, b, c);
 }
 
 __m128d test_mm_msubadd_pd(__m128d a, __m128d b, __m128d c) {
-  // CHECK: @llvm.x86.fma4.vfmsubadd.pd
+  // CHECK: @llvm.x86.fma.vfmsubadd.pd
   return _mm_msubadd_pd(a, b, c);
 }
 
 __m256 test_mm256_macc_ps(__m256 a, __m256 b, __m256 c) {
-  // CHECK: @llvm.x86.fma4.vfmadd.ps.256
+  // CHECK: @llvm.x86.fma.vfmadd.ps.256
   return _mm256_macc_ps(a, b, c);
 }
 
 __m256d test_mm256_macc_pd(__m256d a, __m256d b, __m256d c) {
-  // CHECK: @llvm.x86.fma4.vfmadd.pd.256
+  // CHECK: @llvm.x86.fma.vfmadd.pd.256
   return _mm256_macc_pd(a, b, c);
 }
 
 __m256 test_mm256_msub_ps(__m256 a, __m256 b, __m256 c) {
-  // CHECK: @llvm.x86.fma4.vfmsub.ps.256
+  // CHECK: @llvm.x86.fma.vfmsub.ps.256
   return _mm256_msub_ps(a, b, c);
 }
 
 __m256d test_mm256_msub_pd(__m256d a, __m256d b, __m256d c) {
-  // CHECK: @llvm.x86.fma4.vfmsub.pd.256
+  // CHECK: @llvm.x86.fma.vfmsub.pd.256
   return _mm256_msub_pd(a, b, c);
 }
 
 __m256 test_mm256_nmacc_ps(__m256 a, __m256 b, __m256 c) {
-  // CHECK: @llvm.x86.fma4.vfnmadd.ps.256
+  // CHECK: @llvm.x86.fma.vfnmadd.ps.256
   return _mm256_nmacc_ps(a, b, c);
 }
 
 __m256d test_mm256_nmacc_pd(__m256d a, __m256d b, __m256d c) {
-  // CHECK: @llvm.x86.fma4.vfnmadd.pd.256
+  // CHECK: @llvm.x86.fma.vfnmadd.pd.256
   return _mm256_nmacc_pd(a, b, c);
 }
 
 __m256 test_mm256_nmsub_ps(__m256 a, __m256 b, __m256 c) {
-  // CHECK: @llvm.x86.fma4.vfnmsub.ps.256
+  // CHECK: @llvm.x86.fma.vfnmsub.ps.256
   return _mm256_nmsub_ps(a, b, c);
 }
 
 __m256d test_mm256_nmsub_pd(__m256d a, __m256d b, __m256d c) {
-  // CHECK: @llvm.x86.fma4.vfnmsub.pd.256
+  // CHECK: @llvm.x86.fma.vfnmsub.pd.256
   return _mm256_nmsub_pd(a, b, c);
 }
 
 __m256 test_mm256_maddsub_ps(__m256 a, __m256 b, __m256 c) {
-  // CHECK: @llvm.x86.fma4.vfmaddsub.ps.256
+  // CHECK: @llvm.x86.fma.vfmaddsub.ps.256
   return _mm256_maddsub_ps(a, b, c);
 }
 
 __m256d test_mm256_maddsub_pd(__m256d a, __m256d b, __m256d c) {
-  // CHECK: @llvm.x86.fma4.vfmaddsub.pd.256
+  // CHECK: @llvm.x86.fma.vfmaddsub.pd.256
   return _mm256_maddsub_pd(a, b, c);
 }
 
 __m256 test_mm256_msubadd_ps(__m256 a, __m256 b, __m256 c) {
-  // CHECK: @llvm.x86.fma4.vfmsubadd.ps.256
+  // CHECK: @llvm.x86.fma.vfmsubadd.ps.256
   return _mm256_msubadd_ps(a, b, c);
 }
 
 __m256d test_mm256_msubadd_pd(__m256d a, __m256d b, __m256d c) {
-  // CHECK: @llvm.x86.fma4.vfmsubadd.pd.256
+  // CHECK: @llvm.x86.fma.vfmsubadd.pd.256
   return _mm256_msubadd_pd(a, b, c);
 }

Modified: cfe/branches/tooling/test/CodeGenCXX/debug-info-enum-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCXX/debug-info-enum-class.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCXX/debug-info-enum-class.cpp (original)
+++ cfe/branches/tooling/test/CodeGenCXX/debug-info-enum-class.cpp Mon Jun  4 13:40:31 2012
@@ -3,10 +3,13 @@
 enum class A { A1=1 };                 // underlying type is int by default
 enum class B: unsigned long { B1=1 };  // underlying type is unsigned long
 enum C { C1 = 1 };
+enum D : short; // enum forward declaration
 A a;
 B b;
 C c;
+D d;
 
 // CHECK: metadata !{i32 {{.*}}, null, metadata !"A", metadata !4, i32 3, i64 32, i64 32, i32 0, i32 0, metadata !5, metadata !6, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
 // CHECK: metadata !{i32 {{.*}}, null, metadata !"B", metadata !4, i32 4, i64 64, i64 64, i32 0, i32 0, metadata !9, metadata !10, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
 // CHECK: metadata !{i32 {{.*}}, null, metadata !"C", metadata !4, i32 5, i64 32, i64 32, i32 0, i32 0, null, metadata !13, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
+// CHECK: metadata !{i32 {{.*}}, null, metadata !"D", metadata !4, i32 6, i64 16, i64 16, i32 0, i32 4, null, metadata !16, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]

Modified: cfe/branches/tooling/test/Driver/mips-as.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Driver/mips-as.c?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/Driver/mips-as.c (original)
+++ cfe/branches/tooling/test/Driver/mips-as.c Mon Jun  4 13:40:31 2012
@@ -4,6 +4,13 @@
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS32-EB-AS %s
 // CHECK-MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
+// CHECK-MIPS32-EB-AS-NOT: "-KPIC"
+//
+// RUN: %clang -target mips-linux-gnu -### \
+// RUN:   -no-integrated-as -fPIC -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS32-EB-PIC %s
+// CHECK-MIPS32-EB-PIC: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
+// CHECK-MIPS32-EB-PIC: "-KPIC"
 //
 // RUN: %clang -target mipsel-linux-gnu -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \

Modified: cfe/branches/tooling/test/FixIt/fixit-interface-as-param.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/FixIt/fixit-interface-as-param.m?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/FixIt/fixit-interface-as-param.m (original)
+++ cfe/branches/tooling/test/FixIt/fixit-interface-as-param.m Mon Jun  4 13:40:31 2012
@@ -7,5 +7,5 @@
 - (void) drawRect : inView:(NSView)view;
 @end
 
-// CHECK: {7:34-7:34}:"*"
+// CHECK: {7:35-7:35}:"*"
 

Modified: cfe/branches/tooling/test/Misc/tabstop.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Misc/tabstop.c?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/Misc/tabstop.c (original)
+++ cfe/branches/tooling/test/Misc/tabstop.c Mon Jun  4 13:40:31 2012
@@ -35,13 +35,22 @@
 {
 	if (0	& 1	== 1)
 	{}
+
+	if (1 == 0	& 1)
+	{}
 }
 
 // CHECK-3: {{^   }}if (0 & 1   == 1)
 // CHECK-3: {{^   }}        (       )
+// CHECK-3: {{^   }}if (1 == 0  & 1)
+// CHECK-3: {{^   }}    (     )
 
 // CHECK-4: {{^    }}if (0   & 1 == 1)
 // CHECK-4: {{^    }}          (     )
+// CHECK-4: {{^    }}if (1 == 0  & 1)
+// CHECK-4: {{^    }}    (     )
 
 // CHECK-5: {{^     }}if (0     & 1  == 1)
 // CHECK-5: {{^     }}            (      )
+// CHECK-5: {{^     }}if (1 == 0     & 1)
+// CHECK-5: {{^     }}    (     )

Modified: cfe/branches/tooling/test/Preprocessor/predefined-arch-macros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Preprocessor/predefined-arch-macros.c?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/branches/tooling/test/Preprocessor/predefined-arch-macros.c Mon Jun  4 13:40:31 2012
@@ -379,6 +379,7 @@
 // RUN:     -target i386-unknown-linux \
 // RUN:   | FileCheck %s -check-prefix=CHECK_COREI7_M32
 // CHECK_COREI7_M32: #define __MMX__ 1
+// CHECK_COREI7_M32: #define __POPCNT__ 1
 // CHECK_COREI7_M32: #define __SSE2__ 1
 // CHECK_COREI7_M32: #define __SSE3__ 1
 // CHECK_COREI7_M32: #define __SSE4_1__ 1
@@ -395,6 +396,7 @@
 // RUN:     -target i386-unknown-linux \
 // RUN:   | FileCheck %s -check-prefix=CHECK_COREI7_M64
 // CHECK_COREI7_M64: #define __MMX__ 1
+// CHECK_COREI7_M64: #define __POPCNT__ 1
 // CHECK_COREI7_M64: #define __SSE2_MATH__ 1
 // CHECK_COREI7_M64: #define __SSE2__ 1
 // CHECK_COREI7_M64: #define __SSE3__ 1
@@ -417,6 +419,8 @@
 // CHECK_COREI7_AVX_M32: #define __AES__ 1
 // CHECK_COREI7_AVX_M32: #define __AVX__ 1
 // CHECK_COREI7_AVX_M32: #define __MMX__ 1
+// CHECK_COREI7_AVX_M32: #define __PCLMUL__ 1
+// CHECK_COREI7_AVX_M32: #define __POPCNT__ 1
 // CHECK_COREI7_AVX_M32: #define __SSE2__ 1
 // CHECK_COREI7_AVX_M32: #define __SSE3__ 1
 // CHECK_COREI7_AVX_M32: #define __SSE4_1__ 1
@@ -435,6 +439,8 @@
 // CHECK_COREI7_AVX_M64: #define __AES__ 1
 // CHECK_COREI7_AVX_M64: #define __AVX__ 1
 // CHECK_COREI7_AVX_M64: #define __MMX__ 1
+// CHECK_COREI7_AVX_M64: #define __PCLMUL__ 1
+// CHECK_COREI7_AVX_M64: #define __POPCNT__ 1
 // CHECK_COREI7_AVX_M64: #define __SSE2_MATH__ 1
 // CHECK_COREI7_AVX_M64: #define __SSE2__ 1
 // CHECK_COREI7_AVX_M64: #define __SSE3__ 1
@@ -457,6 +463,7 @@
 // CHECK_CORE_AVX_I_M32: #define __AES__ 1
 // CHECK_CORE_AVX_I_M32: #define __AVX__ 1
 // CHECK_CORE_AVX_I_M32: #define __MMX__ 1
+// CHECK_CORE_AVX_I_M32: #define __PCLMUL__ 1
 // CHECK_CORE_AVX_I_M32: #define __SSE2__ 1
 // CHECK_CORE_AVX_I_M32: #define __SSE3__ 1
 // CHECK_CORE_AVX_I_M32: #define __SSE4_1__ 1
@@ -475,6 +482,7 @@
 // CHECK_CORE_AVX_I_M64: #define __AES__ 1
 // CHECK_CORE_AVX_I_M64: #define __AVX__ 1
 // CHECK_CORE_AVX_I_M64: #define __MMX__ 1
+// CHECK_CORE_AVX_I_M64: #define __PCLMUL__ 1
 // CHECK_CORE_AVX_I_M64: #define __SSE2_MATH__ 1
 // CHECK_CORE_AVX_I_M64: #define __SSE2__ 1
 // CHECK_CORE_AVX_I_M64: #define __SSE3__ 1
@@ -491,6 +499,58 @@
 // CHECK_CORE_AVX_I_M64: #define __x86_64 1
 // CHECK_CORE_AVX_I_M64: #define __x86_64__ 1
 //
+// RUN: %clang -march=core-avx2 -m32 -E -dM %s -o - 2>&1 \
+// RUN:     -target i386-unknown-linux \
+// RUN:   | FileCheck %s -check-prefix=CHECK_CORE_AVX2_M32
+// CHECK_CORE_AVX2_M32: #define __AES__ 1
+// CHECK_CORE_AVX2_M32: #define __AVX__ 1
+// CHECK_CORE_AVX2_M32: #define __BMI2__ 1
+// CHECK_CORE_AVX2_M32: #define __BMI__ 1
+// CHECK_CORE_AVX2_M32: #define __FMA__ 1
+// CHECK_CORE_AVX2_M32: #define __LZCNT__ 1
+// CHECK_CORE_AVX2_M32: #define __MMX__ 1
+// CHECK_CORE_AVX2_M32: #define __PCLMUL__ 1
+// CHECK_CORE_AVX2_M32: #define __POPCNT__ 1
+// CHECK_CORE_AVX2_M32: #define __SSE2__ 1
+// CHECK_CORE_AVX2_M32: #define __SSE3__ 1
+// CHECK_CORE_AVX2_M32: #define __SSE4_1__ 1
+// CHECK_CORE_AVX2_M32: #define __SSE4_2__ 1
+// CHECK_CORE_AVX2_M32: #define __SSE__ 1
+// CHECK_CORE_AVX2_M32: #define __SSSE3__ 1
+// CHECK_CORE_AVX2_M32: #define __corei7 1
+// CHECK_CORE_AVX2_M32: #define __corei7__ 1
+// CHECK_CORE_AVX2_M32: #define __i386 1
+// CHECK_CORE_AVX2_M32: #define __i386__ 1
+// CHECK_CORE_AVX2_M32: #define __tune_corei7__ 1
+// CHECK_CORE_AVX2_M32: #define i386 1
+// RUN: %clang -march=core-avx2 -m64 -E -dM %s -o - 2>&1 \
+// RUN:     -target i386-unknown-linux \
+// RUN:   | FileCheck %s -check-prefix=CHECK_CORE_AVX2_M64
+// CHECK_CORE_AVX2_M64: #define __AES__ 1
+// CHECK_CORE_AVX2_M64: #define __AVX__ 1
+// CHECK_CORE_AVX2_M64: #define __BMI2__ 1
+// CHECK_CORE_AVX2_M64: #define __BMI__ 1
+// CHECK_CORE_AVX2_M64: #define __FMA__ 1
+// CHECK_CORE_AVX2_M64: #define __LZCNT__ 1
+// CHECK_CORE_AVX2_M64: #define __MMX__ 1
+// CHECK_CORE_AVX2_M64: #define __PCLMUL__ 1
+// CHECK_CORE_AVX2_M64: #define __POPCNT__ 1
+// CHECK_CORE_AVX2_M64: #define __SSE2_MATH__ 1
+// CHECK_CORE_AVX2_M64: #define __SSE2__ 1
+// CHECK_CORE_AVX2_M64: #define __SSE3__ 1
+// CHECK_CORE_AVX2_M64: #define __SSE4_1__ 1
+// CHECK_CORE_AVX2_M64: #define __SSE4_2__ 1
+// CHECK_CORE_AVX2_M64: #define __SSE_MATH__ 1
+// CHECK_CORE_AVX2_M64: #define __SSE__ 1
+// CHECK_CORE_AVX2_M64: #define __SSSE3__ 1
+// CHECK_CORE_AVX2_M64: #define __amd64 1
+// CHECK_CORE_AVX2_M64: #define __amd64__ 1
+// CHECK_CORE_AVX2_M64: #define __corei7 1
+// CHECK_CORE_AVX2_M64: #define __corei7__ 1
+// CHECK_CORE_AVX2_M64: #define __tune_corei7__ 1
+// CHECK_CORE_AVX2_M64: #define __x86_64 1
+// CHECK_CORE_AVX2_M64: #define __x86_64__ 1
+//
 // RUN: %clang -march=atom -m32 -E -dM %s -o - 2>&1 \
 // RUN:     -target i386-unknown-linux \
 // RUN:   | FileCheck %s -check-prefix=CHECK_ATOM_M32
@@ -940,5 +1000,47 @@
 // CHECK_ATHLON_FX_M64: #define __tune_k8__ 1
 // CHECK_ATHLON_FX_M64: #define __x86_64 1
 // CHECK_ATHLON_FX_M64: #define __x86_64__ 1
+// RUN: %clang -march=amdfam10 -m64 -E -dM %s -o - 2>&1 \
+// RUN:     -target i386-unknown-linux \
+// RUN:   | FileCheck %s -check-prefix=CHECK_AMDFAM10_M64
+// CHECK_AMDFAM10_M64: #define __3dNOW_A__ 1
+// CHECK_AMDFAM10_M64: #define __3dNOW__ 1
+// CHECK_AMDFAM10_M64: #define __MMX__ 1
+// CHECK_AMDFAM10_M64: #define __SSE2_MATH__ 1
+// CHECK_AMDFAM10_M64: #define __SSE2__ 1
+// CHECK_AMDFAM10_M64: #define __SSE3__ 1
+// CHECK_AMDFAM10_M64: #define __SSE4A__ 1
+// CHECK_AMDFAM10_M64: #define __SSE_MATH__ 1
+// CHECK_AMDFAM10_M64: #define __SSE__ 1
+// CHECK_AMDFAM10_M64: #define __amd64 1
+// CHECK_AMDFAM10_M64: #define __amd64__ 1
+// CHECK_AMDFAM10_M64: #define __amdfam10 1
+// CHECK_AMDFAM10_M64: #define __amdfam10__ 1
+// CHECK_AMDFAM10_M64: #define __tune_amdfam10__ 1
+// CHECK_AMDFAM10_M64: #define __x86_64 1
+// CHECK_AMDFAM10_M64: #define __x86_64__ 1
+// RUN: %clang -march=bdver1 -m64 -E -dM %s -o - 2>&1 \
+// RUN:     -target i386-unknown-linux \
+// RUN:   | FileCheck %s -check-prefix=CHECK_BDVER1_M64
+// CHECK_BDVER1_M64: #define __AVX__ 1
+// CHECK_BDVER1_M64-NOT: #define __3dNOW_A__ 1
+// CHECK_BDVER1_M64-NOT: #define __3dNOW__ 1
+// CHECK_BDVER1_M64: #define __MMX__ 1
+// CHECK_BDVER1_M64: #define __SSE2_MATH__ 1
+// CHECK_BDVER1_M64: #define __SSE2__ 1
+// CHECK_BDVER1_M64: #define __SSE3__ 1
+// CHECK_BDVER1_M64: #define __SSE4A__ 1
+// CHECK_BDVER1_M64: #define __SSE4_1__ 1
+// CHECK_BDVER1_M64: #define __SSE4_2__ 1
+// CHECK_BDVER1_M64: #define __SSE_MATH__ 1
+// CHECK_BDVER1_M64: #define __SSE__ 1
+// CHECK_BDVER1_M64: #define __SSSE3__ 1
+// CHECK_BDVER1_M64: #define __amd64 1
+// CHECK_BDVER1_M64: #define __amd64__ 1
+// CHECK_BDVER1_M64: #define __bdver1 1
+// CHECK_BDVER1_M64: #define __bdver1__ 1
+// CHECK_BDVER1_M64: #define __tune_bdver1__ 1
+// CHECK_BDVER1_M64: #define __x86_64 1
+// CHECK_BDVER1_M64: #define __x86_64__ 1
 //
 // End X86/GCC/Linux tests ------------------

Modified: cfe/branches/tooling/test/Sema/switch.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Sema/switch.c?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/Sema/switch.c (original)
+++ cfe/branches/tooling/test/Sema/switch.c Mon Jun  4 13:40:31 2012
@@ -326,7 +326,7 @@
 void test19(int i) {
   enum {
     kTest19Enum1 = 7,
-    kTest19Enum2 = 7
+    kTest19Enum2 = kTest19Enum1
   };
   const int a = 3;
   switch (i) {

Modified: cfe/branches/tooling/test/Sema/thread-specifier.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Sema/thread-specifier.c?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/Sema/thread-specifier.c (original)
+++ cfe/branches/tooling/test/Sema/thread-specifier.c Mon Jun  4 13:40:31 2012
@@ -1,19 +1,21 @@
-// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify -pedantic %s
 
 __thread int t1;
-__thread extern int t2;
-__thread static int t3;
+__thread extern int t2; // expected-warning {{'__thread' before 'extern'}}
+__thread static int t3; // expected-warning {{'__thread' before 'static'}}
 __thread __private_extern__ int t4;
 struct t5 { __thread int x; }; // expected-error {{type name does not allow storage class to be specified}}
 __thread int t6(); // expected-error {{'__thread' is only allowed on variable declarations}}
+
 int f(__thread int t7) { // expected-error {{'__thread' is only allowed on variable declarations}}
   __thread int t8; // expected-error {{'__thread' variables must have global storage}}
-  __thread extern int t9;
-  __thread static int t10;
+  extern __thread int t9;
+  static __thread int t10;
   __thread __private_extern__ int t11;
   __thread auto int t12; // expected-error {{'__thread' variables must have global storage}}
   __thread register int t13; // expected-error {{'__thread' variables must have global storage}}
 }
+
 __thread typedef int t14; // expected-error {{'__thread' is only allowed on variable declarations}}
 __thread int t15; // expected-note {{previous definition is here}}
 int t15; // expected-error {{non-thread-local declaration of 't15' follows thread-local declaration}}

Modified: cfe/branches/tooling/test/SemaCXX/overloaded-builtin-operators.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/overloaded-builtin-operators.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/overloaded-builtin-operators.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/overloaded-builtin-operators.cpp Mon Jun  4 13:40:31 2012
@@ -237,3 +237,22 @@
     (void)(x - x);
   }
 }
+
+namespace PR12854 {
+  enum { size = 1 };
+  void plus_equals() {
+    int* __restrict py;
+    py += size;
+  }
+
+  struct RestrictInt {
+    operator int* __restrict &();
+  };
+
+  void user_conversions(RestrictInt ri) {
+    ++ri;
+    --ri;
+    ri++;
+    ri--;
+  }
+}

Modified: cfe/branches/tooling/test/SemaCXX/typo-correction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/typo-correction.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/typo-correction.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/typo-correction.cpp Mon Jun  4 13:40:31 2012
@@ -197,3 +197,12 @@
     unsinged : 4; // expected-error{{did you mean 'unsigned'}}
   };
 }
+
+namespace PR12951 {
+// If there are two corrections that have the same identifier and edit distance
+// and only differ by their namespaces, don't suggest either as a correction
+// since both are equally likely corrections.
+namespace foobar { struct Thing {}; }
+namespace bazquux { struct Thing {}; }
+void f() { Thing t; } // expected-error{{unknown type name 'Thing'}}
+}

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/warn-memset-bad-sizeof.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/warn-memset-bad-sizeof.cpp Mon Jun  4 13:40:31 2012
@@ -35,27 +35,27 @@
 
   /* Should warn */
   memset(&s, 0, sizeof(&s));  // \
-      // expected-warning {{argument to 'sizeof' in 'memset' call is the same expression as the destination}}
+      // expected-warning {{'memset' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to remove the addressof in the argument to 'sizeof' (and multiply it by the number of elements)?}}
   memset(ps, 0, sizeof(ps));  // \
-      // expected-warning {{argument to 'sizeof' in 'memset' call is the same expression as the destination}}
+      // expected-warning {{'memset' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?}}
   memset(ps2, 0, sizeof(ps2));  // \
-      // expected-warning {{argument to 'sizeof' in 'memset' call is the same expression as the destination}}
+      // expected-warning {{'memset' call operates on objects of type 'S' while the size is based on a different type 'PS' (aka 'S *')}} expected-note{{did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?}}
   memset(ps2, 0, sizeof(typeof(ps2)));  // \
       // expected-warning {{argument to 'sizeof' in 'memset' call is the same pointer type}}
   memset(ps2, 0, sizeof(PS));  // \
       // expected-warning {{argument to 'sizeof' in 'memset' call is the same pointer type}}
   memset(heap_buffer, 0, sizeof(heap_buffer));  // \
-      // expected-warning {{argument to 'sizeof' in 'memset' call is the same expression as the destination}}
+      // expected-warning {{'memset' call operates on objects of type 'char' while the size is based on a different type 'char *'}} expected-note{{did you mean to provide an explicit length?}}
 
   memcpy(&s, 0, sizeof(&s));  // \
-      // expected-warning {{argument to 'sizeof' in 'memcpy' call is the same expression as the destination}}
+      // expected-warning {{'memcpy' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to remove the addressof in the argument to 'sizeof' (and multiply it by the number of elements)?}}
   memcpy(0, &s, sizeof(&s));  // \
-      // expected-warning {{argument to 'sizeof' in 'memcpy' call is the same expression as the source}}
+      // expected-warning {{'memcpy' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to remove the addressof in the argument to 'sizeof' (and multiply it by the number of elements)?}}
 
   memmove(ps, 0, sizeof(ps));  // \
-      // expected-warning {{argument to 'sizeof' in 'memmove' call is the same expression as the destination}}
+      // expected-warning {{'memmove' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?}}
   memcmp(ps, 0, sizeof(ps));  // \
-      // expected-warning {{argument to 'sizeof' in 'memcmp' call is the same expression as the destination}}
+      // expected-warning {{'memcmp' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?}}
 
   /* Shouldn't warn */
   memset((void*)&s, 0, sizeof(&s));
@@ -132,14 +132,14 @@
   const char* BAR = "<- this, too";
 
   strncmp(FOO, BAR, sizeof(FOO)); // \
-      // expected-warning {{argument to 'sizeof' in 'strncmp' call is the same expression as the destination}}
+      // expected-warning {{'strncmp' call operates on objects of type 'const char' while the size is based on a different type 'const char *'}} expected-note{{did you mean to provide an explicit length?}}
   strncasecmp(FOO, BAR, sizeof(FOO));  // \
-      // expected-warning {{argument to 'sizeof' in 'strncasecmp' call is the same expression as the destination}}
+      // expected-warning {{'strncasecmp' call operates on objects of type 'const char' while the size is based on a different type 'const char *'}} expected-note{{did you mean to provide an explicit length?}}
 
   char buff[80];
 
   strncpy(buff, BAR, sizeof(BAR)); // \
-      // expected-warning {{argument to 'sizeof' in 'strncpy' call is the same expression as the source}}
+      // expected-warning {{'strncpy' call operates on objects of type 'const char' while the size is based on a different type 'const char *'}} expected-note{{did you mean to provide an explicit length?}}
   strndup(FOO, sizeof(FOO)); // \
-      // expected-warning {{argument to 'sizeof' in 'strndup' call is the same expression as the source}}
+      // expected-warning {{'strndup' call operates on objects of type 'const char' while the size is based on a different type 'const char *'}} expected-note{{did you mean to provide an explicit length?}}
 }

Propchange: cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun  4 13:40:31 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-157609
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,146581-157940

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=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/nsobject-attribute.m (original)
+++ cfe/branches/tooling/test/SemaObjC/nsobject-attribute.m Mon Jun  4 13:40:31 2012
@@ -46,9 +46,19 @@
    __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
+ at property (nonatomic, retain) __attribute__((NSObject)) CGColorRefNoNSObject 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}}
 }
 
+// rdar://11569860
+ at interface A { int i; }
+ at property(retain) __attribute__((NSObject)) int i; // expected-error {{__attribute ((NSObject)) is for pointer types only}} \
+  						   // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
+ at end
+
+ at implementation A
+ at synthesize i;
+ at end
+

Modified: cfe/branches/tooling/test/SemaObjC/property-impl-misuse.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/property-impl-misuse.m?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/property-impl-misuse.m (original)
+++ cfe/branches/tooling/test/SemaObjC/property-impl-misuse.m Mon Jun  4 13:40:31 2012
@@ -35,8 +35,8 @@
 }
 @end
 
-// rdar://1105153
- at interface rdar1105153
+// rdar://11054153
+ at interface rdar11054153
 @property int P; // expected-error {{type of property 'P' ('int') does not match type of accessor 'P' ('void')}}
 - (void)P; // expected-note {{declared here}}
 

Modified: cfe/branches/tooling/test/SemaObjC/property-typecheck-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/property-typecheck-1.m?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/property-typecheck-1.m (original)
+++ cfe/branches/tooling/test/SemaObjC/property-typecheck-1.m Mon Jun  4 13:40:31 2012
@@ -73,11 +73,11 @@
  NSArray* first;
 }
 
- at property (readonly) NSArray* pieces;
- at property (readonly) NSMutableArray* first;  // expected-warning {{type of property 'first' does not match type of accessor 'first'}}
+ at property (readonly) NSArray* pieces; // expected-warning {{type of property 'pieces' does not match type of accessor 'pieces'}}
+ at property (readonly) NSMutableArray* first;
 
-- (NSMutableArray*) pieces;
-- (NSArray*) first; // expected-note 2 {{declared here}}
+- (NSMutableArray*) pieces; // expected-note 2 {{declared here}}
+- (NSArray*) first;
 @end
 
 @interface Class2  {
@@ -90,12 +90,12 @@
 
 - (id) lastPiece
 {
- return container.pieces;
+ return container.pieces; // expected-warning {{type of property 'pieces' does not match type of accessor 'pieces'}}
 }
 
 - (id)firstPeice
 {
-  return container.first; // expected-warning {{type of property 'first' does not match type of accessor 'first'}}
+  return container.first;
 }
 @end
 

Modified: cfe/branches/tooling/test/SemaObjC/property-user-setter.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/property-user-setter.m?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/property-user-setter.m (original)
+++ cfe/branches/tooling/test/SemaObjC/property-user-setter.m Mon Jun  4 13:40:31 2012
@@ -124,15 +124,33 @@
 @synthesize t, T;
 @synthesize Pxyz, pxyz;
 - (id) Meth {
-  self.P = 0; // expected-error {{property 'P' not found on object of type 'rdar11363363 *'}}
-  self.q = 0; // expected-error {{property 'q' not found on object of type 'rdar11363363 *'}}
+  self.P = 0;
+  self.q = 0;
 // rdar://11528439
   self.t = 0; // expected-error {{synthesized properties 't' and 'T' both claim setter 'setT:'}}
   self.T = 0; // expected-error {{synthesized properties 'T' and 't' both claim setter 'setT:'}}
   self.Pxyz = 0; // expected-error {{synthesized properties 'Pxyz' and 'pxyz' both claim setter 'setPxyz:'}}
   self.pxyz = 0; // expected-error {{synthesized properties 'pxyz' and 'Pxyz' both claim setter 'setPxyz:'}}
-  self.R = 0; // expected-error {{property 'R' not found on object of type 'rdar11363363 *'; did you mean to access ivar 'R'?}}
-  return self.R; // expected-error {{property 'R' not found on object of type 'rdar11363363 *'; did you mean to access ivar 'R'?}}
+  self.R = 0;
+  return self.R; // expected-error {{expected getter method not found on object of type 'rdar11363363 *'}}
+}
+ at end
+
+// rdar://11499742
+ at class BridgeFormatter;
+
+ at interface FMXBridgeFormatter 
+
+ at property(assign, readwrite, getter=formatter, setter=setFormatter:) BridgeFormatter* cppFormatter;
+
+ at end
+
+ at implementation FMXBridgeFormatter
+ at synthesize cppFormatter;
+
+- (void) dealloc
+{
+ self.formatter = 0;
 }
 @end
 

Modified: cfe/branches/tooling/tools/diagtool/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/diagtool/CMakeLists.txt?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/tools/diagtool/CMakeLists.txt (original)
+++ cfe/branches/tooling/tools/diagtool/CMakeLists.txt Mon Jun  4 13:40:31 2012
@@ -6,12 +6,15 @@
   clangBasic
   clangLex
   clangSema
+  clangFrontend
   )
 
 add_clang_executable(diagtool
   diagtool_main.cpp
   DiagTool.cpp
+  DiagnosticNames.cpp
   ListWarnings.cpp
+  ShowEnabledWarnings.cpp
 )
 
 if(UNIX)

Modified: cfe/branches/tooling/tools/diagtool/ListWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/diagtool/ListWarnings.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/tools/diagtool/ListWarnings.cpp (original)
+++ cfe/branches/tooling/tools/diagtool/ListWarnings.cpp Mon Jun  4 13:40:31 2012
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "DiagTool.h"
+#include "DiagnosticNames.h"
 #include "clang/Basic/Diagnostic.h"
 #include "llvm/Support/Format.h"
 #include "llvm/ADT/StringMap.h"
@@ -26,28 +27,6 @@
 using namespace clang;
 
 namespace {
-struct StaticDiagNameIndexRec {
-  const char *NameStr;
-  unsigned short DiagID;
-  uint8_t NameLen;
-
-  StringRef getName() const {
-    return StringRef(NameStr, NameLen);
-  }
-};
-}
-
-static const StaticDiagNameIndexRec StaticDiagNameIndex[] = {
-#define DIAG_NAME_INDEX(ENUM) { #ENUM, diag::ENUM, STR_SIZE(#ENUM, uint8_t) },
-#include "clang/Basic/DiagnosticIndexName.inc"
-#undef DIAG_NAME_INDEX
-  { 0, 0, 0 }
-};
-
-static const unsigned StaticDiagNameIndexSize =
-  sizeof(StaticDiagNameIndex)/sizeof(StaticDiagNameIndex[0])-1;
-
-namespace {
 struct Entry {
   llvm::StringRef DiagName;
   llvm::StringRef Flag;
@@ -73,8 +52,8 @@
   std::vector<Entry> Flagged, Unflagged;
   llvm::StringMap<std::vector<unsigned> > flagHistogram;
   
-  for (const StaticDiagNameIndexRec *di = StaticDiagNameIndex, *de = StaticDiagNameIndex + StaticDiagNameIndexSize;
-       di != de; ++di) {
+  for (const diagtool::DiagnosticRecord *di = diagtool::BuiltinDiagnostics,
+       *de = di + diagtool::BuiltinDiagnosticsCount; di != de; ++di) {
     
     unsigned diagID = di->DiagID;
     

Modified: cfe/branches/tooling/tools/diagtool/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/diagtool/Makefile?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/tools/diagtool/Makefile (original)
+++ cfe/branches/tooling/tools/diagtool/Makefile Mon Jun  4 13:40:31 2012
@@ -1,4 +1,4 @@
-##===- tools/driver/Makefile -------------------------------*- Makefile -*-===##
+##===- tools/diagtool/Makefile -----------------------------*- Makefile -*-===##
 #
 #                     The LLVM Compiler Infrastructure
 #
@@ -16,9 +16,11 @@
 # Don't install this.
 NO_INSTALL = 1
 
-LINK_COMPONENTS := support
+LINK_COMPONENTS := support mc
 
-USEDLIBS = clangBasic.a
+USEDLIBS = clangFrontend.a clangDriver.a clangSerialization.a clangParse.a \
+           clangSema.a clangAnalysis.a clangEdit.a clangAST.a clangLex.a \
+           clangBasic.a
 
 include $(CLANG_LEVEL)/Makefile
 

Modified: cfe/branches/tooling/tools/diagtool/diagtool_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/diagtool/diagtool_main.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/tools/diagtool/diagtool_main.cpp (original)
+++ cfe/branches/tooling/tools/diagtool/diagtool_main.cpp Mon Jun  4 13:40:31 2012
@@ -18,7 +18,7 @@
 int main(int argc, char *argv[]) {
   if (argc > 1)
     if (DiagTool *tool = diagTools->getTool(argv[1]))
-      return tool->run(argc - 1, &argv[2], llvm::errs());
+      return tool->run(argc - 2, &argv[2], llvm::errs());
 
   llvm::errs() << "usage: diagtool <command> [<args>]\n\n";
   diagTools->printCommands(llvm::errs());

Modified: cfe/branches/tooling/unittests/Tooling/RecursiveASTVisitorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/unittests/Tooling/RecursiveASTVisitorTest.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/unittests/Tooling/RecursiveASTVisitorTest.cpp (original)
+++ cfe/branches/tooling/unittests/Tooling/RecursiveASTVisitorTest.cpp Mon Jun  4 13:40:31 2012
@@ -185,6 +185,33 @@
   }
 };
 
+class TemplateArgumentLocTraverser
+  : public ExpectedLocationVisitor<TemplateArgumentLocTraverser> {
+public:
+  bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc) {
+    std::string ArgStr;
+    llvm::raw_string_ostream Stream(ArgStr);
+    const TemplateArgument &Arg = ArgLoc.getArgument();
+
+    Arg.print(Context->getPrintingPolicy(), Stream);
+    Match(Stream.str(), ArgLoc.getLocation());
+    return ExpectedLocationVisitor<TemplateArgumentLocTraverser>::
+      TraverseTemplateArgumentLoc(ArgLoc);
+  }
+};
+
+class CXXBoolLiteralExprVisitor 
+  : public ExpectedLocationVisitor<CXXBoolLiteralExprVisitor> {
+public:
+  bool VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *BE) {
+    if (BE->getValue())
+      Match("true", BE->getLocation());
+    else
+      Match("false", BE->getLocation());
+    return true;
+  }
+};
+
 TEST(RecursiveASTVisitor, VisitsBaseClassDeclarations) {
   TypeLocVisitor Visitor;
   Visitor.ExpectMatch("class X", 1, 30);
@@ -316,7 +343,7 @@
 
 TEST(RecursiveASTVisitor, VisitsPartialTemplateSpecialization) {
   // From cfe-commits/Week-of-Mon-20100830/033998.html
-  // Contrary to the approach sugggested in that email, we visit all
+  // Contrary to the approach suggested in that email, we visit all
   // specializations when we visit the primary template.  Visiting them when we
   // visit the associated specialization is problematic for specializations of
   // template members of class templates.
@@ -394,4 +421,31 @@
   EXPECT_TRUE(Visitor.runOver("int k = (4) + 9;\n"));
 }
 
+TEST(RecursiveASTVisitor, VisitsClassTemplateNonTypeParmDefaultArgument) {
+  CXXBoolLiteralExprVisitor Visitor;
+  Visitor.ExpectMatch("true", 2, 19);
+  EXPECT_TRUE(Visitor.runOver(
+    "template<bool B> class X;\n"
+    "template<bool B = true> class Y;\n"
+    "template<bool B> class Y {};\n"));
+}
+
+TEST(RecursiveASTVisitor, VisitsClassTemplateTypeParmDefaultArgument) {
+  TypeLocVisitor Visitor;
+  Visitor.ExpectMatch("class X", 2, 23);
+  EXPECT_TRUE(Visitor.runOver(
+    "class X;\n"
+    "template<typename T = X> class Y;\n"
+    "template<typename T> class Y {};\n"));
+}
+
+TEST(RecursiveASTVisitor, VisitsClassTemplateTemplateParmDefaultArgument) {
+  TemplateArgumentLocTraverser Visitor;
+  Visitor.ExpectMatch("X", 2, 40);
+  EXPECT_TRUE(Visitor.runOver(
+    "template<typename T> class X;\n"
+    "template<template <typename> class T = X> class Y;\n"
+    "template<template <typename> class T> class Y {};\n"));
+}
+
 } // end namespace clang

Modified: cfe/branches/tooling/unittests/Tooling/ToolingTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/unittests/Tooling/ToolingTest.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/unittests/Tooling/ToolingTest.cpp (original)
+++ cfe/branches/tooling/unittests/Tooling/ToolingTest.cpp Mon Jun  4 13:40:31 2012
@@ -15,6 +15,7 @@
 #include "clang/Tooling/CompilationDatabase.h"
 #include "clang/Tooling/Tooling.h"
 #include "gtest/gtest.h"
+#include <string>
 
 namespace clang {
 namespace tooling {
@@ -109,5 +110,18 @@
   EXPECT_TRUE(Action.get() != NULL);
 }
 
+TEST(ToolInvocation, TestMapVirtualFile) {
+  clang::FileManager Files((clang::FileSystemOptions()));
+  std::vector<std::string> Args;
+  Args.push_back("tool-executable");
+  Args.push_back("-Idef");
+  Args.push_back("-fsyntax-only");
+  Args.push_back("test.cpp");
+  clang::tooling::ToolInvocation Invocation(Args, new SyntaxOnlyAction, &Files);
+  Invocation.mapVirtualFile("test.cpp", "#include <abc>\n");
+  Invocation.mapVirtualFile("def/abc", "\n");
+  EXPECT_TRUE(Invocation.run());
+}
+
 } // end namespace tooling
 } // end namespace clang

Modified: cfe/branches/tooling/utils/TableGen/NeonEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/utils/TableGen/NeonEmitter.cpp?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/utils/TableGen/NeonEmitter.cpp (original)
+++ cfe/branches/tooling/utils/TableGen/NeonEmitter.cpp Mon Jun  4 13:40:31 2012
@@ -1507,7 +1507,7 @@
     s.push_back(arg);
     comma = ", ";
   }
-  s += ") { \\\n  ";
+  s += ") {\n  ";
 
   if (proto[0] != 'v')
     s += "return ";

Modified: cfe/branches/tooling/utils/analyzer/SATestAdd.py
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/utils/analyzer/SATestAdd.py?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/utils/analyzer/SATestAdd.py (original)
+++ cfe/branches/tooling/utils/analyzer/SATestAdd.py Mon Jun  4 13:40:31 2012
@@ -41,7 +41,7 @@
         sys.exit(-1)
         
     # Build the project.
-    SATestBuild.testProject(ID, True, IsScanBuild, Dir)
+    SATestBuild.testProject(ID, IsScanBuild, IsReferenceBuild=True, Dir=Dir)
 
     # Add the project ID to the project map.
     ProjectMapPath = os.path.join(CurDir, SATestBuild.ProjectMapFile)

Modified: cfe/branches/tooling/utils/analyzer/SATestBuild.py
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/utils/analyzer/SATestBuild.py?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/utils/analyzer/SATestBuild.py (original)
+++ cfe/branches/tooling/utils/analyzer/SATestBuild.py Mon Jun  4 13:40:31 2012
@@ -76,8 +76,6 @@
 
 Verbose = 1
 
-IsReferenceBuild = False
-
 # Make sure we flush the output after every print statement.
 class flushfile(object):
     def __init__(self, f):
@@ -100,7 +98,7 @@
 def getProjectDir(ID):
     return os.path.join(os.path.abspath(os.curdir), ID)        
 
-def getSBOutputDirName() :
+def getSBOutputDirName(IsReferenceBuild) :
     if IsReferenceBuild == True :
         return SBOutputDirReferencePrefix + SBOutputDirName
     else :
@@ -210,7 +208,7 @@
         if Failed == False:
             os.remove(LogFile.name);
 
-def buildProject(Dir, SBOutputDir, IsScanBuild):
+def buildProject(Dir, SBOutputDir, IsScanBuild, IsReferenceBuild):
     TBegin = time.time() 
 
     BuildLogPath = os.path.join(SBOutputDir, LogFolderName, BuildLogName)
@@ -295,7 +293,7 @@
     
         FailuresCopied = NumOfFailuresInSummary
         Idx = 0
-        for FailLogPathI in glob.glob(SBOutputDir + "/*/failures/*.stderr.txt"):
+        for FailLogPathI in Failures:
             if Idx >= NumOfFailuresInSummary:
                 break;
             Idx += 1 
@@ -373,7 +371,7 @@
         ProjectsMap.seek(0)    
         for I in csv.reader(ProjectsMap):
             ProjName = I[0] 
-            Path = os.path.join(ProjName, getSBOutputDirName())
+            Path = os.path.join(ProjName, getSBOutputDirName(True))
     
             if Mode == "delete":
                 Command = "svn delete %s" % (Path,)
@@ -382,7 +380,7 @@
 
             if Verbose == 1:        
                 print "  Executing: %s" % (Command,)
-                check_call(Command, shell=True)    
+            check_call(Command, shell=True)    
     
         if Mode == "delete":
             CommitCommand = "svn commit -m \"[analyzer tests] Remove " \
@@ -392,12 +390,12 @@
                             "reference results.\""
         if Verbose == 1:        
             print "  Executing: %s" % (CommitCommand,)
-            check_call(CommitCommand, shell=True)    
+        check_call(CommitCommand, shell=True)    
     except:
         print "Error: SVN update failed."
         sys.exit(-1)
         
-def testProject(ID, IsScanBuild, Dir=None):
+def testProject(ID, IsScanBuild, IsReferenceBuild=False, Dir=None):
     print " \n\n--- Building project %s" % (ID,)
 
     TBegin = time.time() 
@@ -408,10 +406,10 @@
         print "  Build directory: %s." % (Dir,)
     
     # Set the build results directory.
-    RelOutputDir = getSBOutputDirName()
+    RelOutputDir = getSBOutputDirName(IsReferenceBuild)
     SBOutputDir = os.path.join(Dir, RelOutputDir)
                 
-    buildProject(Dir, SBOutputDir, IsScanBuild)    
+    buildProject(Dir, SBOutputDir, IsScanBuild, IsReferenceBuild)
 
     checkBuild(SBOutputDir)
     
@@ -421,10 +419,7 @@
     print "Completed tests for project %s (time: %.2f)." % \
           (ID, (time.time()-TBegin))
     
-def testAll(InIsReferenceBuild = False, UpdateSVN = False):
-    global IsReferenceBuild
-    IsReferenceBuild = InIsReferenceBuild
-
+def testAll(IsReferenceBuild = False, UpdateSVN = False):
     PMapFile = open(getProjectMapPath(), "rb")
     try:        
         # Validate the input.
@@ -439,13 +434,13 @@
         # When we are regenerating the reference results, we might need to 
         # update svn. Remove reference results from SVN.
         if UpdateSVN == True:
-            assert(InIsReferenceBuild == True);
+            assert(IsReferenceBuild == True);
             updateSVN("delete",  PMapFile);
             
         # Test the projects.
         PMapFile.seek(0)    
         for I in csv.reader(PMapFile):
-            testProject(I[0], int(I[1]))
+            testProject(I[0], int(I[1]), IsReferenceBuild)
 
         # Add reference results to SVN.
         if UpdateSVN == True:

Modified: cfe/branches/tooling/utils/clangVisualizers.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/utils/clangVisualizers.txt?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/utils/clangVisualizers.txt (original)
+++ cfe/branches/tooling/utils/clangVisualizers.txt Mon Jun  4 13:40:31 2012
@@ -3,15 +3,18 @@
 
 llvm::SmallVector<*,*>{
 	preview (
-		#(
-			"[",
-			($T1*)$e.EndX - ($T1*)$e.BeginX,
-			"](",
-			#array(
-				expr: (($T1*)$e.BeginX)[$i],
-				size: ($T1*)$e.EndX - ($T1*)$e.BeginX
-			),
-			")"
+		#if ((($T1*)$e.EndX - ($T1*)$e.BeginX) == 0) ( "empty" )
+		#else (
+			#(
+				"[",
+				($T1*)$e.EndX - ($T1*)$e.BeginX,
+				"](",
+				#array(
+					expr: (($T1*)$e.BeginX)[$i],
+					size: ($T1*)$e.EndX - ($T1*)$e.BeginX
+				),
+				")"
+			)
 		)
 	)
 
@@ -29,15 +32,18 @@
 
 llvm::SmallVectorImpl<*>{
 	preview (
-		#(
-			"[",
-			($T1*)$e.EndX - ($T1*)$e.BeginX,
-			"](",
-			#array(
-				expr: (($T1*)$e.BeginX)[$i],
-				size: ($T1*)$e.EndX - ($T1*)$e.BeginX
-			),
-			")"
+		#if ((($T1*)$e.EndX - ($T1*)$e.BeginX) == 0) ( "empty" )
+		#else (
+			#(
+				"[",
+				($T1*)$e.EndX - ($T1*)$e.BeginX,
+				"](",
+				#array(
+					expr: (($T1*)$e.BeginX)[$i],
+					size: ($T1*)$e.EndX - ($T1*)$e.BeginX
+				),
+				")"
+			)
 		)
 	)
 
@@ -86,6 +92,7 @@
 	
 	children (
 		#(
+			#([raw members] : [$e,!]),
 			#([ptr] : ($T1*)($e.Value & $e.PointerBitMask)),
 			#([int] : ($T3)($e.Value >> $e.IntShift) & $e.IntMask)
 		)
@@ -94,18 +101,16 @@
 
 llvm::PointerUnion<*,*>{
 	preview (
-		#if ((($e.Val.Value >> $e.Val.IntShift) & $e.Val.IntMask) == 0) (
-			"PT1"
-		) #else (
-			"PT2"
-		)
+		#if ((($e.Val.Value >> $e.Val.IntShift) & $e.Val.IntMask) == 0) ( "PT1" )
+		#else ( "PT2" )
 	)
 	
 	children (
 		#(
+			#([raw members] : [$e,!]),
 			#if ((($e.Val.Value >> $e.Val.IntShift) & $e.Val.IntMask) == 0) (
 				#([ptr] : ($T1)($e.Val.Value & $e.Val.PointerBitMask))
-			)	#else (
+			) #else (
 				#([ptr] : ($T2)($e.Val.Value & $e.Val.PointerBitMask))
 			)
 		)
@@ -114,13 +119,9 @@
 
 llvm::PointerUnion3<*,*,*>{
 	preview (
-		#if (($e.Val.Val.Value & 0x2) == 2) (
-			"PT2"
-		) #elif (($e.Val.Val.Value & 0x1) == 1) (
-			"PT3"
-		) #else (
-			"PT1"
-		)
+		#if (($e.Val.Val.Value & 0x2) == 2) ( "PT2" )
+		#elif (($e.Val.Val.Value & 0x1) == 1) ( "PT3" )
+		#else ( "PT1" )
 	)
 	
 	children (
@@ -138,22 +139,17 @@
 
 llvm::PointerUnion4<*,*,*,*>{
 	preview (
-		#if (($e.Val.Val.Value & 0x3) == 3) (
-			"PT4"
-		)	#elif (($e.Val.Val.Value & 0x2) == 2) (
-			"PT2"
-		) #elif (($e.Val.Val.Value & 0x1) == 1) (
-			"PT3"
-		) #else (
-			"PT1"
-		)
+		#if (($e.Val.Val.Value & 0x3) == 3) ( "PT4" )
+		#elif (($e.Val.Val.Value & 0x2) == 2) ( "PT2" )
+		#elif (($e.Val.Val.Value & 0x1) == 1) ( "PT3" )
+		#else ( "PT1" )
 	)
 	
 	children (
 		#(
 			#if (($e.Val.Val.Value & 0x3) == 3) (
 				#([ptr] : ($T4)(($e.Val.Val.Value >> 2) << 2))
-			)	#elif (($e.Val.Val.Value & 0x2) == 2) (
+			) #elif (($e.Val.Val.Value & 0x2) == 2) (
 				#([ptr] : ($T2)(($e.Val.Val.Value >> 2) << 2))
 			) #elif (($e.Val.Val.Value & 0x1) == 1) (
 				#([ptr] : ($T3)(($e.Val.Val.Value >> 2) << 2))
@@ -163,3 +159,233 @@
 		)
 	)
 }
+
+llvm::IntrusiveRefCntPtr<*>{
+	preview (
+		#if ($e.Obj == 0) ( "empty" )
+		#else (
+			#(
+				"[RefCnt=", $e.Obj->ref_cnt,
+				", ",
+				"Obj=", $e.Obj,
+				"]"
+			)
+		)
+	)
+
+	children (
+		#if ($e.Obj == 0) ( #array(expr: 0, size: 0) )
+		#else (
+			#(
+				#(RefCnt : $e.Obj->ref_cnt),
+				#(Obj : $e.Obj)
+			)
+		)
+	)
+}
+
+llvm::OwningPtr<*>{
+	preview (
+		#if ($e.Ptr == 0) ( "empty" )
+		#else ( $e.Ptr )
+	)
+
+	children (
+		#if ($e.Ptr == 0) ( #array(expr: 0, size: 0) )
+		#else ( #(Ptr : $e.Ptr) )
+	)	
+}
+
+llvm::SmallPtrSet<*,*>{
+	preview (
+		#(
+			#if (($e.CurArray) == ($e.SmallArray)) ( "[Small Mode] " )
+			#else ( "[Big Mode] " ),
+			"NumElements=", $e.NumElements,
+			" CurArraySize=", $e.CurArraySize
+		)
+	)
+
+	children (
+		#(
+			#([raw members] : [$c,!]),
+			#(NumElements : $e.NumElements),
+			#(CurArraySize : $e.CurArraySize),
+			#array(
+				expr: $e.CurArray[$i],
+				size: $e.CurArraySize + 1
+			) : ($T1*)&$e
+		)
+	)
+}
+
+llvm::DenseMap<*,*,*>{
+	preview (
+		#if ($e.NumEntries == 0) ( "empty" )
+		#else (
+			#(
+				"[NumEntries=", $e.NumEntries,
+				" NumBuckets=", $e.NumBuckets,
+				"]"
+			)
+		)
+	)
+
+	children (
+		#if ($e.NumEntries == 0) ( #array(expr: 0, size: 0) )
+		#else (
+			#(
+				#([raw members] : [$c,!]),
+				#(NumEntries : $e.NumEntries),
+				#(NumBuckets : $e.NumBuckets),
+				#array(
+					expr: $e.Buckets[$i],
+					size: $e.NumBuckets
+				)
+			)
+		)
+	)
+}
+
+llvm::StringMap<*,*>{
+	preview (
+		#(
+			"[NumBuckets=", $e.NumBuckets,
+			" ItemSize=", $e.ItemSize,
+			"]"
+		)
+	)
+
+	children (
+		#(
+			#([raw members] : [$c,!]),
+			#(NumBuckets : $e.NumBuckets),
+			#(ItemSize : $e.ItemSize),
+			#array(
+				expr: $e.TheTable[$i],
+				size: $e.NumBuckets,
+			) : (llvm::StringMapEntry<$T1>*)&$e
+		)
+	)
+}
+
+llvm::StringMapEntry<*>{
+	preview (
+		#if ($e.StrLen == 0) ( "empty" )
+		#else (	#(Entry : $e.second) )
+	)
+
+	children (
+		#if ($e.StrLen == 0) ( "empty" )
+		#else ( #(Entry : $e.second) )	
+	)
+}
+
+clang::DirectoryEntry|clang::FileEntry|clang::PragmaHandler{
+	preview ( [$e.Name,s] )
+	children (
+		#(
+			#([raw members] : [$c,!]),
+			#(Name : [$e.Name,s])
+		)
+	)
+}
+
+clang::DeclarationName{
+	preview (
+		; enum values from clang::DeclarationName::StoredNameKind
+		#if ($e.Ptr == 0) (
+			"empty"
+		) #elif (($e.Ptr & $e.PtrMask) == $e.StoredIdentifier) (
+			#else ( #("Identifier, ", (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask)) )
+		) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCZeroArgSelector) (
+			#("ZeroArgSelector, ", (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
+		) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCOneArgSelector) (
+			#("OneArgSelector, ", (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
+		) #elif (($e.Ptr & $e.PtrMask) == $e.StoredDeclarationNameExtra) (
+			#switch (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs)
+			#case 0 ( ;DeclarationNameExtra::CXXConstructor
+				#("CXXConstructorName, ", (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+			)
+			#case 1 ( ;DeclarationNameExtra::CXXDestructor
+				#("CXXDestructorName, ", (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+			)
+			#case 2 ( ;DeclarationNameExtra::CXXConversionFunction
+				#("CXXConversionFunctionName, ", (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+			)
+			#case 46 ( ;DeclarationNameExtra::CXXLiteralOperator
+				#("CXXLiteralOperatorName, ", (clang::CXXLiteralOperatorIdName*)($e.Ptr & ~$e.PtrMask))
+			)
+			#case 47 ( ;DeclarationNameExtra::CXXUsingDirective
+				#("CXXUsingDirective")	;TODO What to add here?
+			)
+			#default (
+				#if (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs < 47) (
+					#("CXXOperatorName, ", (clang::CXXOperatorIdName*)($e.Ptr & ~$e.PtrMask))
+				) #else (
+					#("ObjCMultiArgSelector, ", (clang::MultiKeywordSelector*)($e.Ptr & ~$e.PtrMask))
+				)
+			)
+		)
+	)
+
+	children (
+		#(
+			; enum values from clang::DeclarationName::StoredNameKind
+			#if ($e.Ptr == 0) (
+				#array( expr: 0, size: 0 )
+			) #else (
+				#(
+					#([raw members] : [$e.Ptr,!]),
+					if (($e.Ptr & $e.PtrMask) == $e.StoredIdentifier) (
+						#(Ptr : (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
+					) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCZeroArgSelector) (
+						#(Ptr : (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
+					) #elif (($e.Ptr & $e.PtrMask) == $e.StoredObjCOneArgSelector) (
+						#(Ptr : (clang::IdentifierInfo*)($e.Ptr & ~$e.PtrMask))
+					) #elif (($e.Ptr & $e.PtrMask) == $e.StoredDeclarationNameExtra) (
+						#switch (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs)
+						#case 0 ( ;DeclarationNameExtra::CXXConstructor
+							#(Ptr : (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+						)
+						#case 1 ( ;DeclarationNameExtra::CXXDestructor
+							#(Ptr : (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+						)
+						#case 2 ( ;DeclarationNameExtra::CXXConversionFunction
+							#(Ptr : (clang::CXXSpecialName*)($e.Ptr & ~$e.PtrMask))
+						)
+						#case 46 ( ;DeclarationNameExtra::CXXLiteralOperator
+							#(Ptr : (clang::CXXLiteralOperatorIdName*)($e.Ptr & ~$e.PtrMask))
+						)
+						#case 47 ( ;DeclarationNameExtra::CXXUsingDirective
+							#(Ptr : $e.Ptr)	;TODO What to add here?
+						)
+						#default (
+							#if (((clang::DeclarationNameExtra*)($e.Ptr & ~$e.PtrMask)).ExtraKindOrNumArgs < 47) (
+								#(Ptr : (CXXOperatorIdName*)($e.Ptr & ~$e.PtrMask))
+							) #else (
+								#(Ptr : (clang::MultiKeywordSelector*)($e.Ptr & ~$e.PtrMask))
+							)
+						)
+					)
+				)
+			)
+		)
+	)
+}
+
+clang::DeclSpec{
+	preview (
+		#(
+			"[",
+			(clang::DeclSpec::SCS)$e.StorageClassSpec,
+			", ",
+			(clang::TypeSpecifierType)$e.TypeSpecType,
+			"]"
+		)
+	)
+}
+
+llvm::Triple{
+	preview ( $e.Data )
+}

Modified: cfe/branches/tooling/www/analyzer/latest_checker.html.incl
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/www/analyzer/latest_checker.html.incl?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/www/analyzer/latest_checker.html.incl (original)
+++ cfe/branches/tooling/www/analyzer/latest_checker.html.incl Mon Jun  4 13:40:31 2012
@@ -1 +1 @@
-<b><a href="http://bit.ly/LgtUWx">checker-266.tar.bz2</a></b> (built May 23, 2012)
+<b><a href="http://bit.ly/LU4IZJ">checker-267.tar.bz2</a></b> (built June 1, 2012)

Modified: cfe/branches/tooling/www/analyzer/release_notes.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/www/analyzer/release_notes.html?rev=157942&r1=157941&r2=157942&view=diff
==============================================================================
--- cfe/branches/tooling/www/analyzer/release_notes.html (original)
+++ cfe/branches/tooling/www/analyzer/release_notes.html Mon Jun  4 13:40:31 2012
@@ -15,6 +15,13 @@
 
 <h1>Release notes for <tt>checker-XXX</tt> builds</h1>
 
+<h4 id="checker_267">checker-267</h4>
+<p><b>built:</b> June 1, 2012</br>
+   <b>download:</b> <a href="http://bit.ly/LU4IZJ">checker-267.tar.bz2</a></p>
+   <p><b>highlights:</b></p>
+
+<p>Adds basic interprocedural analysis support for blocks.</p>
+
 <h4 id="checker_266">checker-266</h4>
 <p><b>built:</b> May 23, 2012</br>
    <b>download:</b> <a href="http://bit.ly/LgtUWx">checker-266.tar.bz2</a></p>





More information about the llvm-branch-commits mailing list