[Lldb-commits] [PATCH] D66507: Generalize FindTypes with CompilerContext to support fuzzy lookup

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 21 01:31:54 PDT 2019

labath added a comment.

I don't have any context or opinion on the high level functionality, but can we please not use inheritance in this way? Though I have done similar things in the past, I am not really proud of them. It looks like the matching code can be just as easily be implemented as a free function...

Comment at: lldb/source/Symbol/Type.cpp:54-60
+        if (it->kind == CompilerContextKind::Module)
+          while (std::next(it) != end() &&
+                 std::next(it)->kind == CompilerContextKind::Module)
+            ++it;
+        else
+          // Zero module matches, apply the next pattern on this element.
+          continue;
it looks like you should use `context_chain.end()` instead of `end()`.
Also, all of this probably boils down to `it = std::find_if(it, context_chain.end(), [](??? cc) { return cc.kind != Module; });`



More information about the lldb-commits mailing list