diff --git a/infer/src/backend/callbacks.ml b/infer/src/backend/callbacks.ml index cc7df3bbf..77fcd7a5b 100644 --- a/infer/src/backend/callbacks.ml +++ b/infer/src/backend/callbacks.ml @@ -130,7 +130,7 @@ let iterate_callbacks call_graph exe_env = (* analyze all the currently defined procedures *) Cg.get_defined_nodes call_graph in - let analyze_ondemand _ summary proc_desc = + let analyze_ondemand summary proc_desc = let proc_name = Procdesc.get_proc_name proc_desc in iterate_procedure_callbacks exe_env summary proc_name in diff --git a/infer/src/backend/interproc.ml b/infer/src/backend/interproc.ml index 659345a4e..b5d1fbeef 100644 --- a/infer/src/backend/interproc.ml +++ b/infer/src/backend/interproc.ml @@ -1434,7 +1434,7 @@ let do_analysis_closures exe_env : Tasks.closure list = Option.bind (Specs.get_summary proc_name) (fun summary -> summary.Specs.proc_desc_option) | None -> None in - let analyze_ondemand _ _ proc_desc = + let analyze_ondemand _ proc_desc = let proc_name = Procdesc.get_proc_name proc_desc in let tenv = Exe_env.get_tenv exe_env proc_name in if not (Procdesc.did_preanalysis proc_desc) diff --git a/infer/src/backend/ondemand.ml b/infer/src/backend/ondemand.ml index 2d93ad6d0..9b7d59d8a 100644 --- a/infer/src/backend/ondemand.ml +++ b/infer/src/backend/ondemand.ml @@ -27,7 +27,7 @@ let dirs_to_analyze = changed_files String.Set.empty in Option.map ~f:process_changed_files SourceFile.changed_files_set -type analyze_ondemand = SourceFile.t -> Specs.summary -> Procdesc.t -> Specs.summary +type analyze_ondemand = Specs.summary -> Procdesc.t -> Specs.summary type get_proc_desc = Typ.Procname.t -> Procdesc.t option @@ -131,28 +131,18 @@ let run_proc_analysis ~propagate_exceptions analyze_proc curr_pdesc callee_pdesc incr nesting; let attributes_opt = Specs.proc_resolve_attributes callee_pname in - let source = - Option.value_map - ~f:(fun (attributes : ProcAttributes.t) -> - let attribute_pname = attributes.proc_name in - if not (Typ.Procname.equal callee_pname attribute_pname) then - failwith ("ERROR: "^(Typ.Procname.to_string callee_pname) - ^" not equal to "^(Typ.Procname.to_string attribute_pname)); - attributes.loc.file) - ~default:SourceFile.invalid - attributes_opt in let callee_pdesc_option = if Config.dynamic_dispatch = `Lazy then Some callee_pdesc else None in let initial_summary = Specs.reset_summary callee_pname attributes_opt callee_pdesc_option in Specs.set_status callee_pname Specs.Active; - source, initial_summary in + initial_summary in - let postprocess source summary = + let postprocess summary = decr nesting; Specs.store_summary summary; - Printer.write_proc_html source callee_pdesc; + Printer.write_proc_html callee_pdesc; log_elapsed_time (); summary in @@ -167,11 +157,11 @@ let run_proc_analysis ~propagate_exceptions analyze_proc curr_pdesc callee_pdesc new_summary in let old_state = save_global_state () in - let source, initial_summary = preprocess () in + let initial_summary = preprocess () in try let summary = - analyze_proc source initial_summary callee_pdesc - |> postprocess source in + analyze_proc initial_summary callee_pdesc + |> postprocess in restore_global_state old_state; summary with exn -> diff --git a/infer/src/backend/ondemand.mli b/infer/src/backend/ondemand.mli index 7569921ef..5d5913be6 100644 --- a/infer/src/backend/ondemand.mli +++ b/infer/src/backend/ondemand.mli @@ -15,7 +15,7 @@ open! IStd will be analyzed *) val dirs_to_analyze : String.Set.t option -type analyze_ondemand = SourceFile.t -> Specs.summary -> Procdesc.t -> Specs.summary +type analyze_ondemand = Specs.summary -> Procdesc.t -> Specs.summary type get_proc_desc = Typ.Procname.t -> Procdesc.t option diff --git a/infer/src/backend/printer.ml b/infer/src/backend/printer.ml index a75a6dc55..b6a42bc06 100644 --- a/infer/src/backend/printer.ml +++ b/infer/src/backend/printer.ml @@ -416,10 +416,11 @@ let node_finish_session node = (** Write html file for the procedure. The boolean indicates whether to print whole seconds only *) -let write_proc_html source pdesc = +let write_proc_html pdesc = if Config.write_html then begin let pname = Procdesc.get_proc_name pdesc in + let source = (Procdesc.get_loc pdesc).file in let nodes = List.sort ~cmp:Procdesc.Node.compare (Procdesc.get_nodes pdesc) in let linenum = (Procdesc.Node.get_loc (List.hd_exn nodes)).Location.line in let fd, fmt = diff --git a/infer/src/backend/printer.mli b/infer/src/backend/printer.mli index 34a97c1be..8c33b31c3 100644 --- a/infer/src/backend/printer.mli +++ b/infer/src/backend/printer.mli @@ -46,7 +46,7 @@ val node_is_visited : Procdesc.Node.t -> bool * bool val node_start_session : Procdesc.Node.t -> int -> unit (** Write html file for the procedure. *) -val write_proc_html : SourceFile.t -> Procdesc.t -> unit +val write_proc_html : Procdesc.t -> unit (** Create filename.ext.html for each file in the cluster. *) val write_all_html_files : Cluster.t -> unit diff --git a/infer/src/unit/TaintTests.ml b/infer/src/unit/TaintTests.ml index e4a04298e..efe8b3dcf 100644 --- a/infer/src/unit/TaintTests.ml +++ b/infer/src/unit/TaintTests.ml @@ -110,7 +110,7 @@ let tests = make_load_fld ~rhs_typ:(Typ.mk Tvoid) lhs_id_str fld_str (Exp.Var (ident_of_str root_str)) in let assert_empty = invariant "{ }" in (* hack: register an empty analyze_ondemand to prevent a crash because the callback is unset *) - let analyze_ondemand _ summary _ = summary in + let analyze_ondemand summary _ = summary in let get_proc_desc _ = None in let callbacks = {