From 7ad4b2622af9e5e19dc931b1877c5f9814f2b66b Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 26 Apr 2023 10:41:57 -0700 Subject: [PATCH] [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. --- llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp | 5 +++-- llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp | 5 +++-- llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp b/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp index 5198399..2b1e2e7 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 9d6d981..164f8a2 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 df7947f..d198292 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) + "]"); } -- 2.7.4