[PATCH] D128462: [HLSL] add -I option for dxc mode.

Xiang Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 23 14:07:49 PDT 2022


python3kgae created this revision.
python3kgae added reviewers: amccarth, craig.topper, hans, rnk, stefan_reinalter, beanz, pow2clk.
Herald added subscribers: Anastasia, StephenFan.
Herald added a project: All.
python3kgae requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

A new option -I is added for dxc mode.
It is just alias of existing cc1 -I option.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128462

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/dxc_I.hlsl


Index: clang/test/Driver/dxc_I.hlsl
===================================================================
--- /dev/null
+++ clang/test/Driver/dxc_I.hlsl
@@ -0,0 +1,4 @@
+// RUN: %clang_dxc -I test.h  -### %s 2>&1 | FileCheck %s
+
+// Make sure -I send to cc1.
+// CHECK:"-I" "test.h"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3481,6 +3481,7 @@
                               types::ID InputType) {
   const unsigned ForwardedArguments[] = {options::OPT_dxil_validator_version,
                                          options::OPT_D,
+                                         options::OPT_I,
                                          options::OPT_S,
                                          options::OPT_emit_llvm,
                                          options::OPT_disable_llvm_passes,
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -6820,6 +6820,8 @@
   Group<dxc_Group>, Flags<[DXCOption, NoXarchOption]>;
 class DXCJoinedOrSeparate<string name> : Option<["/", "-"], name,
   KIND_JOINED_OR_SEPARATE>, Group<dxc_Group>, Flags<[DXCOption, NoXarchOption]>;
+class DXCJoinedOrSeparateConflict<string name> : Option<["--", "/", "-"], name,
+  KIND_JOINED_OR_SEPARATE>, Group<dxc_Group>, Flags<[DXCOption, NoXarchOption]>;
 
 def dxc_help : Option<["/", "-", "--"], "help", KIND_JOINED>,
   Group<dxc_Group>, Flags<[DXCOption, NoXarchOption]>, Alias<help>,
@@ -6846,6 +6848,9 @@
          "as_6_5, as_6_6, as_6_7">;
 def dxc_D : Option<["--", "/", "-"], "D", KIND_JOINED_OR_SEPARATE>,
   Group<dxc_Group>, Flags<[DXCOption, NoXarchOption]>, Alias<D>;
+def dxc_I : DXCJoinedOrSeparateConflict<"I">,
+  HelpText<"Add directory to include search path">,
+  Alias<I>;
 def emit_pristine_llvm : DXCFlag<"emit-pristine-llvm">,
   HelpText<"Emit pristine LLVM IR from the frontend by not running any LLVM passes at all."
            "Same as -S + -emit-llvm + -disable-llvm-passes.">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128462.439531.patch
Type: text/x-patch
Size: 2192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220623/99e85900/attachment.bin>


More information about the cfe-commits mailing list