You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: could be std::move() [performance-lost-std-move]
27
+
// CHECK-FIXES: f(std::move(ptr));
27
28
}
28
29
29
30
voidf_rvalue_ref(std::shared_ptr<int>&& ptr)
30
31
{
31
32
if (*ptr)
32
33
f(ptr);
33
34
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: could be std::move() [performance-lost-std-move]
35
+
// CHECK-FIXES: f(std::move(ptr));
34
36
}
35
37
36
38
using SharedPtr = std::shared_ptr<int>;
@@ -74,6 +76,7 @@ void f_local()
74
76
if (*ptr)
75
77
f(ptr);
76
78
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: could be std::move() [performance-lost-std-move]
79
+
// CHECK-FIXES: f(std::move(ptr));
77
80
}
78
81
79
82
voidf_move()
@@ -131,7 +134,7 @@ void f_cycle4()
131
134
std::shared_ptr<int> ptr;
132
135
do {
133
136
f(ptr);
134
-
} while (*ptr);
137
+
} while (true);
135
138
}
136
139
137
140
intf_multiple_usages()
@@ -145,6 +148,8 @@ int f_macro()
145
148
{
146
149
std::shared_ptr<int> ptr;
147
150
returnFUN(ptr);
151
+
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: could be std::move() [performance-lost-std-move]
152
+
// CHECK-FIXES: return FUN(std::move(ptr));
148
153
}
149
154
150
155
voidf_lambda_ref()
@@ -160,9 +165,8 @@ void f_lambda()
160
165
{
161
166
std::shared_ptr<int> ptr;
162
167
auto Lambda = [ptr]() mutable {
163
-
// CHECK-MESSAGES: [[@LINE-1]]:18: warning: Parameter 'Mov' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-last-use]
164
-
// CHECK-FIXES: auto Lambda = [Mov]() mutable {
165
-
// Note: No fix, because a fix requires c++14.
168
+
// CHECK-MESSAGES: [[@LINE-1]]:18: warning: could be std::move() [performance-lost-std-move]
169
+
// CHECK-FIXES: auto Lambda = [std::move(ptr)]() mutable {
166
170
f(ptr);
167
171
};
168
172
Lambda();
@@ -172,9 +176,8 @@ void f_lambda_assign()
172
176
{
173
177
std::shared_ptr<int> ptr;
174
178
auto Lambda = [ptr = ptr]() mutable {
175
-
// CHECK-MESSAGES: [[@LINE-1]]:18: warning: Parameter 'Mov' is copied on last use, consider moving it instead. [performance-unnecessary-copy-on-last-use]
176
-
// CHECK-FIXES: auto Lambda = [Mov]() mutable {
177
-
// Note: No fix, because a fix requires c++14.
179
+
// CHECK-MESSAGES: [[@LINE-1]]:24: warning: could be std::move() [performance-lost-std-move]
180
+
// CHECK-FIXES: auto Lambda = [ptr = std::move(ptr)]() mutable {
0 commit comments