================
@@ -105,6 +100,44 @@
lldb_private::formatters::GetSecondValueOfLibCXXCompressedPair(
return value;
}
+std::pair<lldb::ValueObjectSP, bool>
+lldb_private::formatters::GetValueOrOldCompressedPair(
+ ValueObject &obj, size_t anon_struct_idx, llvm::StringRef child_name,
+ llvm::StringRef compressed_pair_name) {
+ auto is_old_compressed_pair = [](ValueObject &pair_obj) -> bool {
+ return isStdTemplate(pair_obj.GetTypeName(), "__compressed_pair");
+ };
+
+ // Try searching the child member in an anonymous structure first.
+ if (auto unwrapped = obj.GetChildAtIndex(anon_struct_idx)) {
+ ValueObjectSP node_sp(obj.GetChildMemberWithName(child_name));
----------------
Michael137 wrote:
Heh good catch. I think `GetChildMemberWithName` gained the ability to handle
fields in anonymous structures around the same time that I landed this.
```
commit 92d3029fa4a9c6ce21c50590e57ae834ae3db3bc
Author: cmtice <[email protected]>
Date: Wed May 7 20:39:37 2025 -0700
[LLDB] Fix GetIndexOfChildMemberWithName to handle anonymous structs.
(#138487)
When handling anonymous structs, GetIndexOfChildMemberWithName needs to
add the number of non-empty base classes to the child index, to get the
actual correct index. It was not doing so. This fixes that.
```
So the anonymous struct unwrapping here is redundant and we can probably remove
the entire branch. We *should* have some coverage for this in our test-suite
https://github.com/llvm/llvm-project/pull/155153
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits