@@ -1602,16 +1602,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1602
1602
mp_integer number;
1603
1603
bool ret=to_integer (to_constant_expr (arg0), number);
1604
1604
INVARIANT (!ret, " ifnonnull argument should be an integer" );
1605
- code_ifthenelset code_branch;
1606
- const typecast_exprt lhs (op[0 ], java_reference_type (empty_typet ()));
1607
- const exprt rhs (null_pointer_exprt (to_pointer_type (lhs.type ())));
1608
- code_branch.cond ()=binary_relation_exprt (lhs, ID_notequal, rhs);
1609
- code_branch.then_case ()=code_gotot (label (integer2string (number)));
1610
- code_branch.then_case ().add_source_location ()=
1611
- address_map.at (integer2unsigned (number)).source ->source_location ;
1612
- code_branch.add_source_location ()=i_it->source_location ;
1613
-
1614
- c=code_branch;
1605
+ c = convert_ifnonull (address_map, op, number, i_it->source_location );
1615
1606
}
1616
1607
else if (statement==patternt (" ifnull" ))
1617
1608
{
@@ -2561,6 +2552,23 @@ codet java_bytecode_convert_methodt::convert_instructions(
2561
2552
return code;
2562
2553
}
2563
2554
2555
+ codet java_bytecode_convert_methodt::convert_ifnonull (
2556
+ const java_bytecode_convert_methodt::address_mapt &address_map,
2557
+ const exprt::operandst &op,
2558
+ const mp_integer &number,
2559
+ const source_locationt &location) const
2560
+ {
2561
+ code_ifthenelset code_branch;
2562
+ const typecast_exprt lhs (op[0 ], java_reference_type (empty_typet ()));
2563
+ const exprt rhs (null_pointer_exprt (to_pointer_type (lhs.type ())));
2564
+ code_branch.cond () = binary_relation_exprt (lhs, ID_notequal, rhs);
2565
+ code_branch.then_case () = code_gotot (label (integer2string (number)));
2566
+ code_branch.then_case ().add_source_location () =
2567
+ address_map.at (integer2unsigned (number)).source ->source_location ;
2568
+ code_branch.add_source_location () = location;
2569
+ return code_branch;
2570
+ }
2571
+
2564
2572
codet java_bytecode_convert_methodt::convert_if (
2565
2573
const java_bytecode_convert_methodt::address_mapt &address_map,
2566
2574
const exprt::operandst &op,
0 commit comments