diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/FixIt/fixit-cxx11-attributes.cpp | 17 | ||||
-rw-r--r-- | clang/test/Parser/cxx11-base-spec-attributes.cpp | 10 | ||||
-rw-r--r-- | clang/test/Parser/cxx11-stmt-attributes.cpp | 40 | ||||
-rw-r--r-- | clang/test/Parser/objcxx11-attributes.mm | 4 |
4 files changed, 49 insertions, 22 deletions
diff --git a/clang/test/FixIt/fixit-cxx11-attributes.cpp b/clang/test/FixIt/fixit-cxx11-attributes.cpp index 7c8efcb8ec7..f28bdfc7cd9 100644 --- a/clang/test/FixIt/fixit-cxx11-attributes.cpp +++ b/clang/test/FixIt/fixit-cxx11-attributes.cpp @@ -32,3 +32,20 @@ namespace ClassSpecifier { // CHECK: fix-it:{{.*}}:{27:19-27:19} // CHECK: fix-it:{{.*}}:{29:5-29:31} } + +namespace BaseSpecifier { + struct base1 {}; + struct base2 {}; + class with_base_spec : public [[a]] // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:26-[[@LINE-1]]:26}:"[{{\[}}a]]" + // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:33-[[@LINE-2]]:39}:"" + virtual [[b]] base1, // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:26-[[@LINE-4]]:26}:"[{{\[}}b]]" + // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:34-[[@LINE-2]]:40}:"" + virtual [[c]] // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:26-[[@LINE-1]]:26}:"[{{\[}}c]]" + // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:34-[[@LINE-2]]:40}:"" + public [[d]] base2 {}; // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:26-[[@LINE-4]]:26}:"[{{\[}}d]]" + // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:33-[[@LINE-2]]:39}:"" +} diff --git a/clang/test/Parser/cxx11-base-spec-attributes.cpp b/clang/test/Parser/cxx11-base-spec-attributes.cpp new file mode 100644 index 00000000000..7338c5116c1 --- /dev/null +++ b/clang/test/Parser/cxx11-base-spec-attributes.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -std=c++11 %s -verify + +struct A {}; +struct B : [[]] A {}; +struct C : [[]] virtual A {}; +struct D : [[]] public virtual A {}; +struct E : public [[]] virtual A {}; // expected-error {{an attribute list cannot appear here}} +struct F : virtual [[]] public A {}; // expected-error {{an attribute list cannot appear here}} +struct G : [[noreturn]] A {}; // expected-error {{'noreturn' attribute cannot be applied to a base specifier}} +struct H : [[unknown::foobar]] A {}; // expected-warning {{unknown attribute 'foobar' ignored}} diff --git a/clang/test/Parser/cxx11-stmt-attributes.cpp b/clang/test/Parser/cxx11-stmt-attributes.cpp index a9958471d64..2f727a25bd7 100644 --- a/clang/test/Parser/cxx11-stmt-attributes.cpp +++ b/clang/test/Parser/cxx11-stmt-attributes.cpp @@ -27,11 +27,11 @@ void foo(int i) { [[unknown_attribute]] return; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} - alignas(8) ; // expected-warning {{attribute alignas cannot be specified on a statement}} - [[noreturn]] { } // expected-warning {{attribute noreturn cannot be specified on a statement}} - [[noreturn]] if (0) { } // expected-warning {{attribute noreturn cannot be specified on a statement}} - [[noreturn]] for (;;); // expected-warning {{attribute noreturn cannot be specified on a statement}} - [[noreturn]] do { // expected-warning {{attribute noreturn cannot be specified on a statement}} + alignas(8) ; // expected-error {{'alignas' attribute cannot be applied to a statement}} + [[noreturn]] { } // expected-error {{'noreturn' attribute cannot be applied to a statement}} + [[noreturn]] if (0) { } // expected-error {{'noreturn' attribute cannot be applied to a statement}} + [[noreturn]] for (;;); // expected-error {{'noreturn' attribute cannot be applied to a statement}} + [[noreturn]] do { // expected-error {{'noreturn' attribute cannot be applied to a statement}} [[unavailable]] continue; // expected-warning {{unknown attribute 'unavailable' ignored}} } while (0); [[unknown_attributqqq]] while (0); // expected-warning {{unknown attribute 'unknown_attributqqq' ignored}} @@ -42,7 +42,7 @@ void foo(int i) { [[unused]] switch (i) { // expected-warning {{unknown attribute 'unused' ignored}} [[uuid]] case 0: // expected-warning {{unknown attribute 'uuid' ignored}} [[visibility]] default: // expected-warning {{unknown attribute 'visibility' ignored}} - [[carries_dependency]] break; // expected-warning {{attribute carries_dependency cannot be specified on a statement}} + [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} } [[fastcall]] goto there; // expected-warning {{unknown attribute 'fastcall' ignored}} @@ -54,26 +54,26 @@ void foo(int i) { [[weakref]] return; // expected-warning {{unknown attribute 'weakref' ignored}} - [[carries_dependency]] ; // expected-warning {{attribute carries_dependency cannot be specified on a statement}} - [[carries_dependency]] { } // expected-warning {{attribute carries_dependency cannot be specified on a statement}} - [[carries_dependency]] if (0) { } // expected-warning {{attribute carries_dependency cannot be specified on a statement}} - [[carries_dependency]] for (;;); // expected-warning {{attribute carries_dependency cannot be specified on a statement}} - [[carries_dependency]] do { // expected-warning {{attribute carries_dependency cannot be specified on a statement}} - [[carries_dependency]] continue; // expected-warning {{attribute carries_dependency cannot be specified on a statement}} ignored}} + [[carries_dependency]] ; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] if (0) { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] for (;;); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] do { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] continue; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}} } while (0); - [[carries_dependency]] while (0); // expected-warning {{attribute carries_dependency cannot be specified on a statement}} + [[carries_dependency]] while (0); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} - [[carries_dependency]] switch (i) { // expected-warning {{attribute carries_dependency cannot be specified on a statement}} ignored}} - [[carries_dependency]] case 0: // expected-warning {{attribute carries_dependency cannot be specified on a statement}} - [[carries_dependency]] default: // expected-warning {{attribute carries_dependency cannot be specified on a statement}} - [[carries_dependency]] break; // expected-warning {{attribute carries_dependency cannot be specified on a statement}} + [[carries_dependency]] switch (i) { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}} + [[carries_dependency]] case 0: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] default: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} } - [[carries_dependency]] goto here; // expected-warning {{attribute carries_dependency cannot be specified on a statement}} + [[carries_dependency]] goto here; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} - [[carries_dependency]] try { // expected-warning {{attribute carries_dependency cannot be specified on a statement}} + [[carries_dependency]] try { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} } catch (...) { } - [[carries_dependency]] return; // expected-warning {{attribute carries_dependency cannot be specified on a statement}} + [[carries_dependency]] return; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} } diff --git a/clang/test/Parser/objcxx11-attributes.mm b/clang/test/Parser/objcxx11-attributes.mm index c72f26d1012..c1d8c4132dc 100644 --- a/clang/test/Parser/objcxx11-attributes.mm +++ b/clang/test/Parser/objcxx11-attributes.mm @@ -32,11 +32,11 @@ void f(X *noreturn) { // An attribute is OK. [[]]; [[int(), noreturn]]; // expected-warning {{unknown attribute 'int' ignored}} \ - // expected-warning {{attribute noreturn cannot be specified on a statement}} + // expected-error {{'noreturn' attribute cannot be applied to a statement}} [[class, test(foo 'x' bar),,,]]; // expected-warning {{unknown attribute 'test' ignored}}\ // expected-warning {{unknown attribute 'class' ignored}} - [[bitand, noreturn]]; // expected-warning {{attribute noreturn cannot be specified on a statement}} \ + [[bitand, noreturn]]; // expected-error {{'noreturn' attribute cannot be applied to a statement}} \ expected-warning {{unknown attribute 'bitand' ignored}} // FIXME: Suppress vexing parse warning |