[PATCH] D20009: Refactor and cleanup Assembly Parsing / Lexing

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 11:26:17 PDT 2016


rnk added a comment.

Overall seems like a good cleanup of a janky parser. =/


================
Comment at: include/llvm/MC/MCParser/AsmLexer.h:32-33
@@ -31,3 +31,4 @@
   StringRef CurBuf;
   bool isAtStartOfLine;
+  bool isAtStartOfStatement;
 
----------------
These should both follow LLVM style, i.e. leading upper case for variables & fields.

================
Comment at: lib/MC/MCParser/AsmLexer.cpp:53
@@ -52,3 +53,1 @@
 int AsmLexer::getNextChar() {
-  char CurChar = *CurPtr++;
-  switch (CurChar) {
----------------
Removing this attempt to optimize seems fine.

================
Comment at: lib/MC/MCParser/AsmLexer.cpp:500
@@ +499,3 @@
+    MutableArrayRef<AsmToken> Buf(TokenBuf, 2);
+    size_t num = peekTokens(Buf, true);
+    // There cannot be a space preceeding this
----------------
Follow the LLVM naming conventions please.

================
Comment at: lib/MC/MCParser/AsmParser.cpp:630
@@ -630,1 +629,3 @@
   const AsmToken *tok = &Lexer.Lex();
+  // Parse comments here.
+  while (tok->is(AsmToken::Comment)) {
----------------
Really it skips them, it doesn't parse them.


http://reviews.llvm.org/D20009





More information about the llvm-commits mailing list