Skip to content

Commit 483516f

Browse files
committed
[ELF] Remove unneeded Twine()
1 parent c1a6def commit 483516f

File tree

8 files changed

+16
-19
lines changed

8 files changed

+16
-19
lines changed

lld/ELF/Arch/AMDGPU.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ uint32_t AMDGPU::calcEFlags() const {
143143
case ELFABIVERSION_AMDGPU_HSA_V6:
144144
return calcEFlagsV6();
145145
default:
146-
ErrAlways(ctx) << "unknown abi version: " << Twine(abiVersion);
146+
ErrAlways(ctx) << "unknown abi version: " << abiVersion;
147147
return 0;
148148
}
149149
}

lld/ELF/Arch/RISCV.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,9 +1197,9 @@ mergeAttributesSection(Ctx &ctx,
11971197
firstStackAlign = sec;
11981198
firstStackAlignValue = *i;
11991199
} else if (r.first->second != *i) {
1200-
Err(ctx) << sec << " has stack_align=" << Twine(*i) << " but "
1200+
Err(ctx) << sec << " has stack_align=" << *i << " but "
12011201
<< firstStackAlign
1202-
<< " has stack_align=" << Twine(firstStackAlignValue);
1202+
<< " has stack_align=" << firstStackAlignValue;
12031203
}
12041204
}
12051205
continue;

lld/ELF/Driver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
15621562
continue;
15631563
arg->claim();
15641564
if (!isValidReportString(option.second)) {
1565-
ErrAlways(ctx) << Twine("-z ") << reportArg.first << "= parameter "
1565+
ErrAlways(ctx) << "-z " << reportArg.first << "= parameter "
15661566
<< option.second << " is not recognized";
15671567
continue;
15681568
}
@@ -1808,7 +1808,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
18081808
if (std::optional<MemoryBufferRef> buffer = readFile(ctx, *path))
18091809
readVersionScript(ctx, *buffer);
18101810
} else {
1811-
ErrAlways(ctx) << Twine("cannot find version script ") << arg->getValue();
1811+
ErrAlways(ctx) << "cannot find version script " << arg->getValue();
18121812
}
18131813
}
18141814

@@ -1953,7 +1953,7 @@ void LinkerDriver::createFiles(opt::InputArgList &args) {
19531953
}
19541954
break;
19551955
}
1956-
ErrAlways(ctx) << Twine("cannot find linker script ") << arg->getValue();
1956+
ErrAlways(ctx) << "cannot find linker script " << arg->getValue();
19571957
break;
19581958
case OPT_as_needed:
19591959
ctx.arg.asNeeded = true;

lld/ELF/DriverUtils.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ opt::InputArgList ELFOptTable::parse(Ctx &ctx, ArrayRef<const char *> argv) {
124124

125125
handleColorDiagnostics(ctx, args);
126126
if (missingCount)
127-
ErrAlways(ctx) << Twine(args.getArgString(missingIndex))
128-
<< ": missing argument";
127+
ErrAlways(ctx) << args.getArgString(missingIndex) << ": missing argument";
129128

130129
for (opt::Arg *arg : args.filtered(OPT_UNKNOWN)) {
131130
std::string nearest;

lld/ELF/InputFiles.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,8 +1042,8 @@ InputSectionBase *ObjFile<ELFT>::getRelocTarget(uint32_t idx, uint32_t info) {
10421042
return target;
10431043
}
10441044

1045-
ErrAlways(ctx) << this << Twine(": relocation section (index ") << idx
1046-
<< ") has invalid sh_info (" << info << ')';
1045+
Err(ctx) << this << ": relocation section (index " << idx
1046+
<< ") has invalid sh_info (" << info << ')';
10471047
return nullptr;
10481048
}
10491049

lld/ELF/InputSection.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ void InputSection::relocateNonAlloc(Ctx &ctx, uint8_t *buf,
10311031
(f->getRelocTargetSym(*it).getVA(ctx) + getAddend<ELFT>(*it));
10321032
}
10331033
if (overwriteULEB128(bufLoc, val) >= 0x80)
1034-
Err(ctx) << getLocation(offset) << ": ULEB128 value " << Twine(val)
1034+
Err(ctx) << getLocation(offset) << ": ULEB128 value " << val
10351035
<< " exceeds available space; references '" << &sym << "'";
10361036
continue;
10371037
}
@@ -1367,8 +1367,7 @@ void EhInputSection::split(ArrayRef<RelTy> rels) {
13671367
d = d.slice(size);
13681368
}
13691369
if (msg)
1370-
Err(file->ctx) << "corrupted .eh_frame: " << Twine(msg)
1371-
<< "\n>>> defined in "
1370+
Err(file->ctx) << "corrupted .eh_frame: " << msg << "\n>>> defined in "
13721371
<< getObjMsg(d.data() - content().data());
13731372
}
13741373

lld/ELF/ScriptLexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void ScriptLexer::lex() {
116116
if (e == StringRef::npos) {
117117
size_t lineno =
118118
StringRef(curBuf.begin, s.data() - curBuf.begin).count('\n');
119-
ErrAlways(ctx) << curBuf.filename << ":" << Twine(lineno + 1)
119+
ErrAlways(ctx) << curBuf.filename << ":" << (lineno + 1)
120120
<< ": unclosed quote";
121121
return;
122122
}

lld/ELF/SyntheticSections.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2876,8 +2876,7 @@ void DebugNamesBaseSection::parseDebugNames(
28762876
return;
28772877
}
28782878
if (nd.hdr.Version != 5) {
2879-
Err(ctx) << namesSec.sec << Twine(": unsupported version: ")
2880-
<< Twine(nd.hdr.Version);
2879+
Err(ctx) << namesSec.sec << ": unsupported version: " << nd.hdr.Version;
28812880
return;
28822881
}
28832882
uint32_t dwarfSize = dwarf::getDwarfOffsetByteSize(DwarfFormat::DWARF32);
@@ -2915,7 +2914,7 @@ void DebugNamesBaseSection::parseDebugNames(
29152914
ne.indexEntries.push_back(std::move(*ieOrErr));
29162915
}
29172916
if (offset >= namesSec.Data.size())
2918-
Err(ctx) << namesSec.sec << Twine(": index entry is out of bounds");
2917+
Err(ctx) << namesSec.sec << ": index entry is out of bounds";
29192918

29202919
for (IndexEntry &ie : ne.entries())
29212920
offsetMap[ie.poolOffset] = &ie;
@@ -3213,7 +3212,7 @@ DebugNamesSection<ELFT>::DebugNamesSection(Ctx &ctx)
32133212

32143213
inputChunk.llvmDebugNames.emplace(namesExtractor, strExtractor);
32153214
if (Error e = inputChunk.llvmDebugNames->extract()) {
3216-
Err(ctx) << dobj.getNamesSection().sec << Twine(": ") << std::move(e);
3215+
Err(ctx) << dobj.getNamesSection().sec << ": " << std::move(e);
32173216
}
32183217
parseDebugNames(
32193218
ctx, inputChunk, chunk, namesExtractor, strExtractor,
@@ -3514,7 +3513,7 @@ createSymbols(
35143513
}
35153514
// If off overflows, the last symbol's nameOff likely overflows.
35163515
if (!isUInt<32>(off))
3517-
Err(ctx) << "--gdb-index: constant pool size (" << Twine(off)
3516+
Err(ctx) << "--gdb-index: constant pool size (" << off
35183517
<< ") exceeds UINT32_MAX";
35193518

35203519
return {ret, off};

0 commit comments

Comments
 (0)