tahonermann 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) &&
----------------
ChuanqiXu wrote:
> 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.
Basing the location of the module output on the presence of `-o` sounds 
confusing to me. Likewise, defaulting to writing next to the input file as 
opposed to the current directory (where a `.o` file is written by default) 
sounds wrong. I think this option should be handled similarly to `-o`; it 
should accept a path and:
  - If an absolute path is provided, write to that location.
  - If a relative path is provided, write to that location relative to the 
current working directory.
Leave it up to the user or build system to ensure that the `.o` and `.pcm` file 
locations coincide if that is what they want. In general, I don't expect 
colocation of `.o` and `.pcm` files to be what is desired.




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

https://reviews.llvm.org/D137058

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to