Remove optional caller_summary from Ondemand.analyze_proc_name

Summary:
- Change the method `Ondemand.analyze_proc_name` so that `caller_summary` is not optional

- Introduce a new method `analyze_proc_name_no_caller` to replace `analyze_proc_name` when there is no caller

Reviewed By: ngorogiannis

Differential Revision: D16183378

fbshipit-source-id: c0c67f869
master
Phoebe Nichols 5 years ago committed by Facebook Github Bot
parent dc37aeed5c
commit 542dc9086a

@ -41,19 +41,21 @@ module Make (P : Payload) : S with type t = P.t = struct
let of_summary (summary : Summary.t) = of_payloads summary.payloads
let read_all ?caller_summary ~callee_pname =
let get_payload analysis_result =
let open Option.Monad_infix in
Ondemand.analyze_proc_name ?caller_summary callee_pname
analysis_result
>>= fun summary ->
of_summary summary >>| fun payload -> (Summary.get_proc_desc summary, payload)
let read_full ~caller_summary ~callee_pname = read_all ~caller_summary ~callee_pname
let read_full ~caller_summary ~callee_pname =
Ondemand.analyze_proc_name ~caller_summary callee_pname |> get_payload
let read ~caller_summary ~callee_pname =
read_all ~caller_summary ~callee_pname |> Option.map ~f:snd
Ondemand.analyze_proc_name ~caller_summary callee_pname |> get_payload |> Option.map ~f:snd
let read_toplevel_procedure callee_pname =
read_all ?caller_summary:None ~callee_pname |> Option.map ~f:snd
Ondemand.analyze_proc_name_no_caller callee_pname |> get_payload |> Option.map ~f:snd
end

@ -334,12 +334,18 @@ let analyze_proc_desc ~caller_summary callee_pdesc =
analyze_proc ~caller_summary callee_pname (Some callee_pdesc) should_be_analyzed
(** analyze_proc_name ?caller_summary callee_pname performs an on-demand analysis of callee_pname triggered
(** analyze_proc_name ~caller_summary callee_pname performs an on-demand analysis of callee_pname triggered
during the analysis of caller_summary *)
let analyze_proc_name ?caller_summary callee_pname =
let analyze_proc_name ~caller_summary callee_pname =
let should_be_analyzed = procedure_should_be_analyzed callee_pname in
let callee_pdesc = get_proc_desc callee_pname in
analyze_proc ?caller_summary callee_pname callee_pdesc should_be_analyzed
analyze_proc ~caller_summary callee_pname callee_pdesc should_be_analyzed
let analyze_proc_name_no_caller callee_pname =
let should_be_analyzed = procedure_should_be_analyzed callee_pname in
let callee_pdesc = get_proc_desc callee_pname in
analyze_proc ?caller_summary:None callee_pname callee_pdesc should_be_analyzed
let clear_cache () = Typ.Procname.Hash.clear (Lazy.force cached_results)
@ -349,7 +355,9 @@ let analyze_procedures exe_env procs_to_analyze source_file_opt =
Option.iter source_file_opt ~f:(fun source_file ->
if Config.dump_duplicate_symbols then dump_duplicate_procs source_file procs_to_analyze ) ;
set_exe_env exe_env ;
let analyze_proc_name_call pname = ignore (analyze_proc_name pname : Summary.t option) in
let analyze_proc_name_call pname =
ignore (analyze_proc_name_no_caller pname : Summary.t option)
in
List.iter ~f:analyze_proc_name_call procs_to_analyze ;
Option.iter source_file_opt ~f:(fun source_file ->
Callbacks.iterate_cluster_callbacks procs_to_analyze exe_env source_file ;

@ -16,10 +16,14 @@ val analyze_proc_desc : caller_summary:Summary.t -> Procdesc.t -> Summary.t opti
(** [analyze_proc_desc ~caller_summary callee_pdesc] performs an on-demand analysis of callee_pdesc
triggered during the analysis of caller_summary *)
val analyze_proc_name : ?caller_summary:Summary.t -> Typ.Procname.t -> Summary.t option
val analyze_proc_name : caller_summary:Summary.t -> Typ.Procname.t -> Summary.t option
(** [analyze_proc_name ~caller_summary callee_pname] performs an on-demand analysis of callee_pname
triggered during the analysis of caller_summary *)
val analyze_proc_name_no_caller : Typ.Procname.t -> Summary.t option
(** [analyze_proc_name_no_caller callee_pname] performs an on-demand analysis of callee_pname
triggered by the top-level of a cluster checker *)
val set_exe_env : Exe_env.t -> unit
(** Set the execution enviroment used during on-demand analysis. *)

Loading…
Cancel
Save