[lld] 6c19fa4 - [ELF] Remove unneeded toString(Error) when using ELFSyncStream

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 16 13:31:10 PST 2024


Author: Fangrui Song
Date: 2024-11-16T13:31:05-08:00
New Revision: 6c19fa4bfc54a8cdb0c48b5024650ff5c630ea8d

URL: https://github.com/llvm/llvm-project/commit/6c19fa4bfc54a8cdb0c48b5024650ff5c630ea8d
DIFF: https://github.com/llvm/llvm-project/commit/6c19fa4bfc54a8cdb0c48b5024650ff5c630ea8d.diff

LOG: [ELF] Remove unneeded toString(Error) when using ELFSyncStream

Added: 
    

Modified: 
    lld/ELF/Arch/RISCV.cpp
    lld/ELF/Driver.cpp
    lld/ELF/InputSection.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 35855672f85654..e3333c66777c19 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1063,8 +1063,7 @@ static void mergeArch(Ctx &ctx, RISCVISAUtils::OrderedExtensionMap &mergedExts,
                       StringRef s) {
   auto maybeInfo = RISCVISAInfo::parseNormalizedArchString(s);
   if (!maybeInfo) {
-    Err(ctx) << sec << ": " << s << ": "
-             << maybeInfo.takeError();
+    Err(ctx) << sec << ": " << s << ": " << maybeInfo.takeError();
     return;
   }
 

diff  --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index be40a0349ebf31..f2499d36dce062 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1140,8 +1140,7 @@ static void ltoValidateAllVtablesHaveTypeInfos(Ctx &ctx,
           << knownSafeName;
     Expected<GlobPattern> pat = GlobPattern::create(knownSafeName);
     if (!pat)
-      ErrAlways(ctx) << "--lto-known-safe-vtables=: "
-                     << pat.takeError();
+      ErrAlways(ctx) << "--lto-known-safe-vtables=: " << pat.takeError();
     vtableSymbolsWithNoRTTI.remove_if(
         [&](StringRef s) { return pat->match(s); });
   }
@@ -1271,8 +1270,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 << ": " << pat.takeError() << ": "
-                   << fields[0];
+    ErrAlways(ctx) << location << ": " << pat.takeError() << ": " << fields[0];
     return true;
   }
   return false;
@@ -1600,8 +1598,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 << pat.takeError() << ": "
-                     << kv.first;
+      ErrAlways(ctx) << errPrefix << pat.takeError() << ": " << kv.first;
   }
 
   auto reports = {std::make_pair("bti-report", &ctx.arg.zBtiReport),

diff  --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index c916ac74405db3..9ae70e1385db8f 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -121,8 +121,7 @@ static void decompressAux(Ctx &ctx, const InputSectionBase &sec, uint8_t *out,
   if (Error e = hdr->ch_type == ELFCOMPRESS_ZLIB
                     ? compression::zlib::decompress(compressed, out, size)
                     : compression::zstd::decompress(compressed, out, size))
-    Fatal(ctx) << &sec
-               << ": decompress failed: " << std::move(e);
+    Fatal(ctx) << &sec << ": decompress failed: " << std::move(e);
 }
 
 void InputSectionBase::decompress() const {
@@ -1278,8 +1277,7 @@ template <class ELFT> void InputSection::writeTo(Ctx &ctx, uint8_t *buf) {
     if (Error e = hdr->ch_type == ELFCOMPRESS_ZLIB
                       ? compression::zlib::decompress(compressed, buf, size)
                       : compression::zstd::decompress(compressed, buf, size))
-      Fatal(ctx) << this
-                 << ": decompress failed: " << llvm::toString(std::move(e));
+      Fatal(ctx) << this << ": decompress failed: " << std::move(e);
     uint8_t *bufEnd = buf + size;
     relocate<ELFT>(ctx, buf, bufEnd);
     return;


        


More information about the llvm-commits mailing list