[infer][eradicate] Use the summary of callee returned by the on-demand analysis call instead of the one in the specs cache

Summary: Having a summary for a callee from the specs cache does not necessarily mean that Eradicate has been run on it. This diff looks at the Eradicate payload instead from the return of the on-demand analysis instead.

Reviewed By: sblackshear

Differential Revision: D6054376

fbshipit-source-id: c6eec35
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent aa54b1b035
commit 23101f4e57

@ -398,8 +398,8 @@ type resolved_param =
; propagates_nullable: bool }
(** Check the parameters of a call. *)
let check_call_parameters tenv find_canonical_duplicate curr_pdesc node callee_attributes
resolved_params loc instr_ref : unit =
let check_call_parameters tenv find_canonical_duplicate curr_pdesc node callee_summary_opt
callee_attributes resolved_params loc instr_ref : unit =
let callee_pname = callee_attributes.ProcAttributes.proc_name in
let tot_param_num = List.length resolved_params in
let check {num= param_num; formal= s1, ta1, t1; actual= orig_e2, ta2} =
@ -438,7 +438,7 @@ let check_call_parameters tenv find_canonical_duplicate curr_pdesc node callee_a
let should_check_parameters =
if check_library_calls then true
else Models.is_modelled_nullable callee_pname || callee_attributes.ProcAttributes.is_defined
|| Specs.get_summary callee_pname <> None
|| Option.is_some callee_summary_opt
in
if should_check_parameters then
(* left to right to avoid guessing the different lengths *)

@ -531,9 +531,15 @@ let typecheck_instr tenv ext calls_this checks (node: Procdesc.Node.t) idenv get
, etl_
, loc
, cflags ) ->
ignore (Ondemand.analyze_proc_name curr_pdesc callee_pname) ;
let callee_summary_opt = Ondemand.analyze_proc_name curr_pdesc callee_pname in
let callee_attributes =
match Specs.proc_resolve_attributes (* AttributesTable.load_attributes *) callee_pname with
let proc_attriutes_opt =
Option.value_map
~default:(Specs.proc_resolve_attributes callee_pname)
~f:(fun summary -> Some (Specs.get_attributes summary))
callee_summary_opt
in
match proc_attriutes_opt with
| Some proc_attributes ->
proc_attributes
| None ->
@ -830,7 +836,7 @@ let typecheck_instr tenv ext calls_this checks (node: Procdesc.Node.t) idenv get
(typecheck_expr find_canonical_duplicate calls_this checks) ;
if checks.eradicate then
EradicateChecks.check_call_parameters tenv find_canonical_duplicate curr_pdesc node
callee_attributes resolved_params loc instr_ref ;
callee_summary_opt callee_attributes resolved_params loc instr_ref ;
let typestate2 =
if checks.check_extension then
let etl' = List.map ~f:(fun ((_, e), t) -> (e, t)) call_params in

Loading…
Cancel
Save