From 05d315953b7082e29c1ad33aa037b36c400dc106 Mon Sep 17 00:00:00 2001 From: dim Date: Mon, 20 Apr 2015 17:36:35 +0000 Subject: 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 after: 3 days --- contrib/llvm/lib/MC/MCParser/AsmParser.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'contrib/llvm/lib/MC/MCParser/AsmParser.cpp') diff --git a/contrib/llvm/lib/MC/MCParser/AsmParser.cpp b/contrib/llvm/lib/MC/MCParser/AsmParser.cpp index 8eff90a..e2a4fc1 100644 --- a/contrib/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/contrib/llvm/lib/MC/MCParser/AsmParser.cpp @@ -3636,21 +3636,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