diff options
| author | Joel E. Denny <jdenny.ornl@gmail.com> | 2018-05-30 18:33:53 +0000 |
|---|---|---|
| committer | Joel E. Denny <jdenny.ornl@gmail.com> | 2018-05-30 18:33:53 +0000 |
| commit | 857613bc6ded429c9a4bb9e4a01839fc62a3e36a (patch) | |
| tree | 6324996b9425660da92f9c9aa2e4145ce6182d83 /clang/test/Sema | |
| parent | 2fbbffa4bf66efa3715fa9c80ef6c43e61bcedfb (diff) | |
| download | bcm5719-llvm-857613bc6ded429c9a4bb9e4a01839fc62a3e36a.tar.gz bcm5719-llvm-857613bc6ded429c9a4bb9e4a01839fc62a3e36a.zip | |
[AST] Fix loss of enum forward decl from decl context
For example, given:
enum __attribute__((deprecated)) T *p;
-ast-print produced:
enum T *p;
The attribute was lost because the enum forward decl was lost.
Another example is the loss of enum forward decls from C++ namespaces
(in MS compatibility mode).
The trouble was that the EnumDecl node was suppressed, as revealed by
-ast-dump. The suppression of the EnumDecl was intentional in
r116122, but I don't understand why. The suppression isn't needed for
the test suite to behave.
Reviewed by: rsmith
Differential Revision: https://reviews.llvm.org/D46846
llvm-svn: 333574
Diffstat (limited to 'clang/test/Sema')
| -rw-r--r-- | clang/test/Sema/ast-print.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/test/Sema/ast-print.c b/clang/test/Sema/ast-print.c index 92b317e00b0..7f675206e58 100644 --- a/clang/test/Sema/ast-print.c +++ b/clang/test/Sema/ast-print.c @@ -4,6 +4,8 @@ // RUN: echo >> %t.c "// expected""-warning@* {{use of GNU old-style field designator extension}}" // RUN: echo >> %t.c "// expected""-warning@* {{'EnumWithAttributes' is deprecated}}" // RUN: echo >> %t.c "// expected""-note@* {{'EnumWithAttributes' has been explicitly marked deprecated here}}" +// RUN: echo >> %t.c "// expected""-warning@* {{'EnumWithAttributes2' is deprecated}}" +// RUN: echo >> %t.c "// expected""-note@* {{'EnumWithAttributes2' has been explicitly marked deprecated here}}" // RUN: echo >> %t.c "// expected""-warning@* {{'EnumWithAttributes3' is deprecated}}" // RUN: echo >> %t.c "// expected""-note@* {{'EnumWithAttributes3' has been explicitly marked deprecated here}}" // RUN: %clang_cc1 -fsyntax-only %t.c -verify @@ -86,8 +88,7 @@ enum EnumWithAttributes { // expected-warning {{'EnumWithAttributes' is deprecat // CHECK-NEXT: } *EnumWithAttributesPtr; } __attribute__((deprecated)) *EnumWithAttributesPtr; // expected-note {{'EnumWithAttributes' has been explicitly marked deprecated here}} -// FIXME: If enum is forward-declared at file scope, attributes are lost. -// CHECK-LABEL: enum EnumWithAttributes2 *EnumWithAttributes2Ptr; +// CHECK-LABEL: enum __attribute__((deprecated(""))) EnumWithAttributes2 *EnumWithAttributes2Ptr; // expected-warning@+2 {{'EnumWithAttributes2' is deprecated}} // expected-note@+1 {{'EnumWithAttributes2' has been explicitly marked deprecated here}} enum __attribute__((deprecated)) EnumWithAttributes2 *EnumWithAttributes2Ptr; |

