This is an archive of the discontinued LLVM Phabricator instance.

driver: Add a `--rsp-quoting` flag to choose which unquoting behavior to use in rsp files.
ClosedPublic

Authored by thakis on Apr 22 2016, 11:50 AM.

Details

Reviewers
rnk
Summary

Currently, clang-cl always uses Windows style for unquoting, and clang always uses POSIX style for unquoting.

In general, response file quoting should match the shell the response file is used in. On Windows, it's possible to run clang-cl in a bash shell, or clang in cmd.exe, so a flag for overriding the default behavior is natural there. On non-Windows, Windows probably never makes sense (except maybe in Wine), but having clang-cl behave differently based on the host OS seems strange too -- people who want to use clang-cl on non-Windows with "native" response files will have to pass --rsp-quoting=posix.

This also includes the clang-side test changes needed for http://reviews.llvm.org/D19417

Diff Detail

Event Timeline

thakis updated this revision to Diff 54691.Apr 22 2016, 11:50 AM
thakis retitled this revision from to driver: Add a `--rsp-quoting` flag to choose which unquoting behavior to use in rsp files..
thakis updated this object.
thakis added a reviewer: rnk.
thakis added a subscriber: cfe-commits.
rnk accepted this revision.Apr 25 2016, 11:22 AM
rnk edited edge metadata.

Looks good

tools/driver/driver.cpp
350

Should we call it "posix" or "gnu"? The reference implementation we are trying to match is part of libiberty, which is why I called the tokenizer TokenizeGNUCommandLine.

This revision is now accepted and ready to land.Apr 25 2016, 11:22 AM

Thanks!

tools/driver/driver.cpp
350

I figured the reference implementation tries to implement http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html from posix, but I don't care much about the name. If you prefer gnu, I'm happy to use gnu. (In the same vein: Do you have an opinion on "windows" vs "cl" vs "msvc"?)

rnk added inline comments.Apr 25 2016, 12:49 PM
tools/driver/driver.cpp
350

I buy that reasoning, let's use "posix" then.

I also like "windows" for the other style. The algorithm documented at https://msdn.microsoft.com/en-us/library/17w5ykft(v=vs.85).aspx is pretty standard. New versions of mingw use the exact same algorithm.

thakis closed this revision.Apr 25 2016, 2:22 PM

Landed the new flag and its tests in r267474, thanks! (Didn't land the test updates needed after http://reviews.llvm.org/D19417 yet, since that's not in yet.)