[cfe-dev] AST transformations

Vassil Vassilev vasil.georgiev.vasilev at cern.ch
Fri Mar 11 13:09:41 PST 2011


On 11.3.2011 г. 18:55, Douglas Gregor wrote:
>
> I'm fairly surprised that nobody has brought up Sema's TreeTransform, which is a generic transformation on the Clang AST that allows subclasses to decide how to replace certain nodes with other nodes, and then rebuild the tree around that. It is currently used for template instantiation, rebuilding types for out-of-line definitions of class template members once we know what their semantic scope is, and for replacing "auto" with its deduced type.
>
> Has TreeTransform been deemed inadequate for some reason? Or did people just not know about it?
>
That is good point! I had have a look 6-7 months ago, but it didn't seem 
appropriate for my use-case then. Today when I looked at it again, I 
realized how much it has evolved. I found out that I did a lot of things 
in the exact same manner as it is done there. Yeah yeah..., I always 
learn thing in the most difficult way ;) What does "replace certain 
nodes with other nodes" mean? It is not possible to insert/remove/modify 
an arbitrary node, is it?
I don't think that TreeTransform.h is public interface. I found it in 
lib/Sema/

Vassil



More information about the cfe-dev mailing list