Skip to content

Commit 6f24efd

Browse files
Do not pass-by-value if unnecessary
Remove unnecessary copying of expressions.
1 parent 9b19704 commit 6f24efd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/goto-symex/solver_hardness.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bool solver_hardnesst::assertion_statst::empty() const
4444

4545
void solver_hardnesst::register_ssa(
4646
std::size_t ssa_index,
47-
const exprt ssa_expression,
47+
const exprt &ssa_expression,
4848
goto_programt::const_targett pc)
4949
{
5050
PRECONDITION(ssa_index < hardness_stats.size());
@@ -73,7 +73,7 @@ void solver_hardnesst::register_ssa_size(std::size_t size)
7373
}
7474

7575
void solver_hardnesst::register_assertion_ssas(
76-
const exprt ssa_expression,
76+
const exprt &ssa_expression,
7777
const std::vector<goto_programt::const_targett> &pcs)
7878
{
7979
if(assertion_stats.empty())
@@ -378,7 +378,7 @@ solver_hardnesst::goto_instruction2string(goto_programt::const_targett pc)
378378
return out.str();
379379
}
380380

381-
std::string solver_hardnesst::expr2string(const exprt expr)
381+
std::string solver_hardnesst::expr2string(const exprt &expr)
382382
{
383383
std::stringstream ss;
384384
ss << format(expr);

src/goto-symex/solver_hardness.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ struct solver_hardnesst : public clause_hardness_collectort
8282
/// \param pc: the GOTO instruction iterator for this SSA step
8383
void register_ssa(
8484
std::size_t ssa_index,
85-
const exprt ssa_expression,
85+
const exprt &ssa_expression,
8686
goto_programt::const_targett pc);
8787

8888
void register_ssa_size(std::size_t size);
@@ -95,7 +95,7 @@ struct solver_hardnesst : public clause_hardness_collectort
9595
/// \param pcs: all GOTO instruction iterators that contributed in the
9696
/// disjunction
9797
void register_assertion_ssas(
98-
const exprt ssa_expression,
98+
const exprt &ssa_expression,
9999
const std::vector<goto_programt::const_targett> &pcs);
100100

101101
/// Called e.g. from the `satcheck_minisat2::lcnf`, this function adds the
@@ -130,7 +130,7 @@ struct solver_hardnesst : public clause_hardness_collectort
130130
// A minor modification of \ref goto_programt::output_instruction
131131
static std::string goto_instruction2string(goto_programt::const_targett pc);
132132

133-
static std::string expr2string(const exprt expr);
133+
static std::string expr2string(const exprt &expr);
134134

135135
std::string outfile;
136136
std::vector<std::unordered_map<hardness_ssa_keyt, sat_hardnesst>>

0 commit comments

Comments
 (0)