diff options
author | Malcolm Parsons <malcolm.parsons@gmail.com> | 2017-01-23 13:18:08 +0000 |
---|---|---|
committer | Malcolm Parsons <malcolm.parsons@gmail.com> | 2017-01-23 13:18:08 +0000 |
commit | 3de05a2fdaaaebe74954fe3368437003d9cfe803 (patch) | |
tree | 9541ad945159e4ec20faf40e8b3c76461f72d952 /clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param.cpp | |
parent | e33d2ce8e32e300c0cfb0e82943e3dd49730baba (diff) | |
download | bcm5719-llvm-3de05a2fdaaaebe74954fe3368437003d9cfe803.tar.gz bcm5719-llvm-3de05a2fdaaaebe74954fe3368437003d9cfe803.zip |
[clang-tidy] Ignore implicit functions in performance-unnecessary-value-param
Summary:
The performance-unnecessary-value-param check mangled inherited
constructors, as the constructors' parameters do not have useful source
locations. Fix this by ignoring implicit functions.
Fixes PR31684.
Reviewers: flx, alexfh, aaron.ballman
Subscribers: madsravn, JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D29018
llvm-svn: 292786
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
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 dfd545ab2b7..5491cbb80c0 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 @@ -331,3 +331,20 @@ template <typename T> struct NegativeFinalImpl : public NegativeDependentTypeInterface<T> { void Method(ExpensiveToCopyType E) final {} }; + +struct PositiveConstructor { + PositiveConstructor(ExpensiveToCopyType E) : E(E) {} + // CHECK-MESSAGES: [[@LINE-1]]:43: warning: the parameter 'E' is copied + // CHECK-FIXES: PositiveConstructor(const ExpensiveToCopyType& E) : E(E) {} + + ExpensiveToCopyType E; +}; + +struct NegativeUsingConstructor : public PositiveConstructor { + using PositiveConstructor::PositiveConstructor; +}; + +void fun() { + ExpensiveToCopyType E; + NegativeUsingConstructor S(E); +} |