[llvm-branch-commits] [cfe-branch] r155650 - in /cfe/branches/tooling: ./ docs/ include/clang/AST/ include/clang/Basic/ include/clang/Driver/ include/clang/Sema/ lib/AST/ lib/Basic/ lib/Driver/ lib/Parse/ lib/Rewrite/ lib/Sema/ lib/StaticAnalyzer/Checkers/ lib/StaticAnalyzer/Core/ test/Analysis/ test/CXX/basic/basic.types/ test/CXX/special/class.copy/ test/Driver/ test/Driver/Inputs/debian_multiarch_tree/lib/mips-linux-gnu/ test/Driver/Inputs/debian_multiarch_tree/lib/mipsel-linux-gnu/ test/Driver/Inputs/debian_multiarch_tree...

Manuel Klimek klimek at google.com
Thu Apr 26 11:38:29 PDT 2012


Author: klimek
Date: Thu Apr 26 13:38:29 2012
New Revision: 155650

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

Added:
    cfe/branches/tooling/docs/LibTooling.html
      - copied unchanged from r155648, cfe/trunk/docs/LibTooling.html
    cfe/branches/tooling/docs/RAVFrontendAction.html
      - copied unchanged from r155648, cfe/trunk/docs/RAVFrontendAction.html
    cfe/branches/tooling/docs/Tooling.html
      - copied unchanged from r155648, cfe/trunk/docs/Tooling.html
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/lib/mips-linux-gnu/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/lib/mips-linux-gnu/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/lib/mips-linux-gnu/.keep
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/lib/mips-linux-gnu/.keep
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/lib/mipsel-linux-gnu/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/lib/mipsel-linux-gnu/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/lib/mipsel-linux-gnu/.keep
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/lib/mipsel-linux-gnu/.keep
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mips-linux-gnu/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mips-linux-gnu/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mips-linux-gnu/.keep
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mips-linux-gnu/.keep
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mipsel-linux-gnu/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mipsel-linux-gnu/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mipsel-linux-gnu/.keep
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mipsel-linux-gnu/.keep
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/include/mips-linux-gnu/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/include/mips-linux-gnu/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/include/mips-linux-gnu/.keep
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/include/mips-linux-gnu/.keep
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/include/mipsel-linux-gnu/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/include/mipsel-linux-gnu/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/include/mipsel-linux-gnu/.keep
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/include/mipsel-linux-gnu/.keep
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/64/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/64/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/64/crtbegin.o
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/64/crtbegin.o
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/crtbegin.o
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/crtbegin.o
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/n32/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/n32/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/n32/crtbegin.o
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/n32/crtbegin.o
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/64/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/64/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/64/crtbegin.o
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/64/crtbegin.o
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/crtbegin.o
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/crtbegin.o
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/n32/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/n32/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/n32/crtbegin.o
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/n32/crtbegin.o
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mips-linux-gnu/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mips-linux-gnu/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mips-linux-gnu/.keep
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mips-linux-gnu/.keep
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mipsel-linux-gnu/
      - copied from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mipsel-linux-gnu/
    cfe/branches/tooling/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mipsel-linux-gnu/.keep
      - copied unchanged from r155648, cfe/trunk/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mipsel-linux-gnu/.keep
    cfe/branches/tooling/test/Rewriter/rewrite-modern-block-consts.mm
      - copied unchanged from r155648, cfe/trunk/test/Rewriter/rewrite-modern-block-consts.mm
    cfe/branches/tooling/test/Rewriter/rewrite-modern-captured-nested-bvar.mm
      - copied unchanged from r155648, cfe/trunk/test/Rewriter/rewrite-modern-captured-nested-bvar.mm
Modified:
    cfe/branches/tooling/   (props changed)
    cfe/branches/tooling/include/clang/AST/CXXInheritance.h
    cfe/branches/tooling/include/clang/AST/DeclContextInternals.h
    cfe/branches/tooling/include/clang/AST/RecursiveASTVisitor.h
    cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/branches/tooling/include/clang/Driver/Options.td
    cfe/branches/tooling/include/clang/Sema/Initialization.h
    cfe/branches/tooling/include/clang/Sema/Sema.h
    cfe/branches/tooling/lib/AST/ExprConstant.cpp
    cfe/branches/tooling/lib/Basic/Targets.cpp
    cfe/branches/tooling/lib/Driver/Tools.cpp
    cfe/branches/tooling/lib/Parse/Parser.cpp
    cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp
    cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp
    cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp
    cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp
    cfe/branches/tooling/lib/Sema/SemaExprMember.cpp
    cfe/branches/tooling/lib/Sema/SemaTemplate.cpp
    cfe/branches/tooling/lib/Sema/SemaTemplateInstantiate.cpp
    cfe/branches/tooling/lib/Sema/SemaType.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/RegionStore.cpp
    cfe/branches/tooling/test/Analysis/malloc.c
    cfe/branches/tooling/test/Analysis/retain-release.m
    cfe/branches/tooling/test/CXX/basic/basic.types/p10.cpp
    cfe/branches/tooling/test/CXX/special/class.copy/implicit-move.cpp
    cfe/branches/tooling/test/Driver/fast-math.c
    cfe/branches/tooling/test/Driver/linux-ld.c
    cfe/branches/tooling/test/FixIt/fixit.cpp
    cfe/branches/tooling/test/Preprocessor/init.c
    cfe/branches/tooling/test/Preprocessor/predefined-arch-macros.c
    cfe/branches/tooling/test/Rewriter/rewrite-byref-in-nested-blocks.mm
    cfe/branches/tooling/test/Rewriter/rewrite-modern-block.mm
    cfe/branches/tooling/test/Rewriter/rewrite-modern-extern-c-func-decl.mm
    cfe/branches/tooling/test/Rewriter/rewrite-rewritten-initializer.mm
    cfe/branches/tooling/test/Sema/attr-visibility.c
    cfe/branches/tooling/test/SemaCXX/alias-template.cpp
    cfe/branches/tooling/test/SemaCXX/arrow-operator.cpp
    cfe/branches/tooling/test/SemaCXX/constant-expression.cpp
    cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-references.cpp
    cfe/branches/tooling/test/SemaCXX/cxx98-compat.cpp
    cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp   (props changed)
    cfe/branches/tooling/test/SemaTemplate/dependent-names.cpp
    cfe/branches/tooling/unittests/Tooling/RecursiveASTVisitorTest.cpp
    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 Thu Apr 26 13:38:29 2012
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:146581-155543
+/cfe/trunk:146581-155648
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/tooling/include/clang/AST/CXXInheritance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/CXXInheritance.h?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/CXXInheritance.h (original)
+++ cfe/branches/tooling/include/clang/AST/CXXInheritance.h Thu Apr 26 13:38:29 2012
@@ -19,7 +19,7 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeOrdering.h"
-#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallMap.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include <list>
@@ -128,8 +128,7 @@
   /// while the element contains the number of non-virtual base
   /// class subobjects for that class type. The key of the map is
   /// the cv-unqualified canonical type of the base class subobject.
-  std::map<QualType, std::pair<bool, unsigned>, QualTypeOrdering>
-    ClassSubobjects;
+  llvm::SmallMap<QualType, std::pair<bool, unsigned>, 8> ClassSubobjects;
   
   /// FindAmbiguities - Whether Sema::IsDerivedFrom should try find
   /// ambiguous paths while it is looking for a path from a derived

Modified: cfe/branches/tooling/include/clang/AST/DeclContextInternals.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/DeclContextInternals.h?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/DeclContextInternals.h (original)
+++ cfe/branches/tooling/include/clang/AST/DeclContextInternals.h Thu Apr 26 13:38:29 2012
@@ -17,8 +17,8 @@
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclarationName.h"
 #include "clang/AST/DeclCXX.h"
-#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerUnion.h"
+#include "llvm/ADT/SmallMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include <algorithm>
 
@@ -196,7 +196,7 @@
 };
 
 class StoredDeclsMap
-  : public llvm::DenseMap<DeclarationName, StoredDeclsList> {
+  : public llvm::SmallMap<DeclarationName, StoredDeclsList, 4> {
 
 public:
   static void DestroyAll(StoredDeclsMap *Map, bool Dependent);

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=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/branches/tooling/include/clang/AST/RecursiveASTVisitor.h Thu Apr 26 13:38:29 2012
@@ -392,8 +392,8 @@
 private:
   // These are helper methods used by more than one Traverse* method.
   bool TraverseTemplateParameterListHelper(TemplateParameterList *TPL);
-  bool TraverseClassInstantiations(ClassTemplateDecl* D, Decl *Pattern);
-  bool TraverseFunctionInstantiations(FunctionTemplateDecl* D) ;
+  bool TraverseClassInstantiations(ClassTemplateDecl *D);
+  bool TraverseFunctionInstantiations(FunctionTemplateDecl *D) ;
   bool TraverseTemplateArgumentLocsHelper(const TemplateArgumentLoc *TAL,
                                           unsigned Count);
   bool TraverseArrayTypeLocHelper(ArrayTypeLoc TL);
@@ -1377,35 +1377,19 @@
 }
 
 // A helper method for traversing the implicit instantiations of a
-// class.
+// class template.
 template<typename Derived>
 bool RecursiveASTVisitor<Derived>::TraverseClassInstantiations(
-  ClassTemplateDecl* D, Decl *Pattern) {
-  assert(isa<ClassTemplateDecl>(Pattern) ||
-         isa<ClassTemplatePartialSpecializationDecl>(Pattern));
-
+    ClassTemplateDecl *D) {
   ClassTemplateDecl::spec_iterator end = D->spec_end();
   for (ClassTemplateDecl::spec_iterator it = D->spec_begin(); it != end; ++it) {
     ClassTemplateSpecializationDecl* SD = *it;
 
     switch (SD->getSpecializationKind()) {
     // Visit the implicit instantiations with the requested pattern.
-    case TSK_ImplicitInstantiation: {
-      llvm::PointerUnion<ClassTemplateDecl *,
-                         ClassTemplatePartialSpecializationDecl *> U
-        = SD->getInstantiatedFrom();
-
-      bool ShouldVisit;
-      if (U.is<ClassTemplateDecl*>())
-        ShouldVisit = (U.get<ClassTemplateDecl*>() == Pattern);
-      else
-        ShouldVisit
-          = (U.get<ClassTemplatePartialSpecializationDecl*>() == Pattern);
-
-      if (ShouldVisit)
-        TRY_TO(TraverseDecl(SD));
-      break;
-    }
+    case TSK_Undeclared:
+    case TSK_ImplicitInstantiation:
+      TRY_TO(TraverseDecl(SD));
 
     // We don't need to do anything on an explicit instantiation
     // or explicit specialization because there will be an explicit
@@ -1414,11 +1398,6 @@
     case TSK_ExplicitInstantiationDefinition:
     case TSK_ExplicitSpecialization:
       break;
-
-    // We don't need to do anything for an uninstantiated
-    // specialization.
-    case TSK_Undeclared:
-      break;
     }
   }
 
@@ -1433,13 +1412,12 @@
     // By default, we do not traverse the instantiations of
     // class templates since they do not appear in the user code. The
     // following code optionally traverses them.
-    if (getDerived().shouldVisitTemplateInstantiations()) {
-      // If this is the definition of the primary template, visit
-      // instantiations which were formed from this pattern.
-      if (D->isThisDeclarationADefinition() ||
-          D->getInstantiatedFromMemberTemplate())
-        TRY_TO(TraverseClassInstantiations(D, D));
-    }
+    //
+    // We only traverse the class instantiations when we see the canonical
+    // declaration of the template, to ensure we only visit them once.
+    if (getDerived().shouldVisitTemplateInstantiations() &&
+        D == D->getCanonicalDecl())
+      TRY_TO(TraverseClassInstantiations(D));
 
     // Note that getInstantiatedFromMemberTemplate() is just a link
     // from a template instantiation back to the template from which
@@ -1450,12 +1428,13 @@
 // function while skipping its specializations.
 template<typename Derived>
 bool RecursiveASTVisitor<Derived>::TraverseFunctionInstantiations(
-  FunctionTemplateDecl* D) {
+    FunctionTemplateDecl *D) {
   FunctionTemplateDecl::spec_iterator end = D->spec_end();
   for (FunctionTemplateDecl::spec_iterator it = D->spec_begin(); it != end;
        ++it) {
     FunctionDecl* FD = *it;
     switch (FD->getTemplateSpecializationKind()) {
+    case TSK_Undeclared:
     case TSK_ImplicitInstantiation:
       // We don't know what kind of FunctionDecl this is.
       TRY_TO(TraverseDecl(FD));
@@ -1467,7 +1446,6 @@
     case TSK_ExplicitInstantiationDefinition:
       break;
 
-    case TSK_Undeclared:           // Declaration of the template definition.
     case TSK_ExplicitSpecialization:
       break;
     }
@@ -1481,20 +1459,14 @@
     TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
 
     // By default, we do not traverse the instantiations of
-    // function templates since they do not apprear in the user code. The
+    // function templates since they do not appear in the user code. The
     // following code optionally traverses them.
-    if (getDerived().shouldVisitTemplateInstantiations()) {
-      // Explicit function specializations will be traversed from the
-      // context of their declaration. There is therefore no need to
-      // traverse them for here.
-      //
-      // In addition, we only traverse the function instantiations when
-      // the function template is a function template definition.
-      if (D->isThisDeclarationADefinition() ||
-          D->getInstantiatedFromMemberTemplate()) {
-        TRY_TO(TraverseFunctionInstantiations(D));
-      }
-    }
+    //
+    // We only traverse the function instantiations when we see the canonical
+    // declaration of the template, to ensure we only visit them once.
+    if (getDerived().shouldVisitTemplateInstantiations() &&
+        D == D->getCanonicalDecl())
+      TRY_TO(TraverseFunctionInstantiations(D));
   })
 
 DEF_TRAVERSE_DECL(TemplateTemplateParmDecl, {
@@ -1636,11 +1608,7 @@
     // template args here.
     TRY_TO(TraverseCXXRecordHelper(D));
 
-    // If we're visiting instantiations, visit the instantiations of
-    // this template now.
-    if (getDerived().shouldVisitTemplateInstantiations() &&
-        D->isThisDeclarationADefinition())
-      TRY_TO(TraverseClassInstantiations(D->getSpecializedTemplate(), D));
+    // Instantiations will have been visited with the primary template.
   })
 
 DEF_TRAVERSE_DECL(EnumConstantDecl, {

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=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td Thu Apr 26 13:38:29 2012
@@ -1367,6 +1367,8 @@
 def err_constexpr_virtual_base : Error<
   "constexpr %select{member function|constructor}0 not allowed in "
   "%select{class|struct}1 with virtual base %plural{1:class|:classes}2">;
+def note_non_literal_incomplete : Note<
+  "incomplete type %0 is not a literal type">;
 def note_non_literal_virtual_base : Note<"%select{class|struct}0 with virtual "
   "base %plural{1:class|:classes}1 is not a literal type">;
 def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
@@ -1813,6 +1815,8 @@
 def warn_attribute_protected_visibility :
   Warning<"target does not support 'protected' visibility; using 'default'">,
   InGroup<DiagGroup<"unsupported-visibility">>;
+def err_mismatched_visibilit: Error<"visibility does not match previous declaration">;
+def note_previous_attribute : Note<"previous attribute is here">;
 def err_unknown_machine_mode : Error<"unknown machine mode %0">;
 def err_unsupported_machine_mode : Error<"unsupported machine mode %0">;
 def err_mode_not_primitive : Error<
@@ -2361,6 +2365,9 @@
   "expression">;
 def err_template_arg_not_address_constant : Error<
   "non-type template argument of type %0 is not a constant expression">;
+def warn_cxx98_compat_template_arg_null : Warning<
+  "use of null pointer as non-type template argument is incompatible with "
+  "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
 def err_template_arg_untyped_null_constant : Error<
   "null non-type template argument must be cast to template parameter type %0">;
 def err_template_arg_wrongtype_null_constant : Error<
@@ -3641,6 +3648,8 @@
 
 def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
 def err_no_member : Error<"no member named %0 in %1">;
+def err_no_member_overloaded_arrow : Error<
+  "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
 
 def err_member_not_yet_instantiated : Error<
   "no member %0 in %1; it has not yet been instantiated">;
@@ -3828,6 +3837,9 @@
   "declaration">;
 def err_invalid_member_use_in_static_method : Error<
   "invalid use of member %0 in static member function">;
+def warn_cxx98_compat_this_outside_method : Warning<
+  "use of 'this' outside a non-static member function is incompatible "
+  "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
 def err_invalid_qualified_function_type : Error<
   "%select{static |non-}0member function %select{of type %2 |}1"
   "cannot have '%3' qualifier">;

Modified: cfe/branches/tooling/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Driver/Options.td?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Driver/Options.td (original)
+++ cfe/branches/tooling/include/clang/Driver/Options.td Thu Apr 26 13:38:29 2012
@@ -352,10 +352,8 @@
 def fhonor_infinities : Flag<"-fhonor-infinities">, Group<f_Group>;
 def fno_honor_infinities : Flag<"-fno-honor-infinities">, Group<f_Group>;
 // Sic. This option was misspelled originally.
-def fhonor_infinites : Flag<"-fhonor-infinites">, Group<f_Group>,
-    Alias<fhonor_infinities>;
-def fno_honor_infinites : Flag<"-fno-honor-infinites">, Group<f_Group>,
-    Alias<fno_honor_infinities>;
+def fhonor_infinites : Flag<"-fhonor-infinites">, Alias<fhonor_infinities>;
+def fno_honor_infinites : Flag<"-fno-honor-infinites">, Alias<fno_honor_infinities>;
 def ftrapping_math : Flag<"-ftrapping-math">, Group<f_Group>;
 def fno_trapping_math : Flag<"-fno-trapping-math">, Group<f_Group>;
 

Modified: cfe/branches/tooling/include/clang/Sema/Initialization.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Sema/Initialization.h?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/Initialization.h (original)
+++ cfe/branches/tooling/include/clang/Sema/Initialization.h Thu Apr 26 13:38:29 2012
@@ -225,7 +225,9 @@
   
   /// \brief Create the initialization entity for a temporary.
   static InitializedEntity InitializeTemporary(QualType Type) {
-    return InitializedEntity(EK_Temporary, SourceLocation(), Type);
+    InitializedEntity Result(EK_Temporary, SourceLocation(), Type);
+    Result.TypeInfo = 0;
+    return Result;
   }
 
   /// \brief Create the initialization entity for a temporary.

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=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/Sema.h (original)
+++ cfe/branches/tooling/include/clang/Sema/Sema.h Thu Apr 26 13:38:29 2012
@@ -2703,6 +2703,18 @@
                                 const DeclarationNameInfo &NameInfo,
                                 const TemplateArgumentListInfo *TemplateArgs);
 
+  // This struct is for use by ActOnMemberAccess to allow
+  // BuildMemberReferenceExpr to be able to reinvoke ActOnMemberAccess after
+  // changing the access operator from a '.' to a '->' (to see if that is the
+  // change needed to fix an error about an unknown member, e.g. when the class
+  // defines a custom operator->).
+  struct ActOnMemberAccessExtraArgs {
+    Scope *S;
+    UnqualifiedId &Id;
+    Decl *ObjCImpDecl;
+    bool HasTrailingLParen;
+  };
+
   ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType,
                                       SourceLocation OpLoc, bool IsArrow,
                                       const CXXScopeSpec &SS,
@@ -2710,7 +2722,8 @@
                                       NamedDecl *FirstQualifierInScope,
                                       LookupResult &R,
                                  const TemplateArgumentListInfo *TemplateArgs,
-                                      bool SuppressQualifierCheck = false);
+                                      bool SuppressQualifierCheck = false,
+                                     ActOnMemberAccessExtraArgs *ExtraArgs = 0);
 
   ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow);
   ExprResult LookupMemberExpr(LookupResult &R, ExprResult &Base,

Modified: cfe/branches/tooling/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ExprConstant.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ExprConstant.cpp (original)
+++ cfe/branches/tooling/lib/AST/ExprConstant.cpp Thu Apr 26 13:38:29 2012
@@ -3408,6 +3408,7 @@
 
 bool RecordExprEvaluator::ZeroInitialization(const Expr *E) {
   const RecordDecl *RD = E->getType()->castAs<RecordType>()->getDecl();
+  if (RD->isInvalidDecl()) return false;
   if (RD->isUnion()) {
     // C++11 [dcl.init]p5: If T is a (possibly cv-qualified) union type, the
     // object's first non-static named data member is zero-initialized
@@ -3470,6 +3471,8 @@
     return false;
 
   const RecordDecl *RD = E->getType()->castAs<RecordType>()->getDecl();
+  if (RD->isInvalidDecl()) return false;
+
   const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(RD);
 
   if (RD->isUnion()) {
@@ -3528,6 +3531,8 @@
 
 bool RecordExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E) {
   const CXXConstructorDecl *FD = E->getConstructor();
+  if (FD->isInvalidDecl() || FD->getParent()->isInvalidDecl()) return false;
+
   bool ZeroInit = E->requiresZeroInitialization();
   if (CheckTrivialDefaultConstructor(Info, E->getExprLoc(), FD, ZeroInit)) {
     // If we've already performed zero-initialization, we're already done.

Modified: cfe/branches/tooling/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/Targets.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/Targets.cpp (original)
+++ cfe/branches/tooling/lib/Basic/Targets.cpp Thu Apr 26 13:38:29 2012
@@ -316,6 +316,8 @@
     DefineStd(Builder, "linux", Opts);
     Builder.defineMacro("__gnu_linux__");
     Builder.defineMacro("__ELF__");
+    if (Triple.getEnvironment() == llvm::Triple::ANDROIDEABI)
+      Builder.defineMacro("__ANDROID__", "1");
     if (Opts.POSIXThreads)
       Builder.defineMacro("_REENTRANT");
     if (Opts.CPlusPlus)
@@ -1642,18 +1644,16 @@
   case CK_Corei7AVX:
   case CK_CoreAVXi:
     setFeatureEnabled(Features, "mmx", true);
-    setFeatureEnabled(Features, "sse4", true);
+    setFeatureEnabled(Features, "avx", true);
     setFeatureEnabled(Features, "aes", true);
-    //setFeatureEnabled(Features, "avx", true);
     break;
   case CK_CoreAVX2:
     setFeatureEnabled(Features, "mmx", true);
-    setFeatureEnabled(Features, "sse4", true);
+    setFeatureEnabled(Features, "avx2", true);
     setFeatureEnabled(Features, "aes", true);
     setFeatureEnabled(Features, "lzcnt", true);
     setFeatureEnabled(Features, "bmi", true);
     setFeatureEnabled(Features, "bmi2", true);
-    //setFeatureEnabled(Features, "avx2", true);
     break;
   case CK_K6:
   case CK_WinChipC6:

Modified: cfe/branches/tooling/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/Tools.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/Tools.cpp (original)
+++ cfe/branches/tooling/lib/Driver/Tools.cpp Thu Apr 26 13:38:29 2012
@@ -1617,16 +1617,15 @@
         A->getOption().getID() != options::OPT_fhonor_nans)
       CmdArgs.push_back("-menable-no-nans");
 
-  // -fno-math-errno is default.
-  bool MathErrno = false;
+  // -fno-math-errno is default on Darwin. Other platforms, -fmath-errno is the
+  // default.
+  bool MathErrno = !getToolChain().getTriple().isOSDarwin();
   if (Arg *A = Args.getLastArg(options::OPT_ffast_math,
                                options::OPT_fmath_errno,
-                               options::OPT_fno_math_errno)) {
-    if (A->getOption().getID() == options::OPT_fmath_errno) {
-      CmdArgs.push_back("-fmath-errno");
-      MathErrno = true;
-    }
-  }
+                               options::OPT_fno_math_errno))
+    MathErrno = A->getOption().getID() == options::OPT_fmath_errno;
+  if (MathErrno)
+    CmdArgs.push_back("-fmath-errno");
 
   // There are several flags which require disabling very specific
   // optimizations. Any of these being disabled forces us to turn off the

Modified: cfe/branches/tooling/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/Parser.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/Parser.cpp (original)
+++ cfe/branches/tooling/lib/Parse/Parser.cpp Thu Apr 26 13:38:29 2012
@@ -641,7 +641,7 @@
   case tok::kw_export:    // As in 'export template'
   case tok::kw_static_assert:
   case tok::kw__Static_assert:
-    // A function definition cannot start with a these keywords.
+    // A function definition cannot start with any of these keywords.
     {
       SourceLocation DeclEnd;
       StmtVector Stmts(Actions);

Modified: cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp Thu Apr 26 13:38:29 2012
@@ -4133,7 +4133,9 @@
 }
 
 void RewriteModernObjC::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) {
-  SourceLocation FunLocStart = getFunctionSourceLocation(*this, FD);
+  SourceLocation FunLocStart = 
+    (!Blocks.empty()) ? getFunctionSourceLocation(*this, FD)
+                      : FD->getTypeSpecStartLoc();
   StringRef FuncName = FD->getName();
 
   SynthesizeBlockLiterals(FunLocStart, FuncName);

Modified: cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp Thu Apr 26 13:38:29 2012
@@ -1752,6 +1752,15 @@
     return;
   }
 
+  VisibilityAttr *PrevAttr = D->getCanonicalDecl()->getAttr<VisibilityAttr>();
+  if (PrevAttr) {
+    VisibilityAttr::VisibilityType PrevVisibility = PrevAttr->getVisibility();
+    if (PrevVisibility != type) {
+      S.Diag(Attr.getLoc(), diag::err_mismatched_visibilit);
+      S.Diag(PrevAttr->getLocation(), diag::note_previous_attribute);
+      return;
+    }
+  }
   D->addAttr(::new (S.Context) VisibilityAttr(Attr.getRange(), S.Context, type));
 }
 

Modified: cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp Thu Apr 26 13:38:29 2012
@@ -8165,7 +8165,7 @@
   // reference types, are supposed to return false here, but that appears
   // to be a standard defect.
   CXXRecordDecl *ClassDecl = Type->getAsCXXRecordDecl();
-  if (!ClassDecl)
+  if (!ClassDecl || !ClassDecl->getDefinition())
     return true;
 
   if (Type.isTriviallyCopyableType(S.Context))

Modified: cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp Thu Apr 26 13:38:29 2012
@@ -693,6 +693,10 @@
 }
 
 void Sema::CheckCXXThisCapture(SourceLocation Loc, bool Explicit) {
+  if (getLangOpts().CPlusPlus0x &&
+      !dyn_cast_or_null<CXXMethodDecl>(getFunctionLevelDeclContext()))
+    Diag(Loc, diag::warn_cxx98_compat_this_outside_method);
+
   // We don't need to capture this in an unevaluated context.
   if (ExprEvalContexts.back().Context == Unevaluated && !Explicit)
     return;

Modified: cfe/branches/tooling/lib/Sema/SemaExprMember.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExprMember.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExprMember.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExprMember.cpp Thu Apr 26 13:38:29 2012
@@ -813,8 +813,9 @@
                                SourceLocation TemplateKWLoc,
                                NamedDecl *FirstQualifierInScope,
                                LookupResult &R,
-                         const TemplateArgumentListInfo *TemplateArgs,
-                               bool SuppressQualifierCheck) {
+                               const TemplateArgumentListInfo *TemplateArgs,
+                               bool SuppressQualifierCheck,
+                               ActOnMemberAccessExtraArgs *ExtraArgs) {
   QualType BaseType = BaseExprType;
   if (IsArrow) {
     assert(BaseType->isPointerType());
@@ -835,6 +836,32 @@
                        ? computeDeclContext(SS, false)
                        : BaseType->getAs<RecordType>()->getDecl());
 
+    if (ExtraArgs) {
+      ExprResult RetryExpr;
+      if (!IsArrow && BaseExpr) {
+        SFINAETrap Trap(*this);
+        ParsedType ObjectType;
+        bool MayBePseudoDestructor = false;
+        RetryExpr = ActOnStartCXXMemberReference(getCurScope(), BaseExpr,
+                                                 OpLoc, tok::arrow, ObjectType,
+                                                 MayBePseudoDestructor);
+        if (RetryExpr.isUsable() && !Trap.hasErrorOccurred()) {
+          CXXScopeSpec TempSS(SS);
+          RetryExpr = ActOnMemberAccessExpr(
+              ExtraArgs->S, RetryExpr.get(), OpLoc, tok::arrow, TempSS,
+              TemplateKWLoc, ExtraArgs->Id, ExtraArgs->ObjCImpDecl,
+              ExtraArgs->HasTrailingLParen);
+        }
+        if (Trap.hasErrorOccurred())
+          RetryExpr = ExprError();
+      }
+      if (RetryExpr.isUsable()) {
+        Diag(OpLoc, diag::err_no_member_overloaded_arrow)
+          << MemberName << DC << FixItHint::CreateReplacement(OpLoc, "->");
+        return RetryExpr;
+      }
+    }
+
     Diag(R.getNameLoc(), diag::err_no_member)
       << MemberName << DC
       << (BaseExpr ? BaseExpr->getSourceRange() : SourceRange());
@@ -1506,9 +1533,11 @@
       return move(Result);
     }
 
+    ActOnMemberAccessExtraArgs ExtraArgs = {S, Id, ObjCImpDecl, HasTrailingLParen};
     Result = BuildMemberReferenceExpr(Base, Base->getType(),
                                       OpLoc, IsArrow, SS, TemplateKWLoc,
-                                      FirstQualifierInScope, R, TemplateArgs);
+                                      FirstQualifierInScope, R, TemplateArgs,
+                                      false, &ExtraArgs);
   }
 
   return move(Result);

Modified: cfe/branches/tooling/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaTemplate.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaTemplate.cpp Thu Apr 26 13:38:29 2012
@@ -2512,6 +2512,7 @@
                                      Converted.size(),
                                      SourceRange(TemplateLoc, RAngleLoc));
 
+    Sema::ContextRAII SavedContext(SemaRef, Template->getDeclContext());
     ArgType = SemaRef.SubstType(ArgType, AllTemplateArgs,
                                 Param->getDefaultArgumentLoc(),
                                 Param->getDeclName());
@@ -2560,6 +2561,7 @@
                                    Converted.size(),
                                    SourceRange(TemplateLoc, RAngleLoc));
 
+  Sema::ContextRAII SavedContext(SemaRef, Template->getDeclContext());
   return SemaRef.SubstExpr(Param->getDefaultArgument(), AllTemplateArgs);
 }
 
@@ -2607,6 +2609,7 @@
                                    Converted.size(),
                                    SourceRange(TemplateLoc, RAngleLoc));
 
+  Sema::ContextRAII SavedContext(SemaRef, Template->getDeclContext());
   // Substitute into the nested-name-specifier first, 
   QualifierLoc = Param->getDefaultArgument().getTemplateQualifierLoc();
   if (QualifierLoc) {
@@ -3586,6 +3589,7 @@
   if (ParamType->isPointerType() || ParamType->isNullPtrType()) {
     switch (isNullPointerValueTemplateArgument(S, Param, ParamType, Arg)) {
     case NPV_NullPointer:
+      S.Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
       Converted = TemplateArgument((Decl *)0);
       return false;
 
@@ -3882,6 +3886,7 @@
   case NPV_Error:
     return true;
   case NPV_NullPointer:
+    S.Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
     Converted = TemplateArgument((Decl *)0);
     return false;
   case NPV_NotNullPointer:
@@ -4317,6 +4322,7 @@
       return ExprError();
       
     case NPV_NullPointer:
+      Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
       Converted = TemplateArgument((Decl *)0);
       return Owned(Arg);;
     }

Modified: cfe/branches/tooling/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaTemplateInstantiate.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaTemplateInstantiate.cpp Thu Apr 26 13:38:29 2012
@@ -638,8 +638,13 @@
        ++Active) 
   {
     switch(Active->Kind) {
-    case ActiveTemplateInstantiation::DefaultFunctionArgumentInstantiation:
     case ActiveTemplateInstantiation::TemplateInstantiation:
+      // An instantiation of an alias template may or may not be a SFINAE
+      // context, depending on what else is on the stack.
+      if (isa<TypeAliasTemplateDecl>(reinterpret_cast<Decl *>(Active->Entity)))
+        break;
+      // Fall through.
+    case ActiveTemplateInstantiation::DefaultFunctionArgumentInstantiation:
     case ActiveTemplateInstantiation::ExceptionSpecInstantiation:
       // This is a template instantiation, so there is no SFINAE.
       return llvm::Optional<TemplateDeductionInfo *>();

Modified: cfe/branches/tooling/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaType.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaType.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaType.cpp Thu Apr 26 13:38:29 2012
@@ -4301,9 +4301,14 @@
 
   const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
 
-  // FIXME: Better diagnostic for incomplete class?
-  if (!RD->isCompleteDefinition())
+  // A partially-defined class type can't be a literal type, because a literal
+  // class type must have a trivial destructor (which can't be checked until
+  // the class definition is complete).
+  if (!RD->isCompleteDefinition()) {
+    RequireCompleteType(Loc, ElemType,
+                        PDiag(diag::note_non_literal_incomplete) << T);
     return true;
+  }
 
   // If the class has virtual base classes, then it's not an aggregate, and
   // cannot have any constexpr constructors or a trivial default constructor,

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Thu Apr 26 13:38:29 2012
@@ -929,9 +929,9 @@
     //  filters.
     assert(ScratchArgs.isEmpty());
 
-    if (FName == "pthread_create") {
-      // Part of: <rdar://problem/7299394>.  This will be addressed
-      // better with IPA.
+    if (FName == "pthread_create" || FName == "pthread_setspecific") {
+      // Part of: <rdar://problem/7299394> and <rdar://problem/11282706>.
+      // This will be addressed better with IPA.
       S = getPersistentStopSummary();
     } else if (FName == "NSMakeCollectable") {
       // Handle: id NSMakeCollectable(CFTypeRef)

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=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/RegionStore.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/RegionStore.cpp Thu Apr 26 13:38:29 2012
@@ -1274,7 +1274,15 @@
   // At this point we have already checked in either getBindingForElement or
   // getBindingForField if 'R' has a direct binding.
   RegionBindings B = GetRegionBindings(store);
+
+  // Lazy binding?
+  Store lazyBindingStore = NULL;
+  const MemRegion *lazyBindingRegion = NULL;
+  llvm::tie(lazyBindingStore, lazyBindingRegion) = GetLazyBinding(B, R, R);
   
+  if (lazyBindingRegion)
+    return getLazyBinding(lazyBindingRegion, lazyBindingStore);
+
   // Record whether or not we see a symbolic index.  That can completely
   // be out of scope of our lookup.
   bool hasSymbolicIndex = false;
@@ -1299,14 +1307,6 @@
     break;
   }
 
-  // Lazy binding?
-  Store lazyBindingStore = NULL;
-  const MemRegion *lazyBindingRegion = NULL;
-  llvm::tie(lazyBindingStore, lazyBindingRegion) = GetLazyBinding(B, R, R);
-
-  if (lazyBindingRegion)
-    return getLazyBinding(lazyBindingRegion, lazyBindingStore);
-
   if (R->hasStackNonParametersStorage()) {
     if (isa<ElementRegion>(R)) {
       // Currently we don't reason specially about Clang-style vectors.  Check

Modified: cfe/branches/tooling/test/Analysis/malloc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/malloc.c?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/malloc.c (original)
+++ cfe/branches/tooling/test/Analysis/malloc.c Thu Apr 26 13:38:29 2012
@@ -760,6 +760,22 @@
     return;
 }
 
+// <rdar://problem/11269741> Previously this triggered a false positive
+// because malloc() is known to return uninitialized memory and the binding
+// of 'o' to 'p->n' was not getting propertly handled.  Now we report a leak.
+struct rdar11269741_a_t {
+  struct rdar11269741_b_t {
+    int m;
+  } n;
+};
+
+int rdar11269741(struct rdar11269741_b_t o)
+{
+  struct rdar11269741_a_t *p = (struct rdar11269741_a_t *) malloc(sizeof(*p));
+  p->n = o;
+  return p->n.m; // expected-warning {{leak}}
+}
+
 // ----------------------------------------------------------------------------
 // Below are the known false positives.
 

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=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/retain-release.m (original)
+++ cfe/branches/tooling/test/Analysis/retain-release.m Thu Apr 26 13:38:29 2012
@@ -1055,10 +1055,14 @@
 typedef struct _opaque_pthread_attr_t __darwin_pthread_attr_t;
 typedef __darwin_pthread_t pthread_t;
 typedef __darwin_pthread_attr_t pthread_attr_t;
+typedef unsigned long __darwin_pthread_key_t;
+typedef __darwin_pthread_key_t pthread_key_t;
 
 int pthread_create(pthread_t *, const pthread_attr_t *,
                    void *(*)(void *), void *);
 
+int pthread_setspecific(pthread_key_t key, const void *value);
+
 void *rdar_7299394_start_routine(void *p) {
   [((id) p) release];
   return 0;
@@ -1072,6 +1076,16 @@
 }
 
 //===----------------------------------------------------------------------===//
+// <rdar://problem/11282706> false positive with not understanding thread
+// local storage
+//===----------------------------------------------------------------------===//
+
+void rdar11282706(pthread_key_t key) {
+  NSNumber *number = [[NSNumber alloc] initWithInt:5]; // no-warning
+  pthread_setspecific(key, (void*) number);
+}
+
+//===----------------------------------------------------------------------===//
 // <rdar://problem/7283567> False leak associated with call to 
 //                          CVPixelBufferCreateWithBytes ()
 //

Modified: cfe/branches/tooling/test/CXX/basic/basic.types/p10.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/basic/basic.types/p10.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/basic/basic.types/p10.cpp (original)
+++ cfe/branches/tooling/test/CXX/basic/basic.types/p10.cpp Thu Apr 26 13:38:29 2012
@@ -22,11 +22,11 @@
 
 // (implied) - it is complete
 
-struct Incomplete;
+struct Incomplete; // expected-note 2{{forward declaration of 'Incomplete'}}
 template<class T> struct ClassTemp {};
 
-constexpr Incomplete incomplete = {}; // expected-error {{constexpr variable cannot have non-literal type 'const Incomplete'}}
-constexpr Incomplete incomplete2[] = {}; // expected-error {{constexpr variable cannot have non-literal type 'Incomplete const[]'}}
+constexpr Incomplete incomplete = {}; // expected-error {{constexpr variable cannot have non-literal type 'const Incomplete'}} expected-note {{incomplete type 'const Incomplete' is not a literal type}}
+constexpr Incomplete incomplete2[] = {}; // expected-error {{constexpr variable cannot have non-literal type 'Incomplete const[]'}} expected-note {{incomplete type 'Incomplete const[]' is not a literal type}}
 constexpr ClassTemp<int> classtemplate = {};
 constexpr ClassTemp<int> classtemplate2[] = {};
 

Modified: cfe/branches/tooling/test/CXX/special/class.copy/implicit-move.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/special/class.copy/implicit-move.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/special/class.copy/implicit-move.cpp (original)
+++ cfe/branches/tooling/test/CXX/special/class.copy/implicit-move.cpp Thu Apr 26 13:38:29 2012
@@ -234,3 +234,10 @@
     friend NoMove11 &NoMove11::operator=(NoMove11 &&); // expected-error {{no matching function}}
   };
 }
+
+namespace PR12625 {
+  struct X; // expected-note {{forward decl}}
+  struct Y {
+    X x; // expected-error {{incomplete}}
+  } y = Y();
+}

Modified: cfe/branches/tooling/test/Driver/fast-math.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Driver/fast-math.c?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/Driver/fast-math.c (original)
+++ cfe/branches/tooling/test/Driver/fast-math.c Thu Apr 26 13:38:29 2012
@@ -19,8 +19,15 @@
 // CHECK-MATH-ERRNO: "-cc1"
 // CHECK-MATH-ERRNO: "-fmath-errno"
 //
-// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
-// RUN:     -fno-trapping-math -c %s 2>&1 \
+// RUN: %clang -### -fmath-errno -fno-math-errno -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target i686-apple-darwin -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// CHECK-NO-MATH-ERRNO: "-cc1"
+// CHECK-NO-MATH-ERRNO-NOT: "-fmath-errno"
+//
+// RUN: %clang -### -fno-math-errno -fassociative-math -freciprocal-math \
+// RUN:     -fno-signed-zeros -fno-trapping-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
 // CHECK-UNSAFE-MATH: "-cc1"
 // CHECK-UNSAFE-MATH: "-menable-unsafe-fp-math"
@@ -36,7 +43,7 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-INFS %s
 // RUN: %clang -### -ffinite-math-only -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-NANS %s
-// RUN: %clang -### -funsafe-math-optimizations -c %s 2>&1 \
+// RUN: %clang -### -funsafe-math-optimizations -fno-math-errno -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
 //
 // One umbrella flag is *really* weird and also changes the semantics of the

Modified: cfe/branches/tooling/test/Driver/linux-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Driver/linux-ld.c?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/Driver/linux-ld.c (original)
+++ cfe/branches/tooling/test/Driver/linux-ld.c Thu Apr 26 13:38:29 2012
@@ -267,6 +267,30 @@
 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../.."
 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/lib"
 // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN:     -target mips-linux-gnu \
+// RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPS %s
+// CHECK-DEBIAN-MIPS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-MIPS: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/crtbegin.o"
+// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
+// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../../mips-linux-gnu"
+// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/mips-linux-gnu"
+// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
+// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN:     -target mipsel-linux-gnu \
+// RUN:     --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-DEBIAN-MIPSEL %s
+// CHECK-DEBIAN-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/crtbegin.o"
+// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
+// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../../mipsel-linux-gnu"
+// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/mipsel-linux-gnu"
+// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
+// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib"
 //
 // Test linker invocation on Android.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \

Modified: cfe/branches/tooling/test/FixIt/fixit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/FixIt/fixit.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/FixIt/fixit.cpp (original)
+++ cfe/branches/tooling/test/FixIt/fixit.cpp Thu Apr 26 13:38:29 2012
@@ -217,3 +217,26 @@
 };
 void Foo::SetBar(Bar bar) { bar_ = bar; } // expected-error {{must use 'enum' tag to refer to type 'Bar' in this scope}}
 }
+
+namespace arrow_suggest {
+
+template <typename T>
+class wrapped_ptr {
+ public:
+  wrapped_ptr(T* ptr) : ptr_(ptr) {}
+  T* operator->() { return ptr_; }
+ private:
+  T *ptr_;
+};
+
+class Worker {
+ public:
+  void DoSomething();
+};
+
+void test() {
+  wrapped_ptr<Worker> worker(new Worker);
+  worker.DoSomething(); // expected-error {{no member named 'DoSomething' in 'arrow_suggest::wrapped_ptr<arrow_suggest::Worker>'; did you mean to use '->' instead of '.'?}}
+}
+
+} // namespace arrow_suggest

Modified: cfe/branches/tooling/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Preprocessor/init.c?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/Preprocessor/init.c (original)
+++ cfe/branches/tooling/test/Preprocessor/init.c Thu Apr 26 13:38:29 2012
@@ -1762,3 +1762,6 @@
 // NORTTI: __GXX_ABI_VERSION
 // NORTTI-NOT:#define __GXX_RTTI
 // NORTTI: __STDC__
+//
+// RUN: %clang_cc1 -triple arm-linux-androideabi -E -dM < /dev/null | FileCheck -check-prefix ANDROID %s
+// ANDROID: __ANDROID__ 1

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=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/branches/tooling/test/Preprocessor/predefined-arch-macros.c Thu Apr 26 13:38:29 2012
@@ -372,8 +372,7 @@
 // RUN: %clang -march=corei7-avx -m32 -E -dM %s -o - 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=CHECK_COREI7_AVX_M32
 // CHECK_COREI7_AVX_M32: #define __AES__ 1
-// FIXME: AVX is not yet enabled with Clang.
-// CHECK_COREI7_AVX_M32-NOT: #define __AVX__ 1
+// CHECK_COREI7_AVX_M32: #define __AVX__ 1
 // CHECK_COREI7_AVX_M32: #define __MMX__ 1
 // CHECK_COREI7_AVX_M32: #define __SSE2__ 1
 // CHECK_COREI7_AVX_M32: #define __SSE3__ 1
@@ -390,8 +389,7 @@
 // RUN: %clang -march=corei7-avx -m64 -E -dM %s -o - 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=CHECK_COREI7_AVX_M64
 // CHECK_COREI7_AVX_M64: #define __AES__ 1
-// FIXME: AVX is not yet enabled with Clang.
-// CHECK_COREI7_AVX_M64-NOT: #define __AVX__ 1
+// CHECK_COREI7_AVX_M64: #define __AVX__ 1
 // CHECK_COREI7_AVX_M64: #define __MMX__ 1
 // CHECK_COREI7_AVX_M64: #define __SSE2_MATH__ 1
 // CHECK_COREI7_AVX_M64: #define __SSE2__ 1
@@ -412,8 +410,7 @@
 // RUN: %clang -march=core-avx-i -m32 -E -dM %s -o - 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=CHECK_CORE_AVX_I_M32
 // CHECK_CORE_AVX_I_M32: #define __AES__ 1
-// FIXME: AVX is not yet enabled with Clang.
-// CHECK_CORE_AVX_I_M32-NOT: #define __AVX__ 1
+// CHECK_CORE_AVX_I_M32: #define __AVX__ 1
 // CHECK_CORE_AVX_I_M32: #define __MMX__ 1
 // CHECK_CORE_AVX_I_M32: #define __SSE2__ 1
 // CHECK_CORE_AVX_I_M32: #define __SSE3__ 1
@@ -430,8 +427,7 @@
 // RUN: %clang -march=core-avx-i -m64 -E -dM %s -o - 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=CHECK_CORE_AVX_I_M64
 // CHECK_CORE_AVX_I_M64: #define __AES__ 1
-// FIXME: AVX is not yet enabled with Clang.
-// CHECK_CORE_AVX_I_M64-NOT: #define __AVX__ 1
+// CHECK_CORE_AVX_I_M64: #define __AVX__ 1
 // CHECK_CORE_AVX_I_M64: #define __MMX__ 1
 // CHECK_CORE_AVX_I_M64: #define __SSE2_MATH__ 1
 // CHECK_CORE_AVX_I_M64: #define __SSE2__ 1

Modified: cfe/branches/tooling/test/Rewriter/rewrite-byref-in-nested-blocks.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Rewriter/rewrite-byref-in-nested-blocks.mm?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/Rewriter/rewrite-byref-in-nested-blocks.mm (original)
+++ cfe/branches/tooling/test/Rewriter/rewrite-byref-in-nested-blocks.mm Thu Apr 26 13:38:29 2012
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
 // RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
 // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
-// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
 // radar 7692350
 
 void f(void (^block)(void));

Modified: cfe/branches/tooling/test/Rewriter/rewrite-modern-block.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Rewriter/rewrite-modern-block.mm?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/Rewriter/rewrite-modern-block.mm (original)
+++ cfe/branches/tooling/test/Rewriter/rewrite-modern-block.mm Thu Apr 26 13:38:29 2012
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
-// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
 // rdar://11230308
 
 typedef struct {
@@ -20,11 +20,12 @@
 // rdar://11236342
 int foo() {
     __block int hello;
+    return hello;
 }
 
 // rdar://7547630
 // rewriting multiple __block decls on wintin same decl stmt.
-int radar7547630() {
+void radar7547630() {
   __block int BI1, BI2;
 
   __block float FLOAT1, FT2, FFFFFFFF3,
@@ -35,11 +36,13 @@
 
 // rewriting multiple __block decls on wintin same decl stmt
 // with initializers.
-void  rdar7547630(const char *keybuf, const char *valuebuf) {
+int  rdar7547630(const char *keybuf, const char *valuebuf) {
   __block int BI1 = 1, BI2 = 2;
 
   double __block BYREFVAR = 1.34, BYREFVAR_NO_INIT, BYREFVAR2 = 1.37;
 
   __block const char *keys = keybuf, *values = valuebuf, *novalues;
+
+  return BI2;
 }
 

Modified: cfe/branches/tooling/test/Rewriter/rewrite-modern-extern-c-func-decl.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Rewriter/rewrite-modern-extern-c-func-decl.mm?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/Rewriter/rewrite-modern-extern-c-func-decl.mm (original)
+++ cfe/branches/tooling/test/Rewriter/rewrite-modern-extern-c-func-decl.mm Thu Apr 26 13:38:29 2012
@@ -68,3 +68,29 @@
     });
 }
 
+// rdar://11314329
+static inline const void *auto_zone_base_pointer(void *zone, const void *ptr) { return 0; }
+
+ at interface I
+{
+   id list;
+}
+- (void) Meth;
+// radar 7589385 use before definition
+- (void) allObjects;
+ at end
+
+ at implementation I
+// radar 7589385 use before definition
+- (void) allObjects {
+    __attribute__((__blocks__(byref))) id *listp;
+
+    void (^B)(void) = ^(void) {
+      *listp++ = 0;
+    };
+
+    B();
+}
+- (void) Meth { __attribute__((__blocks__(byref))) void ** listp = (void **)list; }
+ at end
+

Modified: cfe/branches/tooling/test/Rewriter/rewrite-rewritten-initializer.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Rewriter/rewrite-rewritten-initializer.mm?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/Rewriter/rewrite-rewritten-initializer.mm (original)
+++ cfe/branches/tooling/test/Rewriter/rewrite-rewritten-initializer.mm Thu Apr 26 13:38:29 2012
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp
 // RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw-modern.cpp
+// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw-modern.cpp
 // radar 7669784
 
 typedef void * id;

Modified: cfe/branches/tooling/test/Sema/attr-visibility.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Sema/attr-visibility.c?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/Sema/attr-visibility.c (original)
+++ cfe/branches/tooling/test/Sema/attr-visibility.c Thu Apr 26 13:38:29 2012
@@ -7,3 +7,5 @@
 // rdar://problem/10753392
 void test3() __attribute__((visibility("protected"))); // expected-warning {{target does not support 'protected' visibility; using 'default'}}
 
+struct __attribute__((visibility("hidden"))) test4; // expected-note {{previous attribute is here}}
+struct __attribute__((visibility("default"))) test4; // expected-error {{visibility does not match previous declaration}}

Modified: cfe/branches/tooling/test/SemaCXX/alias-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/alias-template.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/alias-template.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/alias-template.cpp Thu Apr 26 13:38:29 2012
@@ -145,3 +145,30 @@
   template<typename T, typename U> struct S;
   template<typename T> template<typename U> using SS = S<T, U>; // expected-error {{extraneous template parameter list in alias template declaration}}
 }
+
+// PR12647
+namespace SFINAE {
+  template<bool> struct enable_if; // expected-note 2{{here}}
+  template<> struct enable_if<true> { using type = void; };
+
+  template<typename T> struct is_enum { static constexpr bool value = __is_enum(T); };
+
+  template<typename T> using EnableIf = typename enable_if<T::value>::type; // expected-error {{undefined template}}
+  template<typename T> using DisableIf = typename enable_if<!T::value>::type; // expected-error {{undefined template}}
+
+  template<typename T> EnableIf<is_enum<T>> f();
+  template<typename T> DisableIf<is_enum<T>> f();
+
+  enum E { e };
+
+  int main() {
+    f<int>();
+    f<E>();
+  }
+
+  template<typename T, typename U = EnableIf<is_enum<T>>> struct fail1 {}; // expected-note {{here}}
+  template<typename T> struct fail2 : DisableIf<is_enum<T>> {}; // expected-note {{here}}
+
+  fail1<int> f1; // expected-note {{here}}
+  fail2<E> f2; // expected-note {{here}}
+}

Modified: cfe/branches/tooling/test/SemaCXX/arrow-operator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/arrow-operator.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/arrow-operator.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/arrow-operator.cpp Thu Apr 26 13:38:29 2012
@@ -36,3 +36,31 @@
    Line_Segment(node1->Location()); // expected-error {{not a structure or union}}
 }
 }
+
+
+namespace arrow_suggest {
+
+template <typename T>
+class wrapped_ptr {
+ public:
+  wrapped_ptr(T* ptr) : ptr_(ptr) {}
+  T* operator->() { return ptr_; }
+  void Check(); // expected-note {{'Check' declared here}}
+ private:
+  T *ptr_;
+};
+
+class Worker {
+ public:
+  void DoSomething();
+  void Chuck();
+};
+
+void test() {
+  wrapped_ptr<Worker> worker(new Worker);
+  worker.DoSomething(); // expected-error {{no member named 'DoSomething' in 'arrow_suggest::wrapped_ptr<arrow_suggest::Worker>'; did you mean to use '->' instead of '.'?}}
+  worker.DoSamething(); // expected-error {{no member named 'DoSamething' in 'arrow_suggest::wrapped_ptr<arrow_suggest::Worker>'}}
+  worker.Chuck(); // expected-error {{no member named 'Chuck' in 'arrow_suggest::wrapped_ptr<arrow_suggest::Worker>'; did you mean 'Check'?}}
+}
+
+} // namespace arrow_suggest

Modified: cfe/branches/tooling/test/SemaCXX/constant-expression.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/constant-expression.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/constant-expression.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/constant-expression.cpp Thu Apr 26 13:38:29 2012
@@ -117,3 +117,10 @@
   typedef int a[(int)42.997];
   typedef int b[(int)4e10]; // expected-warning {{variable length}} expected-error {{variable length}}
 }
+
+// PR12626
+namespace test3 {
+  struct X; // expected-note {{forward declaration of 'test3::X'}}
+  struct Y { bool b; X x; }; // expected-error {{field has incomplete type 'test3::X'}}
+  int f() { return Y().b; }
+}

Modified: cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-references.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-references.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/cxx0x-initializer-references.cpp Thu Apr 26 13:38:29 2012
@@ -85,3 +85,8 @@
       f({1, 2});
   }
 }
+
+namespace PR12660 {
+  const int &i { 1 };
+  struct S { S(int); } const &s { 2 };
+}

Modified: cfe/branches/tooling/test/SemaCXX/cxx98-compat.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/cxx98-compat.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/cxx98-compat.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/cxx98-compat.cpp Thu Apr 26 13:38:29 2012
@@ -323,3 +323,21 @@
   S<const int&, k> s1; // expected-warning {{non-type template argument referring to object 'k' with internal linkage is incompatible with C++98}}
   S<void(&)(), f> s2; // expected-warning {{non-type template argument referring to function 'f' with internal linkage is incompatible with C++98}}
 }
+
+namespace ThisInExceptionSpec {
+  template<int> struct T {};
+  struct S {
+    int n;
+    void f() throw (T<sizeof(n)>); // expected-warning {{use of 'this' outside a non-static member function is incompatible with C++98}}
+    void g() throw (T<sizeof(S::n)>); // expected-warning {{use of 'this' outside a non-static member function is incompatible with C++98}}
+    void h() throw (T<sizeof(this)>); // expected-warning {{use of 'this' outside a non-static member function is incompatible with C++98}}
+  };
+}
+
+namespace NullPointerTemplateArg {
+  struct A {};
+  template<int*> struct X {};
+  template<int A::*> struct Y {};
+  X<(int*)0> x; // expected-warning {{use of null pointer as non-type template argument is incompatible with C++98}}
+  Y<(int A::*)0> y; // expected-warning {{use of null pointer as non-type template argument is incompatible with C++98}}
+}

Propchange: cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 26 13:38:29 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-155543
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,146581-155648

Modified: cfe/branches/tooling/test/SemaTemplate/dependent-names.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaTemplate/dependent-names.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaTemplate/dependent-names.cpp (original)
+++ cfe/branches/tooling/test/SemaTemplate/dependent-names.cpp Thu Apr 26 13:38:29 2012
@@ -292,3 +292,35 @@
     template void f<S>(); // expected-note {{here}}
   }
 }
+
+namespace rdar11242625 {
+
+template <typename T>
+struct Main {
+  struct default_names {
+    typedef int id;
+  };
+
+  template <typename T2 = typename default_names::id>
+  struct TS {
+    T2 q;
+  };
+};
+
+struct Sub : public Main<int> {
+  TS<> ff;
+};
+
+int arr[sizeof(Sub)];
+
+}
+
+namespace PR11421 {
+template < unsigned > struct X {
+  static const unsigned dimension = 3;
+  template<unsigned dim=dimension> 
+  struct Y: Y<dim> { }; // expected-error {{incomplete type}} expected-note {{is not complete until the closing}}
+};
+typedef X<3> X3;
+X3::Y<>::iterator it; // expected-note {{requested here}}
+}

Modified: cfe/branches/tooling/unittests/Tooling/RecursiveASTVisitorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/unittests/Tooling/RecursiveASTVisitorTest.cpp?rev=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/unittests/Tooling/RecursiveASTVisitorTest.cpp (original)
+++ cfe/branches/tooling/unittests/Tooling/RecursiveASTVisitorTest.cpp Thu Apr 26 13:38:29 2012
@@ -152,6 +152,19 @@
   }
 };
 
+class NamedDeclVisitor
+  : public ExpectedLocationVisitor<NamedDeclVisitor> {
+public:
+  bool VisitNamedDecl(NamedDecl *Decl) {
+    std::string NameWithTemplateArgs;
+    Decl->getNameForDiagnostic(NameWithTemplateArgs,
+                               Decl->getASTContext().getPrintingPolicy(),
+                               true);
+    Match(NameWithTemplateArgs, Decl->getLocation());
+    return true;
+  }
+};
+
 TEST(RecursiveASTVisitor, VisitsBaseClassDeclarations) {
   TypeLocVisitor Visitor;
   Visitor.ExpectMatch("class X", 1, 30);
@@ -251,4 +264,85 @@
 }
 */
 
+TEST(RecursiveASTVisitor, VisitsCallInPartialTemplateSpecialization) {
+  CXXMemberCallVisitor Visitor;
+  Visitor.ExpectMatch("A::x", 6, 20);
+  EXPECT_TRUE(Visitor.runOver(
+    "template <typename T1> struct X {\n"
+    "  template <typename T2, bool B> struct Y { void g(); };\n"
+    "};\n"
+    "template <typename T1> template <typename T2>\n"
+    "struct X<T1>::Y<T2, true> {\n"
+    "  void f() { T2 y; y.x(); }\n"
+    "};\n"
+    "struct A { void x(); };\n"
+    "int main() {\n"
+    "  (new X<A>::Y<A, true>())->f();\n"
+    "}\n"));
+}
+
+TEST(RecursiveASTVisitor, VisitsPartialTemplateSpecialization) {
+  // From cfe-commits/Week-of-Mon-20100830/033998.html
+  // Contrary to the approach sugggested 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.
+  NamedDeclVisitor Visitor;
+  Visitor.ExpectMatch("A<bool>", 1, 26);
+  Visitor.ExpectMatch("A<char *>", 2, 26);
+  EXPECT_TRUE(Visitor.runOver(
+    "template <class T> class A {};\n"
+    "template <class T> class A<T*> {};\n"
+    "A<bool> ab;\n"
+    "A<char*> acp;\n"));
+}
+
+TEST(RecursiveASTVisitor, VisitsUndefinedClassTemplateSpecialization) {
+  NamedDeclVisitor Visitor;
+  Visitor.ExpectMatch("A<int>", 1, 29);
+  EXPECT_TRUE(Visitor.runOver(
+    "template<typename T> struct A;\n"
+    "A<int> *p;\n"));
+}
+
+TEST(RecursiveASTVisitor, VisitsNestedUndefinedClassTemplateSpecialization) {
+  NamedDeclVisitor Visitor;
+  Visitor.ExpectMatch("A<int>::B<char>", 2, 31);
+  EXPECT_TRUE(Visitor.runOver(
+    "template<typename T> struct A {\n"
+    "  template<typename U> struct B;\n"
+    "};\n"
+    "A<int>::B<char> *p;\n"));
+}
+
+TEST(RecursiveASTVisitor, VisitsUndefinedFunctionTemplateSpecialization) {
+  NamedDeclVisitor Visitor;
+  Visitor.ExpectMatch("A<int>", 1, 26);
+  EXPECT_TRUE(Visitor.runOver(
+    "template<typename T> int A();\n"
+    "int k = A<int>();\n"));
+}
+
+TEST(RecursiveASTVisitor, VisitsNestedUndefinedFunctionTemplateSpecialization) {
+  NamedDeclVisitor Visitor;
+  Visitor.ExpectMatch("A<int>::B<char>", 2, 35);
+  EXPECT_TRUE(Visitor.runOver(
+    "template<typename T> struct A {\n"
+    "  template<typename U> static int B();\n"
+    "};\n"
+    "int k = A<int>::B<char>();\n"));
+}
+
+TEST(RecursiveASTVisitor, NoRecursionInSelfFriend) {
+  // From cfe-commits/Week-of-Mon-20100830/033977.html
+  NamedDeclVisitor Visitor;
+  Visitor.ExpectMatch("vector_iterator<int>", 2, 7);
+  EXPECT_TRUE(Visitor.runOver(
+    "template<typename Container>\n"
+    "class vector_iterator {\n"
+    "    template <typename C> friend class vector_iterator;\n"
+    "};\n"
+    "vector_iterator<int> it_int;\n"));
+}
+
 } // end namespace clang

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=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/www/analyzer/latest_checker.html.incl (original)
+++ cfe/branches/tooling/www/analyzer/latest_checker.html.incl Thu Apr 26 13:38:29 2012
@@ -1 +1 @@
-<b><a href="http://bit.ly/GUmtVB">checker-263.tar.bz2</a></b> (built March 22, 2012)
+<b><a href="http://bit.ly/JATSI8">checker-264.tar.bz2</a></b> (built April 26, 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=155650&r1=155649&r2=155650&view=diff
==============================================================================
--- cfe/branches/tooling/www/analyzer/release_notes.html (original)
+++ cfe/branches/tooling/www/analyzer/release_notes.html Thu Apr 26 13:38:29 2012
@@ -15,10 +15,18 @@
 
 <h1>Release notes for <tt>checker-XXX</tt> builds</h1>
 
+<h4 id="checker_264">checker-264</h4>
+
+<p><b>built:</b> April 26, 2012</br>
+  <b>download:</b> <a href="http://bit.ly/JATSI8">checker-264.tar.bz2</a></p>
+  <p><b>highlights:</b></p>
+
+<p>This release contains misc. bug fixes and performance enhancements over checker-263, including
+  a reduction of some kinds of false positives related to the malloc() checker.</p>
+
 <h4 id="checker_263">checker-263</h4>
 
 <p><b>built:</b> March 22, 2012</br>
-   <b>download:</b> <a href="http://bit.ly/GUmtVB">checker-263.tar.bz2</a></p>
 <p><b>highlights:</b></p>
 
 <ul>
@@ -28,7 +36,6 @@
 <h4 id="checker_262">checker-262</h4>
 
 <p><b>built: </b>March 15, 2012</br>
-   <b>download:</b> <a href="http://bit.ly/xETQF0">checker-262.tar.bz2</a></p>
 <p><b>highlights:</b></p>
 
 <ul>
@@ -42,7 +49,6 @@
 <h4 id="checker_261">checker-261</h4>
 
 <p><b>built: </b>February 22, 2012<br>
-<b>download:</b> <a href="http://bit.ly/yN1Awv">checker-261.tar.bz2</a></p>
 <p><b>highlights:</b></p>
 
 <ul>
@@ -58,7 +64,6 @@
 <h4 id="checker_260">checker-260</h4>
 
 <p><b>built: </b>January 25, 2012<br>
-<b>download:</b> <a href="http://bit.ly/wpAqVP">checker-260.tar.bz2</a></p>
 <p><b>highlights:</b></p>
 
 <p>This is essentially the same as checker-259, but enables the following <i>experimental</i> checkers (please provide feedback):</p>
@@ -74,7 +79,6 @@
 <h4 id="checker_259">checker-259</h4>
 
 <p><b>built: </b>January 25, 2012<br>
-<b>download:</b> <a href="http://bit.ly/zOWf1P">checker-259.tar.bz2</a></p>
 <p><b>highlights:</b></p>
 
 <ul>





More information about the llvm-branch-commits mailing list