@@ -152,33 +152,38 @@ class ssa_exprt:public symbol_exprt
152
152
}
153
153
};
154
154
155
- // / Cast a generic exprt to an \ref ssa_exprt. This is an unchecked conversion.
156
- // / \a expr must be known to be \ref ssa_exprt.
155
+ inline bool is_ssa_expr (const exprt &expr)
156
+ {
157
+ return expr.id () == ID_symbol && expr.get_bool (ID_C_SSA_symbol);
158
+ }
159
+
160
+ template <>
161
+ inline bool can_cast_expr<ssa_exprt>(const exprt &base)
162
+ {
163
+ return is_ssa_expr (base);
164
+ }
165
+
166
+ inline void validate_expr (const ssa_exprt &expr)
167
+ {
168
+ ssa_exprt::check (expr);
169
+ }
170
+
171
+ // / Cast a generic exprt to an \ref ssa_exprt.
157
172
// / \param expr: Source expression
158
173
// / \return Object of type \ref ssa_exprt
159
174
// / \ingroup gr_std_expr
160
175
inline const ssa_exprt &to_ssa_expr (const exprt &expr)
161
176
{
162
- PRECONDITION (
163
- expr.id () == ID_symbol && expr.get_bool (ID_C_SSA_symbol) &&
164
- !expr.has_operands ());
177
+ ssa_exprt::check (expr);
165
178
return static_cast <const ssa_exprt &>(expr);
166
179
}
167
180
168
181
// / \copydoc to_ssa_expr(const exprt &)
169
182
// / \ingroup gr_std_expr
170
183
inline ssa_exprt &to_ssa_expr (exprt &expr)
171
184
{
172
- PRECONDITION (
173
- expr.id () == ID_symbol && expr.get_bool (ID_C_SSA_symbol) &&
174
- !expr.has_operands ());
185
+ ssa_exprt::check (expr);
175
186
return static_cast <ssa_exprt &>(expr);
176
187
}
177
188
178
- inline bool is_ssa_expr (const exprt &expr)
179
- {
180
- return expr.id ()==ID_symbol &&
181
- expr.get_bool (ID_C_SSA_symbol);
182
- }
183
-
184
189
#endif // CPROVER_UTIL_SSA_EXPR_H
0 commit comments