================ @@ -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) == ---------------- labath wrote:
Yeah, so the current assumption is that when matching types, the pattern can contain wildcards (you can say "i'm looking for a type or a namespace at a given position"), but the thing you're matching is always precise (it will say "i'm a type" or "I'm a namespace", but it can't say "I don't know"). For DWARF this isn't an issue because we always have that information. I don't know if that's the case for PDB, or if it's just a side-effect of how it performs the query (*). If it's not possible to do it the other way, then we may have to change the way we do matching, but I think it'd be better to not do that. (*) Currently, the PDB code kind of cheats by taking the type name and parsing it as a type query (SymbolFileNativePDB.cpp:1736 in this patch), but then using the result of that parsing as the *thing to match*. This is bad for two reasons: - if you're parsing from a name, it's clear that you won't be able to see whether enclosing scopes are a type or a namespace. The information just isn't there --`Foo::Bar` looks the same regardless of whether `Foo` is a namespace or not. - It's going to be slow because this approach requires you to fully materialize the type (and everything it depends on) before knowing if this is even the type you're looking for. This may not be as big of an issue for PDB as it is for DWARF because (so I hear) in doesn't have template information (which is the big source of fanout in this process) and it may have less of these searches internally (because it's already linked, in DWARF we need to do this just to search for a definition DIE), but it still means that a search for `foo::iterator` will materialize every iterator out there. For this reason it would be better type context was created differently, without relying on a `Type` object. For DWARF this happens in `DWARFDIE::GetTypeLookupContext`, but I don't know if something like that works in PDB. The patch description seems to indicate that this information does not exist, but I don't understand how *anything* could work in that case. E.g. I don't know what kind of Clang AST would we created for these types. Are they properly nested in their expected namespace? If so how do you figure out that namespace? https://github.com/llvm/llvm-project/pull/149876 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits