Skip to content

Remove deprecated base_type_eq #5167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/analyses/does_remove_const.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Author: Diffblue Ltd.
#include <util/type.h>
#include <util/expr.h>
#include <util/std_code.h>
#include <util/base_type.h>

/// A naive analysis to look for casts that remove const-ness from pointers.
/// \param goto_program: the goto program to check
Expand Down Expand Up @@ -74,7 +73,7 @@ bool does_remove_constt::does_expr_lose_const(const exprt &expr) const
for(const exprt &op : expr.operands())
{
const typet &op_type=op.type();
if(base_type_eq(op_type, root_type, ns))
if(op_type == root_type)
{
// Is this child more const-qualified than the root
if(!does_type_preserve_const_correctness(&root_type, &op_type))
Expand Down
5 changes: 2 additions & 3 deletions src/goto-programs/goto_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Author: Daniel Kroening, [email protected]
#include <ostream>
#include <iomanip>

#include <util/base_type.h>
#include <util/expr_iterator.h>
#include <util/find_symbols.h>
#include <util/invariant.h>
Expand Down Expand Up @@ -740,7 +739,7 @@ void goto_programt::instructiont::validate(
if(!ns.lookup(goto_id, table_symbol))
{
bool symbol_expr_type_matches_symbol_table =
base_type_eq(goto_symbol_expr.type(), table_symbol->type, ns);
goto_symbol_expr.type() == table_symbol->type;

if(
!symbol_expr_type_matches_symbol_table &&
Expand All @@ -763,7 +762,7 @@ void goto_programt::instructiont::validate(
table_symbol_type.return_type();

symbol_expr_type_matches_symbol_table =
base_type_eq(goto_symbol_expr_type, table_symbol_type, ns);
goto_symbol_expr_type == table_symbol_type;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/goto-programs/link_goto_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Author: Michael Tautschnig, Daniel Kroening

#include <unordered_set>

#include <util/base_type.h>
#include <util/symbol.h>
#include <util/rename_symbol.h>

Expand Down Expand Up @@ -114,8 +113,9 @@ static bool link_functions(
{
// the linking code will have ensured that types match
rename_symbol(src_func.type);
INVARIANT(base_type_eq(in_dest_symbol_table.type, src_func.type, ns),
"linking ensures that types match");
INVARIANT(
in_dest_symbol_table.type == src_func.type,
"linking ensures that types match");
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/goto-programs/replace_calls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Author: Daniel Poetzl

#include <goto-programs/remove_returns.h>

#include <util/base_type.h>
#include <util/exception_utils.h>
#include <util/invariant.h>
#include <util/irep.h>
Expand Down Expand Up @@ -94,7 +93,7 @@ void replace_callst::operator()(
auto f_it2 = goto_functions.function_map.find(new_id);
PRECONDITION(f_it2 != goto_functions.function_map.end());

PRECONDITION(base_type_eq(f_it1->second.type, f_it2->second.type, ns));
PRECONDITION(f_it1->second.type == f_it2->second.type);

// check that returns have not been removed
if(to_code_type(f_it1->second.type).return_type().id() != ID_empty)
Expand Down Expand Up @@ -167,7 +166,7 @@ void replace_callst::check_replacement_map(
auto it1 = goto_functions.function_map.find(p.first);
if(it1 != goto_functions.function_map.end())
{
if(!base_type_eq(it1->second.type, it2->second.type, ns))
if(it1->second.type != it2->second.type)
throw invalid_command_line_argument_exceptiont(
"functions " + id2string(p.first) + " and " + id2string(p.second) +
" are not type-compatible",
Expand Down
66 changes: 30 additions & 36 deletions src/linking/linking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Author: Daniel Kroening, [email protected]
#include <deque>
#include <unordered_set>

#include <util/base_type.h>
#include <util/find_symbols.h>
#include <util/mathematical_types.h>
#include <util/pointer_offset_size.h>
Expand Down Expand Up @@ -140,8 +139,7 @@ void linkingt::detailed_conflict_report_rec(
else if(t1.id()==ID_pointer ||
t1.id()==ID_array)
{
if(depth>0 &&
!base_type_eq(t1.subtype(), t2.subtype(), ns))
if(depth > 0 && t1.subtype() != t2.subtype())
{
if(conflict_path.type().id() == ID_pointer)
conflict_path = dereference_exprt(conflict_path);
Expand Down Expand Up @@ -190,7 +188,7 @@ void linkingt::detailed_conflict_report_rec(
msg+=id2string(components2[i].get_name())+')';
break;
}
else if(!base_type_eq(subtype1, subtype2, ns))
else if(subtype1 != subtype2)
{
typedef std::unordered_set<typet, irep_hash> type_sett;
type_sett parent_types;
Expand Down Expand Up @@ -307,7 +305,7 @@ void linkingt::detailed_conflict_report_rec(
msg+=std::to_string(parameters1.size())+'/';
msg+=std::to_string(parameters2.size())+')';
}
else if(!base_type_eq(return_type1, return_type2, ns))
else if(return_type1 != return_type2)
{
conflict_path=
index_exprt(conflict_path,
Expand All @@ -331,7 +329,7 @@ void linkingt::detailed_conflict_report_rec(
const typet &subtype1=parameters1[i].type();
const typet &subtype2=parameters2[i].type();

if(!base_type_eq(subtype1, subtype2, ns))
if(subtype1 != subtype2)
{
conflict_path=
index_exprt(conflict_path,
Expand Down Expand Up @@ -450,7 +448,7 @@ void linkingt::duplicate_code_symbol(
symbolt &new_symbol)
{
// Both are functions.
if(!base_type_eq(old_symbol.type, new_symbol.type, ns))
if(old_symbol.type != new_symbol.type)
{
const code_typet &old_t=to_code_type(old_symbol.type);
const code_typet &new_t=to_code_type(new_symbol.type);
Expand All @@ -461,11 +459,8 @@ void linkingt::duplicate_code_symbol(
// casts we need to fail hard
if(old_symbol.type.get_bool(ID_C_incomplete) && old_symbol.value.is_nil())
{
if(base_type_eq(old_t.return_type(), new_t.return_type(), ns))
link_warning(
old_symbol,
new_symbol,
"implicit function declaration");
if(old_t.return_type() == new_t.return_type())
link_warning(old_symbol, new_symbol, "implicit function declaration");
else
link_error(
old_symbol,
Expand All @@ -479,7 +474,7 @@ void linkingt::duplicate_code_symbol(
else if(
new_symbol.type.get_bool(ID_C_incomplete) && new_symbol.value.is_nil())
{
if(base_type_eq(old_t.return_type(), new_t.return_type(), ns))
if(old_t.return_type() == new_t.return_type())
link_warning(
old_symbol,
new_symbol,
Expand All @@ -491,13 +486,12 @@ void linkingt::duplicate_code_symbol(
"implicit function declaration");
}
// handle (incomplete) function prototypes
else if(base_type_eq(old_t.return_type(), new_t.return_type(), ns) &&
((old_t.parameters().empty() &&
old_t.has_ellipsis() &&
old_symbol.value.is_nil()) ||
(new_t.parameters().empty() &&
new_t.has_ellipsis() &&
new_symbol.value.is_nil())))
else if(
old_t.return_type() == new_t.return_type() &&
((old_t.parameters().empty() && old_t.has_ellipsis() &&
old_symbol.value.is_nil()) ||
(new_t.parameters().empty() && new_t.has_ellipsis() &&
new_symbol.value.is_nil())))
{
if(old_t.parameters().empty() &&
old_t.has_ellipsis() &&
Expand Down Expand Up @@ -547,9 +541,9 @@ void linkingt::duplicate_code_symbol(
}
// conflicting declarations without a definition, matching return
// types
else if(base_type_eq(old_t.return_type(), new_t.return_type(), ns) &&
old_symbol.value.is_nil() &&
new_symbol.value.is_nil())
else if(
old_t.return_type() == new_t.return_type() && old_symbol.value.is_nil() &&
new_symbol.value.is_nil())
{
link_warning(
old_symbol,
Expand Down Expand Up @@ -588,7 +582,7 @@ void linkingt::duplicate_code_symbol(
typedef std::deque<std::pair<typet, typet> > conflictst;
conflictst conflicts;

if(!base_type_eq(old_t.return_type(), new_t.return_type(), ns))
if(old_t.return_type() != new_t.return_type())
conflicts.push_back(
std::make_pair(old_t.return_type(), new_t.return_type()));

Expand All @@ -600,7 +594,7 @@ void linkingt::duplicate_code_symbol(
n_it!=new_t.parameters().end();
++o_it, ++n_it)
{
if(!base_type_eq(o_it->type(), n_it->type(), ns))
if(o_it->type() != n_it->type())
conflicts.push_back(
std::make_pair(o_it->type(), n_it->type()));
}
Expand Down Expand Up @@ -693,7 +687,7 @@ void linkingt::duplicate_code_symbol(

bool found=false;
for(const auto &c : union_type.components())
if(base_type_eq(c.type(), src_type, ns))
if(c.type() == src_type)
{
found=true;
if(warn_msg.empty())
Expand Down Expand Up @@ -768,7 +762,7 @@ void linkingt::duplicate_code_symbol(
{
// ok, silently ignore
}
else if(base_type_eq(old_symbol.type, new_symbol.type, ns))
else if(old_symbol.type == new_symbol.type)
{
// keep the one in old_symbol -- libraries come last!
warning().source_location=new_symbol.location;
Expand All @@ -791,7 +785,7 @@ bool linkingt::adjust_object_type_rec(
const typet &t2,
adjust_type_infot &info)
{
if(base_type_eq(t1, t2, ns))
if(t1 == t2)
return false;

if(
Expand Down Expand Up @@ -987,7 +981,7 @@ void linkingt::duplicate_object_symbol(
// both are variables
bool set_to_new = false;

if(!base_type_eq(old_symbol.type, new_symbol.type, ns))
if(old_symbol.type != new_symbol.type)
{
bool failed=
adjust_object_type(old_symbol, new_symbol, set_to_new);
Expand Down Expand Up @@ -1045,7 +1039,7 @@ void linkingt::duplicate_object_symbol(
simplify(tmp_old, ns);
simplify(tmp_new, ns);

if(base_type_eq(tmp_old, tmp_new, ns))
if(tmp_old == tmp_new)
{
// ok, the same
}
Expand Down Expand Up @@ -1170,9 +1164,9 @@ void linkingt::duplicate_type_symbol(
return;
}

if(old_symbol.type.id()==ID_array &&
new_symbol.type.id()==ID_array &&
base_type_eq(old_symbol.type.subtype(), new_symbol.type.subtype(), ns))
if(
old_symbol.type.id() == ID_array && new_symbol.type.id() == ID_array &&
old_symbol.type.subtype() == new_symbol.type.subtype())
{
if(to_array_type(old_symbol.type).size().is_nil() &&
to_array_type(new_symbol.type).size().is_not_nil())
Expand Down Expand Up @@ -1242,9 +1236,9 @@ bool linkingt::needs_renaming_type(
to_union_type(new_symbol.type).is_incomplete())
return false; // not different

if(old_symbol.type.id()==ID_array &&
new_symbol.type.id()==ID_array &&
base_type_eq(old_symbol.type.subtype(), new_symbol.type.subtype(), ns))
if(
old_symbol.type.id() == ID_array && new_symbol.type.id() == ID_array &&
old_symbol.type.subtype() == new_symbol.type.subtype())
{
if(to_array_type(old_symbol.type).size().is_nil() &&
to_array_type(new_symbol.type).size().is_not_nil())
Expand Down
1 change: 0 additions & 1 deletion src/util/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ SRC = allocate_objects.cpp \
arith_tools.cpp \
array_element_from_pointer.cpp \
array_name.cpp \
base_type.cpp \
bv_arithmetic.cpp \
byte_operators.cpp \
c_types.cpp \
Expand Down
Loading