let state_top_addresses_of_locals
is_block offsetmap_top_addresses_of_locals fundec =
let f k offsm =
let r,found_locals = offsetmap_top_addresses_of_locals offsm in
if found_locals then
warn_locals_escape is_block fundec k;
r
in
(fun (state:Relations_type.Model.t) ->
let simple_state = Relations_type.Model.value_state state in
let f base acc =
try
let offset_to_clean = Cvalue_type.Model.find_base base simple_state in
let cleaned_offsetmap = f base offset_to_clean in
Cvalue_type.Model.add_offsetmap base cleaned_offsetmap acc
with Not_found -> acc
in
try
Relations_type.Model.inject
(Location_Bits.Top_Param.fold
f
!bases_containing_locals
(f Base.null simple_state))
with Location_Bits.Top_Param.Error_Top ->
begin
let f k offsm acc =
let r,found_locals = offsetmap_top_addresses_of_locals offsm in
if found_locals then
warn_locals_escape is_block fundec k;
Cvalue_type.Model.add_offsetmap k r acc
in
let result =
try
Relations_type.Model.inject
(Cvalue_type.Model.fold_base_offsetmap
f
(Relations_type.Model.value_state state)
Cvalue_type.Model.empty)
with Cvalue_type.Model.Error_Bottom -> Relations_type.Model.bottom
in
result
end)