Skip to content

Construct with_exprt in a non-deprecated way #3780

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 1 commit into from
Jan 14, 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
12 changes: 2 additions & 10 deletions src/goto-programs/wp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,8 @@ void rewrite_assignment(exprt &lhs, exprt &rhs)
irep_idt component_name=member_expr.get_component_name();
exprt new_lhs=member_expr.struct_op();

with_exprt new_rhs;
new_rhs.type()=new_lhs.type();
new_rhs.old()=new_lhs;
new_rhs.where().id(ID_member_name);
with_exprt new_rhs(new_lhs, exprt(ID_member_name), rhs);
new_rhs.where().set(ID_component_name, component_name);
new_rhs.new_value()=rhs;

Copy link
Member

Choose a reason for hiding this comment

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

The constructor already sets the type.

lhs=new_lhs;
rhs=new_rhs;
Expand All @@ -183,11 +179,7 @@ void rewrite_assignment(exprt &lhs, exprt &rhs)
const index_exprt index_expr=to_index_expr(lhs);
exprt new_lhs=index_expr.array();

with_exprt new_rhs;
new_rhs.type()=new_lhs.type();
new_rhs.old()=new_lhs;
Copy link
Member

Choose a reason for hiding this comment

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

Same here

new_rhs.where()=index_expr.index();
new_rhs.new_value()=rhs;
with_exprt new_rhs(new_lhs, index_expr.index(), rhs);

lhs=new_lhs;
rhs=new_rhs;
Expand Down
4 changes: 2 additions & 2 deletions src/util/expr_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ with_exprt make_with_expr(const update_exprt &src)
const exprt::operandst &designator=src.designator();
PRECONDITION(!designator.empty());

with_exprt result;
with_exprt result{exprt{}, exprt{}, exprt{}};
exprt *dest=&result;

forall_expr(it, designator)
{
with_exprt tmp;
with_exprt tmp{exprt{}, exprt{}, exprt{}};

if(it->id()==ID_index_designator)
{
Expand Down