@ -590,6 +590,17 @@ type resolve_and_analyze_result =
; resolved_procdesc_opt : Procdesc . t option
; resolved_procdesc_opt : Procdesc . t option
; resolved_summary_opt : ( Procdesc . t * BiabductionSummary . t ) option }
; resolved_summary_opt : ( Procdesc . t * BiabductionSummary . t ) option }
let get_proc_desc proc_name =
if BiabductionModels . mem proc_name then AnalysisCallbacks . get_model_proc_desc proc_name
else Procdesc . load proc_name
let get_attributes proc_name =
if BiabductionModels . mem proc_name then
AnalysisCallbacks . get_model_proc_desc proc_name | > Option . map ~ f : Procdesc . get_attributes
else Attributes . load proc_name
(* * Resolve the procedure name and run the analysis of the resolved procedure if not already
(* * Resolve the procedure name and run the analysis of the resolved procedure if not already
analyzed * )
analyzed * )
let resolve_and_analyze { InterproceduralAnalysis . analyze_dependency ; proc_desc ; tenv }
let resolve_and_analyze { InterproceduralAnalysis . analyze_dependency ; proc_desc ; tenv }
@ -601,15 +612,15 @@ let resolve_and_analyze {InterproceduralAnalysis.analyze_dependency; proc_desc;
whether the method is defined or generated by the specialization * )
whether the method is defined or generated by the specialization * )
let analyze_ondemand resolved_pname =
let analyze_ondemand resolved_pname =
if Procname . equal resolved_pname callee_proc_name then
if Procname . equal resolved_pname callee_proc_name then
( AnalysisCallbacks . get_proc_desc callee_proc_name , analyze_dependency callee_proc_name )
( get_proc_desc callee_proc_name , analyze_dependency callee_proc_name )
else
else
(* Create the type specialized procedure description and analyze it directly *)
(* Create the type specialized procedure description and analyze it directly *)
let resolved_proc_desc_option =
let resolved_proc_desc_option =
match AnalysisCallbacks . get_proc_desc resolved_pname with
match get_proc_desc resolved_pname with
| Some _ as resolved_proc_desc ->
| Some _ as resolved_proc_desc ->
resolved_proc_desc
resolved_proc_desc
| None ->
| None ->
let procdesc_opt = AnalysisCallbacks . get_proc_desc callee_proc_name in
let procdesc_opt = get_proc_desc callee_proc_name in
Option . map procdesc_opt ~ f : ( fun callee_proc_desc ->
Option . map procdesc_opt ~ f : ( fun callee_proc_desc ->
(* It is possible that the types of the arguments are not as precise as the type of
(* It is possible that the types of the arguments are not as precise as the type of
the objects in the heap , so we should update them to get the best results . * )
the objects in the heap , so we should update them to get the best results . * )
@ -988,7 +999,7 @@ let execute_store ?(report_deref_errors = true) ({InterproceduralAnalysis.tenv;
let is_variadic_procname callee_pname =
let is_variadic_procname callee_pname =
Option . exists ( AnalysisCallbacks . proc_resolve _attributes callee_pname ) ~ f : ( fun proc_attrs ->
Option . exists ( get _attributes callee_pname ) ~ f : ( fun proc_attrs ->
proc_attrs . ProcAttributes . is_variadic )
proc_attrs . ProcAttributes . is_variadic )
@ -1002,9 +1013,7 @@ let resolve_and_analyze_no_dynamic_dispatch {InterproceduralAnalysis.analyze_dep
callee_pname
callee_pname
in
in
let resolved_summary_opt = analyze_dependency resolved_pname in
let resolved_summary_opt = analyze_dependency resolved_pname in
{ resolved_pname
{ resolved_pname ; resolved_procdesc_opt = get_proc_desc resolved_pname ; resolved_summary_opt }
; resolved_procdesc_opt = AnalysisCallbacks . get_proc_desc resolved_pname
; resolved_summary_opt }
let resolve_and_analyze_clang analysis_data prop_r n_actual_params callee_pname call_flags =
let resolve_and_analyze_clang analysis_data prop_r n_actual_params callee_pname call_flags =
@ -1556,9 +1565,7 @@ and unknown_or_scan_call ~is_scan ~reason ret_typ ret_annots
callee_pname ret_annots loc path_pos
callee_pname ret_annots loc path_pos
in
in
let callee_loc_opt =
let callee_loc_opt =
Option . map
Option . map ~ f : ( fun attributes -> attributes . ProcAttributes . loc ) ( get_attributes callee_pname )
~ f : ( fun attributes -> attributes . ProcAttributes . loc )
( AnalysisCallbacks . proc_resolve_attributes callee_pname )
in
in
let skip_path = Paths . Path . add_skipped_call path callee_pname reason callee_loc_opt in
let skip_path = Paths . Path . add_skipped_call path callee_pname reason callee_loc_opt in
[ ( prop_with_undef_attr , skip_path ) ]
[ ( prop_with_undef_attr , skip_path ) ]
@ -1600,7 +1607,7 @@ and check_variadic_sentinel ?(fails_on_nil = false) n_formals (sentinel, null_po
and check_variadic_sentinel_if_present ( { Builtin . prop_ ; path ; proc_name } as builtin_args ) =
and check_variadic_sentinel_if_present ( { Builtin . prop_ ; path ; proc_name } as builtin_args ) =
match AnalysisCallbacks . proc_resolve _attributes proc_name with
match get _attributes proc_name with
| Some callee_attributes -> (
| Some callee_attributes -> (
match callee_attributes . ProcAttributes . sentinel_attr with
match callee_attributes . ProcAttributes . sentinel_attr with
| Some sentinel ->
| Some sentinel ->