[PATCH] D32191: Enable lsan by default on 64-bit darwin, and enable lsan test suite

Francis Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 14:24:06 PDT 2017


fjricci created this revision.
Herald added a subscriber: mgorny.

https://reviews.llvm.org/D32191

Files:
  cmake/config-ix.cmake
  lib/sanitizer_common/sanitizer_flags.inc
  test/asan/lit.cfg
  test/lsan/lit.common.cfg


Index: test/lsan/lit.common.cfg
===================================================================
--- test/lsan/lit.common.cfg
+++ test/lsan/lit.common.cfg
@@ -75,4 +75,8 @@
 if re.search('mthumb', config.target_cflags) is not None:
   config.unsupported = True
 
+# LeakSanitizer tests are supported on 64-bit Darwin
+if config.host_os is 'Darwin' and config.target_arch is 'x86_64':
+  config.unsupported = False
+
 config.suffixes = ['.c', '.cc', '.cpp']
Index: test/asan/lit.cfg
===================================================================
--- test/asan/lit.cfg
+++ test/asan/lit.cfg
@@ -217,7 +217,8 @@
   config.available_features.add('fast-unwinder-works')
 
 # Turn on leak detection on 64-bit Linux.
-if config.host_os == 'Linux' and (config.target_arch == 'x86_64' or config.target_arch == 'i386'):
+if ((config.host_os == 'Linux') and (config.target_arch == 'x86_64' or config.target_arch == 'i386')) \
+  or ((config.host_os == 'Darwin') and (config.target_arch == 'x86_64')):
   config.available_features.add('leak-detection')
 
 # Set LD_LIBRARY_PATH to pick dynamic runtime up properly.
Index: lib/sanitizer_common/sanitizer_flags.inc
===================================================================
--- lib/sanitizer_common/sanitizer_flags.inc
+++ lib/sanitizer_common/sanitizer_flags.inc
@@ -62,7 +62,8 @@
 COMMON_FLAG(
     int, verbosity, 0,
     "Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output).")
-COMMON_FLAG(bool, detect_leaks, !SANITIZER_MAC, "Enable memory leak detection.")
+COMMON_FLAG(bool, detect_leaks, !(SANITIZER_MAC && SANITIZER_WORDSIZE == 32),
+            "Enable memory leak detection.")
 COMMON_FLAG(
     bool, leak_check_at_exit, true,
     "Invoke leak checking in an atexit handler. Has no effect if "
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -476,7 +476,7 @@
 endif()
 
 if (COMPILER_RT_HAS_SANITIZER_COMMON AND LSAN_SUPPORTED_ARCH AND
-    OS_NAME MATCHES "Linux|FreeBSD")
+    OS_NAME MATCHES "Darwin|Linux|FreeBSD")
   set(COMPILER_RT_HAS_LSAN TRUE)
 else()
   set(COMPILER_RT_HAS_LSAN FALSE)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32191.95631.patch
Type: text/x-patch
Size: 2182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170418/e5920e5a/attachment.bin>


More information about the llvm-commits mailing list