File tree 2 files changed +7
-9
lines changed
2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -321,10 +321,10 @@ bool recursive_initializationt::should_be_treated_as_array(
321
321
initialization_config.pointers_to_treat_as_arrays .end ();
322
322
}
323
323
324
- optionalt<std:: size_t >
324
+ optionalt<recursive_initializationt::equal_cluster_idt >
325
325
recursive_initializationt::find_equal_cluster (const irep_idt &name) const
326
326
{
327
- for (size_t index = 0 ;
327
+ for (equal_cluster_idt index = 0 ;
328
328
index != initialization_config.pointers_to_treat_equal .size ();
329
329
++index )
330
330
{
@@ -820,10 +820,7 @@ code_blockt recursive_initializationt::build_dynamic_array_constructor(
820
820
821
821
bool recursive_initializationt::needs_freeing (const exprt &expr) const
822
822
{
823
- if (expr.type ().id () != ID_pointer || expr.type ().id () == ID_code)
824
- return false ;
825
- else
826
- return true ;
823
+ return expr.type ().id () == ID_pointer && expr.type ().id () != ID_code;
827
824
}
828
825
829
826
void recursive_initializationt::free_if_possible (
@@ -846,9 +843,9 @@ void recursive_initializationt::free_if_possible(
846
843
.get_identifier () != expr_id &&
847
844
initialization_config.arguments_may_be_equal )
848
845
{
849
- // in equality cluster but not common origin -> free if equal to origin
846
+ // in equality cluster but not common origin -> free if not equal to origin
850
847
const auto condition =
851
- equal_exprt {expr, *common_arguments_origins[*maybe_cluster_index]};
848
+ notequal_exprt {expr, *common_arguments_origins[*maybe_cluster_index]};
852
849
body.add (code_ifthenelset{condition, call_free});
853
850
}
854
851
else
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ class recursive_initializationt
60
60
public:
61
61
using recursion_sett = std::set<irep_idt>;
62
62
using type_constructor_namest = std::map<typet, irep_idt>;
63
+ using equal_cluster_idt = std::size_t ;
63
64
64
65
recursive_initializationt (
65
66
recursive_initialization_configt initialization_config,
@@ -102,7 +103,7 @@ class recursive_initializationt
102
103
symbol_exprt get_malloc_function ();
103
104
104
105
bool should_be_treated_as_array (const irep_idt &pointer_name) const ;
105
- optionalt<std:: size_t > find_equal_cluster (const irep_idt &name) const ;
106
+ optionalt<equal_cluster_idt > find_equal_cluster (const irep_idt &name) const ;
106
107
bool is_array_size_parameter (const irep_idt &cmdline_arg) const ;
107
108
optionalt<irep_idt>
108
109
get_associated_size_variable (const irep_idt &array_name) const ;
You can’t perform that action at this time.
0 commit comments