[Dlang-internal] Proposal: New Switch -vcg-ast to output the lowered AST

Ali Cehreli via Dlang-internal dlang-internal at puremagic.com
Sun May 7 08:13:17 PDT 2017


On Thursday, 23 February 2017 at 01:37:15 UTC, Stefan Koch wrote:
> Hello fellow compiler hackers,
>
> In order to debug the inliner I have implemented a switch that 
> prints out the AST after all semantic processing is done.
> Using the infra-structure that is already provided by hdrgen.
> This has already let me to make a few improvements to the 
> hdrgen.
> For example if-else chains will no longer infinitely indent to 
> the left.
> Or Literals of EnumType will be printed by name rather then as 
> cast(MyEnum)38943U.
>
> I do think this is very worthwhile to have.
>
> And would be happy to hear some opinions from you.
>
> PS. I am aware that the printout of enum definitions is now 
> broken; I know howto fix it and will do so shotly.
>
> Lastly I should like the PR:
> https://github.com/dlang/dmd/pull/6556
>
> Cheers,
> Stefan

I've just learned about this switch, which I'm told is currently 
in master. From what Stefan has shown to me, this can be handy in 
many situations because it outputs the instantiations of 
templates. (One limitation is that it currently works only with 
eponymous templates.)

I think this command or a sister of it could be improved to dump 
what is being mixed-in.

Ali



More information about the Dlang-internal mailing list