[reanalyze] Fix reanalyze option

Summary:
This diff fixes `--reanalyze` option that is to reanalyze specific procedures by removing their
summaries.  It was broken because it tried to store an empty summary with `Status.Analyzed`.

Reviewed By: ezgicicek

Differential Revision: D23344633

fbshipit-source-id: 1c4eca6c0
master
Sungkeun Cho 4 years ago committed by Facebook GitHub Bot
parent 5f2849bf01
commit 4c2d5a4c49

@ -268,24 +268,25 @@ module OnDisk = struct
(** Save summary for the procedure into the spec database *)
let store (summ : t) =
let final_summary = {summ with status= Status.Analyzed} in
let proc_name = get_proc_name final_summary in
let store (summary : t) =
let proc_name = get_proc_name summary in
(* Make sure the summary in memory is identical to the saved one *)
add proc_name final_summary ;
add proc_name summary ;
if Config.biabduction_models_mode then
Serialization.write_to_file summary_serializer
(specs_filename_of_procname proc_name)
~data:final_summary
~data:summary
else
let analysis_summary = AnalysisSummary.of_full_summary final_summary in
let report_summary = ReportSummary.of_full_summary final_summary in
let analysis_summary = AnalysisSummary.of_full_summary summary in
let report_summary = ReportSummary.of_full_summary summary in
DBWriter.store_spec
~proc_name:(Procname.SQLite.serialize proc_name)
~analysis_summary:(AnalysisSummary.SQLite.serialize analysis_summary)
~report_summary:(ReportSummary.SQLite.serialize report_summary)
let store_analyzed summary = store {summary with status= Status.Analyzed}
let reset proc_desc =
let summary =
{ sessions= 0

@ -73,7 +73,7 @@ module OnDisk : sig
(** Try to find the attributes for a defined proc. First look at specs (to get attributes computed
by analysis) then look at the attributes table. If no attributes can be found, return None. *)
val store : t -> unit
val store_analyzed : t -> unit
(** Save summary for the procedure into the spec database *)
val reset_all : filter:Filtering.procedures_filter -> unit -> unit

@ -185,7 +185,7 @@ let run_proc_analysis ~caller_pdesc callee_pdesc =
in
let postprocess summary =
decr nesting ;
Summary.OnDisk.store summary ;
Summary.OnDisk.store_analyzed summary ;
remove_active callee_pname ;
Printer.write_proc_html callee_pdesc ;
log_elapsed_time () ;
@ -202,7 +202,7 @@ let run_proc_analysis ~caller_pdesc callee_pdesc =
{summary.payloads with biabduction}
in
let new_summary = {summary with stats; payloads} in
Summary.OnDisk.store new_summary ;
Summary.OnDisk.store_analyzed new_summary ;
remove_active callee_pname ;
log_elapsed_time () ;
new_summary

Loading…
Cancel
Save