Skip to content

Commit c895f23

Browse files
committed
Use code_ifthenelset constructor
1 parent fc8c74d commit c895f23

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

jbmc/src/java_bytecode/java_bytecode_instrument.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,9 @@ code_ifthenelset java_bytecode_instrumentt::check_class_cast(
251251
check_code=std::move(assert_class);
252252
}
253253

254-
code_ifthenelset conditional_check;
255-
notequal_exprt op_not_null(null_check_op, null_pointer_exprt(voidptr));
256-
conditional_check.cond()=std::move(op_not_null);
257-
conditional_check.then_case()=std::move(check_code);
254+
const code_ifthenelset conditional_check(
255+
notequal_exprt(std::move(null_check_op), null_pointer_exprt(voidptr)),
256+
std::move(check_code));
258257
return conditional_check;
259258
}
260259

jbmc/src/java_bytecode/remove_instanceof.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,6 @@ bool remove_instanceoft::lower_instanceof(
134134
// possible values of T.
135135
// (http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.20.2)
136136

137-
code_ifthenelset is_null_branch;
138-
is_null_branch.cond() =
139-
equal_exprt(
140-
check_ptr, null_pointer_exprt(to_pointer_type(check_ptr.type())));
141-
is_null_branch.then_case() =
142-
code_assignt(instanceof_result_sym.symbol_expr(), false_exprt());
143-
144137
code_blockt else_block;
145138
else_block.add(code_declt(clsid_tmp_sym.symbol_expr()));
146139
else_block.add(code_assignt(clsid_tmp_sym.symbol_expr(), object_clsid));
@@ -155,7 +148,11 @@ bool remove_instanceoft::lower_instanceof(
155148
else_block.add(
156149
code_assignt(instanceof_result_sym.symbol_expr(), disjunction(or_ops)));
157150

158-
is_null_branch.else_case() = std::move(else_block);
151+
const code_ifthenelset is_null_branch(
152+
equal_exprt(
153+
check_ptr, null_pointer_exprt(to_pointer_type(check_ptr.type()))),
154+
code_assignt(instanceof_result_sym.symbol_expr(), false_exprt()),
155+
std::move(else_block));
159156

160157
// Replace the instanceof construct with instanceof_result:
161158
expr = instanceof_result_sym.symbol_expr();

src/ansi-c/c_nondet_symbol_factory.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ void symbol_factoryt::gen_nondet_init(
174174
auto set_null_inst=code_assignt(expr, null_pointer_exprt(pointer_type));
175175
set_null_inst.add_source_location()=loc;
176176

177-
code_ifthenelset null_check;
178-
null_check.cond() = side_effect_expr_nondett(bool_typet(), loc);
179-
null_check.then_case()=set_null_inst;
180-
null_check.else_case()=non_null_inst;
177+
code_ifthenelset null_check(
178+
side_effect_expr_nondett(bool_typet(), loc),
179+
std::move(set_null_inst),
180+
std::move(non_null_inst));
181181

182182
assignments.add(std::move(null_check));
183183
}

0 commit comments

Comments
 (0)