[Lldb-commits] [lldb] [lldb] Make CompilerDecl::GetName (always) return template args (PR #116068)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 15 03:01:20 PST 2024


Michael137 wrote:

> I think the problem here is of a more fundamental nature. `FindTypes` finds **types**. `bar` is _not_ a type. `bar<int>` is. So, while a type query for `bar` will find the definition DIE with `DW_AT_name="bar"`, that DIE will actually be defining the type `bar<int>`. So when the implementation looks at the type constructed from that DIE, it will see that the name does not match what is being asked (it gets this name through a different API, so it will include the template args even without this patch), and discard the type.
> 
> As far as i know, this is all WAI. Existing FindType callers expect to get a specific type as a result of their query -- not a collection of instantiations of that template. (That's definitely true in this case, where returning the collection of instantiations would just push the burden of filtering them onto the caller.) That's not to say this kind of a template search is not useful. Having something like that would go a long way towards making expressions like `(bar<int> *) ptr` work. But that would probably be a different API and the problem is that this is basically impossible to implement in a non-simplified-template-name world, and even with simplified names, returning all instantiations might be too expensive.

Makes sense, thanks for elaborating

LGTM

The `TestDAP_evaluate.py` failure is https://github.com/llvm/llvm-project/issues/116041 (which should be fixed once you rebase)

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


More information about the lldb-commits mailing list