[infer] the function to pretty-print the call graph does not need to access the analysis summaries

Summary: This function is always used in the frontend where summaries don't exist yet

Reviewed By: akotulski

Differential Revision: D4979132

fbshipit-source-id: 8d49c52
master
Jeremy Dubreil 8 years ago committed by Facebook Github Bot
parent 7b44236874
commit 250d9cb8b3

@ -372,18 +372,8 @@ let store_to_file (filename: DB.filename) (call_graph: t) =>
Serialization.write_to_file
callgraph_serializer filename data::(call_graph.source, get_nodes_and_edges call_graph);
let pp_graph_dotty get_specs (g: t) fmt => {
let pp_graph_dotty (g: t) fmt => {
let nodes_with_calls = get_all_nodes g;
let num_specs n =>
try (List.length (get_specs n)) {
| exn when SymOp.exn_not_failure exn => (-1)
};
let get_color (n, _) =>
if (num_specs n != 0) {
"green"
} else {
"red"
};
let get_shape (n, _) =>
if (node_defined g n) {
"box"
@ -392,14 +382,7 @@ let pp_graph_dotty get_specs (g: t) fmt => {
};
let pp_node fmt (n, _) => F.fprintf fmt "\"%s\"" (Typ.Procname.to_filename n);
let pp_node_label fmt (n, calls) =>
F.fprintf
fmt
"\"%a | calls=%d %d | specs=%d)\""
Typ.Procname.pp
n
calls.in_calls
calls.out_calls
(num_specs n);
F.fprintf fmt "\"%a | calls=%d %d)\"" Typ.Procname.pp n calls.in_calls calls.out_calls;
F.fprintf fmt "digraph {@\n";
List.iter
f::(
@ -411,7 +394,7 @@ let pp_graph_dotty get_specs (g: t) fmt => {
nc
pp_node_label
nc
(get_color nc)
"red"
(get_shape nc)
)
nodes_with_calls;
@ -421,11 +404,11 @@ let pp_graph_dotty get_specs (g: t) fmt => {
/** Print the call graph as a dotty file. */
let save_call_graph_dotty source get_specs (g: t) => {
let save_call_graph_dotty source (g: t) => {
let fname_dot =
DB.Results_dir.path_to_filename (DB.Results_dir.Abs_source_dir source) ["call_graph.dot"];
let outc = open_out (DB.filename_to_string fname_dot);
let fmt = F.formatter_of_out_channel outc;
pp_graph_dotty get_specs g fmt;
pp_graph_dotty g fmt;
Out_channel.close outc
};

@ -117,7 +117,7 @@ let remove_node_defined: t => Typ.Procname.t => unit;
/** Print the call graph as a dotty file. */
let save_call_graph_dotty: SourceFile.t => (Typ.Procname.t => list 'a) => t => unit;
let save_call_graph_dotty: SourceFile.t => t => unit;
/** Save a call graph into a file */

@ -66,7 +66,7 @@ let do_source_file translation_unit_context ast =
|| Config.frontend_tests
|| Option.is_some Config.icfg_dotty_outfile then
(Dotty.print_icfg_dotty source_file cfg;
Cg.save_call_graph_dotty source_file Specs.get_specs call_graph);
Cg.save_call_graph_dotty source_file call_graph);
Logging.out_debug "%a" Cfg.pp_proc_signatures cfg;
(* NOTE: nothing should be written to source_dir after this *)
DB.mark_file_updated (DB.source_dir_to_string source_dir)

@ -43,7 +43,7 @@ let store_icfg source_file tenv cg cfg =
if Config.debug_mode || Config.frontend_tests then
begin
Dotty.print_icfg_dotty source_file cfg;
Cg.save_call_graph_dotty source_file Specs.get_specs cg
Cg.save_call_graph_dotty source_file cg
end;
(* NOTE: nothing should be written to source_dir after this *)
DB.mark_file_updated (DB.source_dir_to_string source_dir)

Loading…
Cancel
Save