[PATCH] D97362: [clang][parser] Allow attributes in explicit template instantiations
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 31 02:06:58 PDT 2021
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
More information about the cfe-commits
mailing list