Skip to content

Commit 46eadfa

Browse files
author
Daniel Kroening
committed
avoid access to exprt::opX()
This commit replaces exprt::opX by named access methods; this will eventually enable us to protect exprt::opX().
1 parent 8474807 commit 46eadfa

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/solvers/flattening/arrays.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ void arrayst::add_array_constraints_with(
546546
{
547547
const typet &subtype = expr.type().subtype();
548548
index_exprt index_expr1(expr, other_index, subtype);
549-
index_exprt index_expr2(expr.op0(), other_index, subtype);
549+
index_exprt index_expr2(expr.old(), other_index, subtype);
550550

551551
equal_exprt equality_expr(index_expr1, index_expr2);
552552

@@ -646,12 +646,12 @@ void arrayst::add_array_constraints_array_of(
646646
index_exprt index_expr(expr, index, subtype);
647647

648648
DATA_INVARIANT(
649-
base_type_eq(index_expr.type(), expr.op0().type(), ns),
649+
base_type_eq(index_expr.type(), expr.what().type(), ns),
650650
"array_of operand type should match array element type");
651651

652652
// add constraint
653653
lazy_constraintt lazy(
654-
lazy_typet::ARRAY_OF, equal_exprt(index_expr, expr.op0()));
654+
lazy_typet::ARRAY_OF, equal_exprt(index_expr, expr.what()));
655655
add_array_constraint(lazy, false); // added immediately
656656
}
657657
}

src/solvers/flattening/boolbv_array_of.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bvt boolbvt::convert_array_of(const array_of_exprt &expr)
4242
if(to_integer(array_size, size))
4343
return conversion_failed(expr);
4444

45-
const bvt &tmp=convert_bv(expr.op0());
45+
const bvt &tmp = convert_bv(expr.what());
4646

4747
INVARIANT(
4848
size * tmp.size() == width,

src/solvers/smt2/smt2_conv.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3361,11 +3361,11 @@ void smt2_convt::convert_floatbv_div(const ieee_float_op_exprt &expr)
33613361
if(use_FPA_theory)
33623362
{
33633363
out << "(fp.div ";
3364-
convert_rounding_mode_FPA(expr.op2());
3364+
convert_rounding_mode_FPA(expr.rounding_mode());
33653365
out << " ";
3366-
convert_expr(expr.op0());
3366+
convert_expr(expr.lhs());
33673367
out << " ";
3368-
convert_expr(expr.op1());
3368+
convert_expr(expr.rhs());
33693369
out << ")";
33703370
}
33713371
else
@@ -3555,8 +3555,8 @@ void smt2_convt::convert_with(const with_exprt &expr)
35553555
{
35563556
const struct_typet &struct_type = to_struct_type(ns.follow(expr_type));
35573557

3558-
const exprt &index=expr.op1();
3559-
const exprt &value=expr.op2();
3558+
const exprt &index = expr.where();
3559+
const exprt &value = expr.new_value();
35603560

35613561
const irep_idt &component_name=index.get(ID_component_name);
35623562

@@ -3569,7 +3569,7 @@ void smt2_convt::convert_with(const with_exprt &expr)
35693569
const std::string &smt_typename = datatype_map.at(expr_type);
35703570

35713571
out << "(update-" << smt_typename << "." << component_name << " ";
3572-
convert_expr(expr.op0());
3572+
convert_expr(expr.old());
35733573
out << " ";
35743574
convert_expr(value);
35753575
out << ")";
@@ -3583,7 +3583,7 @@ void smt2_convt::convert_with(const with_exprt &expr)
35833583
boolbv_width.get_member(struct_type, component_name);
35843584

35853585
out << "(let ((?withop ";
3586-
convert_expr(expr.op0());
3586+
convert_expr(expr.old());
35873587
out << ")) ";
35883588

35893589
if(m.width==struct_width)
@@ -3626,7 +3626,7 @@ void smt2_convt::convert_with(const with_exprt &expr)
36263626
{
36273627
const union_typet &union_type = to_union_type(ns.follow(expr_type));
36283628

3629-
const exprt &value=expr.op2();
3629+
const exprt &value = expr.new_value();
36303630

36313631
std::size_t total_width=boolbv_width(union_type);
36323632
CHECK_RETURN_WITH_DIAGNOSTICS(
@@ -3651,7 +3651,7 @@ void smt2_convt::convert_with(const with_exprt &expr)
36513651
out << "((_ extract "
36523652
<< (total_width-1)
36533653
<< " " << member_width << ") ";
3654-
convert_expr(expr.op0());
3654+
convert_expr(expr.old());
36553655
out << ") ";
36563656
flatten2bv(value);
36573657
out << ")";

src/util/simplify_expr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,7 +1889,7 @@ bool simplify_exprt::simplify_byte_update(byte_update_exprt &expr)
18891889
exprt compo_offset = from_integer(*i, offset.type());
18901890
plus_exprt new_offset(offset, compo_offset);
18911891
simplify_node(new_offset);
1892-
exprt new_value(with.op2());
1892+
exprt new_value(with.new_value());
18931893
expr.op1().swap(new_offset);
18941894
expr.op2().swap(new_value);
18951895
simplify_byte_update(expr); // do this recursively
@@ -1916,7 +1916,7 @@ bool simplify_exprt::simplify_byte_update(byte_update_exprt &expr)
19161916

19171917
plus_exprt new_offset(offset, index_offset);
19181918
simplify_node(new_offset);
1919-
exprt new_value(with.op2());
1919+
exprt new_value(with.new_value());
19201920
expr.op1().swap(new_offset);
19211921
expr.op2().swap(new_value);
19221922
simplify_byte_update(expr); // do this recursively

0 commit comments

Comments
 (0)