[cfe-dev] clang plugin error

Manuel Klimek klimek at google.com
Mon Apr 9 10:55:31 PDT 2012

On Mon, Apr 9, 2012 at 7:32 PM, akshay ratnaparkhi <ackk007 at gmail.com> wrote:
> Hi ,
>      I am trying to write the plugin like PrinFunctionNames in clang. I
> create instance of "ASTConsumer" from "PluginASTAction's"
> "createASTConsumer" method. I handle all FunctionDecl from
> HandleTopLevelDecl metod of ASTConsumer. I stored all the FunctionDecl in
> one global vector or any datastructure in my code. Now i want to print that
> vector in some print() function after completing all AST pasing . But when
> try to call print() function it will print null values.
>       can any one tell me what is the problem ?
> thnks.

I wouldn't rely on lifetime of the AST objects past the calls to
HandleTopLevelDecl. If you want to store information about the
FunctionDecls longer, I'd extract the data while inside
HandleTopLevelDecl and put that data into your own structures for
later processing.


> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list