[Lldb-commits] [lldb] [LLDB][NativePDB] Allow type lookup in namespaces (PR #149876)

via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 25 09:30:40 PDT 2025


================
@@ -134,7 +134,9 @@ bool TypeQuery::ContextMatches(
     if (ctx == ctx_end)
       return false; // Pattern too long.
 
-    if (ctx->kind == CompilerContextKind::Namespace && ctx->name.IsEmpty()) {
+    if ((ctx->kind & CompilerContextKind::Namespace) ==
----------------
Nerixyz wrote:

That's a good point. I'll create the context in the PDB plugin. To avoid materializing all types that match the basename, I can see two approaches:

1. Naively use the type's name (PDB stores the demangled name there). This would essentially do the same as the `TypeQuery` constructor where it tries to separate the scopes. Every scope/context but the last one would be a namespace. For the last one, we can find the exact type.
2. PDB also contains a `UniqueName` field which can contain a mangled type name. Similar to [`CreateDeclInfoForType`](https://github.com/llvm/llvm-project/blob/a883a679165658bc6495e7d661dd52af02831250/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp#L177-L190), the name could be demangled and each scope could be checked. 

In both cases, it's possible to try and get the parent to handle nested structs/enums/unions like in `CreateDeclInfoForType`.

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


More information about the lldb-commits mailing list