[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
Wed Aug 27 12:22:44 PDT 2025


================
@@ -820,6 +820,26 @@ class vector {
   __add_alignment_assumption(_Ptr __p) _NOEXCEPT {
     return __p;
   }
+
+  template <template <class, class, class> class _Layout>
+  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+  __swap_layouts(__split_buffer<_Tp, allocator_type&, _Layout>& __v) {
+    auto __begin    = __begin_;
+    auto __sentinel = __end_;
+    auto __cap      = __cap_;
+
+    auto __v_begin    = __v.begin();
+    auto __v_sentinel = __v.__sentinel();
+    auto __v_cap      = __v.__raw_capacity();
+
+    // TODO: replace with __set_valid_range and __set_capacity when vector supports it.
+    __begin_ = __v_begin;
+    __end_   = __v_sentinel;
----------------
ldionne wrote:

This doesn't work in the case of a size-based `split_buffer`, right? Since the sentinel of the split buffer is an integer and the vector's `__end_` is a pointer.

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


More information about the lldb-commits mailing list