Skip to content

extend array_exprt API #4367

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 2 commits into from
Mar 12, 2019
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
2 changes: 1 addition & 1 deletion src/analyses/goto_rw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void rw_range_sett::get_objects_array(
const range_spect &range_start,
const range_spect &size)
{
const array_typet &array_type = to_array_type(expr.type());
const array_typet &array_type = expr.type();

auto subtype_bits = pointer_offset_bits(array_type.subtype(), ns);

Expand Down
3 changes: 1 addition & 2 deletions src/util/expr_initializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ optionalt<exprt> expr_initializert<nondet>::expr_initializer_rec(
// we initialize this with an empty array

array_exprt value({}, array_type);
value.type().id(ID_array);
value.type().set(ID_size, from_integer(0, size_type()));
value.type().size() = from_integer(0, size_type());
value.add_source_location()=source_location;
return std::move(value);
}
Expand Down
15 changes: 10 additions & 5 deletions src/util/std_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1671,11 +1671,6 @@ inline array_of_exprt &to_array_of_expr(exprt &expr)
class array_exprt : public multi_ary_exprt
{
public:
DEPRECATED("use array_exprt(type) instead")
array_exprt() : multi_ary_exprt(ID_array)
{
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but doing this now violates our informal 6-months rule.


DEPRECATED("use array_exprt(operands, type) instead")
explicit array_exprt(const array_typet &_type)
: multi_ary_exprt(ID_array, _type)
Expand All @@ -1686,6 +1681,16 @@ class array_exprt : public multi_ary_exprt
: multi_ary_exprt(ID_array, std::move(_operands), _type)
{
}

const array_typet &type() const
{
return static_cast<const array_typet &>(multi_ary_exprt::type());
}

array_typet &type()
{
return static_cast<array_typet &>(multi_ary_exprt::type());
}
};

template <>
Expand Down