Index: tools/clang/pass_to_move/tests/test-expected.cc |
diff --git a/tools/clang/pass_to_move/tests/test-expected.cc b/tools/clang/pass_to_move/tests/test-expected.cc |
index 9bd1ab68e75ae5e6cb03f5a3186a21e102d21d5b..65003f88120db3c70788b84ab511d8ce05f3c85b 100644 |
--- a/tools/clang/pass_to_move/tests/test-expected.cc |
+++ b/tools/clang/pass_to_move/tests/test-expected.cc |
@@ -24,19 +24,39 @@ struct E { |
A* a; |
}; |
-void F() { |
+struct F { |
+ explicit F(A&&); |
+ F&& Pass(); |
+}; |
+ |
+void Test() { |
+ // Pass that returns rvalue reference should use std::move. |
A a1; |
A a2 = std::move(a1); |
+ // Pass that doesn't return a rvalue reference should not be rewritten. |
B b1; |
B b2 = b1.Pass(); |
+ // std::move() needs to wrap the entire expression when passing a member. |
C c; |
A a3 = std::move(c.a); |
+ // Don't rewrite things that return rvalue references that aren't named Pass. |
D d1; |
D d2 = d1.NotPass(); |
+ // Pass via a pointer type should dereference the pointer first. |
E e; |
A a4 = std::move(*e.a); |
+ |
+ // Nested Pass() is handled correctly. |
+ A a5; |
+ F f = std::move(F(std::move(a5))); |
+ |
+ // Chained Pass is handled (mostly) correctly. The replacement applier dedupes |
+ // the insertion of std::move, so the result is not completely correct... |
+ // ... but hopefully there's very little code following this broken pattern. |
+ A a6; |
+ A a7 = std::move(a6)); |
} |