CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
map_visit.h
Go to the documentation of this file.
1/*******************************************************************\
2
3 Module: apply a function to values in a shared_map
4
5 Author: Jez Higgins
6
7\*******************************************************************/
8#ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_MAP_VISIT_H
9#define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_MAP_VISIT_H
10
11template <class mapt, class visitort>
12bool visit_map(mapt &map, const visitort &visitor)
13{
14 bool modified = false;
15 for(auto &item : map.get_view())
16 {
17 auto newval = visitor.visit(item.second);
18 if(newval != item.second)
19 {
20 map.replace(item.first, std::move(newval));
21 modified = true;
22 }
23 }
24 return modified;
25}
26
27#endif // CPROVER_ANALYSES_VARIABLE_SENSITIVITY_MAP_VISIT_H
virtual bool visit(const irep_idt &function_id, trace_ptrt p, working_sett &working_set, const goto_programt &goto_program, const goto_functionst &goto_functions, const namespacet &ns)
Perform one step of abstract interpretation from trace t Depending on the instruction type it may com...
Definition ai.cpp:267
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
bool visit_map(mapt &map, const visitort &visitor)
Definition map_visit.h:12