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

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 23 16:16:18 PDT 2022


mizvekov added a comment.

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.


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