[lld] [LLD][COFF] allow saving intermediate files with /lldsavetemps (PR #115131)

Miguel A. Arroyo via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 09:12:37 PST 2024


================
@@ -2012,8 +2016,18 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
   config->ltoDebugPassManager = ltoDebugPM;
 
   // Handle /lldsavetemps
-  if (args.hasArg(OPT_lldsavetemps))
-    config->saveTemps = true;
+  if (args.hasArg(OPT_lldsavetemps)) {
+    for (const char *s : lldsaveTempsValues)
----------------
mayanez wrote:

That's correct, `SaveTempsArgs` being empty on its own would be insufficient to disambiguate whether we mean the default or all components. We could move to `std::optional` as you suggest. I believe the main drawback is that the list of options has the potential to fall out of sync if it isn't explicit. The current approach forces developers keep the `/lldsavetemps:` options up-to-date should there be more temp files in the future.

I'll be happy to make the change whichever option is decided upon.

https://github.com/llvm/llvm-project/pull/115131


More information about the llvm-commits mailing list