Clang plugin modify AST


I had asked this question on the user mailing list, but i got no answers, i am thus trying it on the dev on. Thanks in advance.
I have been playing around with Clang and its plugin facility for a while. I have a plugin with recursiveASTVisitor working. I am interested to modify some special classes that I tag with the annotate attribute. The part that i can't seem to figure out is how to modify the ast.

For example i would like to  add the ast equivalent of this code to a class definition:
float test = 4.0;
float getTest() const
{return test;}

I read multiple time that the ast is supposed to be immutable, but i also read that there is maybe a solution with the sema. I want to point out I don't want to write this change back into the file but that the change get compile and that i would be able to call getTest in my code.

I hope i have been clear if not i'll be happy to give more details.

Thanks for your help