[clang] 0d459b7 - [Driver][DXC] Treat stdin as HLSL

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 10 09:52:55 PDT 2023


Author: Justin Bogner
Date: 2023-08-10T09:52:31-07:00
New Revision: 0d459b71dc280eede85f443921240df4f7a5c6ff

URL: https://github.com/llvm/llvm-project/commit/0d459b71dc280eede85f443921240df4f7a5c6ff
DIFF: https://github.com/llvm/llvm-project/commit/0d459b71dc280eede85f443921240df4f7a5c6ff.diff

LOG: [Driver][DXC] Treat stdin as HLSL

Differential Revision: https://reviews.llvm.org/D157562

Added: 
    clang/test/Driver/dxc_stdin.hlsl

Modified: 
    clang/lib/Driver/Driver.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 60f5eed8e2d729..150040cc9dd2e4 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -2648,6 +2648,8 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args,
         if (memcmp(Value, "-", 2) == 0) {
           if (IsFlangMode()) {
             Ty = types::TY_Fortran;
+          } else if (IsDXCMode()) {
+            Ty = types::TY_HLSL;
           } else {
             // If running with -E, treat as a C input (this changes the
             // builtin macros, for example). This may be overridden by -ObjC

diff  --git a/clang/test/Driver/dxc_stdin.hlsl b/clang/test/Driver/dxc_stdin.hlsl
new file mode 100644
index 00000000000000..98055b446b7b79
--- /dev/null
+++ b/clang/test/Driver/dxc_stdin.hlsl
@@ -0,0 +1,3 @@
+// RUN: %clang_dxc -Tlib_6_7 - -### 2>&1 | FileCheck %s
+// CHECK: "-cc1"
+// CHECK-SAME: "-x" "hlsl" "-"


        


More information about the cfe-commits mailing list