[llvm] [DenseMap] Resolves asan + msvc build syntax errors (PR #193695)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 01:58:58 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Davide Grohmann (davidegrohmann)
<details>
<summary>Changes</summary>
The problem was introduced by #<!-- -->183457 as an asan workaround for clang builds to silence false positices, so the fix here just enables the workaround for clang builds.
Fixes #<!-- -->189323
---
Full diff: https://github.com/llvm/llvm-project/pull/193695.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/DenseMap.h (+4-2)
``````````diff
diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index e1f1ab251d66c..e396b69ec40e2 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -1037,7 +1037,8 @@ class SmallDenseMap
// Note that this cast does not violate aliasing rules as we assert that
// the memory's dynamic type is the small, inline bucket buffer, and the
// 'storage' is a POD containing a char buffer.
-#if defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_HWADDRESS__)
+#if defined(__clang__) && \
+ (defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_HWADDRESS__))
// Unless it's a sanitizer with container overflow detection. In this case
// some items in buckets can be partially poisoned, triggering sanitizer
// report on load.
@@ -1054,7 +1055,8 @@ class SmallDenseMap
const LargeRep *getLargeRep() const {
assert(!Small);
// Note, same rule about aliasing as with getInlineBuckets.
-#if defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_HWADDRESS__)
+#if defined(__clang__) && \
+ (defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_HWADDRESS__))
__asm__ volatile("" ::: "memory");
#endif
return reinterpret_cast<const LargeRep *>(&storage);
``````````
</details>
https://github.com/llvm/llvm-project/pull/193695
More information about the llvm-commits
mailing list