Skip to content

Commit a755d83

Browse files
Bump COMPRESSED_PAIR_REV
1 parent 3e8a4bf commit a755d83

File tree

6 files changed

+21
-9
lines changed

6 files changed

+21
-9
lines changed

lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
5858

5959
_T1 &first() { return static_cast<_Base1 &>(*this).__get(); }
6060
};
61-
#elif COMPRESSED_PAIR_REV == 1
61+
#elif COMPRESSED_PAIR_REV == 1 || COMPRESSED_PAIR_REV == 2
6262
// From libc++ datasizeof.h
6363
template <class _Tp> struct _FirstPaddingByte {
6464
_LLDB_NO_UNIQUE_ADDRESS _Tp __v_;
@@ -72,6 +72,16 @@ inline const size_t __datasizeof_v =
7272
template <class _Tp>
7373
struct __lldb_is_final : public integral_constant<bool, __is_final(_Tp)> {};
7474

75+
// The legacy layout has been patched, see
76+
// https://github.com/llvm/llvm-project/pull/142516.
77+
#if COMPRESSED_PAIR_REV == 1
78+
template <class _ToPad> class __compressed_pair_padding {
79+
char __padding_[((is_empty<_ToPad>::value &&
80+
!__lldb_is_final<_ToPad>::value) ||
81+
is_reference<_ToPad>::value)
82+
? 0
83+
: sizeof(_ToPad) - __datasizeof_v<_ToPad>];
84+
#else
7585
template <class _ToPad>
7686
inline const bool __is_reference_or_unpadded_object =
7787
(std::is_empty<_ToPad>::value && !__lldb_is_final<_ToPad>::value) ||
@@ -89,6 +99,7 @@ class __compressed_pair_padding {
8999
};
90100

91101
template <class _ToPad> class __compressed_pair_padding<_ToPad, true> {};
102+
#endif
92103

93104
#define _LLDB_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \
94105
[[__gnu__::__aligned__( \
@@ -106,7 +117,7 @@ template <class _ToPad> class __compressed_pair_padding<_ToPad, true> {};
106117
_LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding<T2> __padding2_; \
107118
_LLDB_NO_UNIQUE_ADDRESS T3 Initializer3; \
108119
_LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding<T3> __padding3_;
109-
#elif COMPRESSED_PAIR_REV == 2
120+
#elif COMPRESSED_PAIR_REV == 3
110121
#define _LLDB_COMPRESSED_PAIR(T1, Name1, T2, Name2) \
111122
_LLDB_NO_UNIQUE_ADDRESS T1 Name1; \
112123
_LLDB_NO_UNIQUE_ADDRESS T2 Name2

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/invalid-vector/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define COMPRESSED_PAIR_REV 2
1+
#define COMPRESSED_PAIR_REV 3
22
#include <libcxx-simulators-common/compressed_pair.h>
33

44
namespace std {

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _run_test(self, defines):
2828

2929
for v in [None, "ALTERNATE_LAYOUT"]:
3030
for r in range(6):
31-
for c in range(3):
31+
for c in range(4):
3232
name = "test_r%d_c%d" % (r, c)
3333
defines = ["REVISION=%d" % r, "COMPRESSED_PAIR_REV=%d" % c]
3434
if v:

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,22 +209,22 @@ template <class _CharT, class _Traits, class _Allocator> class basic_string {
209209
__long &getLongRep() {
210210
#if COMPRESSED_PAIR_REV == 0
211211
return __r_.first().__l;
212-
#elif COMPRESSED_PAIR_REV <= 2
212+
#elif COMPRESSED_PAIR_REV <= 3
213213
return __rep_.__l;
214214
#endif
215215
}
216216

217217
__short &getShortRep() {
218218
#if COMPRESSED_PAIR_REV == 0
219219
return __r_.first().__s;
220-
#elif COMPRESSED_PAIR_REV <= 2
220+
#elif COMPRESSED_PAIR_REV <= 3
221221
return __rep_.__s;
222222
#endif
223223
}
224224

225225
#if COMPRESSED_PAIR_REV == 0
226226
std::__lldb::__compressed_pair<__rep, allocator_type> __r_;
227-
#elif COMPRESSED_PAIR_REV <= 2
227+
#elif COMPRESSED_PAIR_REV <= 3
228228
_LLDB_COMPRESSED_PAIR(__rep, __rep_, allocator_type, __alloc_);
229229
#endif
230230

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/unique_ptr/TestDataFormatterLibcxxUniquePtrSimulator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _run_test(self, defines):
2626
)
2727

2828

29-
for r in range(3):
29+
for r in range(4):
3030
name = "test_r%d" % r
3131
defines = ["COMPRESSED_PAIR_REV=%d" % r]
3232

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/unique_ptr/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ template <class _Tp, class _Dp = default_delete<_Tp>> class unique_ptr {
2020
std::__lldb::__compressed_pair<pointer, deleter_type> __ptr_;
2121
explicit unique_ptr(pointer __p) noexcept
2222
: __ptr_(__p, std::__lldb::__value_init_tag()) {}
23-
#elif COMPRESSED_PAIR_REV == 1 || COMPRESSED_PAIR_REV == 2
23+
#elif COMPRESSED_PAIR_REV == 1 || COMPRESSED_PAIR_REV == 2 || \
24+
COMPRESSED_PAIR_REV == 3
2425
_LLDB_COMPRESSED_PAIR(pointer, __ptr_, deleter_type, __deleter_);
2526
explicit unique_ptr(pointer __p) noexcept : __ptr_(__p), __deleter_() {}
2627
#endif

0 commit comments

Comments
 (0)