From ac158b26ea68960d67c74745f9c3e21a53d67e6d Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Fri, 23 Jul 2021 02:29:02 -0700 Subject: [PATCH] [attrs] look at capture DB only -- annotreach 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: D29816181 fbshipit-source-id: e7a2f809c --- infer/src/checkers/annotationReachability.ml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/infer/src/checkers/annotationReachability.ml b/infer/src/checkers/annotationReachability.ml index 08d7b5840..82b4dce65 100644 --- a/infer/src/checkers/annotationReachability.ml +++ b/infer/src/checkers/annotationReachability.ml @@ -115,8 +115,7 @@ let report_annotation_stack ({InterproceduralAnalysis.proc_desc; err_log} as ana let report_call_stack end_of_stack lookup_next_calls report call_site sink_map = let lookup_location pname = - Option.value_map ~f:ProcAttributes.get_loc ~default:Location.dummy - (AnalysisCallbacks.proc_resolve_attributes pname) + Option.value_map ~f:ProcAttributes.get_loc ~default:Location.dummy (Attributes.load pname) in let rec loop fst_call_loc visited_pnames trace (callee_pname, call_loc) = if end_of_stack callee_pname then report fst_call_loc trace callee_pname call_loc @@ -206,7 +205,7 @@ end module CxxAnnotationSpecs = struct let src_path_of pname = - match AnalysisCallbacks.proc_resolve_attributes pname with + match Attributes.load pname with | Some proc_attrs -> let loc = ProcAttributes.get_loc proc_attrs in SourceFile.to_string loc.file