From 6a6d888419af05055f684f601661567d9226a2d2 Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Thu, 29 Jul 2021 12:04:57 -0700 Subject: [PATCH] [ondemand] only look at capture DB for attributes Summary: Ondemand looks at the attributes in the summary of a function in preference to those in the capture DB, in order to decide whether a function needs to be analysed. This is unnecessary and introduces non-determinism (whether the summary has been written is a race condition; attributes may differ from a pre-analysed CFG vs captured). Switch to only looking at the attributes column in the capture DB. Reviewed By: da319 Differential Revision: D29932634 fbshipit-source-id: 8d7d1b145 --- infer/src/backend/Summary.ml | 10 ---------- infer/src/backend/Summary.mli | 4 ---- infer/src/backend/ondemand.ml | 4 +--- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/infer/src/backend/Summary.ml b/infer/src/backend/Summary.ml index 895a5706d..9ad8442ba 100644 --- a/infer/src/backend/Summary.ml +++ b/infer/src/backend/Summary.ml @@ -268,16 +268,6 @@ module OnDisk = struct else Option.map (get model_name) ~f:(fun (s : full_summary) -> s.proc_desc) - (** 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. *) - let proc_resolve_attributes proc_name = - match get proc_name with - | Some summary -> - Some (get_attributes summary) - | None -> - Attributes.load proc_name - - (** Save summary for the procedure into the spec database *) let store (summary : t) = let proc_name = get_proc_name summary in diff --git a/infer/src/backend/Summary.mli b/infer/src/backend/Summary.mli index df04fc22a..78df563be 100644 --- a/infer/src/backend/Summary.mli +++ b/infer/src/backend/Summary.mli @@ -70,10 +70,6 @@ module OnDisk : sig val reset : Procdesc.t -> t (** Reset a summary rebuilding the dependents and preserving the proc attributes if present. *) - val proc_resolve_attributes : Procname.t -> ProcAttributes.t option - (** 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_analyzed : t -> unit (** Save summary for the procedure into the spec database *) diff --git a/infer/src/backend/ondemand.ml b/infer/src/backend/ondemand.ml index 0594d2c06..fbef91a49 100644 --- a/infer/src/backend/ondemand.ml +++ b/infer/src/backend/ondemand.ml @@ -68,10 +68,8 @@ let should_be_analyzed proc_attributes = (not (is_active proc_name)) (* avoid infinite loops *) && not (already_analyzed proc_name) -let get_proc_attr proc_name = Summary.OnDisk.proc_resolve_attributes proc_name - let procedure_should_be_analyzed proc_name = - match get_proc_attr proc_name with + match Attributes.load proc_name with | Some proc_attributes -> should_be_analyzed proc_attributes | None ->