23
23
class remove_instanceoft
24
24
{
25
25
public:
26
- explicit remove_instanceoft (symbol_table_baset &symbol_table)
27
- : symbol_table(symbol_table), ns(symbol_table)
26
+ remove_instanceoft (
27
+ symbol_table_baset &symbol_table, message_handlert &message_handler)
28
+ : symbol_table(symbol_table)
29
+ , ns(symbol_table)
30
+ , message_handler(message_handler)
28
31
{
29
32
class_hierarchy (symbol_table);
30
33
}
@@ -39,6 +42,7 @@ class remove_instanceoft
39
42
symbol_table_baset &symbol_table;
40
43
namespacet ns;
41
44
class_hierarchyt class_hierarchy;
45
+ message_handlert &message_handler;
42
46
43
47
bool lower_instanceof (
44
48
exprt &, goto_programt &, goto_programt::targett);
@@ -154,24 +158,15 @@ bool remove_instanceoft::lower_instanceof(
154
158
// Replace the instanceof construct with instanceof_result:
155
159
expr = instanceof_result_sym.symbol_expr ();
156
160
157
- std::ostringstream convert_output;
158
- stream_message_handlert convert_message_handler (convert_output);
159
- convert_message_handler.set_verbosity (messaget::message_levelt::M_WARNING);
160
-
161
161
// Insert the new test block before it:
162
162
goto_programt new_check_program;
163
163
goto_convert (
164
164
is_null_branch,
165
165
symbol_table,
166
166
new_check_program,
167
- convert_message_handler ,
167
+ message_handler ,
168
168
ID_java);
169
169
170
- INVARIANT (
171
- convert_output.str ().empty (),
172
- " remove_instanceof generated test should be goto-converted without error, "
173
- " but goto_convert reported: " + convert_output.str ());
174
-
175
170
goto_program.destructive_insert (this_inst, new_check_program);
176
171
177
172
return true ;
@@ -245,12 +240,14 @@ bool remove_instanceoft::lower_instanceof(goto_programt &goto_program)
245
240
// / \param target: The instruction to work on.
246
241
// / \param goto_program: The function body containing the instruction.
247
242
// / \param symbol_table: The symbol table to add symbols to.
243
+ // / \param message_handler: logging output
248
244
void remove_instanceof (
249
245
goto_programt::targett target,
250
246
goto_programt &goto_program,
251
- symbol_table_baset &symbol_table)
247
+ symbol_table_baset &symbol_table,
248
+ message_handlert &message_handler)
252
249
{
253
- remove_instanceoft rem (symbol_table);
250
+ remove_instanceoft rem (symbol_table, message_handler );
254
251
rem.lower_instanceof (goto_program, target);
255
252
}
256
253
@@ -259,11 +256,13 @@ void remove_instanceof(
259
256
// / \remarks Extra auxiliary variables may be introduced into symbol_table.
260
257
// / \param function: The function to work on.
261
258
// / \param symbol_table: The symbol table to add symbols to.
259
+ // / \param message_handler: logging output
262
260
void remove_instanceof (
263
261
goto_functionst::goto_functiont &function,
264
- symbol_table_baset &symbol_table)
262
+ symbol_table_baset &symbol_table,
263
+ message_handlert &message_handler)
265
264
{
266
- remove_instanceoft rem (symbol_table);
265
+ remove_instanceoft rem (symbol_table, message_handler );
267
266
rem.lower_instanceof (function.body );
268
267
}
269
268
@@ -272,11 +271,13 @@ void remove_instanceof(
272
271
// / \remarks Extra auxiliary variables may be introduced into symbol_table.
273
272
// / \param goto_functions: The functions to work on.
274
273
// / \param symbol_table: The symbol table to add symbols to.
274
+ // / \param message_handler: logging output
275
275
void remove_instanceof (
276
276
goto_functionst &goto_functions,
277
- symbol_table_baset &symbol_table)
277
+ symbol_table_baset &symbol_table,
278
+ message_handlert &message_handler)
278
279
{
279
- remove_instanceoft rem (symbol_table);
280
+ remove_instanceoft rem (symbol_table, message_handler );
280
281
bool changed=false ;
281
282
for (auto &f : goto_functions.function_map )
282
283
changed=rem.lower_instanceof (f.second .body ) || changed;
@@ -288,8 +289,12 @@ void remove_instanceof(
288
289
// / class-identifier test.
289
290
// / \remarks Extra auxiliary variables may be introduced into symbol_table.
290
291
// / \param goto_model: The functions to work on and the symbol table to add
292
+ // / \param message_handler: logging output
291
293
// / symbols to.
292
- void remove_instanceof (goto_modelt &goto_model)
294
+ void remove_instanceof (
295
+ goto_modelt &goto_model,
296
+ message_handlert &message_handler)
293
297
{
294
- remove_instanceof (goto_model.goto_functions , goto_model.symbol_table );
298
+ remove_instanceof (
299
+ goto_model.goto_functions , goto_model.symbol_table , message_handler);
295
300
}
0 commit comments