[cfe-dev] Life span of AST data

John McCall rjmccall at apple.com
Sun Sep 5 11:46:45 PDT 2010


On Sep 5, 2010, at 12:12 AM, Ilya Mirsky wrote:
> I'm working on a src-2-src transformer, and I want it to be as modular as possible.
> Currently I'm doing the transformations by invoking Rewriter from within ASTConsumer methods.
> What I want is to have methods like: setFuncName, insertTextAfterCall etc, which will be separated from the parsing process, and could be invoked independantly. The problem is that all the data generated during the parsing (Decl, Stmt, SourceLocation) is deleted after the parsing ends.

It's not deleted after parsing ends;  it's deleted when you destroy the ASTContext (or the SourceManager, for SourceLocations).

John.



More information about the cfe-dev mailing list