[infer][checkers] fix performance issue when running the biabduction analysis as a checker

Summary:
With this change, running the biabduction analysis with
  infer -a infer -- ...
or with:
  infer -a checkers --biabduction -- ...
take the same time and give the same list of results.

Reviewed By: sblackshear

Differential Revision: D5026676

fbshipit-source-id: ef23911
master
Jeremy Dubreil 8 years ago committed by Facebook Github Bot
parent b5b12ba9ff
commit 8de5b7b85c

@ -53,12 +53,21 @@ let log_issue_from_summary err_kind summary ?loc ?node_id ?session ?ltr ?linters
let err_log = summary.Specs.attributes.ProcAttributes.err_log in let err_log = summary.Specs.attributes.ProcAttributes.err_log in
log_issue_from_errlog err_kind err_log ?loc ?node_id ?session ?ltr ?linters_def_file exn log_issue_from_errlog err_kind err_log ?loc ?node_id ?session ?ltr ?linters_def_file exn
let log_issue err_kind proc_name ?loc ?node_id ?session ?ltr ?linters_def_file exn = let log_issue
?(store_summary=false)
err_kind
proc_name
?loc
?node_id
?session
?ltr
?linters_def_file
exn =
match Specs.get_summary proc_name with match Specs.get_summary proc_name with
| Some summary -> | Some summary ->
log_issue_from_summary err_kind summary ?loc ?node_id ?session ?ltr ?linters_def_file exn; log_issue_from_summary err_kind summary ?loc ?node_id ?session ?ltr ?linters_def_file exn;
if Config.checkers then if store_summary then
(* TODO (#16348004): Remove this once Specs.get_summary_unsafe is entirely removed *) (* TODO (#16348004): This is currently needed as ThreadSafety works as a cluster checker *)
Specs.store_summary summary Specs.store_summary summary
| None -> | None ->
failwithf failwithf
@ -75,6 +84,6 @@ let log_error_from_summary = log_issue_from_summary Exceptions.Kerror
let log_warning_from_summary = log_issue_from_summary Exceptions.Kwarning let log_warning_from_summary = log_issue_from_summary Exceptions.Kwarning
let log_info_from_summary = log_issue_from_summary Exceptions.Kwarning let log_info_from_summary = log_issue_from_summary Exceptions.Kwarning
let log_error = log_issue Exceptions.Kerror let log_error ?(store_summary=false) = log_issue ~store_summary Exceptions.Kerror
let log_warning = log_issue Exceptions.Kwarning let log_warning ?(store_summary=false) = log_issue ~store_summary Exceptions.Kwarning
let log_info = log_issue Exceptions.Kinfo let log_info ?(store_summary=false) = log_issue ~store_summary Exceptions.Kinfo

@ -23,13 +23,13 @@ type log_t =
type log_issue_from_errlog = Errlog.t -> log_t type log_issue_from_errlog = Errlog.t -> log_t
(** Report an error in the given procedure. *) (** Report an error in the given procedure. *)
val log_error : Typ.Procname.t -> log_t val log_error : ?store_summary:bool -> Typ.Procname.t -> log_t
(** Report a warning in the given procedure. *) (** Report a warning in the given procedure. *)
val log_warning : Typ.Procname.t -> log_t val log_warning : ?store_summary:bool -> Typ.Procname.t -> log_t
(** Report an info in the given procedure. *) (** Report an info in the given procedure. *)
val log_info : Typ.Procname.t -> log_t val log_info : ?store_summary:bool -> Typ.Procname.t -> log_t
(** Report an issue of a given kind in the given error log. *) (** Report an issue of a given kind in the given error log. *)
val log_issue_from_errlog : Exceptions.err_kind -> log_issue_from_errlog val log_issue_from_errlog : Exceptions.err_kind -> log_issue_from_errlog

@ -307,6 +307,7 @@ let mark_instr_fail exn =
fs.instr_fail <- fs.instr_fail + 1 fs.instr_fail <- fs.instr_fail + 1
type log_issue = type log_issue =
?store_summary: bool ->
Typ.Procname.t -> Typ.Procname.t ->
?loc: Location.t -> ?loc: Location.t ->
?node_id: (int * int) -> ?node_id: (int * int) ->

@ -85,6 +85,7 @@ val mark_instr_ok : unit -> unit
val mk_find_duplicate_nodes: Procdesc.t -> (Procdesc.Node.t -> Procdesc.NodeSet.t) val mk_find_duplicate_nodes: Procdesc.t -> (Procdesc.Node.t -> Procdesc.NodeSet.t)
type log_issue = type log_issue =
?store_summary: bool ->
Typ.Procname.t -> Typ.Procname.t ->
?loc: Location.t -> ?loc: Location.t ->
?node_id: (int * int) -> ?node_id: (int * int) ->

@ -955,7 +955,7 @@ let report_thread_safety_violation tenv pdesc ~make_description ?(conflicts=[])
let msg = Localise.to_issue_id Localise.thread_safety_violation in let msg = Localise.to_issue_id Localise.thread_safety_violation in
let description = make_description tenv pname final_sink_site initial_sink_site final_sink in let description = make_description tenv pname final_sink_site initial_sink_site final_sink in
let exn = Exceptions.Checkers (msg, Localise.verbatim_desc description) in let exn = Exceptions.Checkers (msg, Localise.verbatim_desc description) in
Reporting.log_error pname ~loc ~ltr exn in Reporting.log_error ~store_summary:true pname ~loc ~ltr exn in
let trace_of_pname = trace_of_pname access pdesc in let trace_of_pname = trace_of_pname access pdesc in
Option.iter ~f:report_one_path (PathDomain.get_reportable_sink_path access ~trace_of_pname) Option.iter ~f:report_one_path (PathDomain.get_reportable_sink_path access ~trace_of_pname)

Loading…
Cancel
Save