Skip to content

Commit a9e8d4b

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 bc86a60 commit a9e8d4b

Some content is hidden

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

54 files changed

+151
-668
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/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"

src/goto-programs/remove_function_pointers.cpp

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

1414
#include <cassert>
1515

16-
#include <util/base_type.h>
1716
#include <util/c_types.h>
1817
#include <util/fresh_symbol.h>
1918
#include <util/invariant.h>
@@ -22,7 +21,6 @@ Author: Daniel Kroening, [email protected]
2221
#include <util/replace_expr.h>
2322
#include <util/source_location.h>
2423
#include <util/std_expr.h>
25-
#include <util/type_eq.h>
2624

2725
#include <analyses/does_remove_const.h>
2826

@@ -127,7 +125,7 @@ bool remove_function_pointerst::arg_is_type_compatible(
127125
const typet &call_type,
128126
const typet &function_type)
129127
{
130-
if(type_eq(call_type, function_type, ns))
128+
if(call_type == function_type)
131129
return true;
132130

133131
// any integer-vs-enum-vs-pointer is ok
@@ -159,7 +157,7 @@ bool remove_function_pointerst::is_type_compatible(
159157
if(!return_value_used)
160158
{
161159
}
162-
else if(type_eq(call_type.return_type(), empty_typet(), ns))
160+
else if(call_type.return_type() == empty_typet())
163161
{
164162
// ok
165163
}
@@ -214,8 +212,7 @@ void remove_function_pointerst::fix_argument_types(
214212
{
215213
if(i<call_arguments.size())
216214
{
217-
if(!type_eq(call_arguments[i].type(),
218-
function_parameters[i].type(), ns))
215+
if(call_arguments[i].type() != function_parameters[i].type())
219216
{
220217
call_arguments[i].make_typecast(function_parameters[i].type());
221218
}
@@ -234,9 +231,7 @@ void remove_function_pointerst::fix_return_type(
234231
const code_typet &code_type = to_code_type(function_call.function().type());
235232

236233
// type already ok?
237-
if(type_eq(
238-
function_call.lhs().type(),
239-
code_type.return_type(), ns))
234+
if(function_call.lhs().type() == code_type.return_type())
240235
return;
241236

242237
const symbolt &function_symbol =

src/goto-programs/remove_virtual_functions.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ Author: Daniel Kroening, [email protected]
1212

1313
#include <algorithm>
1414

15-
#include <util/type_eq.h>
16-
1715
#include "class_identifier.h"
1816
#include "goto_model.h"
1917
#include "remove_skip.h"
@@ -130,7 +128,7 @@ static void create_static_function_call(
130128
{
131129
const typet &need_type = callee_parameters[i].type();
132130

133-
if(!type_eq(call_args[i].type(), need_type, ns))
131+
if(call_args[i].type() != need_type)
134132
{
135133
// If this wasn't language agnostic code we'd also like to check
136134
// compatibility-- for example, Java overrides may have differing generic

src/goto-programs/replace_calls.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Author: Daniel Poetzl
1515

1616
#include <goto-programs/remove_returns.h>
1717

18-
#include <util/base_type.h>
1918
#include <util/exception_utils.h>
2019
#include <util/invariant.h>
2120
#include <util/irep.h>
@@ -94,7 +93,7 @@ void replace_callst::operator()(
9493
auto f_it2 = goto_functions.function_map.find(new_id);
9594
PRECONDITION(f_it2 != goto_functions.function_map.end());
9695

97-
PRECONDITION(base_type_eq(f_it1->second.type, f_it2->second.type, ns));
96+
PRECONDITION(f_it1->second.type == f_it2->second.type);
9897

9998
// check that returns have not been removed
10099
goto_programt::const_targett next_it = std::next(it);
@@ -165,7 +164,7 @@ void replace_callst::check_replacement_map(
165164
auto it1 = goto_functions.function_map.find(p.first);
166165
if(it1 != goto_functions.function_map.end())
167166
{
168-
if(!base_type_eq(it1->second.type, it2->second.type, ns))
167+
if(it1->second.type != it2->second.type)
169168
throw invalid_command_line_argument_exceptiont(
170169
"functions " + id2string(p.first) + " and " + id2string(p.second) +
171170
" are not type-compatible",

0 commit comments

Comments
 (0)