From 3f4458361c7fdeae1ee8b5024ed11b6fb26aec5c Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Wed, 26 Feb 2020 04:10:27 -0800 Subject: [PATCH] [scheduler][callgraph] only load defined procs Summary: To ease scheduling, it would be best to only load the procnames of procedures that are (a) defined and (b) reachable from the modified files. The frontends play various games with the DB properties: - In Clang all methods have a CFG even if they are undefined. Also, looking for non-NULL CFG rows in the DB brings up methods unreachable from modified files (?). - In Java, some procedures have NULL CFGs. In addition, some of those have `attr_kind!=0`. We only load those procedures that have both non-NULL CFGs and `attr_kind!=0`. That seems to give meaningful numbers, esp. wrt reachable procedures from files. Reviewed By: jberdine Differential Revision: D20068376 fbshipit-source-id: 992b65b4a --- infer/src/backend/SyntacticCallGraph.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/infer/src/backend/SyntacticCallGraph.ml b/infer/src/backend/SyntacticCallGraph.ml index e3f1b6f0b..7a816fd11 100644 --- a/infer/src/backend/SyntacticCallGraph.ml +++ b/infer/src/backend/SyntacticCallGraph.ml @@ -19,7 +19,11 @@ let build_from_captured_procs g = IdMap.add pname_tbl pname pname ; pname in let db = ResultsDatabase.get_database () in - let stmt = Sqlite3.prepare db "SELECT proc_name, callees FROM procedures" in + (* only load procedure info for those we have a CFG *) + let stmt = + Sqlite3.prepare db + "SELECT proc_name, callees FROM procedures WHERE cfg IS NOT NULL and attr_kind != 0" + in SqliteUtils.result_fold_rows db ~log:"creating call graph" stmt ~init:() ~f:(fun () stmt -> let proc_name = Sqlite3.column stmt 0 |> Procname.SQLite.deserialize |> hashcons_pname in let callees =