[asan] Do not invoke LSan hooks unless CAN_SANITIZE_LEAKS.

llvm-svn: 182389
This commit is contained in:
Sergey Matveev 2013-05-21 15:35:34 +00:00
parent fff1f5f5e2
commit 17f5705d3c
2 changed files with 8 additions and 5 deletions

View File

@ -465,9 +465,11 @@ void __asan_init() {
Atexit(asan_atexit);
}
#if CAN_SANITIZE_LEAKS
if (flags()->detect_leaks) {
Atexit(__lsan::DoLeakCheck);
}
#endif
// interceptors
InitializeAsanInterceptors();
@ -548,7 +550,9 @@ void __asan_init() {
main_thread->ThreadStart(internal_getpid());
force_interface_symbols(); // no-op.
#if CAN_SANITIZE_LEAKS
__lsan::InitCommonLsan();
#endif
InitializeAllocator();

View File

@ -20,8 +20,9 @@
#include "sanitizer_common/sanitizer_stacktrace.h"
#include "sanitizer_common/sanitizer_stoptheworld.h"
namespace __lsan {
#if CAN_SANITIZE_LEAKS
namespace __lsan {
Flags lsan_flags;
static void InitializeFlags() {
@ -381,8 +382,6 @@ void LeakReport::PrintLargest(uptr max_leaks) {
remaining > 1 ? "s" : "");
}
}
#else // CAN_SANITIZE_LEAKS
void InitCommonLsan() {}
void DoLeakCheck() {}
#endif // CAN_SANITIZE_LEAKS
} // namespace __lsan
#endif // CAN_SANITIZE_LEAKS