[PATCH] D60450: Only prune new line when it exists (AsmParser).

Brandon Jones via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 9 02:46:46 PDT 2019


BrandonTJones created this revision.
BrandonTJones added reviewers: andreadb, grosbach.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Repository:
  rL LLVM

https://reviews.llvm.org/D60450

Files:
  llvm/lib/MC/MCParser/AsmLexer.cpp


Index: llvm/lib/MC/MCParser/AsmLexer.cpp
===================================================================
--- llvm/lib/MC/MCParser/AsmLexer.cpp
+++ llvm/lib/MC/MCParser/AsmLexer.cpp
@@ -246,6 +246,11 @@
                     StringRef(TokStart, CurPtr - TokStart));
   IsAtStartOfStatement = true;
 
+  // Only prune newline if it exists
+  if (CurChar == EOF && peekPtr(-1) != '\n')
+    return AsmToken(AsmToken::EndOfStatement,
+                    StringRef(TokStart, CurPtr - TokStart));
+
   return AsmToken(AsmToken::EndOfStatement,
                   StringRef(TokStart, CurPtr - 1 - TokStart));
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60450.194275.patch
Type: text/x-patch
Size: 609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190409/b15b09ca/attachment.bin>


More information about the llvm-commits mailing list