diff options
author | Jim Grosbach <grosbach@apple.com> | 2012-04-16 21:18:49 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2012-04-16 21:18:49 +0000 |
commit | 1e1d68f1b90ee2b3912af7878de28e04f49a01cb (patch) | |
tree | 699d5c267e6e22bcf1e292915bab35e3e6ee2695 /llvm/lib | |
parent | 003607f47465f1450281cf62d3d5222f1a518dba (diff) | |
download | bcm5719-llvm-1e1d68f1b90ee2b3912af7878de28e04f49a01cb.tar.gz bcm5719-llvm-1e1d68f1b90ee2b3912af7878de28e04f49a01cb.zip |
MC assembly parser handling for trailing comma in macro instantiation.
A trailing comma means no argument at all (i.e., as if the comma were not
present), not an empty argument to the invokee.
rdar://11252521
llvm-svn: 154863
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 2d61cac6258..8aef43cb0b4 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -1527,11 +1527,11 @@ bool AsmParser::HandleMacroEntry(StringRef Name, SMLoc NameLoc, } Lex(); } - // If there weren't any arguments, erase the token vector so everything - // else knows that. Leaving around the vestigal empty token list confuses - // things. - if (MacroArguments.size() == 1 && MacroArguments.back().empty()) - MacroArguments.clear(); + // If the last argument didn't end up with any tokens, it's not a real + // argument and we should remove it from the list. This happens with either + // a tailing comma or an empty argument list. + if (MacroArguments.back().empty()) + MacroArguments.pop_back(); // Macro instantiation is lexical, unfortunately. We construct a new buffer // to hold the macro body with substitutions. |