Modify AST using libclang

Hi,

Is there a way to modify the AST using libclang and then write it back to .ast? I couldn’t find any methods to actually modify it, just to traverse and inspect.

Thanks,

It is not a good idea to modify the AST.

If you can get away with rewriting the source instead, do that.

However if you must mutate the AST, derive a class from the required Decl class.
You can then access many protected attributes directly.