Skip to content

Commit f03a16e

Browse files
committed
[LoongArch] Use parseOptionalToken. NFC
1 parent 280b859 commit f03a16e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,8 @@ bool LoongArchAsmParser::classifySymbolRef(const MCExpr *Expr,
566566

567567
OperandMatchResultTy
568568
LoongArchAsmParser::parseRegister(OperandVector &Operands) {
569-
if (getLexer().getTok().isNot(AsmToken::Dollar))
569+
if (!parseOptionalToken(AsmToken::Dollar))
570570
return MatchOperand_NoMatch;
571-
572-
// Eat the $ prefix.
573-
getLexer().Lex();
574571
if (getLexer().getKind() != AsmToken::Identifier)
575572
return MatchOperand_NoMatch;
576573

@@ -691,8 +688,7 @@ LoongArchAsmParser::parseAtomicMemOp(OperandVector &Operands) {
691688

692689
// If there is a next operand and it is 0, ignore it. Otherwise print a
693690
// diagnostic message.
694-
if (getLexer().is(AsmToken::Comma)) {
695-
getLexer().Lex(); // Consume comma token.
691+
if (parseOptionalToken(AsmToken::Comma)) {
696692
int64_t ImmVal;
697693
SMLoc ImmStart = getLoc();
698694
if (getParser().parseIntToken(ImmVal, "expected optional integer offset"))

0 commit comments

Comments
 (0)