[lld] abbb0d9 - [ELF] Remove unneeded toStr(ctx, x) when using ELFSyncStream

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 16 16:28:53 PST 2024


Author: Fangrui Song
Date: 2024-11-16T16:28:48-08:00
New Revision: abbb0d9c94511c9e10ec2f5ca65f059b6fa5761f

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

LOG: [ELF] Remove unneeded toStr(ctx, x) when using ELFSyncStream

This patch removes the last use of the global `elf::ctx` outside of
elf::link.

Added: 
    

Modified: 
    lld/ELF/Symbols.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index baa704363efb1f..7d08614038e643 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -295,7 +295,7 @@ void elf::printTraceSymbol(const Symbol &sym, StringRef name) {
   else
     s = ": definition of ";
 
-  Msg(ctx) << toStr(sym.file->ctx, sym.file) << s << name;
+  Msg(sym.file->ctx) << sym.file << s << name;
 }
 
 static void recordWhyExtract(Ctx &ctx, const InputFile *reference,
@@ -320,9 +320,7 @@ void elf::maybeWarnUnorderableSymbol(Ctx &ctx, const Symbol *sym) {
   const InputFile *file = sym->file;
   auto *d = dyn_cast<Defined>(sym);
 
-  auto report = [&](StringRef s) {
-    Warn(ctx) << toStr(ctx, file) << s << sym->getName();
-  };
+  auto report = [&](StringRef s) { Warn(ctx) << file << s << sym->getName(); };
 
   if (sym->isUndefined()) {
     if (cast<Undefined>(sym)->discardedSecIdx)


        


More information about the llvm-commits mailing list