[Lldb-commits] [lldb] [lldb][test] Synchronize `__compressed_pair_padding` with libc++ (PR #142516)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 3 02:23:59 PDT 2025
================
@@ -72,14 +72,24 @@ inline const size_t __datasizeof_v =
template <class _Tp>
struct __lldb_is_final : public integral_constant<bool, __is_final(_Tp)> {};
-template <class _ToPad> class __compressed_pair_padding {
- char __padding_[((is_empty<_ToPad>::value &&
- !__lldb_is_final<_ToPad>::value) ||
- is_reference<_ToPad>::value)
- ? 0
- : sizeof(_ToPad) - __datasizeof_v<_ToPad>];
+template <class _ToPad>
+inline const bool __is_reference_or_unpadded_object =
+ (std::is_empty<_ToPad>::value && !__lldb_is_final<_ToPad>::value) ||
+ sizeof(_ToPad) == __datasizeof_v<_ToPad>;
+
+template <class _Tp>
+inline const bool __is_reference_or_unpadded_object<_Tp &> = true;
+
+template <class _Tp>
+inline const bool __is_reference_or_unpadded_object<_Tp &&> = true;
+
+template <class _ToPad, bool _Empty = __is_reference_or_unpadded_object<_ToPad>>
+class __compressed_pair_padding {
+ char __padding_[sizeof(_ToPad) - __datasizeof_v<_ToPad>] = {};
};
+template <class _ToPad> class __compressed_pair_padding<_ToPad, true> {};
----------------
Michael137 wrote:
Thanks for keeping this in sync! What we would usually do with these simulators is to add the new implementation behind a `ifdef COMPRESSED_PAIR_REV == <new version>`. To make sure we don't regress users still on the older layout. Do you mind doing that? If it's too finicky I'm happy to give it a shot
https://github.com/llvm/llvm-project/pull/142516
More information about the lldb-commits
mailing list