20 #define DOTGRAPHSETTINGS "color=black;" \
21 "orientation=portrait;" \
37 void output(std::ostream &out);
52 std::string &
escape(std::string &str);
61 std::set<goto_programt::const_targett> &,
62 std::set<goto_programt::const_targett> &);
76 clusters.back().set(
"name", function_id);
79 out <<
"subgraph \"cluster_" << function_id <<
"\" {\n";
80 out <<
"label=\"" << function_id <<
"\";\n";
85 if(instructions.empty())
88 "[shape=Mrecord,fontsize=22,label=\"?\"];\n";
94 std::set<goto_programt::const_targett> seen;
96 worklist.push_back(instructions.begin());
98 while(!worklist.empty())
101 worklist.pop_front();
103 if(it==instructions.end() ||
104 seen.find(it)!=seen.end())
continue;
106 std::stringstream tmp;
109 if(it->condition().is_true())
113 std::string t =
from_expr(ns, function_id, it->condition());
114 while(t[ t.size()-1 ]==
'\n')
115 t = t.substr(0, t.size()-1);
119 else if(it->is_assume())
121 std::string t =
from_expr(ns, function_id, it->condition());
122 while(t[ t.size()-1 ]==
'\n')
123 t = t.substr(0, t.size()-1);
124 tmp <<
"Assume\\n(" <<
escape(t) <<
")";
126 else if(it->is_assert())
128 std::string t =
from_expr(ns, function_id, it->condition());
129 while(t[ t.size()-1 ]==
'\n')
130 t = t.substr(0, t.size()-1);
131 tmp <<
"Assert\\n(" <<
escape(t) <<
")";
133 else if(it->is_skip())
135 else if(it->is_end_function())
136 tmp.str(
"End of Function");
137 else if(it->is_location())
139 else if(it->is_dead())
141 else if(it->is_atomic_begin())
142 tmp.str(
"Atomic Begin");
143 else if(it->is_atomic_end())
144 tmp.str(
"Atomic End");
145 else if(it->is_function_call())
148 it->call_lhs(), it->call_function(), it->call_arguments());
149 std::string t =
from_expr(ns, function_id, function_call);
150 while(t[ t.size()-1 ]==
'\n')
151 t = t.substr(0, t.size()-1);
154 std::stringstream ss;
157 std::pair<std::string, exprt>(ss.str(), it->call_function()));
160 it->is_assign() || it->is_decl() || it->is_set_return_value() ||
163 std::string t =
from_expr(ns, function_id, it->code());
164 while(t[ t.size()-1 ]==
'\n')
165 t = t.substr(0, t.size()-1);
168 else if(it->is_start_thread())
169 tmp.str(
"Start of Thread");
170 else if(it->is_end_thread())
171 tmp.str(
"End of Thread");
172 else if(it->is_throw())
174 else if(it->is_catch())
181 if(it->is_goto() && !it->condition().is_constant())
185 out <<
",fontsize=22,label=\"";
189 std::set<goto_programt::const_targett> tres;
190 std::set<goto_programt::const_targett> fres;
195 if(!fres.empty() && !tres.empty())
201 typedef std::set<goto_programt::const_targett> t;
203 for(t::iterator trit=tres.begin();
207 for(t::iterator frit=fres.begin();
214 worklist.insert(worklist.end(), temp.begin(), temp.end());
227 std::list<exprt>::const_iterator cit=
clusters.begin();
229 if(cit->get(
"name") == call.second.get(ID_identifier))
237 << cit->get(
"nr") <<
"_0"
238 <<
" [lhead=\"cluster_" << call.second.get(ID_identifier) <<
"\","
243 out <<
"subgraph \"cluster_" << call.second.get(ID_identifier)
245 out <<
"rank=sink;\n";
246 out <<
"label=\"" << call.second.get(ID_identifier) <<
"\";\n";
248 "[shape=Mrecord,fontsize=22,label=\"?\"];\n";
251 clusters.back().set(
"name", call.second.get(ID_identifier));
257 <<
" [lhead=\"cluster_" << call.second.get(
"identifier") <<
"\","
266 out <<
"digraph G {\n";
271 if(gf_entry.second.body_available())
292 else if(str[i]==
'\"' ||
314 std::set<goto_programt::const_targett> &tres,
315 std::set<goto_programt::const_targett> &fres)
317 if(it->is_goto() && !it->condition().is_false())
319 for(
const auto &target : it->targets)
323 if(it->is_goto() && it->condition().is_true())
327 if(next!=instructions.end())
338 const std::string &label)
345 out <<
"[fontsize=20,label=\"" << label <<
"\"";