[libcxx-commits] [libcxx] [llvm] [libcxx][lldb] Add initial LLDB data-formatters (PR #187677)

Dave Lee via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 20 09:24:12 PDT 2026


================
@@ -0,0 +1,263 @@
+"""
+Python LLDB data formatter for libc++ std::vector
+
+1-to-1 translation from the LLDB builtin std::vector formatter.
+
+Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+See https://llvm.org/LICENSE.txt for license information.
+SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+"""
+
+import lldb
+
+
+def get_data_pointer(root):
+    """Get the data pointer from a vector, handling compressed pair layout."""
+    # Try new layout
+    cap_sp = root.GetChildMemberWithName("__cap_")
+    if cap_sp and cap_sp.IsValid():
----------------
kastiglione wrote:

```suggestion
    if cap_sp:
```

An `IsValid()` check happens within this expression.

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


More information about the libcxx-commits mailing list