================ @@ -288,92 +476,82 @@ template <class _Tp, class _Allocator> template <class _ForwardIterator> _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::__construct_at_end_with_size(_ForwardIterator __first, size_type __n) { - _ConstructTransaction __tx(std::addressof(this->__end_), __n); + _ConstructTransaction __tx(this, __data_.end(), __n); for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__first) { - __alloc_traits::construct(__alloc_, std::__to_address(__tx.__pos_), *__first); + __alloc_traits::construct(__data_.__alloc_, std::__to_address(__tx.__pos_), *__first); } } template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 inline void __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) { - while (__begin_ != __new_begin) - __alloc_traits::destroy(__alloc_, std::__to_address(__begin_++)); + pointer __begin = __data_.__begin_; + while (__begin != __new_begin) + __alloc_traits::destroy(__data_.__alloc_, std::__to_address(__begin++)); + __data_.__update_begin(__begin); } template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 inline void __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type) { - __begin_ = __new_begin; + __data_.__update_begin(__new_begin); } template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT { - while (__new_last != __end_) - __alloc_traits::destroy(__alloc_, std::__to_address(--__end_)); -} - -template <class _Tp, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI void -__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT { - __end_ = __new_last; + pointer __end = __data_.end(); + while (__new_last != __end) + __alloc_traits::destroy(__data_.__alloc_, std::__to_address(--__end)); + __data_.__update_sentinel(__end); } template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a) - : __cap_(nullptr), __alloc_(__a) { - if (__cap == 0) { - __first_ = nullptr; - } else { - auto __allocation = std::__allocate_at_least(__alloc_, __cap); - __first_ = __allocation.ptr; - __cap = __allocation.count; + : __data_(__a) { + _LIBCPP_ASSERT(__cap >= __start, "can't have a start point outside the capacity"); ---------------- ldionne wrote:
We strive not to introduce any new uncategorized `_LIBCPP_ASSERT`s. This one should be a `_LIBCPP_ASSERT_INTERNAL`. https://github.com/llvm/llvm-project/pull/139632 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits