[llvm] [DenseMap] Resolves asan + msvc build syntax errors (PR #193695)
Davide Grohmann via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 01:58:23 PDT 2026
https://github.com/davidegrohmann created https://github.com/llvm/llvm-project/pull/193695
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
>From 3553683e480fbaaace987b43c356e2f05a33a121 Mon Sep 17 00:00:00 2001
From: Davide Grohmann <davide.grohmann at arm.com>
Date: Thu, 23 Apr 2026 10:20:08 +0200
Subject: [PATCH] [DenseMap] Resolves asan + msvc build syntax errors
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
Signed-off-by: Davide Grohmann <davide.grohmann at arm.com>
Change-Id: Iad66b41f5a0a69269e3490bfc0e2cc2821122756
---
llvm/include/llvm/ADT/DenseMap.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
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);
More information about the llvm-commits
mailing list