[PATCH] D57321: Fix LexFloatLiteral Lexing

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 20 16:22:16 PST 2019


efriedma added inline comments.


================
Comment at: llvm/include/llvm/MC/MCParser/AsmLexer.h:65
   AsmToken LexQuote();
-  AsmToken LexFloatLiteral();
+  AsmToken LexFloatLiteral(bool isDotSeperated);
   AsmToken LexHexFloatLiteral(bool NoIntDigits);
----------------
Spelling ("separated").


================
Comment at: llvm/lib/MC/MCParser/AsmLexer.cpp:73
+  if (*CurPtr == '-' || *CurPtr == '+')
+    return ReturnError(CurPtr, "Invalid sign in float literal");
+  // Check for exponent; we enforce rigidity on a correct
----------------
Is this early return necessary, or just to try to improve the error messages?


================
Comment at: llvm/lib/MC/MCParser/AsmLexer.cpp:337
+      if (CurPtr[-1] == '.')
+        return LexFloatLiteral(true);
+      return LexFloatLiteral(false);
----------------
Instead of adding a boolean parameter to LexFloatLiteral, can we make the "++CurPtr" conditional?  It's easier to follow the logic if CurPtr is always before the "E" when LexFloatLiteral is called.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D57321





More information about the llvm-commits mailing list