[Lldb-commits] [lldb] [lldb] Refactor TypeQuery::ContextMatches (PR #99305)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Fri Jul 26 10:25:36 PDT 2024
https://github.com/clayborg commented:
My main questions is do we actually use wildcards a lot? In normal type query matches, we can ask for exact matches where everything is specified, or the user types some string like `a::b::iterator` where we don't know what any of the items are. If exact match is specified then all levels need to match the type we found, but if exact match is not specified, then we accept anything that ends with the specified compiler context. There are no wildcards specified in any of these kinds of queries from a type lookup perspective right? Where are these actual wildcard searches happening?
When searching for a type in anonymous namespaces, are you expecting the compiler context that gets created for such types is doing to include the anonymous namespace in the context? So for:
```
namespace {
struct Foo {};
}
```
The compiler context will end up being:
```
namespace ""
struct "Foo"
```
We might need to notion of a declaration context barrier item in our CompilerContext arrays that say "the type below this is fully qualified on its own, but this barrier can help disambiguate searches if the user fully specifies things. For example a type in a function right now:
```
namespace a {
void func1() {
namespace b {
struct foo{};
};
}
```
Currently will produce a compiler contenxt of:
```
namespace "b"
struct "foo"
```
But could it could include "func1"'s context in the future:
```
namespace "a"
function "func1" <<<< barrier entry (for lack of a better term)
namespace "b"
struct "foo"
```
Then a search for an exact type name `"b::foo"` could match the above compiler context as it matches fully up to a barrier `CompilerContext`. But if the users knows they want this exact type they could ask for `"a::func1::b::foo"` and get the right one if they were other `"b::foo"` types.
I mention this because for anonynmous namespace types, we might not want to have to type `"(anonymous namespace)::Foo"` to find the type from my first example, users probably just want to type `"Foo"` and still find the type and the anonymous namespace could be one of these new decl context root barriers.
Any clarification on what you plan to do for anonymous types would be great to hear.
https://github.com/llvm/llvm-project/pull/99305
More information about the lldb-commits
mailing list