[Lldb-commits] [libcxx] [lldb] [libcxx] adds size-based `__split_buffer` representation to unstable ABI (PR #139632)

Louis Dionne via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 26 12:05:43 PDT 2025


================
@@ -431,52 +599,61 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fi
 template <class _Tp, class _Allocator>
 template <class... _Args>
 _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_front(_Args&&... __args) {
-  if (__begin_ == __first_) {
-    if (__end_ < __cap_) {
-      difference_type __d = __cap_ - __end_;
+  if (__data_.__begin_ == __data_.__first_) {
+    pointer __end = __data_.end();
+    if (__data_.__front_spare() != 0) {
+      difference_type __d = __data_.__back_spare();
       __d                 = (__d + 1) / 2;
-      __begin_            = std::move_backward(__begin_, __end_, __end_ + __d);
-      __end_ += __d;
+      __data_.__begin_    = std::move_backward(__data_.__begin_, __end, __end + __d);
+#ifdef _LIBCPP_ABI_SIZE_BASED_CONTAINERS
+      // TODO: explain why there isn't a size-based analogue
+#else
+      __data_.__end_ += __d;
+#endif
----------------
ldionne wrote:

I don't understand why we wouldn't want to update the end here. Not updating end feels like a bug to me. Can you please explain why we don't want to do it?

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


More information about the lldb-commits mailing list