@@ -984,7 +984,7 @@ exprt goto_convertt::get_array_argument(const exprt &src)
984
984
985
985
/* ******************************************************************\
986
986
987
- Function: goto_convertt::do_array_set
987
+ Function: goto_convertt::do_array_op
988
988
989
989
Inputs:
990
990
@@ -994,7 +994,8 @@ Function: goto_convertt::do_array_set
994
994
995
995
\*******************************************************************/
996
996
997
- void goto_convertt::do_array_set (
997
+ void goto_convertt::do_array_op (
998
+ const irep_idt &id,
998
999
const exprt &lhs,
999
1000
const exprt &function,
1000
1001
const exprt::operandst &arguments,
@@ -1003,47 +1004,16 @@ void goto_convertt::do_array_set(
1003
1004
if (arguments.size ()!=2 )
1004
1005
{
1005
1006
error ().source_location =function.find_source_location ();
1006
- error () << " array_set expects two arguments" << eom;
1007
+ error () << id << " expects two arguments" << eom;
1007
1008
throw 0 ;
1008
1009
}
1009
1010
1010
- codet array_set_statement;
1011
- array_set_statement.set_statement (ID_array_set);
1012
- array_set_statement.operands ()=arguments;
1011
+ codet array_op_statement;
1012
+ array_op_statement.set_statement (id);
1013
+ array_op_statement.operands ()=arguments;
1014
+ array_op_statement.add_source_location ()=function.source_location ();
1013
1015
1014
- copy (array_set_statement, OTHER, dest);
1015
- }
1016
-
1017
- /* ******************************************************************\
1018
-
1019
- Function: goto_convertt::do_array_copy
1020
-
1021
- Inputs:
1022
-
1023
- Outputs:
1024
-
1025
- Purpose:
1026
-
1027
- \*******************************************************************/
1028
-
1029
- void goto_convertt::do_array_copy (
1030
- const exprt &lhs,
1031
- const exprt &function,
1032
- const exprt::operandst &arguments,
1033
- goto_programt &dest)
1034
- {
1035
- if (arguments.size ()!=2 )
1036
- {
1037
- error ().source_location =function.find_source_location ();
1038
- error () << " array_copy expects two arguments" << eom;
1039
- throw 0 ;
1040
- }
1041
-
1042
- codet array_copy_statement;
1043
- array_copy_statement.set_statement (ID_array_copy);
1044
- array_copy_statement.operands ()=arguments;
1045
-
1046
- copy (array_copy_statement, OTHER, dest);
1016
+ copy (array_op_statement, OTHER, dest);
1047
1017
}
1048
1018
1049
1019
/* ******************************************************************\
@@ -1096,6 +1066,7 @@ void goto_convertt::do_array_equal(
1096
1066
assignment.lhs ()=lhs;
1097
1067
assignment.rhs ()=binary_exprt (
1098
1068
lhs_array, ID_array_equal, rhs_array, lhs.type ());
1069
+ assignment.add_source_location ()=function.source_location ();
1099
1070
1100
1071
convert (assignment, dest);
1101
1072
}
@@ -1427,19 +1398,21 @@ void goto_convertt::do_function_call_symbol(
1427
1398
assignment.add_source_location ()=function.source_location ();
1428
1399
copy (assignment, ASSIGN, dest);
1429
1400
}
1430
- else if (has_prefix ( id2string ( identifier), CPROVER_PREFIX " array_set " ) )
1401
+ else if (identifier== CPROVER_PREFIX " array_equal " )
1431
1402
{
1432
- do_array_set (lhs, function, arguments, dest);
1403
+ do_array_equal (lhs, function, arguments, dest);
1433
1404
}
1434
- else if (identifier==CPROVER_PREFIX " array_equal" ||
1435
- identifier==" __CPROVER::array_equal" )
1405
+ else if (identifier==CPROVER_PREFIX " array_set" )
1436
1406
{
1437
- do_array_equal (lhs, function, arguments, dest);
1407
+ do_array_op (ID_array_set, lhs, function, arguments, dest);
1408
+ }
1409
+ else if (identifier==CPROVER_PREFIX " array_copy" )
1410
+ {
1411
+ do_array_op (ID_array_copy, lhs, function, arguments, dest);
1438
1412
}
1439
- else if (identifier==CPROVER_PREFIX " array_copy" ||
1440
- identifier==" __CPROVER::array_equal" )
1413
+ else if (identifier==CPROVER_PREFIX " array_replace" )
1441
1414
{
1442
- do_array_copy ( lhs, function, arguments, dest);
1415
+ do_array_op (ID_array_replace, lhs, function, arguments, dest);
1443
1416
}
1444
1417
else if (identifier==" printf" )
1445
1418
/*
0 commit comments