zequanwu added inline comments.

================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:583
+  llvm::sys::path::Style Style =
+      llvm::sys::path::is_absolute(ObjFileNameForDebug)
+          ? llvm::sys::path::Style::native
----------------
hans wrote:
> zequanwu wrote:
> > hans wrote:
> > > zequanwu wrote:
> > > > hans wrote:
> > > > > Won't the code above (line 580) make many filenames absolute and 
> > > > > cause us to use native slashes even when we want backslashes?
> > > > > 
> > > > > This would also need a test.
> > > > > Won't the code above (line 580) make many filenames absolute and 
> > > > > cause us to use native slashes even when we want backslashes?
> > > > Yes, I don't think we should change anything if it's converted to an 
> > > > absolute path.
> > > > 
> > > > Only if the `-fdebug-compilation-dir` is not given or is an absolute 
> > > > path, the path in `/Fo` will be converted to absolute path. Users can 
> > > > avoid the path being converted to absolute path by passing a relative 
> > > > path to `-fdebug-compilation-dir`, just like what we do in chrome build 
> > > > (`-fdebug-compilation-dir=.`).
> > > > 
> > > > Added a test.
> > > Apologies for all the questions, but I find the logic a bit complex 
> > > still. The test cases are helpful though.
> > > 
> > > Could we simplify by just always using Windows slashes here, regardless 
> > > of `-fdebug-compilation-dir` etc.?
> > The object file path will be converted to absolute path depending on 
> > whether `-fdebug-compilation-dir` is given or whether it's absolute path. I 
> > don't think we want to change a native absolute path of object file to use 
> > Windows slashes. Or this could happen on linux: `/usr/local/src/a.obj` -> 
> > `\usr\local\src\a.obj`. So, we only use windows slashes when it's not an 
> > absolute path here.
> Thanks, that makes sense. Can you add a comment with that explanation?
Done.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147256

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

Reply via email to