[PATCH] D97371: [clang][parser] Remove questionable ProhibitAttributes() call in objc parsing

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 24 02:35:11 PST 2021


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

Clang uses GNU-style attributes in objc code in (for example, I guess?) `tests/Parser/stmt-attributes.m`:

  __attribute__((nomerge)) @try {
    [getTest() foo];
  } @finally {
  }

Once the `ProhibitAttributes()` call in question actually starts handling GNU-style attributes, these tests fail.

The call was introduced in c202b2809ac814bcae8553cd772ec4901fdb8441 by Richard Smith (I'll add him as a reviewer), but with a `TODO` comment stating that it might be incorrect.

I'm having a hard time finding any concrete information on whether GNU-style attributes on `@try`/`@catch` statements are allowed in objc, so maybe someone with more experience can comment?

Thanks,
Timm


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97371

Files:
  clang/lib/Parse/ParseStmt.cpp


Index: clang/lib/Parse/ParseStmt.cpp
===================================================================
--- clang/lib/Parse/ParseStmt.cpp
+++ clang/lib/Parse/ParseStmt.cpp
@@ -172,7 +172,6 @@
   switch (Kind) {
   case tok::at: // May be a @try or @throw statement
     {
-      ProhibitAttributes(Attrs); // TODO: is it correct?
       AtLoc = ConsumeToken();  // consume @
       return ParseObjCAtStatement(AtLoc, StmtCtx);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97371.326027.patch
Type: text/x-patch
Size: 435 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210224/40114a84/attachment.bin>


More information about the cfe-commits mailing list