[libcxx-commits] [libcxx] [ASan][libc++] Update string ASan annotations to Zero-overhead (PR #76165)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 21 10:12:35 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
----------------
ldionne wrote:
```suggestion
# ifndef _LIBCPP_HAS_NO_ASAN
# define _LIBCPP_IF_ASAN() if _LIBCPP_CONSTEXPR (true)
# else
# define _LIBCPP_IF_ASAN() if _LIBCPP_CONSTEXPR (false)
# endif
```
I don't think we need to check for `#ifndef _LIBCPP_IF_ASAN` -- we only do that when we allow macros to be redefined by users.
https://github.com/llvm/llvm-project/pull/76165
More information about the libcxx-commits
mailing list