[PATCH] D147989: [clang] Fix Attribute Placement
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 12 06:09:44 PDT 2023
aaron.ballman added a comment.
Precommit CI has several failures introduced by this patch -- some test cases need to be fixed up (in addition to the new test coverage).
================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:3424
"attribute %0 is ignored, place it after "
- "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
+ "\"%select{class|struct|interface|union|enum|enum class}1\" to apply attribute to "
"type declaration">, InGroup<IgnoredAttributes>;
----------------
tbaeder wrote:
> "enum struct" is also possible in C++, so I think this needs to be covered as well.
If that turns out to be frustrating for some reason, we could perhaps reuse `class` or `struct` instead of adding `enum <X>` as another option. e.g.,
```
__attribute__((whatever)) // warning: attribute 'whatever' is ignored, place it after "class" to apply attribute to type declaration
enum class foo {
};
```
coupled with the insert caret and fix-it hint, it's pretty clear where to move the attribute to despite the warning not saying `enum class` specifically.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147989/new/
https://reviews.llvm.org/D147989
More information about the cfe-commits
mailing list