Why does Xcode define _LIBCPP_HAS_NO_ASAN when enabling address sanitizer?

Turning on address sanitizer in Xcode 7 passes the compile and linker flag -fsanitize=address and also defines _LIBCPP_HAS_NO_ASAN.

When building my library from the command line and running tests on a sanitized build without defining _LIBCPP_HAS_NO_ASAN I see non-repeatable address-sanitizer-reported memory access issues. Defining _LIBCPP_HAS_NO_ASAN, as Xcode does, gets rid of the sanitizer issues but I’m curious as to why it needs doing.

Why do I need to define _LIBCPP_HAS_NO_ASAN with AppleClang7 to avoid getting memory access issues in libcxx?

Regards,

Jon

I believe it was as a result of this thread:
<http://lists.apple.com/archives/xcode-users/2016/Jan/msg00076.html&gt;

That is: otherwise you'd get false positives if you linked to some C++ libs not themselves built with ASan. As of Xcode 7.3 there is the CLANG_ADDRESS_SANITIZER_CONTAINER_OVERFLOW build option.

Cheers,