Skip to content

Get rid of thin (and duplicate) has_dereference wrapper #2062

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

Merged
merged 1 commit into from
Apr 16, 2018
Merged
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
8 changes: 1 addition & 7 deletions src/analyses/goto_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ class goto_checkt

void invalidate(const exprt &lhs);

inline static bool has_dereference(const exprt &src)
{
return has_subexpr(src, ID_dereference);
}

bool enable_bounds_check;
bool enable_pointer_check;
bool enable_memory_leak_check;
Expand Down Expand Up @@ -200,8 +195,7 @@ void goto_checkt::invalidate(const exprt &lhs)
assertionst::iterator next=it;
next++;

if(has_symbol(*it, find_symbols_set) ||
has_dereference(*it))
if(has_symbol(*it, find_symbols_set) || has_subexpr(*it, ID_dereference))
assertions.erase(it);

it=next;
Expand Down
4 changes: 2 additions & 2 deletions src/analyses/goto_rw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Date: April 2010
#include <limits>
#include <memory>

#include <util/expr_util.h>
#include <util/std_code.h>
#include <util/std_expr.h>
#include <util/pointer_offset_size.h>
Expand Down Expand Up @@ -617,8 +618,7 @@ void rw_range_set_value_sett::get_objects_dereference(

// value_set_dereferencet::build_reference_to will turn *p into
// DYNAMIC_OBJECT(p) ? *p : invalid_objectN
if(object.is_not_nil() &&
!value_set_dereferencet::has_dereference(object))
if(object.is_not_nil() && !has_subexpr(object, ID_dereference))
get_objects_rec(mode, object, range_start, new_size);
}

Expand Down
9 changes: 5 additions & 4 deletions src/pointer-analysis/goto_program_dereference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Author: Daniel Kroening, [email protected]

#include "goto_program_dereference.h"

#include <util/expr_util.h>
#include <util/simplify_expr.h>
#include <util/base_type.h>
#include <util/std_code.h>
Expand Down Expand Up @@ -97,7 +98,7 @@ void goto_program_dereferencet::dereference_rec(
guardt &guard,
const value_set_dereferencet::modet mode)
{
if(!dereference.has_dereference(expr))
if(!has_subexpr(expr, ID_dereference))
return;

if(expr.id()==ID_and || expr.id()==ID_or)
Expand All @@ -114,7 +115,7 @@ void goto_program_dereferencet::dereference_rec(
throw expr.id_string()+" takes Boolean operands only, but got "+
op.pretty();

if(dereference.has_dereference(op))
if(has_subexpr(op, ID_dereference))
dereference_rec(op, guard, value_set_dereferencet::modet::READ);

if(expr.id()==ID_or)
Expand Down Expand Up @@ -146,8 +147,8 @@ void goto_program_dereferencet::dereference_rec(

dereference_rec(expr.op0(), guard, value_set_dereferencet::modet::READ);

bool o1=dereference.has_dereference(expr.op1());
bool o2=dereference.has_dereference(expr.op2());
bool o1 = has_subexpr(expr.op1(), ID_dereference);
bool o2 = has_subexpr(expr.op2(), ID_dereference);

if(o1)
{
Expand Down
5 changes: 0 additions & 5 deletions src/pointer-analysis/value_set_dereference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ Author: Daniel Kroening, [email protected]
// global data, horrible
unsigned int value_set_dereferencet::invalid_counter=0;

bool value_set_dereferencet::has_dereference(const exprt &expr)
{
return has_subexpr(expr, ID_dereference);
}

const exprt &value_set_dereferencet::get_symbol(const exprt &expr)
{
if(expr.id()==ID_member || expr.id()==ID_index)
Expand Down
4 changes: 0 additions & 4 deletions src/pointer-analysis/value_set_dereference.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ class value_set_dereferencet
const guardt &guard,
const modet mode);

/*! \brief Returns 'true' iff the given expression contains unary '*'
*/
static bool has_dereference(const exprt &expr);

typedef std::unordered_set<exprt, irep_hash> expr_sett;

private:
Expand Down