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

David Rector via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 27 10:50:44 PDT 2022


davrec added a comment.

In D128113#3753656 <https://reviews.llvm.org/D128113#3753656>, @davrec wrote:

> In D128113#3753640 <https://reviews.llvm.org/D128113#3753640>, @mizvekov wrote:
>
>> In D128113#3753624 <https://reviews.llvm.org/D128113#3753624>, @davrec wrote:
>>
>>> Or just `SubstTemplateTypeParmType` could store this number in addition to its `TemplateTypeParmType`?  (E.g. the first Ts in an expansion is 0, the second Ts in the same expansion is 1, etc. - but it resets for the next expansion.)
>>
>> Well that number is just the pack_index, as implemented in this current patch :)

Disregard my previous comment, you're right, that would be identical.  I'm mixing up my STTPTs and TTPTs :).  So the proposed solution would be to make the TTPTs unique, and map from the TTPTs to their current pack indices in the Resugarer.  But, that is probably identical in terms of memory usage as your proposal to introduce a new sugar type representing unique expansion instances, and the latter is probably clearer/less disruptive.

Thanks for your work on this, and for explaining these complexities.


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