[libcxx-commits] [libcxx] [ASan][libc++] Update string ASan annotations to Zero-overhead (PR #76165)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 21 11:39:55 PST 2023


================
@@ -1490,6 +1490,16 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
 #    define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
 #  endif
 
+// ASan related macros
+// _LIBCPP_IF_ASAN is used to removed ASan related code, whenever compiled without ASan.
+#ifndef _LIBCPP_IF_ASAN
+#  ifndef _LIBCPP_HAS_NO_ASAN
+#    define _LIBCPP_IF_ASAN() if _LIBCPP_CONSTEXPR (true)
+#  else
+#    define _LIBCPP_IF_ASAN() if _LIBCPP_CONSTEXPR (false)
+#  endif
+#endif
----------------
EricWF wrote:

We should gaurd this with `_LIBCPP_INSTRUCTMENTED_WITH_ASAN` too since the underlying calls to asan's runtime only occur if that's the case. So no point turning this on otherwise.

https://github.com/llvm/llvm-project/pull/76165


More information about the libcxx-commits mailing list