1 //=-- lsan_linux.cpp ------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file is a part of LeakSanitizer. Linux/NetBSD/Fuchsia-specific code. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #include "sanitizer_common/sanitizer_platform.h" 14 15 #if SANITIZER_LINUX || SANITIZER_NETBSD || SANITIZER_FUCHSIA 16 17 # include "lsan_allocator.h" 18 # include "lsan_thread.h" 19 20 namespace __lsan { 21 22 static THREADLOCAL ThreadContextLsanBase *current_thread = nullptr; GetCurrentThread()23ThreadContextLsanBase *GetCurrentThread() { return current_thread; } SetCurrentThread(ThreadContextLsanBase * tctx)24void SetCurrentThread(ThreadContextLsanBase *tctx) { current_thread = tctx; } 25 26 static THREADLOCAL AllocatorCache allocator_cache; GetAllocatorCache()27AllocatorCache *GetAllocatorCache() { return &allocator_cache; } 28 ReplaceSystemMalloc()29void ReplaceSystemMalloc() {} 30 31 } // namespace __lsan 32 33 #endif // SANITIZER_LINUX || SANITIZER_NETBSD || SANITIZER_FUCHSIA 34