[lld] 483516f - [ELF] Remove unneeded Twine()
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 16 20:32:49 PST 2024
Author: Fangrui Song
Date: 2024-11-16T20:32:44-08:00
New Revision: 483516fd83f000fd6b2ac1cde943f5639f72b9e9
URL: https://github.com/llvm/llvm-project/commit/483516fd83f000fd6b2ac1cde943f5639f72b9e9
DIFF: https://github.com/llvm/llvm-project/commit/483516fd83f000fd6b2ac1cde943f5639f72b9e9.diff
LOG: [ELF] Remove unneeded Twine()
Added:
Modified:
lld/ELF/Arch/AMDGPU.cpp
lld/ELF/Arch/RISCV.cpp
lld/ELF/Driver.cpp
lld/ELF/DriverUtils.cpp
lld/ELF/InputFiles.cpp
lld/ELF/InputSection.cpp
lld/ELF/ScriptLexer.cpp
lld/ELF/SyntheticSections.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Arch/AMDGPU.cpp b/lld/ELF/Arch/AMDGPU.cpp
index df7e4ee04bb885..ab948e65c25ed0 100644
--- a/lld/ELF/Arch/AMDGPU.cpp
+++ b/lld/ELF/Arch/AMDGPU.cpp
@@ -143,7 +143,7 @@ uint32_t AMDGPU::calcEFlags() const {
case ELFABIVERSION_AMDGPU_HSA_V6:
return calcEFlagsV6();
default:
- ErrAlways(ctx) << "unknown abi version: " << Twine(abiVersion);
+ ErrAlways(ctx) << "unknown abi version: " << abiVersion;
return 0;
}
}
diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 1cf42e1a301bde..1f83ffac9f1c2a 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1197,9 +1197,9 @@ mergeAttributesSection(Ctx &ctx,
firstStackAlign = sec;
firstStackAlignValue = *i;
} else if (r.first->second != *i) {
- Err(ctx) << sec << " has stack_align=" << Twine(*i) << " but "
+ Err(ctx) << sec << " has stack_align=" << *i << " but "
<< firstStackAlign
- << " has stack_align=" << Twine(firstStackAlignValue);
+ << " has stack_align=" << firstStackAlignValue;
}
}
continue;
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 631051c273810c..9d784040aadf28 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1562,7 +1562,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
continue;
arg->claim();
if (!isValidReportString(option.second)) {
- ErrAlways(ctx) << Twine("-z ") << reportArg.first << "= parameter "
+ ErrAlways(ctx) << "-z " << reportArg.first << "= parameter "
<< option.second << " is not recognized";
continue;
}
@@ -1808,7 +1808,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
if (std::optional<MemoryBufferRef> buffer = readFile(ctx, *path))
readVersionScript(ctx, *buffer);
} else {
- ErrAlways(ctx) << Twine("cannot find version script ") << arg->getValue();
+ ErrAlways(ctx) << "cannot find version script " << arg->getValue();
}
}
@@ -1953,7 +1953,7 @@ void LinkerDriver::createFiles(opt::InputArgList &args) {
}
break;
}
- ErrAlways(ctx) << Twine("cannot find linker script ") << arg->getValue();
+ ErrAlways(ctx) << "cannot find linker script " << arg->getValue();
break;
case OPT_as_needed:
ctx.arg.asNeeded = true;
diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp
index bb6146fa36f6d8..33006c1d322ca0 100644
--- a/lld/ELF/DriverUtils.cpp
+++ b/lld/ELF/DriverUtils.cpp
@@ -124,8 +124,7 @@ opt::InputArgList ELFOptTable::parse(Ctx &ctx, ArrayRef<const char *> argv) {
handleColorDiagnostics(ctx, args);
if (missingCount)
- ErrAlways(ctx) << Twine(args.getArgString(missingIndex))
- << ": missing argument";
+ ErrAlways(ctx) << args.getArgString(missingIndex) << ": missing argument";
for (opt::Arg *arg : args.filtered(OPT_UNKNOWN)) {
std::string nearest;
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 011ad7e2698569..5f0c84850a9c75 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -1042,8 +1042,8 @@ InputSectionBase *ObjFile<ELFT>::getRelocTarget(uint32_t idx, uint32_t info) {
return target;
}
- ErrAlways(ctx) << this << Twine(": relocation section (index ") << idx
- << ") has invalid sh_info (" << info << ')';
+ Err(ctx) << this << ": relocation section (index " << idx
+ << ") has invalid sh_info (" << info << ')';
return nullptr;
}
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 736acef778ff1d..bf16a52ba1f36d 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -1031,7 +1031,7 @@ void InputSection::relocateNonAlloc(Ctx &ctx, uint8_t *buf,
(f->getRelocTargetSym(*it).getVA(ctx) + getAddend<ELFT>(*it));
}
if (overwriteULEB128(bufLoc, val) >= 0x80)
- Err(ctx) << getLocation(offset) << ": ULEB128 value " << Twine(val)
+ Err(ctx) << getLocation(offset) << ": ULEB128 value " << val
<< " exceeds available space; references '" << &sym << "'";
continue;
}
@@ -1367,8 +1367,7 @@ void EhInputSection::split(ArrayRef<RelTy> rels) {
d = d.slice(size);
}
if (msg)
- Err(file->ctx) << "corrupted .eh_frame: " << Twine(msg)
- << "\n>>> defined in "
+ Err(file->ctx) << "corrupted .eh_frame: " << msg << "\n>>> defined in "
<< getObjMsg(d.data() - content().data());
}
diff --git a/lld/ELF/ScriptLexer.cpp b/lld/ELF/ScriptLexer.cpp
index 62865681127edf..e0adf2e5b0c8cc 100644
--- a/lld/ELF/ScriptLexer.cpp
+++ b/lld/ELF/ScriptLexer.cpp
@@ -116,7 +116,7 @@ void ScriptLexer::lex() {
if (e == StringRef::npos) {
size_t lineno =
StringRef(curBuf.begin, s.data() - curBuf.begin).count('\n');
- ErrAlways(ctx) << curBuf.filename << ":" << Twine(lineno + 1)
+ ErrAlways(ctx) << curBuf.filename << ":" << (lineno + 1)
<< ": unclosed quote";
return;
}
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 4500a9afa5f3f2..0dad0f7e6cb9d6 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -2876,8 +2876,7 @@ void DebugNamesBaseSection::parseDebugNames(
return;
}
if (nd.hdr.Version != 5) {
- Err(ctx) << namesSec.sec << Twine(": unsupported version: ")
- << Twine(nd.hdr.Version);
+ Err(ctx) << namesSec.sec << ": unsupported version: " << nd.hdr.Version;
return;
}
uint32_t dwarfSize = dwarf::getDwarfOffsetByteSize(DwarfFormat::DWARF32);
@@ -2915,7 +2914,7 @@ void DebugNamesBaseSection::parseDebugNames(
ne.indexEntries.push_back(std::move(*ieOrErr));
}
if (offset >= namesSec.Data.size())
- Err(ctx) << namesSec.sec << Twine(": index entry is out of bounds");
+ Err(ctx) << namesSec.sec << ": index entry is out of bounds";
for (IndexEntry &ie : ne.entries())
offsetMap[ie.poolOffset] = &ie;
@@ -3213,7 +3212,7 @@ DebugNamesSection<ELFT>::DebugNamesSection(Ctx &ctx)
inputChunk.llvmDebugNames.emplace(namesExtractor, strExtractor);
if (Error e = inputChunk.llvmDebugNames->extract()) {
- Err(ctx) << dobj.getNamesSection().sec << Twine(": ") << std::move(e);
+ Err(ctx) << dobj.getNamesSection().sec << ": " << std::move(e);
}
parseDebugNames(
ctx, inputChunk, chunk, namesExtractor, strExtractor,
@@ -3514,7 +3513,7 @@ createSymbols(
}
// If off overflows, the last symbol's nameOff likely overflows.
if (!isUInt<32>(off))
- Err(ctx) << "--gdb-index: constant pool size (" << Twine(off)
+ Err(ctx) << "--gdb-index: constant pool size (" << off
<< ") exceeds UINT32_MAX";
return {ret, off};
More information about the llvm-commits
mailing list