TreeTransform for AST tweaking


I work on a SYCL compiler ( ) which
is basically implemented as a C++ user-library and some LLVM passes to
separate the host code from the device code and do some code
transformation at the LLVM level to add some runtime glue in between.

But now I need also to fix a few things at the Clang AST level, such as
changing the type of the argument capture of some lambda expressions
before Clang CodeGen.

My plan is to use a TreeTransform but I do not know where to do a
man-in-the-middle attack in Clang to put it at the highest level so I
can fix various things from 1 place with only 1 TreeTransform subclass.

Any hint?

It would be nice if it could be implemented as a Clang plugin to
minimize the intrusion too...

Thank you,