================
@@ -1074,27 +1074,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
-  SanitizerMask K = parseSanitizerValue(A->getValue(), /*AllowGroups=*/false);
-  if (K != SanitizerKind::Address)
-    return true;
+  // We only allow the address sanitizer and ignore all other sanitizers.
----------------
ThorBl wrote:

Centralizing the handling of unsupported sanitizers in 
diagnoseUnsupportedSanitizers is a good idea. However, in its current form, it 
only issues a warning and doesn’t prevent unsupported sanitizers from being 
forwarded to the device compilation. For this issue, the logic needs to not 
just warn but also actively filter (drop) unsupported sanitizers from the 
device job to avoid the crash. Extending this function to perform the filtering 
would help reduce code duplication across the HIP and OpenMP toolchains.

https://github.com/llvm/llvm-project/pull/166851
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to