Skip to content

Commit 6ce3d9b

Browse files
author
Sonny Martin
committed
Add additional 'vm' argument to DATA_CHECK
1 parent 82b1936 commit 6ce3d9b

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/goto-programs/validate_goto_model.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ void validate_goto_modelt::do_goto_program_checks(
110110
void validate_goto_modelt::entry_point_exists()
111111
{
112112
DATA_CHECK(
113+
vm,
113114
function_map.find(goto_functionst::entry_point()) != function_map.end(),
114115
"an entry point must exist");
115116
}
@@ -125,6 +126,7 @@ void validate_goto_modelt::function_pointer_calls_removed()
125126
const code_function_callt &function_call =
126127
to_code_function_call(instr.code);
127128
DATA_CHECK(
129+
vm,
128130
function_call.function().id() == ID_symbol,
129131
"no calls via function pointer should be present");
130132
}
@@ -138,22 +140,25 @@ void validate_goto_modelt::check_returns_removed()
138140
{
139141
const goto_functiont &goto_function = fun.second;
140142
DATA_CHECK(
143+
vm,
141144
goto_function.type.return_type().id() == ID_empty,
142145
"functions must have empty return type");
143146

144147
for(const auto &instr : goto_function.body.instructions)
145148
{
146149
DATA_CHECK(
147-
!instr.is_return(), "no return instructions should be present");
150+
vm, !instr.is_return(), "no return instructions should be present");
148151

149152
if(instr.is_function_call())
150153
{
151154
const auto &function_call = to_code_function_call(instr.code);
152155
DATA_CHECK(
153-
function_call.lhs().is_nil(), "function call return should be nil");
156+
vm,
157+
function_call.lhs().is_nil(),
158+
"function call return should be nil");
154159

155160
const auto &callee = to_code_type(function_call.function().type());
156-
DATA_CHECK(callee.return_type().id() == ID_empty, "");
161+
DATA_CHECK(vm, callee.return_type().id() == ID_empty, "");
157162
}
158163
}
159164
}
@@ -193,6 +198,7 @@ void validate_goto_modelt::check_called_functions()
193198
to_symbol_expr(function_call.function()).get_identifier();
194199

195200
DATA_CHECK(
201+
vm,
196202
function_map.find(identifier) != function_map.end(),
197203
"every function call callee must be in the function map");
198204
}
@@ -203,6 +209,7 @@ void validate_goto_modelt::check_called_functions()
203209
{
204210
for(auto &identifier : test_for_function_address.identifiers)
205211
DATA_CHECK(
212+
vm,
206213
function_map.find(identifier) != function_map.end(),
207214
"every function whose address is taken must be in the "
208215
"function map");
@@ -219,6 +226,7 @@ void validate_goto_modelt::check_last_instruction()
219226
if(fun.second.body_available())
220227
{
221228
DATA_CHECK(
229+
vm,
222230
fun.second.body.instructions.back().is_end_function(),
223231
"last instruction should be of end function type");
224232
}
@@ -234,10 +242,12 @@ void validate_goto_modelt::check_sourcecode_location()
234242
for(auto &instr : fun.second.body.instructions)
235243
{
236244
DATA_CHECK(
245+
vm,
237246
instr.code.source_location().is_not_nil(),
238247
"each instruction \"code\" field, must have non nil source location");
239248

240249
DATA_CHECK(
250+
vm,
241251
instr.source_location.is_not_nil(),
242252
"each instruction source location must not be nil");
243253
}

0 commit comments

Comments
 (0)