summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-03-17 00:11:42 +0000
committerJim Grosbach <grosbach@apple.com>2012-03-17 00:11:42 +0000
commitae151ed87d4100ec352fee8fc70e2c8c26281c69 (patch)
tree1a40b2c9b27f821c014712af989ff8c06c503f9f /lib
parent5aeff3171c173dec9a6e6f89e428a0a78698c43e (diff)
downloadllvm-ae151ed87d4100ec352fee8fc70e2c8c26281c69.tar.gz
llvm-ae151ed87d4100ec352fee8fc70e2c8c26281c69.tar.bz2
llvm-ae151ed87d4100ec352fee8fc70e2c8c26281c69.tar.xz
MC asm parser macro argument count was wrong when empty.
evaluated to '1' when the argument list was empty (should be '0'). rdar://11057257 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152967 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/MC/MCParser/AsmParser.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index bd5956f9b4..41ad1642d2 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/lib/MC/MCParser/AsmParser.cpp
@@ -1528,6 +1528,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();
// Macro instantiation is lexical, unfortunately. We construct a new buffer
// to hold the macro body with substitutions.