[PATCH] D53457: clang-cl: Add "/clang:" pass-through arg support.

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 26 06:37:06 PDT 2018


hans added a comment.

  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.

This seems a little unfortunate. I wonder if it would be possible to not have this restriction, i.e. to process these in-line with the rest of the flags?

One way to achieve this would be to change Driver::ParseArgStrings() to handle the "/clang:" arguments. After doing the regular option parsing, it would look for "/clang:" options and substitute them for the underlying option. This has the downside of adding some option-specific logic to ParseArgStrings, but on the other hand it's less intrusive than passing around the IsCLMode bool. Do you think something like this could work?



================
Comment at: docs/UsersManual.rst:3100
+
+The /clang: Option
+^^^^^^^^^^^^^^^^^^^^
----------------
Thanks for thinking about the docs!

I think we should put this above the /fallback section, since this new flag is more important and /fallback shouldn't be used much these days.


================
Comment at: include/clang/Driver/CLCompatOptions.td:324
   HelpText<"Volatile loads and stores have acquire and release semantics">;
+def _SLASH_clang : CLJoinedOrSeparate<"clang:">,
+  HelpText<"Pass <arg> to the clang driver">, MetaVarName<"<arg>">;
----------------
Do we really want the "OrSeparate" part of this? Is there any downside of limiting it to "/clang:-foo" rather than also allowing "/clang: -foo"?


https://reviews.llvm.org/D53457





More information about the cfe-commits mailing list