[Lldb-commits] [lldb] [lldb] Make variant formatter work with libstdc++-14 (PR #97568)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 8 02:46:28 PDT 2024


Michael137 wrote:

> > LGTM
> > Been wondering if we should follow the same principle as we did with `std::string` and simulate the layouts for all the STL types, keeping a record of them as they change. So we know we don't break the old layouts. Of course it has a separate maintenance cost
> 
> Yeah, I think the biggest hurdle is the initial work in getting a stripped down version of the class in place. The problem is that the container types use a lot of template metaprogramming to implement various optimizations like empty base class and whatnot. Copying that verbatim would make the test huge (and in the case of libstdc++ its probably not even possible), and recreating it from scratch is not trivial. I believe that after I wrote the std::string test this way I tried to also do the same for some of the container types (it may have actually been variant), and just gave up after I saw hold long it would take.
> 
> Nonetheless, I think there's definitely value in tests like this (for one, going through the implementation in this way makes it obvious how many corner cases need testing), and it's nice to see there's interest for these tests. I'll keep that in mind when working on future changes.

Agreed, they can get pretty unwieldy. I'll see what the `std::(unordered_)map` simulator could look like since we're making changes there at the moment

https://github.com/llvm/llvm-project/pull/97568


More information about the lldb-commits mailing list