[Lldb-commits] [lldb] Teach LLDB's pretty-printer about libc++'s various `std::vector` layouts (PR #202438)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 10 02:23:16 PDT 2026


================
@@ -0,0 +1,70 @@
+#include <stddef.h>
+
+namespace std {
+inline namespace __LegacyLayout {
+template <typename T> class vector {
+public:
+  typedef T *pointer;
+
+  vector(pointer begin, size_t size) : __begin_(begin), __end_(begin + size) {}
+
+private:
+  pointer __begin_;
+  pointer __end_;
+  // __cap_ and __alloc_ aren't used, so they've been removed for simplicity.
----------------
Michael137 wrote:

> If that's the case, would you be okay with me adding a dedicated [[no_unique_address]] test instead?

There's already `no_unique_address` tests for the other STL containers (and also dedicated ones in the API test suite). So there's no need for special testing of this.

I just wanted the `LegacyLayout` to reflect the layout that `std::vector` used to have. For documentation/consistency purposes. I understand that the class itself is a minimally stripped version of the old layout, but with all the other simulator tests we copy all the members over. I like doing that because it accurately gives us an audit trail of how the layout changed over time without having to trawl through the libc++ git log.

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


More information about the lldb-commits mailing list