[PATCH] D128113: Clang: fix AST representation of expanded template arguments.

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 23 17:17:29 PDT 2022


alexfh added a comment.

In D128113#3744128 <https://reviews.llvm.org/D128113#3744128>, @mizvekov wrote:

> In D128113#3743936 <https://reviews.llvm.org/D128113#3743936>, @alexfh wrote:
>
>> I wonder what is the practical application of the substitution index in SubstTemplateTypeParmType? Diagnostics? Matching AST? Something else? What would be the cost of calculating the index when necessary?
>
> The pack index helps you figure out which argument within an argument pack was used in a substitution, much like the `ReplacementType` has an index which helps you figure out which argument was used.
>
> Calculating it should be possible, if we have the whole type which contains the pattern from where the expansion came from.
>
> The problem is that if we want to extract a sub-type from the whole, say the type of a certain function argument, then we would have to rebuild that type to include this pack index in any substitution sugar. And that sounds expensive as well.

Do you have a practical example that would use the substitution index? I believe you had something in mind before you implemented this patch?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128113/new/

https://reviews.llvm.org/D128113



More information about the cfe-commits mailing list