18 class validate_goto_modelt
33 void entry_point_exists();
44 void check_called_functions();
47 const function_mapt &function_map;
50 validate_goto_modelt::validate_goto_modelt(
54 : vm{vm}, function_map{goto_functions.function_map}
59 check_called_functions();
62 void validate_goto_modelt::entry_point_exists()
67 "an entry point must exist");
70 void validate_goto_modelt::check_called_functions()
72 auto test_for_function_address =
73 [
this](
const exprt &expr) {
74 if(expr.id() == ID_address_of)
78 if(pointee.id() == ID_symbol && pointee.type().id() == ID_code)
84 function_map.find(identifier) != function_map.end(),
85 "every function whose address is taken must be in the "
91 for(
const auto &fun : function_map)
93 for(
const auto &instr : fun.second.body.instructions)
96 if(instr.is_function_call())
100 if(instr.call_function().id() == ID_dereference)
106 instr.call_function().id() == ID_symbol &&
107 instr.call_function().type().id() == ID_code,
108 "function call expected to be code-typed symbol expression");
115 function_map.find(identifier) != function_map.end(),
116 "every function call callee must be in the function map");
120 const auto &src =
static_cast<const exprt &
>(instr.code());
121 src.
visit_pre(test_for_function_address);
133 validate_goto_modelt{goto_functions, vm, validation_options};
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
void visit_pre(std::function< void(exprt &)>)
A collection of goto functions.
std::map< irep_idt, goto_functiont > function_mapt
static irep_idt entry_point()
Get the identifier of the entry point to a goto model.
const irep_idt & get_identifier() const
Goto Programs with Functions.
API to expression classes for Pointers.
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
#define DATA_CHECK(vm, condition, message)
This macro takes a condition which denotes a well-formedness criterion on goto programs,...
void validate_goto_model(const goto_functionst &goto_functions, const validation_modet vm, const goto_model_validation_optionst validation_options)