Skip to content

Commit 38870fe

Browse files
committed
[ELF] Remove unneeded toString(Error) when using ELFSyncStream
1 parent be5dad0 commit 38870fe

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

lld/ELF/Arch/ARM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ template <typename ELFT> void elf::writeARMCmseImportLib(Ctx &ctx) {
15081508
FileOutputBuffer::create(ctx.arg.cmseOutputLib, fileSize, flags);
15091509
if (!bufferOrErr) {
15101510
ErrAlways(ctx) << "failed to open " << ctx.arg.cmseOutputLib << ": "
1511-
<< llvm::toString(bufferOrErr.takeError());
1511+
<< bufferOrErr.takeError();
15121512
return;
15131513
}
15141514

lld/ELF/Arch/RISCV.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ static void mergeArch(Ctx &ctx, RISCVISAUtils::OrderedExtensionMap &mergedExts,
10641064
auto maybeInfo = RISCVISAInfo::parseNormalizedArchString(s);
10651065
if (!maybeInfo) {
10661066
Err(ctx) << sec << ": " << s << ": "
1067-
<< llvm::toString(maybeInfo.takeError());
1067+
<< maybeInfo.takeError();
10681068
return;
10691069
}
10701070

@@ -1187,7 +1187,7 @@ mergeAttributesSection(Ctx &ctx,
11871187
for (const InputSectionBase *sec : sections) {
11881188
RISCVAttributeParser parser;
11891189
if (Error e = parser.parse(sec->content(), llvm::endianness::little))
1190-
Warn(ctx) << sec << ": " << llvm::toString(std::move(e));
1190+
Warn(ctx) << sec << ": " << std::move(e);
11911191
for (const auto &tag : attributesTags) {
11921192
switch (RISCVAttrs::AttrType(tag.attr)) {
11931193
// Integer attributes.
@@ -1260,7 +1260,7 @@ mergeAttributesSection(Ctx &ctx,
12601260
merged.strAttr.try_emplace(RISCVAttrs::ARCH,
12611261
saver().save((*result)->toString()));
12621262
} else {
1263-
Err(ctx) << llvm::toString(result.takeError());
1263+
Err(ctx) << result.takeError();
12641264
}
12651265
}
12661266

lld/ELF/Config.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "llvm/Support/Endian.h"
2727
#include "llvm/Support/FileSystem.h"
2828
#include "llvm/Support/GlobPattern.h"
29-
#include "llvm/Support/PrettyStackTrace.h"
3029
#include "llvm/Support/TarWriter.h"
3130
#include <atomic>
3231
#include <memory>

lld/ELF/Driver.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
684684
if (!ltoSampleProfile.empty())
685685
readFile(ctx, ltoSampleProfile);
686686
} else {
687-
ErrAlways(ctx) << "--reproduce: " << toString(errOrWriter.takeError());
687+
ErrAlways(ctx) << "--reproduce: " << errOrWriter.takeError();
688688
}
689689
}
690690

@@ -1141,7 +1141,7 @@ static void ltoValidateAllVtablesHaveTypeInfos(Ctx &ctx,
11411141
Expected<GlobPattern> pat = GlobPattern::create(knownSafeName);
11421142
if (!pat)
11431143
ErrAlways(ctx) << "--lto-known-safe-vtables=: "
1144-
<< toString(pat.takeError());
1144+
<< pat.takeError();
11451145
vtableSymbolsWithNoRTTI.remove_if(
11461146
[&](StringRef s) { return pat->match(s); });
11471147
}
@@ -1271,7 +1271,7 @@ static bool remapInputs(Ctx &ctx, StringRef line, const Twine &location) {
12711271
else if (Expected<GlobPattern> pat = GlobPattern::create(fields[0]))
12721272
ctx.arg.remapInputsWildcards.emplace_back(std::move(*pat), fields[1]);
12731273
else {
1274-
ErrAlways(ctx) << location << ": " << toString(pat.takeError()) << ": "
1274+
ErrAlways(ctx) << location << ": " << pat.takeError() << ": "
12751275
<< fields[0];
12761276
return true;
12771277
}
@@ -1600,7 +1600,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
16001600
else if (Expected<GlobPattern> pat = GlobPattern::create(kv.first))
16011601
ctx.arg.shuffleSections.emplace_back(std::move(*pat), uint32_t(v));
16021602
else
1603-
ErrAlways(ctx) << errPrefix << toString(pat.takeError()) << ": "
1603+
ErrAlways(ctx) << errPrefix << pat.takeError() << ": "
16041604
<< kv.first;
16051605
}
16061606

@@ -1645,7 +1645,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
16451645
if (Expected<GlobPattern> pat = GlobPattern::create(fields[0])) {
16461646
ctx.arg.compressSections.emplace_back(std::move(*pat), type, level);
16471647
} else {
1648-
ErrAlways(ctx) << arg->getSpelling() << ": " << toString(pat.takeError());
1648+
ErrAlways(ctx) << arg->getSpelling() << ": " << pat.takeError();
16491649
continue;
16501650
}
16511651
}

lld/ELF/InputFiles.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ template <class ELFT> DWARFCache *ObjFile<ELFT>::getDwarf() {
480480
llvm::call_once(initDwarf, [this]() {
481481
dwarf = std::make_unique<DWARFCache>(std::make_unique<DWARFContext>(
482482
std::make_unique<LLDDwarfObj<ELFT>>(this), "",
483-
[&](Error err) { warn(getName() + ": " + toString(std::move(err))); },
483+
[&](Error err) { Warn(ctx) << getName() + ": " << std::move(err); },
484484
[&](Error warning) {
485485
Warn(ctx) << getName() << ": " << std::move(warning);
486486
}));
@@ -634,7 +634,7 @@ template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) {
634634
? llvm::endianness::little
635635
: llvm::endianness::big)) {
636636
InputSection isec(*this, sec, name);
637-
Warn(ctx) << &isec << ": " << llvm::toString(std::move(e));
637+
Warn(ctx) << &isec << ": " << std::move(e);
638638
} else {
639639
updateSupportedARMFeatures(ctx, attributes);
640640
updateARMVFPArgs(ctx, attributes, this);

lld/ELF/InputSection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static void decompressAux(Ctx &ctx, const InputSectionBase &sec, uint8_t *out,
122122
? compression::zlib::decompress(compressed, out, size)
123123
: compression::zstd::decompress(compressed, out, size))
124124
Fatal(ctx) << &sec
125-
<< ": decompress failed: " << llvm::toString(std::move(e));
125+
<< ": decompress failed: " << std::move(e);
126126
}
127127

128128
void InputSectionBase::decompress() const {

0 commit comments

Comments
 (0)