51 const irep_idt &parent = base.type().get_identifier();
57 "parent class not in symbol table");
76 return (*
this)[node_index].class_identifier;
133 class_mapt::const_iterator it=
class_map.find(
c);
136 const entryt &entry=it->second;
139 dest.push_back(
child);
163 const irep_idt &parent = base.type().get_identifier();
183 class_mapt::const_iterator it=
class_map.find(
c);
186 const entryt &entry=it->second;
189 dest.push_back(
child);
203 out <<
c.first << (
c.second.is_abstract ?
" (abstract)" :
"") <<
":\n";
206 out <<
" parents:\n";
207 for(
const auto &
pa :
c.second.parents)
208 out <<
" " <<
pa <<
'\n';
210 out <<
" children:\n";
211 for(
const auto &
ch :
c.second.children)
212 out <<
" " <<
ch <<
'\n';
220 ostr <<
"digraph class_hierarchy {\n"
222 <<
" node [fontsize=12 shape=box];\n";
225 for(
const auto &
ch :
c.second.parents)
227 ostr <<
" \"" <<
c.first <<
"\" -> "
228 <<
"\"" <<
ch <<
"\" "
229 <<
" [arrowhead=\"vee\"];"
252 for(
const auto &
pa :
c.second.parents)
256 json_class.push_back_stream_array(
"children");
257 for(
const auto &
ch :
c.second.children)
268 switch(message_handler.
get_ui())
275 if(
msg.result().tellp() > 0)
void show_class_hierarchy(const class_hierarchyt &hierarchy, ui_message_handlert &message_handler, bool children_only)
Output the class hierarchy.
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.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
void populate(const symbol_table_baset &)
Populate the class hierarchy graph, such that there is a node for every struct type in the symbol tab...
nodes_by_namet nodes_by_name
Maps class identifiers onto node indices.
idst get_children_trans(const irep_idt &c) const
Get all the classes that inherit (directly or indirectly) from class c.
std::vector< irep_idt > idst
idst get_direct_children(const irep_idt &c) const
Get all the classes that directly (i.e.
idst get_other_reachable_ids(const irep_idt &c, bool forwards) const
Helper function for get_children_trans and get_parents_trans
idst get_parents_trans(const irep_idt &c) const
Get all the classes that class c inherits from (directly or indirectly).
idst ids_from_indices(const std::vector< node_indext > &nodes) const
Helper function that converts a vector of node_indext to a vector of ids that are stored in the corre...
Non-graph-based representation of the class hierarchy.
void output_dot(std::ostream &) const
Output class hierarchy in Graphviz DOT format.
void get_parents_trans_rec(const irep_idt &, idst &) const
Get all the classes that class c inherits from (directly or indirectly).
void operator()(const symbol_table_baset &)
Looks for all the struct types in the symbol table and construct a map from class names to a data str...
void get_children_trans_rec(const irep_idt &, idst &) const
void output(std::ostream &, bool children_only) const
Output the class hierarchy in plain text.
std::vector< irep_idt > idst
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
std::vector< node_indext > get_reachable(node_indext src, bool forwards) const
Run depth-first search on the graph, starting from a single source node.
node_indext add_node(arguments &&... values)
void add_edge(node_indext a, node_indext b)
std::vector< node_indext > get_successors(const node_indext &n) const
Provides methods for streaming JSON arrays.
json_stream_objectt & push_back_stream_object()
Add a JSON object child stream.
Provides methods for streaming JSON objects.
static jsont json_boolean(bool value)
Class that provides messages with a built-in verbosity 'level'.
Structure type, corresponds to C style structs.
The symbol table base class interface.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
virtual uit get_ui() const
virtual json_stream_arrayt & get_json_stream()
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.