88//
99// This file defines the DynamicRecursiveASTVisitor interface, which acts
1010// identically to RecursiveASTVisitor, except that it uses virtual dispatch
11- // instead of CRTP, which greatly improves compile times and binary size.
12- //
13- // However, it also comes with limitations in that some of the more seldom
14- // utilised features of RecursiveASTVisitor are not supported.
11+ // instead of CRTP, which greatly improves compile times and binary size.
1512//
1613// Prefer to use this over RecursiveASTVisitor whenever possible.
1714//
@@ -28,21 +25,32 @@ class ASTContext;
2825
2926// / Recursive AST visitor that supports extension via dynamic dispatch.
3027// /
31- // / This only supports some of the more common visitation operations; in
32- // / particular, it does not support overriding WalkUpFromX or post-order
33- // / traversal.
28+ // / Like RecursiveASTVisitor, this class allows for traversal of arbitrarily
29+ // / complex ASTs. The main difference is that this uses virtual functions
30+ // / instead of CRTP, which greatly improves compile times of Clang itself,
31+ // / as well as binary size.
3432// /
3533// / Instead of functions (e.g. shouldVisitImplicitCode()), this class
3634// / uses member variables (e.g. ShouldVisitImplicitCode) to control
3735// / visitation behaviour.
3836// /
39- // / RAV features that are NOT supported:
37+ // / However, there is no support for overriding some of the less commonly
38+ // / used features of the RAV, such as WalkUpFromX or attribute traversal
39+ // / (attributes can still be traversed, but you can't change what happens
40+ // / when we traverse one).
41+ // /
42+ // / The following is a list of RAV features that are NOT customisable:
4043// /
4144// / - Visiting attributes,
42- // / - Post-order traversal,
4345// / - Overriding WalkUpFromX,
4446// / - Overriding getStmtChildren().
4547// /
48+ // / Furthermore, post-order traversal is not supported at all.
49+ // /
50+ // / Prefer to use this over RecursiveASTVisitor unless you absolutely
51+ // / need to use one of the features listed above (e.g. overriding
52+ // / WalkUpFromX or post-order traversal).
53+ // /
4654// / \see RecursiveASTVisitor.
4755class DynamicRecursiveASTVisitor {
4856public:
0 commit comments