[cfe-dev] function calls

Suhas suhaslimaye at gmail.com
Wed Apr 11 22:57:20 PDT 2012


Hi,
There are 2 virtual function VisitFunctionDecl and VisitCallExpr.
If you overload VisitFunctionDecl, you well get all function declaration as
well as function
prototypes ( as FunctionDecl object holds both defination as well as
prototype)

Whereas , VisitCallExpr is to get all function calls from the source file (
input file)

I think , this will help you

Suhas Limaye.
Pune.


On Thu, Apr 12, 2012 at 1:32 AM, Manuel Klimek <klimek at google.com> wrote:

> On Wed, Apr 11, 2012 at 1:19 PM, akshay ratnaparkhi <ackk007 at gmail.com>
> wrote:
> > Hi all,
> >    I am trying to find the function calls from the .c or .cpp input
> file. I
> > used ASTConsumer and VisitStmt for AST traversal.
> >
> > class CGASTActionConsumer:public ASTConsumer{
> >  virtual bool HandleTopLevelDecl(DeclGroupRef DG)
> >   {
> >     //find each FunctionDecl;
> >   }
> > };
> >
> > class Builder:public StmtVisitor<Builder>
> >   {
> >     //visit CallExpr
> >   };
> >
> > I am able to find the simple function calls but the function calls from
> > switch case, while loop etc is not getting . what can i do to get the
> > function calls from switch statement ,while statement etc.
>
> I'd use the RecursiveASTVisitor for that.
>
> Cheers,
> /Manuel
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120412/a7a29aed/attachment.html>


More information about the cfe-dev mailing list