@@ -613,42 +613,33 @@ void cpp_typecheckt::typecheck_compound_declarator(
613
613
lookup (args[0 ].get (ID_C_identifier)).symbol_expr (),
614
614
to_code_type (component.type ()).parameters ()[0 ].type ());
615
615
616
+ side_effect_expr_function_callt expr_call;
617
+ expr_call.function () =
618
+ symbol_exprt (component.get_name (), component.type ());
619
+ expr_call.arguments ().reserve (args.size ());
620
+ expr_call.arguments ().push_back (late_cast);
621
+
622
+ for (const auto &arg : args)
623
+ {
624
+ expr_call.arguments ().push_back (
625
+ lookup (arg.get (ID_C_identifier)).symbol_expr ());
626
+ }
616
627
617
628
if (code_type.return_type ().id ()!=ID_empty &&
618
629
code_type.return_type ().id ()!=ID_destructor)
619
630
{
620
- side_effect_expr_function_callt expr_call;
621
- expr_call.function ()=
622
- symbol_exprt (component.get_name (), component.type ());
623
631
expr_call.type ()=to_code_type (component.type ()).return_type ();
624
- expr_call.arguments ().reserve (args.size ());
625
- expr_call.arguments ().push_back (late_cast);
626
-
627
- for (std::size_t i=1 ; i < args.size (); i++)
628
- {
629
- expr_call.arguments ().push_back (
630
- namespacet (symbol_table).lookup (
631
- args[i].get (ID_C_identifier)).symbol_expr ());
632
- }
632
+ exprt already_typechecked (ID_already_typechecked);
633
+ already_typechecked.move_to_operands (expr_call);
633
634
634
- func_symb.value = code_returnt (expr_call );
635
+ func_symb.value = code_returnt (already_typechecked). make_block ( );
635
636
}
636
637
else
637
638
{
638
- code_function_callt code_func;
639
- code_func.function ()=
640
- symbol_exprt (component.get_name (), component.type ());
641
- code_func.arguments ().reserve (args.size ());
642
- code_func.arguments ().push_back (late_cast);
639
+ exprt already_typechecked (ID_already_typechecked);
640
+ already_typechecked.move_to_operands (expr_call);
643
641
644
- for (std::size_t i=1 ; i < args.size (); i++)
645
- {
646
- code_func.arguments ().push_back (
647
- namespacet (symbol_table).lookup (
648
- args[i].get (ID_C_identifier)).symbol_expr ());
649
- }
650
-
651
- func_symb.value =code_func;
642
+ func_symb.value = code_expressiont (already_typechecked).make_block ();
652
643
}
653
644
654
645
// add this new function to the list of components
@@ -664,6 +655,8 @@ void cpp_typecheckt::typecheck_compound_declarator(
664
655
CHECK_RETURN (!failed);
665
656
}
666
657
658
+ put_compound_into_scope (new_compo);
659
+
667
660
// next base
668
661
virtual_bases.erase (virtual_bases.begin ());
669
662
}
0 commit comments