]> granicus.if.org Git - clang/commitdiff
Append new attributes to the end of an AttributeList.
authorMichael Kruse <llvm@meinersbur.de>
Tue, 19 Jun 2018 23:46:52 +0000 (23:46 +0000)
committerMichael Kruse <llvm@meinersbur.de>
Tue, 19 Jun 2018 23:46:52 +0000 (23:46 +0000)
... 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, and therefore printed in the wrong order by
-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 effects, especially for
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 attribute's order was changed instead.

It also causes some 'previous occurrence here' hints to be textually
after the main marker. This typically happens when attributes are
merged, but are incompatible. 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 reversed. 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, which often is on the same line.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335084 91177308-0d34-0410-b5e6-96231b3b80d8

36 files changed:
include/clang/Sema/AttributeList.h
lib/AST/ItaniumMangle.cpp
lib/Parse/ParseDecl.cpp
lib/Sema/SemaOverload.cpp
lib/Serialization/ASTReaderDecl.cpp
test/Index/annotate-comments-availability-attrs.cpp
test/Index/complete-with-annotations.cpp
test/Misc/ast-print-pragmas.cpp
test/PCH/pragma-loop.cpp
test/Parser/pragma-loop-safety.cpp
test/Parser/pragma-loop.cpp
test/Parser/pragma-unroll.cpp
test/Sema/attr-availability-tvos.c
test/Sema/attr-availability.c
test/Sema/attr-coldhot.c
test/Sema/attr-disable-tail-calls.c
test/Sema/attr-long-call.c
test/Sema/attr-micromips.c
test/Sema/attr-notail.c
test/Sema/attr-ownership.c
test/Sema/attr-ownership.cpp
test/Sema/attr-print.c
test/Sema/attr-swiftcall.c
test/Sema/attr-target-mv.c
test/Sema/attr-visibility.c
test/Sema/internal_linkage.c
test/Sema/mips-interrupt-attr.c
test/Sema/ms_abi-sysv_abi.c
test/Sema/nullability.c
test/Sema/stdcall-fastcall.c
test/SemaCXX/attr-print.cpp
test/SemaCXX/attr-swiftcall.cpp
test/SemaCXX/decl-microsoft-call-conv.cpp
test/SemaCXX/ms-uuid.cpp
test/SemaOpenCL/address-spaces.cl
test/SemaTemplate/attributes.cpp

index dd15b7a2f56ea2bd0e364c9d6a97b7fd9db71d23..dcbd116aa16726c2d785d91c9fedc47ed82421d5 100644 (file)
@@ -764,8 +764,11 @@ public:
   void add(AttributeList *newAttr) {
     assert(newAttr);
     assert(newAttr->getNext() == nullptr);
-    newAttr->setNext(list);
-    list = newAttr;
+
+    // FIXME: AttributeList is a singly linked list, i.e. appending to the end
+    // requires walking to the last element. For adding n attributes, this
+    // requires O(n^2) time. However, AttributeLists should be very short.
+    addAllAtEnd(newAttr);
   }
 
   void addAll(AttributeList *newList) {
index 380cfc47ddd57ef5096db9d3c807ab49a3ce5afa..54ceffa026d69fcbcfa23f3ba36f03f269663320 100644 (file)
@@ -707,10 +707,8 @@ void CXXNameMangler::mangleFunctionEncodingBareType(const FunctionDecl *FD) {
   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)
index 9e4669a8720778ffcc7e5058c548db3d3c2b70a3..83bfd46d8931457bfd500e42b82a3ace86c0ef20 100644 (file)
@@ -1649,9 +1649,7 @@ void Parser::stripTypeAttributesOffDeclSpec(ParsedAttributesWithRange &Attrs,
   }
 
   // Find end of type attributes Attrs and add NewTypeAttributes in the same
-  // order they were in originally.  (Remember, in AttributeList things earlier
-  // in source order are later in the list, since new attributes are added to
-  // the front of the list.)
+  // order they were in originally.
   Attrs.addAllAtEnd(TypeAttrHead);
 }
 
index 45639a718caf90878af3741065c04e14852686b1..89cb9b53a478a4a8105391feefb0091e0d9a358a 100644 (file)
@@ -6189,24 +6189,6 @@ Sema::SelectBestMethod(Selector Sel, MultiExprArg Args, bool IsInstance,
   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,
@@ -6280,9 +6262,9 @@ convertArgsForAvailabilityChecks(Sema &S, FunctionDecl *Function, Expr *ThisArg,
 
 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);
@@ -6292,7 +6274,7 @@ EnableIfAttr *Sema::CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> Args,
   if (!convertArgsForAvailabilityChecks(
           *this, Function, /*ThisArg=*/nullptr, Args, Trap,
           /*MissingImplicitThis=*/true, DiscardedThis, ConvertedArgs))
-    return EnableIfAttrs[0];
+    return *EnableIfAttrs.begin();
 
   for (auto *EIA : EnableIfAttrs) {
     APValue Result;
@@ -8943,24 +8925,21 @@ static Comparison compareEnableIfAttrs(const Sema &S, const FunctionDecl *Cand1,
     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 (auto 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.
+    if (Cand1I == Cand1Attrs.end())
+      return Comparison::Worse;
+    auto Cand1A = Cand1I++;
+
     Cand1A->getCond()->Profile(Cand1ID, S.getASTContext(), true);
     Cand2A->getCond()->Profile(Cand2ID, S.getASTContext(), true);
     if (Cand1ID != Cand2ID)
index a1ce26d27ca4e6ea7c0d4f3380eb0668ee7141d2..0daf1b3bdb7760cf535e7bc0a77f5c44add6d1d6 100644 (file)
@@ -2804,36 +2804,25 @@ static bool hasSameOverloadableAttrs(const FunctionDecl *A,
   // 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.
index f31c4e16ccd63618003fe917d4b2d8dedfd6c4f6..2722c06fc8d93fde5d5b494c7d3594421ae0e1e4 100644 (file)
@@ -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)));
index 7bad8f1b7cbe0dfce3f026e89af9fc304c8b2a56..459bd9f57316e8a34e4f2c772dabdf4969ad2391 100644 (file)
@@ -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)
index f1a7b2479b6b6f15bf9e3589929ebad66be343c1..a87be2a3403f2656ad0eaef7d437f002af5ac469 100644 (file)
@@ -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 *List, int Length) {
   }
 }
 
-// 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);
index 7f443ddb034e77769f0e07ade02cd7eb78cb9ba1..b8079ff608e418cb3aabf9e155d6edd9277c29f8 100644 (file)
@@ -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
index ab87dcdcb63e6a5db5ee2e829c5e0c4133c82455..1393cf747498684ad8bd9c364f43c1e2a6c6db92 100644 (file)
@@ -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;
   }
index f42d196ce8bd3e82b7eb8ee9ceebe84b9a59aab9..3db0fc45968f74613331f007b451f44ad52eca10 100644 (file)
@@ -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;
   }
index b1d7798798317ec2200972fe7f23026f42368376..fb713812877e2b28544e0029f0e79451acf9cccf 100644 (file)
@@ -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;
   }
index 68337e49ce4475f3011971dc7e2241c11f1ac4a2..4f8c4588ec989f98d3c94801d17e7b53369b0d4d 100644 (file)
@@ -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.
index 1b8cbd256ce97f656cda895324a9131e763688fc..4a266382529a3937a1250aa0e95fe71a0a5a5f3b 100644 (file)
@@ -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}}
index 972f5a5266aa7d45052635bc3ea943eacd459346..a4b15822065c37e40612a32337fcdd18ffba16e0 100644 (file)
@@ -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}}
index e8f5bcc73ee87b9be241cd9c98472c06387c4c74..0545e951e60e2b64277fbea50dd289830c427e02 100644 (file)
@@ -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__("");
 }
 
index cd3de1bf9e418a513b81c88a9548a40316364cbe..e80f8fdd52a72a2471bde603f914c109ebe74e3b 100644 (file)
@@ -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}}
index fe587fa3db07824ed7b9c6bc3ba6db1693971759..27c9d3b54f6ad1ab0114967a7ce846f94751b529 100644 (file)
@@ -6,9 +6,9 @@ __attribute__((micromips(1))) void foo2();    // expected-error {{'micromips' at
 __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();
index 4d05fcf6f2c09dd9250f12f26343b8988a902eae..f65af47518d13ccf028a62a9a72da7d762f3d73e 100644 (file)
@@ -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) {
index ff6c7197df8d4acff3bfba40e2614773a16eadd5..5ce758d9f4ad066dbba45803ffe93ab99aa1cd92 100644 (file)
@@ -16,11 +16,11 @@ void *f11(float i) __attribute__((ownership_returns(foo, 1)));  // expected-erro
 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}}
index cde195ff0aa89b98ec35603a625d370f1bb8856b..7381285e2da488767f09a7514c70f02e6ca4333d 100644 (file)
@@ -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}}
 };
index 16b440d5d73a409306a18a7441e95e7e3d303936..645b8bc3e7c5dbd6608620c8f758bbd2e34c8e35 100644 (file)
@@ -24,13 +24,13 @@ 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;
index 0323f059bab501b3e9973199ea82606b674719cf..77cf1b314d4d7cadc7d760c6c6b032fa88266906 100644 (file)
@@ -9,7 +9,7 @@
 int notAFunction SWIFTCALL; // expected-warning {{'swiftcall' only applies to function types; type here is 'int'}}
 void variadic(int x, ...) SWIFTCALL; // expected-error {{variadic function cannot use swiftcall calling convention}}
 void unprototyped() SWIFTCALL; // expected-error {{function with no prototype cannot use the swiftcall calling convention}}
-void multiple_ccs(int x) SWIFTCALL __attribute__((vectorcall)); // expected-error {{vectorcall and swiftcall attributes are not compatible}}
+void multiple_ccs(int x) SWIFTCALL __attribute__((vectorcall)); // expected-error {{swiftcall and vectorcall attributes are not compatible}}
 void (*functionPointer)(void) SWIFTCALL;
 
 void indirect_result_nonswift(INDIRECT_RESULT void *out); // expected-error {{'swift_indirect_result' parameter can only be used with swiftcall calling convention}}
index 671adff5b0427d0e7a4ce00c6ffbfc3a10e7a1d3..e65f6486fb58bca15721fe50855c269cc1c0ead4 100644 (file)
@@ -95,7 +95,7 @@ void __attribute__((target("arch=sandybridge")))  addtl_attrs4(void);
 void __attribute__((used,target("arch=ivybridge")))  addtl_attrs4(void);
 
 int __attribute__((target("sse4.2"))) diff_cc(void);
-// expected-error@+1 {{multiversioned function declaration has a different calling convention}}
+// expected-error@+1 {{attribute 'target' multiversioning cannot be combined with other attributes}}
 __vectorcall int __attribute__((target("arch=sandybridge")))  diff_cc(void);
 
 int __attribute__((target("sse4.2"))) diff_ret(void);
index ed52ec2743f9568082155c6999dd9afae331df68..798d6dcd78fce4db9b69875362b53c3e2432501f 100644 (file)
@@ -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}}
index 57315d826e24222c31db7793f20a2240913ad01d..cc8039acd275cf2595183d7f983170ac4279e1da 100644 (file)
@@ -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}} \
index 17344b6edcf08b971cf626a96f88d6e5632d8922..7c5c9ddab5d6da99eb71b522977bf16b29013a1b 100644 (file)
@@ -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}}
index 35a5fad9ceb3ae91b5b6c82fd73be049622f047b..e97914d7dd7363b2bb936afe19c443351ba690f2 100644 (file)
@@ -6,9 +6,9 @@ int __attribute__((sysv_abi)) var2; // expected-warning{{'sysv_abi' only applies
 
 // Different CC qualifiers are not compatible
 // FIXME: Should say 'sysv_abi' instead of 'cdecl'
-void __attribute__((ms_abi, sysv_abi)) foo3(void); // expected-error{{cdecl and ms_abi attributes are not compatible}}
+void __attribute__((ms_abi, sysv_abi)) foo3(void); // expected-error{{ms_abi and cdecl attributes are not compatible}}
 void __attribute__((ms_abi)) foo4(); // expected-note{{previous declaration is here}}
 void __attribute__((sysv_abi)) foo4(void); // expected-error{{function declared 'cdecl' here was previously declared 'ms_abi'}}
 
-void bar(int i, int j) __attribute__((ms_abi, cdecl)); // expected-error{{cdecl and ms_abi attributes are not compatible}}
+void bar(int i, int j) __attribute__((ms_abi, cdecl)); // expected-error{{ms_abi and cdecl attributes are not compatible}}
 void bar2(int i, int j) __attribute__((sysv_abi, cdecl)); // no-error
index a0247e5af8b3e1288ba632f08de165ebbb137165..cc251257e4e0583ab812dc40d9d7f10856768f05 100644 (file)
@@ -20,8 +20,8 @@ typedef int * _Null_unspecified null_unspecified_int_ptr;
 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;
index 256f5588e6d251f17a8c749d8e07dd402848a621..e011b45518c30addad3c52acb0da6e0e9739b21e 100644 (file)
@@ -5,7 +5,7 @@ int __attribute__((stdcall)) var1; // expected-warning{{'stdcall' only applies t
 int __attribute__((fastcall)) var2; // expected-warning{{'fastcall' only applies to function types; type here is 'int'}}
 
 // Different CC qualifiers are not compatible
-void __attribute__((stdcall, fastcall)) foo3(void); // expected-error{{fastcall and stdcall attributes are not compatible}}
+void __attribute__((stdcall, fastcall)) foo3(void); // expected-error{{stdcall and fastcall attributes are not compatible}}
 void __attribute__((stdcall)) foo4(); // expected-note{{previous declaration is here}} expected-warning{{function with no prototype cannot use the stdcall calling convention}}
 void __attribute__((fastcall)) foo4(void); // expected-error{{function declared 'fastcall' here was previously declared 'stdcall'}}
 
index 960050bc7106afcf213caa55b25aec20a5f50bfc..b741574b125f91abcdc5734b8f6094f6a90c5547 100644 (file)
@@ -14,7 +14,7 @@ void foo() __attribute__((const));
 void bar() __attribute__((__const));
 
 // FIXME: Print this with correct format and order.
-// CHECK: void foo1() __attribute__((pure)) __attribute__((noinline));
+// CHECK: void foo1() __attribute__((noinline)) __attribute__((pure));
 void foo1() __attribute__((noinline, pure));
 
 // CHECK: typedef int Small1 __attribute__((mode(byte)));
index eb9538e3104478448efd4e39ba9ee1310a164307..be4d4e8f770b1860fa103af7d5e62dbe713724fe 100644 (file)
@@ -7,7 +7,7 @@
 
 int notAFunction SWIFTCALL; // expected-warning {{'swiftcall' only applies to function types; type here is 'int'}}
 void variadic(int x, ...) SWIFTCALL; // expected-error {{variadic function cannot use swiftcall calling convention}}
-void multiple_ccs(int x) SWIFTCALL __attribute__((vectorcall)); // expected-error {{vectorcall and swiftcall attributes are not compatible}}
+void multiple_ccs(int x) SWIFTCALL __attribute__((vectorcall)); // expected-error {{swiftcall and vectorcall attributes are not compatible}}
 void (*functionPointer)(void) SWIFTCALL;
 
 void indirect_result_nonswift(INDIRECT_RESULT void *out); // expected-error {{'swift_indirect_result' parameter can only be used with swiftcall calling convention}}
index acd9b0720b6202bb89cba6b8231b892d3bae1dbe..232549988e0b95fb81d2889a57dc0a749ae9f8a7 100644 (file)
@@ -161,7 +161,7 @@ void multi_attribute(int x) { __builtin_unreachable(); }
 // expected-error@+3 {{vectorcall and cdecl attributes are not compatible}}
 // expected-error@+2 {{stdcall and cdecl attributes are not compatible}}
 // expected-error@+1 {{fastcall and cdecl attributes are not compatible}}
-void __cdecl __cdecl __stdcall __cdecl __fastcall __vectorcall multi_cc(int x);
+void __vectorcall __fastcall __cdecl __stdcall __cdecl __cdecl multi_cc(int x);
 
 template <typename T> void __stdcall StdcallTemplate(T) {}
 template <> void StdcallTemplate<int>(int) {}
index 624ac0541db46721c02ef5f003ebe4caf786ee4f..c177570682f6b5ce5ed74bb8743bd98cf278e4ee 100644 (file)
@@ -62,14 +62,14 @@ class __declspec(uuid("110000A0-0000-0000-C000-000000000049")) C2_2;
 [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
index 97dd1f4f90b3e3f58b4ae83bde2b5634bc623869..2fec3e8647df3e75d350f32af04558cb9ad6fb66 100644 (file)
@@ -58,8 +58,8 @@ __generic int func_return_generic(void);    //expected-error {{return value cann
 
 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}}
 }
index 7634b937c906896c1b1829d3801bb902ba3a566d..7a04c4705bf27fb5bf85e6ec746d6a6701b25dea 100644 (file)
@@ -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>(); }