diff --git a/infer/src/backend/reporting.ml b/infer/src/backend/reporting.ml index d89b34038..b164b0509 100644 --- a/infer/src/backend/reporting.ml +++ b/infer/src/backend/reporting.ml @@ -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 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 | Some summary -> log_issue_from_summary err_kind summary ?loc ?node_id ?session ?ltr ?linters_def_file exn; - if Config.checkers then - (* TODO (#16348004): Remove this once Specs.get_summary_unsafe is entirely removed *) + if store_summary then + (* TODO (#16348004): This is currently needed as ThreadSafety works as a cluster checker *) Specs.store_summary summary | None -> 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_info_from_summary = log_issue_from_summary Exceptions.Kwarning -let log_error = log_issue Exceptions.Kerror -let log_warning = log_issue Exceptions.Kwarning -let log_info = log_issue Exceptions.Kinfo +let log_error ?(store_summary=false) = log_issue ~store_summary Exceptions.Kerror +let log_warning ?(store_summary=false) = log_issue ~store_summary Exceptions.Kwarning +let log_info ?(store_summary=false) = log_issue ~store_summary Exceptions.Kinfo diff --git a/infer/src/backend/reporting.mli b/infer/src/backend/reporting.mli index e7d0b665c..2d49d087c 100644 --- a/infer/src/backend/reporting.mli +++ b/infer/src/backend/reporting.mli @@ -23,13 +23,13 @@ type log_t = type log_issue_from_errlog = Errlog.t -> log_t (** 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. *) -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. *) -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. *) val log_issue_from_errlog : Exceptions.err_kind -> log_issue_from_errlog diff --git a/infer/src/backend/state.ml b/infer/src/backend/state.ml index 1ebab033d..c23102299 100644 --- a/infer/src/backend/state.ml +++ b/infer/src/backend/state.ml @@ -307,6 +307,7 @@ let mark_instr_fail exn = fs.instr_fail <- fs.instr_fail + 1 type log_issue = + ?store_summary: bool -> Typ.Procname.t -> ?loc: Location.t -> ?node_id: (int * int) -> diff --git a/infer/src/backend/state.mli b/infer/src/backend/state.mli index 9e0e2f00e..5356ce467 100644 --- a/infer/src/backend/state.mli +++ b/infer/src/backend/state.mli @@ -85,6 +85,7 @@ val mark_instr_ok : unit -> unit val mk_find_duplicate_nodes: Procdesc.t -> (Procdesc.Node.t -> Procdesc.NodeSet.t) type log_issue = + ?store_summary: bool -> Typ.Procname.t -> ?loc: Location.t -> ?node_id: (int * int) -> diff --git a/infer/src/checkers/ThreadSafety.ml b/infer/src/checkers/ThreadSafety.ml index 67c9d8f27..1034d9c81 100644 --- a/infer/src/checkers/ThreadSafety.ml +++ b/infer/src/checkers/ThreadSafety.ml @@ -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 description = make_description tenv pname final_sink_site initial_sink_site final_sink 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 Option.iter ~f:report_one_path (PathDomain.get_reportable_sink_path access ~trace_of_pname)