[lld] 38870fe - [ELF] Remove unneeded toString(Error) when using ELFSyncStream
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 16 13:22:12 PST 2024
Author: Fangrui Song
Date: 2024-11-16T13:22:06-08:00
New Revision: 38870fe124eb5e6e24136f9d3e4551a62370faee
URL: https://github.com/llvm/llvm-project/commit/38870fe124eb5e6e24136f9d3e4551a62370faee
DIFF: https://github.com/llvm/llvm-project/commit/38870fe124eb5e6e24136f9d3e4551a62370faee.diff
LOG: [ELF] Remove unneeded toString(Error) when using ELFSyncStream
Added:
Modified:
lld/ELF/Arch/ARM.cpp
lld/ELF/Arch/RISCV.cpp
lld/ELF/Config.h
lld/ELF/Driver.cpp
lld/ELF/InputFiles.cpp
lld/ELF/InputSection.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp
index fa07fb6b537db5..65be407815701c 100644
--- a/lld/ELF/Arch/ARM.cpp
+++ b/lld/ELF/Arch/ARM.cpp
@@ -1508,7 +1508,7 @@ template <typename ELFT> void elf::writeARMCmseImportLib(Ctx &ctx) {
FileOutputBuffer::create(ctx.arg.cmseOutputLib, fileSize, flags);
if (!bufferOrErr) {
ErrAlways(ctx) << "failed to open " << ctx.arg.cmseOutputLib << ": "
- << llvm::toString(bufferOrErr.takeError());
+ << bufferOrErr.takeError();
return;
}
diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 442bcb055c3b31..35855672f85654 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1064,7 +1064,7 @@ static void mergeArch(Ctx &ctx, RISCVISAUtils::OrderedExtensionMap &mergedExts,
auto maybeInfo = RISCVISAInfo::parseNormalizedArchString(s);
if (!maybeInfo) {
Err(ctx) << sec << ": " << s << ": "
- << llvm::toString(maybeInfo.takeError());
+ << maybeInfo.takeError();
return;
}
@@ -1187,7 +1187,7 @@ mergeAttributesSection(Ctx &ctx,
for (const InputSectionBase *sec : sections) {
RISCVAttributeParser parser;
if (Error e = parser.parse(sec->content(), llvm::endianness::little))
- Warn(ctx) << sec << ": " << llvm::toString(std::move(e));
+ Warn(ctx) << sec << ": " << std::move(e);
for (const auto &tag : attributesTags) {
switch (RISCVAttrs::AttrType(tag.attr)) {
// Integer attributes.
@@ -1260,7 +1260,7 @@ mergeAttributesSection(Ctx &ctx,
merged.strAttr.try_emplace(RISCVAttrs::ARCH,
saver().save((*result)->toString()));
} else {
- Err(ctx) << llvm::toString(result.takeError());
+ Err(ctx) << result.takeError();
}
}
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index 1072b7540f498d..d07670b76b60ed 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -26,7 +26,6 @@
#include "llvm/Support/Endian.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/GlobPattern.h"
-#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/TarWriter.h"
#include <atomic>
#include <memory>
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index a0c95df1ff1f6a..be40a0349ebf31 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -684,7 +684,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
if (!ltoSampleProfile.empty())
readFile(ctx, ltoSampleProfile);
} else {
- ErrAlways(ctx) << "--reproduce: " << toString(errOrWriter.takeError());
+ ErrAlways(ctx) << "--reproduce: " << errOrWriter.takeError();
}
}
@@ -1141,7 +1141,7 @@ static void ltoValidateAllVtablesHaveTypeInfos(Ctx &ctx,
Expected<GlobPattern> pat = GlobPattern::create(knownSafeName);
if (!pat)
ErrAlways(ctx) << "--lto-known-safe-vtables=: "
- << toString(pat.takeError());
+ << pat.takeError();
vtableSymbolsWithNoRTTI.remove_if(
[&](StringRef s) { return pat->match(s); });
}
@@ -1271,7 +1271,7 @@ static bool remapInputs(Ctx &ctx, StringRef line, const Twine &location) {
else if (Expected<GlobPattern> pat = GlobPattern::create(fields[0]))
ctx.arg.remapInputsWildcards.emplace_back(std::move(*pat), fields[1]);
else {
- ErrAlways(ctx) << location << ": " << toString(pat.takeError()) << ": "
+ ErrAlways(ctx) << location << ": " << pat.takeError() << ": "
<< fields[0];
return true;
}
@@ -1600,7 +1600,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
else if (Expected<GlobPattern> pat = GlobPattern::create(kv.first))
ctx.arg.shuffleSections.emplace_back(std::move(*pat), uint32_t(v));
else
- ErrAlways(ctx) << errPrefix << toString(pat.takeError()) << ": "
+ ErrAlways(ctx) << errPrefix << pat.takeError() << ": "
<< kv.first;
}
@@ -1645,7 +1645,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
if (Expected<GlobPattern> pat = GlobPattern::create(fields[0])) {
ctx.arg.compressSections.emplace_back(std::move(*pat), type, level);
} else {
- ErrAlways(ctx) << arg->getSpelling() << ": " << toString(pat.takeError());
+ ErrAlways(ctx) << arg->getSpelling() << ": " << pat.takeError();
continue;
}
}
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 15737650be4c68..9fa4f35275b3e6 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -480,7 +480,7 @@ template <class ELFT> DWARFCache *ObjFile<ELFT>::getDwarf() {
llvm::call_once(initDwarf, [this]() {
dwarf = std::make_unique<DWARFCache>(std::make_unique<DWARFContext>(
std::make_unique<LLDDwarfObj<ELFT>>(this), "",
- [&](Error err) { warn(getName() + ": " + toString(std::move(err))); },
+ [&](Error err) { Warn(ctx) << getName() + ": " << std::move(err); },
[&](Error warning) {
Warn(ctx) << getName() << ": " << std::move(warning);
}));
@@ -634,7 +634,7 @@ template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) {
? llvm::endianness::little
: llvm::endianness::big)) {
InputSection isec(*this, sec, name);
- Warn(ctx) << &isec << ": " << llvm::toString(std::move(e));
+ Warn(ctx) << &isec << ": " << std::move(e);
} else {
updateSupportedARMFeatures(ctx, attributes);
updateARMVFPArgs(ctx, attributes, this);
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 37758f1cb20f1e..c916ac74405db3 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -122,7 +122,7 @@ static void decompressAux(Ctx &ctx, const InputSectionBase &sec, uint8_t *out,
? compression::zlib::decompress(compressed, out, size)
: compression::zstd::decompress(compressed, out, size))
Fatal(ctx) << &sec
- << ": decompress failed: " << llvm::toString(std::move(e));
+ << ": decompress failed: " << std::move(e);
}
void InputSectionBase::decompress() const {
More information about the llvm-commits
mailing list