GCC Middle and Back End API Reference
digraphs-to-dot.h
Go to the documentation of this file.
1/* Converting directed graphs to dot.
2 Copyright (C) 2025 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_DIAGNOSTICS_DIGRAPHS_TO_DOT_H
22#define GCC_DIAGNOSTICS_DIGRAPHS_TO_DOT_H
23
25#include "graphviz.h"
26
27namespace diagnostics {
28namespace digraphs {
29namespace to_dot {
30
31using digraph = diagnostics::digraphs::digraph;
32using digraph_node = diagnostics::digraphs::node;
33using digraph_edge = diagnostics::digraphs::edge;
34
36{
37public:
38 static std::unique_ptr<converter>
39 make (const digraph &dg);
40
41 virtual std::unique_ptr<dot::graph>
43
44 std::unique_ptr<dot::stmt>
46
47 std::unique_ptr<dot::edge_stmt>
49
52
55 const char *compass_point = nullptr);
56
57 bool
58 has_edges_p (const digraph_node &);
59
60 virtual void
62 dot::subgraph &output_subgraph);
63
64 virtual void
66 dot::node_stmt &output_node);
67
68 virtual void
70 dot::edge_stmt &output_edge);
71
72private:
73 std::set<const digraph_node *> m_nodes_with_edges;
74 std::map<const digraph_node *, dot::stmt *> m_node_map;
75};
76
77extern std::unique_ptr<converter>
79
80} // namespace to_dot
81} // namespace digraphs
82} // namespace diagnostics
83
84#endif /* ! GCC_DIAGNOSTICS_DIGRAPHS_TO_DOT_H */
Definition digraphs-to-dot.h:36
std::set< const digraph_node * > m_nodes_with_edges
Definition digraphs-to-dot.h:73
std::map< const digraph_node *, dot::stmt * > m_node_map
Definition digraphs-to-dot.h:74
dot::node_id get_node_id_for_node(const digraph_node &, const char *compass_point=nullptr)
Definition digraphs-to-dot.cc:148
bool has_edges_p(const digraph_node &)
Definition digraphs-to-dot.cc:162
virtual void add_any_edge_attrs(const digraph_edge &input_edge, dot::edge_stmt &output_edge)
Definition digraphs-to-dot.cc:182
std::unique_ptr< dot::stmt > make_dot_node_from_digraph_node(const digraph_node &)
Definition digraphs-to-dot.cc:88
dot::id get_dot_id_for_node(const digraph_node &)
Definition digraphs-to-dot.cc:139
std::unique_ptr< dot::edge_stmt > make_dot_edge_from_digraph_edge(const digraph_edge &)
Definition digraphs-to-dot.cc:125
static std::unique_ptr< converter > make(const digraph &dg)
Definition digraphs-to-dot.cc:189
virtual void add_any_subgraph_attrs(const digraph_node &input_node, dot::subgraph &output_subgraph)
Definition digraphs-to-dot.cc:168
virtual void add_any_node_attrs(const digraph_node &input_node, dot::node_stmt &output_node)
Definition digraphs-to-dot.cc:175
virtual std::unique_ptr< dot::graph > make_dot_graph_from_diagnostic_graph(const digraph &)
Definition digraphs-to-dot.cc:50
static void input_edge(class lto_input_block *ib, vec< symtab_node * > nodes, bool indirect)
Definition lto-cgraph.cc:1549
static struct cgraph_node * input_node(struct lto_file_decl_data *file_data, class lto_input_block *ib, enum LTO_symtab_tags tag, vec< symtab_node * > nodes)
Definition lto-cgraph.cc:1324
Definition digraphs-to-dot-from-cfg.cc:42
diagnostics::digraphs::node digraph_node
Definition digraphs-to-dot.cc:44
diagnostics::digraphs::edge digraph_edge
Definition digraphs-to-dot.cc:45
std::unique_ptr< converter > make_converter_from_cfg()
Definition digraphs-to-dot-from-cfg.cc:316
diagnostics::digraphs::digraph digraph
Definition digraphs-to-dot.cc:43
Definition diagnostics/context.h:39
Definition cfghooks.h:26
Definition graphviz.h:342
Definition graphviz.h:92
Definition graphviz.h:298
Definition graphviz.h:207
Definition graphviz.h:357