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