MCAsmParser: relax declaration parsing

The Linux kernel defines empty macros for compatibility with ARM UAL syntax.
The comma after the name is optional, and if present can be safely lexed.  This
improves compatibility with the GNU assembler.

llvm-svn: 201474
This commit is contained in:
Saleem Abdulrasool 2014-02-16 04:56:31 +00:00
parent f0e7fa2121
commit 1ab302ffd6
2 changed files with 14 additions and 1 deletions

View File

@ -3152,12 +3152,15 @@ bool AsmParser::parseDirectiveMacrosOnOff(StringRef Directive) {
}
/// parseDirectiveMacro
/// ::= .macro name [parameters]
/// ::= .macro name[,] [parameters]
bool AsmParser::parseDirectiveMacro(SMLoc DirectiveLoc) {
StringRef Name;
if (parseIdentifier(Name))
return TokError("expected identifier in '.macro' directive");
if (getLexer().is(AsmToken::Comma))
Lex();
MCAsmMacroParameters Parameters;
while (getLexer().isNot(AsmToken::EndOfStatement)) {
MCAsmMacroParameter Parameter;

View File

@ -0,0 +1,10 @@
# RUN: llvm-mc -triple i386 -filetype asm -o - %s | FileCheck %s
.macro it, cond
.endm
it ne
.long 1
# CHECK: .long 1