[PATCH] D83347: [ms] [llvm-ml] Add support for line continuations in MASM

Eric Astor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 14:38:46 PDT 2020


epastor created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Add support for line continuations (the "backslash operator") in MASM by modifying the Parser's Lex method.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83347

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


Index: llvm/lib/MC/MCParser/MasmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/MasmParser.cpp
+++ llvm/lib/MC/MCParser/MasmParser.cpp
@@ -1099,6 +1099,14 @@
     tok = &Lexer.Lex();
   }
 
+  // Recognize and bypass line continuations.
+  while (tok->is(AsmToken::BackSlash) &&
+         Lexer.peekTok().is(AsmToken::EndOfStatement)) {
+    // Eat both the backslash and the end of statement.
+    Lexer.Lex();
+    tok = &Lexer.Lex();
+  }
+
   if (tok->is(AsmToken::Eof)) {
     // If this is the end of an included file, pop the parent file off the
     // include stack.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83347.276216.patch
Type: text/x-patch
Size: 632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200707/d9a71982/attachment.bin>


More information about the llvm-commits mailing list