Add weak implementation of the __lsan_is_turned_off in Leak Checker

PiperOrigin-RevId: 707155040
Change-Id: I84b84a07289334cb172d8a00674f88396ada9df6
This commit is contained in:
Abseil Team
2024-12-17 10:28:23 -08:00
committed by Copybara-Service
parent 03c34a9eea
commit caec5f1ca5

View File

@@ -28,7 +28,7 @@
#include <sanitizer/lsan_interface.h>
#if ABSL_HAVE_ATTRIBUTE_WEAK
extern "C" ABSL_ATTRIBUTE_WEAK int __lsan_is_turned_off();
extern "C" ABSL_ATTRIBUTE_WEAK int __lsan_is_turned_off() { return 0; }
#endif
namespace absl {
@@ -37,7 +37,7 @@ bool HaveLeakSanitizer() { return true; }
#if ABSL_HAVE_ATTRIBUTE_WEAK
bool LeakCheckerIsActive() {
return !(&__lsan_is_turned_off && __lsan_is_turned_off());
return __lsan_is_turned_off() == 0;
}
#else
bool LeakCheckerIsActive() { return true; }