20 class validate_goto_modelt
35 void entry_point_exists();
46 void check_called_functions();
49 const function_mapt &function_map;
52 validate_goto_modelt::validate_goto_modelt(
56 : vm{vm}, function_map{goto_functions.function_map}
58 if(validation_options.entry_point_exists)
61 check_called_functions();
64 void validate_goto_modelt::entry_point_exists()
69 "an entry point must exist");
72 void validate_goto_modelt::check_called_functions()
74 auto test_for_function_address =
75 [
this](
const exprt &expr) {
76 if(expr.id() == ID_address_of)
80 if(pointee.id() == ID_symbol && pointee.type().id() == ID_code)
86 function_map.find(identifier) != function_map.end(),
87 "every function whose address is taken must be in the "
93 for(
const auto &fun : function_map)
95 for(
const auto &instr : fun.second.body.instructions)
98 if(instr.is_function_call())
102 if(instr.call_function().id() == ID_dereference)
108 instr.call_function().id() == ID_symbol &&
109 instr.call_function().type().id() == ID_code,
110 "function call expected to be code-typed symbol expression");
117 function_map.find(identifier) != function_map.end(),
118 "every function call callee must be in the function map");
122 const auto &src =
static_cast<const exprt &
>(instr.code());
123 src.
visit_pre(test_for_function_address);
135 validate_goto_modelt{goto_functions, vm, validation_options};