[cfe-dev] Life span of AST data

Douglas Gregor dgregor at apple.com
Sun Sep 5 08:20:13 PDT 2010


On Sep 5, 2010, at 12:12 AM, Ilya Mirsky wrote:

> Greetings,
> 
> 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.

Good, that's the right approach.

> 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.

Why can't you just perform all of the necessary operations within ASTConsumer::HandleTranslationUnit?

	- Doug



More information about the cfe-dev mailing list