[clang] [AMDGPU][clang] Fix clang driver check for multiple sanitizer arguments (PR #166851)
Robert Imschweiler via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 7 06:37:54 PST 2025
https://github.com/ro-i updated https://github.com/llvm/llvm-project/pull/166851
>From a4e25d6ccd0e346c8e96a07f8bdeda63fc2ae795 Mon Sep 17 00:00:00 2001
From: Robert Imschweiler <robert.imschweiler at amd.com>
Date: Thu, 6 Nov 2025 15:36:50 -0600
Subject: [PATCH 1/4] [AMDGPU][clang] Fix clang driver check for multiple
sanitizer arguments
`-fsanitize=address,fuzzer` should be rejected like
`-fsanitize=fuzzer,address`.
The address sanitizer enables the device sanitizer pipeline. The fuzzer
implicitly turns on LLVMs SanitizerCoverage, which the driver then
forwards to the device cc1. SanitizerCoverage is not supported on
amdgcn.
---
clang/lib/Driver/ToolChains/AMDGPU.cpp | 8 +++++---
clang/lib/Driver/ToolChains/AMDGPU.h | 12 +++++++-----
clang/test/Driver/amdgpu-openmp-sanitize-options.c | 13 +++++++++++++
3 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 654a382e87e40..1f82ddc23e321 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -1091,9 +1091,11 @@ bool AMDGPUToolChain::shouldSkipSanitizeOption(
auto &Diags = TC.getDriver().getDiags();
// For simplicity, we only allow -fsanitize=address
- SanitizerMask K = parseSanitizerValue(A->getValue(), /*AllowGroups=*/false);
- if (K != SanitizerKind::Address)
- return true;
+ for (const char *Value : A->getValues()) {
+ SanitizerMask K = parseSanitizerValue(Value, /*AllowGroups=*/false);
+ if (K != SanitizerKind::Address)
+ return true;
+ }
llvm::StringMap<bool> FeatureMap;
auto OptionalGpuArch = parseTargetID(TC.getTriple(), TargetID, &FeatureMap);
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.h b/clang/lib/Driver/ToolChains/AMDGPU.h
index e90a5736911e4..c5680a9d486bd 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.h
+++ b/clang/lib/Driver/ToolChains/AMDGPU.h
@@ -161,11 +161,13 @@ class LLVM_LIBRARY_VISIBILITY ROCMToolChain : public AMDGPUToolChain {
return;
auto &Diags = getDriver().getDiags();
for (auto *A : Args.filtered(options::OPT_fsanitize_EQ)) {
- SanitizerMask K =
- parseSanitizerValue(A->getValue(), /*Allow Groups*/ false);
- if (K != SanitizerKind::Address)
- Diags.Report(clang::diag::warn_drv_unsupported_option_for_target)
- << A->getAsString(Args) << getTriple().str();
+ for (const char *Value : A->getValues()) {
+ SanitizerMask K =
+ parseSanitizerValue(Value, /*Allow Groups*/ false);
+ if (K != SanitizerKind::Address)
+ Diags.Report(clang::diag::warn_drv_unsupported_option_for_target)
+ << A->getAsString(Args) << getTriple().str();
+ }
}
}
};
diff --git a/clang/test/Driver/amdgpu-openmp-sanitize-options.c b/clang/test/Driver/amdgpu-openmp-sanitize-options.c
index 914e01873089c..f7b869b6f3234 100644
--- a/clang/test/Driver/amdgpu-openmp-sanitize-options.c
+++ b/clang/test/Driver/amdgpu-openmp-sanitize-options.c
@@ -48,6 +48,18 @@
// RUN: %clang -no-canonical-prefixes -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=gfx908:xnack+ --offload-arch=gfx900:xnack+ -fsanitize=address -fno-gpu-sanitize --rocm-path=%S/Inputs/rocm %s 2>&1 \
// RUN: | FileCheck -check-prefixes=HOSTSAN,NOGPUSAN,SAN %s
+// Catch invalid combination of sanitizers regardless of their order.
+// The address sanitizer enables the device sanitizer pipeline. The fuzzer
+// implicitly turns on LLVMs SanitizerCoverage, which the driver then forwards
+// to the device cc1. SanitizerCoverage is not supported on amdgcn
+// RUN: %clang -no-canonical-prefixes -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=gfx908:xnack+ -fsanitize=address,fuzzer --rocm-path=%S/Inputs/rocm %s 2>&1 \
+// RUN: | FileCheck -check-prefixes=HOSTSANCOMBINATION,INVALIDCOMBINATION1 %s
+// RUN: %clang -no-canonical-prefixes -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=gfx908:xnack+ -fsanitize=fuzzer,address --rocm-path=%S/Inputs/rocm %s 2>&1 \
+// RUN: | FileCheck -check-prefixes=HOSTSANCOMBINATION,INVALIDCOMBINATION2 %s
+
+// INVALIDCOMBINATION1: warning: ignoring '-fsanitize=address,fuzzer' option as it is not currently supported for target 'amdgcn-amd-amdhsa' [-Woption-ignored]
+// INVALIDCOMBINATION2: warning: ignoring '-fsanitize=fuzzer,address' option as it is not currently supported for target 'amdgcn-amd-amdhsa' [-Woption-ignored]
+
// FAIL-DAG: error: cannot find ROCm device library for ABI version 5; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library
// NOTSUPPORTED-DAG: warning: ignoring '-fsanitize=leak' option as it is not currently supported for target 'amdgcn-amd-amdhsa'
@@ -55,6 +67,7 @@
// XNACKNEG: warning: ignoring '-fsanitize=address' option for offload arch 'gfx908:xnack-' as it is not currently supported there. Use it with an offload arch containing 'xnack+' instead
// HOSTSAN: {{"[^"]*clang[^"]*" "-cc1" "-triple" "x86_64-unknown-linux-gnu".* "-fopenmp".* "-fsanitize=address".* "--offload-targets=amdgcn-amd-amdhsa".* "-x" "c".*}}
+// HOSTSANCOMBINATION: {{"[^"]*clang[^"]*" "-cc1" "-triple" "x86_64-unknown-linux-gnu".* "-fopenmp".* "-fsanitize=address,fuzzer,fuzzer-no-link".* "--offload-targets=amdgcn-amd-amdhsa".* "-x" "c".*}}
// GPUSAN: {{"[^"]*clang[^"]*" "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu".* "-emit-llvm-bc".* "-mlink-bitcode-file" "[^"]*asanrtl.bc".* "-mlink-bitcode-file" "[^"]*ockl.bc".* "-target-cpu" "(gfx908|gfx900)".* "-fopenmp".* "-fsanitize=address".* "-x" "c".*}}
// NOGPUSAN: {{"[^"]*clang[^"]*" "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu".* "-emit-llvm-bc".* "-target-cpu" "(gfx908|gfx900)".* "-fopenmp".* "-x" "c".*}}
>From 3a126e06e39ee2c9a19c4e4f176784d4fd6e1a7f Mon Sep 17 00:00:00 2001
From: Robert Imschweiler <robert.imschweiler at amd.com>
Date: Thu, 6 Nov 2025 15:44:06 -0600
Subject: [PATCH 2/4] fix formatting
---
clang/lib/Driver/ToolChains/AMDGPU.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.h b/clang/lib/Driver/ToolChains/AMDGPU.h
index c5680a9d486bd..95d2a53ed5be8 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.h
+++ b/clang/lib/Driver/ToolChains/AMDGPU.h
@@ -162,8 +162,7 @@ class LLVM_LIBRARY_VISIBILITY ROCMToolChain : public AMDGPUToolChain {
auto &Diags = getDriver().getDiags();
for (auto *A : Args.filtered(options::OPT_fsanitize_EQ)) {
for (const char *Value : A->getValues()) {
- SanitizerMask K =
- parseSanitizerValue(Value, /*Allow Groups*/ false);
+ SanitizerMask K = parseSanitizerValue(Value, /*Allow Groups*/ false);
if (K != SanitizerKind::Address)
Diags.Report(clang::diag::warn_drv_unsupported_option_for_target)
<< A->getAsString(Args) << getTriple().str();
>From 3f742c1b7ac08ebac723978642b267cad24d2f68 Mon Sep 17 00:00:00 2001
From: Robert Imschweiler <robert.imschweiler at amd.com>
Date: Fri, 7 Nov 2025 08:09:11 -0600
Subject: [PATCH 3/4] ignore sanitizers selectively
---
clang/lib/Driver/ToolChains/AMDGPU.cpp | 22 +++++++++++--------
clang/lib/Driver/ToolChains/AMDGPU.h | 16 ++++++++------
clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp | 14 +++++++-----
clang/lib/Driver/ToolChains/HIPAMD.cpp | 12 +++++++++-
.../Driver/amdgpu-openmp-sanitize-options.c | 13 ++++++-----
clang/test/Driver/hip-sanitize-options.hip | 19 +++++++++++++++-
6 files changed, 67 insertions(+), 29 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 1f82ddc23e321..1de9d40053c7c 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -1073,29 +1073,32 @@ ROCMToolChain::getCommonDeviceLibNames(
getSanitizerArgs(DriverArgs).needsAsanRt());
}
-bool AMDGPUToolChain::shouldSkipSanitizeOption(
+std::optional<std::string> AMDGPUToolChain::filterSanitizeOption(
const ToolChain &TC, const llvm::opt::ArgList &DriverArgs,
StringRef TargetID, const llvm::opt::Arg *A) const {
// For actions without targetID, do nothing.
if (TargetID.empty())
- return false;
+ return std::nullopt;
Option O = A->getOption();
if (!O.matches(options::OPT_fsanitize_EQ))
- return false;
+ return std::nullopt;
if (!DriverArgs.hasFlag(options::OPT_fgpu_sanitize,
options::OPT_fno_gpu_sanitize, true))
- return true;
+ return "";
auto &Diags = TC.getDriver().getDiags();
- // For simplicity, we only allow -fsanitize=address
+ // We only allow the address sanitizer and ignore all other sanitizers.
+ SmallVector<std::string, 4> SupportedSanitizers;
for (const char *Value : A->getValues()) {
SanitizerMask K = parseSanitizerValue(Value, /*AllowGroups=*/false);
- if (K != SanitizerKind::Address)
- return true;
+ if (K == SanitizerKind::Address)
+ SupportedSanitizers.push_back(std::string(Value));
}
+ if (SupportedSanitizers.empty())
+ return "";
llvm::StringMap<bool> FeatureMap;
auto OptionalGpuArch = parseTargetID(TC.getTriple(), TargetID, &FeatureMap);
@@ -1107,7 +1110,8 @@ bool AMDGPUToolChain::shouldSkipSanitizeOption(
Diags.Report(
clang::diag::warn_drv_unsupported_option_for_offload_arch_req_feature)
<< A->getAsString(DriverArgs) << TargetID << "xnack+";
- return true;
+ return "";
}
- return false;
+
+ return llvm::join(SupportedSanitizers, ",");
}
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.h b/clang/lib/Driver/ToolChains/AMDGPU.h
index 95d2a53ed5be8..7c4dcfef8b7f1 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.h
+++ b/clang/lib/Driver/ToolChains/AMDGPU.h
@@ -101,11 +101,13 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUToolChain : public Generic_ELF {
/// Needed for translating LTO options.
const char *getDefaultLinker() const override { return "ld.lld"; }
- /// Should skip sanitize options.
- bool shouldSkipSanitizeOption(const ToolChain &TC,
- const llvm::opt::ArgList &DriverArgs,
- StringRef TargetID,
- const llvm::opt::Arg *A) const;
+ /// Filter supported sanitizers from the sanitize option and return them. If
+ /// there should be no filtering and Arg should be kept as-is, return
+ /// std::nullopt. If no sanitizers are supported, return an empty string.
+ std::optional<std::string>
+ filterSanitizeOption(const ToolChain &TC,
+ const llvm::opt::ArgList &DriverArgs, StringRef TargetID,
+ const llvm::opt::Arg *A) const;
/// Uses amdgpu-arch tool to get arch of the system GPU. Will return error
/// if unable to find one.
@@ -164,8 +166,8 @@ class LLVM_LIBRARY_VISIBILITY ROCMToolChain : public AMDGPUToolChain {
for (const char *Value : A->getValues()) {
SanitizerMask K = parseSanitizerValue(Value, /*Allow Groups*/ false);
if (K != SanitizerKind::Address)
- Diags.Report(clang::diag::warn_drv_unsupported_option_for_target)
- << A->getAsString(Args) << getTriple().str();
+ Diags.Report(clang::diag::warn_drv_unsupported_option_part_for_target)
+ << Value << A->getAsString(Args) << getTriple().str();
}
}
}
diff --git a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
index 2b41d54a9eb73..8d59116f3cc13 100644
--- a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
@@ -66,16 +66,20 @@ llvm::opt::DerivedArgList *AMDGPUOpenMPToolChain::TranslateArgs(
const OptTable &Opts = getDriver().getOpts();
- // Skip sanitize options passed from the HostTC. Claim them early.
+ // Skip sanitize options passed from the HostTC. Remove them early.
// The decision to sanitize device code is computed only by
// 'shouldSkipSanitizeOption'.
if (DAL->hasArg(options::OPT_fsanitize_EQ))
- DAL->claimAllArgs(options::OPT_fsanitize_EQ);
+ DAL->eraseArg(options::OPT_fsanitize_EQ);
- for (Arg *A : Args)
- if (!shouldSkipSanitizeOption(*this, Args, BoundArch, A) &&
- !llvm::is_contained(*DAL, A))
+ for (Arg *A : Args) {
+ std::optional<std::string> SupportedSanitizers =
+ filterSanitizeOption(*this, Args, BoundArch, A);
+ if (!SupportedSanitizers)
DAL->append(A);
+ else if (!SupportedSanitizers->empty())
+ DAL->AddJoinedArg(A, A->getOption(), *SupportedSanitizers);
+ }
if (!BoundArch.empty()) {
DAL->eraseArg(options::OPT_march_EQ);
diff --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp b/clang/lib/Driver/ToolChains/HIPAMD.cpp
index c0c8afec07264..648be0ac2db08 100644
--- a/clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -291,9 +291,19 @@ HIPAMDToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
const OptTable &Opts = getDriver().getOpts();
+ // Skip sanitize options passed from the HostTC. Remove them early.
+ // The decision to sanitize device code is computed only by
+ // 'shouldSkipSanitizeOption'.
+ if (DAL->hasArg(options::OPT_fsanitize_EQ))
+ DAL->eraseArg(options::OPT_fsanitize_EQ);
+
for (Arg *A : Args) {
- if (!shouldSkipSanitizeOption(*this, Args, BoundArch, A))
+ std::optional<std::string> SupportedSanitizers =
+ filterSanitizeOption(*this, Args, BoundArch, A);
+ if (!SupportedSanitizers)
DAL->append(A);
+ else if (!SupportedSanitizers->empty())
+ DAL->AddJoinedArg(A, A->getOption(), *SupportedSanitizers);
}
if (!BoundArch.empty()) {
diff --git a/clang/test/Driver/amdgpu-openmp-sanitize-options.c b/clang/test/Driver/amdgpu-openmp-sanitize-options.c
index f7b869b6f3234..56f5abb8bed95 100644
--- a/clang/test/Driver/amdgpu-openmp-sanitize-options.c
+++ b/clang/test/Driver/amdgpu-openmp-sanitize-options.c
@@ -48,20 +48,21 @@
// RUN: %clang -no-canonical-prefixes -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=gfx908:xnack+ --offload-arch=gfx900:xnack+ -fsanitize=address -fno-gpu-sanitize --rocm-path=%S/Inputs/rocm %s 2>&1 \
// RUN: | FileCheck -check-prefixes=HOSTSAN,NOGPUSAN,SAN %s
-// Catch invalid combination of sanitizers regardless of their order.
-// The address sanitizer enables the device sanitizer pipeline. The fuzzer
+// Catch invalid combination of sanitizers regardless of their order and ignore
+// them selectively.
+// (The address sanitizer enables the device sanitizer pipeline. The fuzzer
// implicitly turns on LLVMs SanitizerCoverage, which the driver then forwards
-// to the device cc1. SanitizerCoverage is not supported on amdgcn
+// to the device cc1. SanitizerCoverage is not supported on amdgcn.)
// RUN: %clang -no-canonical-prefixes -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=gfx908:xnack+ -fsanitize=address,fuzzer --rocm-path=%S/Inputs/rocm %s 2>&1 \
// RUN: | FileCheck -check-prefixes=HOSTSANCOMBINATION,INVALIDCOMBINATION1 %s
// RUN: %clang -no-canonical-prefixes -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=gfx908:xnack+ -fsanitize=fuzzer,address --rocm-path=%S/Inputs/rocm %s 2>&1 \
// RUN: | FileCheck -check-prefixes=HOSTSANCOMBINATION,INVALIDCOMBINATION2 %s
-// INVALIDCOMBINATION1: warning: ignoring '-fsanitize=address,fuzzer' option as it is not currently supported for target 'amdgcn-amd-amdhsa' [-Woption-ignored]
-// INVALIDCOMBINATION2: warning: ignoring '-fsanitize=fuzzer,address' option as it is not currently supported for target 'amdgcn-amd-amdhsa' [-Woption-ignored]
+// INVALIDCOMBINATION1: warning: ignoring 'fuzzer' in '-fsanitize=address,fuzzer' option as it is not currently supported for target 'amdgcn-amd-amdhsa' [-Woption-ignored]
+// INVALIDCOMBINATION2: warning: ignoring 'fuzzer' in '-fsanitize=fuzzer,address' option as it is not currently supported for target 'amdgcn-amd-amdhsa' [-Woption-ignored]
// FAIL-DAG: error: cannot find ROCm device library for ABI version 5; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library
-// NOTSUPPORTED-DAG: warning: ignoring '-fsanitize=leak' option as it is not currently supported for target 'amdgcn-amd-amdhsa'
+// NOTSUPPORTED-DAG: warning: ignoring 'leak' in '-fsanitize=leak' option as it is not currently supported for target 'amdgcn-amd-amdhsa'
// NOXNACK: warning: ignoring '-fsanitize=address' option for offload arch 'gfx908' as it is not currently supported there. Use it with an offload arch containing 'xnack+' instead
// XNACKNEG: warning: ignoring '-fsanitize=address' option for offload arch 'gfx908:xnack-' as it is not currently supported there. Use it with an offload arch containing 'xnack+' instead
diff --git a/clang/test/Driver/hip-sanitize-options.hip b/clang/test/Driver/hip-sanitize-options.hip
index 0c9c15b61fdc9..371cff3fed25c 100644
--- a/clang/test/Driver/hip-sanitize-options.hip
+++ b/clang/test/Driver/hip-sanitize-options.hip
@@ -47,6 +47,18 @@
// RUN: -fsanitize=leak -nogpuinc --rocm-path=%S/Inputs/rocm \
// RUN: %s 2>&1 | FileCheck -check-prefixes=NOGPUNEG %s
+// Catch invalid combination of sanitizers regardless of their order and ignore
+// them selectively.
+// (The address sanitizer enables the device sanitizer pipeline. The fuzzer
+// implicitly turns on LLVMs SanitizerCoverage, which the driver then forwards
+// to the device cc1. SanitizerCoverage is not supported on amdgcn.)
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu --offload-arch=gfx900:xnack+ \
+// RUN: -fsanitize=address,fuzzer --rocm-path=%S/Inputs/rocm %s 2>&1 \
+// RUN: | FileCheck -check-prefixes=INVALIDCOMBINATION,INVALIDCOMBINATION1 %s
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu --offload-arch=gfx900:xnack+ \
+// RUN: -fsanitize=fuzzer,address --rocm-path=%S/Inputs/rocm %s 2>&1 \
+// RUN: | FileCheck -check-prefixes=INVALIDCOMBINATION,INVALIDCOMBINATION2 %s
+
// CHECK-NOT: {{"[^"]*clang[^"]*".* "-fcuda-is-device".* "-fsanitize=address"}}
// CHECK-NOT: {{"[^"]*clang[^"]*".* "-fcuda-is-device".* "-mlink-bitcode-file" ".*asanrtl.bc"}}
// CHECK-NOT: {{"[^"]*lld(\.exe){0,1}".* ".*hip.bc"}}
@@ -62,7 +74,7 @@
// FAIL: error: cannot find ROCm device library for ABI version 5; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library
-// XNACK-DAG: warning: ignoring '-fsanitize=leak' option as it is not currently supported for target 'amdgcn-amd-amdhsa'
+// XNACK-DAG: warning: ignoring 'leak' in '-fsanitize=leak' option as it is not currently supported for target 'amdgcn-amd-amdhsa'
// XNACK-DAG: warning: ignoring '-fsanitize=address' option for offload arch 'gfx900:xnack-' as it is not currently supported there. Use it with an offload arch containing 'xnack+' instead
// XNACK-DAG: warning: ignoring '-fsanitize=address' option for offload arch 'gfx906' as it is not currently supported there. Use it with an offload arch containing 'xnack+' instead
// XNACK-DAG: {{"[^"]*clang[^"]*".* "-mlink-bitcode-file" ".*asanrtl.bc".* "-target-cpu" "gfx900".* "-target-feature" "\+xnack".* "-fsanitize=address"}}
@@ -96,3 +108,8 @@
// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-mlink-bitcode-file" ".*asanrtl.bc".* "-target-cpu" "gfx900".* "-target-feature" "-xnack"}}
// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-mlink-bitcode-file" ".*asanrtl.bc".* "-target-cpu" "gfx906"}}
// NOGPUNEG-NOT: {{"[^"]*lld(\.exe){0,1}".* ".*hip.bc"}}
+
+// INVALIDCOMBINATION1-DAG: warning: ignoring 'fuzzer' in '-fsanitize=address,fuzzer' option as it is not currently supported for target 'amdgcn-amd-amdhsa' [-Woption-ignored]
+// INVALIDCOMBINATION2-DAG: warning: ignoring 'fuzzer' in '-fsanitize=fuzzer,address' option as it is not currently supported for target 'amdgcn-amd-amdhsa' [-Woption-ignored]
+// INVALIDCOMBINATION-DAG: {{"[^"]*clang[^"]*".* "-mlink-bitcode-file" ".*asanrtl.bc".* "-target-cpu" "gfx900".* "-target-feature" "\+xnack".* "-fsanitize=address"}}
+// INVALIDCOMBINATION-DAG: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address,fuzzer,fuzzer-no-link"}}
>From 990e02bfb57808f74ae5991ccdffb1304111bf99 Mon Sep 17 00:00:00 2001
From: Robert Imschweiler <robert.imschweiler at amd.com>
Date: Fri, 7 Nov 2025 08:37:30 -0600
Subject: [PATCH 4/4] add forgotten diagnostic
---
clang/include/clang/Basic/DiagnosticDriverKinds.td | 3 +++
1 file changed, 3 insertions(+)
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 83980e3ac35b7..4e0774fa16f00 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -133,6 +133,9 @@ def warn_drv_unsupported_option_for_offload_arch_req_feature : Warning<
def warn_drv_unsupported_option_for_target : Warning<
"ignoring '%0' option as it is not currently supported for target '%1'">,
InGroup<OptionIgnored>;
+def warn_drv_unsupported_option_part_for_target : Warning<
+ "ignoring '%0' in '%1' option as it is not currently supported for target '%2'">,
+ InGroup<OptionIgnored>;
def warn_drv_invalid_argument_for_flang : Warning<
"'%0' is not valid for Fortran">,
InGroup<OptionIgnored>;
More information about the cfe-commits
mailing list