@@ -32,19 +32,19 @@ struct A {
3232Movable GlobalObj;
3333struct B {
3434 B (const Movable &M) : M(GlobalObj) {}
35- // CHECK-FIXES: B(const Movable &M) : M(GlobalObj) {}
35+ // CHECK-MESSAGES-NOT: :[[@LINE-1]]:5: warning: pass by value and use std::move
3636 Movable M;
3737};
3838
3939// Test that a parameter with more than one reference to it won't be changed.
4040struct C {
4141 // Tests extra-reference in body.
4242 C (const Movable &M) : M(M) { this ->i = M.a ; }
43- // CHECK-FIXES: C(const Movable &M) : M(M) { this->i = M.a; }
43+ // CHECK-MESSAGES-NOT: :[[@LINE-1]]:5: warning: pass by value and use std::move
4444
4545 // Tests extra-reference in init-list.
4646 C (const Movable &M, int ) : M(M), i(M.a) {}
47- // CHECK-FIXES: C(const Movable &M, int) : M(M), i(M.a) {}
47+ // CHECK-MESSAGES-NOT: :[[@LINE-1]]:5: warning: pass by value and use std::move
4848 Movable M;
4949 int i;
5050};
@@ -70,7 +70,7 @@ struct E {
7070// Test with object that can't be moved.
7171struct F {
7272 F (const NotMovable &NM) : NM(NM) {}
73- // CHECK-FIXES: F(const NotMovable &NM) : NM(NM) {}
73+ // CHECK-MESSAGES-NOT: :[[@LINE-1]]:5: warning: pass by value and use std::move
7474 NotMovable NM;
7575};
7676
@@ -112,7 +112,8 @@ struct I {
112112// Test that templates aren't modified.
113113template <typename T> struct J {
114114 J (const T &M) : M(M) {}
115- // CHECK-FIXES: J(const T &M) : M(M) {}
115+ // CHECK-MESSAGES-NOT: :[[@LINE-1]]:5: warning: pass by value and use std::move
116+ // CHECK-FIXES-NOT: J(T M) : M(std::move(M)) {}
116117 T M;
117118};
118119J<Movable> j1 (Movable());
@@ -129,13 +130,14 @@ struct MovableTemplateT
129130template <class T >
130131struct J2 {
131132 J2 (const MovableTemplateT<T>& A);
132- // CHECK-FIXES: J2(const MovableTemplateT<T>& A);
133+ // CHECK-FIXES-NOT : J2(MovableTemplateT<T> A);
133134 MovableTemplateT<T> M;
134135};
135136
136137template <class T >
137138J2<T>::J2(const MovableTemplateT<T>& A) : M(A) {}
138- // CHECK-FIXES: J2<T>::J2(const MovableTemplateT<T>& A) : M(A) {}
139+ // CHECK-MESSAGES-NOT: :[[@LINE-1]]:11: warning: pass by value and use std::move
140+ // CHECK-FIXES-NOT: J2<T>::J2(MovableTemplateT<T> A) : M(std::move(A)) {}
139141J2<int > j3 (MovableTemplateT<int >{});
140142
141143struct K_Movable {
@@ -182,7 +184,7 @@ struct O {
182184// Test with a const-value parameter.
183185struct P {
184186 P (const Movable M) : M(M) {}
185- // CHECK-FIXES: P(const Movable M) : M(M) {}
187+ // CHECK-MESSAGES-NOT: :[[@LINE-1]]:5: warning: pass by value and use std::move
186188 Movable M;
187189};
188190
@@ -215,7 +217,7 @@ struct R {
215217// Test with rvalue parameter.
216218struct S {
217219 S (Movable &&M) : M(M) {}
218- // CHECK-FIXES: S(Movable &&M) : M(M) {}
220+ // CHECK-MESSAGES-NOT: :[[@LINE-1]]:5: warning: pass by value and use std::move
219221 Movable M;
220222};
221223
@@ -225,13 +227,13 @@ template <typename T, int N> struct array { T A[N]; };
225227// cause problems with performance-move-const-arg, as it will revert it.
226228struct T {
227229 T (array<int , 10 > a) : a_(a) {}
228- // CHECK-FIXES: T(array<int, 10> a) : a_(a) {}
230+ // CHECK-MESSAGES-NOT: :[[@LINE-1]]:5: warning: pass by value and use std::move
229231 array<int , 10 > a_;
230232};
231233
232234struct U {
233235 U (const POD &M) : M(M) {}
234- // CHECK-FIXES: U(const POD &M) : M(M) {}
236+ // CHECK-MESSAGES-NOT: :[[@LINE-1]]:5: warning: pass by value and use std::move
235237 POD M;
236238};
237239
0 commit comments