[PATCH] D97271: [clang][parse] Remove dead ProhibitAttributes() call

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 23 04:29:33 PST 2021


tbaeder created this revision.
tbaeder added a reviewer: aaron.ballman.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Since `MaybeParseGNUAttributes()` only takes a `ParsedAttributes` and not a `ParsedAttributesWithRange`, the source range of `attrs` will always be invalid after calling `MaybeParseGNUAttributes()`. That means the call to `ProhibitAttributes()` removed in this patch will always simply do nothing.

The comment that's removed alongside the `ProhibitAttributes()` call seems to be incorrect as well since numerous tests use (and expect) GNU-style attributes in enum bodies.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97271

Files:
  clang/lib/Parse/ParseDecl.cpp


Index: clang/lib/Parse/ParseDecl.cpp
===================================================================
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -4771,7 +4771,6 @@
     // If attributes exist after the enumerator, parse them.
     ParsedAttributesWithRange attrs(AttrFactory);
     MaybeParseGNUAttributes(attrs);
-    ProhibitAttributes(attrs); // GNU-style attributes are prohibited.
     if (standardAttributesAllowed() && isCXX11AttributeSpecifier()) {
       if (getLangOpts().CPlusPlus)
         Diag(Tok.getLocation(), getLangOpts().CPlusPlus17


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97271.325740.patch
Type: text/x-patch
Size: 583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210223/770c4dcf/attachment.bin>


More information about the cfe-commits mailing list