let rec add_caller_nodes kf acc (undef,nodes) =
let callers = !Db.Value.callers kf in
List.fold_left
(fun acc (kf,stmts) ->
let pdg = !Db.Pdg.get kf in
let acc_undef,caller_nodes =
List.fold_left (fun (acc_undef,acc) stmt ->
let nodes_for_undef, undef' =
!Db.Pdg.find_location_nodes_at_stmt pdg stmt ~before:true
undef
in
let acc_undef = match undef' with
| None -> acc_undef
| Some z -> Locations.Zone.join acc_undef z
in
List.fold_left (fun (acc_undef,acc) (node,_) ->
match !Db.Pdg.node_key node with
| PdgIndex.Key.SigKey (PdgIndex.Signature.In in_key) ->
begin match in_key with
| PdgIndex.Signature.InCtrl ->
acc_undef,acc
| PdgIndex.Signature.InNum n_param ->
acc_undef,
(!Db.Pdg.find_call_input_node pdg stmt n_param,None)::acc
| PdgIndex.Signature.InImpl z ->
let nodes,undef'=
!Db.Pdg.find_location_nodes_at_stmt pdg stmt ~before:true z
in
let acc_undef = match undef' with
| None -> acc_undef
| Some z -> Locations.Zone.join acc_undef z
in
acc_undef, nodes@acc
end
| _ -> acc_undef,acc)
(acc_undef,nodes_for_undef@acc)
nodes)
(Locations.Zone.bottom,[])
stmts
in
add_caller_nodes kf (caller_nodes@acc) (acc_undef,caller_nodes))
acc
callers