[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:39:57 PDT 2019


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

isDeclarationStatement() returns true for __attribute__((fallthough)) ;



================
Comment at: lib/Parse/ParseStmt.cpp:102
   ParsedAttributesWithRange Attrs(AttrFactory);
+  MaybeParseGNUAttributes(Attrs);
   MaybeParseCXX11Attributes(Attrs, nullptr, /*MightBeObjCMessageSend*/ true);
----------------
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);
  }


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