[libcxx-commits] [libcxx] [ASan][libc++] String annotations optimizations fix with lambda (PR #76200)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 21 18:26:36 PST 2023


AdvenamTacet wrote:

This does not answer problem of `_LIBCPP_STRING_INTERNAL_MEMORY_ACCESS` not working inside comma constructors and therefore we have additional write to shadow memory while using ASan. That's a small cost, which I think we can ignore.

Alternative is a function like that:
```cpp
  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
  __compressed_pair<__rep, allocator_type> && __compressed_pair_id(basic_string &__str) {
    if (!__str.__is_long())
      __str.__annotate_delete();
    return std::move(__str.__r_);
  }

```

But I support lambda solution.

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


More information about the libcxx-commits mailing list