Thread overview
Turn output of -vtemplates into compiler-messages and show template instances
Sep 03, 2020
Per Nordlöw
Sep 03, 2020
jmh530
Sep 03, 2020
Per Nordlöw
September 03, 2020
D just got a better formatting of existing template usage sorted by descending unique instantiation count via the flag `-vtemplates`. Each template that has a least one instantiation is now printed using standard compiler diagnostics formatting for easy navigation to the point of its declaration.

Additionally, a new feature is to instead of

    `-vtemplates`

use

    `-vtemplates=list-instances`

. Then the location(s) for each instance of each instantiated template is printed along with information telling whether the instantiation was implicit or explicit.

A good example of the behavior can be found in the test file [2]

[1] https://github.com/dlang/dmd/pull/11463
[2] https://github.com/nordlow/dmd/blob/6b69ff7f0676314953344b5c920d960c023b3134/test/compilable/vtemplates_list.d
September 03, 2020
On Thursday, 3 September 2020 at 13:13:40 UTC, Per Nordlöw wrote:
> D just got a better formatting of existing template usage sorted by descending unique instantiation count via the flag `-vtemplates`. Each template that has a least one instantiation is now printed using standard compiler diagnostics formatting for easy navigation to the point of its declaration.
>
> [snip]

Nice.

People also might find it useful to filter for just one template (and show all the instances).
September 03, 2020
On Thursday, 3 September 2020 at 13:20:32 UTC, jmh530 wrote:
> People also might find it useful to filter for just one template (and show all the instances).

I proposed that feature as, say,

    `vtemplates=list-instances:Template1,Template2,...`

. Just complain a bit and I'll get momentum to add that too ;)