Skip to content

Commit

Permalink
[lldb][test] TestDataFormatterLibcxxStringSimulator.py: add new paddi…
Browse files Browse the repository at this point in the history
…ng layout

Depends on llvm#108362.

Adds new layout for llvm#105865.
  • Loading branch information
Michael137 committed Sep 12, 2024
1 parent 8caff2b commit f74fc08
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _run_test(self, defines):


for v in [None, "ALTERNATE_LAYOUT"]:
for r in range(5):
for r in range(6):
name = "test_r%d" % r
defines = ["REVISION=%d" % r]
if v:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
// Pre-D128285 layout.
#define PACKED_ANON_STRUCT
#endif
// REVISION == 4: current layout
#if REVISION <= 4
// Pre-TODO layout.
#define UB_PADDING
#endif
// REVISION == 5: current layout

#ifdef PACKED_ANON_STRUCT
#define BEGIN_PACKED_ANON_STRUCT struct __attribute__((packed)) {
Expand All @@ -34,13 +38,21 @@
namespace std {
namespace __lldb {

#ifdef UB_PADDING
#if defined(ALTERNATE_LAYOUT) && defined(SUBCLASS_PADDING)
template <class _CharT, size_t = sizeof(_CharT)> struct __padding {
unsigned char __xx[sizeof(_CharT) - 1];
};

template <class _CharT> struct __padding<_CharT, 1> {};
#endif
#else // !UB_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:
Expand Down Expand Up @@ -77,7 +89,12 @@ template <class _CharT, class _Traits, class _Allocator> class basic_string {
};
#else // !SUBCLASS_PADDING

#ifdef UB_PADDING
unsigned char __padding[sizeof(value_type) - 1];
#else
[[no_unique_address]] __padding<sizeof(value_type) - 1> __padding_;
#endif

#ifdef BITMASKS
unsigned char __size_;
#else // !BITMASKS
Expand Down

0 comments on commit f74fc08

Please sign in to comment.