[cfe-dev] one question about CIrewriter.cpp

Bill White bill.white at griggsinst.com
Tue Oct 30 07:30:52 PDT 2012


FWIW, I'm finding it really useful to run clang++ with -E on some file
which includes RecursiveASTVisitor.h.  The resulting preprocessed
output has the macro-expanded definition of the template class.  This
tells you all the functions.  You could puzzle it all out from the
type hierarchy, and figuring out the macros, but it's faster just to
look at the real file.  In fact, the result is a github gist right
here: git://gist.github.com/3980452.git
(https://gist.github.com/3980452).  I elided the bodies, so that all
there is is the declarations.

If one were to do a more sophisticated edit of the macro expansion,
one could use d3.js or something like that to display the inheritance
hierarchy.  I'll just bet it would be possible to define the macros in
clang/AST/StmtNodes.inc, clang/AST/TypeNodes.def and
clang/AST/DeclNodes.inc to generate the javascript for the hierarchy
display.  That would be for someone with more energy and time than I
have, though.


On Tue, Oct 30, 2012 at 3:37 AM, Rambo <hunanlwm at sina.cn> wrote:
> Dear,
> Thanks for giving me some beautiful advices,but I have some questions at
> all.
>
> Firstly,the sentence
> "More precisely, the VisitStmt/VisitFooStmt is called by
> WalkUpFromStmt/WalkUpFromFooStmt methods, which is invoked in
> TraverseStmt/TraverseFooStmt",you meaning is that
> WalkUpFromStmt/WalkUpFromFooStmt methods invoke the VisitStmt/VisitFooStmt
> and WalkUpFromStmt/WalkUpFromFooStmt methods is called by
> TraverseStmt/TraverseFooStmt?I don't understand how the
> WalkUpFromStmt/WalkUpFromFooStmt methods be invoked.
>
> Secordly,What the roles the macro DEF_TRAVERSE_STMT takes in this paper?
>
> Lastly,If I want to rewriter this program(CIrewriter.cpp),What is methods of
> class MyRecursiveASTVisitor
> can i add?Please tell me the function of the methods if you have one!
>
> Thanks your attention and I look forward you respose.
>
> Rambo
>
>
>
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/one-question-about-CIrewriter-cpp-tp4027795p4027825.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




More information about the cfe-dev mailing list