[llvm] 2a1d2a1 - Revert "[ASan][JSON] Unpoison memory before its reuse" (#196203)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 17:02:15 PDT 2026


Author: Aiden Grossman
Date: 2026-05-06T17:02:10-07:00
New Revision: 2a1d2a160695b41787b0f0e734a75c8820655a54

URL: https://github.com/llvm/llvm-project/commit/2a1d2a160695b41787b0f0e734a75c8820655a54
DIFF: https://github.com/llvm/llvm-project/commit/2a1d2a160695b41787b0f0e734a75c8820655a54.diff

LOG: Revert "[ASan][JSON] Unpoison memory before its reuse" (#196203)

Reverts llvm/llvm-project#79065

This is no longer necessary now that we have gotten rid of ASan short
string annotations in libc++.

Added: 
    

Modified: 
    llvm/include/llvm/Support/JSON.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h
index 27862eb7ab6bb..b7aeacbe9ab6f 100644
--- a/llvm/include/llvm/Support/JSON.h
+++ b/llvm/include/llvm/Support/JSON.h
@@ -50,7 +50,6 @@
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
@@ -490,19 +489,7 @@ class Value {
   friend class Array;
   friend class Object;
 
-  template <typename T, typename... U> void create(U &&... V) {
-#if LLVM_ADDRESS_SANITIZER_BUILD
-    // Unpoisoning to prevent overwriting poisoned object (e.g., annotated short
-    // string). Objects that have had their memory poisoned may cause an ASan
-    // error if their memory is reused without calling their destructor.
-    // Unpoisoning the memory prevents this error from occurring.
-    // FIXME: This is a temporary solution to prevent buildbots from failing.
-    //  The more appropriate approach would be to call the object's destructor
-    //  to unpoison memory. This would prevent any potential memory leaks (long
-    //  strings). Read for details:
-    //  https://github.com/llvm/llvm-project/pull/79065#discussion_r1462621761
-    __asan_unpoison_memory_region(&Union, sizeof(T));
-#endif
+  template <typename T, typename... U> void create(U &&...V) {
     new (reinterpret_cast<T *>(&Union)) T(std::forward<U>(V)...);
   }
   template <typename T> T &as() const {


        


More information about the llvm-commits mailing list