Skip to content

Commit 27153d1

Browse files
dcattaruzzapeterschrammel
authored andcommitted
Auxiliary function to check if the ssa has enough data to build an identifier
1 parent d47d503 commit 27153d1

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/util/ssa_expr.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ static void build_ssa_identifier_rec(
7878
assert(false);
7979
}
8080

81+
/* Used to determine whether or not an identifier can be built
82+
* before trying and getting an exception */
83+
bool ssa_exprt::can_build_identifier(const exprt &expr)
84+
{
85+
if(expr.id()==ID_symbol)
86+
return true;
87+
else if(expr.id()==ID_member ||
88+
expr.id()==ID_index)
89+
return can_build_identifier(expr.op0());
90+
else
91+
return false;
92+
}
93+
8194
/*******************************************************************\
8295
8396
Function: ssa_exprt::build_identifier

src/util/ssa_expr.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class ssa_exprt:public symbol_exprt
6464

6565
const irep_idt get_l1_object_identifier() const
6666
{
67-
#if 0
67+
#if 1
6868
return get_l1_object().get_identifier();
6969
#else
7070
// the above is the clean version, this is the fast one, using
@@ -134,6 +134,10 @@ class ssa_exprt:public symbol_exprt
134134
const irep_idt &l0,
135135
const irep_idt &l1,
136136
const irep_idt &l2);
137+
138+
/* Used to determine whether or not an identifier can be built
139+
* before trying and getting an exception */
140+
static bool can_build_identifier(const exprt &src);
137141
};
138142

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

0 commit comments

Comments
 (0)