[PATCH] D137058: [Driver] [Modules] Support -fmodule-output (1/2)

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 11 13:33:14 PST 2023


dblaikie added inline comments.


================
Comment at: clang/lib/Driver/Driver.cpp:5736
+      C.getArgs().hasArg(options::OPT_fmodule_output) &&
+      C.getArgs().hasArg(options::OPT_o)) {
+    SmallString<128> OutputPath;
----------------
ChuanqiXu wrote:
> dblaikie wrote:
> > Is there some way we can avoid this (`-fmodule-output  -o ...`) being a special case? It'd be good if we could use a single common implementation regardless of whether `-o` is used (ie: Figure out the output file name (whether it's implicitly determined by clang, in the absence of `-o`, or explicitly provided by the user through `-o`) and then replace the suffix with `pcm`)?
> I guess we can't do it or we can't do it easily. Otherwise the .pcm file will always lives in the same directory with the input file.
> I guess we can't do it or we can't do it easily. Otherwise the .pcm file will always lives in the same directory with the input file.

I don't follow/understand. What I mean is, I'd like it, if possible, this was implemented by something like "find the path for the .o file output, then replace the extension with .pcm".

I worry atht code like this that recomputes something similar to the object output path risks getting out of sync with the actual object path.


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

https://reviews.llvm.org/D137058



More information about the cfe-commits mailing list