This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb2936caf77e0: [clang] inheritance fix for nomerge attribute 
(authored by xbolva00).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119451/new/

https://reviews.llvm.org/D119451

Files:
  clang/include/clang/Basic/Attr.td
  clang/lib/Sema/SemaStmtAttr.cpp
  clang/test/Parser/stmt-attributes.c
  clang/test/Parser/stmt-attributes.m
  clang/test/Sema/attr-nomerge-ast.cpp
  clang/test/Sema/attr-nomerge.cpp

Index: clang/test/Sema/attr-nomerge.cpp
===================================================================
--- clang/test/Sema/attr-nomerge.cpp
+++ clang/test/Sema/attr-nomerge.cpp
@@ -6,7 +6,7 @@
   [[clang::nomerge]] bar();
   [[clang::nomerge(1, 2)]] bar(); // expected-error {{'nomerge' attribute takes no arguments}}
   int x;
-  [[clang::nomerge]] x = 10; // expected-warning {{nomerge attribute is ignored because there exists no call expression inside the statement}}
+  [[clang::nomerge]] x = 10; // expected-warning {{'nomerge' attribute is ignored because there exists no call expression inside the statement}}
 
   [[clang::nomerge]] label: bar(); // expected-error {{'nomerge' attribute only applies to functions and statements}}
 
Index: clang/test/Sema/attr-nomerge-ast.cpp
===================================================================
--- /dev/null
+++ clang/test/Sema/attr-nomerge-ast.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s
+
+[[clang::nomerge]] void func();
+[[clang::nomerge]] void func();
+void func();
+[[clang::nomerge]] void func() {}
+
+// CHECK: FunctionDecl {{.*}} func 'void ()'
+// CHECK-NEXT: NoMergeAttr
+// CHECK-NEXT: FunctionDecl {{.*}} func 'void ()'
+// CHECK-NEXT: NoMergeAttr
+// CHECK-NEXT: FunctionDecl {{.*}} func 'void ()'
+// CHECK-NEXT: NoMergeAttr {{.*}} Inherited
+// CHECK-NEXT: FunctionDecl {{.*}} func 'void ()'
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: NoMergeAttr
Index: clang/test/Parser/stmt-attributes.m
===================================================================
--- clang/test/Parser/stmt-attributes.m
+++ clang/test/Parser/stmt-attributes.m
@@ -29,13 +29,13 @@
   // expected-error@-3 {{expected identifier or '('}}
   // expected-note@-4 {{to match this '['}}
   __attribute__((nomerge)) [self foo];
-  // expected-warning@-1 {{nomerge attribute is ignored because there exists no call expression inside the statement}}
+  // expected-warning@-1 {{'nomerge' attribute is ignored because there exists no call expression inside the statement}}
   __attribute__((nomerge)) [getTest() foo];
 
   __attribute__(()) ^{};
   // expected-error@-1 {{expected identifier or '('}}
   __attribute__((nomerge)) ^{};
-  // expected-warning@-1 {{nomerge attribute is ignored because there exists no call expression inside the statement}}
+  // expected-warning@-1 {{'nomerge' attribute is ignored because there exists no call expression inside the statement}}
   __attribute__((nomerge)) ^{ [self foo]; }();
 
   __attribute__(()) @try {
@@ -49,9 +49,9 @@
   }
 
   __attribute__((nomerge)) (__bridge void *)self;
-  // expected-warning@-1 {{nomerge attribute is ignored because there exists no call expression inside the statement}}
+  // expected-warning@-1 {{'nomerge' attribute is ignored because there exists no call expression inside the statement}}
 
   __attribute__((nomerge)) self.hasFoobar;
-  // expected-warning@-1 {{nomerge attribute is ignored because there exists no call expression inside the statement}}
+  // expected-warning@-1 {{'nomerge' attribute is ignored because there exists no call expression inside the statement}}
 }
 @end
Index: clang/test/Parser/stmt-attributes.c
===================================================================
--- clang/test/Parser/stmt-attributes.c
+++ clang/test/Parser/stmt-attributes.c
@@ -80,7 +80,7 @@
   __attribute__((nomerge, unused)) bar(); // expected-error {{expected identifier or '('}}
   __attribute__((nomerge(1, 2))) bar();   // expected-error {{'nomerge' attribute takes no arguments}}
   int x;
-  __attribute__((nomerge)) x = 10; // expected-warning {{nomerge attribute is ignored because there exists no call expression inside the statement}}
+  __attribute__((nomerge)) x = 10; // expected-warning {{'nomerge' attribute is ignored because there exists no call expression inside the statement}}
 
   __attribute__((nomerge)) label : bar(); // expected-error {{'nomerge' attribute only applies to functions and statements}}
 }
Index: clang/lib/Sema/SemaStmtAttr.cpp
===================================================================
--- clang/lib/Sema/SemaStmtAttr.cpp
+++ clang/lib/Sema/SemaStmtAttr.cpp
@@ -202,7 +202,7 @@
 
   if (!CEF.foundCallExpr()) {
     S.Diag(St->getBeginLoc(), diag::warn_nomerge_attribute_ignored_in_stmt)
-        << NMA.getSpelling();
+        << A;
     return nullptr;
   }
 
Index: clang/include/clang/Basic/Attr.td
===================================================================
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1390,7 +1390,6 @@
 def NoMerge : DeclOrStmtAttr {
   let Spellings = [Clang<"nomerge">];
   let Documentation = [NoMergeDocs];
-  let InheritEvenIfAlreadyPresent = 1;
   let Subjects = SubjectList<[Function, Stmt], ErrorDiag,
                              "functions and statements">;
   let SimpleHandler = 1;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to