[cfe-dev] one question about CIrewriter.cpp
wolf5x
wolf5x1016 at gmail.com
Mon Oct 29 22:45:50 PDT 2012
They overload the methods of class RecursiveASTVisitor
(clang/AST/RecursiveASTVisitor.h) and are invoked during the TraverseDecl
process. The traverse starts at line 361: rv.TraverseDecl(*b);
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.
The Decl thing works in a similar way. DEF_TRAVERSE_DECL of specific decls
call TraverseStmt.
The BinaryOperator is a subclass of Expr, which is derived from Stmt.
See DEF_TRAVERSE_STMT(BinaryOperator ...
On Sun, Oct 28, 2012 at 10:16 PM, Rambo <hunanlwm at sina.cn> wrote:
> Hi,everybody
>
> I meet a trouble now.if you have a look at this page
> https://github.com/loarabia/Clang-tutorial
> <https://github.com/loarabia/Clang-tutorial> and understand the program
> CIrewriter.cpp
> deeply,I may be ask you a question:How the methods be invoked?The three
> methods is located at line 82-line 84. as follows.
> bool VisitStmt(Stmt *s);
> bool VisitFunctionDecl(FunctionDecl *f);
> Expr *VisitBinaryOperator(BinaryOperator *op);
>
> Thanks for any help to solve my problem or answer my questions! I am
> looking
> forward for you constructive feedback.
>
>
> Rambo
>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/one-question-about-CIrewriter-cpp-tp4027795.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
--
/**************
* Best Regards,
* wolf5x
**************/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121030/ae8694a0/attachment.html>
More information about the cfe-dev
mailing list