@@ -2705,15 +2705,19 @@ code_ifthenelset java_bytecode_convert_methodt::convert_ifnull(
27052705 const mp_integer &number,
27062706 const source_locationt &location) const
27072707{
2708- code_ifthenelset code_branch;
27092708 const typecast_exprt lhs (op[0 ], java_reference_type (empty_typet ()));
27102709 const exprt rhs (null_pointer_exprt (to_pointer_type (lhs.type ())));
2711- code_branch. cond () = binary_relation_exprt (lhs, ID_equal, rhs);
2710+
27122711 const method_offsett label_number = numeric_cast_v<method_offsett>(number);
2713- code_branch.then_case () = code_gotot (label (std::to_string (label_number)));
2712+
2713+ code_ifthenelset code_branch (
2714+ binary_relation_exprt (lhs, ID_equal, rhs),
2715+ code_gotot (label (std::to_string (label_number))));
2716+
27142717 code_branch.then_case ().add_source_location () =
27152718 address_map.at (label_number).source ->source_location ;
27162719 code_branch.add_source_location () = location;
2720+
27172721 return code_branch;
27182722}
27192723
@@ -2723,15 +2727,19 @@ code_ifthenelset java_bytecode_convert_methodt::convert_ifnonull(
27232727 const mp_integer &number,
27242728 const source_locationt &location) const
27252729{
2726- code_ifthenelset code_branch;
27272730 const typecast_exprt lhs (op[0 ], java_reference_type (empty_typet ()));
27282731 const exprt rhs (null_pointer_exprt (to_pointer_type (lhs.type ())));
2729- code_branch. cond () = binary_relation_exprt (lhs, ID_notequal, rhs);
2732+
27302733 const method_offsett label_number = numeric_cast_v<method_offsett>(number);
2731- code_branch.then_case () = code_gotot (label (std::to_string (label_number)));
2734+
2735+ code_ifthenelset code_branch (
2736+ binary_relation_exprt (lhs, ID_notequal, rhs),
2737+ code_gotot (label (std::to_string (label_number))));
2738+
27322739 code_branch.then_case ().add_source_location () =
27332740 address_map.at (label_number).source ->source_location ;
27342741 code_branch.add_source_location () = location;
2742+
27352743 return code_branch;
27362744}
27372745
@@ -2742,18 +2750,20 @@ code_ifthenelset java_bytecode_convert_methodt::convert_if(
27422750 const mp_integer &number,
27432751 const source_locationt &location) const
27442752{
2745- code_ifthenelset code_branch;
2746- code_branch.cond () =
2747- binary_relation_exprt (op[0 ], id, from_integer (0 , op[0 ].type ()));
2753+ const method_offsett label_number = numeric_cast_v<method_offsett>(number);
2754+
2755+ code_ifthenelset code_branch (
2756+ binary_relation_exprt (op[0 ], id, from_integer (0 , op[0 ].type ())),
2757+ code_gotot (label (std::to_string (label_number))));
2758+
27482759 code_branch.cond ().add_source_location () = location;
27492760 code_branch.cond ().add_source_location ().set_function (method_id);
2750- const method_offsett label_number = numeric_cast_v<method_offsett>(number);
2751- code_branch.then_case () = code_gotot (label (std::to_string (label_number)));
27522761 code_branch.then_case ().add_source_location () =
27532762 address_map.at (label_number).source ->source_location ;
27542763 code_branch.then_case ().add_source_location ().set_function (method_id);
27552764 code_branch.add_source_location () = location;
27562765 code_branch.add_source_location ().set_function (method_id);
2766+
27572767 return code_branch;
27582768}
27592769
@@ -2764,15 +2774,16 @@ code_ifthenelset java_bytecode_convert_methodt::convert_if_cmp(
27642774 const mp_integer &number,
27652775 const source_locationt &location) const
27662776{
2767- code_ifthenelset code_branch;
27682777 const irep_idt cmp_op = get_if_cmp_operator (statement);
27692778 binary_relation_exprt condition (
27702779 op[0 ], cmp_op, typecast_exprt::conditional_cast (op[1 ], op[0 ].type ()));
27712780 condition.add_source_location () = location;
27722781
2773- code_branch.cond () = condition;
27742782 const method_offsett label_number = numeric_cast_v<method_offsett>(number);
2775- code_branch.then_case () = code_gotot (label (std::to_string (label_number)));
2783+
2784+ code_ifthenelset code_branch (
2785+ std::move (condition), code_gotot (label (std::to_string (label_number))));
2786+
27762787 code_branch.then_case ().add_source_location () =
27772788 address_map.at (label_number).source ->source_location ;
27782789 code_branch.add_source_location () = location;
@@ -2797,15 +2808,16 @@ code_blockt java_bytecode_convert_methodt::convert_ret(
27972808 c.add (g);
27982809 else
27992810 {
2800- code_ifthenelset branch;
28012811 auto address_ptr =
28022812 from_integer (jsr_ret_targets[idx], unsignedbv_typet (64 ));
28032813 address_ptr.type () = pointer_type (void_typet ());
2804- branch.cond () = equal_exprt (retvar, address_ptr);
2814+
2815+ code_ifthenelset branch (equal_exprt (retvar, address_ptr), std::move (g));
2816+
28052817 branch.cond ().add_source_location () = location;
2806- branch.then_case () = g;
28072818 branch.add_source_location () = location;
2808- c.add (branch);
2819+
2820+ c.add (std::move (branch));
28092821 }
28102822 }
28112823 return c;
0 commit comments