@@ -69,13 +69,15 @@ class java_object_factoryt
69
69
const typet &target_type,
70
70
allocation_typet alloc_type,
71
71
size_t depth,
72
- update_in_placet update_in_place);
72
+ update_in_placet update_in_place,
73
+ const source_locationt &location);
73
74
74
75
void allocate_nondet_length_array (
75
76
code_blockt &assignments,
76
77
const exprt &lhs,
77
78
const exprt &max_length_expr,
78
- const typet &element_type);
79
+ const typet &element_type,
80
+ const source_locationt &location);
79
81
80
82
public:
81
83
java_object_factoryt (
@@ -102,7 +104,8 @@ class java_object_factoryt
102
104
code_blockt &assignments,
103
105
const exprt &expr,
104
106
size_t depth,
105
- update_in_placet);
107
+ update_in_placet,
108
+ const source_locationt &location);
106
109
107
110
void gen_nondet_init (
108
111
code_blockt &assignments,
@@ -114,7 +117,8 @@ class java_object_factoryt
114
117
bool override_,
115
118
const typet &override_type,
116
119
size_t depth,
117
- update_in_placet);
120
+ update_in_placet,
121
+ const source_locationt &location);
118
122
119
123
private:
120
124
void gen_nondet_pointer_init (
@@ -123,7 +127,8 @@ class java_object_factoryt
123
127
allocation_typet alloc_type,
124
128
const pointer_typet &pointer_type,
125
129
size_t depth,
126
- const update_in_placet &update_in_place);
130
+ const update_in_placet &update_in_place,
131
+ const source_locationt &location);
127
132
128
133
void gen_nondet_struct_init (
129
134
code_blockt &assignments,
@@ -134,13 +139,15 @@ class java_object_factoryt
134
139
allocation_typet alloc_type,
135
140
const struct_typet &struct_type,
136
141
size_t depth,
137
- const update_in_placet &update_in_place);
142
+ const update_in_placet &update_in_place,
143
+ const source_locationt &location);
138
144
139
145
symbol_exprt gen_nondet_subtype_pointer_init (
140
146
code_blockt &assignments,
141
147
allocation_typet alloc_type,
142
148
const pointer_typet &substitute_pointer_type,
143
- size_t depth);
149
+ size_t depth,
150
+ const source_locationt &location);
144
151
};
145
152
146
153
// / Generates code for allocating a dynamic object. This is used in
@@ -372,7 +379,8 @@ void java_object_factoryt::gen_pointer_target_init(
372
379
const typet &target_type,
373
380
allocation_typet alloc_type,
374
381
size_t depth,
375
- update_in_placet update_in_place)
382
+ update_in_placet update_in_place,
383
+ const source_locationt &location)
376
384
{
377
385
PRECONDITION (expr.type ().id ()==ID_pointer);
378
386
PRECONDITION (update_in_place!=update_in_placet::MAY_UPDATE_IN_PLACE);
@@ -383,10 +391,7 @@ void java_object_factoryt::gen_pointer_target_init(
383
391
" java::array[" ))
384
392
{
385
393
gen_nondet_array_init (
386
- assignments,
387
- expr,
388
- depth+1 ,
389
- update_in_place);
394
+ assignments, expr, depth + 1 , update_in_place, location);
390
395
}
391
396
else
392
397
{
@@ -426,14 +431,15 @@ void java_object_factoryt::gen_pointer_target_init(
426
431
gen_nondet_init (
427
432
assignments,
428
433
init_expr,
429
- false , // is_sub
430
- " " , // class_identifier
431
- false , // skip_classid
434
+ false , // is_sub
435
+ " " , // class_identifier
436
+ false , // skip_classid
432
437
alloc_type,
433
- false , // override
434
- typet (), // override type immaterial
435
- depth+1 ,
436
- update_in_place);
438
+ false ,
439
+ typet (),
440
+ depth + 1 ,
441
+ update_in_place,
442
+ location);
437
443
}
438
444
}
439
445
@@ -688,7 +694,8 @@ void java_object_factoryt::gen_nondet_pointer_init(
688
694
allocation_typet alloc_type,
689
695
const pointer_typet &pointer_type,
690
696
size_t depth,
691
- const update_in_placet &update_in_place)
697
+ const update_in_placet &update_in_place,
698
+ const source_locationt &location)
692
699
{
693
700
PRECONDITION (expr.type ().id ()==ID_pointer);
694
701
const pointer_typet &replacement_pointer_type =
@@ -710,7 +717,7 @@ void java_object_factoryt::gen_nondet_pointer_init(
710
717
replacement_pointer_type, ns.follow (replacement_pointer_type.subtype ()));
711
718
712
719
const symbol_exprt real_pointer_symbol = gen_nondet_subtype_pointer_init (
713
- assignments, alloc_type, replacement_pointer_type, depth);
720
+ assignments, alloc_type, replacement_pointer_type, depth, location );
714
721
715
722
// Having created a pointer to object of type replacement_pointer_type
716
723
// we now assign it back to the original pointer with a cast
@@ -772,7 +779,8 @@ void java_object_factoryt::gen_nondet_pointer_init(
772
779
subtype,
773
780
alloc_type,
774
781
depth,
775
- update_in_placet::MUST_UPDATE_IN_PLACE);
782
+ update_in_placet::MUST_UPDATE_IN_PLACE,
783
+ location);
776
784
}
777
785
778
786
// if we MUST_UPDATE_IN_PLACE, then the job is done, we copy the code emitted
@@ -794,7 +802,8 @@ void java_object_factoryt::gen_nondet_pointer_init(
794
802
subtype,
795
803
alloc_type,
796
804
depth,
797
- update_in_placet::NO_UPDATE_IN_PLACE);
805
+ update_in_placet::NO_UPDATE_IN_PLACE,
806
+ location);
798
807
799
808
auto set_null_inst=get_null_assignment (expr, pointer_type);
800
809
@@ -829,8 +838,7 @@ void java_object_factoryt::gen_nondet_pointer_init(
829
838
// tmp$<temporary_counter>>
830
839
// }
831
840
code_ifthenelset null_check;
832
- null_check.cond () =
833
- side_effect_expr_nondett (bool_typet (), expr.source_location ());
841
+ null_check.cond () = side_effect_expr_nondett (bool_typet (), location);
834
842
null_check.then_case ()=set_null_inst;
835
843
null_check.else_case ()=non_null_inst;
836
844
@@ -886,7 +894,8 @@ symbol_exprt java_object_factoryt::gen_nondet_subtype_pointer_init(
886
894
code_blockt &assignments,
887
895
allocation_typet alloc_type,
888
896
const pointer_typet &replacement_pointer,
889
- size_t depth)
897
+ size_t depth,
898
+ const source_locationt &location)
890
899
{
891
900
symbolt new_symbol = get_fresh_aux_symbol (
892
901
replacement_pointer,
@@ -900,14 +909,15 @@ symbol_exprt java_object_factoryt::gen_nondet_subtype_pointer_init(
900
909
gen_nondet_init (
901
910
assignments,
902
911
new_symbol.symbol_expr (),
903
- false , // is_sub
904
- " " , // class_identifier
905
- false , // skip_classid
912
+ false , // is_sub
913
+ " " , // class_identifier
914
+ false , // skip_classid
906
915
alloc_type,
907
916
false , // override
908
917
typet (), // override_type
909
918
depth,
910
- update_in_placet::NO_UPDATE_IN_PLACE);
919
+ update_in_placet::NO_UPDATE_IN_PLACE,
920
+ location);
911
921
912
922
return new_symbol.symbol_expr ();
913
923
}
@@ -950,7 +960,8 @@ void java_object_factoryt::gen_nondet_struct_init(
950
960
allocation_typet alloc_type,
951
961
const struct_typet &struct_type,
952
962
size_t depth,
953
- const update_in_placet &update_in_place)
963
+ const update_in_placet &update_in_place,
964
+ const source_locationt &location)
954
965
{
955
966
PRECONDITION (ns.follow (expr.type ()).id ()==ID_struct);
956
967
PRECONDITION (struct_type.id ()==ID_struct);
@@ -1052,12 +1063,13 @@ void java_object_factoryt::gen_nondet_struct_init(
1052
1063
me,
1053
1064
_is_sub,
1054
1065
class_identifier,
1055
- false , // skip_classid
1066
+ false , // skip_classid
1056
1067
alloc_type,
1057
1068
false , // override
1058
1069
typet (), // override_type
1059
1070
depth,
1060
- substruct_in_place);
1071
+ substruct_in_place,
1072
+ location);
1061
1073
}
1062
1074
}
1063
1075
@@ -1125,7 +1137,8 @@ void java_object_factoryt::gen_nondet_init(
1125
1137
bool override_,
1126
1138
const typet &override_type,
1127
1139
size_t depth,
1128
- update_in_placet update_in_place)
1140
+ update_in_placet update_in_place,
1141
+ const source_locationt &location)
1129
1142
{
1130
1143
const typet &type=
1131
1144
override_ ? ns.follow (override_type) : ns.follow (expr.type ());
@@ -1150,7 +1163,8 @@ void java_object_factoryt::gen_nondet_init(
1150
1163
alloc_type,
1151
1164
pointer_type,
1152
1165
depth,
1153
- update_in_place);
1166
+ update_in_place,
1167
+ location);
1154
1168
}
1155
1169
else if (type.id ()==ID_struct)
1156
1170
{
@@ -1179,7 +1193,8 @@ void java_object_factoryt::gen_nondet_init(
1179
1193
alloc_type,
1180
1194
struct_type,
1181
1195
depth,
1182
- update_in_place);
1196
+ update_in_place,
1197
+ location);
1183
1198
}
1184
1199
else
1185
1200
{
@@ -1211,7 +1226,8 @@ void java_object_factoryt::allocate_nondet_length_array(
1211
1226
code_blockt &assignments,
1212
1227
const exprt &lhs,
1213
1228
const exprt &max_length_expr,
1214
- const typet &element_type)
1229
+ const typet &element_type,
1230
+ const source_locationt &location)
1215
1231
{
1216
1232
symbolt &length_sym = get_fresh_aux_symbol (
1217
1233
java_int_type (),
@@ -1234,7 +1250,8 @@ void java_object_factoryt::allocate_nondet_length_array(
1234
1250
false , // override
1235
1251
typet (), // override type is immaterial
1236
1252
0 , // depth is immaterial, always non-null
1237
- update_in_placet::NO_UPDATE_IN_PLACE);
1253
+ update_in_placet::NO_UPDATE_IN_PLACE,
1254
+ location);
1238
1255
1239
1256
// Insert assumptions to bound its length:
1240
1257
binary_relation_exprt
@@ -1265,7 +1282,8 @@ void java_object_factoryt::gen_nondet_array_init(
1265
1282
code_blockt &assignments,
1266
1283
const exprt &expr,
1267
1284
size_t depth,
1268
- update_in_placet update_in_place)
1285
+ update_in_placet update_in_place,
1286
+ const source_locationt &location)
1269
1287
{
1270
1288
PRECONDITION (expr.type ().id ()==ID_pointer);
1271
1289
PRECONDITION (expr.type ().subtype ().id ()==ID_symbol);
@@ -1284,10 +1302,7 @@ void java_object_factoryt::gen_nondet_array_init(
1284
1302
if (update_in_place==update_in_placet::NO_UPDATE_IN_PLACE)
1285
1303
{
1286
1304
allocate_nondet_length_array (
1287
- assignments,
1288
- expr,
1289
- max_length_expr,
1290
- element_type);
1305
+ assignments, expr, max_length_expr, element_type, location);
1291
1306
}
1292
1307
1293
1308
// Otherwise we're updating the array in place, and use the
@@ -1377,15 +1392,16 @@ void java_object_factoryt::gen_nondet_array_init(
1377
1392
gen_nondet_init (
1378
1393
assignments,
1379
1394
arraycellref,
1380
- false , // is_sub
1395
+ false , // is_sub
1381
1396
irep_idt (), // class_identifier
1382
- false , // skip_classid
1397
+ false , // skip_classid
1383
1398
// These are variable in number, so use dynamic allocator:
1384
1399
allocation_typet::DYNAMIC,
1385
- true , // override
1400
+ true , // override
1386
1401
element_type,
1387
1402
depth,
1388
- child_update_in_place);
1403
+ child_update_in_place,
1404
+ location);
1389
1405
1390
1406
exprt java_one=from_integer (1 , java_int_type ());
1391
1407
code_assignt incr (counter_expr, plus_exprt (counter_expr, java_one));
@@ -1476,7 +1492,8 @@ exprt object_factory(
1476
1492
false , // override
1477
1493
typet (), // override_type is immaterial
1478
1494
1 , // initial depth
1479
- update_in_placet::NO_UPDATE_IN_PLACE);
1495
+ update_in_placet::NO_UPDATE_IN_PLACE,
1496
+ loc);
1480
1497
1481
1498
declare_created_symbols (symbols_created, loc, init_code);
1482
1499
@@ -1549,7 +1566,8 @@ void gen_nondet_init(
1549
1566
false , // override
1550
1567
typet (), // override_type is immaterial
1551
1568
1 , // initial depth
1552
- update_in_place);
1569
+ update_in_place,
1570
+ loc);
1553
1571
1554
1572
declare_created_symbols (symbols_created, loc, init_code);
1555
1573
0 commit comments