================ @@ -273,6 +273,18 @@ void UnnecessaryCopyInitialization::registerMatchers(MatchFinder *Finder) { Finder->addMatcher(LocalVarCopiedFrom(declRefExpr( to(varDecl(hasLocalStorage()).bind(OldVarDeclId)))), this); + + auto DeclRefToConstVar = + declRefExpr(to(varDecl(anyOf(hasType(isConstQualified()), + hasType(references(isConstQualified())))) + .bind(OldVarDeclId))); + Finder->addMatcher( + LocalVarCopiedFrom( + memberExpr(hasObjectExpression(anyOf(hasDescendant(DeclRefToConstVar), ---------------- vbvictor wrote:
Why do we need `hasDescendant`? It's an expensive operation and other matchers seems not to have it. https://github.com/llvm/llvm-project/pull/151936 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits