aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-04-16 21:18:49 +0000
committerJim Grosbach <grosbach@apple.com>2012-04-16 21:18:49 +0000
commit68f89a61587e8d482347cf892c2670a869a1ad61 (patch)
treeca95dcba7483a48c62b08caf66cdacb611271833 /lib
parentb8768dc32df0bf3edfa2777cdef57bb066e54344 (diff)
downloadexternal_llvm-68f89a61587e8d482347cf892c2670a869a1ad61.zip
external_llvm-68f89a61587e8d482347cf892c2670a869a1ad61.tar.gz
external_llvm-68f89a61587e8d482347cf892c2670a869a1ad61.tar.bz2
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154863 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/MC/MCParser/AsmParser.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 2d61cac..8aef43c 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/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.