[cfe-dev] what is the order of Visit* methods in RecursiveASTVisitor?

Kim Gräsman kim.grasman at gmail.com
Sat Dec 28 01:22:39 PST 2013

Hi lotay,

On Sat, Dec 28, 2013 at 8:06 AM, lotay <158481612 at qq.com> wrote:
> For example, for two method VisitFunctionDecl and VisitCXXMethodDecl
> implmented in my visitor, what is the order of this two method invoked when
> analyze the CXX method?1. VisitFunctionDecl first or VisitCXXMethodDecl
> first?2. just invoke VisitCXXMethodDecl?3 just invoke
> VisitFunctionDecl?really thanks for help.

I always find this confusing as well, and I've had great help from
this design doc e-mail from a few years back:

It appears it walks up the hierarchy recursively and then visits each
generation's node, so it should be VisitFunctionDecl and then

- Kim

More information about the cfe-dev mailing list