Skip to content

Commit ea9ce99

Browse files
committed
Add abstract_object::write_location_context
Default implementation just forwards to update_location_context({from}, true)
1 parent 79100c6 commit ea9ce99

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/analyses/variable-sensitivity/abstract_object.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ bool abstract_objectt::should_use_base_meet(
241241
return is_bottom() || is_top() || other->is_bottom() || other->is_top();
242242
}
243243

244+
abstract_object_pointert
245+
abstract_objectt::write_location_context(const locationt &location) const
246+
{
247+
return update_location_context({location}, true);
248+
}
249+
244250
abstract_object_pointert abstract_objectt::update_location_context(
245251
const locationst &locations,
246252
const bool update_sub_elements) const

src/analyses/variable-sensitivity/abstract_object.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ class abstract_objectt : public std::enable_shared_from_this<abstract_objectt>
289289
virtual abstract_object_pointert
290290
meet(const abstract_object_pointert &other) const;
291291

292+
virtual abstract_object_pointert
293+
write_location_context(const locationt &location) const;
294+
292295
/**
293296
* Update the location context for an abstract object, potentially
294297
* propogating the update to any children of this abstract object.

src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,11 @@ void variable_sensitivity_domaint::transform(
3939
{
4040
case DECL:
4141
{
42-
const abstract_objectt::locationst write_location = {from};
4342
abstract_object_pointert top_object =
4443
abstract_state
4544
.abstract_object_factory(
4645
instruction.decl_symbol().type(), ns, true, false)
47-
->update_location_context(write_location, true);
46+
->write_location_context(from);
4847
abstract_state.assign(instruction.decl_symbol(), top_object, ns);
4948
}
5049
// We now store top.
@@ -60,10 +59,8 @@ void variable_sensitivity_domaint::transform(
6059
{
6160
// TODO : check return values
6261
const code_assignt &inst = instruction.get_assign();
63-
const abstract_objectt::locationst write_location = {from};
6462
abstract_object_pointert rhs =
65-
abstract_state.eval(inst.rhs(), ns)
66-
->update_location_context(write_location, true);
63+
abstract_state.eval(inst.rhs(), ns)->write_location_context(from);
6764
abstract_state.assign(inst.lhs(), rhs, ns);
6865
}
6966
break;
@@ -382,8 +379,7 @@ void variable_sensitivity_domaint::transform_function_call(
382379
// Evaluate the expression that is being
383380
// passed into the function call (called_arg)
384381
abstract_object_pointert param_val =
385-
abstract_state.eval(called_arg, ns)
386-
->update_location_context({from}, true);
382+
abstract_state.eval(called_arg, ns)->write_location_context(from);
387383

388384
// Assign the evaluated value to the symbol associated with the
389385
// parameter of the function

0 commit comments

Comments
 (0)