@ -44,7 +44,6 @@ let unregister_all_callbacks () =
procedure_callbacks := [] ;
cluster_callbacks := []
(* * Collect what we need to know about a procedure for the analysis. *)
let get_procedure_definition exe_env proc_name =
let tenv = Exe_env . get_tenv exe_env proc_name in
@ -57,6 +56,17 @@ let get_procedure_definition exe_env proc_name =
let get_language proc_name = if Procname . is_java proc_name then Config . Java else Config . Clang
let reset_summary proc_name =
let should_reset =
is_none ( Specs . get_summary proc_name ) in
if should_reset
then
let attributes_opt =
Specs . proc_resolve_attributes proc_name in
Specs . reset_summary proc_name attributes_opt None
(* * Invoke all registered procedure callbacks on the given procedure. *)
let iterate_procedure_callbacks exe_env caller_pname =
let procedure_language = get_language caller_pname in
@ -132,14 +142,24 @@ let iterate_cluster_callbacks all_procs exe_env proc_names =
cluster_callback exe_env all_procs get_procdesc environment )
! cluster_callbacks
(* * Invoke all procedure and cluster callbacks on a given environment. *)
let iterate_callbacks call_graph exe_env =
let saved_language = ! Config . curr_language in
let procs_to_analyze =
(* analyze all the currently defined procedures *)
Cg . get_defined_nodes call_graph in
(* Make sure summaries exists. *)
List . iter ~ f : reset_summary procs_to_analyze ;
(* Invoke procedure callbacks. *)
List . iter
~ f : ( iterate_procedure_callbacks exe_env )
procs_to_analyze ;
let originally_defined_procs =
Cg . get_defined_nodes call_graph in
let saved_language = ! Config . curr_language in
let cluster_id proc_name =
match proc_name with
@ -158,22 +178,8 @@ let iterate_callbacks call_graph exe_env =
proc_names in
(* Return all values of the map *)
String . Map . data cluster_map in
let reset_summary proc_name =
let attributes_opt =
Specs . proc_resolve_attributes proc_name in
let should_reset =
is_none ( Specs . get_summary proc_name ) in
if should_reset
then Specs . reset_summary proc_name attributes_opt None in
(* Make sure summaries exists. *)
List . iter ~ f : reset_summary procs_to_analyze ;
(* Invoke callbacks. *)
List . iter
~ f : ( iterate_procedure_callbacks exe_env )
procs_to_analyze ;
(* Invoke cluster callbacks. *)
List . iter
~ f : ( iterate_cluster_callbacks originally_defined_procs exe_env )
( cluster procs_to_analyze ) ;