[PATCH] D137058: [Driver] [Modules] Support -fsave-std-c++-module-file (1/2)

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 15 19:11:00 PST 2022


ChuanqiXu marked 2 inline comments as done.
ChuanqiXu added inline comments.


================
Comment at: clang/lib/Driver/Driver.cpp:5541-5542
+  //
+  // FIXME: Do we need to handle the case that the calculated output is
+  // conflicting with the specified output file or the input file?
+  if (!AtTopLevel && isa<PrecompileJobAction>(JA) &&
----------------
dblaikie wrote:
> Do we do that for `-o` today? (eg: if you try to `-o` and specify the input file name, such that the output would overwrite the input, what happens? I'm not sure - but I guess it's OK to do whatever that is for this case too)
> Do we do that for -o today? (eg: if you try to -o and specify the input file name, such that the output would overwrite the input, what happens? I'm not sure - but I guess it's OK to do whatever that is for this case too)

In this case, the input file will be overwrite and no warning shows. So it looks like we didn't take special treatment here. So I remove the FIXME.


================
Comment at: clang/test/Driver/save-std-c++-module-file.cpp:1-11
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: split-file %s %t
+//
+// RUN: %clang -std=c++20 %t/Hello.cppm -fsave-std-c++-module-file -c
+// RUN: ls %t | FileCheck %t/Hello.cppm --check-prefix=CHECK-DEFAULT
+//
----------------
dblaikie wrote:
> Usually driver tests only invoke the driver and observe the output using `-###` to see what subcommands the driver would run. Could this test be phrased in that way? (testing whatever command line is expected to be invoked, rather than the actual behavior of the frontend)
Good point! Done.


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

https://reviews.llvm.org/D137058



More information about the cfe-commits mailing list