diff options
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 5 | ||||
-rw-r--r-- | test/MC/AsmParser/macro-args.s | 10 |
2 files changed, 15 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. diff --git a/test/MC/AsmParser/macro-args.s b/test/MC/AsmParser/macro-args.s index 808b6eb488..4b878999e4 100644 --- a/test/MC/AsmParser/macro-args.s +++ b/test/MC/AsmParser/macro-args.s @@ -8,3 +8,13 @@ GET is_sse, %eax // CHECK: movl is_sse@GOTOFF(%ebx), %eax + +.macro bar + .long $n +.endm + +bar 1, 2, 3 +bar + +// CHECK: .long 3 +// CHECK: .long 0 |