From 69cb38204284b5c07588090431719cfee1152ff3 Mon Sep 17 00:00:00 2001 From: dim Date: Thu, 23 Apr 2015 22:06:02 +0000 Subject: 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. --- contrib/llvm/lib/MC/MCParser/AsmParser.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'contrib/llvm/lib') 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; } -- cgit v1.1