[all-commits] [llvm/llvm-project] 4ca8fb: [lldb][test] TestDataFormatterLibcxxStringSimulato...

Michael Buch via All-commits all-commits at lists.llvm.org
Fri Sep 13 03:01:46 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ca8fb18129e6465c3594a8681f1cca0e2aff724
      https://github.com/llvm/llvm-project/commit/4ca8fb18129e6465c3594a8681f1cca0e2aff724
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2024-09-13 (Fri, 13 Sep 2024)

  Changed paths:
    M lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py
    M lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp

  Log Message:
  -----------
  [lldb][test] TestDataFormatterLibcxxStringSimulator.py: fix padding for current layout (#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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list