[llvm] [libcxx] [compiler-rt] [flang] [clang] [libc] [clang-tools-extra] [NFC][ASAN] Replace AsanInitIsRunning with TryAsanInitFromRtl (PR #74171)

Vitaly Buka via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 11:02:22 PST 2023


https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/74171

>From c630b3d042729fa2053866c959e8e05b8ce11267 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Fri, 1 Dec 2023 19:20:23 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20change?=
 =?UTF-8?q?s=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/lib/asan/asan_interceptors.h | 9 +++------
 compiler-rt/lib/asan/asan_rtl.cpp        | 4 +++-
 2 files changed, 6 insertions(+), 7 deletions(-)

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 cfe-commits mailing list