Index: clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp +++ clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.cpp @@ -159,7 +159,8 @@ parmVarDecl(hasType(matchers::isReferenceToConst()))); auto Matches = match( decl(hasDescendant( - cxxOperatorCallExpr(UsedAsConstRefArg, hasOverloadedOperatorName("=")) + cxxOperatorCallExpr(UsedAsConstRefArg, hasOverloadedOperatorName("="), + callee(cxxMethodDecl(isCopyAssignmentOperator()))) .bind("operatorCallExpr"))), Decl, Context); return !Matches.empty(); Index: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp +++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp @@ -247,6 +247,17 @@ // CHECK-FIXES: F = std::move(E); } +struct NotCopyAssigned { + NotCopyAssigned &operator=(const ExpensiveMovableType &); +}; + +void PositiveNoMoveForNonCopyAssigmentOperator(ExpensiveMovableType E) { + // CHECK-MESSAGES: [[@LINE-1]]:69: warning: the parameter 'E' is copied + // CHECK-FIXES: void PositiveNoMoveForNonCopyAssigmentOperator(const ExpensiveMovableType& E) { + NotCopyAssigned N; + N = E; +} + // The argument could be moved but is not since copy statement is inside a loop. void PositiveNoMoveInsideLoop(ExpensiveMovableType E) { // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the parameter 'E' is copied