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"
@@ -787,7 +788,7 @@ void c_typecheck_baset::typecheck_declaration(
787
788
788
789
// ensure parameter declarations are available for type checking to
789
790
// succeed
790
- std::vector<symbol_exprt> temporary_parameter_symbols;
791
+ binding_exprt::variablest temporary_parameter_symbols;
791
792
792
793
const auto &return_type = code_type.return_type ();
793
794
if (return_type.id () != ID_empty)
@@ -822,16 +823,28 @@ void c_typecheck_baset::typecheck_declaration(
822
823
{
823
824
typecheck_spec_function_pointer_obeys_contract (expr);
824
825
check_history_expr (expr);
826
+ lambda_exprt lambda{temporary_parameter_symbols, expr};
827
+ lambda.add_source_location () = expr.source_location ();
828
+ expr.swap (lambda);
825
829
}
826
830
827
831
for (auto &requires : code_type.requires ())
828
832
{
829
833
typecheck_expr (requires);
830
834
implicit_typecast_bool (requires);
831
835
check_history_expr (requires);
836
+ lambda_exprt lambda{temporary_parameter_symbols, requires};
837
+ lambda.add_source_location () = requires.source_location ();
838
+ requires.swap (lambda);
832
839
}
833
840
834
841
typecheck_spec_assigns (code_type.assigns ());
842
+ for (auto &assigns : code_type.assigns ())
843
+ {
844
+ lambda_exprt lambda{temporary_parameter_symbols, assigns};
845
+ lambda.add_source_location () = assigns.source_location ();
846
+ assigns.swap (lambda);
847
+ }
835
848
836
849
for (auto &expr : code_type.ensures_contract ())
837
850
{
@@ -840,6 +853,9 @@ void c_typecheck_baset::typecheck_declaration(
840
853
expr,
841
854
ID_loop_entry,
842
855
CPROVER_PREFIX " loop_entry is not allowed in postconditions." );
856
+ lambda_exprt lambda{temporary_parameter_symbols, expr};
857
+ lambda.add_source_location () = expr.source_location ();
858
+ expr.swap (lambda);
843
859
}
844
860
845
861
for (auto &ensures : code_type.ensures ())
@@ -850,6 +866,9 @@ void c_typecheck_baset::typecheck_declaration(
850
866
ensures,
851
867
ID_loop_entry,
852
868
CPROVER_PREFIX " loop_entry is not allowed in postconditions." );
869
+ lambda_exprt lambda{temporary_parameter_symbols, ensures};
870
+ lambda.add_source_location () = ensures.source_location ();
871
+ ensures.swap (lambda);
853
872
}
854
873
855
874
for (const auto ¶meter_sym : temporary_parameter_symbols)
0 commit comments