Skip to content

Commit cc0cf72

Browse files
authored
[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 #137370
1 parent f02c93d commit cc0cf72

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

clang/lib/Driver/Driver.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -3001,6 +3001,8 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args,
30013001
Ty = types::TY_CXX;
30023002
else if (CCCIsCPP() || CCGenDiagnostics)
30033003
Ty = types::TY_C;
3004+
else if (IsDXCMode())
3005+
Ty = types::TY_HLSL;
30043006
else
30053007
Ty = types::TY_Object;
30063008
}

clang/test/Driver/dxc_I.test

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %clang_dxc -Tlib_6_3 -### %s 2>&1 | FileCheck %s
2+
3+
// Make sure a non `.hlsl` file is considered an HLSL source file in dxc mode.
4+
// CHECK: "-x" "hlsl" "{{.*}}dxc_I.test"

0 commit comments

Comments
 (0)