[Lldb-commits] [lldb] Improve type lookup using .debug_names parent chain (PR #108907)

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 7 11:00:11 PDT 2024


================
@@ -444,6 +499,72 @@ void DebugNamesDWARFIndex::GetNamespaces(
   m_fallback.GetNamespaces(name, callback);
 }
 
+llvm::SmallVector<CompilerContext>
+DebugNamesDWARFIndex::GetTypeQueryParentContexts(TypeQuery &query) {
+  std::vector<lldb_private::CompilerContext> &query_decl_context =
+      query.GetContextRef();
+  llvm::SmallVector<CompilerContext> parent_contexts;
+  if (!query_decl_context.empty()) {
+    // Skip the last entry, it is the type we are looking for.
----------------
Jlalond wrote:

This comment is confusing

the last element contains what we have, but then we reverse the `0..N-1` part of the list and capture this data is the check if it's invalid and that we have a non-invalid/null name.

I can figure out what you're doing but I think we can rework some of the comments.

```
// Skip the last entry as it's the type we're finding parents for.
```

Also, why are we reversing it? That is not very apparent to me

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


More information about the lldb-commits mailing list