[Lldb-commits] [lldb] [lldb][DataFormatters] Support newer _LIBCPP_COMPRESSED_PAIR layout (PR #155153)
@@ -105,6 +100,44 @@
lldb_private::formatters::GetSecondValueOfLibCXXCompressedPair(
return value;
}
+std::pair
+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:
Thanks for bringing this to my attention. PR:
https://github.com/llvm/llvm-project/pull/175564
https://github.com/llvm/llvm-project/pull/155153
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatters] Support newer _LIBCPP_COMPRESSED_PAIR layout (PR #155153)
@@ -105,6 +100,44 @@
lldb_private::formatters::GetSecondValueOfLibCXXCompressedPair(
return value;
}
+std::pair
+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
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
[Lldb-commits] [lldb] [lldb][DataFormatters] Support newer _LIBCPP_COMPRESSED_PAIR layout (PR #155153)
@@ -105,6 +100,44 @@
lldb_private::formatters::GetSecondValueOfLibCXXCompressedPair(
return value;
}
+std::pair
+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));
nd-work wrote:
@Michael137 shouldn't unwrapped be used inside the if body?
https://github.com/llvm/llvm-project/pull/155153
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatters] Support newer _LIBCPP_COMPRESSED_PAIR layout (PR #155153)
https://github.com/adrian-prantl closed https://github.com/llvm/llvm-project/pull/155153 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatters] Support newer _LIBCPP_COMPRESSED_PAIR layout (PR #155153)
https://github.com/adrian-prantl approved this pull request. https://github.com/llvm/llvm-project/pull/155153 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatters] Support newer _LIBCPP_COMPRESSED_PAIR layout (PR #155153)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/155153 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
