Skip to content

Commit 7932fdd

Browse files
committed
Factor out is_read_only_object function
1 parent b03077b commit 7932fdd

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/goto-symex/goto_symex_state.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,14 @@ class goto_symex_statet final : public goto_statet
239239
return fresh_l2_name_provider;
240240
}
241241

242+
/// Returns true if \p lvalue is a read-only object, such as the null object
243+
static bool is_read_only_object(const exprt &lvalue)
244+
{
245+
return lvalue.id() == ID_string_constant || lvalue.id() == ID_null_object ||
246+
lvalue.id() == "zero_string" || lvalue.id() == "is_zero_string" ||
247+
lvalue.id() == "zero_string_length";
248+
}
249+
242250
private:
243251
std::function<std::size_t(const irep_idt &)> fresh_l2_name_provider;
244252

src/goto-symex/symex_assign.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,7 @@ void symex_assignt::assign_rec(
6767
assign_if(to_if_expr(lhs), full_lhs, rhs, guard);
6868
else if(lhs.id()==ID_typecast)
6969
assign_typecast(to_typecast_expr(lhs), full_lhs, rhs, guard);
70-
else if(lhs.id() == ID_string_constant ||
71-
lhs.id() == ID_null_object ||
72-
lhs.id() == "zero_string" ||
73-
lhs.id() == "is_zero_string" ||
74-
lhs.id() == "zero_string_length")
70+
else if(goto_symex_statet::is_read_only_object(lhs))
7571
{
7672
// ignore
7773
}

0 commit comments

Comments
 (0)