[infer][ondemand] minor simplification of the top-level iteration

Summary: This should make no difference as the `Ondemand` would already only run the analysis when the procedure description is found, and naturally skip the analysis otherwise.

Reviewed By: sblackshear, jvillard

Differential Revision: D6705813

fbshipit-source-id: 44bffee
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent 5b95f51b52
commit 7bbb615740

@ -89,10 +89,7 @@ let iterate_cluster_callbacks all_procs exe_env get_proc_desc =
(** Invoke all procedure and cluster callbacks on a given environment. *) (** Invoke all procedure and cluster callbacks on a given environment. *)
let iterate_callbacks call_graph exe_env = let iterate_callbacks call_graph exe_env =
let saved_language = !Config.curr_language in let saved_language = !Config.curr_language in
let procs_to_analyze = (* Create and register on-demand analysis callback *)
(* analyze all the currently defined procedures *)
Cg.get_defined_nodes call_graph
in
let get_proc_desc proc_name = let get_proc_desc proc_name =
match Exe_env.get_proc_desc exe_env proc_name with match Exe_env.get_proc_desc exe_env proc_name with
| Some pdesc -> | Some pdesc ->
@ -103,17 +100,17 @@ let iterate_callbacks call_graph exe_env =
let analyze_ondemand summary proc_desc = let analyze_ondemand summary proc_desc =
iterate_procedure_callbacks get_proc_desc exe_env summary proc_desc iterate_procedure_callbacks get_proc_desc exe_env summary proc_desc
in in
let callbacks = {Ondemand.analyze_ondemand; get_proc_desc} in Ondemand.set_callbacks {Ondemand.analyze_ondemand; get_proc_desc} ;
(* Create and register on-demand analysis callback *) (* Invoke procedure callbacks using on-demand analysis schedulling *)
let procs_to_analyze =
(* analyze all the currently defined procedures *)
Cg.get_defined_nodes call_graph
in
let analyze_proc_name pname = let analyze_proc_name pname =
match Ondemand.get_proc_desc pname with Option.iter
| None -> ~f:(fun pdesc -> ignore (Ondemand.analyze_proc_desc pdesc pdesc))
L.internal_error "Could not find proc desc for %a" Typ.Procname.pp pname (Ondemand.get_proc_desc pname)
| Some pdesc ->
ignore (Ondemand.analyze_proc_desc pdesc pdesc)
in in
Ondemand.set_callbacks callbacks ;
(* Invoke procedure callbacks using on-demand anlaysis schedulling *)
List.iter ~f:analyze_proc_name procs_to_analyze ; List.iter ~f:analyze_proc_name procs_to_analyze ;
(* Invoke cluster callbacks. *) (* Invoke cluster callbacks. *)
iterate_cluster_callbacks procs_to_analyze exe_env get_proc_desc ; iterate_cluster_callbacks procs_to_analyze exe_env get_proc_desc ;

Loading…
Cancel
Save