mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[ms] [llvm-ml] Add support for line continuations in MASM
Add support for line continuations (the "backslash operator") in MASM by modifying the Parser's Lex method. Reviewed By: thakis Differential Revision: https://reviews.llvm.org/D83347
This commit is contained in:
parent
0eabaf370e
commit
24f72a81f9
@ -1094,6 +1094,14 @@ const AsmToken &MasmParser::Lex() {
|
||||
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.
|
||||
|
17
test/tools/llvm-ml/line_continuations.test
Normal file
17
test/tools/llvm-ml/line_continuations.test
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user