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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 07:04:21 PST 2024


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

Urgh, yeah... our const correctness with the recursive AST visitor is... bad.  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.  our parameters would have a lot of `add_const_if<DeclRefExpr, IsConst>` (where `add_const_if` is a new template we would need to add, and `IsConst` is the template parameter I referred to).

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


More information about the cfe-commits mailing list