Summary: It's typically used inside another ~fold argument and it gets too verbose. Reviewed By: da319 Differential Revision: D22846501 fbshipit-source-id: 2fdd4271f
@ -70,7 +70,7 @@ let filter ~fold ~filter t ~init ~f =
let map ~f:g fold t ~init ~f = fold t ~init ~f:(fun acc item -> f acc (g item))
let fold_of_pervasives_map_fold ~fold collection ~init ~f =
let fold_of_pervasives_map_fold fold collection ~init ~f =
fold (fun item value accum -> f accum (item, value)) collection init
@ -46,7 +46,7 @@ val filter :
val map : f:('a -> 'b) -> ('t, 'a, 'accum) Container.fold -> ('t, 'b, 'accum) Container.fold
val fold_of_pervasives_map_fold :
fold:(('key -> 'value -> 'accum -> 'accum) -> 't -> 'accum -> 'accum)
(('key -> 'value -> 'accum -> 'accum) -> 't -> 'accum -> 'accum)
-> ('t, 'key * 'value, 'accum) Container.fold
val iter_result :
@ -243,9 +243,8 @@ end = struct
let fold ~var_filter astate ~init ~f ~finish =
let finish (visited, accum) = (visited, finish accum) in
let init = (AbstractValue.Set.empty, init) in
Container.fold_until astate.stack
Container.fold_until astate.stack ~fold:(IContainer.fold_of_pervasives_map_fold Stack.fold)
~fold:(IContainer.fold_of_pervasives_map_fold ~fold:Stack.fold) ~init ~finish
~init ~finish ~f:(fun visited_accum (var, (address, _loc)) ->
~f:(fun visited_accum (var, (address, _loc)) ->
if var_filter var then visit_address var ~f [] astate address visited_accum
else Continue visited_accum )
end
@ -76,7 +76,7 @@ let pp_contradiction fmt = function
exception Contradiction of contradiction
let fold_globals_of_stack call_loc stack call_state ~f =
Container.fold_result ~fold:(IContainer.fold_of_pervasives_map_fold ~fold:BaseStack.fold)
Container.fold_result ~fold:(IContainer.fold_of_pervasives_map_fold BaseStack.fold)
stack ~init:call_state ~f:(fun call_state (var, stack_value) ->
match var with
| Var.ProgramVar pvar when Pvar.is_global pvar ->
@ -285,7 +285,7 @@ let check_address_escape escape_location proc_desc address history astate =
in
let check_address_of_stack_variable () =
let proc_name = Procdesc.get_proc_name proc_desc in
IContainer.iter_result ~fold:(IContainer.fold_of_pervasives_map_fold ~fold:Stack.fold) astate
IContainer.iter_result ~fold:(IContainer.fold_of_pervasives_map_fold Stack.fold) astate
~f:(fun (variable, (var_address, _)) ->
if
AbstractValue.equal var_address address