Skip to content

Commit

Permalink
[HLSL][clang][Driver] Fix error when using the option -fcgl in --driv…
Browse files Browse the repository at this point in the history
…er-mode=dxc. (#97001)

When -fcgl is set in --driver-mode=dxc, both -S and -emit-llvm are
currently enabled.

This results in the following error:
```
  error: '-S' action ignored; '-emit-llvm' action specified previously.
```
This change fixes the issue by not rendering -S in RenderHLSLOptions.

Additionally, a test has been added to ensure that enabling -fcgl does
not trigger any diagnostics

Fixes #97296
  • Loading branch information
python3kgae authored Jul 1, 2024
1 parent 9f3bfbb commit 75ec24e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3666,7 +3666,6 @@ static void RenderHLSLOptions(const ArgList &Args, ArgStringList &CmdArgs,
const unsigned ForwardedArguments[] = {options::OPT_dxil_validator_version,
options::OPT_D,
options::OPT_I,
options::OPT_S,
options::OPT_O,
options::OPT_emit_llvm,
options::OPT_emit_obj,
Expand Down
7 changes: 5 additions & 2 deletions clang/test/Driver/dxc_fcgl.hlsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// RUN: not %clang_dxc -fcgl -T lib_6_7 foo.hlsl -### %s 2>&1 | FileCheck %s
// RUN: %clang_dxc -fcgl -T lib_6_7 %s -Xclang -verify

// Make sure fcgl option flag which translated into "-emit-llvm" "-disable-llvm-passes".
// CHECK:"-S"
// CHECK-SAME:"-emit-llvm" "-disable-llvm-passes"
// CHECK: "-emit-llvm"
// CHECK-SAME: "-disable-llvm-passes"

// Make sure fcgl option not generate any diagnostics.
// expected-no-diagnostics

0 comments on commit 75ec24e

Please sign in to comment.