Skip to content

Commit e057cd4

Browse files
s-perronIanWood1
authored andcommitted
[HLSL] Allow non .hlsl files as source files (llvm#137378)
Changes the driver to assume input file with an unknown extension are HLSL source files instead of object files. Fixes llvm#137370
1 parent 65c3b41 commit e057cd4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 2 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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)