diff --git a/infer/src/backend/CallGraph.ml b/infer/src/backend/CallGraph.ml index 679c668cb..99a05f2dc 100644 --- a/infer/src/backend/CallGraph.ml +++ b/infer/src/backend/CallGraph.ml @@ -33,10 +33,13 @@ module Node : NodeSig = struct let unset_flag n = n.flag <- false - let pp_dot fmt {id; pname; successors} = + let pp_dot fmt {id; pname; successors; flag} = let pp_id fmt id = F.fprintf fmt "N%d" id in let pp_edge fmt src dst = F.fprintf fmt " %a -> %a ;@\n" pp_id src pp_id dst in - F.fprintf fmt " %a [ label = %S ];@\n" pp_id id (F.asprintf "%a" Typ.Procname.pp pname) ; + let pp_flag fmt flag = F.fprintf fmt "%B" flag in + F.fprintf fmt " %a [ label = %S, flag = %a ];@\n" pp_id id + (F.asprintf "%a" Typ.Procname.pp pname) + pp_flag flag ; List.iter successors ~f:(pp_edge fmt id) ; F.pp_print_newline fmt () end diff --git a/infer/src/backend/InferAnalyze.ml b/infer/src/backend/InferAnalyze.ml index 0918b83bd..50fabce1c 100644 --- a/infer/src/backend/InferAnalyze.ml +++ b/infer/src/backend/InferAnalyze.ml @@ -150,6 +150,8 @@ let invalidate_changed_procedures changed_files = SourceFiles.proc_names_of_source sf |> List.iter ~f:(CallGraph.flag_reachable reverse_callgraph) ) changed_files ; + if Config.debug_level_analysis > 0 then + CallGraph.to_dotty reverse_callgraph "reverse_analysis_callgraph.dot" ; CallGraph.iter_flagged reverse_callgraph ~f:(fun node -> SpecsFiles.delete node.pname) ; (* save some memory *) CallGraph.reset reverse_callgraph diff --git a/infer/src/backend/SyntacticCallGraph.ml b/infer/src/backend/SyntacticCallGraph.ml index 03c27a9fb..530b19d6d 100644 --- a/infer/src/backend/SyntacticCallGraph.ml +++ b/infer/src/backend/SyntacticCallGraph.ml @@ -37,7 +37,7 @@ let build_from_sources g sources = SourceFiles.proc_names_of_source sf |> List.iter ~f:(CallGraph.flag_reachable g) ) ; CallGraph.remove_unflagged_and_unflag_all g ; CallGraph.trim_id_map g ; - if Config.debug_level_analysis > 0 then CallGraph.to_dotty g "callgraph.dot" ; + if Config.debug_level_analysis > 0 then CallGraph.to_dotty g "syntactic_callgraph.dot" ; L.progress "Built call graph in %a, from %d total procs, %d reachable defined procs and takes %d bytes@." Mtime.Span.pp (Mtime_clock.count time0) n_captured (CallGraph.n_procs g)