Index: llvm/trunk/lib/MC/MCParser/AsmParser.cpp =================================================================== --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp @@ -3874,6 +3874,12 @@ if (parseIdentifier(Parameter.Name)) return TokError("expected identifier in '.macro' directive"); + // Emit an error if two (or more) named parameters share the same name + for (const MCAsmMacroParameter& CurrParam : Parameters) + if (CurrParam.Name.equals(Parameter.Name)) + return TokError("macro '" + Name + "' has multiple parameters" + " named '" + Parameter.Name + "'"); + if (Lexer.is(AsmToken::Colon)) { Lex(); // consume ':' Index: llvm/trunk/test/MC/AsmParser/macro-duplicate-params-names-err.s =================================================================== --- llvm/trunk/test/MC/AsmParser/macro-duplicate-params-names-err.s +++ llvm/trunk/test/MC/AsmParser/macro-duplicate-params-names-err.s @@ -0,0 +1,7 @@ +// RUN: not llvm-mc %s 2> %t +// RUN: FileCheck < %t %s + +.macro M a a +.endm + +// CHECK: macro 'M' has multiple parameters named 'a'