Skip to content

Commit

Permalink
Auxiliary function to check if the ssa has enough data to build an id…
Browse files Browse the repository at this point in the history
…entifier
  • Loading branch information
dcattaruzza authored and peterschrammel committed Mar 2, 2017
1 parent d47d503 commit 27153d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/util/ssa_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ static void build_ssa_identifier_rec(
assert(false);
}

/* Used to determine whether or not an identifier can be built
* before trying and getting an exception */
bool ssa_exprt::can_build_identifier(const exprt &expr)
{
if(expr.id()==ID_symbol)
return true;
else if(expr.id()==ID_member ||
expr.id()==ID_index)
return can_build_identifier(expr.op0());
else
return false;
}

/*******************************************************************\
Function: ssa_exprt::build_identifier
Expand Down
6 changes: 5 additions & 1 deletion src/util/ssa_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ssa_exprt:public symbol_exprt

const irep_idt get_l1_object_identifier() const
{
#if 0
#if 1
return get_l1_object().get_identifier();
#else
// the above is the clean version, this is the fast one, using
Expand Down Expand Up @@ -134,6 +134,10 @@ class ssa_exprt:public symbol_exprt
const irep_idt &l0,
const irep_idt &l1,
const irep_idt &l2);

/* Used to determine whether or not an identifier can be built
* before trying and getting an exception */
static bool can_build_identifier(const exprt &src);
};

/*! \brief Cast a generic exprt to an \ref ssa_exprt
Expand Down

0 comments on commit 27153d1

Please sign in to comment.