It seems like some combination of checking the target triple, host triple, and driver mode and putting the conversions behind those checks could work?<br><br>For paths like resource dir that are going into debug info it should be driver mode.  For paths we pass to another tool it should probably be based on target triple .   This probably isn’t perfect, but WDYT?<br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 24, 2018 at 12:16 AM Martin Storsjö via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">mstorsjo added inline comments.<br>
<br>
<br>
================<br>
Comment at: lib/Driver/Driver.cpp:1013-1014<br>
   }<br>
+  for (auto *Str : {&Dir, &InstalledDir, &SysRoot, &DyldPrefix, &ResourceDir})<br>
+    *Str = llvm::sys::path::convert_to_slash(*Str);<br>
<br>
----------------<br>
rnk wrote:<br>
> zturner wrote:<br>
> > Is this going to affect the cl driver as well?<br>
> Yeah, if we change the resource dir, I think it's going to have knock-on affects to the debug info we emit to describe the locations of compiler intrinsic headers. I was imagining that this would be limited to flags which only get passed to GNU-ld-compatible linkers.<br>
Well, the first minimal version that was committed in rL345004 was enough to produce paths that worked with libtool, but I guess that one also would cause some amount of changes for the cl driver.<br>
<br>
Now in order for all the tests to pass, I had to change (almost) all of these as I have here. (After rechecking, I think I can spare one or two of them.)<br>
<br>
But I do have to touch ResourceDir for test/Driver/linux-per-target-runtime-dir.c to pass, since it requires that a `-resource-dir` parameter matches a later `-L` linker flag, and I do need to change the `-L` linker flag for the libtool case.<br>
<br>
So I guess it's back to the drawing board with this change then. What do you guys think is the path of least impact on e.g. the cl driver and PDB generation in general (and least messy scattered rewrites), without breaking a bunch of tests (e.g. test/Driver/linux-ld.c requires the `--sysroot` parameter to match `-L`), while still getting libtool compatible paths with forward slashes out of `-v`. At least when targeting mingw, but maybe ideally for any non-msvc target? For cross compiling for a linux target from windows, I would guess forward slashes would be preferred as well.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D53066" rel="noreferrer" target="_blank">https://reviews.llvm.org/D53066</a><br>
<br>
<br>
<br>
</blockquote></div>