From 9ce2d72677d549aa16203edef41b83e2f7ad44c6 Mon Sep 17 00:00:00 2001
From: Valentin Perrelle <valentin.perrelle@cea.fr>
Date: Mon, 7 Feb 2022 16:58:45 +0100
Subject: [PATCH] [Sparecode] Use the new Eva API

---
 src/plugins/sparecode/register.ml  |  2 +-
 src/plugins/sparecode/transform.ml | 12 +++++-------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/plugins/sparecode/register.ml b/src/plugins/sparecode/register.ml
index a6c985c0dc8..a6a1fa9a5bf 100644
--- a/src/plugins/sparecode/register.ml
+++ b/src/plugins/sparecode/register.ml
@@ -35,7 +35,7 @@ module Result =
     (struct
       let name = "Sparecode"
       let size = 7
-      let dependencies = [ Ast.self; Db.Value.self ] (* delayed, see below *)
+      let dependencies = [ Ast.self; Eva.Analysis.self ] (* delayed, see below *)
     end)
 
 let () =
diff --git a/src/plugins/sparecode/transform.ml b/src/plugins/sparecode/transform.ml
index ce447c3fb94..8c9fb9a68f6 100644
--- a/src/plugins/sparecode/transform.ml
+++ b/src/plugins/sparecode/transform.ml
@@ -81,7 +81,7 @@ module BoolInfo = struct
     key_visible "label_visible" fm lab_key
 
   let annotation_visible _ stmt annot =
-    Db.Value.is_reachable_stmt stmt && Alarms.find annot = None
+    Eva.Results.is_reachable stmt && Alarms.find annot = None
   (* Keep annotations on reachable, but not alarms: they can be resynthesized,
      and the alarms table is not synchronized in the new project anyway *)
   (* TODO: does not seem really coherent with the fact that almost everything
@@ -126,13 +126,11 @@ module BoolInfo = struct
   let called_info (project, _fm) call_stmt =
     match call_stmt.skind with
     | Instr (Call (_, _, _, _) | Local_init(_, ConsInit _, _)) ->
-      let called_functions = Db.Value.call_to_kernel_function call_stmt in
+      let called_functions = Eva.Results.callee call_stmt in
       let call_info =
-        match
-          Kernel_function.Hptset.contains_single_elt called_functions
-        with
-        | None -> None
-        | Some kf ->
+        match called_functions with
+        | [] | _ :: _  :: _ -> None
+        | [kf] ->
           match Spare_marks.get_marks project kf with
           | None ->
             if Spare_marks.kf_visible project kf
-- 
GitLab