From e4ab0602f214dda9955a07aa8fc7ea4e68e5a867 Mon Sep 17 00:00:00 2001 From: Felix Berger Date: Fri, 2 Dec 2016 14:44:16 +0000 Subject: [clang-tidy] Do not trigger unnecessary-value-param check on methods marked as final Summary: Virtual method overrides of dependent types cannot be recognized unless they are marked as override or final. Exclude methods marked as final from check and add test. Reviewers: sbenza, hokein, alexfh Subscribers: malcolm.parsons, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D27248 llvm-svn: 288502 --- .../clang-tidy/performance-unnecessary-value-param.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param.cpp') diff --git a/clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param.cpp b/clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param.cpp index 3da15a359c8..5f7a4dd91d4 100644 --- a/clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param.cpp +++ b/clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param.cpp @@ -271,3 +271,21 @@ void PositiveMessageAndFixAsFunctionIsCalled(ExpensiveToCopyType A) { 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 {} +}; -- cgit v1.2.3