[PATCH] D103980: [ms] [llvm-ml] Fix parity errors in error handling for INCLUDE directive
Eric Astor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 9 10:34:38 PDT 2021
epastor created this revision.
Herald added a subscriber: hiraditya.
epastor requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Also adds basic testing for "include" directive.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D103980
Files:
llvm/lib/MC/MCParser/MasmParser.cpp
llvm/test/tools/llvm-ml/include.asm
llvm/test/tools/llvm-ml/included.inc
Index: llvm/test/tools/llvm-ml/included.inc
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-ml/included.inc
@@ -0,0 +1,6 @@
+Const equ 00008H
+
+push_pop macro Reg
+ push Reg
+ pop Reg
+endm
Index: llvm/test/tools/llvm-ml/include.asm
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-ml/include.asm
@@ -0,0 +1,20 @@
+# RUN: llvm-ml -filetype=s %s /I %S /Fo - | FileCheck %s
+
+include included.inc
+
+.code
+
+t1:
+mov eax, Const
+
+; CHECK-LABEL: t1:
+; CHECK-NEXT: mov eax, 8
+
+t2:
+push_pop ebx
+
+; CHECK-LABEL: t2:
+; CHECK-NEXT: push ebx
+; CHECK-NEXT: pop ebx
+
+end
Index: llvm/lib/MC/MCParser/MasmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/MasmParser.cpp
+++ llvm/lib/MC/MCParser/MasmParser.cpp
@@ -5889,9 +5889,9 @@
std::string Filename;
SMLoc IncludeLoc = getTok().getLoc();
- if (!parseAngleBracketString(Filename))
+ if (parseAngleBracketString(Filename))
Filename = parseStringTo(AsmToken::EndOfStatement);
- if (check(!Filename.empty(), "missing filename in 'include' directive") ||
+ if (check(Filename.empty(), "missing filename in 'include' directive") ||
check(getTok().isNot(AsmToken::EndOfStatement),
"unexpected token in 'include' directive") ||
// Attempt to switch the lexer to the included file before consuming the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103980.350947.patch
Type: text/x-patch
Size: 1465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210609/647fd473/attachment.bin>
More information about the llvm-commits
mailing list