[clang] [HLSL][clang][Driver] Fix error when using the option -fcgl in --driver-mode=dxc. (PR #97001)
Xiang Li via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 27 21:19:53 PDT 2024
https://github.com/python3kgae created https://github.com/llvm/llvm-project/pull/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
>From d858c6b5cde38d236149035845c0209d45cae863 Mon Sep 17 00:00:00 2001
From: Xiang Li <python3kgae at outlook.com>
Date: Fri, 28 Jun 2024 00:12:34 -0400
Subject: [PATCH] [HLSL][clang][Driver] Fix error when using the option -fcgl
in --driver-mode=dxc.
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
---
clang/lib/Driver/ToolChains/Clang.cpp | 1 -
clang/test/Driver/dxc_fcgl.hlsl | 7 +++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index c0f6bc0c2e45a..9c959617fba98 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -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,
diff --git a/clang/test/Driver/dxc_fcgl.hlsl b/clang/test/Driver/dxc_fcgl.hlsl
index cfbf2503ddaae..fe65124c197bc 100644
--- a/clang/test/Driver/dxc_fcgl.hlsl
+++ b/clang/test/Driver/dxc_fcgl.hlsl
@@ -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
More information about the cfe-commits
mailing list