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

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 19:21:07 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/74170.diff


2 Files Affected:

- (modified) compiler-rt/lib/asan/asan_interceptors.h (+3-6) 
- (modified) compiler-rt/lib/asan/asan_rtl.cpp (+3-1) 


``````````diff
diff --git a/compiler-rt/lib/asan/asan_interceptors.h b/compiler-rt/lib/asan/asan_interceptors.h
index e355c1258a9fe12..6a7748c8f9bb92a 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 d8bd19d8b79d4b9..b129e22813dac99 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

``````````

</details>


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


More information about the llvm-commits mailing list