[Lldb-commits] [lldb] [lldb] Refactor TypeQuery::ContextMatches (PR #99305)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 18 07:24:13 PDT 2024


================
@@ -153,19 +127,89 @@ void TypeQuery::SetLanguages(LanguageSet languages) {
 
 bool TypeQuery::ContextMatches(
     llvm::ArrayRef<CompilerContext> context_chain) const {
-  if (GetExactMatch() || context_chain.size() == m_context.size())
-    return ::contextMatches(context_chain, m_context);
-
-  // We don't have an exact match, we need to bottom m_context.size() items to
-  // match for a successful lookup.
-  if (context_chain.size() < m_context.size())
-    return false; // Not enough items in context_chain to allow for a match.
-
-  size_t compare_count = context_chain.size() - m_context.size();
-  return ::contextMatches(
-      llvm::ArrayRef<CompilerContext>(context_chain.data() + compare_count,
-                                      m_context.size()),
-      m_context);
+  auto ctx = context_chain.rbegin(), ctx_end = context_chain.rend();
+  for (auto pat = m_context.rbegin(), pat_end = m_context.rend();
+       pat != pat_end;) {
+
+    // Handle AnyModule matches. These are tricky as they can match any number
----------------
labath wrote:

That's a very good question actually. I'm pretty sure we're not using it. I assumed it was being used for some Apple thing with -gmodules or whatever, but now mention that, it doesn't appear to be actually used except for some specialized tests.

So, as much as I loved implementing a glob algorithm, I would love even more to delete it.

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


More information about the lldb-commits mailing list