c++: over-eager friend matching [PR109649]
[official-gcc.git] / libsanitizer / lsan / lsan.h
blob757edec8e104f906206520ce6207d99b6a02cd06
1 //=-- lsan.h --------------------------------------------------------------===//
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.
10 // Private header for standalone LSan RTL.
12 //===----------------------------------------------------------------------===//
14 #include "lsan_thread.h"
15 #if SANITIZER_POSIX
16 # include "lsan_posix.h"
17 #elif SANITIZER_FUCHSIA
18 # include "lsan_fuchsia.h"
19 #endif
20 #include "sanitizer_common/sanitizer_flags.h"
21 #include "sanitizer_common/sanitizer_stacktrace.h"
23 #define GET_STACK_TRACE(max_size, fast) \
24 __sanitizer::BufferedStackTrace stack; \
25 stack.Unwind(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), nullptr, fast, \
26 max_size);
28 #define GET_STACK_TRACE_FATAL \
29 GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_fatal)
31 #define GET_STACK_TRACE_MALLOC \
32 GET_STACK_TRACE(__sanitizer::common_flags()->malloc_context_size, \
33 common_flags()->fast_unwind_on_malloc)
35 #define GET_STACK_TRACE_THREAD GET_STACK_TRACE(kStackTraceMax, true)
37 namespace __lsan {
39 void InitializeInterceptors();
40 void ReplaceSystemMalloc();
41 void LsanOnDeadlySignal(int signo, void *siginfo, void *context);
42 void InstallAtExitCheckLeaks();
44 #define ENSURE_LSAN_INITED \
45 do { \
46 CHECK(!lsan_init_is_running); \
47 if (!lsan_inited) \
48 __lsan_init(); \
49 } while (0)
51 } // namespace __lsan
53 extern bool lsan_inited;
54 extern bool lsan_init_is_running;
56 extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __lsan_init();