6
6
7
7
\*******************************************************************/
8
8
9
- #include " region_context .h"
9
+ #include " liveness_context .h"
10
10
11
- abstract_objectt::locationt region_contextt ::get_location () const
11
+ abstract_objectt::locationt liveness_contextt ::get_location () const
12
12
{
13
13
return *assign_location;
14
14
}
@@ -29,7 +29,7 @@ abstract_objectt::locationt region_contextt::get_location() const
29
29
* \return the abstract_objectt representing the result of writing
30
30
* to a specific component.
31
31
*/
32
- abstract_object_pointert region_contextt ::write (
32
+ abstract_object_pointert liveness_contextt ::write (
33
33
abstract_environmentt &environment,
34
34
const namespacet &ns,
35
35
const std::stack<exprt> &stack,
@@ -47,12 +47,13 @@ abstract_object_pointert region_contextt::write(
47
47
// Need to ensure the result of the write is still wrapped in a dependency
48
48
// context
49
49
const auto &result =
50
- std::dynamic_pointer_cast<region_contextt >(mutable_clone ());
50
+ std::dynamic_pointer_cast<liveness_contextt >(mutable_clone ());
51
51
52
52
result->set_child (updated_child);
53
53
54
54
// Update the child and record the updated write locations
55
- auto value_context = std::dynamic_pointer_cast<const region_contextt>(value);
55
+ auto value_context =
56
+ std::dynamic_pointer_cast<const liveness_contextt>(value);
56
57
if (value_context)
57
58
result->set_location (value_context->get_location ());
58
59
@@ -69,11 +70,11 @@ abstract_object_pointert region_contextt::write(
69
70
* \return the result of the merge, or 'this' if the merge would not change
70
71
* the current abstract object
71
72
*/
72
- abstract_object_pointert region_contextt ::merge (
73
+ abstract_object_pointert liveness_contextt ::merge (
73
74
const abstract_object_pointert &other,
74
75
const widen_modet &widen_mode) const
75
76
{
76
- auto cast_other = std::dynamic_pointer_cast<const region_contextt >(other);
77
+ auto cast_other = std::dynamic_pointer_cast<const liveness_contextt >(other);
77
78
78
79
if (cast_other)
79
80
{
@@ -97,26 +98,27 @@ abstract_objectt::combine_result object_meet(
97
98
}
98
99
99
100
abstract_object_pointert
100
- region_contextt ::meet (const abstract_object_pointert &other) const
101
+ liveness_contextt ::meet (const abstract_object_pointert &other) const
101
102
{
102
- auto cast_other = std::dynamic_pointer_cast<const region_contextt >(other);
103
+ auto cast_other = std::dynamic_pointer_cast<const liveness_contextt >(other);
103
104
104
105
if (cast_other)
105
106
return combine (cast_other, object_meet);
106
107
107
108
return abstract_objectt::meet (other);
108
109
}
109
110
110
- abstract_object_pointert
111
- region_contextt::combine (const region_context_ptrt &other, combine_fn fn) const
111
+ abstract_object_pointert liveness_contextt::combine (
112
+ const region_context_ptrt &other,
113
+ combine_fn fn) const
112
114
{
113
115
auto combined_child = fn (child_abstract_object, other->child_abstract_object );
114
116
auto location_match = get_location () == other->get_location ();
115
117
116
118
if (combined_child.modified || location_match)
117
119
{
118
120
const auto &result =
119
- std::dynamic_pointer_cast<region_contextt >(mutable_clone ());
121
+ std::dynamic_pointer_cast<liveness_contextt >(mutable_clone ());
120
122
result->set_child (combined_child.object );
121
123
result->reset_location ();
122
124
return result;
@@ -125,21 +127,21 @@ region_contextt::combine(const region_context_ptrt &other, combine_fn fn) const
125
127
return shared_from_this ();
126
128
}
127
129
128
- void region_contextt ::reset_location ()
130
+ void liveness_contextt ::reset_location ()
129
131
{
130
132
assign_location.reset ();
131
133
}
132
134
133
135
context_abstract_objectt::context_abstract_object_ptrt
134
- region_contextt ::update_location_context_internal (
136
+ liveness_contextt ::update_location_context_internal (
135
137
const locationst &locations) const
136
138
{
137
- auto result = std::dynamic_pointer_cast<region_contextt >(mutable_clone ());
139
+ auto result = std::dynamic_pointer_cast<liveness_contextt >(mutable_clone ());
138
140
result->set_location (*locations.cbegin ());
139
141
return result;
140
142
}
141
143
142
- void region_contextt ::set_location (const locationt &location)
144
+ void liveness_contextt ::set_location (const locationt &location)
143
145
{
144
146
assign_location.emplace (location);
145
147
}
@@ -152,7 +154,7 @@ void region_contextt::set_location(const locationt &location)
152
154
* (that contains the object ... )
153
155
* \param ns the current namespace
154
156
*/
155
- void region_contextt ::output (
157
+ void liveness_contextt ::output (
156
158
std::ostream &out,
157
159
const ai_baset &ai,
158
160
const namespacet &ns) const
@@ -175,14 +177,14 @@ void region_contextt::output(
175
177
* \return true if 'this' is considered to have been modified in comparison
176
178
* to 'before', false otherwise.
177
179
*/
178
- bool region_contextt ::has_been_modified (
180
+ bool liveness_contextt ::has_been_modified (
179
181
const abstract_object_pointert &before) const
180
182
{
181
183
if (this == before.get ())
182
184
return false ;
183
185
184
186
auto before_context =
185
- std::dynamic_pointer_cast<const region_contextt >(before);
187
+ std::dynamic_pointer_cast<const liveness_contextt >(before);
186
188
187
189
if (!before_context)
188
190
{
@@ -204,12 +206,12 @@ bool region_contextt::has_been_modified(
204
206
}
205
207
206
208
abstract_object_pointert
207
- region_contextt ::merge_location_context (const locationt &location) const
209
+ liveness_contextt ::merge_location_context (const locationt &location) const
208
210
{
209
211
if (assign_location.has_value ())
210
212
return shared_from_this ();
211
213
212
- auto update = std::dynamic_pointer_cast<region_contextt >(mutable_clone ());
214
+ auto update = std::dynamic_pointer_cast<liveness_contextt >(mutable_clone ());
213
215
update->assign_location = location;
214
216
return update;
215
217
}
0 commit comments