[llvm] f03a16e - [LoongArch] Use parseOptionalToken. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 15 12:01:21 PDT 2023
Author: Fangrui Song
Date: 2023-06-15T12:01:16-07:00
New Revision: f03a16e633f2ca67e6e1100955e223c64c76dc71
URL: https://github.com/llvm/llvm-project/commit/f03a16e633f2ca67e6e1100955e223c64c76dc71
DIFF: https://github.com/llvm/llvm-project/commit/f03a16e633f2ca67e6e1100955e223c64c76dc71.diff
LOG: [LoongArch] Use parseOptionalToken. NFC
Added:
Modified:
llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp b/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
index a3ba9aab9e862..a28e9e5efc954 100644
--- a/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
+++ b/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
@@ -566,11 +566,8 @@ bool LoongArchAsmParser::classifySymbolRef(const MCExpr *Expr,
OperandMatchResultTy
LoongArchAsmParser::parseRegister(OperandVector &Operands) {
- if (getLexer().getTok().isNot(AsmToken::Dollar))
+ if (!parseOptionalToken(AsmToken::Dollar))
return MatchOperand_NoMatch;
-
- // Eat the $ prefix.
- getLexer().Lex();
if (getLexer().getKind() != AsmToken::Identifier)
return MatchOperand_NoMatch;
@@ -691,8 +688,7 @@ LoongArchAsmParser::parseAtomicMemOp(OperandVector &Operands) {
// If there is a next operand and it is 0, ignore it. Otherwise print a
// diagnostic message.
- if (getLexer().is(AsmToken::Comma)) {
- getLexer().Lex(); // Consume comma token.
+ if (parseOptionalToken(AsmToken::Comma)) {
int64_t ImmVal;
SMLoc ImmStart = getLoc();
if (getParser().parseIntToken(ImmVal, "expected optional integer offset"))
More information about the llvm-commits
mailing list