Fix treatment of recursion and double file descriptor close in on-demand.

Reviewed By: jeremydubreil

Differential Revision: D2850579

fb-gh-sync-id: 7cb2476
master
Cristiano Calcagno 9 years ago committed by facebook-github-bot-5
parent f34f2dcd98
commit 97a3aa3d0b

@ -40,14 +40,19 @@ let proc_is_up_to_date gr pname =
| None -> false | None -> false
| Some summary -> | Some summary ->
let filter dependent_proc = let filter dependent_proc =
Specs.get_timestamp summary = try
Procname.Map.find dependent_proc summary.Specs.dependency_map in Specs.get_timestamp summary =
Procname.Map.find dependent_proc summary.Specs.dependency_map
with Not_found -> (* can happen in on-demand *)
true in
Procname.Set.for_all filter (Cg.get_defined_children gr pname) Procname.Set.for_all filter (Cg.get_defined_children gr pname)
(** Return the list of procedures which should perform a phase (** Return the list of procedures which should perform a phase
transition from [FOOTPRINT] to [RE_EXECUTION] *) transition from [FOOTPRINT] to [RE_EXECUTION] *)
let should_perform_transition gr proc_name : Procname.t list = let should_perform_transition gr proc_name : Procname.t list =
let recursive_dependents = Cg.get_recursive_dependents gr proc_name in let recursive_dependents =
if !Config.ondemand_enabled then Procname.Set.empty
else Cg.get_recursive_dependents gr proc_name in
let recursive_dependents_plus_self = Procname.Set.add proc_name recursive_dependents in let recursive_dependents_plus_self = Procname.Set.add proc_name recursive_dependents in
let should_transition = let should_transition =
Specs.get_phase proc_name == Specs.FOOTPRINT && Specs.get_phase proc_name == Specs.FOOTPRINT &&

@ -146,7 +146,6 @@ let do_analysis curr_pdesc proc_name =
match !callbacks_ref with match !callbacks_ref with
| Some callbacks | Some callbacks
when procedure_should_be_analyzed curr_pdesc proc_name -> when procedure_should_be_analyzed curr_pdesc proc_name ->
begin begin
match callbacks.get_proc_desc proc_name with match callbacks.get_proc_desc proc_name with
| Some proc_desc -> | Some proc_desc ->

@ -92,7 +92,8 @@ end = struct
let finish_node nodeid = let finish_node nodeid =
let fname = id_to_fname nodeid in let fname = id_to_fname nodeid in
let fd = Hashtbl.find log_files (fname, !DB.current_source) in let fd = Hashtbl.find log_files (fname, !DB.current_source) in
Unix.close fd; if not !Config.ondemand_enabled (* TODO: close all file descriptors at the end in on-demand *)
then Unix.close fd;
html_formatter := F.std_formatter html_formatter := F.std_formatter
end end
(* =============== END of module Log_nodes =============== *) (* =============== END of module Log_nodes =============== *)

Loading…
Cancel
Save