While using Clang LibTooling's RecursiveASTVisitor, how to tell the library to abort the scan of the subtree under the currently visited AST node?
RecursiveASTVisitor uses depth-first traversal on the AST, it could be easy to abort some subtree and continue the traversal.
For example (please read the comments in the code):
virtual bool VisitCXXRecordDecl(CXXRecordDecl *decl) {
//some code to tell the lib not to traverse the subtree
//under the currently visited node i.e. decl
//but still continue the traversal
//so that the scan process will skip all AST nodes under any
//CXXRecordDecl in the AST
}
I thought to return false from the Visit*** method will get this goal, but it indeed tells the lib to end the traversal all together, not skipping subtree.
ASTMatchers are not considered since the goal is just the one described in the title.