[compiler-rt] e893f69 - [NFC][ASAN] Move ENSURE_ASAN_INITED into AsanInitFromRtl (#74170)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 10:59:15 PST 2023


Author: Vitaly Buka
Date: 2023-12-04T10:59:11-08:00
New Revision: e893f69545148c723a8b51d0975eb0142de86c62

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

LOG: [NFC][ASAN] Move ENSURE_ASAN_INITED into AsanInitFromRtl (#74170)

Added: 
    

Modified: 
    compiler-rt/lib/asan/asan_interceptors.h
    compiler-rt/lib/asan/asan_rtl.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/asan_interceptors.h b/compiler-rt/lib/asan/asan_interceptors.h
index e355c1258a9fe..6a7748c8f9bb9 100644
--- a/compiler-rt/lib/asan/asan_interceptors.h
+++ b/compiler-rt/lib/asan/asan_interceptors.h
@@ -24,12 +24,9 @@ namespace __asan {
 void InitializeAsanInterceptors();
 void InitializePlatformInterceptors();
 
-#define ENSURE_ASAN_INITED()       \
-  do {                             \
-    CHECK(!AsanInitIsRunning());   \
-    if (UNLIKELY(!AsanInited())) { \
-      AsanInitFromRtl();           \
-    }                              \
+#define ENSURE_ASAN_INITED() \
+  do {                       \
+    AsanInitFromRtl();       \
   } while (0)
 
 }  // namespace __asan

diff  --git a/compiler-rt/lib/asan/asan_rtl.cpp b/compiler-rt/lib/asan/asan_rtl.cpp
index d8bd19d8b79d4..b129e22813dac 100644
--- a/compiler-rt/lib/asan/asan_rtl.cpp
+++ b/compiler-rt/lib/asan/asan_rtl.cpp
@@ -520,7 +520,9 @@ static void AsanInitInternal() {
 // Initialize as requested from some part of ASan runtime library (interceptors,
 // allocator, etc).
 void AsanInitFromRtl() {
-  AsanInitInternal();
+  CHECK(!AsanInitIsRunning());
+  if (UNLIKELY(!AsanInited()))
+    AsanInitInternal();
 }
 
 #if ASAN_DYNAMIC


        


More information about the llvm-commits mailing list