Skip to content

Commit

Permalink
Merge pull request #7793 from sdingcn/develop
Browse files Browse the repository at this point in the history
Add std::move to reduce redundant copies
  • Loading branch information
NlightNFotis authored Jul 10, 2023
2 parents 5ac54be + 00c6e8a commit 64bf1ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
15 changes: 9 additions & 6 deletions src/goto-harness/function_call_harness_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ Author: Diffblue Ltd.
#include <goto-programs/goto_convert_functions.h>
#include <goto-programs/goto_model.h>

#include <algorithm>
#include <iterator>
#include <set>

#include "function_harness_generator_options.h"
#include "goto_harness_generator_factory.h"
#include "recursive_initialization.h"

#include <algorithm>
#include <iterator>
#include <set>
#include <utility>

/// This contains implementation details of
/// function call harness generator to avoid
/// leaking them out into the header.
Expand Down Expand Up @@ -136,7 +137,8 @@ void function_call_harness_generatort::handle_option(
{
equal_param_set.insert(param_id);
}
p_impl->function_parameters_to_treat_equal.push_back(equal_param_set);
p_impl->function_parameters_to_treat_equal.push_back(
std::move(equal_param_set));
}
}
}
Expand Down Expand Up @@ -527,7 +529,8 @@ function_call_harness_generatort::implt::declare_arguments(
cluster_argument_names.insert(
parameter_name_to_argument_name[parameter_name]);
}
function_arguments_to_treat_equal.push_back(cluster_argument_names);
function_arguments_to_treat_equal.push_back(
std::move(cluster_argument_names));
}

allocate_objects.declare_created_symbols(function_body);
Expand Down
6 changes: 4 additions & 2 deletions src/solvers/flattening/bv_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Author: Daniel Kroening, kroening@kroening.com

#include "bv_utils.h"

#include <utility>

bvt bv_utilst::build_constant(const mp_integer &n, std::size_t width)
{
std::string n_str=integer2binary(n, width);
Expand Down Expand Up @@ -672,8 +674,8 @@ bvt bv_utilst::wallace_tree(const std::vector<bvt> &pps)
carry(a[bit-1], b[bit-1], c[bit-1]);
}

new_pps.push_back(s);
new_pps.push_back(t);
new_pps.push_back(std::move(s));
new_pps.push_back(std::move(t));
}

// pass onwards up to two remaining partial products
Expand Down

0 comments on commit 64bf1ca

Please sign in to comment.