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

Loading…
Cancel
Save