[PATCH] D125655: [HLSL] add -P option for dxc mode.

Xiang Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 12 16:40:46 PDT 2022


python3kgae marked an inline comment as done.
python3kgae added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticDriverKinds.td:684
+def warn_drv_dxc_ignore_output_for_preprocess : Warning<
+  "output compiler options like -Fo ignored with Preprocess">,
+  InGroup<OptionIgnored>;
----------------
pow2clk wrote:
> As I read it, "like -Fo" means either "-Fo" or "-o". I think saying that would be less vague.
dxc mode only accept "-Fo".


================
Comment at: clang/include/clang/Driver/Options.td:6921
                      HelpText<"Entry point name">;
+def dxc_P : Option<["--", "/", "-"], "P", KIND_SEPARATE>,
+  Group<dxc_Group>, Flags<[DXCOption, NoXarchOption]>,
----------------
beanz wrote:
> This is the same option as `_SLASH_P` right? Is there a reason not to re-use it?
__SLASH_P is a flag which not accept output file name.
dxc_P is translated into -E -o filename.

-P a.txt will be -E -o a.txt for cc1.


================
Comment at: clang/include/clang/Driver/Options.td:6793
 def fcgl : DXCFlag<"fcgl">, Alias<emit_pristine_llvm>;
+def dxc_P : Option<["--", "/", "-"], "P", KIND_SEPARATE>,
+  Group<dxc_Group>, Flags<[DXCOption, NoXarchOption]>,
----------------
pow2clk wrote:
> --P is not allowed by DXC 
To work around conflict with clang-cl option
 _SLASH_P : CLFlag<"P">, HelpText<"Preprocess to file">;


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:3480
+      options::OPT_dxil_validator_version, options::OPT_E, options::OPT_S,
+      options::OPT_emit_llvm, options::OPT_disable_llvm_passes};
 
----------------
pow2clk wrote:
> I think we need OPT_o here too in order to capture the full intent since -E doesn't include an output file
OPT_o has NoXarchOption flag which enabled in dxc mode.
So we don't need OPT_o here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125655/new/

https://reviews.llvm.org/D125655



More information about the cfe-commits mailing list