Skip to content

Commit 4e797f2

Browse files
authored
Merge pull request #3781 from tautschnig/deprecation-dereference_exprt
Construct dereference_exprt in a non-deprecated way
2 parents 4477a72 + 05e8603 commit 4e797f2

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

src/goto-programs/builtin_functions.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,8 +1108,7 @@ void goto_convertt::do_function_call_symbol(
11081108
if(lhs.is_not_nil())
11091109
{
11101110
typet t=pointer_type(lhs.type());
1111-
dereference_exprt rhs(lhs.type());
1112-
rhs.op0()=typecast_exprt(list_arg, t);
1111+
dereference_exprt rhs(typecast_exprt(list_arg, t), lhs.type());
11131112
rhs.add_source_location()=function.source_location();
11141113
goto_programt::targett t2=dest.add_instruction(ASSIGN);
11151114
t2->source_location=function.source_location();

src/goto-symex/symex_dereference.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,8 @@ void goto_symext::dereference_rec(
312312
address_of_exprt address_of_expr(index_expr.array());
313313
address_of_expr.type()=pointer_type(expr.type());
314314

315-
dereference_exprt tmp;
316-
tmp.pointer()=plus_exprt(address_of_expr, index_expr.index());
317-
tmp.type()=expr.type();
315+
dereference_exprt tmp(
316+
plus_exprt(address_of_expr, index_expr.index()), expr.type());
318317
tmp.add_source_location()=expr.source_location();
319318

320319
// recursive call

src/pointer-analysis/rewrite_index.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ Author: Daniel Kroening, [email protected]
1616
/// rewrite a[i] to *(a+i)
1717
dereference_exprt rewrite_index(const index_exprt &index_expr)
1818
{
19-
dereference_exprt result;
20-
result.pointer()=plus_exprt(index_expr.array(), index_expr.index());
21-
result.type()=index_expr.type();
19+
dereference_exprt result(
20+
plus_exprt(index_expr.array(), index_expr.index()), index_expr.type());
2221
result.add_source_location()=index_expr.source_location();
2322
return result;
2423
}

0 commit comments

Comments
 (0)