1// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- -config="{CheckOptions: {performance-unnecessary-value-param.AllowedTypes: '[Pp]ointer$;[Pp]tr$;[Rr]ef(erence)?$'}}" --
2
3struct SmartPointer {
4 ~SmartPointer();
5};
6
7struct smart_pointer {
8 ~smart_pointer();
9};
10
11struct SmartPtr {
12 ~SmartPtr();
13};
14
15struct smart_ptr {
16 ~smart_ptr();
17};
18
19struct SmartReference {
20 ~SmartReference();
21};
22
23struct smart_reference {
24 ~smart_reference();
25};
26
27struct SmartRef {
28 ~SmartRef();
29};
30
31struct smart_ref {
32 ~smart_ref();
33};
34
35struct OtherType {
36 ~OtherType();
37};
38
39template <typename T> struct SomeComplexTemplate {
40 ~SomeComplexTemplate();
41};
42
43typedef SomeComplexTemplate<int> NotTooComplexRef;
44
45void negativeSmartPointer(SmartPointer P) {
46}
47
48void negative_smart_pointer(smart_pointer p) {
49}
50
51void negativeSmartPtr(SmartPtr P) {
52}
53
54void negative_smart_ptr(smart_ptr p) {
55}
56
57void negativeSmartReference(SmartReference R) {
58}
59
60void negative_smart_reference(smart_reference r) {
61}
62
63void negativeSmartRef(SmartRef R) {
64}
65
66void negative_smart_ref(smart_ref r) {
67}
68
69void positiveOtherType(OtherType O) {
70 // CHECK-MESSAGES: [[@LINE-1]]:34: warning: the parameter 'O' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
71 // CHECK-FIXES: void positiveOtherType(const OtherType& O) {
72}
73
74void negativeNotTooComplexRef(NotTooComplexRef R) {
75}
76

source code of clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-allowed-types.cpp