summaryrefslogtreecommitdiff
path: root/test/CXX
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2017-11-26 20:01:12 +0000
committerAaron Ballman <aaron@aaronballman.com>2017-11-26 20:01:12 +0000
commitf3dc13021086ea1868536c072117c33b45f80584 (patch)
treec61c356e6645dc582831a19cdc8938584b1612cd /test/CXX
parentdace80474949dad7ff70ab721adadf47966fdeb7 (diff)
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
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp6
-rw-r--r--test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp2
2 files changed, 4 insertions, 4 deletions
diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp
index 9f7ef3ace9..6cf27af323 100644
--- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp
+++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp
@@ -7,8 +7,8 @@
[[carries_dependency]] void f1(); // FIXME: warn here
[[carries_dependency]] int f2(); // ok
int f3(int param [[carries_dependency]]); // ok
-[[carries_dependency]] int (*f4)(); // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
-int (*f5 [[carries_dependency]])(); // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
+[[carries_dependency]] int (*f4)(); // expected-error {{'carries_dependency' attribute only applies to parameters, Objective-C methods, and functions}}
+int (*f5 [[carries_dependency]])(); // expected-error {{'carries_dependency' attribute only applies to}}
int (*f6)() [[carries_dependency]]; // expected-error {{'carries_dependency' attribute cannot be applied to types}}
int (*f7)(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}}
int (((f8)))(int n [[carries_dependency]]); // ok
@@ -21,7 +21,7 @@ struct S {
};
void f() {
[[carries_dependency]] int f(int n [[carries_dependency]]); // ok
- [[carries_dependency]] // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
+ [[carries_dependency]] // expected-error {{'carries_dependency' attribute only applies to}}
int (*p)(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}}
}
diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp
index e7a2382412..4425416650 100644
--- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp
+++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp
@@ -7,4 +7,4 @@ struct [[nodiscard("Wrong")]] S3 {}; // expected-error {{'nodiscard' cannot have
[[nodiscard]] int f();
enum [[nodiscard]] E {};
-namespace [[nodiscard]] N {} // expected-warning {{'nodiscard' attribute only applies to functions, methods, enums, and classes}}
+namespace [[nodiscard]] N {} // expected-warning {{'nodiscard' attribute only applies to Objective-C methods, enums, structs, unions, classes, functions, and function pointers}}