newbie question on traversing with recursiveASTVisitor

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

} Now is there a way to come back to the "=" visit once i have visited
} all its children while using recursiveASTvisitor?

Yes: instead of overloading VisitFoo, overload TraverseFoo. This
means you'll have to manually call the superclass's TraverseFoo, but
can then do whatever logic you want after that.

The code would look something like this:

  bool TraverseCXXConstructorDecl(clang::CXXConstructorDecl* decl) {
    DoStuffThatTakesPlaceBeforeVisitingChildren();
    if (!Base::TraverseCXXConstructorDecl(decl)) return false;
    DoStuffThatTakesPlaceAfterVisitingChildren();
    return true;
  }

craig