[PATCH] D53457: clang-cl: Add "/Xdriver:" pass-through arg support.
Neeraj K. Singh via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 19 15:46:46 PDT 2018
neerajksingh created this revision.
neerajksingh added reviewers: rnk, hans.
The clang-cl driver disables access to command line options outside of the
"Core" and "CLOption" sets of command line arguments. This filtering makes it
impossible to pass arguments that are interpreted by the clang driver and not
by either 'cc1' (the frontend) or the LLVM backend.
An example driver-level flag is the '-fno-slp-vectorize' flag, which is
processed by the driver in Clang::ConstructJob and used to set the cc1 flag
"-vectorize-slp". There is no negative cc1 flag or -mllvm flag, so it is not
currently possible to disable the SLP vectorizer from the clang-cl driver.
This change introduces the "/Xdriver:" argument that is available when the
driver mode is set to CL compatibility. This option works similarly to the
"-Xclang" option, except that the option values are processed by the clang
driver rather than by 'cc1'. An example usage is:
clang-cl /Xdriver:-fno-slp-vectorize /O2 test.c
Another example shows how "/Xdriver:" can be used to pass a flag where there is
a conflict between a clang-cl compat option and an overlapping clang driver
option:
clang-cl /MD /Xdriver:-MD /Xdriver:-MF /Xdriver:test_dep_file.dep test.c
In the previous example, the unprefixed /MD selects the DLL version of the msvc
CRT, while the prefixed -MD flag and the -MF flags are used to create a make
dependency file for included headers.
One note about flag ordering: the /Xdriver: flags are concatenated to the end of
the argument list, so in cases where the last flag wins, the /Xdriver: flags
will be chosen regardless of their order relative to other flags on the driver
command line.
Repository:
rC Clang
https://reviews.llvm.org/D53457
Files:
include/clang/Driver/CLCompatOptions.td
include/clang/Driver/Driver.h
lib/Driver/Driver.cpp
test/Driver/cl-options.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53457.170269.patch
Type: text/x-patch
Size: 6649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181019/3577affc/attachment.bin>
More information about the cfe-commits
mailing list