[clang] cc0cf72 - [HLSL] Allow non `.hlsl` files as source files (#137378)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 29 06:28:33 PDT 2025
Author: Steven Perron
Date: 2025-04-29T09:28:29-04:00
New Revision: cc0cf7253967af4aa3dce2a5de186f766564747b
URL: https://github.com/llvm/llvm-project/commit/cc0cf7253967af4aa3dce2a5de186f766564747b
DIFF: https://github.com/llvm/llvm-project/commit/cc0cf7253967af4aa3dce2a5de186f766564747b.diff
LOG: [HLSL] Allow non `.hlsl` files as source files (#137378)
Changes the driver to assume input file with an unknown extension are
HLSL source files instead of object files.
Fixes https://github.com/llvm/llvm-project/issues/137370
Added:
clang/test/Driver/dxc_I.test
Modified:
clang/lib/Driver/Driver.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 2b8c6e35263b1..a648cc928afdc 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -3001,6 +3001,8 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args,
Ty = types::TY_CXX;
else if (CCCIsCPP() || CCGenDiagnostics)
Ty = types::TY_C;
+ else if (IsDXCMode())
+ Ty = types::TY_HLSL;
else
Ty = types::TY_Object;
}
diff --git a/clang/test/Driver/dxc_I.test b/clang/test/Driver/dxc_I.test
new file mode 100644
index 0000000000000..c78382375b2b1
--- /dev/null
+++ b/clang/test/Driver/dxc_I.test
@@ -0,0 +1,4 @@
+// RUN: %clang_dxc -Tlib_6_3 -### %s 2>&1 | FileCheck %s
+
+// Make sure a non `.hlsl` file is considered an HLSL source file in dxc mode.
+// CHECK: "-x" "hlsl" "{{.*}}dxc_I.test"
More information about the cfe-commits
mailing list