[PATCH] D75563: [clang][Parse] properly parse asm-qualifiers, asm inline

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 9 18:54:13 PDT 2020


nickdesaulniers planned changes to this revision.
nickdesaulniers marked 3 inline comments as done.
nickdesaulniers added a comment.

Sorry, got a little trigger happy with the refactoring.  Having a weekend to think about this more definitely helps.  It's nice to avoid instantiating a whole instance of `SemaDecl` and instead use a single `unsigned` bitfield!  I have a few more refactorings I'd like to do, but I'm working remote and my workstation is suddenly unavailable over SSH. Hopefully I can reboot it tomorrow.



================
Comment at: clang/include/clang/Parse/Parser.h:3214
+    };
+    GNUAsmQualifiers() : Qualifiers(0) {}
+    static const char *getSpecifierName(const AQ AQ);
----------------
Might be nice to have an implicit constructor that takes a `GNUAsmQualifier` operand that defaults to `AQ_unspecified`.


================
Comment at: clang/include/clang/Parse/Parser.h:3215
+    GNUAsmQualifiers() : Qualifiers(0) {}
+    static const char *getSpecifierName(const AQ AQ);
+    static AQ getQualifierForTokenKind(const tok::TokenKind K);
----------------
Now that we're not using `DeclSpec`, maybe we could drop this in preference of `operator<<`.


================
Comment at: clang/lib/Parse/ParseStmtAsm.cpp:358-359
+bool Parser::isGNUAsmQualifier(const Token &TokAfterAsm) const {
+  return TokAfterAsm.is(tok::kw_volatile) || TokAfterAsm.is(tok::kw_inline) ||
+         TokAfterAsm.is(tok::kw_goto);
 }
----------------
Can be implemented in terms of `Parser::GNUAsmQualifiers::getQualifierForTokenKind`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75563





More information about the cfe-commits mailing list