Skip to content

Commit 211525a

Browse files
Make simplify_expr take copy instead of reference
The implementation will make a copy of the argument anyway. This makes it explicit in the type and allow the use of move by the caller which avoids a copy.
1 parent 863d199 commit 211525a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/util/simplify_expr.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,9 +2574,8 @@ bool simplify(exprt &expr, const namespacet &ns)
25742574
return simplify_exprt(ns).simplify(expr);
25752575
}
25762576

2577-
exprt simplify_expr(const exprt &src, const namespacet &ns)
2577+
exprt simplify_expr(exprt src, const namespacet &ns)
25782578
{
2579-
exprt tmp=src;
2580-
simplify_exprt(ns).simplify(tmp);
2581-
return tmp;
2579+
simplify_exprt(ns).simplify(src);
2580+
return src;
25822581
}

src/util/simplify_expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ bool simplify(
2525
const namespacet &ns);
2626

2727
// this is the preferred interface
28-
exprt simplify_expr(const exprt &src, const namespacet &ns);
28+
exprt simplify_expr(exprt src, const namespacet &ns);
2929

3030
#endif // CPROVER_UTIL_SIMPLIFY_EXPR_H

0 commit comments

Comments
 (0)