Skip to content

Commit 7d1d88e

Browse files
authored
Merge pull request #8189 from tautschnig/feature/scope-tree-output
Scope tree: add dot output
2 parents 3516d1f + 8a1060e commit 7d1d88e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/goto-programs/scope_tree.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ class scope_treet
165165
/// Walks the current node down to its child.
166166
void descend_tree();
167167

168+
/// Output scope tree to \p os in dot format.
169+
void output_dot(std::ostream &os) const
170+
{
171+
scope_graph.output_dot(os);
172+
}
173+
168174
private:
169175
class scope_nodet : public graph_nodet<empty_edget>
170176
{
@@ -177,6 +183,15 @@ class scope_treet
177183

178184
std::optional<codet> destructor_value;
179185
std::optional<declaration_statet> declaration;
186+
187+
std::string dot_attributes(const node_indext &n) const override
188+
{
189+
if(!declaration.has_value())
190+
return "";
191+
192+
return id2string(
193+
declaration->instruction->decl_symbol().get_identifier());
194+
}
180195
};
181196

182197
grapht<scope_nodet> scope_graph;

0 commit comments

Comments
 (0)