[PATCH] D53066: [RFC] [MinGW] Print paths with forward slashes in commands printed with -v

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 10 02:31:47 PDT 2018


mstorsjo created this revision.
mstorsjo added reviewers: rnk, smeenai, compnerd, phosek, rupprecht.

libtool inspects the output of `$CC -v` to detect what object files and libraries are linked in by default. When clang is built as a native windows executable, all paths are formatted with backslashes, and the backslashes cause each argument to be enclosed in quotes. The backslashes and quotes break further processing within libtool (which is implemented in shell script, running in e.g. msys) pretty badly.

Between unix style pathes (that only work in tools that are linked to the msys runtime, essentially the same as cygwin) and proper windows style paths (with backslashes, that don't work within shell scripts and msys environments), the best compromise is to use windows style paths (starting with e.g. `c:`) but with forward slashes, which both msys based tools, shell scripts and native windows executables can cope with. This incidentally turns out to be the form of paths that GCC prints out when run with `-v` on windows as well.

This patch applies a rewrite from backslashes to forwad slashes on all command line arguments printed when compiling with `-v`, if the target triple is mingw/cygwin.

The patch isn't super pretty but hopefully should be acceptable unless there are better suggestions on how to handle it. Any suggestions on how would one go about to add a test for this?


Repository:
  rC Clang

https://reviews.llvm.org/D53066

Files:
  include/clang/Driver/Job.h
  lib/Driver/Compilation.cpp
  lib/Driver/Job.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53066.168958.patch
Type: text/x-patch
Size: 6327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181010/d557a9d3/attachment-0001.bin>


More information about the cfe-commits mailing list