diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp --- a/llvm/lib/MC/MCParser/MasmParser.cpp +++ b/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 diff --git a/llvm/test/tools/llvm-ml/include.asm b/llvm/test/tools/llvm-ml/include.asm new file mode 100644 --- /dev/null +++ b/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 diff --git a/llvm/test/tools/llvm-ml/included.inc b/llvm/test/tools/llvm-ml/included.inc new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-ml/included.inc @@ -0,0 +1,6 @@ +Const equ 00008H + +push_pop macro Reg + push Reg + pop Reg +endm