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

[Studia] Use the new Eva API

parent 9221859a
No related branches found
No related tags found
No related merge requests found
...@@ -44,15 +44,13 @@ class find_read zlval = object ...@@ -44,15 +44,13 @@ class find_read zlval = object
let deps = match lvopt with let deps = match lvopt with
| None -> deps | None -> deps
| Some lv -> | Some lv ->
let dlv, _ = let dlv = Eva.Results.(before stmt |> address_deps lv) in
!Db.Value.lval_to_loc_with_deps (Kstmt stmt) ~deps:Zone.bottom lv
in
Zone.join dlv deps Zone.join dlv deps
in in
let direct = Zone.intersects deps zlval in let direct = Zone.intersects deps zlval in
(* now determine if the functions called at [stmt] read directly or (* now determine if the functions called at [stmt] read directly or
indirectly [zlval] *) indirectly [zlval] *)
let aux_kf kf effects = let aux_kf effects kf =
let inputs = !Db.Inputs.get_internal kf in let inputs = !Db.Inputs.get_internal kf in
(* TODO: change to this once we can get "full" inputs through Inout. (* TODO: change to this once we can get "full" inputs through Inout.
Currently, non operational inputs disappear, and this function Currently, non operational inputs disappear, and this function
...@@ -68,9 +66,9 @@ class find_read zlval = object ...@@ -68,9 +66,9 @@ class find_read zlval = object
else else
effects (* this function pointer does not read [zlval] *) effects (* this function pointer does not read [zlval] *)
in in
let kfs = Db.Value.call_to_kernel_function stmt in let kfs = Eva.Results.callee stmt in
let effects = let effects =
Kernel_function.Hptset.fold aux_kf kfs {direct; indirect = false} List.fold_left aux_kf {direct; indirect = false} kfs
in in
res <- (stmt, effects) :: res res <- (stmt, effects) :: res
end end
......
...@@ -90,7 +90,7 @@ struct ...@@ -90,7 +90,7 @@ struct
(Stmt.Map.Make(Datatype.String.Set)) (Stmt.Map.Make(Datatype.String.Set))
(struct (struct
let name = Info.name let name = Info.name
let dependencies = [ Db.Value.self ] let dependencies = [ Eva.Analysis.self ]
let default () = Stmt.Map.empty let default () = Stmt.Map.empty
end) end)
...@@ -184,7 +184,7 @@ module StudiaState = ...@@ -184,7 +184,7 @@ module StudiaState =
(Stmt) (Stmt)
(struct (struct
let name = "Studia.Highlighter.StudiaState" let name = "Studia.Highlighter.StudiaState"
let dependencies = [ Db.Value.self ] let dependencies = [ Eva.Analysis.self ]
end) end)
let reset () = let reset () =
...@@ -226,7 +226,7 @@ let highlighter (buffer:Design.reactive_buffer) localizable ~start ~stop = ...@@ -226,7 +226,7 @@ let highlighter (buffer:Design.reactive_buffer) localizable ~start ~stop =
with Not_found -> () with Not_found -> ()
let check_value (main_ui:Design.main_window_extension_points) = let check_value (main_ui:Design.main_window_extension_points) =
Db.Value.is_computed () || Eva.Analysis.is_computed () ||
let answer = GToolbox.question_box let answer = GToolbox.question_box
~title:("Eva Needed") ~title:("Eva Needed")
~buttons:[ "Run"; "Cancel" ] ~buttons:[ "Run"; "Cancel" ]
...@@ -234,7 +234,7 @@ let check_value (main_ui:Design.main_window_extension_points) = ...@@ -234,7 +234,7 @@ let check_value (main_ui:Design.main_window_extension_points) =
^"Do you want to run Eva now ?") ^"Do you want to run Eva now ?")
in in
answer = 1 && answer = 1 &&
match main_ui#full_protect ~cancelable:true !Db.Value.compute with match main_ui#full_protect ~cancelable:true Eva.Analysis.compute with
| Some _ -> true | Some _ -> true
| None -> false | None -> false
......
...@@ -81,7 +81,10 @@ let compute kind zone = ...@@ -81,7 +81,10 @@ let compute kind zone =
let empty = { direct = []; indirect = []; } in let empty = { direct = []; indirect = []; } in
List.fold_left add empty stmts List.fold_left add empty stmts
let lval_location kinstr lval = !Db.Value.lval_to_zone kinstr lval let lval_location kinstr lval =
Eva.Results.(
before_kinstr kinstr |> eval_address lval |> as_zone |>
default Locations.Zone.bottom)
let () = Request.register ~package let () = Request.register ~package
~kind:`GET ~name:"getReadsLval" ~kind:`GET ~name:"getReadsLval"
......
...@@ -35,7 +35,7 @@ type effects = { ...@@ -35,7 +35,7 @@ type effects = {
(** Does the functions called at [stmt] modify directly or indirectly [zlval] *) (** Does the functions called at [stmt] modify directly or indirectly [zlval] *)
let effects_of_call stmt zlval effects = let effects_of_call stmt zlval effects =
let aux_kf kf effects = let aux_kf effects kf =
let inout = !Db.Operational_inputs.get_internal_precise ~stmt kf in let inout = !Db.Operational_inputs.get_internal_precise ~stmt kf in
let out = inout.Inout_type.over_outputs in let out = inout.Inout_type.over_outputs in
if Zone.intersects out zlval then if Zone.intersects out zlval then
...@@ -47,8 +47,8 @@ let effects_of_call stmt zlval effects = ...@@ -47,8 +47,8 @@ let effects_of_call stmt zlval effects =
else else
effects effects
in in
let kfs = Db.Value.call_to_kernel_function stmt in let kfs = Eva.Results.callee stmt in
Kernel_function.Hptset.fold aux_kf kfs effects List.fold_left aux_kf effects kfs
class find_write zlval = object (self) class find_write zlval = object (self)
inherit Visitor.frama_c_inplace inherit Visitor.frama_c_inplace
...@@ -66,8 +66,8 @@ class find_write zlval = object (self) ...@@ -66,8 +66,8 @@ class find_write zlval = object (self)
let direct_write = match lvopt with let direct_write = match lvopt with
| None -> false | None -> false
| Some lv -> | Some lv ->
let zlv = !Db.Value.lval_to_zone (Kstmt stmt) lv in Eva.Results.(before stmt |> eval_address lv |> as_zone) |>
Zone.intersects zlv zlval Result.fold ~ok:(Zone.intersects zlval) ~error:(fun _ -> false)
in in
let effects = let effects =
effects_of_call stmt zlval {direct = direct_write; indirect =false} effects_of_call stmt zlval {direct = direct_write; indirect =false}
......
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