Skip to content

Commit 3fb39c0

Browse files
committed
Remove unnecessary use of ns.follow in smt2_convt
1 parent 122a905 commit 3fb39c0

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/solvers/smt2/smt2_conv.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void smt2_convt::define_object_size(
148148

149149
for(const auto &o : pointer_logic.objects)
150150
{
151-
const typet &type = ns.follow(o.type());
151+
const typet &type = o.type();
152152
exprt size_expr = size_of_expr(type, ns);
153153
mp_integer object_size;
154154

@@ -557,7 +557,7 @@ void smt2_convt::convert_address_of_rec(
557557
const member_exprt &member_expr=to_member_expr(expr);
558558

559559
const exprt &struct_op=member_expr.struct_op();
560-
const typet &struct_op_type=ns.follow(struct_op.type());
560+
const typet &struct_op_type=struct_op.type();
561561

562562
DATA_INVARIANT(
563563
struct_op_type.id() == ID_struct || struct_op_type.id() == ID_struct_tag,
@@ -1918,11 +1918,11 @@ void smt2_convt::convert_typecast(const typecast_exprt &expr)
19181918
{
19191919
const exprt &src = expr.op();
19201920

1921-
typet dest_type=ns.follow(expr.type());
1921+
typet dest_type=expr.type();
19221922
if(dest_type.id()==ID_c_enum_tag)
19231923
dest_type=ns.follow_tag(to_c_enum_tag_type(dest_type));
19241924

1925-
typet src_type=ns.follow(src.type());
1925+
typet src_type=src.type();
19261926
if(src_type.id()==ID_c_enum_tag)
19271927
src_type=ns.follow_tag(to_c_enum_tag_type(src_type));
19281928

@@ -2621,7 +2621,7 @@ void smt2_convt::convert_struct(const struct_exprt &expr)
26212621
exprt op=expr.operands()[i-1];
26222622

26232623
// may need to flatten array-theory arrays in there
2624-
if(ns.follow(op.type()).id()==ID_array)
2624+
if(op.type().id()==ID_array)
26252625
flatten_array(op);
26262626
else
26272627
convert_expr(op);
@@ -2641,7 +2641,7 @@ void smt2_convt::convert_struct(const struct_exprt &expr)
26412641
void smt2_convt::flatten_array(const exprt &expr)
26422642
{
26432643
const array_typet &array_type=
2644-
to_array_type(ns.follow(expr.type()));
2644+
to_array_type(expr.type());
26452645

26462646
mp_integer size = numeric_cast_v<mp_integer>(array_type.size());
26472647
CHECK_RETURN_WITH_DIAGNOSTICS(size != 0, "can't convert zero-sized array");
@@ -3495,7 +3495,7 @@ void smt2_convt::convert_with(const with_exprt &expr)
34953495
"with expression should have been converted to a version with three "
34963496
"operands above");
34973497

3498-
const typet &expr_type=ns.follow(expr.type());
3498+
const typet &expr_type=expr.type();
34993499

35003500
if(expr_type.id()==ID_array)
35013501
{
@@ -3727,15 +3727,15 @@ void smt2_convt::convert_update(const exprt &expr)
37273727

37283728
void smt2_convt::convert_index(const index_exprt &expr)
37293729
{
3730-
const typet &array_op_type=ns.follow(expr.array().type());
3730+
const typet &array_op_type=expr.array().type();
37313731

37323732
if(array_op_type.id()==ID_array)
37333733
{
37343734
const array_typet &array_type=to_array_type(array_op_type);
37353735

37363736
if(use_array_theory(expr.array()))
37373737
{
3738-
if(ns.follow(expr.type()).id()==ID_bool && !use_array_of_bool)
3738+
if(expr.type().id()==ID_bool && !use_array_of_bool)
37393739
{
37403740
out << "(= ";
37413741
out << "(select ";
@@ -3827,7 +3827,7 @@ void smt2_convt::convert_member(const member_exprt &expr)
38273827
{
38283828
const member_exprt &member_expr=to_member_expr(expr);
38293829
const exprt &struct_op=member_expr.struct_op();
3830-
const typet &struct_op_type=ns.follow(struct_op.type());
3830+
const typet &struct_op_type=struct_op.type();
38313831
const irep_idt &name=member_expr.get_component_name();
38323832

38333833
if(struct_op_type.id() == ID_struct || struct_op_type.id() == ID_struct_tag)
@@ -3886,7 +3886,7 @@ void smt2_convt::convert_member(const member_exprt &expr)
38863886

38873887
void smt2_convt::flatten2bv(const exprt &expr)
38883888
{
3889-
const typet &type=ns.follow(expr.type());
3889+
const typet &type=expr.type();
38903890

38913891
if(type.id()==ID_bool)
38923892
{
@@ -4382,9 +4382,8 @@ void smt2_convt::find_symbols(const exprt &expr)
43824382

43834383
bool smt2_convt::use_array_theory(const exprt &expr)
43844384
{
4385-
const typet &type=ns.follow(expr.type());
4385+
const typet &type=expr.type();
43864386
PRECONDITION(type.id()==ID_array);
4387-
// const array_typet &array_type=to_array_type(ns.follow(expr.type()));
43884387

43894388
if(use_datatypes)
43904389
{
@@ -4410,7 +4409,7 @@ void smt2_convt::convert_type(const typet &type)
44104409
CHECK_RETURN(array_type.size().is_not_nil());
44114410

44124411
// we always use array theory for top-level arrays
4413-
const typet &subtype=ns.follow(array_type.subtype());
4412+
const typet &subtype=array_type.subtype();
44144413

44154414
out << "(Array ";
44164415
convert_type(array_type.size().type());

0 commit comments

Comments
 (0)