[Lldb-commits] [lldb] [lldb/DWARF] Remove duplicate type filtering (PR #116989)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 21 07:25:28 PST 2024


================
@@ -2726,39 +2726,8 @@ void SymbolFileDWARF::FindTypes(const TypeQuery &query, TypeResults &results) {
   TypeQuery query_full(query);
   bool have_index_match = false;
   m_index->GetTypesWithQuery(query_full, [&](DWARFDIE die) {
-    // Check the language, but only if we have a language filter.
-    if (query.HasLanguage()) {
-      if (!query.LanguageMatches(GetLanguageFamily(*die.GetCU())))
-        return true; // Keep iterating over index types, language mismatch.
-    }
-
-    // Since mangled names are unique, we only need to check if the names are
-    // the same.
-    if (query.GetSearchByMangledName()) {
-      if (die.GetMangledName(/*substitute_name_allowed=*/false) !=
-          query.GetTypeBasename().GetStringRef())
-        return true; // Keep iterating over index types, mangled name mismatch.
-      if (Type *matching_type = ResolveType(die, true, true)) {
-        results.InsertUnique(matching_type->shared_from_this());
-        return !results.Done(query); // Keep iterating if we aren't done.
-      }
-      return true; // Keep iterating over index types, weren't able to resolve
-                   // this type
-    }
-
-    // Check the context matches
-    std::vector<lldb_private::CompilerContext> die_context;
-    if (query.GetModuleSearch())
-      die_context = die.GetDeclContext();
-    else
-      die_context = die.GetTypeLookupContext();
-    assert(!die_context.empty());
----------------
labath wrote:

I don't feel strongly about this, but I don't think this should be an assert. Like, we can probably reach this code if a bad (corrupted) index points us to an empty DIE. According to the [assertion manifesto](https://lldb.llvm.org/resources/contributing.html#error-handling-and-use-of-assertions-in-lldb) this shouldn't crash lldb.

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


More information about the lldb-commits mailing list