mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 06:26:08 +00:00
Reland "[lldb][test] TestDataFormatterLibcxxStringSimulator.py: add new padding layout" (#111123)
Relands https://github.com/llvm/llvm-project/pull/108375 which had to be reverted because it was failing on the Windows buildbot. Trying to reland this with `msvc::no_unique_address` on Windows.
This commit is contained in:
parent
74a98fdbc4
commit
d148548779
@ -7,6 +7,12 @@
|
||||
namespace std {
|
||||
namespace __lldb {
|
||||
|
||||
#if __has_cpp_attribute(msvc::no_unique_address)
|
||||
#define _LLDB_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
|
||||
#elif __has_cpp_attribute(no_unique_address)
|
||||
#define _LLDB_NO_UNIQUE_ADDRESS [[__no_unique_address__]]
|
||||
#endif
|
||||
|
||||
#if COMPRESSED_PAIR_REV == 0 // Post-c88580c layout
|
||||
struct __value_init_tag {};
|
||||
struct __default_init_tag {};
|
||||
@ -55,7 +61,7 @@ public:
|
||||
#elif COMPRESSED_PAIR_REV == 1
|
||||
// From libc++ datasizeof.h
|
||||
template <class _Tp> struct _FirstPaddingByte {
|
||||
[[no_unique_address]] _Tp __v_;
|
||||
_LLDB_NO_UNIQUE_ADDRESS _Tp __v_;
|
||||
char __first_padding_byte_;
|
||||
};
|
||||
|
||||
@ -75,29 +81,30 @@ template <class _ToPad> class __compressed_pair_padding {
|
||||
};
|
||||
|
||||
#define _LLDB_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \
|
||||
[[__gnu__::__aligned__(alignof(T2))]] [[no_unique_address]] T1 Initializer1; \
|
||||
[[no_unique_address]] __compressed_pair_padding<T1> __padding1_; \
|
||||
[[no_unique_address]] T2 Initializer2; \
|
||||
[[no_unique_address]] __compressed_pair_padding<T2> __padding2_;
|
||||
[[__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) \
|
||||
[[using __gnu__: __aligned__(alignof(T2)), \
|
||||
__aligned__(alignof(T3))]] [[no_unique_address]] T1 Initializer1; \
|
||||
[[no_unique_address]] __compressed_pair_padding<T1> __padding1_; \
|
||||
[[no_unique_address]] T2 Initializer2; \
|
||||
[[no_unique_address]] __compressed_pair_padding<T2> __padding2_; \
|
||||
[[no_unique_address]] T3 Initializer3; \
|
||||
[[no_unique_address]] __compressed_pair_padding<T3> __padding3_;
|
||||
__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 == 2
|
||||
#define _LLDB_COMPRESSED_PAIR(T1, Name1, T2, Name2) \
|
||||
[[no_unique_address]] T1 Name1; \
|
||||
[[no_unique_address]] T2 Name2
|
||||
_LLDB_NO_UNIQUE_ADDRESS T1 Name1; \
|
||||
_LLDB_NO_UNIQUE_ADDRESS T2 Name2
|
||||
|
||||
#define _LLDB_COMPRESSED_TRIPLE(T1, Name1, T2, Name2, T3, Name3) \
|
||||
[[no_unique_address]] T1 Name1; \
|
||||
[[no_unique_address]] T2 Name2; \
|
||||
[[no_unique_address]] T3 Name3
|
||||
_LLDB_NO_UNIQUE_ADDRESS T1 Name1; \
|
||||
_LLDB_NO_UNIQUE_ADDRESS T2 Name2; \
|
||||
_LLDB_NO_UNIQUE_ADDRESS T3 Name3
|
||||
#endif
|
||||
} // namespace __lldb
|
||||
} // namespace std
|
||||
|
@ -27,7 +27,7 @@ class LibcxxStringDataFormatterSimulatorTestCase(TestBase):
|
||||
|
||||
|
||||
for v in [None, "ALTERNATE_LAYOUT"]:
|
||||
for r in range(5):
|
||||
for r in range(6):
|
||||
for c in range(3):
|
||||
name = "test_r%d_c%d" % (r, c)
|
||||
defines = ["REVISION=%d" % r, "COMPRESSED_PAIR_REV=%d" % c]
|
||||
|
@ -20,7 +20,11 @@
|
||||
// Pre-D128285 layout.
|
||||
#define PACKED_ANON_STRUCT
|
||||
#endif
|
||||
// REVISION == 4: current layout
|
||||
#if REVISION <= 4
|
||||
// Pre-2a1ef74 layout.
|
||||
#define NON_STANDARD_PADDING
|
||||
#endif
|
||||
// REVISION == 5: current layout
|
||||
|
||||
#ifdef PACKED_ANON_STRUCT
|
||||
#define BEGIN_PACKED_ANON_STRUCT struct __attribute__((packed)) {
|
||||
@ -34,6 +38,7 @@
|
||||
namespace std {
|
||||
namespace __lldb {
|
||||
|
||||
#ifdef NON_STANDARD_PADDING
|
||||
#if defined(ALTERNATE_LAYOUT) && defined(SUBCLASS_PADDING)
|
||||
template <class _CharT, size_t = sizeof(_CharT)> struct __padding {
|
||||
unsigned char __xx[sizeof(_CharT) - 1];
|
||||
@ -41,6 +46,13 @@ template <class _CharT, size_t = sizeof(_CharT)> struct __padding {
|
||||
|
||||
template <class _CharT> struct __padding<_CharT, 1> {};
|
||||
#endif
|
||||
#else // !NON_STANDARD_PADDING
|
||||
template <size_t _PaddingSize> struct __padding {
|
||||
char __padding_[_PaddingSize];
|
||||
};
|
||||
|
||||
template <> struct __padding<0> {};
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator> class basic_string {
|
||||
public:
|
||||
@ -77,7 +89,12 @@ public:
|
||||
};
|
||||
#else // !SUBCLASS_PADDING
|
||||
|
||||
#ifdef NON_STANDARD_PADDING
|
||||
unsigned char __padding[sizeof(value_type) - 1];
|
||||
#else
|
||||
_LLDB_NO_UNIQUE_ADDRESS __padding<sizeof(value_type) - 1> __padding_;
|
||||
#endif
|
||||
|
||||
#ifdef BITMASKS
|
||||
unsigned char __size_;
|
||||
#else // !BITMASKS
|
||||
@ -129,21 +146,26 @@ public:
|
||||
union {
|
||||
#ifdef BITMASKS
|
||||
unsigned char __size_;
|
||||
#else
|
||||
#else // !BITMASKS
|
||||
struct {
|
||||
unsigned char __is_long_ : 1;
|
||||
unsigned char __size_ : 7;
|
||||
};
|
||||
#endif
|
||||
#endif // BITMASKS
|
||||
value_type __lx;
|
||||
};
|
||||
#else
|
||||
#else // !SHORT_UNION
|
||||
BEGIN_PACKED_ANON_STRUCT
|
||||
unsigned char __is_long_ : 1;
|
||||
unsigned char __size_ : 7;
|
||||
END_PACKED_ANON_STRUCT
|
||||
char __padding_[sizeof(value_type) - 1];
|
||||
#endif
|
||||
#ifdef NON_STANDARD_PADDING
|
||||
unsigned char __padding[sizeof(value_type) - 1];
|
||||
#else // !NON_STANDARD_PADDING
|
||||
_LLDB_NO_UNIQUE_ADDRESS __padding<sizeof(value_type) - 1> __padding_;
|
||||
#endif // NON_STANDARD_PADDING
|
||||
|
||||
#endif // SHORT_UNION
|
||||
value_type __data_[__min_cap];
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user