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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Saleem Abdulrasool 2014-02-16 04:56:31 +00:00
parent 1edea19210
commit 5a39da0a6f
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