summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param.cpp
diff options
context:
space:
mode:
authorFelix Berger <flx@google.com>2016-07-05 14:40:44 +0000
committerFelix Berger <flx@google.com>2016-07-05 14:40:44 +0000
commit17934da767c7d2a0ad727a2513aac9132819ee4e (patch)
treec78821326cb1286ec97e2017795e66293fae0773 /clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param.cpp
parenta9cd6aa895f7740cb7a125f3f45201c6402a6f4c (diff)
downloadbcm5719-llvm-17934da767c7d2a0ad727a2513aac9132819ee4e.tar.gz
bcm5719-llvm-17934da767c7d2a0ad727a2513aac9132819ee4e.zip
[clang-tidy] UnnecessaryValueParamCheck - only warn for virtual methods
Summary: As changing virtual methods could break method overrides disable applying the fix and just warn. Reviewers: alexfh, sbenza Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21936 llvm-svn: 274552
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.cpp13
1 files changed, 13 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 48440e8615c..e33f44927ee 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
@@ -182,6 +182,19 @@ struct NegativeOverriddenMethod : public VirtualMethod {
}
};
+struct VirtualMethodWarningOnly {
+ virtual void methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+ // CHECK-MESSAGES: [[@LINE-1]]:66: warning: the parameter 'T' is copied
+ // CHECK-FIXES: virtual void methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
+ virtual ~VirtualMethodWarningOnly() {}
+};
+
+struct PositiveNonVirualMethod {
+ void method(const ExpensiveToCopyType T) {}
+ // CHECK-MESSAGES: [[@LINE-1]]:41: warning: the const qualified parameter 'T' is copied
+ // CHECK-FIXES: void method(const ExpensiveToCopyType& T) {}
+};
+
struct NegativeDeletedMethod {
~NegativeDeletedMethod() {}
NegativeDeletedMethod& operator=(NegativeDeletedMethod N) = delete;
OpenPOWER on IntegriCloud