You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 1, 2021. It is now read-only.
Determine the attribute subject for diagnostics based on declarative information in DeclNodes.td. This greatly reduces the number of enumerated values used for more complex diagnostics; these are now only required when the "attribute only applies to" diagnostic needs to be generated manually as part of semantic processing.
This also clarifies some terminology used by the diagnostic (methods -> Objective-C methods, fields -> non-static data members, etc).
Many of the tests needed to be updated in multiple places for the diagnostic wording tweaks. The first instance of the diagnostic for that attribute is fully specified and subsequent instances cut off the complete list (to make it easier if additional subjects are added in the future for the attribute).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319002 91177308-0d34-0410-b5e6-96231b3b80d8
Copy file name to clipboardexpand all lines: test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp
+3-3
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,8 @@
7
7
[[carries_dependency]] voidf1(); // FIXME: warn here
8
8
[[carries_dependency]] intf2(); // ok
9
9
intf3(int param [[carries_dependency]]); // ok
10
-
[[carries_dependency]] int (*f4)(); // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
11
-
int (*f5 [[carries_dependency]])(); // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
10
+
[[carries_dependency]] int (*f4)(); // expected-error {{'carries_dependency' attribute only applies to parameters, Objective-C methods, and functions}}
11
+
int (*f5 [[carries_dependency]])(); // expected-error {{'carries_dependency' attribute only applies to}}
12
12
int (*f6)() [[carries_dependency]]; // expected-error {{'carries_dependency' attribute cannot be applied to types}}
13
13
int (*f7)(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}}
14
14
int (((f8)))(int n [[carries_dependency]]); // ok
@@ -21,7 +21,7 @@ struct S {
21
21
};
22
22
voidf() {
23
23
[[carries_dependency]] intf(int n [[carries_dependency]]); // ok
24
-
[[carries_dependency]] // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
24
+
[[carries_dependency]] // expected-error {{'carries_dependency' attribute only applies to}}
25
25
int (*p)(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}}
namespace[[nodiscard]] N {} // expected-warning {{'nodiscard' attribute only applies to functions, methods, enums, and classes}}
10
+
namespace[[nodiscard]] N {} // expected-warning {{'nodiscard' attribute only applies to Objective-C methods, enums, structs, unions, classes, functions, and function pointers}}
__attribute__((objc_runtime_name("MySecretNamespace.Message"))) // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}}
10
+
__attribute__((objc_runtime_name("MySecretNamespace.Message"))) // expected-error {{'objc_runtime_name' attribute only applies to Objective-C interfaces and Objective-C protocols}}
@property int MyProperty; // expected-error {{prefix attribute must be followed by an interface or protocol}}}}
15
15
16
-
- (int) getMyProperty __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}}
__declspec(uuid("000000A0-0000-0000-C000-000000000046")) int i; // expected-warning {{'uuid' attribute only applies to classes}}
54
+
__declspec(uuid("000000A0-0000-0000-C000-000000000046")) int i; // expected-warning {{'uuid' attribute only applies to structs, unions, classes, and enums}}
int__declspec(uuid("000000A0-0000-0000-C000-000000000046")) inappropriate_uuid; // expected-warning {{'uuid' attribute only applies to classes and enumerations}}
72
+
int__declspec(uuid("000000A0-0000-0000-C000-000000000046")) inappropriate_uuid; // expected-warning {{'uuid' attribute only applies to}}
Copy file name to clipboardexpand all lines: test/Sema/attr-capabilities.c
+2-2
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,8 @@ typedef union { int a; char* b; } __attribute__((capability("mutex"))) MutexUnio
11
11
// Test an invalid capability name
12
12
struct __attribute__((capability("wrong"))) IncorrectName {}; // expected-warning {{invalid capability name 'wrong'; capability name must be 'mutex' or 'role'}}
13
13
14
-
intTest1 __attribute__((capability("test1"))); // expected-error {{'capability' attribute only applies to structs, unions, and typedefs}}
15
-
intTest2 __attribute__((shared_capability("test2"))); // expected-error {{'shared_capability' attribute only applies to structs, unions, and typedefs}}
14
+
intTest1 __attribute__((capability("test1"))); // expected-error {{'capability' attribute only applies to structs, unions, classes, and typedefs}}
15
+
intTest2 __attribute__((shared_capability("test2"))); // expected-error {{'shared_capability' attribute only applies to structs, unions, classes, and typedefs}}
16
16
intTest3 __attribute__((acquire_capability("test3"))); // expected-warning {{'acquire_capability' attribute only applies to functions}}
17
17
intTest4 __attribute__((try_acquire_capability("test4"))); // expected-error {{'try_acquire_capability' attribute only applies to functions}}
18
18
intTest5 __attribute__((release_capability("test5"))); // expected-warning {{'release_capability' attribute only applies to functions}}
__attribute__((mode(QI))) intinvalid_func() { return1; } // expected-error{{'mode' attribute only applies to variables, enums, fields and typedefs}}
30
-
enuminvalid_enum { A1__attribute__((mode(QI))) }; // expected-error{{'mode' attribute only applies to variables, enums, fields and typedefs}}
29
+
__attribute__((mode(QI))) intinvalid_func() { return1; } // expected-error{{'mode' attribute only applies to variables, enums, typedefs, and non-static data members}}
30
+
enuminvalid_enum { A1__attribute__((mode(QI))) }; // expected-error{{'mode' attribute only applies to}}
Copy file name to clipboardexpand all lines: test/Sema/attr-nodebug.c
+1-1
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
inta __attribute__((nodebug));
4
4
5
-
voidb(intp __attribute__((nodebug))) { // expected-warning {{'nodebug' attribute only applies to variables and functions}}
5
+
voidb(intp __attribute__((nodebug))) { // expected-warning {{'nodebug' attribute only applies to functions, function pointers, Objective-C methods, and variables and functions}}
Copy file name to clipboardexpand all lines: test/Sema/attr-section.c
+2-2
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,15 @@ int y __attribute__((section(
10
10
11
11
// PR6007
12
12
voidtest() {
13
-
__attribute__((section("NEAR,x"))) intn1; // expected-error {{'section' attribute only applies to functions, methods, properties, and global variables}}
13
+
__attribute__((section("NEAR,x"))) intn1; // expected-error {{'section' attribute only applies to functions, global variables, Objective-C methods, and Objective-C properties}}
14
14
__attribute__((section("NEAR,x"))) staticintn2; // ok.
15
15
}
16
16
17
17
// pr9356
18
18
void __attribute__((section("foo,zed"))) test2(void); // expected-note {{previous attribute is here}}
19
19
void __attribute__((section("bar,zed"))) test2(void) {} // expected-warning {{section does not match previous declaration}}
20
20
21
-
enum__attribute__((section("NEAR,x"))) e { one }; // expected-error {{'section' attribute only applies to functions, methods, properties, and global variables}}
21
+
enum__attribute__((section("NEAR,x"))) e { one }; // expected-error {{'section' attribute only applies to}}
22
22
23
23
externinta; // expected-note {{previous declaration is here}}
0 commit comments