Skip to content

Commit c327572

Browse files
authored
Merge pull request #3829 from tautschnig/function-dot
dot: use irep_idt for function identifier [blocks: #3126]
2 parents 58e3a57 + e3f5bd2 commit c327572

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/goto-instrument/dot.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ class dott
4444
std::list<exprt> function_calls;
4545
std::list<exprt> clusters;
4646

47-
void write_dot_subgraph(
48-
std::ostream &,
49-
const std::string &,
50-
const goto_programt &);
47+
void
48+
write_dot_subgraph(std::ostream &, const irep_idt &, const goto_programt &);
5149

5250
void do_dot_function_calls(std::ostream &);
5351

@@ -64,21 +62,23 @@ class dott
6462
std::set<goto_programt::const_targett> &);
6563
};
6664

67-
/// writes the dot graph that corresponds to the goto program to the output
65+
/// Write the dot graph that corresponds to the goto program to the output
6866
/// stream.
69-
/// \par parameters: output stream, name and goto program
67+
/// \param out: output stream
68+
/// \param function_id: name of \p goto_program
69+
/// \param goto_program: goto program the dot graph of which is written
7070
/// \return true on error, false otherwise
7171
void dott::write_dot_subgraph(
7272
std::ostream &out,
73-
const std::string &name,
73+
const irep_idt &function_id,
7474
const goto_programt &goto_program)
7575
{
7676
clusters.push_back(exprt("cluster"));
77-
clusters.back().set("name", name);
77+
clusters.back().set("name", function_id);
7878
clusters.back().set("nr", subgraphscount);
7979

80-
out << "subgraph \"cluster_" << name << "\" {\n";
81-
out << "label=\"" << name << "\";\n";
80+
out << "subgraph \"cluster_" << function_id << "\" {\n";
81+
out << "label=\"" << function_id << "\";\n";
8282

8383
const goto_programt::instructionst &instructions =
8484
goto_program.instructions;
@@ -111,22 +111,22 @@ void dott::write_dot_subgraph(
111111
tmp.str("Goto");
112112
else
113113
{
114-
std::string t = from_expr(ns, it->function, it->guard);
114+
std::string t = from_expr(ns, function_id, it->guard);
115115
while(t[ t.size()-1 ]=='\n')
116116
t = t.substr(0, t.size()-1);
117117
tmp << escape(t) << "?";
118118
}
119119
}
120120
else if(it->is_assume())
121121
{
122-
std::string t = from_expr(ns, it->function, it->guard);
122+
std::string t = from_expr(ns, function_id, it->guard);
123123
while(t[ t.size()-1 ]=='\n')
124124
t = t.substr(0, t.size()-1);
125125
tmp << "Assume\\n(" << escape(t) << ")";
126126
}
127127
else if(it->is_assert())
128128
{
129-
std::string t = from_expr(ns, it->function, it->guard);
129+
std::string t = from_expr(ns, function_id, it->guard);
130130
while(t[ t.size()-1 ]=='\n')
131131
t = t.substr(0, t.size()-1);
132132
tmp << "Assert\\n(" << escape(t) << ")";
@@ -145,7 +145,7 @@ void dott::write_dot_subgraph(
145145
tmp.str("Atomic End");
146146
else if(it->is_function_call())
147147
{
148-
std::string t = from_expr(ns, it->function, it->code);
148+
std::string t = from_expr(ns, function_id, it->code);
149149
while(t[ t.size()-1 ]=='\n')
150150
t = t.substr(0, t.size()-1);
151151
tmp.str(escape(t));
@@ -162,7 +162,7 @@ void dott::write_dot_subgraph(
162162
it->is_return() ||
163163
it->is_other())
164164
{
165-
std::string t = from_expr(ns, it->function, it->code);
165+
std::string t = from_expr(ns, function_id, it->code);
166166
while(t[ t.size()-1 ]=='\n')
167167
t = t.substr(0, t.size()-1);
168168
tmp.str(escape(t));
@@ -266,7 +266,7 @@ void dott::output(std::ostream &out)
266266

267267
forall_goto_functions(it, goto_model.goto_functions)
268268
if(it->second.body_available())
269-
write_dot_subgraph(out, id2string(it->first), it->second.body);
269+
write_dot_subgraph(out, it->first, it->second.body);
270270

271271
do_dot_function_calls(out);
272272

0 commit comments

Comments
 (0)