They overload the methods of class RecursiveASTVisitor (clang/AST/RecursiveASTVisitor.h) and are invoked during the TraverseDecl process. The traverse starts at line 361: <span class="n" style="margin:0px;padding:0px;border:0px;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre;background-color:rgb(255,255,255)">rv</span><span class="p" style="margin:0px;padding:0px;border:0px;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre;background-color:rgb(255,255,255)">.</span><span class="n" style="margin:0px;padding:0px;border:0px;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre;background-color:rgb(255,255,255)">TraverseDecl</span><span class="p" style="margin:0px;padding:0px;border:0px;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre;background-color:rgb(255,255,255)">(</span><span class="o" style="margin:0px;padding:0px;border:0px;font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre;background-color:rgb(255,255,255)">*</span><span class="n" style="margin:0px;padding:0px;border:0px;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre;background-color:rgb(255,255,255)">b</span><span class="p" style="margin:0px;padding:0px;border:0px;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre;background-color:rgb(255,255,255)">);</span><div>
<br></div><div>More precisely, the VisitStmt/VisitFooStmt is called by WalkUpFromStmt/WalkUpFromFooStmt methods, which is invoked in TraverseStmt/TraverseFooStmt. You can look into "switch (S->getStmtClass())" in TraverseStmt, and the macro DEF_TRAVERSE_STMT.</div>
<div><br></div><div>The Decl thing works in a similar way. DEF_TRAVERSE_DECL of specific decls call TraverseStmt.</div><div><br></div><div>The BinaryOperator is a subclass of Expr, which is derived from Stmt. See DEF_TRAVERSE_STMT(BinaryOperator ...</div>
<div><br><div class="gmail_quote">On Sun, Oct 28, 2012 at 10:16 PM, Rambo <span dir="ltr"><<a href="mailto:hunanlwm@sina.cn" target="_blank">hunanlwm@sina.cn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,everybody<br>
<br>
I meet a trouble now.if you have a look at this page<br>
<a href="https://github.com/loarabia/Clang-tutorial" target="_blank">https://github.com/loarabia/Clang-tutorial</a><br>
<<a href="https://github.com/loarabia/Clang-tutorial" target="_blank">https://github.com/loarabia/Clang-tutorial</a>>  and understand the program<br>
CIrewriter.cpp<br>
deeply,I may be ask you a question:How the  methods be invoked?The three<br>
methods is located at line 82-line 84. as follows.<br>
bool VisitStmt(Stmt *s);<br>
bool VisitFunctionDecl(FunctionDecl *f);<br>
Expr *VisitBinaryOperator(BinaryOperator *op);<br>
<br>
Thanks for any help to solve my problem or answer my questions! I am looking<br>
forward for you constructive feedback.<br>
<br>
<br>
Rambo<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/one-question-about-CIrewriter-cpp-tp4027795.html" target="_blank">http://clang-developers.42468.n3.nabble.com/one-question-about-CIrewriter-cpp-tp4027795.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>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><font face="verdana, sans-serif">/**************</font></div><font face="verdana, sans-serif"> * Best Regards,</font><div><font face="verdana, sans-serif"> * wolf5x</font></div>
<div><font face="verdana, sans-serif"> **************/</font></div><br>
</div>