[llvm] 0e9409d - [Xtensa] Use parseOptionalToken. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 15 11:51:56 PDT 2023
Author: Fangrui Song
Date: 2023-06-15T11:51:52-07:00
New Revision: 0e9409d926956f6d19c1fe36cbd15de231ef8e7c
URL: https://github.com/llvm/llvm-project/commit/0e9409d926956f6d19c1fe36cbd15de231ef8e7c
DIFF: https://github.com/llvm/llvm-project/commit/0e9409d926956f6d19c1fe36cbd15de231ef8e7c.diff
LOG: [Xtensa] Use parseOptionalToken. NFC
Added:
Modified:
llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp b/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp
index 1bf2f3cbc2847..b8632d4ababf6 100644
--- a/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp
+++ b/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp
@@ -642,14 +642,12 @@ bool XtensaAsmParser::ParseInstructionWithSR(ParseInstructionInfo &Info,
if (parseOperand(Operands, Name))
return true;
- if (!getLexer().is(AsmToken::Comma)) {
+ if (!parseOptionalToken(AsmToken::Comma)) {
SMLoc Loc = getLexer().getLoc();
getParser().eatToEndOfStatement();
return Error(Loc, "unexpected token");
}
- getLexer().Lex();
-
// Parse second operand
if (parseOperand(Operands, Name, true))
return true;
@@ -685,14 +683,9 @@ bool XtensaAsmParser::ParseInstruction(ParseInstructionInfo &Info,
return true;
// Parse until end of statement, consuming commas between operands
- while (getLexer().is(AsmToken::Comma)) {
- // Consume comma token
- getLexer().Lex();
-
- // Parse next operand
+ while (parseOptionalToken(AsmToken::Comma))
if (parseOperand(Operands, Name))
return true;
- }
if (getLexer().isNot(AsmToken::EndOfStatement)) {
SMLoc Loc = getLexer().getLoc();
More information about the llvm-commits
mailing list