38 const std::stack<exprt> &stack,
39 const exprt &specifier,
41 bool merging_write)
const
44 environment, ns, stack, specifier, value, merging_write);
48 return shared_from_this();
53 std::dynamic_pointer_cast<write_location_contextt>(
mutable_clone());
56 result->set_child(updated_child);
58 std::dynamic_pointer_cast<const write_location_contextt>(value);
62 result->set_last_written_locations(
63 value_context->get_last_written_locations());
84 std::dynamic_pointer_cast<const write_location_contextt>(other);
88 auto merge_fn = [&widen_mode](
93 return combine(cast_other, merge_fn);
111 std::dynamic_pointer_cast<const write_location_contextt>(other);
127 bool merge_locations =
130 if(combined_child.modified || merge_locations)
133 std::dynamic_pointer_cast<write_location_contextt>(
mutable_clone());
134 if(combined_child.modified)
136 result->set_child(combined_child.object);
140 result->set_last_written_locations(location_union);
146 return shared_from_this();
167 std::dynamic_pointer_cast<const write_location_contextt>(other);
171 auto location_union =
178 std::dynamic_pointer_cast<write_location_contextt>(
mutable_clone());
179 return result->update_location_context_internal(location_union);
182 return shared_from_this();
190 std::dynamic_pointer_cast<write_location_contextt>(
mutable_clone());
191 result->set_last_written_locations(locations);
238 existing_locations.insert(locations.begin(), locations.end());
240 return existing_locations;
256 if(
this == before.get())
262 auto before_context =
263 std::dynamic_pointer_cast<const write_location_contextt>(before);
282 before_context->get_last_written_locations();
285 class location_ordert
292 return instruction->location_number > other_instruction->location_number;
296 typedef std::set<goto_programt::const_targett, location_ordert>
299 sorted_locationst lhs_location;
300 for(
const auto &entry : first_write_locations)
302 lhs_location.insert(entry);
305 sorted_locationst rhs_location;
306 for(
const auto &entry : second_write_locations)
308 rhs_location.insert(entry);
312 std::set_intersection(
313 lhs_location.cbegin(),
315 rhs_location.cbegin(),
319 bool all_matched =
intersection.size() == first_write_locations.size() &&
338 std::set<unsigned> sorted_locations;
339 for(
auto location : locations)
341 sorted_locations.insert(location->location_number);
344 for(
auto location_number : sorted_locations)
348 out << location_number;
353 out <<
", " << location_number;
sharing_ptrt< class abstract_objectt > abstract_object_pointert
static combine_result merge(const abstract_object_pointert &op1, const abstract_object_pointert &op2, const locationt &merge_location, const widen_modet &widen_mode)
static combine_result meet(const abstract_object_pointert &op1, const abstract_object_pointert &op2)
Interface method for the meet operation.
This is the basic interface of the abstract interpreter with default implementations of the core func...
std::shared_ptr< context_abstract_objectt > context_abstract_object_ptrt
void output(std::ostream &out, const class ai_baset &ai, const namespacet &ns) const override
Output a representation of the value of this abstract object.
abstract_object_pointert child_abstract_object
std::set< locationt, goto_programt::target_less_than > locationst
Base class for all expressions.
instructionst::const_iterator const_targett
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
abstract_object_pointert merge(const abstract_object_pointert &other, const widen_modet &widen_mode) const override
Create a new abstract object that is the result of merging this abstract object with a given abstract...
std::function< abstract_objectt::combine_result(const abstract_object_pointert &op1, const abstract_object_pointert &op2)> combine_fn
internal_abstract_object_pointert mutable_clone() const override
virtual locationst get_last_written_locations() const
abstract_object_pointert abstract_object_merge_internal(const abstract_object_pointert &other) const override
Helper function for abstract_objectt::abstract_object_merge to perform any additional actions after t...
void output(std::ostream &out, const class ai_baset &ai, const namespacet &ns) const override
Output a representation of the value of this abstract object.
locationst last_written_locations
abstract_object_pointert meet(const abstract_object_pointert &other) const override
Base implementation of the meet operation: only used if no more precise abstraction can be used,...
abstract_object_pointert write(abstract_environmentt &environment, const namespacet &ns, const std::stack< exprt > &stack, const exprt &specifier, const abstract_object_pointert &value, bool merging_write) const override
A helper function to evaluate writing to a component of an abstract object.
static void output_last_written_locations(std::ostream &out, const locationst &locations)
Internal helper function to format and output a given set of locations.
bool has_been_modified(const abstract_object_pointert &before) const override
Determine whether 'this' abstract_object has been modified in comparison to a previous 'before' state...
locationst get_location_union(const locationst &locations) const
Construct the union of the location set of the current object, and a the provided location set.
void set_last_written_locations(const locationst &locations)
Sets the last written locations for this context.
std::shared_ptr< const write_location_contextt > write_location_context_ptrt
context_abstract_object_ptrt update_location_context_internal(const locationst &locations) const override
abstract_object_pointert combine(const write_location_context_ptrt &other, combine_fn fn) const
void intersection(const typename graph_nodet< E >::edgest &a, const typename graph_nodet< E >::edgest &b, typename graph_nodet< E >::edgest &dest)
Compute intersection of two edge sets, in linear time.
Clones the first parameter and merges it with the second.
static abstract_objectt::combine_result object_meet(const abstract_object_pointert &op1, const abstract_object_pointert &op2)
Maintain a context in the variable sensitvity domain that records write locations for a given abstrac...