[libcxx-commits] [libcxx] [libc++] Rename __construct_one_at_end to __emplace_back_assume_capacity (PR #132276)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 24 10:12:54 PDT 2025
================
@@ -1152,7 +1156,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline
vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
pointer __end = this->__end_;
if (__end < this->__cap_) {
- __construct_one_at_end(std::forward<_Args>(__args)...);
+ __emplace_back_assume_capacity(std::forward<_Args>(__args)...);
----------------
ldionne wrote:
Thanks for taking a look! What seems to be actually happening is that if we fail to `__annotate_increase(1)` *before* we use `construct_at`, Asan thinks that we're writing outside of the container and complains. So we need to use `__annotate_increase` upon entry and then to use `__anotate_shrink` if the operation failed.
I'll return to the original implementation for now, but I still think the name change is an improvement.
https://github.com/llvm/llvm-project/pull/132276
More information about the libcxx-commits
mailing list