[Lldb-commits] [PATCH] D66398: 2/2: Fix `TestDataFormatterStdList` regression

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 22 04:52:46 PDT 2019

jankratochvil added a comment.

In D66398#1635344 <https://reviews.llvm.org/D66398#1635344>, @labath wrote:

> Since it seems that there is a need for disambiguation (libc++ can be configured to have any name for the inline namespace, so there's no way to make its regex not match the libstdc++ one),

This is regression from D57466 <https://reviews.llvm.org/D57466>. If you configure libc++ to have the same name ("__cxx11") as libstdc++ then LLDB really cannot recognize it is libc++ behind.

> I think we should just use the registration order to disambiguate. Then we just need to make sure the libstdc++ formatter is registered before the libc++ one, which should be both easy to achieve and understandable.
> Since you've recently touched this code, how hard do you think it would be to exchange the std::map in FormattersContainer for a std::vector? Would you be willing to give that a try?

>From IRC:
That `std::vector` there is not easy.  First some methods were already using `.find()` on it so I had to change them to iterate through that vector.
Also some iterating in `FormattersContainer` (`Delete_Impl`, `GetExact_Impl`) were now iterating for comparison despite they could use `.find()` so by moving to `std::vector` we lose this improvement possibility.
labath: if replace that by a single entry then the nondeterminism goes away
labath: `std::.*::list -> { if (inline_namespace == "__cxx11") return "libstdc++ formatter" else return "libc++ formatter" }`

I have somehow find that dispatching implemented C++ not so simple, why not just to remove the ambiguity from the regexes?




More information about the lldb-commits mailing list