CodeMod: future-then-continuation-lvalue-ref

Summary:
CodeMod: `future-then-continuation-lvalue-ref`.

```
buck run mode/opt foundation/clangr:clangr_coordinator -- run foundation/clang/codemods:future-then-continuation-lvalue-ref --dev -p 7 --num-workers=200
```

There is no need to support continuations taking non-const lvalue-ref params; callers can get exactly the same semantics with non-const rvalue-ref params instead. Thsi codemod preserves semantics. Many of these cases could do just as well taking by value, but this codemod preserves semantics.

Reviewed By: Orvid

Differential Revision: D8166008

fbshipit-source-id: 84b635cccce24b6485ffb5b24b98f10422b9a517
This commit is contained in:
Yedidya Feldblum 2018-05-30 12:29:11 -07:00 committed by Facebook Github Bot
parent deee232d74
commit 96af55472f

View File

@ -115,7 +115,7 @@ Future<Unit> TreeDiffer::diffCommits(Hash hash1, Hash hash2) {
return collect(future1, future2) return collect(future1, future2)
.then([this](std::tuple< .then([this](std::tuple<
std::shared_ptr<const Tree>, std::shared_ptr<const Tree>,
std::shared_ptr<const Tree>>& tup) { std::shared_ptr<const Tree>>&& tup) {
auto tree1 = std::get<0>(tup); auto tree1 = std::get<0>(tup);
auto tree2 = std::get<1>(tup); auto tree2 = std::get<1>(tup);
return diffTrees(RelativePathPiece{}, *tree1, *tree2); return diffTrees(RelativePathPiece{}, *tree1, *tree2);
@ -135,7 +135,7 @@ TreeDiffer::diffTrees(RelativePathPiece path, Hash hash1, Hash hash2) {
return folly::collect(treeFuture1, treeFuture2) return folly::collect(treeFuture1, treeFuture2)
.then([this, path = path.copy()](std::tuple< .then([this, path = path.copy()](std::tuple<
std::shared_ptr<const Tree>, std::shared_ptr<const Tree>,
std::shared_ptr<const Tree>>& tup) { std::shared_ptr<const Tree>>&& tup) {
auto tree1 = std::get<0>(tup); auto tree1 = std::get<0>(tup);
auto tree2 = std::get<1>(tup); auto tree2 = std::get<1>(tup);
return diffTrees(path, *tree1, *tree2); return diffTrees(path, *tree1, *tree2);