[llvm-branch-commits] [cfe-branch] r157321 - in /cfe/branches/tooling: ./ include/clang/AST/ include/clang/Basic/ include/clang/Driver/ include/clang/Frontend/ include/clang/Parse/ include/clang/Rewrite/ include/clang/Sema/ lib/ARCMigrate/ lib/AST/ lib/CodeGen/ lib/Driver/ lib/Edit/ lib/Frontend/ lib/Parse/ lib/Rewrite/ lib/Sema/ lib/StaticAnalyzer/Core/ test/ARCMT/ test/Analysis/ test/CodeGen/ test/CodeGenCXX/ test/FixIt/ test/Index/ test/Parser/ test/SemaCXX/ test/SemaObjC/ test/SemaTemplate/ unittests/ unittests/Tooling/ u...

Manuel Klimek klimek at google.com
Wed May 23 06:10:29 PDT 2012


Author: klimek
Date: Wed May 23 08:10:29 2012
New Revision: 157321

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


Added:
    cfe/branches/tooling/test/Analysis/PR12905.c
      - copied unchanged from r157315, cfe/trunk/test/Analysis/PR12905.c
    cfe/branches/tooling/test/CodeGenCXX/debug-info-enum-class.cpp
      - copied unchanged from r157315, cfe/trunk/test/CodeGenCXX/debug-info-enum-class.cpp
    cfe/branches/tooling/test/CodeGenCXX/debug-info-flex-member.cpp
      - copied unchanged from r157315, cfe/trunk/test/CodeGenCXX/debug-info-flex-member.cpp
    cfe/branches/tooling/test/FixIt/fixit-objc-message-comma-separator.m
      - copied unchanged from r157315, cfe/trunk/test/FixIt/fixit-objc-message-comma-separator.m
    cfe/branches/tooling/test/Index/index-kernel-invocation.cpp
      - copied unchanged from r157315, cfe/trunk/test/Index/index-kernel-invocation.cpp
    cfe/branches/tooling/unittests/Tooling/RewriterTest.cpp
      - copied unchanged from r157315, cfe/trunk/unittests/Tooling/RewriterTest.cpp
    cfe/branches/tooling/unittests/Tooling/RewriterTestContext.h
      - copied unchanged from r157315, cfe/trunk/unittests/Tooling/RewriterTestContext.h
    cfe/branches/tooling/utils/analyzer/reducer.pl
      - copied unchanged from r157315, cfe/trunk/utils/analyzer/reducer.pl
Modified:
    cfe/branches/tooling/   (props changed)
    cfe/branches/tooling/include/clang/AST/DeclCXX.h
    cfe/branches/tooling/include/clang/Basic/Attr.td
    cfe/branches/tooling/include/clang/Basic/DiagnosticParseKinds.td
    cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/branches/tooling/include/clang/Basic/LangOptions.def
    cfe/branches/tooling/include/clang/Basic/TokenKinds.def
    cfe/branches/tooling/include/clang/Driver/Driver.h
    cfe/branches/tooling/include/clang/Frontend/CodeGenOptions.h
    cfe/branches/tooling/include/clang/Parse/Parser.h
    cfe/branches/tooling/include/clang/Rewrite/Rewriter.h
    cfe/branches/tooling/include/clang/Sema/CodeCompleteConsumer.h
    cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
    cfe/branches/tooling/lib/AST/Decl.cpp
    cfe/branches/tooling/lib/AST/ExprConstant.cpp
    cfe/branches/tooling/lib/CodeGen/BackendUtil.cpp
    cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp
    cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp
    cfe/branches/tooling/lib/CodeGen/CGExpr.cpp
    cfe/branches/tooling/lib/CodeGen/CodeGenFunction.cpp
    cfe/branches/tooling/lib/Driver/Driver.cpp
    cfe/branches/tooling/lib/Driver/ToolChains.cpp
    cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp
    cfe/branches/tooling/lib/Frontend/ASTUnit.cpp
    cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp
    cfe/branches/tooling/lib/Frontend/CreateInvocationFromCommandLine.cpp
    cfe/branches/tooling/lib/Parse/ParseDecl.cpp
    cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp
    cfe/branches/tooling/lib/Parse/ParseObjc.cpp
    cfe/branches/tooling/lib/Rewrite/Rewriter.cpp
    cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp
    cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp
    cfe/branches/tooling/lib/Sema/SemaTemplateInstantiateDecl.cpp
    cfe/branches/tooling/lib/Sema/SemaType.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineC.cpp
    cfe/branches/tooling/lib/StaticAnalyzer/Core/ObjCMessage.cpp
    cfe/branches/tooling/test/ARCMT/checking.m
    cfe/branches/tooling/test/ARCMT/objcmt-subscripting-literals.m
    cfe/branches/tooling/test/ARCMT/objcmt-subscripting-literals.m.result
    cfe/branches/tooling/test/Analysis/cxx11-crashes.cpp
    cfe/branches/tooling/test/Analysis/nullptr.cpp
    cfe/branches/tooling/test/CodeGen/bounds-checking.c
    cfe/branches/tooling/test/CodeGen/object-size.c
    cfe/branches/tooling/test/CodeGenCXX/visibility.cpp
    cfe/branches/tooling/test/Parser/MicrosoftExtensions.c
    cfe/branches/tooling/test/Parser/MicrosoftExtensions.cpp
    cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp   (props changed)
    cfe/branches/tooling/test/SemaObjC/iboutlet.m
    cfe/branches/tooling/test/SemaTemplate/instantiate-expr-1.cpp
    cfe/branches/tooling/unittests/CMakeLists.txt
    cfe/branches/tooling/unittests/Tooling/Makefile
    cfe/branches/tooling/www/cxx_status.html

Propchange: cfe/branches/tooling/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 23 08:10:29 2012
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:146581-157176
+/cfe/trunk:146581-157315
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/tooling/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/DeclCXX.h?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/DeclCXX.h (original)
+++ cfe/branches/tooling/include/clang/AST/DeclCXX.h Wed May 23 08:10:29 2012
@@ -1610,8 +1610,8 @@
     return cast<CXXMethodDecl>(FunctionDecl::getCanonicalDecl());
   }
 
-  /// isUserProvided - True if it is either an implicit constructor or
-  /// if it was defaulted or deleted on first declaration.
+  /// isUserProvided - True if this method is user-declared and was not
+  /// deleted or defaulted on its first declaration.
   bool isUserProvided() const {
     return !(isDeleted() || getCanonicalDecl()->isDefaulted());
   }

Modified: cfe/branches/tooling/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/Attr.td?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/Attr.td (original)
+++ cfe/branches/tooling/include/clang/Basic/Attr.td Wed May 23 08:10:29 2012
@@ -308,14 +308,6 @@
   let Args = [IntArgument<"Priority">];
 }
 
-def DLLExport : InheritableAttr {
-  let Spellings = ["dllexport"];
-}
-
-def DLLImport : InheritableAttr {
-  let Spellings = ["dllimport"];
-}
-
 def ExtVectorType : Attr {
   let Spellings = ["ext_vector_type"];
   let Args = [ExprArgument<"NumElements">];
@@ -336,10 +328,6 @@
   let SemaHandler = 0;
 }
 
-def MsStruct : InheritableAttr {
-  let Spellings = ["__ms_struct__"];
-}
-
 def Format : InheritableAttr {
   let Spellings = ["format"];
   let Args = [StringArgument<"Type">, IntArgument<"FormatIdx">,
@@ -816,3 +804,41 @@
   let LateParsed = 1;
   let TemplateDependent = 1;
 }
+
+// Microsoft-related attributes
+
+def MsStruct : InheritableAttr {
+  let Spellings = ["__ms_struct__"];
+}
+
+def DLLExport : InheritableAttr {
+  let Spellings = ["dllexport"];
+}
+
+def DLLImport : InheritableAttr {
+  let Spellings = ["dllimport"];
+}
+
+def Win64 : InheritableAttr {
+  let Spellings = ["__w64"];
+}
+
+def Ptr32 : InheritableAttr {
+  let Spellings = ["__ptr32"];
+}
+
+def Ptr64 : InheritableAttr {
+  let Spellings = ["__ptr64"];
+}
+
+def SingleInheritance : InheritableAttr {
+  let Spellings = ["__single_inheritance"];
+}
+
+def MultipleInheritance : InheritableAttr {
+  let Spellings = ["__multiple_inheritance"];
+}
+
+def VirtualInheritance : InheritableAttr {
+  let Spellings = ["__virtual_inheritance"];
+}
\ No newline at end of file

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=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticParseKinds.td Wed May 23 08:10:29 2012
@@ -378,6 +378,8 @@
 def warn_semicolon_before_method_body : Warning<
   "semicolon before method body is ignored">,
   InGroup<DiagGroup<"semicolon-before-method-body">>, DefaultIgnore;
+def note_extra_comma_message_arg : Note<
+  "comma separating objective-c messaging arguments">;
 
 def err_expected_field_designator : Error<
   "expected a field designator, such as '.field = 4'">;

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=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td Wed May 23 08:10:29 2012
@@ -1630,7 +1630,8 @@
   "variables and functions|functions and methods|parameters|"
   "functions, methods and blocks|functions, methods, and parameters|"
   "classes|variables|methods|variables, functions and labels|"
-  "fields and global variables|structs}1">;
+  "fields and global variables|structs|"
+  "variables, functions and tag types}1">;
 def err_attribute_wrong_decl_type : Error<
   "%0 attribute only applies to %select{functions|unions|"
   "variables and functions|functions and methods|parameters|"

Modified: cfe/branches/tooling/include/clang/Basic/LangOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/LangOptions.def?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/LangOptions.def (original)
+++ cfe/branches/tooling/include/clang/Basic/LangOptions.def Wed May 23 08:10:29 2012
@@ -157,7 +157,6 @@
                "maximum constexpr call depth")
 BENIGN_LANGOPT(NumLargeByValueCopy, 32, 0, 
         "if non-zero, warn about parameter or return Warn if parameter/return value is larger in bytes than this setting. 0 is no check.")
-BENIGN_LANGOPT(BoundsChecking , 8, 0, "if non-zero, add run-time bounds checking code")
 VALUE_LANGOPT(MSCVersion, 32, 0, 
               "version of Microsoft Visual C/C++")
 

Modified: cfe/branches/tooling/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/TokenKinds.def?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/TokenKinds.def (original)
+++ cfe/branches/tooling/include/clang/Basic/TokenKinds.def Wed May 23 08:10:29 2012
@@ -496,6 +496,9 @@
 KEYWORD(__int64                       , KEYMS)
 KEYWORD(__if_exists                   , KEYMS)
 KEYWORD(__if_not_exists               , KEYMS)
+KEYWORD(__single_inheritance          , KEYMS)
+KEYWORD(__multiple_inheritance        , KEYMS)
+KEYWORD(__virtual_inheritance         , KEYMS)
 ALIAS("__int8"           , char       , KEYMS)
 ALIAS("__int16"          , short      , KEYMS)
 ALIAS("__int32"          , int        , KEYMS)

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=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Driver/Driver.h (original)
+++ cfe/branches/tooling/include/clang/Driver/Driver.h Wed May 23 08:10:29 2012
@@ -156,6 +156,9 @@
   /// used where an integrated CPP would).
   unsigned CCCUseClangCPP : 1;
 
+  /// \brief Force use of clang frontend.
+  unsigned ForcedClangUse : 1;
+
 public:
   /// Use lazy precompiled headers for PCH support.
   unsigned CCCUsePCH : 1;
@@ -229,6 +232,9 @@
     InstalledDir = Value;
   }
 
+  bool shouldForceClangUse() const { return ForcedClangUse; }
+  void setForcedClangUse(bool V = true) { ForcedClangUse = V; }
+
   /// @}
   /// @name Primary Functionality
   /// @{

Modified: cfe/branches/tooling/include/clang/Frontend/CodeGenOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/CodeGenOptions.h?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/CodeGenOptions.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/CodeGenOptions.h Wed May 23 08:10:29 2012
@@ -172,6 +172,9 @@
   /// or 0 if unspecified.
   unsigned NumRegisterParameters;
 
+  /// The run-time penalty for bounds checking, or 0 to disable.
+  unsigned char BoundsChecking;
+
 public:
   CodeGenOptions() {
     AsmVerbose = 0;
@@ -224,6 +227,7 @@
     VerifyModule = 1;
     StackRealignment = 0;
     StackAlignment = 0;
+    BoundsChecking = 0;
 
     DebugInfo = NoDebugInfo;
     Inlining = NoInlining;

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=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Parse/Parser.h (original)
+++ cfe/branches/tooling/include/clang/Parse/Parser.h Wed May 23 08:10:29 2012
@@ -1859,6 +1859,7 @@
                                 SourceLocation *endLoc = 0);
   void ParseMicrosoftDeclSpec(ParsedAttributes &attrs);
   void ParseMicrosoftTypeAttributes(ParsedAttributes &attrs);
+  void ParseMicrosoftInheritanceClassAttributes(ParsedAttributes &attrs);
   void ParseBorlandTypeAttributes(ParsedAttributes &attrs);
   void ParseOpenCLAttributes(ParsedAttributes &attrs);
   void ParseOpenCLQualifiers(DeclSpec &DS);

Modified: cfe/branches/tooling/include/clang/Rewrite/Rewriter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Rewrite/Rewriter.h?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Rewrite/Rewriter.h (original)
+++ cfe/branches/tooling/include/clang/Rewrite/Rewriter.h Wed May 23 08:10:29 2012
@@ -279,6 +279,13 @@
   buffer_iterator buffer_begin() { return RewriteBuffers.begin(); }
   buffer_iterator buffer_end() { return RewriteBuffers.end(); }
 
+  /// SaveFiles - Save all changed files to disk.
+  ///
+  /// Returns whether not all changes were saved successfully.
+  /// Outputs diagnostics via the source manager's diagnostic engine
+  /// in case of an error.
+  bool overwriteChangedFiles();
+
 private:
   unsigned getLocationOffsetAndFileID(SourceLocation Loc, FileID &FID) const;
 };

Modified: cfe/branches/tooling/include/clang/Sema/CodeCompleteConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Sema/CodeCompleteConsumer.h?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/CodeCompleteConsumer.h (original)
+++ cfe/branches/tooling/include/clang/Sema/CodeCompleteConsumer.h Wed May 23 08:10:29 2012
@@ -669,13 +669,13 @@
   unsigned StartParameter;
 
   /// \brief The kind of result stored here.
-  ResultKind Kind : 3;
+  ResultKind Kind;
 
   /// \brief The cursor kind that describes this result.
-  CXCursorKind CursorKind : 16;
+  CXCursorKind CursorKind;
 
   /// \brief The availability of this result.
-  CXAvailabilityKind Availability : 8;
+  CXAvailabilityKind Availability;
 
   /// \brief Whether this result is hidden by another name.
   bool Hidden : 1;

Modified: cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp Wed May 23 08:10:29 2012
@@ -63,6 +63,17 @@
         break;
       return true;
     case OMF_autorelease:
+      if (isRemovable(E)) {
+        // An unused autorelease is badness. If we remove it the receiver
+        // will likely die immediately while previously it was kept alive
+        // by the autorelease pool. This is bad practice in general, leave it
+        // and emit an error to force the user to restructure his code.
+        Pass.TA.reportError("it is not safe to remove an unused 'autorelease' "
+            "message; its receiver may be destroyed immediately",
+            E->getLocStart(), E->getSourceRange());
+        return true;
+      }
+      // Pass through.
     case OMF_retain:
     case OMF_release:
       if (E->getReceiverKind() == ObjCMessageExpr::Instance)

Modified: cfe/branches/tooling/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/Decl.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/Decl.cpp (original)
+++ cfe/branches/tooling/lib/AST/Decl.cpp Wed May 23 08:10:29 2012
@@ -158,12 +158,13 @@
   return getLVForTemplateArgumentList(TArgs.data(), TArgs.size(), OnlyTemplate);
 }
 
-static bool shouldConsiderTemplateLV(const FunctionDecl *fn) {
-  return !fn->hasAttr<VisibilityAttr>();
+static bool shouldConsiderTemplateLV(const FunctionDecl *fn,
+                               const FunctionTemplateSpecializationInfo *spec) {
+  return !fn->hasAttr<VisibilityAttr>() || spec->isExplicitSpecialization();
 }
 
 static bool shouldConsiderTemplateLV(const ClassTemplateSpecializationDecl *d) {
-  return !d->hasAttr<VisibilityAttr>();
+  return !d->hasAttr<VisibilityAttr>() || d->isExplicitSpecialization();
 }
 
 static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
@@ -374,7 +375,7 @@
     // this is an explicit specialization with a visibility attribute.
     if (FunctionTemplateSpecializationInfo *specInfo
                                = Function->getTemplateSpecializationInfo()) {
-      if (shouldConsiderTemplateLV(Function)) {
+      if (shouldConsiderTemplateLV(Function, specInfo)) {
         LV.merge(getLVForDecl(specInfo->getTemplate(),
                               true));
         const TemplateArgumentList &templateArgs = *specInfo->TemplateArguments;
@@ -525,7 +526,7 @@
     // the template parameters and arguments.
     if (FunctionTemplateSpecializationInfo *spec
            = MD->getTemplateSpecializationInfo()) {
-      if (shouldConsiderTemplateLV(MD)) {
+      if (shouldConsiderTemplateLV(MD, spec)) {
         LV.mergeWithMin(getLVForTemplateArgumentList(*spec->TemplateArguments,
                                                      OnlyTemplate));
         if (!OnlyTemplate)

Modified: cfe/branches/tooling/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ExprConstant.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ExprConstant.cpp (original)
+++ cfe/branches/tooling/lib/AST/ExprConstant.cpp Wed May 23 08:10:29 2012
@@ -4319,10 +4319,16 @@
 }
 
 bool IntExprEvaluator::TryEvaluateBuiltinObjectSize(const CallExpr *E) {
-  // TODO: Perhaps we should let LLVM lower this?
   LValue Base;
-  if (!EvaluatePointer(E->getArg(0), Base, Info))
-    return false;
+
+  {
+    // The operand of __builtin_object_size is never evaluated for side-effects.
+    // If there are any, but we can determine the pointed-to object anyway, then
+    // ignore the side-effects.
+    SpeculativeEvaluationRAII SpeculativeEval(Info);
+    if (!EvaluatePointer(E->getArg(0), Base, Info))
+      return false;
+  }
 
   // If we can prove the base is null, lower to zero now.
   if (!Base.getLValueBase()) return Success(0, E);
@@ -4355,13 +4361,16 @@
       return true;
 
     // If evaluating the argument has side-effects we can't determine
-    // the size of the object and lower it to unknown now.
+    // the size of the object and lower it to unknown now. CodeGen relies on
+    // us to handle all cases where the expression has side-effects.
     if (E->getArg(0)->HasSideEffects(Info.Ctx)) {
       if (E->getArg(1)->EvaluateKnownConstInt(Info.Ctx).getZExtValue() <= 1)
         return Success(-1ULL, E);
       return Success(0, E);
     }
 
+    // Expression had no side effects, but we couldn't statically determine the
+    // size of the referenced object.
     return Error(E);
   }
 

Modified: cfe/branches/tooling/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/BackendUtil.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/BackendUtil.cpp Wed May 23 08:10:29 2012
@@ -121,6 +121,12 @@
     PM.add(createObjCARCOptPass());
 }
 
+static unsigned BoundsChecking;
+static void addBoundsCheckingPass(const PassManagerBuilder &Builder,
+                                    PassManagerBase &PM) {
+  PM.add(createBoundsCheckingPass(BoundsChecking));
+}
+
 static void addAddressSanitizerPass(const PassManagerBuilder &Builder,
                                     PassManagerBase &PM) {
   PM.add(createAddressSanitizerPass());
@@ -160,6 +166,14 @@
                            addObjCARCOptPass);
   }
 
+  if (CodeGenOpts.BoundsChecking > 0) {
+    BoundsChecking = CodeGenOpts.BoundsChecking;
+    PMBuilder.addExtension(PassManagerBuilder::EP_ScalarOptimizerLate,
+                           addBoundsCheckingPass);
+    PMBuilder.addExtension(PassManagerBuilder::EP_EnabledOnOptLevel0,
+                           addBoundsCheckingPass);
+  }
+
   if (LangOpts.AddressSanitizer) {
     PMBuilder.addExtension(PassManagerBuilder::EP_ScalarOptimizerLate,
                            addAddressSanitizerPass);

Modified: cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGBuiltin.cpp Wed May 23 08:10:29 2012
@@ -335,6 +335,10 @@
     return RValue::get(Builder.CreateCall(F, ArgValue));
   }
   case Builtin::BI__builtin_object_size: {
+    // We rely on constant folding to deal with expressions with side effects.
+    assert(!E->getArg(0)->HasSideEffects(getContext()) &&
+           "should have been constant folded");
+
     // We pass this builtin onto the optimizer so that it can
     // figure out the object size in more complex cases.
     llvm::Type *ResType = ConvertType(E->getType());
@@ -346,12 +350,9 @@
     assert(CI);
     uint64_t val = CI->getZExtValue();
     CI = ConstantInt::get(Builder.getInt1Ty(), (val & 0x2) >> 1);    
-    Value *Runtime = Builder.getInt32(0);  // FIXME: use BoundsChecking here?
     
     Value *F = CGM.getIntrinsic(Intrinsic::objectsize, ResType);
-    return RValue::get(Builder.CreateCall3(F,
-                                           EmitScalarExpr(E->getArg(0)),
-                                           CI, Runtime));
+    return RValue::get(Builder.CreateCall2(F, EmitScalarExpr(E->getArg(0)),CI));
   }
   case Builtin::BI__builtin_prefetch: {
     Value *Locality, *RW, *Address = EmitScalarExpr(E->getArg(0));

Modified: cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp Wed May 23 08:10:29 2012
@@ -1479,25 +1479,21 @@
   // obvious/recursive way?
   SmallVector<llvm::Value *, 8> Subscripts;
   QualType EltTy(Ty, 0);
-  if (Ty->isIncompleteArrayType())
+  while ((Ty = dyn_cast<ArrayType>(EltTy))) {
+    int64_t UpperBound = 0;
+    int64_t LowerBound = 0;
+    if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(Ty)) {
+      if (CAT->getSize().getZExtValue())
+        UpperBound = CAT->getSize().getZExtValue() - 1;
+    } else
+      // This is an unbounded array. Use Low = 1, Hi = 0 to express such 
+      // arrays.
+      LowerBound = 1;
+    
+    // FIXME: Verify this is right for VLAs.
+    Subscripts.push_back(DBuilder.getOrCreateSubrange(LowerBound,
+                                                      UpperBound));
     EltTy = Ty->getElementType();
-  else {
-    while ((Ty = dyn_cast<ArrayType>(EltTy))) {
-      int64_t UpperBound = 0;
-      int64_t LowerBound = 0;
-      if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(Ty)) {
-        if (CAT->getSize().getZExtValue())
-          UpperBound = CAT->getSize().getZExtValue() - 1;
-      } else
-        // This is an unbounded array. Use Low = 1, Hi = 0 to express such 
-        // arrays.
-        LowerBound = 1;
-
-      // FIXME: Verify this is right for VLAs.
-      Subscripts.push_back(DBuilder.getOrCreateSubrange(LowerBound,
-                                                        UpperBound));
-      EltTy = Ty->getElementType();
-    }
   }
 
   llvm::DIArray SubscriptArray = DBuilder.getOrCreateArray(Subscripts);
@@ -1590,9 +1586,12 @@
   }
   llvm::DIDescriptor EnumContext = 
     getContextDescriptor(cast<Decl>(ED->getDeclContext()));
+  llvm::DIType ClassTy = ED->isScopedUsingClassTag() ?
+    getOrCreateType(ED->getIntegerType(), DefUnit) : llvm::DIType();
   llvm::DIType DbgTy = 
     DBuilder.createEnumerationType(EnumContext, ED->getName(), DefUnit, Line,
-                                   Size, Align, EltArray);
+                                   Size, Align, EltArray,
+                                   ClassTy);
   return DbgTy;
 }
 

Modified: cfe/branches/tooling/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGExpr.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGExpr.cpp Wed May 23 08:10:29 2012
@@ -517,7 +517,7 @@
 }
 
 void CodeGenFunction::EmitCheck(llvm::Value *Address, unsigned Size) {
-  if (BoundsChecking <= 0)
+  if (!CatchUndefined)
     return;
 
   // This needs to be to the standard address space.
@@ -526,8 +526,7 @@
   llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::objectsize, IntPtrTy);
 
   llvm::Value *Min = Builder.getFalse();
-  llvm::Value *Runtime = Builder.getInt32(BoundsChecking);
-  llvm::Value *C = Builder.CreateCall3(F, Address, Min, Runtime);
+  llvm::Value *C = Builder.CreateCall2(F, Address, Min);
   llvm::BasicBlock *Cont = createBasicBlock();
   Builder.CreateCondBr(Builder.CreateICmpUGE(C,
                                         llvm::ConstantInt::get(IntPtrTy, Size)),

Modified: cfe/branches/tooling/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CodeGenFunction.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CodeGenFunction.cpp Wed May 23 08:10:29 2012
@@ -41,7 +41,6 @@
     CXXVTTValue(0), OutermostConditional(0), TerminateLandingPad(0),
     TerminateHandler(0), TrapBB(0) {
 
-  BoundsChecking = getContext().getLangOpts().BoundsChecking;
   CatchUndefined = getContext().getLangOpts().CatchUndefined;
   CGM.getCXXABI().getMangleContext().startNewFunction();
 }

Modified: cfe/branches/tooling/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/Driver.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/Driver.cpp (original)
+++ cfe/branches/tooling/lib/Driver/Driver.cpp Wed May 23 08:10:29 2012
@@ -59,7 +59,7 @@
     CCPrintOptions(false), CCPrintHeaders(false), CCLogDiagnostics(false),
     CCGenDiagnostics(false), CCCGenericGCCName(""), CheckInputsExist(true),
     CCCUseClang(true), CCCUseClangCXX(true), CCCUseClangCPP(true),
-    CCCUsePCH(true), SuppressMissingInputWarning(false) {
+    ForcedClangUse(false), CCCUsePCH(true), SuppressMissingInputWarning(false) {
   if (IsProduction) {
     // In a "production" build, only use clang on architectures we expect to
     // work.

Modified: cfe/branches/tooling/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/ToolChains.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/ToolChains.cpp (original)
+++ cfe/branches/tooling/lib/Driver/ToolChains.cpp Wed May 23 08:10:29 2012
@@ -199,21 +199,25 @@
 
 Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA,
                          const ActionList &Inputs) const {
-  Action::ActionClass Key;
+  Action::ActionClass Key = JA.getKind();
+  bool useClang = false;
 
   if (getDriver().ShouldUseClangCompiler(C, JA, getTriple())) {
+    useClang = true;
     // Fallback to llvm-gcc for i386 kext compiles, we don't support that ABI.
-    if (Inputs.size() == 1 &&
+    if (!getDriver().shouldForceClangUse() &&
+        Inputs.size() == 1 &&
         types::isCXX(Inputs[0]->getType()) &&
         getTriple().isOSDarwin() &&
         getTriple().getArch() == llvm::Triple::x86 &&
         (C.getArgs().getLastArg(options::OPT_fapple_kext) ||
          C.getArgs().getLastArg(options::OPT_mkernel)))
-      Key = JA.getKind();
-    else
-      Key = Action::AnalyzeJobClass;
-  } else
-    Key = JA.getKind();
+      useClang = false;
+  }
+
+  // FIXME: This seems like a hacky way to choose clang frontend.
+  if (useClang)
+    Key = Action::AnalyzeJobClass;
 
   bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as,
                                              options::OPT_no_integrated_as,

Modified: cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp (original)
+++ cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp Wed May 23 08:10:29 2012
@@ -624,6 +624,7 @@
       isa<ObjCPropertyRefExpr>(Expr) ||
       isa<ObjCProtocolExpr>(Expr) ||
       isa<MemberExpr>(Expr) ||
+      isa<ObjCIvarRefExpr>(Expr) ||
       isa<ParenExpr>(FullExpr) ||
       isa<ParenListExpr>(Expr) ||
       isa<SizeOfPackExpr>(Expr))
@@ -650,6 +651,7 @@
       isa<ObjCPropertyRefExpr>(Expr) ||
       isa<ObjCProtocolExpr>(Expr) ||
       isa<MemberExpr>(Expr) ||
+      isa<ObjCIvarRefExpr>(Expr) ||
       isa<ParenExpr>(FullExpr) ||
       isa<ParenListExpr>(Expr) ||
       isa<SizeOfPackExpr>(Expr) ||

Modified: cfe/branches/tooling/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/ASTUnit.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/ASTUnit.cpp Wed May 23 08:10:29 2012
@@ -17,12 +17,6 @@
 #include "clang/AST/DeclVisitor.h"
 #include "clang/AST/TypeOrdering.h"
 #include "clang/AST/StmtVisitor.h"
-#include "clang/Driver/Compilation.h"
-#include "clang/Driver/Driver.h"
-#include "clang/Driver/Job.h"
-#include "clang/Driver/ArgList.h"
-#include "clang/Driver/Options.h"
-#include "clang/Driver/Tool.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Frontend/FrontendDiagnostic.h"

Modified: cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/CompilerInvocation.cpp Wed May 23 08:10:29 2012
@@ -283,6 +283,8 @@
     Res.push_back("-fobjc-dispatch-method=non-legacy");
     break;
   }
+  if (Opts.BoundsChecking > 0)
+    Res.push_back("-fbounds-checking=" + llvm::utostr(Opts.BoundsChecking));
   if (Opts.NumRegisterParameters)
     Res.push_back("-mregparm", llvm::utostr(Opts.NumRegisterParameters));
   if (Opts.NoGlobalMerge)
@@ -675,8 +677,6 @@
     Res.push_back("-fno-operator-names");
   if (Opts.PascalStrings)
     Res.push_back("-fpascal-strings");
-  if (Opts.BoundsChecking > 0)
-    Res.push_back("-fbounds-checking=" + llvm::utostr(Opts.BoundsChecking));
   if (Opts.CatchUndefined)
     Res.push_back("-fcatch-undefined-behavior");
   if (Opts.AddressSanitizer)
@@ -1217,6 +1217,8 @@
   Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
   Opts.RelocationModel = Args.getLastArgValue(OPT_mrelocation_model, "pic");
   Opts.TrapFuncName = Args.getLastArgValue(OPT_ftrap_function_EQ);
+  Opts.BoundsChecking = Args.getLastArgIntValue(OPT_fbounds_checking_EQ, 0,
+                                                Diags);
 
   Opts.FunctionSections = Args.hasArg(OPT_ffunction_sections);
   Opts.DataSections = Args.hasArg(OPT_fdata_sections);
@@ -1955,11 +1957,7 @@
     Opts.ObjCNonFragileABI2 = true;
   Opts.ObjCDefaultSynthProperties =
     Args.hasArg(OPT_fobjc_default_synthesize_properties);
-  Opts.BoundsChecking = 0;
-  if ((Opts.CatchUndefined = Args.hasArg(OPT_fcatch_undefined_behavior)))
-    Opts.BoundsChecking = 5;
-  Opts.BoundsChecking = Args.getLastArgIntValue(OPT_fbounds_checking_EQ,
-                                                Opts.BoundsChecking, Diags);
+  Opts.CatchUndefined = Args.hasArg(OPT_fcatch_undefined_behavior);
   Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
   Opts.PackStruct = Args.getLastArgIntValue(OPT_fpack_struct_EQ, 0, Diags);
   Opts.PICLevel = Args.getLastArgIntValue(OPT_pic_level, 0, Diags);

Modified: cfe/branches/tooling/lib/Frontend/CreateInvocationFromCommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/CreateInvocationFromCommandLine.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/CreateInvocationFromCommandLine.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/CreateInvocationFromCommandLine.cpp Wed May 23 08:10:29 2012
@@ -43,13 +43,17 @@
   Args.push_back("<clang>"); // FIXME: Remove dummy argument.
   Args.insert(Args.end(), ArgList.begin(), ArgList.end());
 
-  // FIXME: Find a cleaner way to force the driver into restricted modes. We
-  // also want to force it to use clang.
+  // FIXME: Find a cleaner way to force the driver into restricted modes.
   Args.push_back("-fsyntax-only");
 
   // FIXME: We shouldn't have to pass in the path info.
   driver::Driver TheDriver("clang", llvm::sys::getDefaultTargetTriple(),
                            "a.out", false, *Diags);
+  // Force driver to use clang.
+  // FIXME: This seems like a hack. Maybe the "Clang" tool subclass should be
+  // available for using it to get the arguments, thus avoiding the overkill
+  // of using the driver.
+  TheDriver.setForcedClangUse();
 
   // Don't check that inputs exist, they may have been remapped.
   TheDriver.setCheckInputsExist(false);

Modified: cfe/branches/tooling/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseDecl.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseDecl.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseDecl.cpp Wed May 23 08:10:29 2012
@@ -343,10 +343,6 @@
          Tok.is(tok::kw___unaligned)) {
     IdentifierInfo *AttrName = Tok.getIdentifierInfo();
     SourceLocation AttrNameLoc = ConsumeToken();
-    if (Tok.is(tok::kw___ptr64) || Tok.is(tok::kw___w64) ||
-        Tok.is(tok::kw___ptr32))
-      // FIXME: Support these properly!
-      continue;
     attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
                  SourceLocation(), 0, 0, true);
   }

Modified: cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseDeclCXX.cpp Wed May 23 08:10:29 2012
@@ -900,6 +900,17 @@
   return Actions.ActOnTypeName(getCurScope(), DeclaratorInfo);
 }
 
+void Parser::ParseMicrosoftInheritanceClassAttributes(ParsedAttributes &attrs) {
+  while (Tok.is(tok::kw___single_inheritance) ||
+         Tok.is(tok::kw___multiple_inheritance) ||
+         Tok.is(tok::kw___virtual_inheritance)) {
+    IdentifierInfo *AttrName = Tok.getIdentifierInfo();
+    SourceLocation AttrNameLoc = ConsumeToken();
+    attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
+                 SourceLocation(), 0, 0, false);
+  }
+}
+
 /// ParseClassSpecifier - Parse a C++ class-specifier [C++ class] or
 /// elaborated-type-specifier [C++ dcl.type.elab]; we can't tell which
 /// until we reach the start of a definition or see a token that
@@ -985,6 +996,12 @@
   while (Tok.is(tok::kw___declspec))
     ParseMicrosoftDeclSpec(attrs);
 
+  // Parse inheritance specifiers.
+  if (Tok.is(tok::kw___single_inheritance) ||
+      Tok.is(tok::kw___multiple_inheritance) ||
+      Tok.is(tok::kw___virtual_inheritance))
+      ParseMicrosoftInheritanceClassAttributes(attrs);
+
   // If C++0x attributes exist here, parse them.
   // FIXME: Are we consistent with the ordering of parsing of different
   // styles of attributes?

Modified: cfe/branches/tooling/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseObjc.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseObjc.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseObjc.cpp Wed May 23 08:10:29 2012
@@ -2452,10 +2452,14 @@
     }
     // Parse the, optional, argument list, comma separated.
     while (Tok.is(tok::comma)) {
-      ConsumeToken(); // Eat the ','.
+      SourceLocation commaLoc = ConsumeToken(); // Eat the ','.
       ///  Parse the expression after ','
       ExprResult Res(ParseAssignmentExpression());
       if (Res.isInvalid()) {
+        if (Tok.is(tok::colon)) {
+          Diag(commaLoc, diag::note_extra_comma_message_arg) <<
+            FixItHint::CreateRemoval(commaLoc);
+        }
         // We must manually skip to a ']', otherwise the expression skipper will
         // stop at the ']' when it skips to the ';'.  We want it to skip beyond
         // the enclosing expression.

Modified: cfe/branches/tooling/lib/Rewrite/Rewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Rewrite/Rewriter.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Rewrite/Rewriter.cpp (original)
+++ cfe/branches/tooling/lib/Rewrite/Rewriter.cpp Wed May 23 08:10:29 2012
@@ -15,9 +15,12 @@
 #include "clang/Rewrite/Rewriter.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/Decl.h"
-#include "clang/Lex/Lexer.h"
+#include "clang/Basic/DiagnosticIDs.h"
+#include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Lex/Lexer.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/Support/FileSystem.h"
 using namespace clang;
 
 raw_ostream &RewriteBuffer::write(raw_ostream &os) const {
@@ -412,3 +415,68 @@
 
   return false;
 }
+
+// A wrapper for a file stream that atomically overwrites the target.
+//
+// Creates a file output stream for a temporary file in the constructor,
+// which is later accessible via getStream() if ok() return true.
+// Flushes the stream and moves the temporary file to the target location
+// in the destructor.
+class AtomicallyMovedFile {
+public:
+  AtomicallyMovedFile(DiagnosticsEngine &Diagnostics, StringRef Filename,
+                      bool &AllWritten)
+    : Diagnostics(Diagnostics), Filename(Filename), AllWritten(AllWritten) {
+    TempFilename = Filename;
+    TempFilename += "-%%%%%%%%";
+    int FD;
+    if (llvm::sys::fs::unique_file(TempFilename.str(), FD, TempFilename,
+                                    /*makeAbsolute=*/true, 0664)) {
+      AllWritten = false;
+      Diagnostics.Report(clang::diag::err_unable_to_make_temp)
+        << TempFilename;
+    } else {
+      FileStream.reset(new llvm::raw_fd_ostream(FD, /*shouldClose=*/true));
+    }
+  }
+
+  ~AtomicallyMovedFile() {
+    if (!ok()) return;
+
+    FileStream->flush();
+    if (llvm::error_code ec =
+          llvm::sys::fs::rename(TempFilename.str(), Filename)) {
+      AllWritten = false;
+      Diagnostics.Report(clang::diag::err_unable_to_rename_temp)
+        << TempFilename << Filename << ec.message();
+      bool existed;
+      // If the remove fails, there's not a lot we can do - this is already an
+      // error.
+      llvm::sys::fs::remove(TempFilename.str(), existed);
+    }
+  }
+
+  bool ok() { return FileStream; }
+  llvm::raw_ostream &getStream() { return *FileStream; }
+
+private:
+  DiagnosticsEngine &Diagnostics;
+  StringRef Filename;
+  SmallString<128> TempFilename;
+  OwningPtr<llvm::raw_fd_ostream> FileStream;
+  bool &AllWritten;
+};
+
+bool Rewriter::overwriteChangedFiles() {
+  bool AllWritten = true;
+  for (buffer_iterator I = buffer_begin(), E = buffer_end(); I != E; ++I) {
+    const FileEntry *Entry =
+        getSourceMgr().getFileEntryForID(I->first);
+    AtomicallyMovedFile File(getSourceMgr().getDiagnostics(), Entry->getName(),
+                             AllWritten);
+    if (File.ok()) {
+      I->second.write(File.getStream());
+    }
+  }
+  return !AllWritten;
+}

Modified: cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp Wed May 23 08:10:29 2012
@@ -3773,6 +3773,38 @@
     S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "uuid";
 }
 
+static void handleInheritanceAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+  if (S.LangOpts.MicrosoftExt) {
+    AttributeList::Kind Kind = Attr.getKind();
+    if (Kind == AttributeList::AT_single_inheritance)
+      D->addAttr(
+          ::new (S.Context) SingleInheritanceAttr(Attr.getRange(), S.Context));
+    else if (Kind == AttributeList::AT_multiple_inheritance)
+      D->addAttr(
+          ::new (S.Context) MultipleInheritanceAttr(Attr.getRange(), S.Context));
+    else if (Kind == AttributeList::AT_virtual_inheritance)
+      D->addAttr(
+          ::new (S.Context) VirtualInheritanceAttr(Attr.getRange(), S.Context));
+  } else
+    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
+}
+
+static void handlePortabilityAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+  if (S.LangOpts.MicrosoftExt) {
+    AttributeList::Kind Kind = Attr.getKind();
+    if (Kind == AttributeList::AT_ptr32)
+      D->addAttr(
+          ::new (S.Context) Ptr32Attr(Attr.getRange(), S.Context));
+    else if (Kind == AttributeList::AT_ptr64)
+      D->addAttr(
+          ::new (S.Context) Ptr64Attr(Attr.getRange(), S.Context));
+    else if (Kind == AttributeList::AT_w64)
+      D->addAttr(
+          ::new (S.Context) Win64Attr(Attr.getRange(), S.Context));
+  } else
+    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
+}
+
 //===----------------------------------------------------------------------===//
 // Top Level Sema Entry Points
 //===----------------------------------------------------------------------===//
@@ -3889,7 +3921,6 @@
       handleInitPriorityAttr(S, D, Attr); break;
       
   case AttributeList::AT_packed:      handlePackedAttr      (S, D, Attr); break;
-  case AttributeList::AT_ms_struct:    handleMsStructAttr    (S, D, Attr); break;
   case AttributeList::AT_section:     handleSectionAttr     (S, D, Attr); break;
   case AttributeList::AT_unavailable:
     handleAttrWithMessage<UnavailableAttr>(S, D, Attr, "unavailable");
@@ -3949,9 +3980,24 @@
   case AttributeList::AT_opencl_kernel_function:
     handleOpenCLKernelAttr(S, D, Attr);
     break;
+
+  // Microsoft attributes:
+  case AttributeList::AT_ms_struct:
+    handleMsStructAttr(S, D, Attr);
+    break;
   case AttributeList::AT_uuid:
     handleUuidAttr(S, D, Attr);
     break;
+  case AttributeList::AT_single_inheritance:
+  case AttributeList::AT_multiple_inheritance:
+  case AttributeList::AT_virtual_inheritance:
+    handleInheritanceAttr(S, D, Attr);
+    break;
+  case AttributeList::AT_w64:
+  case AttributeList::AT_ptr32:
+  case AttributeList::AT_ptr64:
+    handlePortabilityAttr(S, D, Attr);
+    break;
 
   // Thread safety attributes:
   case AttributeList::AT_guarded_var:

Modified: cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp Wed May 23 08:10:29 2012
@@ -18,6 +18,8 @@
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ASTMutationListener.h"
+#include "clang/Lex/Lexer.h"
+#include "clang/Basic/SourceManager.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SmallString.h"
 
@@ -200,51 +202,35 @@
   return (ObjCPropertyDecl::PropertyAttributeKind)attributesAsWritten;
 }
 
-static std::string getPropertyAttributeString(const ObjCPropertyDecl *property,
-                                              unsigned Attributes) {
-  std::string attr;
-  if (!Attributes)
-    return attr;
-  attr = "(";
-  bool first = true;
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_readonly)
-    {attr +=  !first ? ", readonly" : "readonly"; first = false; } 
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_readwrite)
-    {attr +=  !first ? ", readwrite" : "readwrite"; first = false; } 
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_getter)
-    {
-      if (!first)
-        attr += ", ";
-      attr += "getter=";
-      attr += property->getGetterName().getAsString();
-      first = false;
-   }
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_setter)
-    {
-      if (!first)
-        attr += ", ";
-      attr += "setter=";
-      attr += property->getSetterName().getAsString();
-      first = false;
-   }
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_assign)
-    {attr +=  !first ? ", assign" : "assign"; first = false; } 
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_retain)
-    {attr +=  !first ? ", retain" : "retain"; first = false; } 
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_strong)
-    {attr +=  !first ? ", strong" : "strong"; first = false; } 
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_weak)
-    {attr +=  !first ? ", weak" : "weak"; first = false; } 
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_copy)
-    {attr +=  !first ? ", copy" : "copy"; first = false; } 
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_unsafe_unretained)
-    {attr +=  !first ? ", unsafe_unretained" : "unsafe_unretained"; first = false; } 
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic)
-    {attr +=  !first ? ", nonatomic" : "nonatomic"; first = false; } 
-  if (Attributes & ObjCPropertyDecl::OBJC_PR_atomic)
-    {attr +=  !first ? ", atomic" : "atomic"; first = false; } 
-  attr += ")";
-  return attr;
+static bool LocPropertyAttribute( ASTContext &Context, const char *attrName, 
+                                 SourceLocation LParenLoc, SourceLocation &Loc) {
+  if (LParenLoc.isMacroID())
+    return false;
+  
+  SourceManager &SM = Context.getSourceManager();
+  std::pair<FileID, unsigned> locInfo = SM.getDecomposedLoc(LParenLoc);
+  // Try to load the file buffer.
+  bool invalidTemp = false;
+  StringRef file = SM.getBufferData(locInfo.first, &invalidTemp);
+  if (invalidTemp)
+    return false;
+  const char *tokenBegin = file.data() + locInfo.second;
+  
+  // Lex from the start of the given location.
+  Lexer lexer(SM.getLocForStartOfFile(locInfo.first),
+              Context.getLangOpts(),
+              file.begin(), tokenBegin, file.end());
+  Token Tok;
+  do {
+    lexer.LexFromRawLexer(Tok);
+    if (Tok.is(tok::raw_identifier) &&
+        StringRef(Tok.getRawIdentifierData(), Tok.getLength()) == attrName) {
+      Loc = Tok.getLocation();
+      return true;
+    }
+  } while (Tok.isNot(tok::r_paren));
+  return false;
+  
 }
 
 Decl *
@@ -684,15 +670,16 @@
       rwPIKind &= (~ObjCPropertyDecl::OBJC_PR_readonly);
       Diag(IC->getLocation(), diag::warn_auto_readonly_iboutlet_property);
       Diag(property->getLocation(), diag::note_property_declare);
-      // FIXME. End location must be that of closing ')' which is currently
-      // unavailable. Need to add it.
-      SourceLocation endLoc =
-              property->getTypeSourceInfo()->getTypeLoc().getBeginLoc();
-      SourceRange PropSourceRange(property->getLParenLoc(), endLoc);
-      Diag(property->getLocation(), 
-           diag::note_auto_readonly_iboutlet_fixup_suggest) <<
-      FixItHint::CreateReplacement(PropSourceRange, getPropertyAttributeString(property,
-                                                                               rwPIKind));
+      SourceLocation readonlyLoc;
+      if (LocPropertyAttribute(Context, "readonly", 
+                               property->getLParenLoc(), readonlyLoc)) {
+        SourceLocation endLoc = 
+          readonlyLoc.getLocWithOffset(strlen("readonly")-1);
+        SourceRange ReadonlySourceRange(readonlyLoc, endLoc);
+        Diag(property->getLocation(), 
+             diag::note_auto_readonly_iboutlet_fixup_suggest) <<
+        FixItHint::CreateReplacement(ReadonlySourceRange, "readwrite");
+      }
     }
         
   } else if ((CatImplClass = dyn_cast<ObjCCategoryImplDecl>(ClassImpDecl))) {

Modified: cfe/branches/tooling/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaTemplateInstantiateDecl.cpp Wed May 23 08:10:29 2012
@@ -431,7 +431,7 @@
                                             D->isMutable(),
                                             BitWidth,
                                             D->hasInClassInitializer(),
-                                            D->getTypeSpecStartLoc(),
+                                            D->getInnerLocStart(),
                                             D->getAccess(),
                                             0);
   if (!Field) {

Modified: cfe/branches/tooling/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaType.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaType.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaType.cpp Wed May 23 08:10:29 2012
@@ -4028,6 +4028,13 @@
       attr.setUsedAsTypeAttr();
       break;
 
+    case AttributeList::AT_w64:
+    case AttributeList::AT_ptr32:
+    case AttributeList::AT_ptr64:
+      // FIXME: don't ignore these
+      attr.setUsedAsTypeAttr();
+      break;
+
     case AttributeList::AT_ns_returns_retained:
       if (!state.getSema().getLangOpts().ObjCAutoRefCount)
 	break;

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineC.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineC.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineC.cpp Wed May 23 08:10:29 2012
@@ -568,8 +568,10 @@
                                              state->getSVal(initEx, LCtx)));
     return;
   }
-  
-  llvm_unreachable("unprocessed InitListExpr type");
+
+  assert(IE->getNumInits() == 1);
+  B.generateNode(IE, Pred, state->BindExpr(IE, LCtx, UnknownVal()));
+  return;
 }
 
 void ExprEngine::VisitGuardedExpr(const Expr *Ex,

Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/ObjCMessage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/ObjCMessage.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ObjCMessage.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ObjCMessage.cpp Wed May 23 08:10:29 2012
@@ -161,16 +161,15 @@
 }
 
 bool CallOrObjCMessage::isCFCGAllowingEscape(StringRef FName) {
-  if (FName[0] == 'C' && (FName[1] == 'F' || FName[1] == 'G'))
-         if (StrInStrNoCase(FName, "InsertValue") != StringRef::npos||
-             StrInStrNoCase(FName, "AddValue") != StringRef::npos ||
-             StrInStrNoCase(FName, "SetValue") != StringRef::npos ||
-             StrInStrNoCase(FName, "WithData") != StringRef::npos ||
-             StrInStrNoCase(FName, "AppendValue") != StringRef::npos||
-             StrInStrNoCase(FName, "SetAttribute") != StringRef::npos) {
-       return true;
-     }
-  return false;
+  if (!FName.startswith("CF") && !FName.startswith("CG"))
+    return false;
+
+  return StrInStrNoCase(FName, "InsertValue")  != StringRef::npos ||
+         StrInStrNoCase(FName, "AddValue")     != StringRef::npos ||
+         StrInStrNoCase(FName, "SetValue")     != StringRef::npos ||
+         StrInStrNoCase(FName, "WithData")     != StringRef::npos ||
+         StrInStrNoCase(FName, "AppendValue")  != StringRef::npos ||
+         StrInStrNoCase(FName, "SetAttribute") != StringRef::npos;
 }
 
 

Modified: cfe/branches/tooling/test/ARCMT/checking.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/checking.m?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/checking.m (original)
+++ cfe/branches/tooling/test/ARCMT/checking.m Wed May 23 08:10:29 2012
@@ -89,7 +89,8 @@
   [a retain];
   [a retainCount]; // expected-error {{ARC forbids explicit message send of 'retainCount'}}
   [a release];
-  [a autorelease];
+  [a autorelease]; // expected-error {{it is not safe to remove an unused 'autorelease' message; its receiver may be destroyed immediately}} \
+                   // expected-error {{ARC forbids explicit message send}}
 
   CFStringRef cfstr;
   NSString *str = (NSString *)cfstr; // expected-error {{cast of C pointer type 'CFStringRef' (aka 'const struct __CFString *') to Objective-C pointer type 'NSString *' requires a bridged cast}} \

Modified: cfe/branches/tooling/test/ARCMT/objcmt-subscripting-literals.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/objcmt-subscripting-literals.m?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/objcmt-subscripting-literals.m (original)
+++ cfe/branches/tooling/test/ARCMT/objcmt-subscripting-literals.m Wed May 23 08:10:29 2012
@@ -77,7 +77,9 @@
 #define PAIR(x) @#x, [NSNumber numberWithInt:(x)]
 #define TWO(x) ((x), (x))
 
- at interface I
+ at interface I {
+  NSArray *ivarArr;
+}
 @end
 @implementation I
 -(void) foo {
@@ -138,6 +140,7 @@
   o = [*parr objectAtIndex:2];
   void *hd;
   o = [(NSArray*)hd objectAtIndex:2];
+  o = [ivarArr objectAtIndex:2];
 }
 @end
 

Modified: cfe/branches/tooling/test/ARCMT/objcmt-subscripting-literals.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/objcmt-subscripting-literals.m.result?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/objcmt-subscripting-literals.m.result (original)
+++ cfe/branches/tooling/test/ARCMT/objcmt-subscripting-literals.m.result Wed May 23 08:10:29 2012
@@ -77,7 +77,9 @@
 #define PAIR(x) @#x, [NSNumber numberWithInt:(x)]
 #define TWO(x) ((x), (x))
 
- at interface I
+ at interface I {
+  NSArray *ivarArr;
+}
 @end
 @implementation I
 -(void) foo {
@@ -138,6 +140,7 @@
   o = (*parr)[2];
   void *hd;
   o = ((NSArray*)hd)[2];
+  o = ivarArr[2];
 }
 @end
 

Modified: cfe/branches/tooling/test/Analysis/cxx11-crashes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/cxx11-crashes.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/cxx11-crashes.cpp (original)
+++ cfe/branches/tooling/test/Analysis/cxx11-crashes.cpp Wed May 23 08:10:29 2012
@@ -31,3 +31,8 @@
   namespace fs = boost::filesystem;
   fs::path p;
 }
+
+// PR12873 radrar://11499139
+void testFloatInitializer() {
+  const float ysize={0.015}, xsize={0.01};
+}

Modified: cfe/branches/tooling/test/Analysis/nullptr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/nullptr.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/nullptr.cpp (original)
+++ cfe/branches/tooling/test/Analysis/nullptr.cpp Wed May 23 08:10:29 2012
@@ -55,7 +55,7 @@
   int **a = 0;
   int **b = 0;
   asm ("nop"
-      :"=a"(*a)
+      :"=r"(*a)
       :"0"(*b) // expected-warning{{Dereference of null pointer}}
       );
 }

Modified: cfe/branches/tooling/test/CodeGen/bounds-checking.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGen/bounds-checking.c?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGen/bounds-checking.c (original)
+++ cfe/branches/tooling/test/CodeGen/bounds-checking.c Wed May 23 08:10:29 2012
@@ -3,23 +3,24 @@
 // CHECK: @f
 double f(int b, int i) {
   double a[b];
+  // CHECK: trap
   return a[i];
-  // CHECK: objectsize.i64({{.*}}, i1 false, i32 4)
-  // CHECK: icmp uge i64 {{.*}}, 8
 }
 
 // CHECK: @f2
 void f2() {
+  // everything is constant; no trap possible
+  // CHECK-NOT: trap
   int a[2];
-  // CHECK: objectsize.i64({{.*}}, i1 false, i32 4)
-  // CHECK: icmp uge i64 {{.*}}, 4
   a[1] = 42;
   
   short *b = malloc(64);
-  // CHECK: objectsize.i64({{.*}}, i1 false, i32 4)
-  // CHECK: icmp uge i64 {{.*}}, 4
-  // CHECK: getelementptr {{.*}}, i64 5
-  // CHECK: objectsize.i64({{.*}}, i1 false, i32 4)
-  // CHECK: icmp uge i64 {{.*}}, 2
-  b[5] = a[1]+2;
+  b[5] = *a + a[1] + 2;
+}
+
+// CHECK: @f3
+void f3() {
+  int a[1];
+  // CHECK: trap
+  a[2] = 1;
 }

Modified: cfe/branches/tooling/test/CodeGen/object-size.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGen/object-size.c?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGen/object-size.c (original)
+++ cfe/branches/tooling/test/CodeGen/object-size.c Wed May 23 08:10:29 2012
@@ -40,7 +40,7 @@
 // CHECK: define void @test5
 void test5() {
   // CHECK:     = load i8** @gp
-  // CHECK-NEXT:= call i64 @llvm.objectsize.i64(i8* %{{.*}}, i1 false, i32 0)
+  // CHECK-NEXT:= call i64 @llvm.objectsize.i64(i8* %{{.*}}, i1 false)
   strcpy(gp, "Hi there");
 }
 
@@ -55,7 +55,10 @@
 // CHECK: define void @test7
 void test7() {
   int i;
-  // CHECK:     = call i64 @llvm.objectsize.i64(i8* {{.*}}@gbuf{{.*}}, i1 false, i32 0)
+  // Ensure we only evaluate the side-effect once.
+  // CHECK:     = add
+  // CHECK-NOT: = add
+  // CHECK:     = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 63)
   strcpy((++i, gbuf), "Hi there");
 }
 

Modified: cfe/branches/tooling/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCXX/visibility.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/branches/tooling/test/CodeGenCXX/visibility.cpp Wed May 23 08:10:29 2012
@@ -66,6 +66,19 @@
   // CHECK-HIDDEN: _ZN6test403fooIiE3barE = weak_odr global
 }
 
+namespace test41 {
+  // Unlike gcc we propagate the information that foo not only is hidden, but
+  // has been explicitly marked as so. This lets us produce a hidden undefined
+  // reference to bar.
+  struct __attribute__((visibility("hidden"))) foo {};
+  extern foo bar;
+  foo *zed() {
+    return &bar;
+  }
+  // CHECK: @_ZN6test413barE = external hidden global
+  // CHECK-HIDDEN: @_ZN6test413barE = external hidden global
+}
+
 // CHECK: @_ZN5Test425VariableInHiddenNamespaceE = hidden global i32 10
 // CHECK: @_ZN5Test71aE = hidden global
 // CHECK: @_ZN5Test71bE = global
@@ -776,3 +789,32 @@
   // GCC produces a default for this one. Why?
   // CHECK-HIDDEN: define weak_odr hidden void @_ZN6test391AINS_8hidden_tEE1BIS1_E4tempIS1_EEvv
 }
+
+namespace test42 {
+  struct HIDDEN foo {
+  };
+  template <class P>
+  struct bar {
+  };
+  template <>
+  struct HIDDEN bar<foo> {
+    DEFAULT static void zed();
+  };
+  void bar<foo>::zed() {
+  }
+  // CHECK: define hidden void @_ZN6test423barINS_3fooEE3zedEv
+  // CHECK-HIDDEN: define hidden void @_ZN6test423barINS_3fooEE3zedEv
+}
+
+namespace test43 {
+  struct HIDDEN foo {
+  };
+  template <class P>
+  void bar() {
+  }
+  template <>
+  DEFAULT void bar<foo>() {
+  }
+  // CHECK: define hidden void @_ZN6test433barINS_3fooEEEvv
+  // CHECK-HIDDEN: define hidden void @_ZN6test433barINS_3fooEEEvv
+}

Modified: cfe/branches/tooling/test/Parser/MicrosoftExtensions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Parser/MicrosoftExtensions.c?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/Parser/MicrosoftExtensions.c (original)
+++ cfe/branches/tooling/test/Parser/MicrosoftExtensions.c Wed May 23 08:10:29 2012
@@ -11,11 +11,11 @@
 
 void * __ptr64 PtrToPtr64(const void *p)
 {
-  return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr64' ignored}}
+  return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p );
 }
 void * __ptr32 PtrToPtr32(const void *p)
 {
-  return((void * __ptr32) (unsigned __int32) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr32' ignored}}
+  return((void * __ptr32) (unsigned __int32) (ULONG_PTR)p );
 }
 
 void __forceinline InterlockedBitTestAndSet (long *Base, long Bit)

Modified: cfe/branches/tooling/test/Parser/MicrosoftExtensions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Parser/MicrosoftExtensions.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/Parser/MicrosoftExtensions.cpp (original)
+++ cfe/branches/tooling/test/Parser/MicrosoftExtensions.cpp Wed May 23 08:10:29 2012
@@ -297,28 +297,29 @@
   missing_template_keyword<int>();
 }
 
+namespace access_protected_PTM {
+  class A {
+  protected:
+    void f(); // expected-note {{must name member using the type of the current context 'access_protected_PTM::B'}}
+  };
 
+  class B : public A{
+  public:
+    void test_access();
+    static void test_access_static();
+  };
 
-
-namespace access_protected_PTM {
-
-class A {
-protected:
-  void f(); // expected-note {{must name member using the type of the current context 'access_protected_PTM::B'}}
-};
-
-class B : public A{
-public:
-  void test_access();
-  static void test_access_static();
-};
-
-void B::test_access() {
-  &A::f; // expected-error {{'f' is a protected member of 'access_protected_PTM::A'}}
-}
-
-void B::test_access_static() {
-  &A::f;
-}
-
-}
\ No newline at end of file
+  void B::test_access() {
+    &A::f; // expected-error {{'f' is a protected member of 'access_protected_PTM::A'}}
+  }
+
+  void B::test_access_static() {
+    &A::f;
+  }
+}
+
+namespace Inheritance {
+  class __single_inheritance A;
+  class __multiple_inheritance B;
+  class __virtual_inheritance C;
+}

Propchange: cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 23 08:10: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-157176
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,146581-157315

Modified: cfe/branches/tooling/test/SemaObjC/iboutlet.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/iboutlet.m?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/iboutlet.m (original)
+++ cfe/branches/tooling/test/SemaObjC/iboutlet.m Wed May 23 08:10:29 2012
@@ -2,6 +2,8 @@
 // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-default-synthesize-properties  -verify %s
 // rdar://11448209
 
+#define READONLY readonly
+
 @class NSView;
 
 #define IBOutlet __attribute__((iboutlet))
@@ -9,7 +11,13 @@
 @interface I
 @property (getter = MyGetter, readonly, assign) IBOutlet NSView *myView; // expected-note {{property declared here}} \
 							// expected-note {{readonly IBOutlet property should be changed to be readwrite}}
+
+ at property (readonly) IBOutlet NSView *myView1; // expected-note {{readonly IBOutlet property should be changed to be readwrite}} \
+                                               // expected-note {{property declared here}}
+
+ at property (getter = MyGetter, READONLY) IBOutlet NSView *myView2;  // expected-note {{property declared here}}
+
 @end
 
- at implementation I // expected-warning {{readonly IBOutlet property when auto-synthesized may not work correctly with 'nib' loader}}
+ at implementation I // expected-warning 3 {{readonly IBOutlet property when auto-synthesized may not work correctly with 'nib' loader}}
 @end

Modified: cfe/branches/tooling/test/SemaTemplate/instantiate-expr-1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaTemplate/instantiate-expr-1.cpp?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaTemplate/instantiate-expr-1.cpp (original)
+++ cfe/branches/tooling/test/SemaTemplate/instantiate-expr-1.cpp Wed May 23 08:10:29 2012
@@ -127,7 +127,7 @@
 
 template<typename T>
 void test_asm(T t) {
-  asm ("nop" : "=a"(*t) : "r"(*t)); // expected-error {{indirection requires pointer operand ('int' invalid)}}
+  asm ("nop" : "=r"(*t) : "r"(*t)); // expected-error {{indirection requires pointer operand ('int' invalid)}}
 }
 
 void test_asm() {

Modified: cfe/branches/tooling/unittests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/unittests/CMakeLists.txt?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/unittests/CMakeLists.txt (original)
+++ cfe/branches/tooling/unittests/CMakeLists.txt Wed May 23 08:10:29 2012
@@ -76,6 +76,7 @@
   Tooling/ToolingTest.cpp
   Tooling/RecursiveASTVisitorTest.cpp
   Tooling/RefactoringTest.cpp
-  USED_LIBS gtest gtest_main clangAST clangTooling
+  Tooling/RewriterTest.cpp
+  USED_LIBS gtest gtest_main clangAST clangTooling clangRewrite
  )
 

Modified: cfe/branches/tooling/unittests/Tooling/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/unittests/Tooling/Makefile?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/unittests/Tooling/Makefile (original)
+++ cfe/branches/tooling/unittests/Tooling/Makefile Wed May 23 08:10:29 2012
@@ -11,7 +11,7 @@
 TESTNAME = Tooling
 LINK_COMPONENTS := support mc
 USEDLIBS = clangTooling.a clangFrontend.a clangSerialization.a clangDriver.a \
-           clangRewrite.a clangParse.a clangSema.a clangAnalysis.a \
+           clangParse.a clangRewrite.a clangSema.a clangAnalysis.a clangEdit.a \
            clangAST.a clangLex.a clangBasic.a
 
 include $(CLANG_LEVEL)/unittests/Makefile

Modified: cfe/branches/tooling/www/cxx_status.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/www/cxx_status.html?rev=157321&r1=157320&r2=157321&view=diff
==============================================================================
--- cfe/branches/tooling/www/cxx_status.html (original)
+++ cfe/branches/tooling/www/cxx_status.html Wed May 23 08:10:29 2012
@@ -83,7 +83,7 @@
     <tr>
       <td>Initializer lists</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm">N2672</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>Static assertions</td>
@@ -113,7 +113,7 @@
     <tr>
       <td>Lambda expressions</td>
       <td><a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf">N2927</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>Declared type of an expression</td>
@@ -123,7 +123,7 @@
     <tr>
       <td>    Incomplete return types</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3276.pdf">N3276</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>Right angle brackets</td>
@@ -164,7 +164,7 @@
       <td>Forward declarations for enums</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf">N2764</a>
       <br><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1206">DR1206</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>Generalized attributes</td>
@@ -174,7 +174,7 @@
     <tr>
       <td>Generalized constant expressions</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf">N2235</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>Alignment support</td>
@@ -216,12 +216,12 @@
     <tr>
       <td>Universal character names in literals</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html">N2170</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>User-defined literals</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf">N2765</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>Standard Layout Types</td>
@@ -247,7 +247,7 @@
       <td>Extending <code>sizeof</code></td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html">N2253</a>
       <br><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#850">DR850</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>Inline namespaces</td>
@@ -257,7 +257,7 @@
     <tr>
       <td>Unrestricted unions</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf">N2544</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>Local and unnamed types as template arguments</td>
@@ -303,17 +303,17 @@
     <tr>
       <td>Atomic operations</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html">N2427</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>Strong Compare and Exchange</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2748.html">N2748</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>Bidirectional Fences</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2752.htm">N2752</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
 
     <tr>
@@ -339,7 +339,7 @@
     <tr>
       <td>Allow atomics use in signal handlers</td>
       <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2547.htm">N2547</a></td>
-      <td class="svn" align="center">Clang 3.1</td>
+      <td class="full" align="center">Clang 3.1</td>
     </tr>
     <tr>
       <td>Thread-local storage</td>





More information about the llvm-branch-commits mailing list