[PATCH] D63299: [Clang] Parse GNU fallthrough attributes

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 14 04:44:47 PDT 2019


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


================
Comment at: lib/Parse/ParseStmt.cpp:102
   ParsedAttributesWithRange Attrs(AttrFactory);
+  MaybeParseGNUAttributes(Attrs);
   MaybeParseCXX11Attributes(Attrs, nullptr, /*MightBeObjCMessageSend*/ true);
----------------
xbolva00 wrote:
> Maybe we check if Tok is kw__attribute and look ahead a few tokens to check if attribute name is fallthough in ParseStatementOrDeclarationAfterAttributes.
> 
> Now, we always fall into
> 
> if ((getLangOpts().CPlusPlus || getLangOpts().MicrosoftExt ||
>          (StmtCtx & ParsedStmtContext::AllowDeclarationsInC) !=
>              ParsedStmtContext()) &&
>         isDeclarationStatement()) {
>       SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
>       DeclGroupPtrTy Decl = ParseDeclaration(DeclaratorContext::BlockContext,
>                                              DeclEnd, Attrs);
>       return Actions.ActOnDeclStmt(Decl, DeclStart, DeclEnd);
>   }
Then we go to "ParseSimpleDeclaration" -> "ParseDeclarationSpecifier". What is quite strange for me, we do not set "Attrs" in ParseSimpleDeclaration from DS.getAttributes()..


Repository:
  rC Clang

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

https://reviews.llvm.org/D63299





More information about the cfe-commits mailing list