[clang] [LinkerWrapper] Fix -fsave-optimization-record default file (PR #149003)

Joel E. Denny via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 17 13:51:18 PDT 2025


================
@@ -5895,6 +5895,11 @@ def o : JoinedOrSeparate<["-"], "o">,
   Visibility<[ClangOption, CC1Option, CC1AsOption, FC1Option, FlangOption]>,
   HelpText<"Write output to <file>">, MetaVarName<"<file>">,
   MarshallingInfoString<FrontendOpts<"OutputFile">>;
+def foutput_file_base : Joined<["-"], "foutput-file-base=">,
----------------
jdenny-ornl wrote:

Thanks, I didn't know about -dumpdir.  It would indeed be better to use an existing option.

However, I ran into a couple of issues:
1. The primary output file name has arbitrary hashes because it goes in /tmp.  For example: /tmp/test-96a056-amdgcn-amd-amdhsa-gfx906-15df10.o.  With the -dumpdir solution, the auxiliary output files, which the user actually wants, would end up with those too, making their names unpredictable.  Would implementing gcc's -dumpbase be the right way to avoid that?
2. Because -foutput-file-base is an internal option not really meant for users, I took the liberty of having Clang always disable any warnings about it being unused.  Is there some way for clang-linker-wrapper to tell Clang not to warn if -dumpdir is unused without suppressing warnings about all other options?  Of course, we could add another option for that, but I'm hoping there's some existing way.

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


More information about the cfe-commits mailing list