diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2025-08-25 17:17:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-25 09:17:55 -0700 |
commit | 20dd053160f7d933037aacb69067ef4d77996ba1 (patch) | |
tree | b36945b09677700c38491ae8b9b51a42f62f250c /lldb/packages/Python/lldbsuite/test | |
parent | 8ab917a241e5b9e153012eef9d76519c6eab9526 (diff) | |
download | llvm-20dd053160f7d933037aacb69067ef4d77996ba1.zip llvm-20dd053160f7d933037aacb69067ef4d77996ba1.tar.gz llvm-20dd053160f7d933037aacb69067ef4d77996ba1.tar.bz2 |
[lldb][DataFormatters] Support newer _LIBCPP_COMPRESSED_PAIR layout (#155153)
Starting with https://github.com/llvm/llvm-project/pull/154686 the
compressed_pair children are now wrapped in an anonymous structure.
This patch adjusts the LLDB data-formatters to support that.
Outstanding questions:
1. Should GetChildMemberWithName look through anonymous structures? That
will break users most likely. But maybe introducing a new API is worth
it? Then we wouldnt have to do this awkward passing around of
`anon_struct_index`
2. Do we support the layout without the anonymous structure? It's not
too much added complexity. And we did release that version of libc++, so
there is code out there compiled against it. But there is no great way
of testing it (some of our macOS matrix bots do test it i suppose, but
not in a targeted way). We have the layout "simulator" tests for some of
the STL types which I will adjust.
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h index 491acb5..a1aa7e1 100644 --- a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h +++ b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h @@ -8,7 +8,9 @@ // 0 -> Post-c88580c layout // 1 -> Post-27c83382d83dc layout // 2 -> Post-769c42f4a552a layout -// 3 -> padding-less no_unique_address-based layout (introduced in 27c83382d83dc) +// 3 -> Post-f5e687d7bf49c layout +// 4 -> padding-less no_unique_address-based layout (introduced in +// 27c83382d83dc) namespace std { namespace __lldb { @@ -42,7 +44,7 @@ template <class _ToPad> class __compressed_pair_padding { ? 0 : sizeof(_ToPad) - __datasizeof_v<_ToPad>]; }; -#elif COMPRESSED_PAIR_REV > 1 && COMPRESSED_PAIR_REV < 3 +#elif COMPRESSED_PAIR_REV > 1 && COMPRESSED_PAIR_REV < 4 template <class _ToPad> inline const bool __is_reference_or_unpadded_object = (std::is_empty<_ToPad>::value && !__lldb_is_final<_ToPad>::value) || @@ -125,6 +127,27 @@ public: _LLDB_NO_UNIQUE_ADDRESS T3 Initializer3; \ _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding<T3> __padding3_; #elif COMPRESSED_PAIR_REV == 3 +#define _LLDB_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \ + struct { \ + [[__gnu__::__aligned__( \ + alignof(T2))]] _LLDB_NO_UNIQUE_ADDRESS T1 Initializer1; \ + _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding<T1> __padding1_; \ + _LLDB_NO_UNIQUE_ADDRESS T2 Initializer2; \ + _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding<T2> __padding2_; \ + } + +#define _LLDB_COMPRESSED_TRIPLE(T1, Initializer1, T2, Initializer2, T3, \ + Initializer3) \ + struct { \ + [[using __gnu__: __aligned__(alignof(T2)), \ + __aligned__(alignof(T3))]] _LLDB_NO_UNIQUE_ADDRESS T1 Initializer1; \ + _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding<T1> __padding1_; \ + _LLDB_NO_UNIQUE_ADDRESS T2 Initializer2; \ + _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding<T2> __padding2_; \ + _LLDB_NO_UNIQUE_ADDRESS T3 Initializer3; \ + _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding<T3> __padding3_; \ + } +#elif COMPRESSED_PAIR_REV == 4 #define _LLDB_COMPRESSED_PAIR(T1, Name1, T2, Name2) \ _LLDB_NO_UNIQUE_ADDRESS T1 Name1; \ _LLDB_NO_UNIQUE_ADDRESS T2 Name2 |