================
@@ -126,40 +128,50 @@
lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::GetChildAtIndex(
m_element_type);
}
-static ValueObjectSP GetDataPointer(ValueObject &root) {
- auto [cap_sp, is_compressed_pair] =
- GetValueOrOldCompressedPair(root, "__cap_", "__end_cap_");
- if (!cap_sp)
- return nullptr;
-
- if (is_compressed_pair)
- return GetFirstValueOfLibCXXCompressedPair(*cap_sp);
-
- return cap_sp;
-}
-
lldb::ChildCacheState
lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() {
m_start = m_finish = nullptr;
- ValueObjectSP data_sp(GetDataPointer(m_backend));
- if (!data_sp)
+ // Determine if this version of libc++'s `std::vector` uses
`__vector_layout`.
+ ValueObjectSP layout_sp = m_backend.GetChildMemberWithName("__layout_");
+ ValueObject *target = layout_sp ? layout_sp.get() : &m_backend;
+
+ ValueObjectSP begin_sp = target->GetChildMemberWithName("__begin_");
+ if (!begin_sp)
return lldb::ChildCacheState::eRefetch;
- m_element_type = data_sp->GetCompilerType().GetPointeeType();
+ m_element_type = begin_sp->GetCompilerType().GetPointeeType();
----------------
Michael137 wrote:
Can we add some tests to confirm that this works with the old-style
compressed-pair (before the `no_unique_address` refactor)
https://github.com/llvm/llvm-project/pull/202438
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits