File tree 2 files changed +24
-5
lines changed
2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ void scope_treet::add(
13
13
std::optional<goto_programt::targett> declaration)
14
14
{
15
15
auto previous_node = get_current_node ();
16
- auto new_node = scope_graph.add_node (destructor);
16
+ auto new_node = scope_graph.add_node (destructor, declaration );
17
17
scope_graph.add_edge (previous_node, new_node);
18
18
current_node = new_node;
19
19
}
@@ -24,6 +24,13 @@ optionalt<codet> &scope_treet::get_destructor(node_indext index)
24
24
return scope_graph[index ].destructor_value ;
25
25
}
26
26
27
+ optionalt<goto_programt::targett> &
28
+ scope_treet::get_declaration (node_indext index)
29
+ {
30
+ PRECONDITION (index < scope_graph.size ());
31
+ return scope_graph[index ].declaration_value ;
32
+ }
33
+
27
34
const ancestry_resultt scope_treet::get_nearest_common_ancestor_info (
28
35
node_indext left_index,
29
36
node_indext right_index)
@@ -100,3 +107,11 @@ node_indext scope_treet::get_current_node() const
100
107
{
101
108
return current_node;
102
109
}
110
+
111
+ scope_treet::scope_nodet::scope_nodet (
112
+ codet destructor,
113
+ std::optional<goto_programt::targett> declaration)
114
+ : destructor_value(std::move(destructor)),
115
+ declaration_value(std::move(declaration))
116
+ {
117
+ }
Original file line number Diff line number Diff line change @@ -107,6 +107,9 @@ class scope_treet
107
107
// / Fetches the destructor value for the passed-in node index.
108
108
optionalt<codet> &get_destructor (node_indext index);
109
109
110
+ // / Fetches the declaration value for the passed-in node index.
111
+ optionalt<goto_programt::targett> &get_declaration (node_indext index);
112
+
110
113
// / Builds a vector of destructors that start from starting_index and ends
111
114
// / at end_index.
112
115
// / \param end_index Index of the first variable to keep.
@@ -147,11 +150,12 @@ class scope_treet
147
150
public:
148
151
scope_nodet () = default ;
149
152
150
- explicit scope_nodet (codet destructor)
151
- : destructor_value(std::move( destructor))
152
- {
153
- }
153
+ explicit scope_nodet (
154
+ codet destructor,
155
+ std::optional<goto_programt::targett> declaration);
156
+
154
157
optionalt<codet> destructor_value;
158
+ optionalt<goto_programt::targett> declaration_value;
155
159
};
156
160
157
161
grapht<scope_nodet> scope_graph;
You can’t perform that action at this time.
0 commit comments