diff --git a/src/plugins/value/api/values_request.ml b/src/plugins/value/api/values_request.ml index ed98a6bb1b48ea0ef3e609e0729f5570b79a951e..986e4339faf65d14376ebf79b6294ca1d3274a4a 100644 --- a/src/plugins/value/api/values_request.ml +++ b/src/plugins/value/api/values_request.ml @@ -54,6 +54,8 @@ type domain = { let signal = Request.signal ~package ~name:"changed" ~descr:(Md.plain "Emitted when EVA results has changed") +let () = Analysis.register_computed_hook (fun () -> Request.emit signal) + (* -------------------------------------------------------------------------- *) (* --- Marker Utilities --- *) (* -------------------------------------------------------------------------- *) diff --git a/src/plugins/value/engine/analysis.ml b/src/plugins/value/engine/analysis.ml index 256e3db49ab2a6777e173761dc06633b9cb20204..d1d807098e3f571860d4221bbc4f5c2912f6e10a 100644 --- a/src/plugins/value/engine/analysis.ml +++ b/src/plugins/value/engine/analysis.ml @@ -127,9 +127,16 @@ let current_analyzer () = (module (val (snd !ref_analyzer)): S) Useful for the GUI parts that depend on it. *) module Analyzer_Hook = Hook.Build (struct type t = (module S) end) +(* Set of hooks called whenever the current Analyzer is computed. + Useful for the GUI parts that depend on it. *) +module Computed_Hook = Hook.Build (struct type t = unit end) + (* Register a new hook. *) let register_hook = Analyzer_Hook.extend +(* Register a new computed hook. *) +let register_computed_hook = Computed_Hook.extend + (* Sets the current Analyzer module for a given configuration. Calls the hooks above. *) let set_current_analyzer config (analyzer: (module Analyzer)) = @@ -169,7 +176,8 @@ let force_compute () = let kf, lib_entry = Globals.entry_point () in reset_analyzer (); let module Analyzer = (val snd !ref_analyzer) in - Analyzer.compute_from_entry_point ~lib_entry kf + Analyzer.compute_from_entry_point ~lib_entry kf ; + Computed_Hook.apply () (* Resets the Analyzer when the current project is changed. *) let () = diff --git a/src/plugins/value/engine/analysis.mli b/src/plugins/value/engine/analysis.mli index 6f85061797c199d610235ce9328d34203f91b6ae..50b943ccad73a30eb0d8e41ab94a60e334e471ef 100644 --- a/src/plugins/value/engine/analysis.mli +++ b/src/plugins/value/engine/analysis.mli @@ -70,6 +70,10 @@ val register_hook: ((module S) -> unit) -> unit is changed. This happens when a new analysis is run with different abstractions than before, or when the current project is changed. *) +val register_computed_hook: (unit -> unit) -> unit +(** Registers a hook that will be called each time the [current] analyzer + has been computed. *) + val force_compute : unit -> unit (** Perform a full analysis, starting from the [main] function. *)