[clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)
Dmitri Gribenko via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 6 06:25:14 PDT 2024
gribozavr wrote:
> So from my undertstanding, IWYU only needs the SubstTemplateTypeParmType for resugaring purposes, in order to recover the type as written by the user.
>
> But with this patch we are doing the substitution already with sugar, so there is no need to resugar, so IWYU shouldn't need the SubstTemplateTypeParmType here anymore.
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). It relies on `SubstTemplateTypeParmType` nodes to propagate nullability annotations through template signatures. We can't rely on the Clang frontend doing this propagation because this logic is in an external tool.
So for all practical purposes, the removal of `SubstTemplateTypeParmType` is losing relevant information, and it means that no other tool can do the things that Clang frontend can.
https://github.com/llvm/llvm-project/pull/101858
More information about the cfe-commits
mailing list