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) Index: test/asan/lit.cfg =================================================================== --- test/asan/lit.cfg +++ test/asan/lit.cfg @@ -38,6 +38,11 @@ # Also, make sure we do not overwhelm the syslog while testing. default_asan_opts = 'abort_on_error=0' default_asan_opts += ':log_to_syslog=0' + + # On Darwin, leak checking is not enabled by default. Enable for x86_64 + # tests to prevent regressions + if config.target_arch == 'x86_64': + default_asan_opts += ':detect_leaks=1' elif config.android: # The same as on Darwin, we default to "abort_on_error=1" which slows down # testing. Also, all existing tests are using "not" instead of "not --crash" @@ -217,7 +222,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: test/lsan/lit.common.cfg =================================================================== --- test/lsan/lit.common.cfg +++ test/lsan/lit.common.cfg @@ -67,8 +67,9 @@ config.substitutions.append( ("%clang_lsan ", build_invocation(clang_lsan_cflags)) ) config.substitutions.append( ("%clangxx_lsan ", build_invocation(clang_lsan_cxxflags)) ) -# LeakSanitizer tests are currently supported on x86-64 Linux, arm Linux and mips64 Linux only. -if config.host_os not in ['Linux'] or config.host_arch not in ['x86_64', 'mips64', 'arm', 'armhf', 'armv7l']: +# LeakSanitizer tests are currently supported on x86-64 Linux, arm Linux, mips64 Linux, and x86_64 Darwin +if (config.host_os not in ['Linux'] or config.host_arch not in ['x86_64', 'mips64', 'arm', 'armhf', 'armv7l']) + and (config.host_os is not 'Darwin' or config.target_arch is not 'x86_64'): config.unsupported = True # Don't support Thumb due to broken fast unwinder