diff --git a/infer/src/eradicate/eradicateChecks.ml b/infer/src/eradicate/eradicateChecks.ml index e8aa2b15e..a4d2e9430 100644 --- a/infer/src/eradicate/eradicateChecks.ml +++ b/infer/src/eradicate/eradicateChecks.ml @@ -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 *) diff --git a/infer/src/eradicate/typeCheck.ml b/infer/src/eradicate/typeCheck.ml index cfc304b88..0e8dcece1 100644 --- a/infer/src/eradicate/typeCheck.ml +++ b/infer/src/eradicate/typeCheck.ml @@ -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