|
13 | 13 | /// \file util/std_expr.h
|
14 | 14 | /// API to expression classes
|
15 | 15 |
|
| 16 | +#include "as_const.h" |
16 | 17 | #include "expr_cast.h"
|
17 | 18 | #include "invariant.h"
|
18 | 19 | #include "std_types.h"
|
@@ -969,20 +970,20 @@ class multi_ary_exprt : public expr_protectedt
|
969 | 970 | operands() = std::move(_operands);
|
970 | 971 | }
|
971 | 972 |
|
972 |
| - multi_ary_exprt(const exprt &_lhs, const irep_idt &_id, const exprt &_rhs) |
973 |
| - : expr_protectedt(_id, _lhs.type()) |
| 973 | + multi_ary_exprt(exprt _lhs, const irep_idt &_id, exprt _rhs) |
| 974 | + : expr_protectedt(_id, as_const(_lhs).type()) |
974 | 975 | {
|
975 |
| - add_to_operands(_lhs, _rhs); |
| 976 | + add_to_operands(std::move(_lhs), std::move(_rhs)); |
976 | 977 | }
|
977 | 978 |
|
978 | 979 | multi_ary_exprt(
|
979 |
| - const exprt &_lhs, |
| 980 | + exprt _lhs, |
980 | 981 | const irep_idt &_id,
|
981 |
| - const exprt &_rhs, |
| 982 | + exprt _rhs, |
982 | 983 | const typet &_type)
|
983 | 984 | : expr_protectedt(_id, _type)
|
984 | 985 | {
|
985 |
| - add_to_operands(_lhs, _rhs); |
| 986 | + add_to_operands(std::move(_lhs), std::move(_rhs)); |
986 | 987 | }
|
987 | 988 |
|
988 | 989 | // In contrast to exprt::opX, the methods
|
@@ -1069,18 +1070,13 @@ class plus_exprt:public multi_ary_exprt
|
1069 | 1070 | {
|
1070 | 1071 | }
|
1071 | 1072 |
|
1072 |
| - plus_exprt( |
1073 |
| - const exprt &_lhs, |
1074 |
| - const exprt &_rhs): |
1075 |
| - multi_ary_exprt(_lhs, ID_plus, _rhs) |
| 1073 | + plus_exprt(exprt _lhs, exprt _rhs) |
| 1074 | + : multi_ary_exprt(std::move(_lhs), ID_plus, std::move(_rhs)) |
1076 | 1075 | {
|
1077 | 1076 | }
|
1078 | 1077 |
|
1079 |
| - plus_exprt( |
1080 |
| - const exprt &_lhs, |
1081 |
| - const exprt &_rhs, |
1082 |
| - const typet &_type): |
1083 |
| - multi_ary_exprt(_lhs, ID_plus, _rhs, _type) |
| 1078 | + plus_exprt(exprt _lhs, exprt _rhs, const typet &_type) |
| 1079 | + : multi_ary_exprt(_lhs, ID_plus, _rhs, _type) |
1084 | 1080 | {
|
1085 | 1081 | }
|
1086 | 1082 |
|
@@ -1187,10 +1183,8 @@ class mult_exprt:public multi_ary_exprt
|
1187 | 1183 | {
|
1188 | 1184 | }
|
1189 | 1185 |
|
1190 |
| - mult_exprt( |
1191 |
| - const exprt &_lhs, |
1192 |
| - const exprt &_rhs): |
1193 |
| - multi_ary_exprt(_lhs, ID_mult, _rhs) |
| 1186 | + mult_exprt(exprt _lhs, exprt _rhs) |
| 1187 | + : multi_ary_exprt(std::move(_lhs), ID_mult, std::move(_rhs)) |
1194 | 1188 | {
|
1195 | 1189 | }
|
1196 | 1190 | };
|
@@ -2410,22 +2404,24 @@ class and_exprt:public multi_ary_exprt
|
2410 | 2404 | {
|
2411 | 2405 | }
|
2412 | 2406 |
|
2413 |
| - and_exprt(const exprt &op0, const exprt &op1): |
2414 |
| - multi_ary_exprt(op0, ID_and, op1, bool_typet()) |
| 2407 | + and_exprt(exprt op0, exprt op1) |
| 2408 | + : multi_ary_exprt(std::move(op0), ID_and, std::move(op1), bool_typet()) |
2415 | 2409 | {
|
2416 | 2410 | }
|
2417 | 2411 |
|
2418 |
| - and_exprt(const exprt &op0, const exprt &op1, const exprt &op2) |
2419 |
| - : multi_ary_exprt(ID_and, {op0, op1, op2}, bool_typet()) |
| 2412 | + and_exprt(exprt op0, exprt op1, exprt op2) |
| 2413 | + : multi_ary_exprt( |
| 2414 | + ID_and, |
| 2415 | + {std::move(op0), std::move(op1), std::move(op2)}, |
| 2416 | + bool_typet()) |
2420 | 2417 | {
|
2421 | 2418 | }
|
2422 | 2419 |
|
2423 |
| - and_exprt( |
2424 |
| - const exprt &op0, |
2425 |
| - const exprt &op1, |
2426 |
| - const exprt &op2, |
2427 |
| - const exprt &op3) |
2428 |
| - : multi_ary_exprt(ID_and, {op0, op1, op2, op3}, bool_typet()) |
| 2420 | + and_exprt(exprt op0, exprt op1, exprt op2, exprt op3) |
| 2421 | + : multi_ary_exprt( |
| 2422 | + ID_and, |
| 2423 | + {std::move(op0), std::move(op1), std::move(op2), std::move(op3)}, |
| 2424 | + bool_typet()) |
2429 | 2425 | {
|
2430 | 2426 | }
|
2431 | 2427 |
|
@@ -2526,22 +2522,24 @@ class or_exprt:public multi_ary_exprt
|
2526 | 2522 | {
|
2527 | 2523 | }
|
2528 | 2524 |
|
2529 |
| - or_exprt(const exprt &op0, const exprt &op1): |
2530 |
| - multi_ary_exprt(op0, ID_or, op1, bool_typet()) |
| 2525 | + or_exprt(exprt op0, exprt op1) |
| 2526 | + : multi_ary_exprt(std::move(op0), ID_or, std::move(op1), bool_typet()) |
2531 | 2527 | {
|
2532 | 2528 | }
|
2533 | 2529 |
|
2534 |
| - or_exprt(const exprt &op0, const exprt &op1, const exprt &op2) |
2535 |
| - : multi_ary_exprt(ID_or, {op0, op1, op2}, bool_typet()) |
| 2530 | + or_exprt(exprt op0, exprt op1, exprt op2) |
| 2531 | + : multi_ary_exprt( |
| 2532 | + ID_or, |
| 2533 | + {std::move(op0), std::move(op1), std::move(op2)}, |
| 2534 | + bool_typet()) |
2536 | 2535 | {
|
2537 | 2536 | }
|
2538 | 2537 |
|
2539 |
| - or_exprt( |
2540 |
| - const exprt &op0, |
2541 |
| - const exprt &op1, |
2542 |
| - const exprt &op2, |
2543 |
| - const exprt &op3) |
2544 |
| - : multi_ary_exprt(ID_or, {op0, op1, op2, op3}, bool_typet()) |
| 2538 | + or_exprt(exprt op0, exprt op1, exprt op2, exprt op3) |
| 2539 | + : multi_ary_exprt( |
| 2540 | + ID_or, |
| 2541 | + {std::move(op0), std::move(op1), std::move(op2), std::move(op3)}, |
| 2542 | + bool_typet()) |
2545 | 2543 | {
|
2546 | 2544 | }
|
2547 | 2545 |
|
|
0 commit comments