tbaeder added inline comments.

================
Comment at: clang/lib/Parse/ParseDecl.cpp:4656-4657
       !getLangOpts().ObjC) {
-    ProhibitAttributes(attrs);
+    ProhibitCXX11Attributes(attrs, diag::err_attributes_not_allowed,
+                            /*DiagnoseEmptyAttrs=*/true);
     if (BaseType.isUsable())
----------------
aaron.ballman wrote:
> Test coverage for this change?
I did not add tests for these changes since they are NFC and already tested:
  1) We test that empty `[[]]` are not allowed for example in 
`clang/test/Parser/cxx0x-attributes.c:192`: `enum [[]] E1 e;`
  2) We test that GNU-style attributes are still allowed for example in 
`clang/test/Sema/ast-print.c:94`: `enum __attribute__((deprecated)) 
EnumWithAttributes2 *EnumWithAttributes2Ptr;`


================
Comment at: clang/lib/Parse/ParseDeclCXX.cpp:1936
     if (TUK != Sema::TUK_Declaration && TUK != Sema::TUK_Definition)
-      ProhibitAttributes(attrs);
+      ProhibitCXX11Attributes(attrs, diag::err_attributes_not_allowed,
+                              /* DiagnoseEmptyAttrs=*/true);
----------------
aaron.ballman wrote:
> Test coverage for this change?

1) We already test that empty `[[]]` is diagnosed for example in 
`clang/test/Parser/cxx0x-attributes.c:178`: `struct [[]] N::S s;`
2) We test that GNU-style attributes are not diagnosed for example in 
`clang/test/Sema/struct-decl.c:71`: `typedef struct __attribute__((noreturn)) 
PreserveAttributes PreserveAttributes_t;`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97362/new/

https://reviews.llvm.org/D97362

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to