[cfe-dev] new design of RecursiveASTVisitor

Abramo Bagnara abramo.bagnara at gmail.com
Sat Jun 5 01:17:46 PDT 2010


>> Another very useful thing you should consider is to add a child
>> identifier to handler arguments that inform handler about *which* parent
>> child is currently visited: this information is not otherwise deducible.
> 
> Sorry, I don't understand what you mean by "which parent child is
> currently visited".  Care to clarify?
> 
>> To better understand this try to imagine an application that want to
>> check lhs of assign binary operator.

As you've noted in your documentation it might be useful to know the
ancestor chain of current node and for this aim it is possibile to save
a stack of node entered, but what about to know *which* child of its
parent current node is?

This info is not available or deducible *unless* the parent visit (in
its general purpose code) pass down this information.

This make possibile to node visit to answer to the following questions:

"I'm the lhs or the rhs expression?", "I'm the return type of function
decl or the full function type?",  "I'm the return type of function type
or an argument type?", etc.



More information about the cfe-dev mailing list