From 914d082ff0beec08f8b8ceafcf04fb357b4899c5 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Mon, 17 Apr 2023 16:29:18 -0700 Subject: [PATCH] [lsan] Fix Darwin build --- compiler-rt/lib/lsan/lsan_common_mac.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler-rt/lib/lsan/lsan_common_mac.cpp b/compiler-rt/lib/lsan/lsan_common_mac.cpp index 70ff6d5..79cc987 100644 --- a/compiler-rt/lib/lsan/lsan_common_mac.cpp +++ b/compiler-rt/lib/lsan/lsan_common_mac.cpp @@ -25,6 +25,8 @@ # include "sanitizer_common/sanitizer_allocator_internal.h" namespace __lsan { +class ThreadContextLsanBase; + enum class SeenRegion { None = 0, AllocOnce = 1 << 0, @@ -57,11 +59,11 @@ typedef struct { static pthread_key_t key; static pthread_once_t key_once = PTHREAD_ONCE_INIT; -// The main thread destructor requires the current thread id, -// so we can't destroy it until it's been used and reset to invalid tid +// The main thread destructor requires the current thread, +// so we can't destroy it until it's been used and reset. void restore_tid_data(void *ptr) { thread_local_data_t *data = (thread_local_data_t *)ptr; - if (data->current_thread_id != kInvalidTid) + if (data->current_thread_id) pthread_setspecific(key, data); } @@ -76,7 +78,7 @@ static thread_local_data_t *get_tls_val(bool alloc) { if (ptr == NULL && alloc) { ptr = (thread_local_data_t *)InternalAlloc(sizeof(*ptr)); ptr->disable_counter = 0; - ptr->current_thread_id = kInvalidTid; + ptr->current_thread = nullptr; ptr->cache = AllocatorCache(); pthread_setspecific(key, ptr); } -- 2.7.4