mizvekov wrote:

> I agree that we don't need `SubstTemplateTypeParmType` nodes if all 
> resuraging that we ever do is related to types that the Clang frontend itself 
> knows. However that is not universally true.
> 
> For example, we (Google) have a tool for inferring and checking nullability 
> contracts (https://github.com/google/crubit/tree/main/nullability), and a 
> tool for lifetime contracts 
> (https://github.com/google/crubit/tree/main/lifetime_annotations). These tool 
> rely on `SubstTemplateTypeParmType` nodes to propagate nullability and 
> lifetime annotations through template signatures. We can't rely on the Clang 
> frontend doing this propagation because this logic is in an external tool, 
> and the whole notion of nullability and lifetimes is absent in Clang's 
> upstream repository.
> 

Can we extend Clang in other ways where this propagation can happen within our 
transforms?

> To be clear: our tool right now is partially broken (when alias templates are 
> involved), and I am not sure how to fix it when `SubstTemplateTypeParmType` 
> nodes are not going to be available.

To be clear, it has been broken as of a couple of years already for some cases, 
we already perform this 'Final' substitution when instantiating default 
arguments for templates, for example.

This patch extends that to alias templates.

As for my first question, can you think of an alternative way we can go about 
this? What would you need to be upstreamed in order for our own transforms to 
handle this for you?

It sounds like it will be a lot of waste if we have our own resugarer within 
clang, but then you would be forced to implement your own external resugarer 
anyway.

https://github.com/llvm/llvm-project/pull/101858
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to