CBMC
static_show_domain.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: goto-analyzer
4 
5 Author: Martin Brain, martin.brain@cs.ox.ac.uk
6 
7 \*******************************************************************/
8 
9 #include "static_show_domain.h"
10 
11 #include <util/options.h>
12 
15 
22  const goto_modelt &goto_model,
23  const ai_baset &ai,
24  const optionst &options,
25  std::ostream &out)
26 {
27  if(options.get_bool_option("json"))
28  {
29  out << ai.output_json(goto_model);
30  }
31  else if(options.get_bool_option("xml"))
32  {
33  out << ai.output_xml(goto_model);
34  }
35  else if(
36  options.get_bool_option("dot") &&
37  (options.get_bool_option("dependence-graph") ||
38  options.get_bool_option("dependence-graph-vs")))
39  {
40  // It would be nice to cast this to a grapht but C++ templates and
41  // inheritance need some care to work together.
42  if(options.get_bool_option("dependence-graph"))
43  {
44  auto d = dynamic_cast<const dependence_grapht *>(&ai);
45  INVARIANT(
46  d != nullptr,
47  "--dependence-graph should set ai to be a dependence_grapht");
48 
49  out << "digraph g {\n";
50  d->output_dot(out);
51  out << "}\n";
52  }
53  else if(options.get_bool_option("dependence-graph-vs"))
54  {
55  auto d =
56  dynamic_cast<const variable_sensitivity_dependence_grapht *>(&ai);
57  INVARIANT(
58  d != nullptr,
59  "--dependence-graph-vsd should set ai to be a "
60  "variable_sensitivity_dependence_grapht");
61 
62  out << "digraph g {\n";
63  d->output_dot(out);
64  out << "}\n";
65  }
67  }
68  else
69  {
70  // 'text' or console output
71  ai.output(goto_model, out);
72  }
73 }
This is the basic interface of the abstract interpreter with default implementations of the core func...
Definition: ai.h:117
virtual void output(const namespacet &ns, const irep_idt &function_id, const goto_programt &goto_program, std::ostream &out) const
Output the abstract states for a single function.
Definition: ai.cpp:39
virtual xmlt output_xml(const namespacet &ns, const irep_idt &function_id, const goto_programt &goto_program) const
Output the abstract states for a single function as XML.
Definition: ai.cpp:136
virtual jsont output_json(const namespacet &ns, const irep_idt &function_id, const goto_programt &goto_program) const
Output the abstract states for a single function as JSON.
Definition: ai.cpp:83
bool get_bool_option(const std::string &option) const
Definition: options.cpp:44
Field-Sensitive Program Dependence Analysis, Litvak et al., FSE 2010.
Options.
#define UNREACHABLE
This should be used to mark dead code.
Definition: invariant.h:525
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
Definition: invariant.h:423
void static_show_domain(const goto_modelt &goto_model, const ai_baset &ai, const optionst &options, std::ostream &out)
Runs the analyzer and then prints out the domain.
A forked and modified version of analyses/dependence_graph.