Index: clang-tidy/modernize/PassByValueCheck.cpp =================================================================== --- clang-tidy/modernize/PassByValueCheck.cpp +++ clang-tidy/modernize/PassByValueCheck.cpp @@ -45,6 +45,21 @@ return false; } +/// \brief Matches non-copy constructors. +/// +/// Given +/// \code +/// struct Bar { }; +/// struct Foo { Foo(); +/// Foo(const Foo &); +/// Foo(const Bar &); }; +/// \endcode +/// constructorDecl(isNotCopyConstructor()) +/// matches "Foo()" and "Foo(const Bar &)". +AST_MATCHER(CXXConstructorDecl, isNotCopyConstructor) { + return !Node.isCopyConstructor(); +} + static TypeMatcher constRefType() { return lValueReferenceType(pointee(isConstQualified())); } @@ -148,7 +163,7 @@ nonConstValueType())))) .bind("Param")))), hasDeclaration(cxxConstructorDecl( - isCopyConstructor(), unless(isDeleted()), + isNotCopyConstructor(), hasDeclContext( cxxRecordDecl(isMoveConstructible()))))))) .bind("Initializer")))