[lld] 59bc03c - [lld-link] Simplify warnUnusable. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 22:33:42 PST 2024


Author: Fangrui Song
Date: 2024-12-03T22:33:36-08:00
New Revision: 59bc03cf8e9df134e591c989abb1c068e4201008

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

LOG: [lld-link] Simplify warnUnusable. NFC

Added: 
    

Modified: 
    lld/COFF/PDB.cpp

Removed: 
    


################################################################################
diff  --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index 8553832909522b..b4b10ef8913f0e 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -1006,11 +1006,10 @@ static void warnUnusable(InputFile *f, Error e, bool shouldWarn) {
     consumeError(std::move(e));
     return;
   }
-  auto msg = "Cannot use debug info for '" + toString(f) + "' [LNK4099]";
+  auto diag = Warn(f->ctx);
+  diag << "Cannot use debug info for '" << f << "' [LNK4099]";
   if (e)
-    warn(msg + "\n>>> failed to load reference " + toString(std::move(e)));
-  else
-    warn(msg);
+    diag << "\n>>> failed to load reference " << std::move(e);
 }
 
 // Allocate memory for a .debug$S / .debug$F section and relocate it.


        


More information about the llvm-commits mailing list