[libcxx-commits] [libcxx] [ASan][libc++] Annotating `std::basic_string` with all allocators (PR #75845)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 19 17:22:02 PST 2023
================
@@ -1891,8 +1891,7 @@ private:
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
const void* __begin = data();
const void* __end = data() + capacity() + 1;
- if (!__libcpp_is_constant_evaluated() && __begin != nullptr &&
- is_same<allocator_type, __default_allocator_type>::value)
+ if (!__libcpp_is_constant_evaluated() && __asan_annotate_container_with_allocator<allocator_type>::value)
----------------
AdvenamTacet wrote:
In your example, the string is short (btw. the default allocator is also used), and until https://github.com/llvm/llvm-project/pull/75882 annotations for SSO cases are turned off. But even if you turn them on (change value of `_LIBCPP_SHORT_STRING_ANNOTATIONS_ALLOWED` to true) it works as expected. Constant evaluated objects are not annotated, runtime objects are annotated. s2 is annotated when it's created.
s is probably not annotated, but it's ok, it may only lead to false negatives. I will investigate it before merge of short string annotations, but it shouldn't affect this PR.
No boom is expected. No boom happens.
https://github.com/llvm/llvm-project/pull/75845
More information about the libcxx-commits
mailing list