[cfe-dev] newbie question on traversing with recursiveASTVisitor

sid sidxavier1 at yahoo.co.in
Fri Oct 14 15:24:28 PDT 2011


Hi,

I am trying to traverse statement trees with recursiveASTVisitor. I call a
traverseDecl from handletranslationunit.

I understand that it will do a top down traversal and the visits will happen
in a top-down manner. ie if we have an expression -

a = b+c;
it will first visit for "=" and then move down the tree to visit for "+"
etc.

Now is there a way to come back to the "=" visit once i have visited all its
children while using recursiveASTvisitor? Basically I would want to count
the number of registers being used in each expression or more generally emit
my own unoptimized IR for it. 

But since i will have a top down visit sequence I can never come back to the
"=" visit for doing something on it once I have totally parsed the RHS of
it.
Is there a function that i should overload..

Sorry if i am missing something very obvious here.
(I know that i can achieve this behaviour by manually making and calling
each visit fn for sub-expressions but how to do it with recursiveASTVisitor)

Thanks

--
View this message in context: http://clang-developers.42468.n3.nabble.com/newbie-question-on-traversing-with-recursiveASTVisitor-tp3423001p3423001.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list