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:
Daniel Dunbar 2010-08-10 17:38:52 +00:00
parent 1b73052140
commit e25c6b95ce
2 changed files with 14 additions and 5 deletions

View File

@ -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();

View File

@ -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)