@@ -403,63 +403,22 @@ bool ai_baset::do_function_call_rec(
403
403
{
404
404
PRECONDITION (!goto_functions.function_map .empty ());
405
405
406
- // We can't really do this here -- we rely on
407
- // these being removed by some previous analysis.
408
- PRECONDITION (function.id () != ID_dereference);
409
-
410
- // Can't be a function
411
- DATA_INVARIANT (
412
- function.id () != " NULL-object" , " Function cannot be null object" );
413
- DATA_INVARIANT (function.id () != ID_member, " Function cannot be struct field" );
414
- DATA_INVARIANT (function.id () != ID_index, " Function cannot be array element" );
406
+ // This is quite a strong assumption on the well-formedness of the program.
407
+ // It means function pointers must be removed before use.
408
+ DATA_INVARIANT (function.id () == ID_symbol);
415
409
416
410
bool new_data=false ;
417
411
418
- if (function.id ()==ID_symbol)
419
- {
420
- const irep_idt &identifier = to_symbol_expr (function).get_identifier ();
412
+ const irep_idt &identifier = to_symbol_expr (function).get_identifier ();
421
413
422
- goto_functionst::function_mapt::const_iterator it=
423
- goto_functions.function_map .find (identifier);
414
+ goto_functionst::function_mapt::const_iterator it =
415
+ goto_functions.function_map .find (identifier);
424
416
425
- if (it== goto_functions.function_map .end ())
426
- throw " failed to find function " + id2string (identifier);
417
+ if (it == goto_functions.function_map .end ())
418
+ throw " failed to find function " + id2string (identifier);
427
419
428
- new_data=do_function_call (
429
- l_call, l_return,
430
- goto_functions,
431
- it,
432
- arguments,
433
- ns);
434
- }
435
- else if (function.id ()==ID_if)
436
- {
437
- DATA_INVARIANT (function.operands ().size () != 3 , " if has three operands" );
438
-
439
- bool new_data1=
440
- do_function_call_rec (
441
- l_call, l_return,
442
- function.op1 (),
443
- arguments,
444
- goto_functions,
445
- ns);
446
-
447
- bool new_data2=
448
- do_function_call_rec (
449
- l_call, l_return,
450
- function.op2 (),
451
- arguments,
452
- goto_functions,
453
- ns);
454
-
455
- if (new_data1 || new_data2)
456
- new_data=true ;
457
- }
458
- else
459
- {
460
- throw " unexpected function_call argument: " +
461
- function.id_string ();
462
- }
420
+ new_data =
421
+ do_function_call (l_call, l_return, goto_functions, it, arguments, ns);
463
422
464
423
return new_data;
465
424
}
0 commit comments