[Lldb-commits] [lldb] Improve type and namespace lookup using parent chain (PR #108907)
Felipe de Azevedo Piovezan via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 19 07:58:52 PDT 2024
================
@@ -444,6 +492,98 @@ void DebugNamesDWARFIndex::GetNamespaces(
m_fallback.GetNamespaces(name, callback);
}
+void DebugNamesDWARFIndex::GetNamespacesWithParents(
+ ConstString name, llvm::ArrayRef<llvm::StringRef> parent_names,
+ llvm::function_ref<bool(DWARFDIE die)> callback) {
+ Progress progress("Get namespace from index for %s", name.GetCString());
+ for (const DebugNames::Entry &entry :
+ m_debug_names_up->equal_range(name.GetStringRef())) {
+ lldb_private::dwarf::Tag entry_tag = entry.tag();
+ if (entry_tag == DW_TAG_namespace ||
+ entry_tag == DW_TAG_imported_declaration) {
+ std::optional<llvm::SmallVector<Entry, 4>> parent_chain =
+ getParentChain(entry);
+ if (!parent_chain) {
+ // Fallback: use the base class implementation.
+ if (!ProcessEntry(entry, [&](DWARFDIE die) {
+ return ProcessDieMatchParentNames(name, parent_names, die, callback);
+ }))
+ return;
+ continue;
+ }
+
+ if (parent_chain->size() < parent_names.size())
+ continue;
+ else if (parent_chain->size() == parent_names.size()) {
----------------
felipepiovezan wrote:
I'd probably fold this optimization inside `WithinParentChain`
https://github.com/llvm/llvm-project/pull/108907
More information about the lldb-commits
mailing list