[PATCH] D86943: [ms] [llvm-ml] Add support for line continuations in MASM
Eric Astor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 1 07:59:56 PDT 2020
epastor created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
epastor requested review of this revision.
Add support for the line continuation character (\)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86943
Files:
llvm/lib/MC/MCParser/MasmParser.cpp
llvm/test/tools/llvm-ml/line_continuations.test
Index: llvm/test/tools/llvm-ml/line_continuations.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-ml/line_continuations.test
@@ -0,0 +1,17 @@
+# RUN: llvm-ml -filetype=asm %s | FileCheck %s
+
+.code
+
+t1:
+mov eax, \
+ ebx
+# CHECK: t1:
+# CHECK-NEXT: mov eax, ebx
+
+t2:
+mov eax, [ebx + \
+ 1]
+# CHECK: t2:
+# CHECK-NEXT: mov eax, dword ptr [ebx + 1]
+
+END
Index: llvm/lib/MC/MCParser/MasmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/MasmParser.cpp
+++ llvm/lib/MC/MCParser/MasmParser.cpp
@@ -1094,6 +1094,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: D86943.289169.patch
Type: text/x-patch
Size: 1070 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200901/24e87ea8/attachment.bin>
More information about the llvm-commits
mailing list