| Index: tools/clang/pass_to_move/tests/test-original.cc
|
| diff --git a/tools/clang/pass_to_move/tests/test-original.cc b/tools/clang/pass_to_move/tests/test-original.cc
|
| index 06ea9e0833c493c33ac5c2801b5f3f272aee7f62..1e2a96d0b0d2669d4ff367c23ad9f78e5d011d5f 100644
|
| --- a/tools/clang/pass_to_move/tests/test-original.cc
|
| +++ b/tools/clang/pass_to_move/tests/test-original.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 = a1.Pass();
|
|
|
| + // 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 = c.a.Pass();
|
|
|
| + // 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 = e.a->Pass();
|
| +
|
| + // Nested Pass() is handled correctly.
|
| + A a5;
|
| + F f = F(a5.Pass()).Pass();
|
| +
|
| + // 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 = a6.Pass().Pass();
|
| }
|
|
|