diff --git a/infer/src/backend/ReverseAnalysisCallGraph.ml b/infer/src/backend/ReverseAnalysisCallGraph.ml new file mode 100644 index 000000000..5f68084fb --- /dev/null +++ b/infer/src/backend/ReverseAnalysisCallGraph.ml @@ -0,0 +1,17 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) +open! IStd + +let register_summary graph summary = + let caller_pname = Summary.get_proc_name summary in + let callee_pnames = summary.Summary.callee_pnames in + Typ.Procname.Set.iter + (fun callee_pname -> CallGraph.add_edge graph ~pname:callee_pname ~successor_pname:caller_pname) + callee_pnames + + +let build graph = SpecsFiles.iter ~f:(register_summary graph) diff --git a/infer/src/backend/ReverseAnalysisCallGraph.mli b/infer/src/backend/ReverseAnalysisCallGraph.mli new file mode 100644 index 000000000..feb608232 --- /dev/null +++ b/infer/src/backend/ReverseAnalysisCallGraph.mli @@ -0,0 +1,12 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) +open! IStd + +(* Suppress unused value warning until this is used for incremental diff analysis *) +val build : CallGraph.t -> unit + [@@warning "-32"] +(** Build the graph from the summaries in the .specs files *)