[PATCH] D149193: [Driver] -gsplit-dwarf: derive .dwo names from -o for link actions

Scott Linder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 25 15:27:29 PDT 2023


scott.linder added a comment.

I'm a bit confused after trying to work out the rules for the GCC version of `-dumpdir` over at https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html#index-dumpdir but it at least seems like our version is a subset of theirs.

Do we support any of the other `-dump*` options GCC does? E.g. https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html#index-dumpbase and https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html#index-dumpbase-ext ? I don't think we need to in order to add and use `-dumpdir`, but they do have a somewhat unique inter-dependence in that the exact value of one can cause another to be completely ignored.

Also, would it be worth adding tests for the following cases:

> It defaults to the location of the output file, unless the output file is a special file like /dev/null. Options -save-temps=cwd and -save-temps=obj override this default, just like an explicit -dumpdir option. In case multiple such options are given, the last one prevails:



================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:1250-1267
 
+  SmallString<128> T;
+  if (const Arg *A = Args.getLastArg(options::OPT_dumpdir))
+    T = A->getValue();
+
   Arg *FinalOutput = Args.getLastArg(options::OPT_o);
   if (FinalOutput && Args.hasArg(options::OPT_c)) {
----------------
There is an extra check for `dumpdir` and a string copy in the `OPT_c` case, maybe it can just move past that case?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149193/new/

https://reviews.llvm.org/D149193



More information about the cfe-commits mailing list