Define a new macro in libc++ named '_LIBCPP_HAS_NO_ASAN'. When this is defined,
libc++ will not call address_sanitizer to detect addressing errors in the
standard library containers. This is a negative macro to enable users to
disable the libc++ checks even if they are compiling with address sanitizer
enabled by defining this macro.
At the present time, there is no code in libc++ that looks at this macro.
That will come soon. This is just infrastructure.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@206184 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__config b/include/__config
index 33254e9..fb775c6 100644
--- a/include/__config
+++ b/include/__config
@@ -352,6 +352,10 @@
}
}
+#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
+#define _LIBCPP_HAS_NO_ASAN
+#endif
+
#elif defined(__GNUC__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
@@ -426,6 +430,10 @@
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}
+#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
+#define _LIBCPP_HAS_NO_ASAN
+#endif
+
#elif defined(_LIBCPP_MSVC)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -451,6 +459,8 @@
namespace std {
}
+#define _LIBCPP_HAS_NO_ASAN
+
#elif defined(__IBMCPP__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
@@ -483,6 +493,8 @@
}
}
+#define _LIBCPP_HAS_NO_ASAN
+
#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS