@@ -11,6 +11,9 @@ Date: August 2013
1111
1212#include < cassert>
1313
14+ #include < util/json.h>
15+ #include < util/json_expr.h>
16+
1417#include " goto_rw.h"
1518
1619#include " dependence_graph.h"
@@ -347,6 +350,46 @@ void dep_graph_domaint::output(
347350
348351/* ******************************************************************\
349352
353+ Function: dep_graph_domaint::output_json
354+
355+ Inputs: The abstract interpreter and the namespace.
356+
357+ Outputs: The domain, formatted as a JSON object.
358+
359+ Purpose: Outputs the current value of the domain.
360+
361+ \*******************************************************************/
362+
363+ jsont dep_graph_domaint::output_json (
364+ const ai_baset &ai,
365+ const namespacet &ns) const
366+ {
367+ json_arrayt graph;
368+
369+ for (const auto &cd : control_deps)
370+ {
371+ json_objectt &link=graph.push_back ().make_object ();
372+ link[" locationNumber" ]=
373+ json_numbert (std::to_string (cd->location_number ));
374+ link[" sourceLocation" ]=json (cd->source_location );
375+ link[" type" ]=json_stringt (" control" );
376+ }
377+
378+ for (const auto &dd : data_deps)
379+ {
380+ json_objectt &link=graph.push_back ().make_object ();
381+ link[" locationNumber" ]=
382+ json_numbert (std::to_string (dd->location_number ));
383+ link[" sourceLocation" ]=json (dd->source_location );
384+ json_stringt (dd->source_location .as_string ());
385+ link[" type" ]=json_stringt (" data" );
386+ }
387+
388+ return graph;
389+ }
390+
391+ /* ******************************************************************\
392+
350393Function: dependence_grapht::add_dep
351394
352395 Inputs:
0 commit comments