[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 05:21:52 PDT 2022


mboehme marked an inline comment as done.
mboehme added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:4633-4637
 Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS,
                                  RecordDecl *&AnonRecord) {
-  return ParsedFreeStandingDeclSpec(S, AS, DS, MultiTemplateParamsArg(), false,
+  return ParsedFreeStandingDeclSpec(S, AS, DS, ParsedAttributesView::none(),
+                                    MultiTemplateParamsArg(), false,
                                     AnonRecord);
----------------
aaron.ballman wrote:
> It's surprising that we don't need to update this interface as well; is that inconsistency desired?
This is OK because every caller of this overload happens to do `ProhibitAttributes(DeclAttrs)`.

But now that you bring this up, I realize that this is risky. What if we add another caller in the future that doesn’t do `ProhibitAttribubtes(DeclAttrs)`? And even in the current situation, I think it makes sense to be explicit that we’re passing an empty list of attributes.

So I’ve added the `DeclAttrs` parameter to this function too, and now pass `ParsedAttributesView::none()` at the callsites.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128499



More information about the cfe-commits mailing list