[cfe-dev] Help: Clang Rewriter

hsankara at ittc.ku.edu hsankara at ittc.ku.edu
Thu Dec 15 11:41:21 PST 2011


Hi,

I have created a plugin to do some transformations on c files. My main
class inherits ASTConsumer class. I have 2 questions

1) I want to give multiple files as input. While I am able to do it the
AST Objects(like FunctionDecl, VarDecl and others) of the first file get
deleted when the first processing is done. This I understand is because
AST Objects get destroyed when ASTContext gets destroyed which is single
AST specific. Is there a way to not release these objects. I do need the
first file's objects when working on the second file since these files
belong to a single project and are interrelated.

2) I want to do all the source level transformations and then finally
rewrite the output buffer(RewriteBuffer) to these files at the very end
and not in HandleTranslationUnit function which is AST specific.


Kindly let me know if I am missing something obvious.

Thanks,
Hema




More information about the cfe-dev mailing list