Index: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp @@ -61,7 +61,8 @@ unless(referenceType())))), decl().bind("param")); Finder->addMatcher( - functionDecl(isDefinition(), unless(cxxMethodDecl(isOverride())), + functionDecl(isDefinition(), + unless(cxxMethodDecl(anyOf(isOverride(), isFinal()))), unless(isInstantiated()), has(typeLoc(forEach(ExpensiveValueParamDecl))), decl().bind("functionDecl")), 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 @@ -271,3 +271,21 @@ void ReferenceFunctionByCallingIt() { PositiveMessageAndFixAsFunctionIsCalled(ExpensiveToCopyType()); } + +// Virtual method overrides of dependent types cannot be recognized unless they +// are marked as override or final. Test that check is not triggered on methods +// marked with override or final. +template +struct NegativeDependentTypeInterface { + virtual void Method(ExpensiveToCopyType E) = 0; +}; + +template +struct NegativeOverrideImpl : public NegativeDependentTypeInterface { + void Method(ExpensiveToCopyType E) override {} +}; + +template +struct NegativeFinalImpl : public NegativeDependentTypeInterface { + void Method(ExpensiveToCopyType E) final {} +};