[Lldb-commits] [lldb] Improve performance of .debug_names lookups when DW_IDX_parent attributes are used (PR #91808)
Felipe de Azevedo Piovezan via lldb-commits
lldb-commits at lists.llvm.org
Fri May 10 20:57:09 PDT 2024
felipepiovezan wrote:
Ok, minor correction: if there is no complete parent chain, it just defaults to the older implementation (which calls ProcessEntry). But my point still stands: I don't believe this is related to the presence of IDX_parent.
```
void DebugNamesDWARFIndex::GetFullyQualifiedType(
const DWARFDeclContext &context,
llvm::function_ref<bool(DWARFDIE die)> callback) {
if (context.GetSize() == 0)
return;
llvm::StringRef leaf_name = context[0].name;
llvm::SmallVector<llvm::StringRef> parent_names;
for (auto idx : llvm::seq<int>(1, context.GetSize()))
parent_names.emplace_back(context[idx].name);
// For each entry, grab its parent chain and check if we have a match.
for (const DebugNames::Entry &entry :
m_debug_names_up->equal_range(leaf_name)) {
if (!isType(entry.tag()))
continue;
// Grab at most one extra parent, subsequent parents are not necessary to
// test equality.
std::optional<llvm::SmallVector<Entry, 4>> parent_chain =
getParentChain(entry, parent_names.size() + 1);
if (!parent_chain) {
// Fallback: use the base class implementation.
if (!ProcessEntry(entry, [&](DWARFDIE die) {
return GetFullyQualifiedTypeImpl(context, die, callback);
}))
return;
continue;
}
if (SameParentChain(parent_names, *parent_chain) &&
!ProcessEntry(entry, callback))
return;
}
}
```
https://github.com/llvm/llvm-project/pull/91808
More information about the lldb-commits
mailing list