14
14
#include < util/c_types.h>
15
15
#include < util/config.h>
16
16
#include < util/expr_util.h>
17
+ #include < util/mathematical_expr.h>
17
18
#include < util/std_types.h>
18
19
19
20
#include " ansi_c_declaration.h"
@@ -745,7 +746,7 @@ void c_typecheck_baset::typecheck_declaration(
745
746
746
747
// ensure parameter declarations are available for type checking to
747
748
// succeed
748
- std::vector<symbol_exprt> temporary_parameter_symbols;
749
+ binding_exprt::variablest temporary_parameter_symbols;
749
750
750
751
const auto &return_type = code_type.return_type ();
751
752
if (return_type.id () != ID_empty)
@@ -780,16 +781,28 @@ void c_typecheck_baset::typecheck_declaration(
780
781
{
781
782
typecheck_spec_function_pointer_obeys_contract (expr);
782
783
check_history_expr (expr);
784
+ lambda_exprt lambda{temporary_parameter_symbols, expr};
785
+ lambda.add_source_location () = expr.source_location ();
786
+ expr.swap (lambda);
783
787
}
784
788
785
789
for (auto &requires : code_type.requires ())
786
790
{
787
791
typecheck_expr (requires);
788
792
implicit_typecast_bool (requires);
789
793
check_history_expr (requires);
794
+ lambda_exprt lambda{temporary_parameter_symbols, requires};
795
+ lambda.add_source_location () = requires.source_location ();
796
+ requires.swap (lambda);
790
797
}
791
798
792
799
typecheck_spec_assigns (code_type.assigns ());
800
+ for (auto &assigns : code_type.assigns ())
801
+ {
802
+ lambda_exprt lambda{temporary_parameter_symbols, assigns};
803
+ lambda.add_source_location () = assigns.source_location ();
804
+ assigns.swap (lambda);
805
+ }
793
806
794
807
for (auto &expr : code_type.ensures_contract ())
795
808
{
@@ -798,6 +811,9 @@ void c_typecheck_baset::typecheck_declaration(
798
811
expr,
799
812
ID_loop_entry,
800
813
CPROVER_PREFIX " loop_entry is not allowed in postconditions." );
814
+ lambda_exprt lambda{temporary_parameter_symbols, expr};
815
+ lambda.add_source_location () = expr.source_location ();
816
+ expr.swap (lambda);
801
817
}
802
818
803
819
for (auto &ensures : code_type.ensures ())
@@ -808,6 +824,9 @@ void c_typecheck_baset::typecheck_declaration(
808
824
ensures,
809
825
ID_loop_entry,
810
826
CPROVER_PREFIX " loop_entry is not allowed in postconditions." );
827
+ lambda_exprt lambda{temporary_parameter_symbols, ensures};
828
+ lambda.add_source_location () = ensures.source_location ();
829
+ ensures.swap (lambda);
811
830
}
812
831
813
832
for (const auto ¶meter_sym : temporary_parameter_symbols)
0 commit comments