The RecursiveASTVisitor does not appear to support visiting const-qualified statements since its VisitStmt member function accepts a pointer to an unqualified Stmt:
By contrast, the ast_matcher’s getNodeAs function returns a pointer to a const-qualified node type:
I was using the ast_matcher but reached a point where I needed to apply a RecursiveASTVisitor to the result of a getNodeAs call to check for something deeply nested (without writing more matchers to get me through any possible thing I might encounter on the way down). Unfortunately, it looks like I can’t do that without resorting to an ugly const_cast and assuming that the visitor does not actually modify any Stmts.
Am I missing something? Is there a const-alternative to RecursiveASTVisitor?