diff options
author | Jim Grosbach <grosbach@apple.com> | 2011-12-21 22:30:16 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2011-12-21 22:30:16 +0000 |
commit | 1152cc0cad6a42ac005ab6f45f6445b1c04871f5 (patch) | |
tree | 7ab266139530620750743408aef17dbc22ca26ff /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | |
parent | 20bb3aa53a0c9ed02dbcdd216f4607034c9e1122 (diff) | |
download | bcm5719-llvm-1152cc0cad6a42ac005ab6f45f6445b1c04871f5.tar.gz bcm5719-llvm-1152cc0cad6a42ac005ab6f45f6445b1c04871f5.zip |
ARM asm parser should be more lenient w/ .thumb_func directive.
Rather than require the symbol to be explicitly an argument of the directive,
allow it to look ahead and grab the symbol from the next non-whitespace
line.
rdar://10611140
llvm-svn: 147100
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 5e438729a99..f276862bf92 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -6421,23 +6421,32 @@ bool ARMAsmParser::parseDirectiveThumbFunc(SMLoc L) { const MCAsmInfo &MAI = getParser().getStreamer().getContext().getAsmInfo(); bool isMachO = MAI.hasSubsectionsViaSymbols(); StringRef Name; + bool needFuncName = true; - // Darwin asm has function name after .thumb_func direction + // Darwin asm has (optionally) function name after .thumb_func direction // ELF doesn't if (isMachO) { const AsmToken &Tok = Parser.getTok(); - if (Tok.isNot(AsmToken::Identifier) && Tok.isNot(AsmToken::String)) - return Error(L, "unexpected token in .thumb_func directive"); - Name = Tok.getIdentifier(); - Parser.Lex(); // Consume the identifier token. + if (Tok.isNot(AsmToken::EndOfStatement)) { + if (Tok.isNot(AsmToken::Identifier) && Tok.isNot(AsmToken::String)) + return Error(L, "unexpected token in .thumb_func directive"); + Name = Tok.getIdentifier(); + Parser.Lex(); // Consume the identifier token. + needFuncName = false; + } } - if (getLexer().isNot(AsmToken::EndOfStatement)) + if (getLexer().isNot(AsmToken::EndOfStatement)) return Error(L, "unexpected token in directive"); - Parser.Lex(); + + // Eat the end of statement and any blank lines that follow. + while (getLexer().is(AsmToken::EndOfStatement)) + Parser.Lex(); // FIXME: assuming function name will be the line following .thumb_func - if (!isMachO) { + // We really should be checking the next symbol definition even if there's + // stuff in between. + if (needFuncName) { Name = Parser.getTok().getIdentifier(); } |