[lld] bc66e9a - [lld-link] Replace message(...) with Msg(ctx)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 21:29:08 PST 2024


Author: Fangrui Song
Date: 2024-12-03T21:29:02-08:00
New Revision: bc66e9aaa69cf50634929f3bf10e40b336a6abb6

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

LOG: [lld-link] Replace message(...) with Msg(ctx)

to avoid the global ctx.

Added: 
    

Modified: 
    lld/COFF/Driver.cpp
    lld/COFF/DriverUtils.cpp
    lld/COFF/PDB.cpp

Removed: 
    


################################################################################
diff  --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index e4cfcb335869a4..a4f7e6c76af493 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -1638,7 +1638,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
   // because it doesn't start with "/", but we deliberately chose "--" to
   // avoid conflict with /version and for compatibility with clang-cl.
   if (args.hasArg(OPT_dash_dash_version)) {
-    message(getLLDVersion());
+    Msg(ctx) << getLLDVersion();
     return;
   }
 

diff  --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp
index 8a72d74bd27bac..f5862977857dfe 100644
--- a/lld/COFF/DriverUtils.cpp
+++ b/lld/COFF/DriverUtils.cpp
@@ -922,7 +922,7 @@ opt::InputArgList ArgParser::parse(ArrayRef<const char *> argv) {
     std::string msg = "Command line:";
     for (const char *s : expandedArgv)
       msg += " " + std::string(s);
-    message(msg);
+    Msg(ctx) << msg;
   }
 
   // Save the command line after response file expansion so we can write it to

diff  --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index c20b54a5d42e4f..8553832909522b 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -1317,7 +1317,7 @@ void PDBLinker::printStats() {
     printLargeInputTypeRecs("IPI", tMerger.ipiCounts, tMerger.getIDTable());
   }
 
-  message(buffer);
+  Msg(ctx) << buffer;
 }
 
 void PDBLinker::addNatvisFiles() {


        


More information about the llvm-commits mailing list