aboutsummaryrefslogtreecommitdiff
path: root/clang/docs
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2018-11-08 11:27:04 +0000
committerHans Wennborg <hans@hanshq.net>2018-11-08 11:27:04 +0000
commit797004d2ea98342aa9a5e6d458f44a4e2e8f18cd (patch)
tree590ec21701366f5fa6c5a5dc220ed796631f2b04 /clang/docs
parent3fee3518679bede07c59ffa71b427a9240a09d3c (diff)
clang-cl: Add "/clang:" pass-through arg support.
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 one of the other tools invoked by the driver. 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 "/clang:" 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 /clang:-fno-slp-vectorize /O2 test.c Another example shows how "/clang:" 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 /clang:-MD /clang:-MF /clang: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 /clang: flags are concatenated to the end of the argument list, so in cases where the last flag wins, the /clang: flags will be chosen regardless of their order relative to other flags on the driver command line. Patch by Neeraj K. Singh! Differential revision: https://reviews.llvm.org/D53457 llvm-svn: 346393
Diffstat (limited to 'clang/docs')
-rw-r--r--clang/docs/UsersManual.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index 65718d204448..87a6d3e0025d 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -2849,6 +2849,7 @@ Execute ``clang-cl /?`` to see a list of supported options:
/arch:<value> Set architecture for code generation
/Brepro- Emit an object file which cannot be reproduced over time
/Brepro Emit an object file which can be reproduced over time
+ /clang:<arg> Pass <arg> to the clang driver
/C Don't discard comments when preprocessing
/c Compile only
/d1PP Retain macro definitions in /E mode
@@ -3084,6 +3085,17 @@ Execute ``clang-cl /?`` to see a list of supported options:
-W<warning> Enable the specified warning
-Xclang <arg> Pass <arg> to the clang compiler
+The /clang: Option
+^^^^^^^^^^^^^^^^^^
+
+When clang-cl is run with a set of ``/clang:<arg>`` options, it will gather all
+of the ``<arg>`` arguments and process them as if they were passed to the clang
+driver. This mechanism allows you to pass flags that are not exposed in the
+clang-cl options or flags that have a different meaning when passed to the clang
+driver. Regardless of where they appear in the command line, the ``/clang:``
+arguments are treated as if they were passed at the end of the clang-cl command
+line.
+
The /fallback Option
^^^^^^^^^^^^^^^^^^^^