[PATCH] [lsan] Make __lsan_do_leak_check() honor the detect_leaks flag.

Sergey Matveev earthdok at google.com
Mon Jul 22 04:18:19 PDT 2013


Hi kcc,

http://llvm-reviews.chandlerc.com/D1193

Files:
  lib/asan/asan_rtl.cc
  lib/lsan/lsan.cc
  lib/lsan/lsan_common.cc

Index: lib/asan/asan_rtl.cc
===================================================================
--- lib/asan/asan_rtl.cc
+++ lib/asan/asan_rtl.cc
@@ -566,3 +566,14 @@
     Report("AddressSanitizer Init done\n");
   }
 }
+
+// LSan interface.
+extern "C" {
+SANITIZER_INTERFACE_ATTRIBUTE
+void __lsan_do_leak_check() {
+#if CAN_SANITIZE_LEAKS
+  if (flags()->detect_leaks)
+    __lsan::DoLeakCheck();
+#endif  // CAN_SANITIZE_LEAKS
+}
+}  // extern "C"
Index: lib/lsan/lsan.cc
===================================================================
--- lib/lsan/lsan.cc
+++ lib/lsan/lsan.cc
@@ -62,3 +62,12 @@
 }
 
 }  // namespace __lsan
+
+extern "C" {
+SANITIZER_INTERFACE_ATTRIBUTE
+void __lsan_do_leak_check() {
+#if CAN_SANITIZE_LEAKS
+  __lsan::DoLeakCheck();
+#endif
+}
+}
Index: lib/lsan/lsan_common.cc
===================================================================
--- lib/lsan/lsan_common.cc
+++ lib/lsan/lsan_common.cc
@@ -544,13 +544,6 @@
 #endif
 }
 
-SANITIZER_INTERFACE_ATTRIBUTE
-void __lsan_do_leak_check() {
-#if CAN_SANITIZE_LEAKS
-  __lsan::DoLeakCheck();
-#endif
-}
-
 #if !SANITIZER_SUPPORTS_WEAK_HOOKS
 SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE
 int __lsan_is_turned_off() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1193.1.patch
Type: text/x-patch
Size: 1212 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130722/31a35236/attachment.bin>


More information about the llvm-commits mailing list