@@ -714,9 +714,9 @@ void java_bytecode_convert_methodt::replace_goto_target(
714
714
code_blockt &java_bytecode_convert_methodt::get_block_for_pcrange (
715
715
block_tree_nodet &tree,
716
716
code_blockt &this_block,
717
- unsigned address_start,
718
- unsigned address_limit,
719
- unsigned next_block_start_address)
717
+ std:: size_t address_start,
718
+ std:: size_t address_limit,
719
+ std:: size_t next_block_start_address)
720
720
{
721
721
address_mapt dummy;
722
722
return get_or_create_block_for_pcrange (
@@ -746,9 +746,9 @@ code_blockt &java_bytecode_convert_methodt::get_block_for_pcrange(
746
746
code_blockt &java_bytecode_convert_methodt::get_or_create_block_for_pcrange (
747
747
block_tree_nodet &tree,
748
748
code_blockt &this_block,
749
- unsigned address_start,
750
- unsigned address_limit,
751
- unsigned next_block_start_address,
749
+ std:: size_t address_start,
750
+ std:: size_t address_limit,
751
+ std:: size_t next_block_start_address,
752
752
const address_mapt &amap,
753
753
bool allow_merge)
754
754
{
@@ -778,10 +778,9 @@ code_blockt &java_bytecode_convert_methodt::get_or_create_block_for_pcrange(
778
778
tree.branch_addresses .begin (),
779
779
tree.branch_addresses .end (),
780
780
address_limit);
781
- unsigned findlim_block_start_address=
782
- findlim==tree.branch_addresses .end () ?
783
- next_block_start_address :
784
- (*findlim);
781
+ const auto findlim_block_start_address =
782
+ findlim == tree.branch_addresses .end () ? next_block_start_address
783
+ : (*findlim);
785
784
786
785
// If all children are in scope, return this.
787
786
if (findstart==tree.branch_addresses .begin () &&
@@ -924,7 +923,7 @@ code_blockt &java_bytecode_convert_methodt::get_or_create_block_for_pcrange(
924
923
}
925
924
926
925
static void gather_symbol_live_ranges (
927
- unsigned pc,
926
+ std:: size_t pc,
928
927
const exprt &e,
929
928
std::map<irep_idt, java_bytecode_convert_methodt::variablet> &result)
930
929
{
@@ -1002,9 +1001,9 @@ codet java_bytecode_convert_methodt::convert_instructions(
1002
1001
// first pass: get targets and map addresses to instructions
1003
1002
1004
1003
address_mapt address_map;
1005
- std::set<unsigned > targets;
1004
+ std::set<std:: size_t > targets;
1006
1005
1007
- std::vector<unsigned > jsr_ret_targets;
1006
+ std::vector<std:: size_t > jsr_ret_targets;
1008
1007
std::vector<instructionst::const_iterator> ret_instructions;
1009
1008
1010
1009
for (auto i_it = instructions.begin (); i_it != instructions.end (); i_it++)
@@ -1049,9 +1048,9 @@ codet java_bytecode_convert_methodt::convert_instructions(
1049
1048
(threading_support && (i_it->statement ==" monitorenter" ||
1050
1049
i_it->statement ==" monitorexit" )))
1051
1050
{
1052
- const std::vector<unsigned int > handler =
1051
+ const std::vector<std:: size_t > handler =
1053
1052
try_catch_handler (i_it->address , method.exception_table );
1054
- std::list<unsigned int > &successors = a_entry.first ->second .successors ;
1053
+ std::list<std:: size_t > &successors = a_entry.first ->second .successors ;
1055
1054
successors.insert (successors.end (), handler.begin (), handler.end ());
1056
1055
targets.insert (handler.begin (), handler.end ());
1057
1056
}
@@ -1110,7 +1109,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1110
1109
1111
1110
for (const auto &address : address_map)
1112
1111
{
1113
- for (unsigned s : address.second .successors )
1112
+ for (auto s : address.second .successors )
1114
1113
{
1115
1114
const auto a_it = address_map.find (s);
1116
1115
CHECK_RETURN (a_it != address_map.end ());
@@ -1128,7 +1127,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1128
1127
// (these require the graph to determine live ranges)
1129
1128
setup_local_variables (method, address_map);
1130
1129
1131
- std::set<unsigned > working_set;
1130
+ std::set<std:: size_t > working_set;
1132
1131
1133
1132
if (!instructions.empty ())
1134
1133
working_set.insert (instructions.front ().address );
@@ -1139,7 +1138,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1139
1138
auto address_it = address_map.find (*cur);
1140
1139
CHECK_RETURN (address_it != address_map.end ());
1141
1140
auto &instruction = address_it->second ;
1142
- unsigned cur_pc= *cur;
1141
+ const std:: size_t cur_pc = *cur;
1143
1142
working_set.erase (cur);
1144
1143
1145
1144
if (instruction.done )
@@ -1698,7 +1697,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1698
1697
push (results);
1699
1698
1700
1699
instruction.done = true ;
1701
- for (const unsigned address : instruction.successors )
1700
+ for (const auto address : instruction.successors )
1702
1701
{
1703
1702
address_mapt::iterator a_it2=address_map.find (address);
1704
1703
CHECK_RETURN (a_it2 != address_map.end ());
@@ -1807,10 +1806,10 @@ codet java_bytecode_convert_methodt::convert_instructions(
1807
1806
// constructs as variable live-ranges require next.
1808
1807
bool start_new_block=true ;
1809
1808
bool has_seen_previous_address=false ;
1810
- unsigned previous_address= 0 ;
1809
+ std:: size_t previous_address = 0 ;
1811
1810
for (const auto &address_pair : address_map)
1812
1811
{
1813
- const unsigned address= address_pair.first ;
1812
+ const std:: size_t address = address_pair.first ;
1814
1813
assert (address_pair.first ==address_pair.second .source ->address );
1815
1814
const codet &c=address_pair.second .code ;
1816
1815
@@ -1890,8 +1889,8 @@ codet java_bytecode_convert_methodt::convert_instructions(
1890
1889
root,
1891
1890
root_block,
1892
1891
v.start_pc ,
1893
- v.start_pc + v.length ,
1894
- std::numeric_limits<unsigned >::max (),
1892
+ v.start_pc + v.length ,
1893
+ std::numeric_limits<std:: size_t >::max (),
1895
1894
address_map);
1896
1895
}
1897
1896
for (const auto vp : vars_to_process)
@@ -1902,12 +1901,12 @@ codet java_bytecode_convert_methodt::convert_instructions(
1902
1901
// Skip anonymous variables:
1903
1902
if (v.symbol_expr .get_identifier ().empty ())
1904
1903
continue ;
1905
- auto &block= get_block_for_pcrange (
1904
+ auto &block = get_block_for_pcrange (
1906
1905
root,
1907
1906
root_block,
1908
1907
v.start_pc ,
1909
- v.start_pc + v.length ,
1910
- std::numeric_limits<unsigned >::max ());
1908
+ v.start_pc + v.length ,
1909
+ std::numeric_limits<std:: size_t >::max ());
1911
1910
code_declt d (v.symbol_expr );
1912
1911
block.operands ().insert (block.operands ().begin (), d);
1913
1912
}
@@ -1963,7 +1962,8 @@ codet java_bytecode_convert_methodt::convert_switch(
1963
1962
// to the jump target of the tableswitch/lookupswitch case at
1964
1963
// hand. Therefore we consider this code to belong to the source bytecode
1965
1964
// instruction and not the target instruction.
1966
- code_case.code () = code_gotot (label (integer2string (number)));
1965
+ const std::size_t label_number = numeric_cast_v<std::size_t >(number);
1966
+ code_case.code () = code_gotot (label (std::to_string (label_number)));
1967
1967
code_case.code ().add_source_location () = location;
1968
1968
1969
1969
if (a_it == args.begin ())
@@ -2338,8 +2338,8 @@ void java_bytecode_convert_methodt::convert_athrow(
2338
2338
2339
2339
codet &java_bytecode_convert_methodt::do_exception_handling (
2340
2340
const java_bytecode_convert_methodt::methodt &method,
2341
- const std::set<unsigned int > &working_set,
2342
- unsigned int cur_pc,
2341
+ const std::set<std:: size_t > &working_set,
2342
+ std:: size_t cur_pc,
2343
2343
codet &c)
2344
2344
{
2345
2345
std::vector<irep_idt> exception_ids;
@@ -2722,7 +2722,7 @@ codet java_bytecode_convert_methodt::convert_iinc(
2722
2722
const exprt &arg0,
2723
2723
const exprt &arg1,
2724
2724
const source_locationt &location,
2725
- const unsigned address)
2725
+ const std:: size_t address)
2726
2726
{
2727
2727
code_blockt block;
2728
2728
block.add_source_location () = location;
@@ -2756,9 +2756,10 @@ codet java_bytecode_convert_methodt::convert_ifnull(
2756
2756
const typecast_exprt lhs (op[0 ], java_reference_type (empty_typet ()));
2757
2757
const exprt rhs (null_pointer_exprt (to_pointer_type (lhs.type ())));
2758
2758
code_branch.cond () = binary_relation_exprt (lhs, ID_equal, rhs);
2759
- code_branch.then_case () = code_gotot (label (integer2string (number)));
2759
+ const std::size_t label_number = numeric_cast_v<std::size_t >(number);
2760
+ code_branch.then_case () = code_gotot (label (std::to_string (label_number)));
2760
2761
code_branch.then_case ().add_source_location () =
2761
- address_map.at (integer2unsigned (number) ).source ->source_location ;
2762
+ address_map.at (label_number ).source ->source_location ;
2762
2763
code_branch.add_source_location () = location;
2763
2764
return code_branch;
2764
2765
}
@@ -2773,9 +2774,10 @@ codet java_bytecode_convert_methodt::convert_ifnonull(
2773
2774
const typecast_exprt lhs (op[0 ], java_reference_type (empty_typet ()));
2774
2775
const exprt rhs (null_pointer_exprt (to_pointer_type (lhs.type ())));
2775
2776
code_branch.cond () = binary_relation_exprt (lhs, ID_notequal, rhs);
2776
- code_branch.then_case () = code_gotot (label (integer2string (number)));
2777
+ const std::size_t label_number = numeric_cast_v<std::size_t >(number);
2778
+ code_branch.then_case () = code_gotot (label (std::to_string (label_number)));
2777
2779
code_branch.then_case ().add_source_location () =
2778
- address_map.at (integer2unsigned (number) ).source ->source_location ;
2780
+ address_map.at (label_number ).source ->source_location ;
2779
2781
code_branch.add_source_location () = location;
2780
2782
return code_branch;
2781
2783
}
@@ -2792,9 +2794,10 @@ codet java_bytecode_convert_methodt::convert_if(
2792
2794
binary_relation_exprt (op[0 ], id, from_integer (0 , op[0 ].type ()));
2793
2795
code_branch.cond ().add_source_location () = location;
2794
2796
code_branch.cond ().add_source_location ().set_function (method_id);
2795
- code_branch.then_case () = code_gotot (label (integer2string (number)));
2797
+ const std::size_t label_number = numeric_cast_v<std::size_t >(number);
2798
+ code_branch.then_case () = code_gotot (label (std::to_string (label_number)));
2796
2799
code_branch.then_case ().add_source_location () =
2797
- address_map.at (integer2unsigned (number) ).source ->source_location ;
2800
+ address_map.at (label_number ).source ->source_location ;
2798
2801
code_branch.then_case ().add_source_location ().set_function (method_id);
2799
2802
code_branch.add_source_location () = location;
2800
2803
code_branch.add_source_location ().set_function (method_id);
@@ -2821,19 +2824,20 @@ codet java_bytecode_convert_methodt::convert_if_cmp(
2821
2824
2822
2825
code_branch.cond () = condition;
2823
2826
code_branch.cond ().add_source_location () = location;
2824
- code_branch.then_case () = code_gotot (label (integer2string (number)));
2827
+ const std::size_t label_number = numeric_cast_v<std::size_t >(number);
2828
+ code_branch.then_case () = code_gotot (label (std::to_string (label_number)));
2825
2829
code_branch.then_case ().add_source_location () =
2826
- address_map.at (integer2unsigned (number) ).source ->source_location ;
2830
+ address_map.at (label_number ).source ->source_location ;
2827
2831
code_branch.add_source_location () = location;
2828
2832
2829
2833
return code_branch;
2830
2834
}
2831
2835
2832
2836
code_blockt java_bytecode_convert_methodt::convert_ret (
2833
- const std::vector<unsigned int > &jsr_ret_targets,
2837
+ const std::vector<std:: size_t > &jsr_ret_targets,
2834
2838
const exprt &arg0,
2835
2839
const source_locationt &location,
2836
- const unsigned address)
2840
+ const std:: size_t address)
2837
2841
{
2838
2842
code_blockt c;
2839
2843
auto retvar = variable (arg0, ' a' , address, NO_CAST);
@@ -2885,7 +2889,7 @@ codet java_bytecode_convert_methodt::convert_store(
2885
2889
const irep_idt &statement,
2886
2890
const exprt &arg0,
2887
2891
const exprt::operandst &op,
2888
- const unsigned address,
2892
+ const std:: size_t address,
2889
2893
const source_locationt &location)
2890
2894
{
2891
2895
const exprt var = variable (arg0, statement[0 ], address, NO_CAST);
@@ -2974,7 +2978,7 @@ optionalt<exprt> java_bytecode_convert_methodt::convert_invoke_dynamic(
2974
2978
2975
2979
void java_bytecode_convert_methodt::draw_edges_from_ret_to_jsr (
2976
2980
java_bytecode_convert_methodt::address_mapt &address_map,
2977
- const std::vector<unsigned int > &jsr_ret_targets,
2981
+ const std::vector<std:: size_t > &jsr_ret_targets,
2978
2982
const std::vector<
2979
2983
std::vector<java_bytecode_parse_treet::instructiont>::const_iterator>
2980
2984
&ret_instructions) const
@@ -2988,12 +2992,12 @@ void java_bytecode_convert_methodt::draw_edges_from_ret_to_jsr(
2988
2992
}
2989
2993
}
2990
2994
2991
- std::vector<unsigned > java_bytecode_convert_methodt::try_catch_handler (
2992
- const unsigned int address,
2995
+ std::vector<std:: size_t > java_bytecode_convert_methodt::try_catch_handler (
2996
+ const std:: size_t address,
2993
2997
const java_bytecode_parse_treet::methodt::exception_tablet &exception_table)
2994
2998
const
2995
2999
{
2996
- std::vector<unsigned > result;
3000
+ std::vector<std:: size_t > result;
2997
3001
for (const auto &exception_row : exception_table)
2998
3002
{
2999
3003
if (address >= exception_row.start_pc && address < exception_row.end_pc )
0 commit comments