mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 02:33:33 +00:00
MC/AsmParser: Fix a bug in macro argument parsing, which was dropping
parentheses from argument lists. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110692 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1b73052140
commit
e25c6b95ce
@ -1032,12 +1032,14 @@ bool AsmParser::HandleMacroEntry(StringRef Name, SMLoc NameLoc,
|
||||
// list.
|
||||
if (ParenLevel == 0 && Lexer.is(AsmToken::Comma)) {
|
||||
MacroArguments.push_back(std::vector<AsmToken>());
|
||||
} else if (Lexer.is(AsmToken::LParen)) {
|
||||
++ParenLevel;
|
||||
} else if (Lexer.is(AsmToken::RParen)) {
|
||||
if (ParenLevel)
|
||||
--ParenLevel;
|
||||
} else {
|
||||
// Adjust the current parentheses level.
|
||||
if (Lexer.is(AsmToken::LParen))
|
||||
++ParenLevel;
|
||||
else if (Lexer.is(AsmToken::RParen) && ParenLevel)
|
||||
--ParenLevel;
|
||||
|
||||
// Append the token to the current argument list.
|
||||
MacroArguments.back().push_back(getTok());
|
||||
}
|
||||
Lex();
|
||||
|
@ -30,3 +30,10 @@ test2 10
|
||||
|
||||
// CHECK: .globl "1 23 $3 2"
|
||||
test3 1,2 3
|
||||
|
||||
.macro test4
|
||||
.globl "$0 -- $1"
|
||||
.endmacro
|
||||
|
||||
// CHECK: .globl "ab)(,) -- (cd)"
|
||||
test4 a b)(,),(cd)
|
||||
|
Loading…
x
Reference in New Issue
Block a user