Skip to content

Commit 64bf1ca

Browse files
authored
Merge pull request #7793 from sdingcn/develop
Add std::move to reduce redundant copies
2 parents 5ac54be + 00c6e8a commit 64bf1ca

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/goto-harness/function_call_harness_generator.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ Author: Diffblue Ltd.
2121
#include <goto-programs/goto_convert_functions.h>
2222
#include <goto-programs/goto_model.h>
2323

24-
#include <algorithm>
25-
#include <iterator>
26-
#include <set>
27-
2824
#include "function_harness_generator_options.h"
2925
#include "goto_harness_generator_factory.h"
3026
#include "recursive_initialization.h"
3127

28+
#include <algorithm>
29+
#include <iterator>
30+
#include <set>
31+
#include <utility>
32+
3233
/// This contains implementation details of
3334
/// function call harness generator to avoid
3435
/// leaking them out into the header.
@@ -136,7 +137,8 @@ void function_call_harness_generatort::handle_option(
136137
{
137138
equal_param_set.insert(param_id);
138139
}
139-
p_impl->function_parameters_to_treat_equal.push_back(equal_param_set);
140+
p_impl->function_parameters_to_treat_equal.push_back(
141+
std::move(equal_param_set));
140142
}
141143
}
142144
}
@@ -527,7 +529,8 @@ function_call_harness_generatort::implt::declare_arguments(
527529
cluster_argument_names.insert(
528530
parameter_name_to_argument_name[parameter_name]);
529531
}
530-
function_arguments_to_treat_equal.push_back(cluster_argument_names);
532+
function_arguments_to_treat_equal.push_back(
533+
std::move(cluster_argument_names));
531534
}
532535

533536
allocate_objects.declare_created_symbols(function_body);

src/solvers/flattening/bv_utils.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Author: Daniel Kroening, [email protected]
88

99
#include "bv_utils.h"
1010

11+
#include <utility>
12+
1113
bvt bv_utilst::build_constant(const mp_integer &n, std::size_t width)
1214
{
1315
std::string n_str=integer2binary(n, width);
@@ -672,8 +674,8 @@ bvt bv_utilst::wallace_tree(const std::vector<bvt> &pps)
672674
carry(a[bit-1], b[bit-1], c[bit-1]);
673675
}
674676

675-
new_pps.push_back(s);
676-
new_pps.push_back(t);
677+
new_pps.push_back(std::move(s));
678+
new_pps.push_back(std::move(t));
677679
}
678680

679681
// pass onwards up to two remaining partial products

0 commit comments

Comments
 (0)