diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py index 98d2c7320003e4c..dd9f5de22c9057d 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py @@ -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: diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp index b010dc25f8f804d..25dfa54bb5acbe4 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp @@ -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)) { @@ -34,6 +38,7 @@ namespace std { namespace __lldb { +#ifdef UB_PADDING #if defined(ALTERNATE_LAYOUT) && defined(SUBCLASS_PADDING) template struct __padding { unsigned char __xx[sizeof(_CharT) - 1]; @@ -41,6 +46,13 @@ template struct __padding { template struct __padding<_CharT, 1> {}; #endif +#else // !UB_PADDING +template struct __padding { + char __padding_[_PaddingSize]; + }; + + template <> struct __padding<0> {}; +#endif template class basic_string { public: @@ -77,7 +89,12 @@ template class basic_string { }; #else // !SUBCLASS_PADDING +#ifdef UB_PADDING unsigned char __padding[sizeof(value_type) - 1]; +#else + [[no_unique_address]] __padding __padding_; +#endif + #ifdef BITMASKS unsigned char __size_; #else // !BITMASKS