diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2010-05-17 23:15:38 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2010-05-17 23:15:38 +0000 |
commit | 2fe0025a1300689b2d2517bb89ecadbab8b62ac5 (patch) | |
tree | 84e190ea8b34230bf6d321ebe97834e5a5382979 | |
parent | e2aaf39abf0e4c6c293a9842c23a1a44496d683b (diff) |
Add a 'Base' type to RecursiveASTVisitor to make recursing easier and document
how you're supposed to use it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103993 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/RecursiveASTVisitor.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index 36b151ddf3..1b2f3a79dd 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -40,14 +40,17 @@ return static_cast<Derived*>(this)->Visit ## NAME(static_cast<CLASS*>(Var)) * * Clients of this visitor should subclass the visitor (providing themselves * as the template argument, using the curiously recurring template pattern) - * 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. + * 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 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); } |