From 9be3af16ac969792f9eb075a7771e340f6af4910 Mon Sep 17 00:00:00 2001 From: Phoebe Nichols Date: Thu, 18 Jul 2019 10:28:17 -0700 Subject: [PATCH] Create ReverseAnalysisCallGraph.ml Summary: The analysis call graph is the call graph from the perspective of the analyses run in infer This commit creates the reverse analysis call graph to be used for incremental diff analysis Reviewed By: ezgicicek Differential Revision: D16335938 fbshipit-source-id: 0cbab3298 --- infer/src/backend/ReverseAnalysisCallGraph.ml | 17 +++++++++++++++++ infer/src/backend/ReverseAnalysisCallGraph.mli | 12 ++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 infer/src/backend/ReverseAnalysisCallGraph.ml create mode 100644 infer/src/backend/ReverseAnalysisCallGraph.mli 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 *)