I have been able to use CDT's AST API for parsing source code successfully. My question involves the reverse: How can I build an C AST programmatically, and then tell it to write itself to a file? I have seen the class ASTWriter (but that is internal) and can't find any tutorials or documentation on building the actual AST.
I have found a paper that goes over the idea of what I want to do: Generating Rewritable Abstract Syntax Trees which makes it seem like generating code would be easy if I could construct the tree and say 'write yourself'. Is this possible in CDT and how might I get started (preferably without deprecated/internal methods?)