Add a 'Base' type to RecursiveASTVisitor to make recursing easier and document

how you're supposed to use it.

llvm-svn: 103993
This commit is contained in:
Nick Lewycky 2010-05-17 23:15:38 +00:00
parent 02d3368831
commit 47b92a2cc4
1 changed files with 7 additions and 4 deletions

View File

@ -43,11 +43,14 @@ return static_cast<Derived*>(this)->Visit ## NAME(static_cast<CLASS*>(Var))
* and override any of the Visit* methods for declaration, type, statement,
* expression, or other AST nodes where the visitor should customize
* behavior. Returning "true" from one of these overridden functions will
* abort the traversal.
* abort the entire traversal. An overridden Visit* method will not descend
* further into the AST for that node unless Base::Visit* is called.
*/
template<typename Derived>
class RecursiveASTVisitor {
public:
typedef RecursiveASTVisitor<Derived> Base;
/// \brief Return a reference to the derived class.
Derived &getDerived() { return *static_cast<Derived*>(this); }