<div dir="ltr">Looks like a missed comma parsing typo. I'll commit a fix presently. <div><br></div><div>Thanks, </div><div><br></div><div>-Nirav</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 26, 2016 at 12:56 PM, Keith Walker <span dir="ltr"><<a href="mailto:Keith.Walker@arm.com" target="_blank">Keith.Walker@arm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
It appears that this change has introduced a regression in the handling of multiple optional options to the .loc directive.<br>
<br>
This can be demonstrated using the command:<br>
clang --target=aarch64 -c fail.s<br>
<br>
with this assembler source as input:<br>
<br>
.text<br>
func:<br>
.file 1 "fail.c"<br>
.loc 1 5 16 is_stmt 0 discriminator 1<br>
ret<br>
<br>
and it produces the following error:<br>
<br>
fail.s:4:34: error: unexpected token<br>
.loc 1 5 16 is_stmt 0 discriminator 1<br>
^<br>
<span class="HOEnZb"><font color="#888888"><br>
Keith<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> -----Original Message-----<br>
> From: llvm-commits [mailto:<a href="mailto:llvm-commits-bounces@lists.llvm.org">llvm-commits-bounces@<wbr>lists.llvm.org</a>] On<br>
> Behalf Of Nirav Dave via llvm-commits<br>
> Sent: 24 October 2016 15:35<br>
> To: <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> Subject: [llvm] r284978 - [MC] Fix Various End Of Line Comment checkings<br>
><br>
> Author: niravd<br>
> Date: Mon Oct 24 09:35:29 2016<br>
> New Revision: 284978<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=284978&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=284978&view=rev</a><br>
> Log:<br>
> [MC] Fix Various End Of Line Comment checkings<br>
><br>
> Fix AsmParser lines to correctly handle end-of-line pre-processor<br>
> comments parsing when '#' is not the assembly line comment prefix.<br>
><br>
> Reviewers: rnk<br>
><br>
> Subscribers: llvm-commits<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D25567" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D25567</a><br>
><br>
> Added:<br>
> llvm/trunk/test/MC/AsmParser/<wbr>AArch64/<br>
> llvm/trunk/test/MC/AsmParser/<wbr>AArch64/directive-parse-err.s<br>
> llvm/trunk/test/MC/AsmParser/<wbr>AArch64/lit.local.cfg<br>
> Modified:<br>
> llvm/trunk/include/llvm/MC/<wbr>MCParser/MCAsmParser.h<br>
> llvm/trunk/lib/MC/MCParser/<wbr>AsmParser.cpp<br>
> llvm/trunk/lib/MC/MCParser/<wbr>MCAsmParser.cpp<br>
> llvm/trunk/test/MC/AsmParser/<wbr>exprs-invalid.s<br>
><br>
> Modified: llvm/trunk/include/llvm/MC/<wbr>MCParser/MCAsmParser.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/include/<wbr>llvm/MC/MCParser/MCAsmParser.<wbr>h?rev=284978&r1=<br>
> 284977&r2=284978&view=diff<br>
> ==============================<wbr>==============================<wbr>============<br>
> ======<br>
> --- llvm/trunk/include/llvm/MC/<wbr>MCParser/MCAsmParser.h (original)<br>
> +++ llvm/trunk/include/llvm/MC/<wbr>MCParser/MCAsmParser.h Mon Oct 24<br>
> 09:35:29 2016<br>
> @@ -166,6 +166,8 @@ public:<br>
> return rv;<br>
> }<br>
><br>
> + bool addErrorSuffix(const Twine &Suffix);<br>
> +<br>
> /// \brief Get the next AsmToken in the stream, possibly handling<br>
> file<br>
> /// inclusion first.<br>
> virtual const AsmToken &Lex() = 0;<br>
> @@ -177,11 +179,15 @@ public:<br>
> bool TokError(const Twine &Msg, SMRange Range = None);<br>
><br>
> bool parseTokenLoc(SMLoc &Loc);<br>
> - bool parseToken(AsmToken::TokenKind T, const Twine &Msg);<br>
> - bool parseOptionalToken(AsmToken::<wbr>TokenKind T, bool &Present);<br>
> + bool parseToken(AsmToken::TokenKind T, const Twine &Msg = "unexpected<br>
> token");<br>
> + /// \brief Attempt to parse and consume token, returning true on<br>
> + /// success.<br>
> + bool parseOptionalToken(AsmToken::<wbr>TokenKind T);<br>
><br>
> bool parseEOL(const Twine &ErrMsg);<br>
><br>
> + bool parseMany(std::function<bool()<wbr>> parseOne, bool hasComma = true);<br>
> +<br>
> bool parseIntToken(int64_t &V, const Twine &ErrMsg);<br>
><br>
> bool check(bool P, const llvm::Twine &Msg);<br>
><br>
> Modified: llvm/trunk/lib/MC/MCParser/<wbr>AsmParser.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/lib/MC/<wbr>MCParser/AsmParser.cpp?rev=<wbr>284978&r1=284977&r2<br>
> =284978&view=diff<br>
> ==============================<wbr>==============================<wbr>============<br>
> ======<br>
> --- llvm/trunk/lib/MC/MCParser/<wbr>AsmParser.cpp (original)<br>
> +++ llvm/trunk/lib/MC/MCParser/<wbr>AsmParser.cpp Mon Oct 24 09:35:29 2016<br>
> @@ -425,9 +425,11 @@ private:<br>
> // ".ascii", ".asciz", ".string"<br>
> bool parseDirectiveAscii(StringRef IDVal, bool ZeroTerminated);<br>
> bool parseDirectiveReloc(SMLoc DirectiveLoc); // ".reloc"<br>
> - bool parseDirectiveValue(unsigned Size); // ".byte", ".long", ...<br>
> - bool parseDirectiveOctaValue(); // ".octa"<br>
> - bool parseDirectiveRealValue(const fltSemantics &); // ".single", ...<br>
> + bool parseDirectiveValue(StringRef IDVal,<br>
> + unsigned Size); // ".byte", ".long",<br>
> ...<br>
> + bool parseDirectiveOctaValue(<wbr>StringRef IDVal); // ".octa", ...<br>
> + bool parseDirectiveRealValue(<wbr>StringRef IDVal,<br>
> + const fltSemantics &); // ".single", ...<br>
> bool parseDirectiveFill(); // ".fill"<br>
> bool parseDirectiveZero(); // ".zero"<br>
> // ".set", ".equ", ".equiv"<br>
> @@ -1732,25 +1734,34 @@ bool AsmParser::parseStatement(<wbr>ParseStat<br>
> case DK_STRING:<br>
> return parseDirectiveAscii(IDVal, true);<br>
> case DK_BYTE:<br>
> - return parseDirectiveValue(1);<br>
> + case DK_DC_B:<br>
> + return parseDirectiveValue(IDVal, 1);<br>
> + case DK_DC:<br>
> + case DK_DC_W:<br>
> case DK_SHORT:<br>
> case DK_VALUE:<br>
> case DK_2BYTE:<br>
> - return parseDirectiveValue(2);<br>
> + return parseDirectiveValue(IDVal, 2);<br>
> case DK_LONG:<br>
> case DK_INT:<br>
> case DK_4BYTE:<br>
> - return parseDirectiveValue(4);<br>
> + case DK_DC_L:<br>
> + return parseDirectiveValue(IDVal, 4);<br>
> case DK_QUAD:<br>
> case DK_8BYTE:<br>
> - return parseDirectiveValue(8);<br>
> + return parseDirectiveValue(IDVal, 8);<br>
> + case DK_DC_A:<br>
> + return parseDirectiveValue(IDVal,<br>
> + getContext().getAsmInfo()-<br>
> >getPointerSize());<br>
> case DK_OCTA:<br>
> - return parseDirectiveOctaValue();<br>
> + return parseDirectiveOctaValue(IDVal)<wbr>;<br>
> case DK_SINGLE:<br>
> case DK_FLOAT:<br>
> - return parseDirectiveRealValue(<wbr>APFloat::IEEEsingle);<br>
> + case DK_DC_S:<br>
> + return parseDirectiveRealValue(IDVal, APFloat::IEEEsingle);<br>
> case DK_DOUBLE:<br>
> - return parseDirectiveRealValue(<wbr>APFloat::IEEEdouble);<br>
> + case DK_DC_D:<br>
> + return parseDirectiveRealValue(IDVal, APFloat::IEEEdouble);<br>
> case DK_ALIGN: {<br>
> bool IsPow2 = !getContext().getAsmInfo()-<br>
> >getAlignmentIsInBytes();<br>
> return parseDirectiveAlign(IsPow2, /*ExprSize=*/1);<br>
> @@ -1923,20 +1934,6 @@ bool AsmParser::parseStatement(<wbr>ParseStat<br>
> return parseDirectiveWarning(IDLoc);<br>
> case DK_RELOC:<br>
> return parseDirectiveReloc(IDLoc);<br>
> - case DK_DC:<br>
> - return parseDirectiveValue(2);<br>
> - case DK_DC_A:<br>
> - return parseDirectiveValue(<wbr>getContext().getAsmInfo()-<br>
> >getPointerSize());<br>
> - case DK_DC_B:<br>
> - return parseDirectiveValue(1);<br>
> - case DK_DC_D:<br>
> - return parseDirectiveRealValue(<wbr>APFloat::IEEEdouble);<br>
> - case DK_DC_L:<br>
> - return parseDirectiveValue(4);<br>
> - case DK_DC_S:<br>
> - return parseDirectiveRealValue(<wbr>APFloat::IEEEsingle);<br>
> - case DK_DC_W:<br>
> - return parseDirectiveValue(2);<br>
> case DK_DCB:<br>
> case DK_DCB_W:<br>
> return parseDirectiveDCB(IDVal, 2);<br>
> @@ -2645,17 +2642,15 @@ bool AsmParser::parseIdentifier(<wbr>StringRe<br>
> /// ::= .set identifier ',' expression<br>
> bool AsmParser::parseDirectiveSet(<wbr>StringRef IDVal, bool allow_redef) {<br>
> StringRef Name;<br>
> -<br>
> - if (check(parseIdentifier(Name),<br>
> - "expected identifier after '" + Twine(IDVal) + "'") ||<br>
> - parseToken(AsmToken::Comma, "unexpected token in '" +<br>
> Twine(IDVal) + "'"))<br>
> - return true;<br>
> -<br>
> - return parseAssignment(Name, allow_redef, true);<br>
> + if (check(parseIdentifier(Name), "expected identifier") ||<br>
> + parseToken(AsmToken::Comma) || parseAssignment(Name, allow_redef,<br>
> true))<br>
> + return addErrorSuffix(" in '" + Twine(IDVal) + "' directive");<br>
> + return false;<br>
> }<br>
><br>
> bool AsmParser::parseEscapedString(<wbr>std::string &Data) {<br>
> - assert(getLexer().is(AsmToken:<wbr>:String) && "Unexpected current<br>
> token!");<br>
> + if (check(getTok().isNot(<wbr>AsmToken::String), "expected string"))<br>
> + return true;<br>
><br>
> Data = "";<br>
> StringRef Str = getTok().getStringContents();<br>
> @@ -2716,31 +2711,18 @@ bool AsmParser::parseEscapedString(<wbr>std::<br>
> /// parseDirectiveAscii:<br>
> /// ::= ( .ascii | .asciz | .string ) [ "string" ( , "string" )* ]<br>
> bool AsmParser::<wbr>parseDirectiveAscii(StringRef IDVal, bool<br>
> ZeroTerminated) {<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - if (checkForValidSection())<br>
> - return true;<br>
> -<br>
> - while (true) {<br>
> - std::string Data;<br>
> - if (check(getTok().isNot(<wbr>AsmToken::String),<br>
> - "expected string in '" + Twine(IDVal) + "' directive")<br>
> ||<br>
> - parseEscapedString(Data))<br>
> - return true;<br>
> -<br>
> - getStreamer().EmitBytes(Data);<br>
> - if (ZeroTerminated)<br>
> - getStreamer().EmitBytes(<wbr>StringRef("\0", 1));<br>
> -<br>
> - if (getLexer().is(AsmToken::<wbr>EndOfStatement))<br>
> - break;<br>
> -<br>
> - if (parseToken(AsmToken::Comma,<br>
> - "unexpected token in '" + Twine(IDVal) + "'<br>
> directive"))<br>
> - return true;<br>
> - }<br>
> - }<br>
> + auto parseOp = [&]() -> bool {<br>
> + std::string Data;<br>
> + if (checkForValidSection() || parseEscapedString(Data))<br>
> + return true;<br>
> + getStreamer().EmitBytes(Data);<br>
> + if (ZeroTerminated)<br>
> + getStreamer().EmitBytes(<wbr>StringRef("\0", 1));<br>
> + return false;<br>
> + };<br>
><br>
> - Lex();<br>
> + if (parseMany(parseOp))<br>
> + return addErrorSuffix(" in '" + Twine(IDVal) + "' directive");<br>
> return false;<br>
> }<br>
><br>
> @@ -2751,11 +2733,12 @@ bool AsmParser::<wbr>parseDirectiveReloc(SMLo<br>
> const MCExpr *Expr = nullptr;<br>
><br>
> SMLoc OffsetLoc = Lexer.getTok().getLoc();<br>
> + int64_t OffsetValue;<br>
> + // We can only deal with constant expressions at the moment.<br>
> +<br>
> if (parseExpression(Offset))<br>
> return true;<br>
><br>
> - // We can only deal with constant expressions at the moment.<br>
> - int64_t OffsetValue;<br>
> if (check(!Offset-><wbr>evaluateAsAbsolute(<wbr>OffsetValue), OffsetLoc,<br>
> "expression is not a constant value") ||<br>
> check(OffsetValue < 0, OffsetLoc, "expression is negative") ||<br>
> @@ -2790,86 +2773,63 @@ bool AsmParser::<wbr>parseDirectiveReloc(SMLo<br>
><br>
> /// parseDirectiveValue<br>
> /// ::= (.byte | .short | ... ) [ expression (, expression)* ]<br>
> -bool AsmParser::<wbr>parseDirectiveValue(unsigned Size) {<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - if (checkForValidSection())<br>
> - return true;<br>
> -<br>
> - while (true) {<br>
> - const MCExpr *Value;<br>
> - SMLoc ExprLoc = getLexer().getLoc();<br>
> - if (parseExpression(Value))<br>
> - return true;<br>
> -<br>
> - // Special case constant expressions to match code generator.<br>
> - if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(<wbr>Value))<br>
> {<br>
> - assert(Size <= 8 && "Invalid size");<br>
> - uint64_t IntValue = MCE->getValue();<br>
> - if (!isUIntN(8 * Size, IntValue) && !isIntN(8 * Size,<br>
> IntValue))<br>
> - return Error(ExprLoc, "literal value out of range for<br>
> directive");<br>
> - getStreamer().EmitIntValue(<wbr>IntValue, Size);<br>
> - } else<br>
> - getStreamer().EmitValue(Value, Size, ExprLoc);<br>
> -<br>
> - if (getLexer().is(AsmToken::<wbr>EndOfStatement))<br>
> - break;<br>
> -<br>
> - // FIXME: Improve diagnostic.<br>
> - if (parseToken(AsmToken::Comma, "unexpected token in directive"))<br>
> - return true;<br>
> - }<br>
> - }<br>
> +bool AsmParser::<wbr>parseDirectiveValue(StringRef IDVal, unsigned Size) {<br>
> + auto parseOp = [&]() -> bool {<br>
> + const MCExpr *Value;<br>
> + SMLoc ExprLoc = getLexer().getLoc();<br>
> + if (checkForValidSection() || parseExpression(Value))<br>
> + return true;<br>
> + // Special case constant expressions to match code generator.<br>
> + if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(<wbr>Value)) {<br>
> + assert(Size <= 8 && "Invalid size");<br>
> + uint64_t IntValue = MCE->getValue();<br>
> + if (!isUIntN(8 * Size, IntValue) && !isIntN(8 * Size, IntValue))<br>
> + return Error(ExprLoc, "out of range literal value");<br>
> + getStreamer().EmitIntValue(<wbr>IntValue, Size);<br>
> + } else<br>
> + getStreamer().EmitValue(Value, Size, ExprLoc);<br>
> + return false;<br>
> + };<br>
><br>
> - Lex();<br>
> + if (parseMany(parseOp))<br>
> + return addErrorSuffix(" in '" + Twine(IDVal) + "' directive");<br>
> return false;<br>
> }<br>
><br>
> /// ParseDirectiveOctaValue<br>
> /// ::= .octa [ hexconstant (, hexconstant)* ]<br>
> -bool AsmParser::<wbr>parseDirectiveOctaValue() {<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> +<br>
> +bool AsmParser::<wbr>parseDirectiveOctaValue(<wbr>StringRef IDVal) {<br>
> + auto parseOp = [&]() -> bool {<br>
> if (checkForValidSection())<br>
> return true;<br>
> -<br>
> - while (true) {<br>
> - if (getTok().is(AsmToken::Error))<br>
> - return true;<br>
> - if (getTok().isNot(AsmToken::<wbr>Integer) &&<br>
> getTok().isNot(AsmToken::<wbr>BigNum))<br>
> - return TokError("unknown token in expression");<br>
> -<br>
> - SMLoc ExprLoc = getLexer().getLoc();<br>
> - APInt IntValue = getTok().getAPIntVal();<br>
> - Lex();<br>
> -<br>
> - uint64_t hi, lo;<br>
> - if (IntValue.isIntN(64)) {<br>
> - hi = 0;<br>
> - lo = IntValue.getZExtValue();<br>
> - } else if (IntValue.isIntN(128)) {<br>
> - // It might actually have more than 128 bits, but the top ones<br>
> are zero.<br>
> - hi = IntValue.getHiBits(IntValue.<wbr>getBitWidth() -<br>
> 64).getZExtValue();<br>
> - lo = IntValue.getLoBits(64).<wbr>getZExtValue();<br>
> - } else<br>
> - return Error(ExprLoc, "literal value out of range for<br>
> directive");<br>
> -<br>
> - if (MAI.isLittleEndian()) {<br>
> - getStreamer().EmitIntValue(lo, 8);<br>
> - getStreamer().EmitIntValue(hi, 8);<br>
> - } else {<br>
> - getStreamer().EmitIntValue(hi, 8);<br>
> - getStreamer().EmitIntValue(lo, 8);<br>
> - }<br>
> -<br>
> - if (getLexer().is(AsmToken::<wbr>EndOfStatement))<br>
> - break;<br>
> -<br>
> - // FIXME: Improve diagnostic.<br>
> - if (parseToken(AsmToken::Comma, "unexpected token in directive"))<br>
> - return true;<br>
> + if (getTok().isNot(AsmToken::<wbr>Integer) &&<br>
> getTok().isNot(AsmToken::<wbr>BigNum))<br>
> + return TokError("unknown token in expression");<br>
> + SMLoc ExprLoc = getTok().getLoc();<br>
> + APInt IntValue = getTok().getAPIntVal();<br>
> + uint64_t hi, lo;<br>
> + Lex();<br>
> + if (!IntValue.isIntN(128))<br>
> + return Error(ExprLoc, "out of range literal value");<br>
> + if (!IntValue.isIntN(64)) {<br>
> + hi = IntValue.getHiBits(IntValue.<wbr>getBitWidth() -<br>
> 64).getZExtValue();<br>
> + lo = IntValue.getLoBits(64).<wbr>getZExtValue();<br>
> + } else {<br>
> + hi = 0;<br>
> + lo = IntValue.getZExtValue();<br>
> }<br>
> - }<br>
> + if (MAI.isLittleEndian()) {<br>
> + getStreamer().EmitIntValue(lo, 8);<br>
> + getStreamer().EmitIntValue(hi, 8);<br>
> + } else {<br>
> + getStreamer().EmitIntValue(hi, 8);<br>
> + getStreamer().EmitIntValue(lo, 8);<br>
> + }<br>
> + return false;<br>
> + };<br>
><br>
> - Lex();<br>
> + if (parseMany(parseOp))<br>
> + return addErrorSuffix(" in '" + Twine(IDVal) + "' directive");<br>
> return false;<br>
> }<br>
><br>
> @@ -2915,28 +2875,19 @@ bool AsmParser::parseRealValue(<wbr>const flt<br>
><br>
> /// parseDirectiveRealValue<br>
> /// ::= (.single | .double) [ expression (, expression)* ]<br>
> -bool AsmParser::<wbr>parseDirectiveRealValue(const fltSemantics &Semantics)<br>
> {<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - if (checkForValidSection())<br>
> +bool AsmParser::<wbr>parseDirectiveRealValue(<wbr>StringRef IDVal,<br>
> + const fltSemantics &Semantics)<br>
> {<br>
> + auto parseOp = [&]() -> bool {<br>
> + APInt AsInt;<br>
> + if (checkForValidSection() || parseRealValue(Semantics, AsInt))<br>
> return true;<br>
> + getStreamer().EmitIntValue(<wbr>AsInt.getLimitedValue(),<br>
> + AsInt.getBitWidth() / 8);<br>
> + return false;<br>
> + };<br>
><br>
> - while (true) {<br>
> - APInt AsInt;<br>
> - if (parseRealValue(Semantics, AsInt))<br>
> - return true;<br>
> -<br>
> - getStreamer().EmitIntValue(<wbr>AsInt.getLimitedValue(),<br>
> - AsInt.getBitWidth() / 8);<br>
> -<br>
> - if (Lexer.is(AsmToken::<wbr>EndOfStatement))<br>
> - break;<br>
> -<br>
> - if (parseToken(AsmToken::Comma, "unexpected token in directive"))<br>
> - return true;<br>
> - }<br>
> - }<br>
> -<br>
> - Lex();<br>
> + if (parseMany(parseOp))<br>
> + return addErrorSuffix(" in '" + Twine(IDVal) + "' directive");<br>
> return false;<br>
> }<br>
><br>
> @@ -2975,21 +2926,20 @@ bool AsmParser::parseDirectiveFill(<wbr>) {<br>
> int64_t FillExpr = 0;<br>
><br>
> SMLoc SizeLoc, ExprLoc;<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
><br>
> - if (parseToken(AsmToken::Comma, "unexpected token in '.fill'<br>
> directive") ||<br>
> - parseTokenLoc(SizeLoc) || parseAbsoluteExpression(<wbr>FillSize))<br>
> + if (parseOptionalToken(AsmToken::<wbr>Comma)) {<br>
> + SizeLoc = getTok().getLoc();<br>
> + if (parseAbsoluteExpression(<wbr>FillSize))<br>
> return true;<br>
> -<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - if (parseToken(AsmToken::Comma,<br>
> - "unexpected token in '.fill' directive") ||<br>
> - parseTokenLoc(ExprLoc) || parseAbsoluteExpression(<wbr>FillExpr)<br>
> ||<br>
> - parseToken(AsmToken::<wbr>EndOfStatement,<br>
> - "unexpected token in '.fill' directive"))<br>
> + if (parseOptionalToken(AsmToken::<wbr>Comma)) {<br>
> + ExprLoc = getTok().getLoc();<br>
> + if (parseAbsoluteExpression(<wbr>FillExpr))<br>
> return true;<br>
> }<br>
> }<br>
> + if (parseToken(AsmToken::<wbr>EndOfStatement,<br>
> + "unexpected token in '.fill' directive"))<br>
> + return true;<br>
><br>
> if (FillSize < 0) {<br>
> Warning(SizeLoc, "'.fill' directive with negative size has no<br>
> effect");<br>
> @@ -3017,15 +2967,11 @@ bool AsmParser::parseDirectiveOrg() {<br>
><br>
> // Parse optional fill expression.<br>
> int64_t FillExpr = 0;<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - if (parseToken(AsmToken::Comma, "unexpected token in '.org'<br>
> directive") ||<br>
> - parseAbsoluteExpression(<wbr>FillExpr))<br>
> - return true;<br>
> - }<br>
> -<br>
> - if (parseToken(AsmToken::<wbr>EndOfStatement,<br>
> - "unexpected token in '.org' directive"))<br>
> - return true;<br>
> + if (parseOptionalToken(AsmToken::<wbr>Comma))<br>
> + if (parseAbsoluteExpression(<wbr>FillExpr))<br>
> + return addErrorSuffix(" in '.org' directive");<br>
> + if (parseToken(AsmToken::<wbr>EndOfStatement))<br>
> + return addErrorSuffix(" in '.org' directive");<br>
><br>
> getStreamer().<wbr>emitValueToOffset(Offset, FillExpr);<br>
> return false;<br>
> @@ -3036,38 +2982,33 @@ bool AsmParser::parseDirectiveOrg() {<br>
> bool AsmParser::<wbr>parseDirectiveAlign(bool IsPow2, unsigned ValueSize) {<br>
> SMLoc AlignmentLoc = getLexer().getLoc();<br>
> int64_t Alignment;<br>
> - if (checkForValidSection() || parseAbsoluteExpression(<wbr>Alignment))<br>
> - return true;<br>
> -<br>
> SMLoc MaxBytesLoc;<br>
> bool HasFillExpr = false;<br>
> int64_t FillExpr = 0;<br>
> int64_t MaxBytesToFill = 0;<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - if (parseToken(AsmToken::Comma, "unexpected token in directive"))<br>
> - return true;<br>
><br>
> - // The fill expression can be omitted while specifying a maximum<br>
> number of<br>
> - // alignment bytes, e.g:<br>
> - // .align 3,,4<br>
> - if (getTok().isNot(AsmToken::<wbr>Comma)) {<br>
> - HasFillExpr = true;<br>
> - if (parseAbsoluteExpression(<wbr>FillExpr))<br>
> - return true;<br>
> - }<br>
> -<br>
> - if (getTok().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - if (parseToken(AsmToken::Comma, "unexpected token in directive")<br>
> ||<br>
> - parseTokenLoc(MaxBytesLoc) ||<br>
> parseAbsoluteExpression(<wbr>MaxBytesToFill))<br>
> - return true;<br>
> + auto parseAlign = [&]() -> bool {<br>
> + if (checkForValidSection() || parseAbsoluteExpression(<wbr>Alignment))<br>
> + return true;<br>
> + if (parseOptionalToken(AsmToken::<wbr>Comma)) {<br>
> + // The fill expression can be omitted while specifying a maximum<br>
> number of<br>
> + // alignment bytes, e.g:<br>
> + // .align 3,,4<br>
> + if (getTok().isNot(AsmToken::<wbr>Comma)) {<br>
> + HasFillExpr = true;<br>
> + if (parseAbsoluteExpression(<wbr>FillExpr))<br>
> + return true;<br>
> + }<br>
> + if (parseOptionalToken(AsmToken::<wbr>Comma))<br>
> + if (parseTokenLoc(MaxBytesLoc) ||<br>
> + parseAbsoluteExpression(<wbr>MaxBytesToFill))<br>
> + return true;<br>
> }<br>
> - }<br>
> + return parseToken(AsmToken::<wbr>EndOfStatement);<br>
> + };<br>
><br>
> - if (parseToken(AsmToken::<wbr>EndOfStatement, "unexpected token in<br>
> directive"))<br>
> - return true;<br>
> -<br>
> - if (!HasFillExpr)<br>
> - FillExpr = 0;<br>
> + if (parseAlign())<br>
> + return addErrorSuffix(" in directive");<br>
><br>
> // Always emit an alignment here even if we thrown an error.<br>
> bool ReturnVal = false;<br>
> @@ -3185,7 +3126,7 @@ bool AsmParser::parseDirectiveFile(<wbr>SMLoc<br>
> /// ::= .line [number]<br>
> bool AsmParser::parseDirectiveLine(<wbr>) {<br>
> int64_t LineNumber;<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> + if (getLexer().is(AsmToken::<wbr>Integer)) {<br>
> if (parseIntToken(LineNumber, "unexpected token in '.line'<br>
> directive"))<br>
> return true;<br>
> (void)LineNumber;<br>
> @@ -3234,65 +3175,61 @@ bool AsmParser::parseDirectiveLoc() {<br>
> unsigned Flags = DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT :<br>
> 0;<br>
> unsigned Isa = 0;<br>
> int64_t Discriminator = 0;<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - while (true) {<br>
> - if (getLexer().is(AsmToken::<wbr>EndOfStatement))<br>
> - break;<br>
><br>
> - StringRef Name;<br>
> - SMLoc Loc = getTok().getLoc();<br>
> - if (parseIdentifier(Name))<br>
> - return TokError("unexpected token in '.loc' directive");<br>
> -<br>
> - if (Name == "basic_block")<br>
> - Flags |= DWARF2_FLAG_BASIC_BLOCK;<br>
> - else if (Name == "prologue_end")<br>
> - Flags |= DWARF2_FLAG_PROLOGUE_END;<br>
> - else if (Name == "epilogue_begin")<br>
> - Flags |= DWARF2_FLAG_EPILOGUE_BEGIN;<br>
> - else if (Name == "is_stmt") {<br>
> - Loc = getTok().getLoc();<br>
> - const MCExpr *Value;<br>
> - if (parseExpression(Value))<br>
> - return true;<br>
> - // The expression must be the constant 0 or 1.<br>
> - if (const MCConstantExpr *MCE =<br>
> dyn_cast<MCConstantExpr>(<wbr>Value)) {<br>
> - int Value = MCE->getValue();<br>
> - if (Value == 0)<br>
> - Flags &= ~DWARF2_FLAG_IS_STMT;<br>
> - else if (Value == 1)<br>
> - Flags |= DWARF2_FLAG_IS_STMT;<br>
> - else<br>
> - return Error(Loc, "is_stmt value not 0 or 1");<br>
> - } else {<br>
> - return Error(Loc, "is_stmt value not the constant value of 0<br>
> or 1");<br>
> - }<br>
> - } else if (Name == "isa") {<br>
> - Loc = getTok().getLoc();<br>
> - const MCExpr *Value;<br>
> - if (parseExpression(Value))<br>
> - return true;<br>
> - // The expression must be a constant greater or equal to 0.<br>
> - if (const MCConstantExpr *MCE =<br>
> dyn_cast<MCConstantExpr>(<wbr>Value)) {<br>
> - int Value = MCE->getValue();<br>
> - if (Value < 0)<br>
> - return Error(Loc, "isa number less than zero");<br>
> - Isa = Value;<br>
> - } else {<br>
> - return Error(Loc, "isa number not a constant value");<br>
> - }<br>
> - } else if (Name == "discriminator") {<br>
> - if (parseAbsoluteExpression(<wbr>Discriminator))<br>
> - return true;<br>
> + auto parseLocOp = [&]() -> bool {<br>
> + StringRef Name;<br>
> + SMLoc Loc = getTok().getLoc();<br>
> + if (parseIdentifier(Name))<br>
> + return TokError("unexpected token in '.loc' directive");<br>
> +<br>
> + if (Name == "basic_block")<br>
> + Flags |= DWARF2_FLAG_BASIC_BLOCK;<br>
> + else if (Name == "prologue_end")<br>
> + Flags |= DWARF2_FLAG_PROLOGUE_END;<br>
> + else if (Name == "epilogue_begin")<br>
> + Flags |= DWARF2_FLAG_EPILOGUE_BEGIN;<br>
> + else if (Name == "is_stmt") {<br>
> + Loc = getTok().getLoc();<br>
> + const MCExpr *Value;<br>
> + if (parseExpression(Value))<br>
> + return true;<br>
> + // The expression must be the constant 0 or 1.<br>
> + if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(<wbr>Value))<br>
> {<br>
> + int Value = MCE->getValue();<br>
> + if (Value == 0)<br>
> + Flags &= ~DWARF2_FLAG_IS_STMT;<br>
> + else if (Value == 1)<br>
> + Flags |= DWARF2_FLAG_IS_STMT;<br>
> + else<br>
> + return Error(Loc, "is_stmt value not 0 or 1");<br>
> } else {<br>
> - return Error(Loc, "unknown sub-directive in '.loc' directive");<br>
> + return Error(Loc, "is_stmt value not the constant value of 0 or<br>
> 1");<br>
> }<br>
> -<br>
> - if (getLexer().is(AsmToken::<wbr>EndOfStatement))<br>
> - break;<br>
> + } else if (Name == "isa") {<br>
> + Loc = getTok().getLoc();<br>
> + const MCExpr *Value;<br>
> + if (parseExpression(Value))<br>
> + return true;<br>
> + // The expression must be a constant greater or equal to 0.<br>
> + if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(<wbr>Value))<br>
> {<br>
> + int Value = MCE->getValue();<br>
> + if (Value < 0)<br>
> + return Error(Loc, "isa number less than zero");<br>
> + Isa = Value;<br>
> + } else {<br>
> + return Error(Loc, "isa number not a constant value");<br>
> + }<br>
> + } else if (Name == "discriminator") {<br>
> + if (parseAbsoluteExpression(<wbr>Discriminator))<br>
> + return true;<br>
> + } else {<br>
> + return Error(Loc, "unknown sub-directive in '.loc' directive");<br>
> }<br>
> - }<br>
> - Lex();<br>
> + return false;<br>
> + };<br>
> +<br>
> + if (parseMany(parseLocOp))<br>
> + return true;<br>
><br>
> getStreamer().<wbr>EmitDwarfLocDirective(<wbr>FileNumber, LineNumber,<br>
> ColumnPos, Flags,<br>
> Isa, Discriminator, StringRef());<br>
> @@ -3326,7 +3263,7 @@ bool AsmParser::<wbr>parseDirectiveCVFile() {<br>
> return true;<br>
><br>
> if (!getStreamer().<wbr>EmitCVFileDirective(<wbr>FileNumber, Filename))<br>
> - Error(FileNumberLoc, "file number already allocated");<br>
> + return Error(FileNumberLoc, "file number already allocated");<br>
><br>
> return false;<br>
> }<br>
> @@ -3366,7 +3303,7 @@ bool AsmParser::<wbr>parseDirectiveCVFuncId()<br>
> return true;<br>
><br>
> if (!getStreamer().<wbr>EmitCVFuncIdDirective(<wbr>FunctionId))<br>
> - Error(FunctionIdLoc, "function id already allocated");<br>
> + return Error(FunctionIdLoc, "function id already allocated");<br>
><br>
> return false;<br>
> }<br>
> @@ -3465,12 +3402,12 @@ bool AsmParser::<wbr>parseDirectiveCVLoc() {<br>
><br>
> bool PrologueEnd = false;<br>
> uint64_t IsStmt = 0;<br>
> - while (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> +<br>
> + auto parseOp = [&]() -> bool {<br>
> StringRef Name;<br>
> SMLoc Loc = getTok().getLoc();<br>
> if (parseIdentifier(Name))<br>
> return TokError("unexpected token in '.cv_loc' directive");<br>
> -<br>
> if (Name == "prologue_end")<br>
> PrologueEnd = true;<br>
> else if (Name == "is_stmt") {<br>
> @@ -3488,8 +3425,11 @@ bool AsmParser::<wbr>parseDirectiveCVLoc() {<br>
> } else {<br>
> return Error(Loc, "unknown sub-directive in '.cv_loc'<br>
> directive");<br>
> }<br>
> - }<br>
> - Lex();<br>
> + return false;<br>
> + };<br>
> +<br>
> + if (parseMany(parseOp, false /*hasComma*/))<br>
> + return true;<br>
><br>
> getStreamer().<wbr>EmitCVLocDirective(FunctionId, FileNumber, LineNumber,<br>
> ColumnPos, PrologueEnd, IsStmt,<br>
> StringRef(),<br>
> @@ -3636,12 +3576,12 @@ bool AsmParser::<wbr>parseDirectiveCFISection<br>
> /// ::= .cfi_startproc [simple]<br>
> bool AsmParser::<wbr>parseDirectiveCFIStartProc() {<br>
> StringRef Simple;<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement))<br>
> - if (parseIdentifier(Simple) || Simple != "simple")<br>
> - return TokError("unexpected token in .cfi_startproc directive");<br>
> -<br>
> - if (parseToken(AsmToken::<wbr>EndOfStatement, "Expected end of<br>
> statement"))<br>
> - return true;<br>
> + if (!parseOptionalToken(AsmToken:<wbr>:EndOfStatement)) {<br>
> + if (check(parseIdentifier(Simple) || Simple != "simple",<br>
> + "unexpected token") ||<br>
> + parseToken(AsmToken::<wbr>EndOfStatement))<br>
> + return addErrorSuffix(" in '.cfi_startproc' directive");<br>
> + }<br>
><br>
> getStreamer().<wbr>EmitCFIStartProc(!Simple.<wbr>empty());<br>
> return false;<br>
> @@ -4214,22 +4154,20 @@ bool AsmParser::<wbr>parseDirectiveBundleLock<br>
> return true;<br>
> bool AlignToEnd = false;<br>
><br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - StringRef Option;<br>
> - SMLoc Loc = getTok().getLoc();<br>
> - const char *kInvalidOptionError =<br>
> - "invalid option for '.bundle_lock' directive";<br>
> + StringRef Option;<br>
> + SMLoc Loc = getTok().getLoc();<br>
> + const char *kInvalidOptionError =<br>
> + "invalid option for '.bundle_lock' directive";<br>
><br>
> + if (!parseOptionalToken(AsmToken:<wbr>:EndOfStatement)) {<br>
> if (check(parseIdentifier(Option)<wbr>, Loc, kInvalidOptionError) ||<br>
> check(Option != "align_to_end", Loc, kInvalidOptionError) ||<br>
> - check(getTok().isNot(AsmToken:<wbr>:EndOfStatement), Loc,<br>
> - "unexpected token after '.bundle_lock' directive<br>
> option"))<br>
> + parseToken(AsmToken::<wbr>EndOfStatement,<br>
> + "unexpected token after '.bundle_lock' directive<br>
> option"))<br>
> return true;<br>
> AlignToEnd = true;<br>
> }<br>
><br>
> - Lex();<br>
> -<br>
> getStreamer().EmitBundleLock(<wbr>AlignToEnd);<br>
> return false;<br>
> }<br>
> @@ -4256,17 +4194,11 @@ bool AsmParser::<wbr>parseDirectiveSpace(Stri<br>
> return true;<br>
><br>
> int64_t FillExpr = 0;<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> -<br>
> - if (parseToken(AsmToken::Comma,<br>
> - "unexpected token in '" + Twine(IDVal) + "'<br>
> directive") ||<br>
> - parseAbsoluteExpression(<wbr>FillExpr))<br>
> - return true;<br>
> - }<br>
> -<br>
> - if (parseToken(AsmToken::<wbr>EndOfStatement,<br>
> - "unexpected token in '" + Twine(IDVal) + "'<br>
> directive"))<br>
> - return true;<br>
> + if (parseOptionalToken(AsmToken::<wbr>Comma))<br>
> + if (parseAbsoluteExpression(<wbr>FillExpr))<br>
> + return addErrorSuffix("in '" + Twine(IDVal) + "' directive");<br>
> + if (parseToken(AsmToken::<wbr>EndOfStatement))<br>
> + return addErrorSuffix("in '" + Twine(IDVal) + "' directive");<br>
><br>
> // FIXME: Sometimes the fill expr is 'nop' if it isn't supplied,<br>
> instead of 0.<br>
> getStreamer().emitFill(*<wbr>NumBytes, FillExpr, NumBytesLoc);<br>
> @@ -4378,24 +4310,19 @@ bool AsmParser::<wbr>parseDirectiveLEB128(boo<br>
> if (checkForValidSection())<br>
> return true;<br>
><br>
> - const MCExpr *Value;<br>
> -<br>
> - while (true) {<br>
> + auto parseOp = [&]() -> bool {<br>
> + const MCExpr *Value;<br>
> if (parseExpression(Value))<br>
> return true;<br>
> -<br>
> if (Signed)<br>
> getStreamer().<wbr>EmitSLEB128Value(Value);<br>
> else<br>
> getStreamer().<wbr>EmitULEB128Value(Value);<br>
> + return false;<br>
> + };<br>
><br>
> - if (getLexer().is(AsmToken::<wbr>EndOfStatement))<br>
> - break;<br>
> -<br>
> - if (parseToken(AsmToken::Comma, "unexpected token in directive"))<br>
> - return true;<br>
> - }<br>
> - Lex();<br>
> + if (parseMany(parseOp))<br>
> + return addErrorSuffix(" in directive");<br>
><br>
> return false;<br>
> }<br>
> @@ -4403,32 +4330,24 @@ bool AsmParser::<wbr>parseDirectiveLEB128(boo<br>
> /// parseDirectiveSymbolAttribute<br>
> /// ::= { ".globl", ".weak", ... } [ identifier ( , identifier )* ]<br>
> bool AsmParser::<wbr>parseDirectiveSymbolAttribute(<wbr>MCSymbolAttr Attr) {<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - while (true) {<br>
> - StringRef Name;<br>
> - SMLoc Loc = getTok().getLoc();<br>
> -<br>
> - if (parseIdentifier(Name))<br>
> - return Error(Loc, "expected identifier in directive");<br>
> -<br>
> - MCSymbol *Sym = getContext().<wbr>getOrCreateSymbol(Name);<br>
> -<br>
> - // Assembler local symbols don't make any sense here. Complain<br>
> loudly.<br>
> - if (Sym->isTemporary())<br>
> - return Error(Loc, "non-local symbol required in directive");<br>
> -<br>
> - if (!getStreamer().<wbr>EmitSymbolAttribute(Sym, Attr))<br>
> - return Error(Loc, "unable to emit symbol attribute");<br>
> + auto parseOp = [&]() -> bool {<br>
> + StringRef Name;<br>
> + SMLoc Loc = getTok().getLoc();<br>
> + if (parseIdentifier(Name))<br>
> + return Error(Loc, "expected identifier");<br>
> + MCSymbol *Sym = getContext().<wbr>getOrCreateSymbol(Name);<br>
><br>
> - if (getLexer().is(AsmToken::<wbr>EndOfStatement))<br>
> - break;<br>
> + // Assembler local symbols don't make any sense here. Complain<br>
> loudly.<br>
> + if (Sym->isTemporary())<br>
> + return Error(Loc, "non-local symbol required");<br>
><br>
> - if (parseToken(AsmToken::Comma, "unexpected token in directive"))<br>
> - return true;<br>
> - }<br>
> - }<br>
> + if (!getStreamer().<wbr>EmitSymbolAttribute(Sym, Attr))<br>
> + return Error(Loc, "unable to emit symbol attribute");<br>
> + return false;<br>
> + };<br>
><br>
> - Lex();<br>
> + if (parseMany(parseOp))<br>
> + return addErrorSuffix(" in directive");<br>
> return false;<br>
> }<br>
><br>
> @@ -4476,10 +4395,9 @@ bool AsmParser::parseDirectiveComm(<wbr>bool<br>
> }<br>
> }<br>
><br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement))<br>
> - return TokError("unexpected token in '.comm' or '.lcomm'<br>
> directive");<br>
> -<br>
> - Lex();<br>
> + if (parseToken(AsmToken::<wbr>EndOfStatement,<br>
> + "unexpected token in '.comm' or '.lcomm' directive"))<br>
> + return true;<br>
><br>
> // NOTE: a size of zero for a .comm should create a undefined symbol<br>
> // but a size of .lcomm creates a bss symbol of size zero.<br>
> @@ -4562,20 +4480,16 @@ bool AsmParser::<wbr>parseDirectiveIncbin() {<br>
> int64_t Skip = 0;<br>
> const MCExpr *Count = nullptr;<br>
> SMLoc SkipLoc, CountLoc;<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - if (parseToken(AsmToken::Comma, "unexpected token in '.incbin'<br>
> directive"))<br>
> - return true;<br>
> -<br>
> + if (parseOptionalToken(AsmToken::<wbr>Comma)) {<br>
> // The skip expression can be omitted while specifying the count,<br>
> e.g:<br>
> // .incbin "filename",,4<br>
> if (getTok().isNot(AsmToken::<wbr>Comma)) {<br>
> if (parseTokenLoc(SkipLoc) || parseAbsoluteExpression(Skip))<br>
> return true;<br>
> }<br>
> -<br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> - if (parseToken(AsmToken::Comma, "unexpected token in '.incbin'<br>
> directive") ||<br>
> - parseTokenLoc(CountLoc) || parseExpression(Count))<br>
> + if (parseOptionalToken(AsmToken::<wbr>Comma)) {<br>
> + CountLoc = getTok().getLoc();<br>
> + if (parseExpression(Count))<br>
> return true;<br>
> }<br>
> }<br>
> @@ -4771,10 +4685,10 @@ bool AsmParser::<wbr>parseDirectiveElseIf(SML<br>
> if (parseAbsoluteExpression(<wbr>ExprValue))<br>
> return true;<br>
><br>
> - if (getLexer().isNot(AsmToken::<wbr>EndOfStatement))<br>
> - return TokError("unexpected token in '.elseif' directive");<br>
> + if (parseToken(AsmToken::<wbr>EndOfStatement,<br>
> + "unexpected token in '.elseif' directive"))<br>
> + return true;<br>
><br>
> - Lex();<br>
> TheCondState.CondMet = ExprValue;<br>
> TheCondState.Ignore = !TheCondState.CondMet;<br>
> }<br>
> @@ -4813,7 +4727,7 @@ bool AsmParser::parseDirectiveEnd(<wbr>SMLoc<br>
> return true;<br>
><br>
> while (Lexer.isNot(AsmToken::Eof))<br>
> - Lex();<br>
> + Lexer.Lex();<br>
><br>
> return false;<br>
> }<br>
> @@ -4855,12 +4769,16 @@ bool AsmParser::<wbr>parseDirectiveWarning(SM<br>
> }<br>
><br>
> StringRef Message = ".warning directive invoked in source file";<br>
> - if (Lexer.isNot(AsmToken::<wbr>EndOfStatement)) {<br>
> +<br>
> + if (!parseOptionalToken(AsmToken:<wbr>:EndOfStatement)) {<br>
> if (Lexer.isNot(AsmToken::String)<wbr>)<br>
> return TokError(".warning argument must be a string");<br>
><br>
> Message = getTok().getStringContents();<br>
> Lex();<br>
> + if (parseToken(AsmToken::<wbr>EndOfStatement,<br>
> + "expected end of statement in '.warning'<br>
> directive"))<br>
> + return true;<br>
> }<br>
><br>
> return Warning(L, Message);<br>
> @@ -5547,19 +5465,15 @@ bool parseAssignmentExpression(<wbr>StringRef<br>
> SMLoc EqualLoc = Parser.getTok().getLoc();<br>
><br>
> if (Parser.parseExpression(Value)<wbr>) {<br>
> - Parser.TokError("missing expression");<br>
> - return true;<br>
> + return Parser.TokError("missing expression");<br>
> }<br>
><br>
> // Note: we don't count b as used in "a = b". This is to allow<br>
> // a = b<br>
> // b = c<br>
><br>
> - if (Parser.getTok().isNot(<wbr>AsmToken::EndOfStatement))<br>
> - return Parser.TokError("unexpected token in assignment");<br>
> -<br>
> - // Eat the end of statement marker.<br>
> - Parser.Lex();<br>
> + if (Parser.parseToken(AsmToken::<wbr>EndOfStatement))<br>
> + return true;<br>
><br>
> // Validate that the LHS is allowed to be a variable (either it has<br>
> not been<br>
> // used as a symbol, or it is an absolute symbol).<br>
><br>
> Modified: llvm/trunk/lib/MC/MCParser/<wbr>MCAsmParser.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/lib/MC/<wbr>MCParser/MCAsmParser.cpp?rev=<wbr>284978&r1=284977&<br>
> r2=284978&view=diff<br>
> ==============================<wbr>==============================<wbr>============<br>
> ======<br>
> --- llvm/trunk/lib/MC/MCParser/<wbr>MCAsmParser.cpp (original)<br>
> +++ llvm/trunk/lib/MC/MCParser/<wbr>MCAsmParser.cpp Mon Oct 24 09:35:29 2016<br>
> @@ -68,11 +68,14 @@ bool MCAsmParser::parseIntToken(<wbr>int64_t<br>
> return false;<br>
> }<br>
><br>
> -bool MCAsmParser::<wbr>parseOptionalToken(AsmToken::<wbr>TokenKind T, bool<br>
> &Present) {<br>
> - Present = (getTok().getKind() == T);<br>
> +bool MCAsmParser::<wbr>parseOptionalToken(AsmToken::<wbr>TokenKind T) {<br>
> + bool Present = (getTok().getKind() == T);<br>
> + // if token is EOL and current token is # this is an EOL comment.<br>
> + if (getTok().getKind() == AsmToken::Hash && T ==<br>
> AsmToken::EndOfStatement)<br>
> + Present = true;<br>
> if (Present)<br>
> - Lex();<br>
> - return false;<br>
> + parseToken(T);<br>
> + return Present;<br>
> }<br>
><br>
> bool MCAsmParser::check(bool P, const Twine &Msg) {<br>
> @@ -97,9 +100,38 @@ bool MCAsmParser::Error(SMLoc L, const T<br>
> Msg.toVector(PErr.Msg);<br>
> PErr.Range = Range;<br>
> PendingErrors.push_back(PErr);<br>
> +<br>
> + // If we threw this parsing error after a lexing error, this should<br>
> + // supercede the lexing error and so we remove it from the Lexer<br>
> + // before it can propagate<br>
> + if (getTok().is(AsmToken::Error))<br>
> + getLexer().Lex();<br>
> + return true;<br>
> +}<br>
> +<br>
> +bool MCAsmParser::addErrorSuffix(<wbr>const Twine &Suffix) {<br>
> + // Make sure lexing errors have propagated to the parser.<br>
> + if (getTok().is(AsmToken::Error))<br>
> + Lex();<br>
> + for (auto &PErr : PendingErrors)<br>
> + Suffix.toVector(PErr.Msg);<br>
> return true;<br>
> }<br>
><br>
> +bool MCAsmParser::parseMany(std::<wbr>function<bool()> parseOne, bool<br>
> hasComma) {<br>
> + if (parseOptionalToken(AsmToken::<wbr>EndOfStatement))<br>
> + return false;<br>
> + while (1) {<br>
> + if (parseOne())<br>
> + return true;<br>
> + if (parseOptionalToken(AsmToken::<wbr>EndOfStatement))<br>
> + return false;<br>
> + if (hasComma && parseToken(AsmToken::Comma))<br>
> + return true;<br>
> + }<br>
> + return false;<br>
> +}<br>
> +<br>
> bool MCAsmParser::parseExpression(<wbr>const MCExpr *&Res) {<br>
> SMLoc L;<br>
> return parseExpression(Res, L);<br>
><br>
> Added: llvm/trunk/test/MC/AsmParser/<wbr>AArch64/directive-parse-err.s<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/test/MC/<wbr>AsmParser/AArch64/directive-<wbr>parse-<br>
> err.s?rev=284978&view=auto<br>
> ==============================<wbr>==============================<wbr>============<br>
> ======<br>
> --- llvm/trunk/test/MC/AsmParser/<wbr>AArch64/directive-parse-err.s (added)<br>
> +++ llvm/trunk/test/MC/AsmParser/<wbr>AArch64/directive-parse-err.s Mon Oct<br>
> 24 09:35:29 2016<br>
> @@ -0,0 +1,258 @@<br>
> +// RUN: not llvm-mc -triple aarch64-unknown-unknown %s 2>&1 | FileCheck<br>
> %s<br>
> +// RUN: not llvm-mc -triple aarch64-unknown-unknown %s 2>&1 | grep<br>
> "error:" | count 60<br>
> +<br>
> + // CHECK: [[@LINE+1]]:19: error: unexpected token in '.equ'<br>
> directive<br>
> + .equ ident1, 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .equ ident1, 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:19: error: unexpected token in '.equiv'<br>
> directive<br>
> + .equiv ident2, 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .equiv ident2, 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:19: error: unexpected token in '.set'<br>
> directive<br>
> + .set ident3, 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .set ident3, 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:20: error: unexpected token in '.ascii'<br>
> directive<br>
> + .ascii "string1" $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .ascii "string1" # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:20: error: unexpected token in '.asciz'<br>
> directive<br>
> + .asciz "string2" $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .asciz "string2" # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:20: error: unexpected token in '.string'<br>
> directive<br>
> + .string "string3" $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .string "string3" # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.byte'<br>
> directive<br>
> + .byte 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .byte 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.b'<br>
> directive<br>
> + .dc.b 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .dc.b 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:8: error: unexpected token in '.dc'<br>
> directive<br>
> + .dc 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .dc.b 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.w'<br>
> directive<br>
> + .dc.w 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .dc.w 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:11: error: unexpected token in '.short'<br>
> directive<br>
> + .short 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .short 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:11: error: unexpected token in '.value'<br>
> directive<br>
> + .value 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .value 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:11: error: unexpected token in '.2byte'<br>
> directive<br>
> + .2byte 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .2byte 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.long'<br>
> directive<br>
> + .long 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .long 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.int'<br>
> directive<br>
> + .int 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .int 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:11: error: unexpected token in '.4byte'<br>
> directive<br>
> + .4byte 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .4byte 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.l'<br>
> directive<br>
> + .dc.l 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .dc.l 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.quad'<br>
> directive<br>
> + .quad 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .quad 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:11: error: unexpected token in '.8byte'<br>
> directive<br>
> + .8byte 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .8byte 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.a'<br>
> directive<br>
> + .dc.a 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .dc.a 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.octa'<br>
> directive<br>
> + .octa 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .octa 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:12: error: unexpected token in '.single'<br>
> directive<br>
> + .single 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .single 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:11: error: unexpected token in '.float'<br>
> directive<br>
> + .float 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .float 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.s'<br>
> directive<br>
> + .dc.s 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .dc.s 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:12: error: unexpected token in '.double'<br>
> directive<br>
> + .double 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .double 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.d'<br>
> directive<br>
> + .dc.d 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .dc.d 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:13: error: unexpected token in '.fill'<br>
> directive<br>
> + .fill 1, 1 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .fill 1, 1 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:17: error: unexpected token in '.fill'<br>
> directive<br>
> + .fill 1, 1, 10 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .fill 1, 1, 10 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:16: error: unexpected token in '.org'<br>
> directive<br>
> + .org 1 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .org 1 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:11: error: unexpected token in directive<br>
><br>
> + .align 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .align 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:13: error: unexpected token in directive<br>
> + .align32 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .align32 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:12: error: unexpected token in directive<br>
> + .balign 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .balign 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:13: error: unexpected token in directive<br>
> + .balignw 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .balignw 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:13: error: unexpected token in directive<br>
> + .balignl 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .balignl 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:13: error: unexpected token in directive<br>
> + .p2align 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .p2align 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:14: error: unexpected token in directive<br>
> + .p2alignw 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .p2alignw 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:14: error: unexpected token in directive<br>
> + .p2alignl 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .p2alignl 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:8: error: unexpected token in '.line'<br>
> directive<br>
> + .line $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .line # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:10: error: unexpected token in '.line'<br>
> directive<br>
> + .line 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .line 0 # EOL COMMENT<br>
> +<br>
> + .file 1 "hello"<br>
> + // CHECK: [[@LINE+1]]:16: error: unexpected token in '.loc'<br>
> directive<br>
> + .loc 1 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .loc 1 # EOL COMMENT<br>
> +<br>
> + // CHECK: [[@LINE+1]]:21: error: unexpected token in '.cv_file'<br>
> directive<br>
> + .cv_file 1 "hello" $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .cv_file 1 "hello" # EOL COMMENT<br>
> +<br>
> + .cv_func_id 1<br>
> + // CHECK: [[@LINE+1]]:14: error: unexpected token in '.cv_loc'<br>
> directive<br>
> + .cv_loc 1 1 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .cv_loc 1 1 # EOL COMMENT<br>
> +<br>
> + // CHECK: [[@LINE+1]]:28: error: unexpected token after<br>
> '.bundle_lock' directive option<br>
> + .bundle_lock align_to_end $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .bundle_lock align_to_end # EOL COMMENT<br>
> +<br>
> + // CHECK: [[@LINE+1]]:11: error: invalid token in expression in<br>
> directive<br>
> + .sleb128 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .sleb128 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:13: error: unexpected token in directive<br>
> + .sleb128 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .sleb128 0 # EOL COMMENT<br>
> +<br>
> + // CHECK: [[@LINE+1]]:11: error: invalid token in expression in<br>
> directive<br>
> + .uleb128 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .uleb128 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:13: error: unexpected token in directive<br>
> + .uleb128 0 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .uleb128 0 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:31: error: unexpected token<br>
> + .globl a1 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .globl a1 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:31: error: unexpected token in directive<br>
> + .global a2 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .global a2 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:31: error: unexpected token in directive<br>
> + .lazy_reference a3 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .lazy_reference a3 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:31: error: unexpected token in directive<br>
> + .symbol_resolver a4 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .symbol_resolver a4 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:31: error: unexpected token in directive<br>
> + .private_extern a5 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .private_extern a5 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:31: error: unexpected token in directive<br>
> + .reference a6 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .reference a6 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:31: error: unexpected token in directive<br>
> + .weak_definition a7 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .weak_definition a7 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:31: error: unexpected token in directive<br>
> + .weak_reference a8 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .weak_reference a8 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:31: error: unexpected token in directive<br>
> + .weak_def_can_be_hidden a9 $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .weak_def_can_be_hidden a9 # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:12: error: .warning argument must be a<br>
> string<br>
> + .warning $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .warning # EOL COMMENT<br>
> + // CHECK: [[@LINE+1]]:21: error: expected end of statement in<br>
> '.warning' directive<br>
> + .warning "warning" $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .warning "warning" # EOL COMMENT<br>
> +<br>
> +<br>
> + // CHECK: [[@LINE+1]]:17: error: unexpected token in<br>
> '.cfi_startproc' directive<br>
> + .cfi_startproc $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .cfi_startproc # EOL COMMENT<br>
> + .cfi_endproc<br>
> + // CHECK: [[@LINE+1]]:24: error: unexpected token in<br>
> '.cfi_startproc' directive<br>
> + .cfi_startproc simple $<br>
> + // CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:<br>
> + .cfi_startproc simple # EOL COMMENT<br>
> + .cfi_endproc<br>
> +<br>
> +<br>
> + // CHECK-NOT: error:<br>
><br>
> Added: llvm/trunk/test/MC/AsmParser/<wbr>AArch64/lit.local.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/test/MC/<wbr>AsmParser/AArch64/lit.local.<wbr>cfg?rev=284978&vi<br>
> ew=auto<br>
> ==============================<wbr>==============================<wbr>============<br>
> ======<br>
> --- llvm/trunk/test/MC/AsmParser/<wbr>AArch64/lit.local.cfg (added)<br>
> +++ llvm/trunk/test/MC/AsmParser/<wbr>AArch64/lit.local.cfg Mon Oct 24<br>
> 09:35:29 2016<br>
> @@ -0,0 +1,2 @@<br>
> +if 'AArch64' not in config.root.targets:<br>
> + config.unsupported = True<br>
><br>
> Modified: llvm/trunk/test/MC/AsmParser/<wbr>exprs-invalid.s<br>
> URL: <a href="http://llvm.org/viewvc/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
> project/llvm/trunk/test/MC/<wbr>AsmParser/exprs-<br>
> invalid.s?rev=284978&r1=<wbr>284977&r2=284978&view=diff<br>
> ==============================<wbr>==============================<wbr>============<br>
> ======<br>
> --- llvm/trunk/test/MC/AsmParser/<wbr>exprs-invalid.s (original)<br>
> +++ llvm/trunk/test/MC/AsmParser/<wbr>exprs-invalid.s Mon Oct 24 09:35:29<br>
> 2016<br>
> @@ -1,17 +1,17 @@<br>
> // RUN: not llvm-mc -triple x86_64-apple-darwin10 %s 2> %t.err |<br>
> FileCheck %s<br>
> // RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err<br>
> // CHECK: .section __TEXT,__text,regular,pure_<wbr>instructions<br>
> -// CHECK-ERRORS: error: invalid octal number<br>
> +// CHECK-ERRORS: [[@LINE+1]]:10: error: invalid octal number in '.long'<br>
> directive<br>
> .long 80+08<br>
><br>
> -// CHECK-ERRORS: error: invalid hexadecimal number<br>
> +// CHECK-ERRORS: [[@LINE+1]]:10: error: invalid hexadecimal number in<br>
> '.long' directive<br>
> .long 80+0xzz<br>
><br>
> -// CHECK-ERRORS: error: literal value out of range for directive<br>
> +// CHECK-ERRORS: [[@LINE+1]]:7: error: out of range literal value in<br>
> '.byte' directive<br>
> .byte 256<br>
><br>
> -// CHECK-ERRORS: error: literal value out of range for directive<br>
> +// CHECK-ERRORS: [[@LINE+1]]:7: error: out of range literal value in<br>
> '.long' directive<br>
> .long 4e71cf69 // double floating point constant due to missing "0x"<br>
><br>
> -// CHECK-ERRORS: error: literal value out of range for directive<br>
> +// CHECK-ERRORS: [[@LINE+1]]:7: error: literal value out of range for<br>
> directive<br>
> .word 0xfffffffff<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>