let find_location_nodes_at_stmt pdg stmt ~before loc =
let get_nodes state = find_loc_nodes pdg state loc in
let get_stmt_nodes stmt = get_nodes (get_stmt_state pdg stmt) in
let get_stmts_nodes stmts =
let add (acc_nodes, acc_loc) stmt =
let nodes, undef = get_stmt_nodes stmt in
let acc_nodes = acc_nodes @ nodes in
let acc_loc = match acc_loc, undef with
| _, None -> acc_loc
| None, _ -> undef
| Some acc_loc, Some undef -> Some (Locations.Zone.join acc_loc undef)
in (acc_nodes, acc_loc)
in List.fold_left add ([], None) stmts
in
let nodes, undef_zone =
if before
then get_stmt_nodes stmt
else match stmt.skind, stmt.succs with
| Return _, [] -> get_nodes (get_last_state pdg)
| _, [] ->
raise Not_found
| _, succs ->
get_stmts_nodes succs
in nodes, undef_zone