Commit d617f1b
committed
[lldb][test] TestDataFormatterLibcxxStringSimulator.py: fix padding for current layout (llvm#108362)
IIUC, the history of `std::string`'s `__short` structure in the
alternate ABI layout (as recorded by the simulator test) looks as
follows:
* First layout ( `SUBCLASS_PADDING` is defined):
```
struct __short
{
value_type __data_[__min_cap];
struct
: __padding<value_type>
{
unsigned char __size_;
};
};
```
* Then:
```
struct __short
{
value_type __data_[__min_cap];
unsigned char __padding[sizeof(value_type) - 1];
unsigned char __size_;
};
```
* Then, post-`BITMASKS`:
```
struct __short
{
value_type __data_[__min_cap];
unsigned char __padding[sizeof(value_type) - 1];
unsigned char __size_ : 7;
unsigned char __is_long_ : 1;
};
```
Which is the one that's [on
top-of-tree](https://github.com/llvm/llvm-project/blob/89c10e27d8b4d5f44998aad9abd2590d9f96c5df/libcxx/include/string#L854-L859).
But for `REVISION > 1`, `BITMASKS` is never set, so for those tests we
lose the `__padding` member.
This patch fixes this by splitting out the `SUBCLASS_PADDING` out of the
ifdef.
Drive-by:
* Also run expression evaluator on the string to provide is with some
extra coverage.
(cherry picked from commit 4ca8fb1)1 parent 957e177 commit d617f1b
File tree
2 files changed
+8
-4
lines changed- lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string
2 files changed
+8
-4
lines changedLines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | | - | |
| 78 | + | |
| 79 | + | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | | - | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
0 commit comments