xref: /freebsd/contrib/llvm-project/compiler-rt/lib/lsan/lsan_linux.cpp (revision 56b17de1e8360fe131d425de20b5e75ff3ea897c)
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;
23 ThreadContextLsanBase *GetCurrentThread() { return current_thread; }
24 void SetCurrentThread(ThreadContextLsanBase *tctx) { current_thread = tctx; }
25 
26 static THREADLOCAL AllocatorCache allocator_cache;
27 AllocatorCache *GetAllocatorCache() { return &allocator_cache; }
28 
29 void ReplaceSystemMalloc() {}
30 
31 } // namespace __lsan
32 
33 #endif  // SANITIZER_LINUX || SANITIZER_NETBSD || SANITIZER_FUCHSIA
34