[infer][java] avoid redundant calls to the function procedure_should_be_analyzed for Infer.SL

Summary:
This simplifies a bit the code to run the analysis on all the prcedures in the cluster. Before, the functions procedure_should_be_analyzed, which loads the attributes, and get_proc_desc were called twice for the analysis of every procedure.

The objective is to remove the calls to procedure_should_be_analyzed and hide it from the ondemand API since it is already called before the analysis of every procedure.

Reviewed By: sblackshear

Differential Revision: D4553397

fbshipit-source-id: 02cffaf
master
Jeremy Dubreil 8 years ago committed by Facebook Github Bot
parent d19e4eaf86
commit db285f976c

@ -1403,27 +1403,18 @@ let interprocedural_algorithm exe_env : unit =
Int.equal (Specs.get_timestamp summary) 0 in Int.equal (Specs.get_timestamp summary) 0 in
let procs_to_analyze = let procs_to_analyze =
List.filter ~f:filter_initial (Cg.get_defined_nodes call_graph) in List.filter ~f:filter_initial (Cg.get_defined_nodes call_graph) in
let to_analyze proc_name =
match Exe_env.get_proc_desc exe_env proc_name with
| Some proc_desc ->
let reactive_changed =
if Config.reactive_mode
then (Procdesc.get_attributes proc_desc).ProcAttributes.changed
else true in
if
reactive_changed && (* in reactive mode, only analyze changed procedures *)
Ondemand.procedure_should_be_analyzed proc_name
then
Some proc_desc
else
None
| None ->
None in
let process_one_proc proc_name = let process_one_proc proc_name =
match to_analyze proc_name with let analyze proc_desc =
| Some pdesc -> Ondemand.analyze_proc_name ~propagate_exceptions:false pdesc proc_name Ondemand.analyze_proc_desc ~propagate_exceptions:false proc_desc proc_desc in
match Exe_env.get_proc_desc exe_env proc_name with
| Some proc_desc
when Config.reactive_mode (* in reactive mode, only analyze changed procedures *)
&& (Procdesc.get_attributes proc_desc).ProcAttributes.changed ->
analyze proc_desc
| Some proc_desc -> analyze proc_desc
| None -> () in | None -> () in
IList.iter process_one_proc procs_to_analyze List.iter ~f:process_one_proc procs_to_analyze
(** Perform the analysis of an exe_env *) (** Perform the analysis of an exe_env *)
let do_analysis exe_env = let do_analysis exe_env =

Loading…
Cancel
Save