Skip to content

Commit 0e9409d

Browse files
committed
[Xtensa] Use parseOptionalToken. NFC
1 parent 7163539 commit 0e9409d

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -642,14 +642,12 @@ bool XtensaAsmParser::ParseInstructionWithSR(ParseInstructionInfo &Info,
642642
if (parseOperand(Operands, Name))
643643
return true;
644644

645-
if (!getLexer().is(AsmToken::Comma)) {
645+
if (!parseOptionalToken(AsmToken::Comma)) {
646646
SMLoc Loc = getLexer().getLoc();
647647
getParser().eatToEndOfStatement();
648648
return Error(Loc, "unexpected token");
649649
}
650650

651-
getLexer().Lex();
652-
653651
// Parse second operand
654652
if (parseOperand(Operands, Name, true))
655653
return true;
@@ -685,14 +683,9 @@ bool XtensaAsmParser::ParseInstruction(ParseInstructionInfo &Info,
685683
return true;
686684

687685
// Parse until end of statement, consuming commas between operands
688-
while (getLexer().is(AsmToken::Comma)) {
689-
// Consume comma token
690-
getLexer().Lex();
691-
692-
// Parse next operand
686+
while (parseOptionalToken(AsmToken::Comma))
693687
if (parseOperand(Operands, Name))
694688
return true;
695-
}
696689

697690
if (getLexer().isNot(AsmToken::EndOfStatement)) {
698691
SMLoc Loc = getLexer().getLoc();

0 commit comments

Comments
 (0)