[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:45 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_;
----------------
ldionne wrote:

Can we use this naming instead for local variables?

```
auto __vector_begin = __begin_;
auto __vector_sentinel = __end_;
auto __vector_cap = __cap_;

auto __buffer_begin = __v.begin();
auto __buffer_sentinel = __v.__sentinel();
auot __buffer_cap = __v.__raw_capacity();

__begin_ = __buffer_begin;
__end_ = __buffer_sentinel;
__cap_ = __buffer_cap;

__v.__set_valid_range(__vector_begin, __vector_sentinel);
__v.__set_capacity(__vector_cap);
```

Right now the names are very subtle, if you miss e.g. `__begin_` vs `__begin` then you'd think the code is incorrect.

Also, I know `__v` is used quite a bit for the name of the split buffer, but I think it can be somewhat confusing. I'd suggest renaming to `__sb` or similar (not throughout, but just within this function since you're introducing it from scratch).

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


More information about the lldb-commits mailing list