[PATCH] D147989: [clang] Fix Attribute Placement
Sam Tebbs via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 11 03:00:10 PDT 2023
samtebbs added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:58
using namespace sema;
-
+bool isEnumClass = false;
Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) {
----------------
This being global could lead to issues where one overwrites the other. I think a better approach would be to create another version of `GetDiagnosticTypeSpecifierID` that takes the DeclSpec, then this won't be needed.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:5305-5310
+ if (TypeSpecType == DeclSpec::TST_enum) {
+ if (const EnumDecl *ED = dyn_cast<EnumDecl>(DS.getRepAsDecl())) {
+ if (ED->isScopedUsingClassTag())
+ isEnumClass = true;
+ }
+ }
----------------
if you make a new `GetDiagnosticTypeSpecifierID` then you can check these conditions in that function instead of there and return 5 if they are all true, otherwise return `GetDiagnosticTypeSpecifierID(TypeSpecType)`.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:5313-5316
<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
for (const ParsedAttr &AL : DeclAttrs)
Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored)
<< AL << GetDiagnosticTypeSpecifierID(TypeSpecType);
----------------
Then use the new `GetDiagnosticTypeSpecifierID` here, passing `DS` instead of `TypeSpecType`.
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