Author: meinersbur
Date: Thu Aug  2 18:21:16 2018
New Revision: 338800

URL: http://llvm.org/viewvc/llvm-project?rev=338800&view=rev
Log:
Append new attributes to the end of an AttributeList.

Recommit of r335084 after revert in r335516.

... instead of prepending it at the beginning (the original behavior
since implemented in r122535 2010-12-23). This builds up an
AttributeList in the the order in which the attributes appear in the
source.

The reverse order caused nodes for attributes in the AST (e.g. LoopHint)
to be in the reverse order, and therefore printed in the wrong order in
-ast-dump. Some TODO comments mention this. The order was explicitly
reversed for enable_if attribute overload resolution and name mangling,
which is not necessary anymore with this patch.

The change unfortunately has some secondary effect, especially on
diagnostic output. In the simplest cases, the CHECK lines or expected
diagnostic were changed to the the new output. If the kind of
error/warning changed, the attributes' order was changed instead.

This unfortunately causes some 'previous occurrence here' hints to be
textually after the main marker. This typically happens when attributes
are merged, but are incompatible to each other. Interchanging the role
of the the main and note SourceLocation will also cause the case where
two different declaration's attributes (in contrast to multiple
attributes of the same declaration) are merged to be reverse. There is
no easy fix because sometimes previous attributes are merged into a new
declaration's attribute list, sometimes new attributes are added to a
previous declaration's attribute list. Since 'previous occurrence here'
pointing to locations after the main marker is not rare, I left the
markers as-is; it is only relevant when the attributes are declared in
the same declaration anyway.

Differential Revision: https://reviews.llvm.org/D48100

Modified:
    cfe/trunk/include/clang/Sema/ParsedAttr.h
    cfe/trunk/lib/AST/ItaniumMangle.cpp
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
    cfe/trunk/lib/Parse/ParseObjc.cpp
    cfe/trunk/lib/Sema/SemaAttr.cpp
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
    cfe/trunk/test/Index/annotate-comments-availability-attrs.cpp
    cfe/trunk/test/Index/complete-with-annotations.cpp
    cfe/trunk/test/Misc/ast-print-pragmas.cpp
    cfe/trunk/test/PCH/pragma-loop.cpp
    cfe/trunk/test/Parser/pragma-loop-safety.cpp
    cfe/trunk/test/Parser/pragma-loop.cpp
    cfe/trunk/test/Parser/pragma-unroll-and-jam.cpp
    cfe/trunk/test/Parser/pragma-unroll.cpp
    cfe/trunk/test/Sema/attr-availability-tvos.c
    cfe/trunk/test/Sema/attr-availability.c
    cfe/trunk/test/Sema/attr-coldhot.c
    cfe/trunk/test/Sema/attr-disable-tail-calls.c
    cfe/trunk/test/Sema/attr-long-call.c
    cfe/trunk/test/Sema/attr-micromips.c
    cfe/trunk/test/Sema/attr-notail.c
    cfe/trunk/test/Sema/attr-ownership.c
    cfe/trunk/test/Sema/attr-ownership.cpp
    cfe/trunk/test/Sema/attr-print.c
    cfe/trunk/test/Sema/attr-visibility.c
    cfe/trunk/test/Sema/internal_linkage.c
    cfe/trunk/test/Sema/mips-interrupt-attr.c
    cfe/trunk/test/Sema/nullability.c
    cfe/trunk/test/SemaCXX/attr-print.cpp
    cfe/trunk/test/SemaCXX/ms-uuid.cpp
    cfe/trunk/test/SemaObjC/nullability.m
    cfe/trunk/test/SemaOpenCL/address-spaces.cl
    cfe/trunk/test/SemaTemplate/attributes.cpp

Modified: cfe/trunk/include/clang/Sema/ParsedAttr.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ParsedAttr.h?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/ParsedAttr.h (original)
+++ cfe/trunk/include/clang/Sema/ParsedAttr.h Thu Aug  2 18:21:16 2018
@@ -728,10 +728,6 @@ public:
   ParsedAttr &operator[](SizeType pos) { return *AttrList[pos]; }
   const ParsedAttr &operator[](SizeType pos) const { return *AttrList[pos]; }
 
-  void addAtStart(ParsedAttr *newAttr) {
-    assert(newAttr);
-    AttrList.insert(AttrList.begin(), newAttr);
-  }
   void addAtEnd(ParsedAttr *newAttr) {
     assert(newAttr);
     AttrList.push_back(newAttr);
@@ -785,6 +781,23 @@ public:
   iterator end() { return iterator(AttrList.end()); }
   const_iterator end() const { return const_iterator(AttrList.end()); }
 
+  ParsedAttr &front() {
+    assert(!empty());
+    return *AttrList.front();
+  }
+  const ParsedAttr &front() const {
+    assert(!empty());
+    return *AttrList.front();
+  }
+  ParsedAttr &back() {
+    assert(!empty());
+    return *AttrList.back();
+  }
+  const ParsedAttr &back() const {
+    assert(!empty());
+    return *AttrList.back();
+  }
+
   bool hasAttribute(ParsedAttr::Kind K) const {
     return llvm::any_of(
         AttrList, [K](const ParsedAttr *AL) { return AL->getKind() == K; });
@@ -826,7 +839,7 @@ public:
                      SourceLocation ellipsisLoc = SourceLocation()) {
     ParsedAttr *attr = pool.create(attrName, attrRange, scopeName, scopeLoc,
                                    args, numArgs, syntax, ellipsisLoc);
-    addAtStart(attr);
+    addAtEnd(attr);
     return attr;
   }
 
@@ -842,7 +855,7 @@ public:
     ParsedAttr *attr = pool.create(
         attrName, attrRange, scopeName, scopeLoc, Param, introduced, 
deprecated,
         obsoleted, unavailable, MessageExpr, syntax, strict, ReplacementExpr);
-    addAtStart(attr);
+    addAtEnd(attr);
     return attr;
   }
 
@@ -853,7 +866,7 @@ public:
                      IdentifierLoc *Param3, ParsedAttr::Syntax syntax) {
     ParsedAttr *attr = pool.create(attrName, attrRange, scopeName, scopeLoc,
                                    Param1, Param2, Param3, syntax);
-    addAtStart(attr);
+    addAtEnd(attr);
     return attr;
   }
 
@@ -867,7 +880,7 @@ public:
     ParsedAttr *attr = pool.createTypeTagForDatatype(
         attrName, attrRange, scopeName, scopeLoc, argumentKind, matchingCType,
         layoutCompatible, mustBeNull, syntax);
-    addAtStart(attr);
+    addAtEnd(attr);
     return attr;
   }
 
@@ -878,7 +891,7 @@ public:
                              ParsedAttr::Syntax syntaxUsed) {
     ParsedAttr *attr = pool.createTypeAttribute(attrName, attrRange, scopeName,
                                                 scopeLoc, typeArg, syntaxUsed);
-    addAtStart(attr);
+    addAtEnd(attr);
     return attr;
   }
 
@@ -891,7 +904,7 @@ public:
     ParsedAttr *attr =
         pool.createPropertyAttribute(attrName, attrRange, scopeName, scopeLoc,
                                      getterId, setterId, syntaxUsed);
-    addAtStart(attr);
+    addAtEnd(attr);
     return attr;
   }
 

Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Thu Aug  2 18:21:16 2018
@@ -721,10 +721,8 @@ void CXXNameMangler::mangleFunctionEncod
   if (FD->hasAttr<EnableIfAttr>()) {
     FunctionTypeDepthState Saved = FunctionTypeDepth.push();
     Out << "Ua9enable_ifI";
-    // FIXME: specific_attr_iterator iterates in reverse order. Fix that and 
use
-    // it here.
-    for (AttrVec::const_reverse_iterator I = FD->getAttrs().rbegin(),
-                                         E = FD->getAttrs().rend();
+    for (AttrVec::const_iterator I = FD->getAttrs().begin(),
+                                 E = FD->getAttrs().end();
          I != E; ++I) {
       EnableIfAttr *EIA = dyn_cast<EnableIfAttr>(*I);
       if (!EIA)

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Thu Aug  2 18:21:16 2018
@@ -3875,7 +3875,7 @@ bool Parser::ParseCXX11AttributeArgs(Ide
 
   if (!Attrs.empty() &&
       IsBuiltInOrStandardCXX11Attribute(AttrName, ScopeName)) {
-    ParsedAttr &Attr = *Attrs.begin();
+    ParsedAttr &Attr = Attrs.back();
     // If the attribute is a standard or built-in attribute and we are
     // parsing an argument list, we need to determine whether this attribute
     // was allowed to have an argument list (such as [[deprecated]]), and how

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Thu Aug  2 18:21:16 2018
@@ -384,12 +384,12 @@ static void addContextSensitiveTypeNulla
 
   if (D.getNumTypeObjects() > 0) {
     // Add the attribute to the declarator chunk nearest the declarator.
-    D.getTypeObject(0).getAttrs().addAtStart(
+    D.getTypeObject(0).getAttrs().addAtEnd(
         getNullabilityAttr(D.getAttributePool()));
   } else if (!addedToDeclSpec) {
     // Otherwise, just put it on the declaration specifiers (if one
     // isn't there already).
-    D.getMutableDeclSpec().getAttributes().addAtStart(
+    D.getMutableDeclSpec().getAttributes().addAtEnd(
         getNullabilityAttr(D.getMutableDeclSpec().getAttributes().getPool()));
     addedToDeclSpec = true;
   }
@@ -1198,7 +1198,7 @@ static void takeDeclAttributes(ParsedAtt
   for (auto &AL : llvm::reverse(from)) {
     if (!AL.isUsedAsTypeAttr()) {
       from.remove(&AL);
-      attrs.addAtStart(&AL);
+      attrs.addAtEnd(&AL);
     }
   }
 }

Modified: cfe/trunk/lib/Sema/SemaAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAttr.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAttr.cpp Thu Aug  2 18:21:16 2018
@@ -661,7 +661,7 @@ void Sema::AddPragmaAttributes(Scope *S,
     Entry.IsUsed = true;
     PragmaAttributeCurrentTargetDecl = D;
     ParsedAttributesView Attrs;
-    Attrs.addAtStart(Attribute);
+    Attrs.addAtEnd(Attribute);
     ProcessDeclAttributeList(S, D, Attrs);
     PragmaAttributeCurrentTargetDecl = nullptr;
   }

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Aug  2 18:21:16 2018
@@ -6215,24 +6215,6 @@ Sema::SelectBestMethod(Selector Sel, Mul
   return nullptr;
 }
 
-// specific_attr_iterator iterates over enable_if attributes in reverse, and
-// enable_if is order-sensitive. As a result, we need to reverse things
-// sometimes. Size of 4 elements is arbitrary.
-static SmallVector<EnableIfAttr *, 4>
-getOrderedEnableIfAttrs(const FunctionDecl *Function) {
-  SmallVector<EnableIfAttr *, 4> Result;
-  if (!Function->hasAttrs())
-    return Result;
-
-  const auto &FuncAttrs = Function->getAttrs();
-  for (Attr *Attr : FuncAttrs)
-    if (auto *EnableIf = dyn_cast<EnableIfAttr>(Attr))
-      Result.push_back(EnableIf);
-
-  std::reverse(Result.begin(), Result.end());
-  return Result;
-}
-
 static bool
 convertArgsForAvailabilityChecks(Sema &S, FunctionDecl *Function, Expr 
*ThisArg,
                                  ArrayRef<Expr *> Args, Sema::SFINAETrap &Trap,
@@ -6306,9 +6288,8 @@ convertArgsForAvailabilityChecks(Sema &S
 
 EnableIfAttr *Sema::CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> 
Args,
                                   bool MissingImplicitThis) {
-  SmallVector<EnableIfAttr *, 4> EnableIfAttrs =
-      getOrderedEnableIfAttrs(Function);
-  if (EnableIfAttrs.empty())
+  auto EnableIfAttrs = Function->specific_attrs<EnableIfAttr>();
+  if (EnableIfAttrs.begin() == EnableIfAttrs.end())
     return nullptr;
 
   SFINAETrap Trap(*this);
@@ -6318,7 +6299,7 @@ EnableIfAttr *Sema::CheckEnableIf(Functi
   if (!convertArgsForAvailabilityChecks(
           *this, Function, /*ThisArg=*/nullptr, Args, Trap,
           /*MissingImplicitThis=*/true, DiscardedThis, ConvertedArgs))
-    return EnableIfAttrs[0];
+    return *EnableIfAttrs.begin();
 
   for (auto *EIA : EnableIfAttrs) {
     APValue Result;
@@ -8967,24 +8948,21 @@ static Comparison compareEnableIfAttrs(c
     return Cand1Attr ? Comparison::Better : Comparison::Worse;
   }
 
-  // FIXME: The next several lines are just
-  // specific_attr_iterator<EnableIfAttr> but going in declaration order,
-  // instead of reverse order which is how they're stored in the AST.
-  auto Cand1Attrs = getOrderedEnableIfAttrs(Cand1);
-  auto Cand2Attrs = getOrderedEnableIfAttrs(Cand2);
-
-  // It's impossible for Cand1 to be better than (or equal to) Cand2 if Cand1
-  // has fewer enable_if attributes than Cand2.
-  if (Cand1Attrs.size() < Cand2Attrs.size())
-    return Comparison::Worse;
+  auto Cand1Attrs = Cand1->specific_attrs<EnableIfAttr>();
+  auto Cand2Attrs = Cand2->specific_attrs<EnableIfAttr>();
 
   auto Cand1I = Cand1Attrs.begin();
   llvm::FoldingSetNodeID Cand1ID, Cand2ID;
-  for (auto &Cand2A : Cand2Attrs) {
+  for (EnableIfAttr *Cand2A : Cand2Attrs) {
     Cand1ID.clear();
     Cand2ID.clear();
 
-    auto &Cand1A = *Cand1I++;
+    // It's impossible for Cand1 to be better than (or equal to) Cand2 if Cand1
+    // has fewer enable_if attributes than Cand2.
+    auto Cand1A = Cand1I++;
+    if (Cand1A == Cand1Attrs.end())
+      return Comparison::Worse;
+
     Cand1A->getCond()->Profile(Cand1ID, S.getASTContext(), true);
     Cand2A->getCond()->Profile(Cand2ID, S.getASTContext(), true);
     if (Cand1ID != Cand2ID)

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu Aug  2 18:21:16 2018
@@ -246,7 +246,7 @@ namespace {
 
       getMutableDeclSpec().getAttributes().clearListOnly();
       for (ParsedAttr *AL : savedAttrs)
-        getMutableDeclSpec().getAttributes().addAtStart(AL);
+        getMutableDeclSpec().getAttributes().addAtEnd(AL);
     }
   };
 } // end anonymous namespace
@@ -255,7 +255,7 @@ static void moveAttrFromListToList(Parse
                                    ParsedAttributesView &fromList,
                                    ParsedAttributesView &toList) {
   fromList.remove(&attr);
-  toList.addAtStart(&attr);
+  toList.addAtEnd(&attr);
 }
 
 /// The location of a type attribute.
@@ -4128,7 +4128,7 @@ static TypeSourceInfo *GetFullTypeForDec
               SourceRange(pointerLoc), nullptr, SourceLocation(), nullptr, 0,
               syntax);
 
-      attrs.addAtStart(nullabilityAttr);
+      attrs.addAtEnd(nullabilityAttr);
 
       if (inferNullabilityCS) {
         state.getDeclarator().getMutableDeclSpec().getObjCQualifiers()
@@ -5093,7 +5093,7 @@ static void transferARCOwnershipToDeclar
       &S.Context.Idents.get("objc_ownership"), SourceLocation(),
       /*scope*/ nullptr, SourceLocation(),
       /*args*/ &Args, 1, ParsedAttr::AS_GNU);
-  chunk.getAttrs().addAtStart(attr);
+  chunk.getAttrs().addAtEnd(attr);
   // TODO: mark whether we did this inference?
 }
 

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Thu Aug  2 18:21:16 2018
@@ -2832,36 +2832,25 @@ static bool hasSameOverloadableAttrs(con
   // Note that pass_object_size attributes are represented in the function's
   // ExtParameterInfo, so we don't need to check them here.
 
-  SmallVector<const EnableIfAttr *, 4> AEnableIfs;
-  // Since this is an equality check, we can ignore that enable_if attrs show 
up
-  // in reverse order.
-  for (const auto *EIA : A->specific_attrs<EnableIfAttr>())
-    AEnableIfs.push_back(EIA);
-
-  SmallVector<const EnableIfAttr *, 4> BEnableIfs;
-  for (const auto *EIA : B->specific_attrs<EnableIfAttr>())
-    BEnableIfs.push_back(EIA);
-
-  // Two very common cases: either we have 0 enable_if attrs, or we have an
-  // unequal number of enable_if attrs.
-  if (AEnableIfs.empty() && BEnableIfs.empty())
-    return true;
-
-  if (AEnableIfs.size() != BEnableIfs.size())
-    return false;
-
+  // Return false if any of the enable_if expressions of A and B are different.
   llvm::FoldingSetNodeID Cand1ID, Cand2ID;
-  for (unsigned I = 0, E = AEnableIfs.size(); I != E; ++I) {
+  auto AEnableIfAttrs = A->specific_attrs<EnableIfAttr>();
+  auto BEnableIfAttrs = B->specific_attrs<EnableIfAttr>();
+  auto AEnableIf = AEnableIfAttrs.begin();
+  auto BEnableIf = BEnableIfAttrs.begin();
+  for (; AEnableIf != AEnableIfAttrs.end() && BEnableIf != 
BEnableIfAttrs.end();
+       ++BEnableIf, ++AEnableIf) {
     Cand1ID.clear();
     Cand2ID.clear();
 
-    AEnableIfs[I]->getCond()->Profile(Cand1ID, A->getASTContext(), true);
-    BEnableIfs[I]->getCond()->Profile(Cand2ID, B->getASTContext(), true);
+    AEnableIf->getCond()->Profile(Cand1ID, A->getASTContext(), true);
+    BEnableIf->getCond()->Profile(Cand2ID, B->getASTContext(), true);
     if (Cand1ID != Cand2ID)
       return false;
   }
 
-  return true;
+  // Return false if the number of enable_if attributes was different.
+  return AEnableIf == AEnableIfAttrs.end() && BEnableIf == 
BEnableIfAttrs.end();
 }
 
 /// Determine whether the two declarations refer to the same entity.

Modified: cfe/trunk/test/Index/annotate-comments-availability-attrs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-comments-availability-attrs.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Index/annotate-comments-availability-attrs.cpp (original)
+++ cfe/trunk/test/Index/annotate-comments-availability-attrs.cpp Thu Aug  2 
18:21:16 2018
@@ -13,7 +13,7 @@
 void attr_availability_1() 
__attribute__((availability(macosx,obsoleted=10.0,introduced=8.0,deprecated=9.0,
 message="use availability_test in <foo.h>")))
                            __attribute__((availability(ios,unavailable, 
message="not for iOS")));
 
-// CHECK: FullCommentAsXML=[<Function 
file="{{[^"]+}}annotate-comments-availability-attrs.cpp" line="[[@LINE-3]]" 
column="6"><Name>attr_availability_1</Name><USR>c:@F@attr_availability_1#</USR><Declaration>void
 attr_availability_1()</Declaration><Abstract><Para> 
Aaa.</Para></Abstract><Availability distribution="iOS"><DeprecationSummary>not 
for iOS</DeprecationSummary><Unavailable/></Availability><Availability 
distribution="macOS"><IntroducedInVersion>8.0</IntroducedInVersion><DeprecatedInVersion>9.0</DeprecatedInVersion><RemovedAfterVersion>10.0</RemovedAfterVersion><DeprecationSummary>use
 availability_test in 
&lt;foo.h&gt;</DeprecationSummary></Availability></Function>]
+// CHECK: FullCommentAsXML=[<Function 
file="{{[^"]+}}annotate-comments-availability-attrs.cpp" line="[[@LINE-3]]" 
column="6"><Name>attr_availability_1</Name><USR>c:@F@attr_availability_1#</USR><Declaration>void
 attr_availability_1()</Declaration><Abstract><Para> 
Aaa.</Para></Abstract><Availability 
distribution="macOS"><IntroducedInVersion>8.0</IntroducedInVersion><DeprecatedInVersion>9.0</DeprecatedInVersion><RemovedAfterVersion>10.0</RemovedAfterVersion><DeprecationSummary>use
 availability_test in 
&lt;foo.h&gt;</DeprecationSummary></Availability><Availability 
distribution="iOS"><DeprecationSummary>not for 
iOS</DeprecationSummary><Unavailable/></Availability></Function>]
 
 /// Aaa.
 void attr_availability_2() 
__attribute__((availability(macosx,obsoleted=10.0.1,introduced=8.0.1,deprecated=9.0.1)));

Modified: cfe/trunk/test/Index/complete-with-annotations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-with-annotations.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-with-annotations.cpp (original)
+++ cfe/trunk/test/Index/complete-with-annotations.cpp Thu Aug  2 18:21:16 2018
@@ -14,7 +14,7 @@ void X::doSomething() {
 }
 
 // CHECK: CXXMethod:{ResultType void}{TypedText doSomething}{LeftParen 
(}{RightParen )} (34)
-// CHECK: FieldDecl:{ResultType int}{TypedText field} (35) ("three", "two", 
"one")
+// CHECK: FieldDecl:{ResultType int}{TypedText field} (35) ("one", "two", 
"three")
 // CHECK: CXXMethod:{ResultType void}{TypedText func2}{LeftParen (}{RightParen 
)} (34) ("some annotation")
 // CHECK: FieldDecl:{ResultType int}{TypedText member2} (35) ("another 
annotation", "some annotation")
 // CHECK: CXXMethod:{ResultType X &}{TypedText operator=}{LeftParen 
(}{Placeholder const X &}{RightParen )} (79)

Modified: cfe/trunk/test/Misc/ast-print-pragmas.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/ast-print-pragmas.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Misc/ast-print-pragmas.cpp (original)
+++ cfe/trunk/test/Misc/ast-print-pragmas.cpp Thu Aug  2 18:21:16 2018
@@ -1,11 +1,8 @@
 // RUN: %clang_cc1 -ast-print %s -o - | FileCheck %s
 // RUN: %clang_cc1 -DMS_EXT -fsyntax-only -fms-extensions %s -triple 
x86_64-pc-win32 -ast-print | FileCheck %s --check-prefix=MS-EXT
 
-// FIXME: A bug in ParsedAttributes causes the order of the attributes to be
-// reversed. The checks are consequently in the reverse order below.
-
-// CHECK: #pragma clang loop interleave_count(8){{$}}
-// CHECK-NEXT: #pragma clang loop vectorize_width(4)
+// CHECK: #pragma clang loop vectorize_width(4)
+// CHECK-NEXT: #pragma clang loop interleave_count(8){{$}}
 
 void test(int *List, int Length) {
   int i = 0;
@@ -17,9 +14,9 @@ void test(int *List, int Length) {
     i++;
   }
 
-// CHECK: #pragma clang loop interleave(disable)
+// CHECK: #pragma clang loop distribute(disable)
 // CHECK-NEXT: #pragma clang loop vectorize(enable)
-// CHECK-NEXT: #pragma clang loop distribute(disable)
+// CHECK-NEXT: #pragma clang loop interleave(disable)
 
 #pragma clang loop distribute(disable)
 #pragma clang loop vectorize(enable)
@@ -30,9 +27,9 @@ void test(int *List, int Length) {
     i++;
   }
 
-// CHECK: #pragma clang loop interleave(enable)
+// CHECK: #pragma clang loop distribute(enable)
 // CHECK-NEXT: #pragma clang loop vectorize(disable)
-// CHECK-NEXT: #pragma clang loop distribute(enable)
+// CHECK-NEXT: #pragma clang loop interleave(enable)
 
 #pragma clang loop distribute(enable)
 #pragma clang loop vectorize(disable)
@@ -52,8 +49,8 @@ void test_nontype_template_param(int *Li
   }
 }
 
-// CHECK: #pragma clang loop interleave_count(I)
 // CHECK: #pragma clang loop vectorize_width(V)
+// CHECK: #pragma clang loop interleave_count(I)
 
 void test_templates(int *List, int Length) {
   test_nontype_template_param<2, 4>(List, Length);

Modified: cfe/trunk/test/PCH/pragma-loop.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/pragma-loop.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/PCH/pragma-loop.cpp (original)
+++ cfe/trunk/test/PCH/pragma-loop.cpp Thu Aug  2 18:21:16 2018
@@ -1,26 +1,23 @@
 // RUN: %clang_cc1 -emit-pch -o %t.a %s
 // RUN: %clang_cc1 -include-pch %t.a %s -ast-print -o - | FileCheck %s
 
-// FIXME: A bug in ParsedAttributes causes the order of the attributes to be
-// reversed. The checks are consequently in the reverse order below.
-
-// CHECK: #pragma clang loop unroll_count(16){{$}}
-// CHECK: #pragma clang loop interleave_count(8)
 // CHECK: #pragma clang loop vectorize_width(4)
-// CHECK: #pragma clang loop distribute(enable)
-// CHECK: #pragma clang loop unroll(disable)
-// CHECK: #pragma clang loop interleave(disable)
+// CHECK: #pragma clang loop interleave_count(8)
+// CHECK: #pragma clang loop unroll_count(16){{$}}
 // CHECK: #pragma clang loop vectorize(enable)
-// CHECK: #pragma clang loop distribute(disable)
-// CHECK: #pragma clang loop unroll(full)
-// CHECK: #pragma clang loop interleave(enable)
+// CHECK: #pragma clang loop interleave(disable)
+// CHECK: #pragma clang loop unroll(disable)
+// CHECK: #pragma clang loop distribute(enable)
 // CHECK: #pragma clang loop vectorize(disable)
+// CHECK: #pragma clang loop interleave(enable)
+// CHECK: #pragma clang loop unroll(full)
+// CHECK: #pragma clang loop distribute(disable)
 // FIXME: "#pragma unroll (enable)" is invalid and is not the input source.
 // CHECK: #pragma unroll (enable){{$}}
 // CHECK: #pragma unroll (32){{$}}
 // CHECK: #pragma nounroll{{$}}
-// CHECK: #pragma clang loop interleave_count(I)
 // CHECK: #pragma clang loop vectorize_width(V)
+// CHECK: #pragma clang loop interleave_count(I)
 
 #ifndef HEADER
 #define HEADER

Modified: cfe/trunk/test/Parser/pragma-loop-safety.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/pragma-loop-safety.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Parser/pragma-loop-safety.cpp (original)
+++ cfe/trunk/test/Parser/pragma-loop-safety.cpp Thu Aug  2 18:21:16 2018
@@ -25,10 +25,10 @@ void test(int *List, int Length) {
     List[i] = i;
   }
 
-/* expected-error {{duplicate directives 'vectorize(assume_safety)' and 
'vectorize(enable)'}} */ #pragma clang loop vectorize(enable)
-#pragma clang loop vectorize(assume_safety)
-/* expected-error {{duplicate directives 'interleave(assume_safety)' and 
'interleave(enable)'}} */ #pragma clang loop interleave(enable)
-#pragma clang loop interleave(assume_safety)
+#pragma clang loop vectorize(enable)
+/* expected-error {{duplicate directives 'vectorize(enable)' and 
'vectorize(assume_safety)'}} */ #pragma clang loop vectorize(assume_safety)
+#pragma clang loop interleave(enable)
+/* expected-error {{duplicate directives 'interleave(enable)' and 
'interleave(assume_safety)'}} */ #pragma clang loop interleave(assume_safety)
   while (i-9 < Length) {
     List[i] = i;
   }

Modified: cfe/trunk/test/Parser/pragma-loop.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/pragma-loop.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Parser/pragma-loop.cpp (original)
+++ cfe/trunk/test/Parser/pragma-loop.cpp Thu Aug  2 18:21:16 2018
@@ -231,51 +231,50 @@ const int VV = 4;
 // of the next three tests rather than the last, and the order of the kinds
 // is also reversed.
 
-/* expected-error {{incompatible directives 'vectorize(disable)' and 
'vectorize_width(4)'}} */ #pragma clang loop vectorize_width(4)
-#pragma clang loop vectorize(disable)
-/* expected-error {{incompatible directives 'interleave(disable)' and 
'interleave_count(4)'}} */ #pragma clang loop interleave_count(4)
-#pragma clang loop interleave(disable)
-/* expected-error {{incompatible directives 'unroll(disable)' and 
'unroll_count(4)'}} */ #pragma clang loop unroll_count(4)
-#pragma clang loop unroll(disable)
+#pragma clang loop vectorize_width(4)
+/* expected-error {{incompatible directives 'vectorize(disable)' and 
'vectorize_width(4)'}} */ #pragma clang loop vectorize(disable)
+#pragma clang loop interleave_count(4)
+/* expected-error {{incompatible directives 'interleave(disable)' and 
'interleave_count(4)'}} */ #pragma clang loop interleave(disable)
+#pragma clang loop unroll_count(4)
+/* expected-error {{incompatible directives 'unroll(disable)' and 
'unroll_count(4)'}} */ #pragma clang loop unroll(disable)
   while (i-8 < Length) {
     List[i] = i;
   }
 
-/* expected-error {{duplicate directives 'vectorize(disable)' and 
'vectorize(enable)'}} */ #pragma clang loop vectorize(enable)
-#pragma clang loop vectorize(disable)
-/* expected-error {{duplicate directives 'interleave(disable)' and 
'interleave(enable)'}} */ #pragma clang loop interleave(enable)
-#pragma clang loop interleave(disable)
-/* expected-error {{duplicate directives 'unroll(disable)' and 
'unroll(full)'}} */ #pragma clang loop unroll(full)
-#pragma clang loop unroll(disable)
-/* expected-error {{duplicate directives 'distribute(disable)' and 
'distribute(enable)'}} */ #pragma clang loop distribute(enable)
-#pragma clang loop distribute(disable)
+#pragma clang loop vectorize(enable)
+/* expected-error {{duplicate directives 'vectorize(enable)' and 
'vectorize(disable)'}} */ #pragma clang loop vectorize(disable)
+#pragma clang loop interleave(enable)
+/* expected-error {{duplicate directives 'interleave(enable)' and 
'interleave(disable)'}} */ #pragma clang loop interleave(disable)
+#pragma clang loop unroll(full)
+/* expected-error {{duplicate directives 'unroll(full)' and 
'unroll(disable)'}} */ #pragma clang loop unroll(disable)
+#pragma clang loop distribute(enable)
+/* expected-error {{duplicate directives 'distribute(enable)' and 
'distribute(disable)'}} */ #pragma clang loop distribute(disable)
   while (i-9 < Length) {
     List[i] = i;
   }
 
-/* expected-error {{incompatible directives 'vectorize(disable)' and 
'vectorize_width(4)'}} */ #pragma clang loop vectorize(disable)
-#pragma clang loop vectorize_width(4)
-/* expected-error {{incompatible directives 'interleave(disable)' and 
'interleave_count(4)'}} */ #pragma clang loop interleave(disable)
-#pragma clang loop interleave_count(4)
-/* expected-error {{incompatible directives 'unroll(disable)' and 
'unroll_count(4)'}} */ #pragma clang loop unroll(disable)
-#pragma clang loop unroll_count(4)
+#pragma clang loop vectorize(disable)
+/* expected-error {{incompatible directives 'vectorize(disable)' and 
'vectorize_width(4)'}} */ #pragma clang loop vectorize_width(4)
+#pragma clang loop interleave(disable)
+/* expected-error {{incompatible directives 'interleave(disable)' and 
'interleave_count(4)'}} */ #pragma clang loop interleave_count(4)
+#pragma clang loop unroll(disable)
+/* expected-error {{incompatible directives 'unroll(disable)' and 
'unroll_count(4)'}} */ #pragma clang loop unroll_count(4)
   while (i-10 < Length) {
     List[i] = i;
   }
 
-/* expected-error {{duplicate directives 'vectorize_width(4)' and 
'vectorize_width(8)'}} */ #pragma clang loop vectorize_width(8)
-#pragma clang loop vectorize_width(4)
-/* expected-error {{duplicate directives 'interleave_count(4)' and 
'interleave_count(8)'}} */ #pragma clang loop interleave_count(8)
-#pragma clang loop interleave_count(4)
-/* expected-error {{duplicate directives 'unroll_count(4)' and 
'unroll_count(8)'}} */ #pragma clang loop unroll_count(8)
-#pragma clang loop unroll_count(4)
+#pragma clang loop vectorize_width(8)
+/* expected-error {{duplicate directives 'vectorize_width(8)' and 
'vectorize_width(4)'}} */ #pragma clang loop vectorize_width(4)
+#pragma clang loop interleave_count(8)
+/* expected-error {{duplicate directives 'interleave_count(8)' and 
'interleave_count(4)'}} */ #pragma clang loop interleave_count(4)
+#pragma clang loop unroll_count(8)
+/* expected-error {{duplicate directives 'unroll_count(8)' and 
'unroll_count(4)'}} */ #pragma clang loop unroll_count(4)
   while (i-11 < Length) {
     List[i] = i;
   }
 
-
-/* expected-error {{incompatible directives 'unroll(full)' and 
'unroll_count(4)'}} */ #pragma clang loop unroll(full)
-#pragma clang loop unroll_count(4)
+#pragma clang loop unroll(full)
+/* expected-error {{incompatible directives 'unroll(full)' and 
'unroll_count(4)'}} */ #pragma clang loop unroll_count(4)
   while (i-11 < Length) {
     List[i] = i;
   }

Modified: cfe/trunk/test/Parser/pragma-unroll-and-jam.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/pragma-unroll-and-jam.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Parser/pragma-unroll-and-jam.cpp (original)
+++ cfe/trunk/test/Parser/pragma-unroll-and-jam.cpp Thu Aug  2 18:21:16 2018
@@ -50,8 +50,8 @@ void test(int *List, int Length, int Val
 #pragma nounroll_and_jam
 /* expected-error {{expected a for, while, or do-while loop to follow '#pragma 
nounroll_and_jam'}} */ int l = Length;
 
-/* expected-error {{incompatible directives '#pragma nounroll_and_jam' and 
'#pragma unroll_and_jam(4)'}} */ #pragma unroll_and_jam 4
-#pragma nounroll_and_jam
+#pragma unroll_and_jam 4
+/* expected-error {{incompatible directives '#pragma nounroll_and_jam' and 
'#pragma unroll_and_jam(4)'}} */ #pragma nounroll_and_jam
   for (int i = 0; i < Length; i++) {
     for (int j = 0; j < Length; j++) {
       List[i * Length + j] = Value;

Modified: cfe/trunk/test/Parser/pragma-unroll.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/pragma-unroll.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Parser/pragma-unroll.cpp (original)
+++ cfe/trunk/test/Parser/pragma-unroll.cpp Thu Aug  2 18:21:16 2018
@@ -55,56 +55,56 @@ void test(int *List, int Length) {
 #pragma nounroll
 /* expected-error {{expected a for, while, or do-while loop to follow '#pragma 
nounroll'}} */ int l = Length;
 
-/* expected-error {{incompatible directives 'unroll(disable)' and '#pragma 
unroll(4)'}} */ #pragma unroll 4
-#pragma clang loop unroll(disable)
+#pragma unroll 4
+/* expected-error {{incompatible directives 'unroll(disable)' and '#pragma 
unroll(4)'}} */ #pragma clang loop unroll(disable)
   while (i-10 < Length) {
     List[i] = i;
   }
 
-/* expected-error {{incompatible directives 'unroll(full)' and '#pragma 
unroll(4)'}} */ #pragma unroll(4)
-#pragma clang loop unroll(full)
+#pragma unroll(4)
+/* expected-error {{incompatible directives 'unroll(full)' and '#pragma 
unroll(4)'}} */ #pragma clang loop unroll(full)
   while (i-11 < Length) {
     List[i] = i;
   }
 
-/* expected-error {{incompatible directives 'unroll(enable)' and '#pragma 
unroll(4)'}} */ #pragma unroll(4)
-#pragma clang loop unroll(enable)
+#pragma unroll(4)
+/* expected-error {{incompatible directives 'unroll(enable)' and '#pragma 
unroll(4)'}} */ #pragma clang loop unroll(enable)
   while (i-11 < Length) {
     List[i] = i;
   }
 
-/* expected-error {{incompatible directives '#pragma unroll' and '#pragma 
unroll(4)'}} */ #pragma unroll(4)
-#pragma unroll
+#pragma unroll(4)
+/* expected-error {{incompatible directives '#pragma unroll' and '#pragma 
unroll(4)'}} */ #pragma unroll
   while (i-11 < Length) {
     List[i] = i;
   }
 
-/* expected-error {{incompatible directives '#pragma nounroll' and 
'unroll_count(4)'}} */ #pragma clang loop unroll_count(4)
-#pragma nounroll
+#pragma clang loop unroll_count(4)
+/* expected-error {{incompatible directives '#pragma nounroll' and 
'unroll_count(4)'}} */ #pragma nounroll
   while (i-12 < Length) {
     List[i] = i;
   }
 
-/* expected-error {{duplicate directives '#pragma nounroll' and '#pragma 
nounroll'}} */ #pragma nounroll
 #pragma nounroll
+/* expected-error {{duplicate directives '#pragma nounroll' and '#pragma 
nounroll'}} */ #pragma nounroll
   while (i-13 < Length) {
     List[i] = i;
   }
 
-/* expected-error {{duplicate directives '#pragma unroll' and '#pragma 
unroll'}} */ #pragma unroll
 #pragma unroll
+/* expected-error {{duplicate directives '#pragma unroll' and '#pragma 
unroll'}} */ #pragma unroll
   while (i-14 < Length) {
     List[i] = i;
   }
 
-/* expected-error {{duplicate directives 'unroll(full)' and '#pragma unroll'}} 
*/ #pragma unroll
-#pragma clang loop unroll(full)
+#pragma unroll
+/* expected-error {{duplicate directives '#pragma unroll' and 'unroll(full)'}} 
*/ #pragma clang loop unroll(full)
   while (i-15 < Length) {
     List[i] = i;
   }
 
-/* expected-error {{duplicate directives '#pragma unroll(4)' and '#pragma 
unroll(4)'}} */ #pragma unroll 4
-#pragma unroll(4)
+#pragma unroll 4
+/* expected-error {{duplicate directives '#pragma unroll(4)' and '#pragma 
unroll(4)'}} */ #pragma unroll(4)
   while (i-16 < Length) {
     List[i] = i;
   }

Modified: cfe/trunk/test/Sema/attr-availability-tvos.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-availability-tvos.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-availability-tvos.c (original)
+++ cfe/trunk/test/Sema/attr-availability-tvos.c Thu Aug  2 18:21:16 2018
@@ -27,10 +27,8 @@ void test_transcribed_availability() {
   f9(0);
 }
 
-__attribute__((availability(ios,introduced=9_0,deprecated=9_0,message="" ))) 
// expected-note{{previous attribute is here}} \
-  // expected-note{{previous attribute is here}}
-__attribute__((availability(ios,introduced=7_0))) // 
expected-warning{{availability does not match previous declaration}} \
-  // expected-warning{{availability does not match previous declaration}}
+__attribute__((availability(ios,introduced=9_0,deprecated=9_0,message="" ))) 
// expected-warning 2{{availability does not match previous declaration}}
+__attribute__((availability(ios,introduced=7_0)))                            
// expected-note 2{{previous attribute is here}}
 void f10(int);
 
 // Test tvOS specific attributes.

Modified: cfe/trunk/test/Sema/attr-availability.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-availability.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-availability.c (original)
+++ cfe/trunk/test/Sema/attr-availability.c Thu Aug  2 18:21:16 2018
@@ -64,8 +64,8 @@ enum {
 void f4(int) __attribute__((availability(ios,deprecated=3.0)));
 void f4(int) __attribute__((availability(ios,introduced=4.0))); // 
expected-warning {{feature cannot be deprecated in iOS version 3.0 before it 
was introduced in version 4.0; attribute ignored}}
 
-void f5(int) __attribute__((availability(ios,deprecated=3.0),
-                            availability(ios,introduced=4.0)));  // 
expected-warning {{feature cannot be deprecated in iOS version 3.0 before it 
was introduced in version 4.0; attribute ignored}}
+void f5(int) __attribute__((availability(ios,deprecated=3.0),   // 
expected-warning {{feature cannot be deprecated in iOS version 3.0 before it 
was introduced in version 4.0; attribute ignored}}
+                            availability(ios,introduced=4.0)));
 
 void f6(int) __attribute__((availability(ios,deprecated=3.0))); // 
expected-note {{previous attribute is here}}
 void f6(int) __attribute__((availability(ios,deprecated=4.0))); // 
expected-warning {{availability does not match previous declaration}}

Modified: cfe/trunk/test/Sema/attr-coldhot.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-coldhot.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-coldhot.c (original)
+++ cfe/trunk/test/Sema/attr-coldhot.c Thu Aug  2 18:21:16 2018
@@ -6,7 +6,7 @@ int bar() __attribute__((__cold__));
 int var1 __attribute__((__cold__)); // expected-warning{{'__cold__' attribute 
only applies to functions}}
 int var2 __attribute__((__hot__)); // expected-warning{{'__hot__' attribute 
only applies to functions}}
 
-int qux() __attribute__((__hot__)) __attribute__((__cold__)); // 
expected-error{{'__hot__' and 'cold' attributes are not compatible}} \
+int qux() __attribute__((__hot__)) __attribute__((__cold__)); // 
expected-error{{'__cold__' and 'hot' attributes are not compatible}} \
 // expected-note{{conflicting attribute is here}}
-int baz() __attribute__((__cold__)) __attribute__((__hot__)); // 
expected-error{{'__cold__' and 'hot' attributes are not compatible}} \
+int baz() __attribute__((__cold__)) __attribute__((__hot__)); // 
expected-error{{'__hot__' and 'cold' attributes are not compatible}} \
 // expected-note{{conflicting attribute is here}}

Modified: cfe/trunk/test/Sema/attr-disable-tail-calls.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-disable-tail-calls.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-disable-tail-calls.c (original)
+++ cfe/trunk/test/Sema/attr-disable-tail-calls.c Thu Aug  2 18:21:16 2018
@@ -1,10 +1,10 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
-void __attribute__((disable_tail_calls,naked)) foo1(int a) { // expected-error 
{{'disable_tail_calls' and 'naked' attributes are not compatible}} 
expected-note {{conflicting attribute is here}}
+void __attribute__((disable_tail_calls,naked)) foo1(int a) { // expected-error 
{{'naked' and 'disable_tail_calls' attributes are not compatible}} 
expected-note {{conflicting attribute is here}}
   __asm__("");
 }
 
-void __attribute__((naked,disable_tail_calls)) foo2(int a) { // expected-error 
{{'naked' and 'disable_tail_calls' attributes are not compatible}} 
expected-note {{conflicting attribute is here}}
+void __attribute__((naked,disable_tail_calls)) foo2(int a) { // expected-error 
{{'disable_tail_calls' and 'naked' attributes are not compatible}} 
expected-note {{conflicting attribute is here}}
   __asm__("");
 }
 

Modified: cfe/trunk/test/Sema/attr-long-call.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-long-call.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-long-call.c (original)
+++ cfe/trunk/test/Sema/attr-long-call.c Thu Aug  2 18:21:16 2018
@@ -19,8 +19,8 @@ __attribute((near)) void foo6();
 __attribute((long_call, far)) void foo7();
 __attribute((short_call, near)) void foo11();
 
-__attribute((far, near)) void foo8(); // expected-error {{'far' and 'near' 
attributes are not compatible}} \
+__attribute((far, near)) void foo8(); // expected-error {{'near' and 'far' 
attributes are not compatible}} \
                                       // expected-note {{conflicting attribute 
is here}}
 
-__attribute((short_call, long_call)) void foo12(); // expected-error 
{{'short_call' and 'long_call' attributes are not compatible}} \
+__attribute((short_call, long_call)) void foo12(); // expected-error 
{{'long_call' and 'short_call' attributes are not compatible}} \
                                                    // expected-note 
{{conflicting attribute is here}}

Modified: cfe/trunk/test/Sema/attr-micromips.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-micromips.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-micromips.c (original)
+++ cfe/trunk/test/Sema/attr-micromips.c Thu Aug  2 18:21:16 2018
@@ -6,9 +6,9 @@ __attribute__((micromips(1))) void foo2(
 __attribute((nomicromips)) int a; // expected-error {{attribute only applies 
to functions}}
 __attribute((micromips)) int b;   // expected-error {{attribute only applies 
to functions}}
 
-__attribute__((micromips,mips16)) void foo5();  // expected-error 
{{'micromips' and 'mips16' attributes are not compatible}} \
+__attribute__((micromips,mips16)) void foo5();  // expected-error {{'mips16' 
and 'micromips' attributes are not compatible}} \
                                                 // expected-note {{conflicting 
attribute is here}}
-__attribute__((mips16,micromips)) void foo6();  // expected-error {{'mips16' 
and 'micromips' attributes are not compatible}} \
+__attribute__((mips16,micromips)) void foo6();  // expected-error 
{{'micromips' and 'mips16' attributes are not compatible}} \
                                                 // expected-note {{conflicting 
attribute is here}}
 
 __attribute((micromips)) void foo7();

Modified: cfe/trunk/test/Sema/attr-notail.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-notail.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-notail.c (original)
+++ cfe/trunk/test/Sema/attr-notail.c Thu Aug  2 18:21:16 2018
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
-int callee0() __attribute__((not_tail_called,always_inline)); // 
expected-error{{'not_tail_called' and 'always_inline' attributes are not 
compatible}} \
+int callee0() __attribute__((not_tail_called,always_inline)); // 
expected-error{{'always_inline' and 'not_tail_called' attributes are not 
compatible}} \
 // expected-note{{conflicting attribute is here}}
-int callee1() __attribute__((always_inline,not_tail_called)); // 
expected-error{{'always_inline' and 'not_tail_called' attributes are not 
compatible}} \
+int callee1() __attribute__((always_inline,not_tail_called)); // 
expected-error{{'not_tail_called' and 'always_inline' attributes are not 
compatible}} \
 // expected-note{{conflicting attribute is here}}
 
 int foo(int a) {

Modified: cfe/trunk/test/Sema/attr-ownership.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-ownership.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-ownership.c (original)
+++ cfe/trunk/test/Sema/attr-ownership.c Thu Aug  2 18:21:16 2018
@@ -16,11 +16,11 @@ void *f11(float i) __attribute__((owners
 void *f12(float i, int k, int f, int *j) __attribute__((ownership_returns(foo, 
4)));  // expected-error {{'ownership_returns' attribute only applies to 
integer arguments}}
 
 void f13(int *i, int *j) __attribute__((ownership_holds(foo, 1))) 
__attribute__((ownership_takes(foo, 2)));
-void f14(int i, int j, int *k) __attribute__((ownership_holds(foo, 3))) 
__attribute__((ownership_takes(foo, 3)));  // expected-error 
{{'ownership_holds' and 'ownership_takes' attributes are not compatible}}
+void f14(int i, int j, int *k) __attribute__((ownership_holds(foo, 3))) 
__attribute__((ownership_takes(foo, 3)));  // expected-error 
{{'ownership_takes' and 'ownership_holds' attributes are not compatible}}
 
 void f15(int, int)
-  __attribute__((ownership_returns(foo, 1)))  // expected-note {{declared with 
index 1 here}}
-  __attribute__((ownership_returns(foo, 2))); // expected-error 
{{'ownership_returns' attribute index does not match; here it is 2}}
+  __attribute__((ownership_returns(foo, 1)))  // expected-error 
{{'ownership_returns' attribute index does not match; here it is 1}}
+  __attribute__((ownership_returns(foo, 2))); // expected-note {{declared with 
index 2 here}}
 void f16(int *i, int *j) __attribute__((ownership_holds(foo, 1))) 
__attribute__((ownership_holds(foo, 1))); // OK, same index
 void f17(void*) __attribute__((ownership_takes(__, 1)));
 void f18() __attribute__((ownership_takes(foo, 1)));  // expected-warning 
{{'ownership_takes' attribute only applies to non-K&R-style functions}}

Modified: cfe/trunk/test/Sema/attr-ownership.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-ownership.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-ownership.cpp (original)
+++ cfe/trunk/test/Sema/attr-ownership.cpp Thu Aug  2 18:21:16 2018
@@ -2,6 +2,6 @@
 
 class C {
   void f(int, int)
-      __attribute__((ownership_returns(foo, 2)))  // expected-note {{declared 
with index 2 here}}
-      __attribute__((ownership_returns(foo, 3))); // expected-error 
{{'ownership_returns' attribute index does not match; here it is 3}}
+      __attribute__((ownership_returns(foo, 2)))  // expected-error 
{{'ownership_returns' attribute index does not match; here it is 2}}
+      __attribute__((ownership_returns(foo, 3))); // expected-note {{declared 
with index 3 here}}
 };

Modified: cfe/trunk/test/Sema/attr-print.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-print.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-print.c (original)
+++ cfe/trunk/test/Sema/attr-print.c Thu Aug  2 18:21:16 2018
@@ -22,15 +22,13 @@ int * __ptr32 p32;
 // CHECK: int * __ptr64 p64;
 int * __ptr64 p64;
 
-// TODO: the Type Printer has no way to specify the order to print attributes
-// in, and so it currently always prints them in reverse order. Fix this.
-// CHECK: int * __ptr32 __uptr p32_2;
+// CHECK: int * __uptr __ptr32 p32_2;
 int * __uptr __ptr32 p32_2;
 
-// CHECK: int * __ptr64 __sptr p64_2;
+// CHECK: int * __sptr __ptr64 p64_2;
 int * __sptr __ptr64 p64_2;
 
-// CHECK: int * __ptr32 __uptr p32_3;
+// CHECK: int * __uptr __ptr32 p32_3;
 int * __uptr __ptr32 p32_3;
 
 // CHECK: int * __sptr * __ptr32 ppsp32;

Modified: cfe/trunk/test/Sema/attr-visibility.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-visibility.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-visibility.c (original)
+++ cfe/trunk/test/Sema/attr-visibility.c Thu Aug  2 18:21:16 2018
@@ -15,8 +15,8 @@ struct test5;
 struct __attribute__((visibility("hidden"))) test5; // expected-note 
{{previous attribute is here}}
 struct __attribute__((visibility("default"))) test5; // expected-error 
{{visibility does not match previous declaration}}
 
-void test6() __attribute__((visibility("hidden"), // expected-note {{previous 
attribute is here}}
-                            visibility("default"))); // expected-error 
{{visibility does not match previous declaration}}
+void test6() __attribute__((visibility("default"), // expected-error 
{{visibility does not match previous declaration}}
+                            visibility("hidden"))); // expected-note 
{{previous attribute is here}}
 
 extern int test7 __attribute__((visibility("default"))); // expected-note 
{{previous attribute is here}}
 extern int test7 __attribute__((visibility("hidden"))); // expected-error 
{{visibility does not match previous declaration}}

Modified: cfe/trunk/test/Sema/internal_linkage.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/internal_linkage.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/internal_linkage.c (original)
+++ cfe/trunk/test/Sema/internal_linkage.c Thu Aug  2 18:21:16 2018
@@ -1,9 +1,9 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -fdouble-square-bracket-attributes %s
 
 int var __attribute__((internal_linkage));
-int var2 __attribute__((internal_linkage,common)); // 
expected-error{{'internal_linkage' and 'common' attributes are not compatible}} 
\
+int var2 __attribute__((internal_linkage,common)); // expected-error{{'common' 
and 'internal_linkage' attributes are not compatible}} \
                                                    // 
expected-note{{conflicting attribute is here}}
-int var3 __attribute__((common,internal_linkage)); // expected-error{{'common' 
and 'internal_linkage' attributes are not compatible}} \
+int var3 __attribute__((common,internal_linkage)); // 
expected-error{{'internal_linkage' and 'common' attributes are not compatible}} 
\
                                                    // 
expected-note{{conflicting attribute is here}}
 
 int var4 __attribute__((common)); // expected-error{{'common' and 
'internal_linkage' attributes are not compatible}} \

Modified: cfe/trunk/test/Sema/mips-interrupt-attr.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/mips-interrupt-attr.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/mips-interrupt-attr.c (original)
+++ cfe/trunk/test/Sema/mips-interrupt-attr.c Thu Aug  2 18:21:16 2018
@@ -19,11 +19,11 @@ __attribute__((interrupt(""))) void food
 
 __attribute__((interrupt)) int foob() {return 0;} // expected-warning {{MIPS 
'interrupt' attribute only applies to functions that have a 'void' return type}}
 __attribute__((interrupt())) void fooc(int a) {} // expected-warning {{MIPS 
'interrupt' attribute only applies to functions that have no parameters}}
-__attribute__((interrupt,mips16)) void fooe() {} // expected-error 
{{'interrupt' and 'mips16' attributes are not compatible}} \
+__attribute__((interrupt,mips16)) void fooe() {} // expected-error {{'mips16' 
and 'interrupt' attributes are not compatible}} \
                                                  // expected-note 
{{conflicting attribute is here}}
-__attribute__((mips16,interrupt)) void foof() {} // expected-error {{'mips16' 
and 'interrupt' attributes are not compatible}} \
+__attribute__((mips16,interrupt)) void foof() {} // expected-error 
{{'interrupt' and 'mips16' attributes are not compatible}} \
                                                  // expected-note 
{{conflicting attribute is here}}
-__attribute__((interrupt)) __attribute__ ((mips16)) void foo10() {} // 
expected-error {{'interrupt' and 'mips16' attributes are not compatible}} \
+__attribute__((interrupt)) __attribute__ ((mips16)) void foo10() {} // 
expected-error {{'mips16' and 'interrupt' attributes are not compatible}} \
                                                                     // 
expected-note {{conflicting attribute is here}}
-__attribute__((mips16)) __attribute ((interrupt)) void foo11() {} // 
expected-error {{'mips16' and 'interrupt' attributes are not compatible}} \
+__attribute__((mips16)) __attribute ((interrupt)) void foo11() {} // 
expected-error {{'interrupt' and 'mips16' attributes are not compatible}} \
                                                                   // 
expected-note {{conflicting attribute is here}}

Modified: cfe/trunk/test/Sema/nullability.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/nullability.c?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/Sema/nullability.c (original)
+++ cfe/trunk/test/Sema/nullability.c Thu Aug  2 18:21:16 2018
@@ -20,8 +20,8 @@ typedef int * _Null_unspecified null_uns
 typedef int * _Nonnull _Nonnull redundant_1; // expected-warning{{duplicate 
nullability specifier '_Nonnull'}}
 
 // Conflicting nullability type specifiers.
-typedef int * _Nonnull _Nullable conflicting_1; // expected-error{{nullability 
specifier '_Nonnull' conflicts with existing specifier '_Nullable'}}
-typedef int * _Null_unspecified _Nonnull conflicting_2; // 
expected-error{{nullability specifier '_Null_unspecified' conflicts with 
existing specifier '_Nonnull'}}
+typedef int * _Nonnull _Nullable conflicting_1; // expected-error{{nullability 
specifier '_Nullable' conflicts with existing specifier '_Nonnull'}}
+typedef int * _Null_unspecified _Nonnull conflicting_2; // 
expected-error{{nullability specifier '_Nonnull' conflicts with existing 
specifier '_Null_unspecified'}}
 
 // Redundant nullability specifiers via a typedef are okay.
 typedef nonnull_int_ptr _Nonnull redundant_okay_1;

Modified: cfe/trunk/test/SemaCXX/attr-print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-print.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/attr-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-print.cpp Thu Aug  2 18:21:16 2018
@@ -13,8 +13,8 @@ void foo() __attribute__((const));
 // CHECK: void bar() __attribute__((__const));
 void bar() __attribute__((__const));
 
-// FIXME: Print this with correct format and order.
-// CHECK: void foo1() __attribute__((pure)) __attribute__((noinline));
+// FIXME: Print this with correct format.
+// CHECK: void foo1() __attribute__((noinline)) __attribute__((pure));
 void foo1() __attribute__((noinline, pure));
 
 // CHECK: typedef int Small1 __attribute__((mode(byte)));

Modified: cfe/trunk/test/SemaCXX/ms-uuid.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ms-uuid.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/ms-uuid.cpp (original)
+++ cfe/trunk/test/SemaCXX/ms-uuid.cpp Thu Aug  2 18:21:16 2018
@@ -62,14 +62,14 @@ class __declspec(uuid("110000A0-0000-000
 [uuid("220000A0-0000-0000-C000-000000000049")] class C4 {};
 
 // Both cl and clang-cl error out on this:
-// expected-note@+1 {{previous uuid specified here}}
-class __declspec(uuid("000000A0-0000-0000-C000-000000000049"))
 // expected-error@+1 {{uuid does not match previous declaration}}
+class __declspec(uuid("000000A0-0000-0000-C000-000000000049"))
+// expected-note@+1 {{previous uuid specified here}}
       __declspec(uuid("110000A0-0000-0000-C000-000000000049")) C5;
 
-// expected-note@+1 {{previous uuid specified here}}
-[uuid("000000A0-0000-0000-C000-000000000049"),
 // expected-error@+1 {{uuid does not match previous declaration}}
+[uuid("000000A0-0000-0000-C000-000000000049"),
+// expected-note@+1 {{previous uuid specified here}}
  uuid("110000A0-0000-0000-C000-000000000049")] class C6;
 
 // cl doesn't diagnose having one uuid each as []-style attributes and as

Modified: cfe/trunk/test/SemaObjC/nullability.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/nullability.m?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/nullability.m (original)
+++ cfe/trunk/test/SemaObjC/nullability.m Thu Aug  2 18:21:16 2018
@@ -36,14 +36,14 @@ __attribute__((objc_root_class))
 
 - (nonnull NSFoo **)invalidMethod1; // expected-error{{nullability keyword 
'nonnull' cannot be applied to multi-level pointer type 'NSFoo **'}}
 // expected-note@-1{{use nullability type specifier '_Nonnull' to affect the 
innermost pointer type of 'NSFoo **'}}
-- (nonnull NSFoo * _Nullable)conflictingMethod1; // 
expected-error{{nullability specifier '_Nullable' conflicts with existing 
specifier '_Nonnull'}}
-- (nonnull NSFoo * _Nonnull)redundantMethod1; // expected-warning{{duplicate 
nullability specifier '_Nonnull'}}
+- (nonnull NSFoo * _Nullable)conflictingMethod1; // 
expected-error{{nullability specifier 'nonnull' conflicts with existing 
specifier '_Nullable'}}
+- (nonnull NSFoo * _Nonnull)redundantMethod1; // expected-warning{{duplicate 
nullability specifier 'nonnull'}}
 
 @property(nonnull,retain) NSFoo *property1;
 @property(nullable,assign) NSFoo ** invalidProperty1; // 
expected-error{{nullability keyword 'nullable' cannot be applied to multi-level 
pointer type 'NSFoo **'}}
 // expected-note@-1{{use nullability type specifier '_Nullable' to affect the 
innermost pointer type of 'NSFoo **'}}
-@property(null_unspecified,retain) NSFoo * _Nullable conflictingProperty1; // 
expected-error{{nullability specifier '_Nullable' conflicts with existing 
specifier '_Null_unspecified'}}
-@property(retain,nonnull) NSFoo * _Nonnull redundantProperty1; // 
expected-warning{{duplicate nullability specifier '_Nonnull'}}
+@property(null_unspecified,retain) NSFoo * _Nullable conflictingProperty1; // 
expected-error{{nullability specifier 'null_unspecified' conflicts with 
existing specifier '_Nullable'}}
+@property(retain,nonnull) NSFoo * _Nonnull redundantProperty1; // 
expected-warning{{duplicate nullability specifier 'nonnull'}}
 
 @property(null_unspecified,retain,nullable) NSFoo *conflictingProperty3; // 
expected-error{{nullability specifier 'nullable' conflicts with existing 
specifier 'null_unspecified'}}
 @property(nullable,retain,nullable) NSFoo *redundantProperty3; // 
expected-warning{{duplicate nullability specifier 'nullable'}}
@@ -53,8 +53,8 @@ __attribute__((objc_root_class))
 @property(nonnull,retain) NSFoo *property2;
 @property(nullable,assign) NSFoo ** invalidProperty2; // 
expected-error{{nullability keyword 'nullable' cannot be applied to multi-level 
pointer type 'NSFoo **'}}
 // expected-note@-1{{use nullability type specifier '_Nullable' to affect the 
innermost pointer type of 'NSFoo **'}}
-@property(null_unspecified,retain) NSFoo * _Nullable conflictingProperty2; // 
expected-error{{nullability specifier '_Nullable' conflicts with existing 
specifier '_Null_unspecified'}}
-@property(retain,nonnull) NSFoo * _Nonnull redundantProperty2; // 
expected-warning{{duplicate nullability specifier '_Nonnull'}}
+@property(null_unspecified,retain) NSFoo * _Nullable conflictingProperty2; // 
expected-error{{nullability specifier 'null_unspecified' conflicts with 
existing specifier '_Nullable'}}
+@property(retain,nonnull) NSFoo * _Nonnull redundantProperty2; // 
expected-warning{{duplicate nullability specifier 'nonnull'}}
 @end
 
 void test_accepts_nonnull_null_pointer_literal(NSFoo *foo, _Nonnull NSBar 
*bar) {
@@ -157,7 +157,7 @@ __attribute__((objc_root_class))
 - (nullable instancetype)returnMe;
 + (nullable instancetype)returnInstanceOfMe;
 
-- (nonnull instancetype _Nullable)initWithBlah2:(nonnull id)blah; // 
expected-error {{nullability specifier '_Nullable' conflicts with existing 
specifier '_Nonnull'}}
+- (nonnull instancetype _Nullable)initWithBlah2:(nonnull id)blah; // 
expected-error {{nullability specifier 'nonnull' conflicts with existing 
specifier '_Nullable'}}
 - (instancetype _Nullable)returnMe2;
 + (_Nonnull instancetype)returnInstanceOfMe2;
 @end

Modified: cfe/trunk/test/SemaOpenCL/address-spaces.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/address-spaces.cl?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/SemaOpenCL/address-spaces.cl (original)
+++ cfe/trunk/test/SemaOpenCL/address-spaces.cl Thu Aug  2 18:21:16 2018
@@ -61,8 +61,8 @@ __generic int func_return_generic(void);
 
 void func_multiple_addr(void) {
   typedef __private int private_int_t;
-  __local __private int var1;   // expected-error {{multiple address spaces 
specified for type}}
-  __local __private int *var2;  // expected-error {{multiple address spaces 
specified for type}}
+  __private __local int var1;   // expected-error {{multiple address spaces 
specified for type}}
+  __private __local int *var2;  // expected-error {{multiple address spaces 
specified for type}}
   __local private_int_t var3;   // expected-error {{multiple address spaces 
specified for type}}
   __local private_int_t *var4;  // expected-error {{multiple address spaces 
specified for type}}
   __private private_int_t var5; // expected-warning {{multiple identical 
address spaces specified for type}}

Modified: cfe/trunk/test/SemaTemplate/attributes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/attributes.cpp?rev=338800&r1=338799&r2=338800&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/attributes.cpp (original)
+++ cfe/trunk/test/SemaTemplate/attributes.cpp Thu Aug  2 18:21:16 2018
@@ -55,11 +55,11 @@ namespace PR9049 {
 }
 
 // CHECK: FunctionTemplateDecl {{.*}} HasAnnotations
-// CHECK:   AnnotateAttr {{.*}} "ANNOTATE_BAR"
 // CHECK:   AnnotateAttr {{.*}} "ANNOTATE_FOO"
+// CHECK:   AnnotateAttr {{.*}} "ANNOTATE_BAR"
 // CHECK: FunctionDecl {{.*}} HasAnnotations
 // CHECK:   TemplateArgument type 'int'
-// CHECK:   AnnotateAttr {{.*}} "ANNOTATE_BAR"
 // CHECK:   AnnotateAttr {{.*}} "ANNOTATE_FOO"
+// CHECK:   AnnotateAttr {{.*}} "ANNOTATE_BAR"
 template<typename T> [[clang::annotate("ANNOTATE_FOO"), 
clang::annotate("ANNOTATE_BAR")]] void HasAnnotations();
 void UseAnnotations() { HasAnnotations<int>(); }


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to