@ -8,7 +8,6 @@
open ! IStd
module F = Format
open PolyVariantEqual
module Stats = struct
type t =
@ -96,14 +95,6 @@ let get_err_log summary = summary.err_log
let get_loc summary = ( get_attributes summary ) . ProcAttributes . loc
type cache = t Typ . Procname . Hash . t
let cache : cache = Typ . Procname . Hash . create 128
let clear_cache () = Typ . Procname . Hash . clear cache
let remove_from_cache pname = Typ . Procname . Hash . remove cache pname
let pp_errlog fmt err_log =
F . fprintf fmt " ERRORS: @[<h>%a@]@ \n %! " Errlog . pp_errors err_log ;
F . fprintf fmt " WARNINGS: @[<h>%a@] " Errlog . pp_warnings err_log
@ -139,6 +130,17 @@ let pp_html source fmt summary =
F . fprintf fmt " </LISTING>@ \n "
module OnDisk = struct
open PolyVariantEqual
type cache = t Typ . Procname . Hash . t
let cache : cache = Typ . Procname . Hash . create 128
let clear_cache () = Typ . Procname . Hash . clear cache
let remove_from_cache pname = Typ . Procname . Hash . remove cache pname
(* * Add the summary to the table for the given function *)
let add ( proc_name : Typ . Procname . t ) ( summary : t ) : unit =
Typ . Procname . Hash . replace cache proc_name summary
@ -165,7 +167,9 @@ let specs_models_filename pname =
DB . filename_from_string ( Filename . concat Config . models_dir ( specs_filename pname ) )
let has_model pname = Sys . file_exists ( DB . filename_to_string ( specs_models_filename pname ) ) = ` Yes
let has_model pname =
Sys . file_exists ( DB . filename_to_string ( specs_models_filename pname ) ) = ` Yes
let summary_serializer : t Serialization . serializer =
Serialization . create_serializer Serialization . Key . summary
@ -203,8 +207,11 @@ let load_summary_to_spec_table =
let get proc_name =
try Some ( Typ . Procname . Hash . find cache proc_name )
with Caml . Not_found -> load_summary_to_spec_table proc_name
match Typ . Procname . Hash . find cache proc_name with
| summary ->
Some summary
| exception Caml . Not_found ->
load_summary_to_spec_table proc_name
(* * Check if the procedure is from a library:
@ -239,7 +246,7 @@ let store (summ : t) =
~ data : final_summary
let init_summary proc_desc =
let reset proc_desc =
let summary =
{ sessions = ref 0
; payloads = Payloads . empty
@ -258,11 +265,8 @@ let dummy =
ProcAttributes . default ( SourceFile . invalid _ _ FILE__ ) Typ . Procname . empty_block
in
let dummy_proc_desc = Procdesc . from_proc_attributes dummy_attributes in
init_summary dummy_proc_desc
reset dummy_proc_desc
(* * Reset a summary rebuilding the dependents and preserving the proc attributes if present. *)
let reset proc_desc = init_summary proc_desc
let reset_all ~ filter () =
let reset proc_name =
@ -273,7 +277,7 @@ let reset_all ~filter () =
Serialization . write_to_file summary_serializer filename ~ data : blank_summary )
in
Procedures . get_all ~ filter () | > List . iter ~ f : reset
end
module SummaryValue = struct
type nonrec t = t option