Fix mismatched enum value name and diagnostic text.
authorDouglas Katzman <dougk@google.com>
Fri, 11 Nov 2016 16:51:40 +0000 (16:51 +0000)
committerDouglas Katzman <dougk@google.com>
Fri, 11 Nov 2016 16:51:40 +0000 (16:51 +0000)
ExpectedFunctionGlobalVarMethodOrProperty
would previously say "functions and global variables"
instead of "functions, methods, properties, and global variables"

The newly added ExpectedFunctionOrGlobalVariable
says "functions and global variables"

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

llvm-svn: 286599

clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/AttributeList.h
clang/test/Sema/attr-section.c

index 173c1749a4db6440eaacbe31aeff5693436c2f0f..46924959c2df81e94e1d70345840542bf0a90a1b 100644 (file)
@@ -382,7 +382,7 @@ def Alias : Attr {
   let Spellings = [GCC<"alias">];
   let Args = [StringArgument<"Aliasee">];
   let Subjects = SubjectList<[Function, GlobalVar], ErrorDiag,
-                             "ExpectedFunctionGlobalVarMethodOrProperty">;
+                             "ExpectedFunctionOrGlobalVar">;
   let Documentation = [Undocumented];
 }
 
@@ -1746,7 +1746,7 @@ def NoSanitizeSpecific : InheritableAttr {
                    GCC<"no_sanitize_thread">,
                    GNU<"no_sanitize_memory">];
   let Subjects = SubjectList<[Function, GlobalVar], ErrorDiag,
-        "ExpectedFunctionGlobalVarMethodOrProperty">;
+        "ExpectedFunctionOrGlobalVar">;
   let Documentation = [NoSanitizeAddressDocs, NoSanitizeThreadDocs,
                        NoSanitizeMemoryDocs];
   let ASTNode = 0;
index 4e7b664995560fe4749959a6dfa2c83c39eca537..cc08434f5d3b167fb75040482dadfef73e61d76f 100644 (file)
@@ -2599,6 +2599,7 @@ def warn_attribute_wrong_decl_type : Warning<
   "functions"
   "|unions"
   "|variables and functions"
+  "|functions and global variables"
   "|functions, variables, and Objective-C interfaces"
   "|functions and methods"
   "|parameters"
@@ -2629,7 +2630,7 @@ def warn_attribute_wrong_decl_type : Warning<
   "|functions, variables, classes, and Objective-C interfaces"
   "|Objective-C protocols"
   "|variables with static or thread storage duration"
-  "|functions and global variables"
+  "|functions, methods, properties, and global variables"
   "|structs, unions, and typedefs"
   "|structs and typedefs"
   "|interface or protocol declarations"
index 96653ef8ea49cafeb01dc301bf61a104cae9a3f3..0c56b3fa346973cec2746ebb544a06b76f34358b 100644 (file)
@@ -885,6 +885,7 @@ enum AttributeDeclKind {
   ExpectedFunction,
   ExpectedUnion,
   ExpectedVariableOrFunction,
+  ExpectedFunctionOrGlobalVar,
   ExpectedFunctionVariableOrObjCInterface,
   ExpectedFunctionOrMethod,
   ExpectedParameter,
index 812de067180cb2555a14044a7ebbdfb05fa4615a..c64b10d80ff64324010491576151bcee950357bd 100644 (file)
@@ -10,7 +10,7 @@ int y __attribute__((section(
 
 // PR6007
 void test() {
-  __attribute__((section("NEAR,x"))) int n1; // expected-error {{'section' attribute only applies to functions and global variables}}
+  __attribute__((section("NEAR,x"))) int n1; // expected-error {{'section' attribute only applies to functions, methods, properties, and global variables}}
   __attribute__((section("NEAR,x"))) static int n2; // ok.
 }
 
@@ -18,4 +18,4 @@ void test() {
 void __attribute__((section("foo,zed"))) test2(void); // expected-note {{previous attribute is here}}
 void __attribute__((section("bar,zed"))) test2(void) {} // expected-warning {{section does not match previous declaration}}
 
-enum __attribute__((section("NEAR,x"))) e { one }; // expected-error {{'section' attribute only applies to functions and global variables}}
+enum __attribute__((section("NEAR,x"))) e { one }; // expected-error {{'section' attribute only applies to functions, methods, properties, and global variables}}