Hi,<br>There are 2 virtual function VisitFunctionDecl and VisitCallExpr. <br>If you overload VisitFunctionDecl, you well get all function declaration as well as function<br>prototypes ( as FunctionDecl object holds both defination as well as prototype)<br>
<br>Whereas , VisitCallExpr is to get all function calls from the source file ( input file)<br><br>I think , this will help you<br><br clear="all">Suhas Limaye. <br>Pune.<br>
<br><br><div class="gmail_quote">On Thu, Apr 12, 2012 at 1:32 AM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com">klimek@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Wed, Apr 11, 2012 at 1:19 PM, akshay ratnaparkhi <<a href="mailto:ackk007@gmail.com">ackk007@gmail.com</a>> wrote:<br>
> Hi all,<br>
>    I am trying to find the function calls from the .c or .cpp input file. I<br>
> used ASTConsumer and VisitStmt for AST traversal.<br>
><br>
> class CGASTActionConsumer:public ASTConsumer{<br>
>  virtual bool HandleTopLevelDecl(DeclGroupRef DG)<br>
>   {<br>
>     //find each FunctionDecl;<br>
>   }<br>
> };<br>
><br>
> class Builder:public StmtVisitor<Builder><br>
>   {<br>
>     //visit CallExpr<br>
>   };<br>
><br>
> I am able to find the simple function calls but the function calls from<br>
> switch case, while loop etc is not getting . what can i do to get the<br>
> function calls from switch statement ,while statement etc.<br>
<br>
</div></div>I'd use the RecursiveASTVisitor for that.<br>
<br>
Cheers,<br>
/Manuel<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br>