[llvm] 7ad4b26 - [RISCV][CSKY][Loong] Pass Twine by const reference instead of by value. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 26 10:47:24 PDT 2023
Author: Craig Topper
Date: 2023-04-26T10:43:55-07:00
New Revision: 7ad4b2622af9e5e19dc931b1877c5f9814f2b66b
URL: https://github.com/llvm/llvm-project/commit/7ad4b2622af9e5e19dc931b1877c5f9814f2b66b
DIFF: https://github.com/llvm/llvm-project/commit/7ad4b2622af9e5e19dc931b1877c5f9814f2b66b.diff
LOG: [RISCV][CSKY][Loong] Pass Twine by const reference instead of by value. NFC
I think RISCV was the original here and the CSKY and Loong copied it.
Added:
Modified:
llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp b/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
index 5198399a4ebf7..2b1e2e7c366e8 100644
--- a/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
+++ b/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
@@ -61,7 +61,8 @@ class CSKYAsmParser : public MCTargetAsmParser {
unsigned Kind) override;
bool generateImmOutOfRangeError(OperandVector &Operands, uint64_t ErrorInfo,
- int64_t Lower, int64_t Upper, Twine Msg);
+ int64_t Lower, int64_t Upper,
+ const Twine &Msg);
SMLoc getLoc() const { return getParser().getTok().getLoc(); }
@@ -650,7 +651,7 @@ static std::string CSKYMnemonicSpellCheck(StringRef S, const FeatureBitset &FBS,
bool CSKYAsmParser::generateImmOutOfRangeError(
OperandVector &Operands, uint64_t ErrorInfo, int64_t Lower, int64_t Upper,
- Twine Msg = "immediate must be an integer in the range") {
+ const Twine &Msg = "immediate must be an integer in the range") {
SMLoc ErrorLoc = ((CSKYOperand &)*Operands[ErrorInfo]).getStartLoc();
return Error(ErrorLoc, Msg + " [" + Twine(Lower) + ", " + Twine(Upper) + "]");
}
diff --git a/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp b/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
index 9d6d981bb9082..164f8a2f7e648 100644
--- a/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
+++ b/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
@@ -64,7 +64,8 @@ class LoongArchAsmParser : public MCTargetAsmParser {
unsigned Kind) override;
bool generateImmOutOfRangeError(OperandVector &Operands, uint64_t ErrorInfo,
- int64_t Lower, int64_t Upper, Twine Msg);
+ int64_t Lower, int64_t Upper,
+ const Twine &Msg);
/// Helper for processing MC instructions that have been successfully matched
/// by MatchAndEmitInstruction.
@@ -1242,7 +1243,7 @@ LoongArchAsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp,
bool LoongArchAsmParser::generateImmOutOfRangeError(
OperandVector &Operands, uint64_t ErrorInfo, int64_t Lower, int64_t Upper,
- Twine Msg = "immediate must be an integer in the range") {
+ const Twine &Msg = "immediate must be an integer in the range") {
SMLoc ErrorLoc = ((LoongArchOperand &)*Operands[ErrorInfo]).getStartLoc();
return Error(ErrorLoc, Msg + " [" + Twine(Lower) + ", " + Twine(Upper) + "]");
}
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index df7947f2d8818..d1982928168da 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -85,7 +85,8 @@ class RISCVAsmParser : public MCTargetAsmParser {
unsigned checkTargetMatchPredicate(MCInst &Inst) override;
bool generateImmOutOfRangeError(OperandVector &Operands, uint64_t ErrorInfo,
- int64_t Lower, int64_t Upper, Twine Msg);
+ int64_t Lower, int64_t Upper,
+ const Twine &Msg);
bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
OperandVector &Operands, MCStreamer &Out,
@@ -1168,7 +1169,7 @@ unsigned RISCVAsmParser::checkTargetMatchPredicate(MCInst &Inst) {
bool RISCVAsmParser::generateImmOutOfRangeError(
OperandVector &Operands, uint64_t ErrorInfo, int64_t Lower, int64_t Upper,
- Twine Msg = "immediate must be an integer in the range") {
+ const Twine &Msg = "immediate must be an integer in the range") {
SMLoc ErrorLoc = ((RISCVOperand &)*Operands[ErrorInfo]).getStartLoc();
return Error(ErrorLoc, Msg + " [" + Twine(Lower) + ", " + Twine(Upper) + "]");
}
More information about the llvm-commits
mailing list