[libcxx-commits] [libcxx] [libc++] Rename __construct_one_at_end to __emplace_back_assume_capacity (PR #132276)

Peng Liu via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 21 13:16:13 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)...);
----------------
winner245 wrote:

I analyzed the ASAN failure. It seems that the failure is caused by omitting an `__annotate_shrink` call when the element construction fails. Previously, `~_ConstructTransaction()` ensured that when construction exception is thrown, this destructor would call `__annotate_shrink(__new_end_ - __v_.__begin_);`. This omission might be the cause of the ASAN failure. 

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


More information about the libcxx-commits mailing list