Skip to content
Snippets Groups Projects
Commit 12e98c22 authored by Valentin Perrelle's avatar Valentin Perrelle Committed by David Bühler
Browse files

[Eva] api: Add callers and callsites requests

parent 2705efe2
No related branches found
No related tags found
No related merge requests found
......@@ -72,11 +72,15 @@ module Results: sig
val is_initialized : evaluation -> bool
val alarms : evaluation -> Alarms.t list
(* Bottomness *)
(* Reachability *)
val is_bottom : evaluation -> bool
val is_called : Cil_types.kernel_function -> bool (* called during the analysis, not by the actual program *)
val is_reachable : Cil_types.stmt -> bool (* reachable by the analysis, not by the actual program *)
(* Callers / callsites *)
val callers : Cil_types.kernel_function -> Cil_types.kernel_function list
val callsites : Cil_types.kernel_function -> Cil_types.stmt list
end
module Value_results: sig
......
......@@ -631,7 +631,7 @@ let alarms evaluation =
let module E = (val evaluation : Evaluation) in
E.alarms E.v
(* Bottomness *)
(* Reachability *)
let is_bottom evaluation =
let module E = (val evaluation : Evaluation) in
......@@ -644,3 +644,21 @@ let is_called kf =
let is_reachable stmt =
let module M = Make () in
M.is_reachable (before stmt)
(* Callers / callsites *)
let callers kf =
let f = function
| [] | [_] -> None
| _ :: (kf,_) :: _-> Some kf
in
at_start_of kf |> callstacks |>
List.filter_map f |> List.sort_uniq Kernel_function.compare
let callsites kf =
let f = function
| [] | (_,Cil_types.Kglobal) :: _ -> None
| (_,Kstmt stmt) :: _-> Some stmt
in
at_start_of kf |> callstacks |>
List.filter_map f |> List.sort_uniq Cil_datatype.Stmt.compare
......@@ -92,9 +92,13 @@ val as_zone : lvaluation -> Locations.Zone.t result
val is_initialized : evaluation -> bool
val alarms : evaluation -> Alarms.t list
(* Bottomness *)
(* Reachability *)
val is_bottom : evaluation -> bool
val is_called : Cil_types.kernel_function -> bool (* called during the analysis, not by the actual program *)
val is_reachable : Cil_types.stmt -> bool (* reachable by the analysis, not by the actual program *)
(* Callers / callsites *)
val callers : Cil_types.kernel_function -> Cil_types.kernel_function list
val callsites : Cil_types.kernel_function -> Cil_types.stmt list
[@@@ api_end]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment