================
@@ -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.
----------------
ampandey-1995 wrote:

This function is a lower-level helper utility. We can check for whatever 
options supported by `-fsanitize=` and filter them at higher level.  
[getSupportedSanitizers]( 
https://github.com/llvm/llvm-project/blob/0875755f5275dc7a84b1aeb526b7822b47a733c9/clang/lib/Driver/ToolChains/AMDGPU.h#L154)
  might help to cover this part of code.

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