diff options
author | dim <dim@FreeBSD.org> | 2015-04-23 22:06:02 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-04-23 22:06:02 +0000 |
commit | 69cb38204284b5c07588090431719cfee1152ff3 (patch) | |
tree | e9a2711d3d2bf551ebb3ab4b0a1a1736da5fc9b4 /contrib/llvm/lib/MC/MCParser/AsmParser.cpp | |
parent | af18c5177e93ff098b8442eab7a6b57daeff1823 (diff) | |
download | FreeBSD-src-69cb38204284b5c07588090431719cfee1152ff3.zip FreeBSD-src-69cb38204284b5c07588090431719cfee1152ff3.tar.gz |
MFC r281775:
Pull in r229911 from upstream llvm trunk (by Benjamin Kramer):
MC: Allow multiple comma-separated expressions on the .uleb128 directive.
For compatiblity with GNU as. Binutils documents this as
'.uleb128 expressions'. Subtle, isn't it?
Reported by: sbruno
PR: 199554
MFC r281777:
Add llvm patch corresponding to r281775.
Diffstat (limited to 'contrib/llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r-- | contrib/llvm/lib/MC/MCParser/AsmParser.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/contrib/llvm/lib/MC/MCParser/AsmParser.cpp b/contrib/llvm/lib/MC/MCParser/AsmParser.cpp index 7f8e9df..ea18234 100644 --- a/contrib/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/contrib/llvm/lib/MC/MCParser/AsmParser.cpp @@ -3370,21 +3370,27 @@ bool AsmParser::parseDirectiveSpace(StringRef IDVal) { } /// parseDirectiveLEB128 -/// ::= (.sleb128 | .uleb128) expression +/// ::= (.sleb128 | .uleb128) [ expression (, expression)* ] bool AsmParser::parseDirectiveLEB128(bool Signed) { checkForValidSection(); const MCExpr *Value; - if (parseExpression(Value)) - return true; + for (;;) { + if (parseExpression(Value)) + return true; - if (getLexer().isNot(AsmToken::EndOfStatement)) - return TokError("unexpected token in directive"); + if (Signed) + getStreamer().EmitSLEB128Value(Value); + else + getStreamer().EmitULEB128Value(Value); - if (Signed) - getStreamer().EmitSLEB128Value(Value); - else - getStreamer().EmitULEB128Value(Value); + if (getLexer().is(AsmToken::EndOfStatement)) + break; + + if (getLexer().isNot(AsmToken::Comma)) + return TokError("unexpected token in directive"); + Lex(); + } return false; } |