[clang] Reapply "[Driver][ROCm][OpenMP] Fix default ockl linking for OpenMP."… (PR #126671)

Amit Kumar Pandey via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 11 04:49:31 PST 2025


================
@@ -1014,17 +1014,20 @@ RocmInstallationDetector::getCommonBitcodeLibs(
     bool isOpenMP = false) const {
   llvm::SmallVector<ToolChain::BitCodeLibraryInfo, 12> BCLibs;
 
-  auto GPUSanEnabled = [GPUSan]() { return std::get<bool>(GPUSan); };
+  // GPU Sanitizer currently only supports ASan and is enabled through host
+  // ASan.
+  auto GPUSanEnabled = [GPUSan]() {
+    return std::get<bool>(GPUSan) &&
+           std::get<const SanitizerArgs>(GPUSan).needsAsanRt();
+  };
----------------
ampandey-1995 wrote:

> Why is this using a lambda and capture for a simple and?
If we have other sanitizers apart from asan such as msan for GPU. Then , what I think we would be having another msanrtl.bc linked so that future code would be something like below for easy readability and maintainability purpose. Note: we cannot enable both ASan and MSan simultaneously at compile time.  

```
auto GPUSanEnabled = [GPUSan](){
auto SanArgs = std::get<const SanitizerArgs>(GPUSan);
return std::get<bool>(GPUSan) &&
           (SanArgs.needsAsanRt() || SanArgs.needsMsanRt()) ;
};
```

> I'm also surprised `get<bool>` works instead of `get<0>`
Yes, since the  tuple contents are of unique types it works. Should I change it?







https://github.com/llvm/llvm-project/pull/126671


More information about the cfe-commits mailing list