From 41c402116268985c9d5a5aade00e637387d44d26 Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Fri, 23 Jul 2021 02:29:24 -0700 Subject: [PATCH] [attrs] look at capture DB only -- pulse Summary: `AnalysisCallbacks.proc_resolve_attributes` introduces non-determinism because it first looks for the attributes in a (procdesc in a) summary and if it doesn't find it then returns the value in the attribute column from the capture DB. The problem is: - the main factor affecting the existence of a summary on-disk is timing; - the two proc descs are generally different, as the one in the summary is preanalysed and the one in the capture DB is not; - this extends to the attributes included in the proc desc in some cases. The plan is to eliminate these calls one by one, replacing with `Attributes.load` which only looks at the capture DB attribute column. Reviewed By: skcho Differential Revision: D29817582 fbshipit-source-id: 24f9dfcc3 --- infer/src/pulse/Pulse.ml | 4 +--- infer/src/pulse/PulseModels.ml | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/infer/src/pulse/Pulse.ml b/infer/src/pulse/Pulse.ml index f78f2a081..8b1333e74 100644 --- a/infer/src/pulse/Pulse.ml +++ b/infer/src/pulse/Pulse.ml @@ -29,9 +29,7 @@ module PulseTransferFunctions = struct type analysis_data = PulseSummary.t InterproceduralAnalysis.t - let get_pvar_formals pname = - AnalysisCallbacks.proc_resolve_attributes pname |> Option.map ~f:Pvar.get_pvar_formals - + let get_pvar_formals pname = IRAttributes.load pname |> Option.map ~f:Pvar.get_pvar_formals let interprocedural_call {InterproceduralAnalysis.analyze_dependency; tenv; proc_desc} path ret callee_pname call_exp actuals call_loc astate = diff --git a/infer/src/pulse/PulseModels.ml b/infer/src/pulse/PulseModels.ml index e5341254e..3fe69d573 100644 --- a/infer/src/pulse/PulseModels.ml +++ b/infer/src/pulse/PulseModels.ml @@ -6,6 +6,7 @@ *) open! IStd +module IRAttributes = Attributes open PulseBasicInterface open PulseDomainInterface open PulseOperations.Import @@ -96,10 +97,7 @@ module Misc = struct List.map args ~f:(fun {ProcnameDispatcher.Call.FuncArg.arg_payload= actual; typ} -> (actual, typ) ) in - let formals_opt = - AnalysisCallbacks.proc_resolve_attributes callee_procname - |> Option.map ~f:Pvar.get_pvar_formals - in + let formals_opt = IRAttributes.load callee_procname |> Option.map ~f:Pvar.get_pvar_formals in let<+> astate = PulseCallOperations.unknown_call tenv path location (Model skip_reason) ~ret ~actuals ~formals_opt astate