[PATCH] D128499: [Clang] Fix: Restore warning inadvertently removed by D126061.
Martin Böhme via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 24 00:18:42 PDT 2022
mboehme created this revision.
Herald added a project: All.
mboehme requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Before D126061 <https://reviews.llvm.org/D126061>, Clang would warn about this code
struct X {
[[deprecated]] struct Y {};
};
with the warning
attribute 'deprecated' is ignored, place it after "struct" to apply attribute to type declaration
D126061 <https://reviews.llvm.org/D126061> inadvertently caused this warning to no longer be emitted. This patch
restores the previous behavior.
The reason for the bug is that after D126061 <https://reviews.llvm.org/D126061>, C++11 attributes applied to a
member declaration are no longer placed in `DS.getAttributes()` but are instead
tracked in a separate list (`DeclAttrs`). In the case of a free-standing
decl-specifier-seq, we would simply ignore the contents of this list. Instead,
we now pass the list on to `Sema::ParsedFreeStandingDeclSpec()` so that it can
issue the appropriate warning.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D128499
Files:
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Parse/ParseTemplate.cpp
clang/lib/Sema/SemaDecl.cpp
clang/test/SemaCXX/attr-declspec-ignored.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128499.439651.patch
Type: text/x-patch
Size: 8774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220624/2b3d5b38/attachment.bin>
More information about the cfe-commits
mailing list