================ @@ -62,6 +62,16 @@ AST_MATCHER(CXXMethodDecl, usesThis) { return false; // Stop traversal. } + bool VisitDeclRefExpr(const DeclRefExpr *E) { + if (const auto *PVD = dyn_cast_if_present<ParmVarDecl>(E->getDecl()); + PVD && PVD->isExplicitObjectParameter()) { + Used = true; + return false; // Stop traversal. + } + + return true; + } ---------------- vbvictor wrote:
I think we should not introduce a new method in `RecursiveASTVisitor`. As for now, you would traverse every `DeclRefExpr` in function body trying to `dyn_cast` which is not efficient. Instead, We should only check for `this` in methods parameters, so you can write ```cpp Finder->addMatcher( cxxMethodDecl( isDefinition(), isUserProvided(), unless(anyOf( hasAnyParameter(isExplicitObjectParameter()) ``` https://github.com/llvm/llvm-project/pull/141391 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits