[clang] [Clang] [NFC] Refactor more AST visitors (PR #116823)

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 07:07:30 PST 2024


================
@@ -266,7 +265,7 @@ class RenameLocFinder : public RecursiveASTVisitor<RenameLocFinder> {
     return true;
   }
 
-  bool VisitDeclRefExpr(const DeclRefExpr *Expr) {
----------------
Sirraide wrote:

> One thing I think we'd be better off doing if we cared to make this change (rather than copy/paste) would be to make `RecursiveASTVistior` take a template parameter that says whether it is const correct-ish and apply it that way.

That still doesn’t work too well for DynamicRecursiveASTVisitor—I guess we could make the template parameter a `bool` and then explicitly instantiate the only two possible instantiations in DynamicRecursiveASTVisitor.cpp...

https://github.com/llvm/llvm-project/pull/116823


More information about the cfe-commits mailing list