Skip to content

Commit d10aabd

Browse files
author
Daniel Kroening
committed
remove base_type_eq and type_eq
These are no longer needed, as symbol_type is no longer in use.
1 parent ddbefaa commit d10aabd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+163
-684
lines changed

jbmc/unit/java-testing-utils/require_type.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Author: Diffblue Ltd.
99
#include "require_type.h"
1010

1111
#include <testing-utils/use_catch.h>
12-
#include <util/base_type.h>
1312
#include <util/namespace.h>
1413
#include <util/symbol_table.h>
1514

@@ -26,10 +25,8 @@ pointer_typet require_type::require_pointer(
2625
const pointer_typet &pointer = to_pointer_type(type);
2726

2827
if(subtype)
29-
{
30-
namespacet ns{symbol_tablet{}};
31-
base_type_eq(pointer.subtype(), subtype.value(), ns);
32-
}
28+
REQUIRE(pointer.subtype() == subtype.value());
29+
3330
return pointer;
3431
}
3532

src/analyses/constant_propagator.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Author: Peter Schrammel
1717
#endif
1818

1919
#include <util/arith_tools.h>
20-
#include <util/base_type.h>
2120
#include <util/c_types.h>
2221
#include <util/cprover_prefix.h>
2322
#include <util/expr_util.h>
@@ -103,7 +102,7 @@ void constant_propagator_domaint::assign_rec(
103102
if(dest_values.is_constant(tmp))
104103
{
105104
DATA_INVARIANT(
106-
base_type_eq(ns.lookup(s).type, tmp.type(), ns),
105+
ns.lookup(s).type == tmp.type(),
107106
"type of constant to be replaced should match");
108107
dest_values.set_to(s, tmp);
109108
}
@@ -623,7 +622,7 @@ bool constant_propagator_domaint::valuest::meet(
623622
{
624623
const typet &m_id_type = ns.lookup(m.first).type;
625624
DATA_INVARIANT(
626-
base_type_eq(m_id_type, m.second.type(), ns),
625+
m_id_type == m.second.type(),
627626
"type of constant to be stored should match");
628627
set_to(symbol_exprt(m.first, m_id_type), m.second);
629628
changed=true;

src/analyses/does_remove_const.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Author: Diffblue Ltd.
1515
#include <util/type.h>
1616
#include <util/expr.h>
1717
#include <util/std_code.h>
18-
#include <util/base_type.h>
1918

2019
/// A naive analysis to look for casts that remove const-ness from pointers.
2120
/// \param goto_program: the goto program to check
@@ -74,7 +73,7 @@ bool does_remove_constt::does_expr_lose_const(const exprt &expr) const
7473
for(const exprt &op : expr.operands())
7574
{
7675
const typet &op_type=op.type();
77-
if(base_type_eq(op_type, root_type, ns))
76+
if(op_type == root_type)
7877
{
7978
// Is this child more const-qualified than the root
8079
if(!does_type_preserve_const_correctness(&root_type, &op_type))

src/analyses/goto_check.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Author: Daniel Kroening, [email protected]
1515

1616
#include <util/arith_tools.h>
1717
#include <util/array_name.h>
18-
#include <util/base_type.h>
1918
#include <util/c_types.h>
2019
#include <util/config.h>
2120
#include <util/cprover_prefix.h>

src/analyses/invariant_propagation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Author: Daniel Kroening, [email protected]
1212
#include "invariant_propagation.h"
1313

1414
#include <util/simplify_expr.h>
15-
#include <util/base_type.h>
1615
#include <util/symbol_table.h>
1716
#include <util/std_expr.h>
1817

src/analyses/invariant_set.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Author: Daniel Kroening, [email protected]
1515

1616
#include <util/arith_tools.h>
1717
#include <util/base_exceptions.h>
18-
#include <util/base_type.h>
1918
#include <util/c_types.h>
2019
#include <util/expr_util.h>
2120
#include <util/namespace.h>

src/analyses/local_safe_pointers.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Author: Diffblue Ltd
1111

1212
#include "local_safe_pointers.h"
1313

14-
#include <util/base_type.h>
1514
#include <util/expr_iterator.h>
1615
#include <util/expr_util.h>
1716
#include <util/format_expr.h>
@@ -275,7 +274,7 @@ bool local_safe_pointerst::is_non_null_at_program_point(
275274
bool local_safe_pointerst::base_type_comparet::operator()(
276275
const exprt &e1, const exprt &e2) const
277276
{
278-
if(base_type_eq(e1, e2, ns))
277+
if(e1 == e2)
279278
return false;
280279
else
281280
return e1 < e2;

src/ansi-c/c_typecast.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Author: Daniel Kroening, [email protected]
1313
#include <cassert>
1414

1515
#include <util/arith_tools.h>
16-
#include <util/base_type.h>
1716
#include <util/c_types.h>
1817
#include <util/config.h>
1918
#include <util/expr_util.h>
@@ -551,7 +550,7 @@ void c_typecastt::implicit_typecast_followed(
551550
// very generous:
552551
// between any two function pointers it's ok
553552
}
554-
else if(base_type_eq(src_sub, dest_sub, ns))
553+
else if(src_sub == dest_sub)
555554
{
556555
// ok
557556
}
@@ -565,9 +564,9 @@ void c_typecastt::implicit_typecast_followed(
565564
// Also generous: between any to scalar types it's ok.
566565
// We should probably check the size.
567566
}
568-
else if(src_sub.id()==ID_array &&
569-
dest_sub.id()==ID_array &&
570-
base_type_eq(src_sub.subtype(), dest_sub.subtype(), ns))
567+
else if(
568+
src_sub.id() == ID_array && dest_sub.id() == ID_array &&
569+
src_sub.subtype() == dest_sub.subtype())
571570
{
572571
// we ignore the size of the top-level array
573572
// in the case of pointers to arrays

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Author: Daniel Kroening, [email protected]
1414
#include <cassert>
1515

1616
#include <util/arith_tools.h>
17-
#include <util/base_type.h>
1817
#include <util/c_types.h>
1918
#include <util/config.h>
2019
#include <util/cprover_prefix.h>
@@ -1064,9 +1063,9 @@ void c_typecheck_baset::typecheck_expr_typecast(exprt &expr)
10641063

10651064
const typet expr_type=follow(expr.type());
10661065

1067-
if(expr_type.id()==ID_union &&
1068-
!base_type_eq(expr_type, op.type(), *this) &&
1069-
op.id()!=ID_initializer_list)
1066+
if(
1067+
expr_type.id() == ID_union && expr_type != op.type() &&
1068+
op.id() != ID_initializer_list)
10701069
{
10711070
// This is a GCC extension. It's either a 'temporary union',
10721071
// where the argument is one of the member types.
@@ -1080,7 +1079,7 @@ void c_typecheck_baset::typecheck_expr_typecast(exprt &expr)
10801079
// we need to find a member with the right type
10811080
for(const auto &c : to_union_type(expr_type).components())
10821081
{
1083-
if(base_type_eq(c.type(), op.type(), *this))
1082+
if(c.type() == op.type())
10841083
{
10851084
// found! build union constructor
10861085
union_exprt union_expr(c.get_name(), op, expr.type());
@@ -1131,7 +1130,7 @@ void c_typecheck_baset::typecheck_expr_typecast(exprt &expr)
11311130
const typet op_type = op.type();
11321131

11331132
// cast to same type?
1134-
if(base_type_eq(expr_type, op_type, *this))
1133+
if(expr_type == op_type)
11351134
return; // it's ok
11361135

11371136
// vectors?
@@ -2516,8 +2515,7 @@ exprt c_typecheck_baset::do_special_functions(
25162515
expr.arguments().front(), expr.arguments().back());
25172516
equality_expr.add_source_location()=source_location;
25182517

2519-
if(!base_type_eq(equality_expr.lhs().type(),
2520-
equality_expr.rhs().type(), *this))
2518+
if(equality_expr.lhs().type() != equality_expr.rhs().type())
25212519
{
25222520
error().source_location = f_op.source_location();
25232521
error() << "equal expects two operands of same type" << eom;

src/ansi-c/c_typecheck_initializer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Author: Daniel Kroening, [email protected]
1919
#include <util/simplify_expr.h>
2020
#include <util/std_types.h>
2121
#include <util/string_constant.h>
22-
#include <util/type_eq.h>
2322

2423
#include "anonymous_member.h"
2524

src/cpp/cpp_typecheck_expr.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Author: Daniel Kroening, [email protected]
1616
#endif
1717

1818
#include <util/arith_tools.h>
19-
#include <util/base_type.h>
2019
#include <util/c_types.h>
2120
#include <util/config.h>
2221
#include <util/expr_initializer.h>
@@ -2373,9 +2372,9 @@ void cpp_typecheckt::typecheck_method_application(
23732372
if(expr.arguments().size()==func_type.parameters().size())
23742373
{
23752374
// this might be set up for base-class initialisation
2376-
if(!base_type_eq(expr.arguments().front().type(),
2377-
func_type.parameters().front().type(),
2378-
*this))
2375+
if(
2376+
expr.arguments().front().type() !=
2377+
func_type.parameters().front().type())
23792378
{
23802379
implicit_typecast(expr.arguments().front(), this_type);
23812380
assert(is_reference(expr.arguments().front().type()));

src/goto-instrument/dump_c.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include "dump_c.h"
1313

14-
#include <util/base_type.h>
1514
#include <util/config.h>
1615
#include <util/find_symbols.h>
1716
#include <util/invariant.h>
@@ -1277,9 +1276,9 @@ void dump_ct::cleanup_expr(exprt &expr)
12771276
expr.swap(tmp);
12781277
}
12791278
}
1280-
else if(expr.id()==ID_typecast &&
1281-
expr.op0().id()==ID_typecast &&
1282-
base_type_eq(expr.type(), expr.op0().type(), ns))
1279+
else if(
1280+
expr.id() == ID_typecast && expr.op0().id() == ID_typecast &&
1281+
expr.type() == expr.op0().type())
12831282
{
12841283
exprt tmp=expr.op0();
12851284
expr.swap(tmp);
@@ -1309,8 +1308,7 @@ void dump_ct::cleanup_expr(exprt &expr)
13091308
if(type.id()==ID_union &&
13101309
type.get_bool(ID_C_transparent_union))
13111310
{
1312-
if(it2->id()==ID_typecast &&
1313-
base_type_eq(it2->type(), type, ns))
1311+
if(it2->id() == ID_typecast && it2->type() == type)
13141312
*it2=to_typecast_expr(*it2).op();
13151313

13161314
// add a typecast for NULL or 0

src/goto-instrument/goto_program2code.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Author: Daniel Kroening, [email protected]
2020
#include <util/find_symbols.h>
2121
#include <util/prefix.h>
2222
#include <util/simplify_expr.h>
23-
#include <util/type_eq.h>
2423

2524
void goto_program2codet::operator()()
2625
{
@@ -1875,7 +1874,7 @@ void goto_program2codet::cleanup_expr(exprt &expr, bool no_typecast)
18751874
if(!has_prefix(id2string(it->second.base_name), "nondet_"))
18761875
continue;
18771876
const code_typet &code_type=to_code_type(it->second.type);
1878-
if(!type_eq(code_type.return_type(), expr.type(), ns))
1877+
if(code_type.return_type() != expr.type())
18791878
continue;
18801879
if(!code_type.parameters().empty())
18811880
continue;

src/goto-programs/goto_convert_functions.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Date: June 2003
1010

1111
#include "goto_convert_functions.h"
1212

13-
#include <util/base_type.h>
1413
#include <util/fresh_symbol.h>
1514
#include <util/prefix.h>
1615
#include <util/std_code.h>

src/goto-programs/goto_inline.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Author: Daniel Kroening, [email protected]
1515

1616
#include <util/prefix.h>
1717
#include <util/cprover_prefix.h>
18-
#include <util/base_type.h>
1918
#include <util/std_code.h>
2019
#include <util/std_expr.h>
2120

src/goto-programs/goto_inline_class.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Author: Daniel Kroening, [email protected]
1515
#include <iostream>
1616
#endif
1717

18-
#include <util/base_type.h>
1918
#include <util/cprover_prefix.h>
2019
#include <util/expr_util.h>
2120
#include <util/invariant.h>
@@ -91,7 +90,7 @@ void goto_inlinet::parameter_assignments(
9190
{
9291
// it should be the same exact type as the parameter,
9392
// subject to some exceptions
94-
if(!base_type_eq(par_type, actual.type(), ns))
93+
if(par_type != actual.type())
9594
{
9695
const typet &f_partype = par_type;
9796
const typet &f_acttype = actual.type();

src/goto-programs/goto_program.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ void goto_programt::instructiont::validate(
713713
if(!ns.lookup(goto_id, table_symbol))
714714
{
715715
bool symbol_expr_type_matches_symbol_table =
716-
base_type_eq(goto_symbol_expr.type(), table_symbol->type, ns);
716+
goto_symbol_expr.type() == table_symbol->type;
717717

718718
if(
719719
!symbol_expr_type_matches_symbol_table &&
@@ -722,10 +722,9 @@ void goto_programt::instructiont::validate(
722722
// Return removal sets the return type of a function symbol table
723723
// entry to 'void', but some callsites still expect the original
724724
// type (e.g. if a function is passed as a parameter)
725-
symbol_expr_type_matches_symbol_table = base_type_eq(
726-
goto_symbol_expr.type(),
727-
original_return_type(ns.get_symbol_table(), goto_id),
728-
ns);
725+
symbol_expr_type_matches_symbol_table =
726+
goto_symbol_expr.type() ==
727+
original_return_type(ns.get_symbol_table(), goto_id);
729728

730729
if(
731730
!symbol_expr_type_matches_symbol_table &&
@@ -749,7 +748,7 @@ void goto_programt::instructiont::validate(
749748
table_symbol_type.return_type();
750749

751750
symbol_expr_type_matches_symbol_table =
752-
base_type_eq(goto_symbol_expr_type, table_symbol_type, ns);
751+
goto_symbol_expr_type == table_symbol_type;
753752
}
754753
}
755754
}
@@ -767,8 +766,8 @@ void goto_programt::instructiont::validate(
767766
auto symbol_table_array_type = to_array_type(table_symbol->type);
768767
symbol_table_array_type.size() = nil_exprt();
769768

770-
symbol_expr_type_matches_symbol_table = base_type_eq(
771-
goto_symbol_expr.type(), symbol_table_array_type, ns);
769+
symbol_expr_type_matches_symbol_table =
770+
goto_symbol_expr.type() == symbol_table_array_type;
772771
}
773772
}
774773

src/goto-programs/graphml_witness.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Author: Daniel Kroening
1111

1212
#include "graphml_witness.h"
1313

14-
#include <util/base_type.h>
1514
#include <util/byte_operators.h>
1615
#include <util/c_types.h>
1716
#include <util/arith_tools.h>
@@ -75,8 +74,9 @@ std::string graphml_witnesst::convert_assign_rec(
7574
{
7675
// dereferencing may have resulted in an lhs that is the first
7776
// struct member; undo this
78-
if(assign.lhs().id()==ID_member &&
79-
!base_type_eq(assign.lhs().type(), assign.rhs().type(), ns))
77+
if(
78+
assign.lhs().id() == ID_member &&
79+
assign.lhs().type() != assign.rhs().type())
8080
{
8181
code_assignt tmp=assign;
8282
tmp.lhs()=to_member_expr(assign.lhs()).struct_op();

src/goto-programs/link_goto_model.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Author: Michael Tautschnig, Daniel Kroening
1313

1414
#include <unordered_set>
1515

16-
#include <util/base_type.h>
1716
#include <util/symbol.h>
1817
#include <util/rename_symbol.h>
1918

@@ -102,8 +101,9 @@ static bool link_functions(
102101
{
103102
// the linking code will have ensured that types match
104103
rename_symbol(src_func.type);
105-
INVARIANT(base_type_eq(in_dest_symbol_table.type, src_func.type, ns),
106-
"linking ensures that types match");
104+
INVARIANT(
105+
in_dest_symbol_table.type == src_func.type,
106+
"linking ensures that types match");
107107
}
108108
}
109109
}

src/goto-programs/read_goto_binary.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Module: Read Goto Programs
1818
#include <util/unicode.h>
1919
#include <util/tempfile.h>
2020
#include <util/rename_symbol.h>
21-
#include <util/base_type.h>
2221
#include <util/config.h>
2322

2423
#include "goto_model.h"

0 commit comments

Comments
 (0)