I dont want to hijack this thread but how would i start the RecursiveASTVisitor? The problem is, i dont know what to do after i call LoadFromASTFile<br>My question is in more detail here <a href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-June/015613.html">http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-June/015613.html</a><br>
<br><div class="gmail_quote">On Sat, Jun 18, 2011 at 5:46 AM, Adrien Chauve <span dir="ltr"><<a href="mailto:adrien.chauve@gmail.com">adrien.chauve@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
To simplify the code and avoid handwritten recursion, maybe you could<br>
use the RecursiveASTVisitor insted of 3 visitors:<br>
<br>
class MyConsumer : public ASTConsumer, public RecursiveASTVisitor<MyConsumer><br>
{<br>
virtual void HandleTranslationUnit(ASTContext &context)<br>
{<br>
// traverse AST to visit declarations and statements<br>
TraverseDecl(context.getTranslationUnitDecl());<br>
}<br>
<br>
bool VisitBinaryOperator(BinaryOperator* expr)<br>
{<br>
// ... handle expr<br>
return true;<br>
}<br>
<br>
bool VisitDeclRefExpr(DeclRefExpr* expr)<br>
{<br>
// ... handle expr<br>
return true;<br>
}<br>
};<br>
<font color="#888888"><br>
<br>
Adrien<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
On Sat, Jun 18, 2011 at 07:46, sirinda <<a href="mailto:sxp969@psu.edu">sxp969@psu.edu</a>> wrote:<br>
> sorry, I forgot to include the following code to check if the stmt is an<br>
> expr.<br>
><br>
> // this code is inside VisitStmt(Stmt* Node)<br>
> if (isa<Expr>(Node)) {<br>
> Expr *expr = (Expr*)Node;<br>
> VisitExpr(expr);<br>
><br>
> --<br>
> View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/A-newbie-question-on-getting-operator-in-Expr-tp3073430p3078936.html" target="_blank">http://clang-developers.42468.n3.nabble.com/A-newbie-question-on-getting-operator-in-Expr-tp3073430p3078936.html</a><br>
> Sent from the Clang Developers mailing list archive at Nabble.com.<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>
><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>
</div></div></blockquote></div><br><div></div>