From 928ab4099b873e196ce27077abd72917c537721f Mon Sep 17 00:00:00 2001 From: 2over12 Date: Mon, 13 Jan 2025 12:43:32 -0500 Subject: [PATCH] hacky fix for callgraph --- GillianCore/gil_parser/gil_parsing.ml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/GillianCore/gil_parser/gil_parsing.ml b/GillianCore/gil_parser/gil_parsing.ml index 5989e5b6..49923437 100644 --- a/GillianCore/gil_parser/gil_parsing.ml +++ b/GillianCore/gil_parser/gil_parsing.ml @@ -57,6 +57,13 @@ module Make (Annot : Annot.S) = struct in { labeled_prog; init_data } + let get_callees (proc : ('a, 'b) Proc.t) : string list = + Array.to_list proc.proc_body + |> List.filter_map (function + | _, _, Cmd.Call (_, Expr.Lit (Literal.String callee), _, _, _) -> + Some callee + | _ -> None) + let trans_procs procs path internal_file = let procs' = Hashtbl.create Config.small_tbl_size in let () = @@ -67,7 +74,9 @@ module Make (Annot : Annot.S) = struct else Some path in let proc_internal = proc.proc_internal || internal_file in - Hashtbl.add procs' name { proc with proc_source_path; proc_internal }) + let proc_calls = get_callees proc in + Hashtbl.add procs' name + { proc with proc_source_path; proc_internal; proc_calls }) procs in procs'