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

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 22 05:20:40 PDT 2019

labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

In D66398#1640840 <https://reviews.llvm.org/D66398#1640840>, @jankratochvil wrote:

> It just makes now the regexes unambiguous.

I think this is fine too, but I would also only consider it a stop-gap, because these kinds of regular are horrid.

What was the problem with the dispatching solution? If it is hard to programatically access the inline namespace name (though I expect you should at least be able to to something like `type.GetName().startswith("std::__cxx11")`, then we can dispatch based on some other property. The presence of some member variable for instance? This would technically be even more correct as it would also work in the case when someone sadistically configures libc++ to use the `__cxx11` namespace. And since the formatters need have knowledge of the member variables then I think dispatching based on them is fair game too...

Comment at: lldb/include/lldb/DataFormatters/FormattersContainer.h:299-316
+    MapIterator found = end;
     for (pos = m_format_map.map().begin(); pos != end; pos++) {
       lldb::RegularExpressionSP regex = pos->first;
       if (regex->Execute(key_str)) {
-        value = pos->second;
-        return true;
+        if (found != end) {
+          llvm::errs() << "Two regexes (\"" << found->first->GetText()
+                       << "\" and \"" << regex->GetText()
Let's make a separate patch for this. I think it would be better to print this error through proper channels, but that might require some plumbing.




More information about the lldb-commits mailing list