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 | 47b92a2cc4540354335f3c3e8558f2a6126368e8 (patch) | |
| tree | e635e2f28f7ae648a021b50a0a4cf097293625dc | |
| parent | 02d3368831b9c6ae8c52f516c0db9c3d0a6b1926 (diff) | |
| download | bcm5719-llvm-47b92a2cc4540354335f3c3e8558f2a6126368e8.tar.gz bcm5719-llvm-47b92a2cc4540354335f3c3e8558f2a6126368e8.zip | |
Add a 'Base' type to RecursiveASTVisitor to make recursing easier and document
how you're supposed to use it.
llvm-svn: 103993
| -rw-r--r-- | clang/include/clang/AST/RecursiveASTVisitor.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index 36b151ddf34..1b2f3a79ddb 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/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); } |

