Skip to content

Commit e7a49de

Browse files
tautschnigDaniel Kroening
authored and
Daniel Kroening
committed
Construct if_exprt in a non-deprecated way
The default constructor is deprecated.
1 parent 1b910f8 commit e7a49de

File tree

4 files changed

+4
-20
lines changed

4 files changed

+4
-20
lines changed

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,10 +1696,7 @@ void c_typecheck_baset::typecheck_side_effect_gcc_conditional_expression(
16961696

16971697
// use typechecking code for "if"
16981698

1699-
if_exprt if_expr;
1700-
if_expr.cond()=operands[0];
1701-
if_expr.true_case()=operands[0];
1702-
if_expr.false_case()=operands[1];
1699+
if_exprt if_expr(operands[0], operands[0], operands[1]);
17031700
if_expr.add_source_location()=expr.source_location();
17041701

17051702
typecheck_expr_trinary(if_expr);

src/goto-programs/goto_clean_expr.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,7 @@ void goto_convertt::remove_gcc_conditional_expression(
504504
clean_expr(expr.op0(), dest, mode);
505505

506506
// now we can copy op0 safely
507-
if_exprt if_expr;
508-
509-
if_expr.cond()=expr.op0();
510-
if_expr.true_case()=expr.op0();
511-
if_expr.false_case()=expr.op1();
512-
if_expr.type()=expr.type();
507+
if_exprt if_expr(expr.op0(), expr.op0(), expr.op1(), expr.type());
513508
if_expr.add_source_location()=expr.source_location();
514509

515510
if(if_expr.cond().type()!=bool_typet())

src/goto-symex/symex_assign.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,7 @@ void goto_symext::symex_assign_symbol(
223223
// put assignment guard into the rhs
224224
if(!guard.is_true())
225225
{
226-
if_exprt tmp_ssa_rhs;
227-
tmp_ssa_rhs.type()=ssa_rhs.type();
228-
tmp_ssa_rhs.cond()=guard.as_expr();
229-
tmp_ssa_rhs.true_case()=ssa_rhs;
230-
tmp_ssa_rhs.false_case()=lhs;
226+
if_exprt tmp_ssa_rhs(guard.as_expr(), ssa_rhs, lhs, ssa_rhs.type());
231227
tmp_ssa_rhs.swap(ssa_rhs);
232228
}
233229

src/util/expr_util.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,8 @@ if_exprt lift_if(const exprt &src, std::size_t operand_number)
205205
const exprt true_case=if_expr.true_case();
206206
const exprt false_case=if_expr.false_case();
207207

208-
if_exprt result;
209-
result.cond()=if_expr.cond();
210-
result.type()=src.type();
211-
result.true_case()=src;
208+
if_exprt result(if_expr.cond(), src, src);
212209
result.true_case().operands()[operand_number]=true_case;
213-
result.false_case()=src;
214210
result.false_case().operands()[operand_number]=false_case;
215211

216212
return result;

0 commit comments

Comments
 (0)