[compiler-rt] r184422 - [asan] Define LSan annotations as no-ops if leak detection is not supported.
Sergey Matveev
earthdok at google.com
Thu Jun 20 06:39:43 PDT 2013
Author: smatveev
Date: Thu Jun 20 08:39:42 2013
New Revision: 184422
URL: http://llvm.org/viewvc/llvm-project?rev=184422&view=rev
Log:
[asan] Define LSan annotations as no-ops if leak detection is not supported.
Modified:
compiler-rt/trunk/lib/asan/asan_allocator2.cc
compiler-rt/trunk/lib/lsan/lsan_common.cc
Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=184422&r1=184421&r2=184422&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Thu Jun 20 08:39:42 2013
@@ -797,18 +797,22 @@ IgnoreObjectResult IgnoreObjectLocked(co
extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE
void __lsan_disable() {
+#if CAN_SANITIZE_LEAKS
__asan_init();
__asan::AsanThread *t = __asan::GetCurrentThread();
CHECK(t);
t->disable_lsan();
+#endif // CAN_SANITIZE_LEAKS
}
SANITIZER_INTERFACE_ATTRIBUTE
void __lsan_enable() {
+#if CAN_SANITIZE_LEAKS
__asan_init();
__asan::AsanThread *t = __asan::GetCurrentThread();
CHECK(t);
t->enable_lsan();
+#endif // CAN_SANITIZE_LEAKS
}
} // extern "C"
Modified: compiler-rt/trunk/lib/lsan/lsan_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.cc?rev=184422&r1=184421&r2=184422&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Thu Jun 20 08:39:42 2013
@@ -399,12 +399,14 @@ void LeakReport::PrintSummary() {
}
} // namespace __lsan
+#endif // CAN_SANITIZE_LEAKS
using namespace __lsan; // NOLINT
extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE
void __lsan_ignore_object(const void *p) {
+#if CAN_SANITIZE_LEAKS
// Cannot use PointsIntoChunk or LsanMetadata here, since the allocator is not
// locked.
BlockingMutexLock l(&global_mutex);
@@ -416,6 +418,6 @@ void __lsan_ignore_object(const void *p)
"heap object at %p is already being ignored\n", p);
if (res == kIgnoreObjectSuccess && flags()->verbosity >= 2)
Report("__lsan_ignore_object(): ignoring heap object at %p\n", p);
+#endif // CAN_SANITIZE_LEAKS
}
} // extern "C"
-#endif // CAN_SANITIZE_LEAKS
More information about the llvm-commits
mailing list