[cfgs] only analyse *defined* procedures

Summary:
There's nothing to analyse for declared procedures, and if there is then
that's because they are defined outside the source file and should not
be analysed unless ondemand needs them.

Reviewed By: ngorogiannis

Differential Revision: D10173353

fbshipit-source-id: 39c42eb7a
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent 2a51bdabaf
commit b8240eadc1

@ -24,9 +24,9 @@ let iter_over_sorted_procs cfg ~f =
|> List.iter ~f
let get_all_proc_names cfg =
let get_all_defined_proc_names cfg =
let procs = ref [] in
let f pname _ = procs := pname :: !procs in
let f pname pdesc = if Procdesc.is_defined pdesc then procs := pname :: !procs in
Typ.Procname.Hash.iter f cfg ; !procs

@ -16,8 +16,8 @@ type t = Procdesc.t Typ.Procname.Hash.t
val load : SourceFile.t -> t option
(** Load the cfgs of the procedures of a source file *)
val get_all_proc_names : t -> Typ.Procname.t list
(** get all the keys from the hashtable *)
val get_all_defined_proc_names : t -> Typ.Procname.t list
(** get all the procedure names that are defined in the current file *)
(** {2 Functions for manipulating an interprocedural CFG} *)

@ -65,7 +65,8 @@ let add source_file cfg tenv =
Tenv.SQLite.serialize tenv |> Sqlite3.bind store_stmt 3
(* :tenv *)
|> SqliteUtils.check_result_code db ~log:"store bind type environment" ;
Cfg.get_all_proc_names cfg |> Typ.Procname.SQLiteList.serialize |> Sqlite3.bind store_stmt 4
Cfg.get_all_defined_proc_names cfg
|> Typ.Procname.SQLiteList.serialize |> Sqlite3.bind store_stmt 4
(* :proc_names *)
|> SqliteUtils.check_result_code db ~log:"store bind proc names" ;
Sqlite3.bind store_stmt 5 (Sqlite3.Data.INT Int64.one)

@ -59,7 +59,7 @@ let iterate_procedure_callbacks exe_env summary proc_desc =
let get_procs_in_file proc_name =
match Exe_env.get_cfg exe_env proc_name with
| Some cfg ->
Cfg.get_all_proc_names cfg
Cfg.get_all_defined_proc_names cfg
| None ->
[]
in

Loading…
Cancel
Save