|
7 | 7 | namespace std {
|
8 | 8 | namespace __lldb {
|
9 | 9 |
|
10 |
| -// Post-c88580c layout |
| 10 | +#if COMPRESSED_PAIR_REV == 0 // Post-c88580c layout |
11 | 11 | struct __value_init_tag {};
|
12 | 12 | struct __default_init_tag {};
|
13 | 13 |
|
@@ -52,6 +52,53 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
|
52 | 52 |
|
53 | 53 | _T1 &first() { return static_cast<_Base1 &>(*this).__get(); }
|
54 | 54 | };
|
| 55 | +#elif COMPRESSED_PAIR_REV == 1 |
| 56 | +// From libc++ datasizeof.h |
| 57 | +template <class _Tp> struct _FirstPaddingByte { |
| 58 | + [[no_unique_address]] _Tp __v_; |
| 59 | + char __first_padding_byte_; |
| 60 | +}; |
| 61 | + |
| 62 | +template <class _Tp> |
| 63 | +inline const size_t __datasizeof_v = |
| 64 | + __builtin_offsetof(_FirstPaddingByte<_Tp>, __first_padding_byte_); |
| 65 | + |
| 66 | +template <class _Tp> |
| 67 | +struct __lldb_is_final : public integral_constant<bool, __is_final(_Tp)> {}; |
| 68 | + |
| 69 | +template <class _ToPad> class __compressed_pair_padding { |
| 70 | + char __padding_[((is_empty<_ToPad>::value && |
| 71 | + !__lldb_is_final<_ToPad>::value) || |
| 72 | + is_reference<_ToPad>::value) |
| 73 | + ? 0 |
| 74 | + : sizeof(_ToPad) - __datasizeof_v<_ToPad>]; |
| 75 | +}; |
| 76 | + |
| 77 | +#define _LLDB_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \ |
| 78 | + [[__gnu__::__aligned__(alignof(T2))]] [[no_unique_address]] T1 Initializer1; \ |
| 79 | + [[no_unique_address]] __compressed_pair_padding<T1> __padding1_; \ |
| 80 | + [[no_unique_address]] T2 Initializer2; \ |
| 81 | + [[no_unique_address]] __compressed_pair_padding<T2> __padding2_; |
| 82 | + |
| 83 | +#define _LLDB_COMPRESSED_TRIPLE(T1, Initializer1, T2, Initializer2, T3, \ |
| 84 | + Initializer3) \ |
| 85 | + [[using __gnu__: __aligned__(alignof(T2)), \ |
| 86 | + __aligned__(alignof(T3))]] [[no_unique_address]] T1 Initializer1; \ |
| 87 | + [[no_unique_address]] __compressed_pair_padding<T1> __padding1_; \ |
| 88 | + [[no_unique_address]] T2 Initializer2; \ |
| 89 | + [[no_unique_address]] __compressed_pair_padding<T2> __padding2_; \ |
| 90 | + [[no_unique_address]] T3 Initializer3; \ |
| 91 | + [[no_unique_address]] __compressed_pair_padding<T3> __padding3_; |
| 92 | +#elif COMPRESSED_PAIR_REV == 2 |
| 93 | +#define _LLDB_COMPRESSED_PAIR(T1, Name1, T2, Name2) \ |
| 94 | + [[no_unique_address]] T1 Name1; \ |
| 95 | + [[no_unique_address]] T2 Name2 |
| 96 | + |
| 97 | +#define _LLDB_COMPRESSED_TRIPLE(T1, Name1, T2, Name2, T3, Name3) \ |
| 98 | + [[no_unique_address]] T1 Name1; \ |
| 99 | + [[no_unique_address]] T2 Name2; \ |
| 100 | + [[no_unique_address]] T3 Name3 |
| 101 | +#endif |
55 | 102 | } // namespace __lldb
|
56 | 103 | } // namespace std
|
57 | 104 |
|
|
0 commit comments