Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cc0cf72

Browse files
authoredApr 29, 2025
[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 f02c93d commit cc0cf72

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)
Please sign in to comment.