@@ -168,11 +168,11 @@ static const typet &type_from_suffix(
168
168
return static_cast <const typet&>(get_nil_irep ());
169
169
// Otherwise this is the base class.
170
170
// Can't use the method below because it might contain periods.
171
- const auto &subclass_comp= to_struct_union_type (*ret).components ()[0 ];
172
- std::string subclass_name= id2string (subclass_comp .get_name ());
173
- assert (has_infix (suffix, subclass_name , next_member));
174
- ret=&subclass_comp .type ();
175
- next_member+=(subclass_name .size ()+ 1 );
171
+ const auto &superclass_comp = to_struct_union_type (*ret).components ()[0 ];
172
+ std::string superclass_name = id2string (superclass_comp .get_name ());
173
+ assert (has_infix (suffix, superclass_name , next_member));
174
+ ret = &superclass_comp .type ();
175
+ next_member += (superclass_name .size () + 1 );
176
176
suffix_without_supertypes=suffix.substr (next_member-1 );
177
177
}
178
178
else
@@ -252,37 +252,30 @@ void local_value_sett::get_value_set_rec(
252
252
// if it hasn't been initialised yet, do so now.
253
253
254
254
typet declared_on_type;
255
- std::string suffix_without_subtype;
256
- const typet &field_type=
257
- type_from_suffix (
258
- expr.type (),
259
- suffix,
260
- ns,
261
- declared_on_type,
262
- suffix_without_subtype);
255
+ std::string suffix_without_supertypes;
256
+ const typet &field_type = type_from_suffix (
257
+ expr.type (), suffix, ns, declared_on_type, suffix_without_supertypes);
263
258
if (field_type.id ()==ID_pointer)
264
259
{
265
260
// Temporary: keep track of whether we read from an EVS, so we can
266
261
// ignore precise access path EVSs when applying function summaries if
267
262
// there are any reads from EVSs.
268
263
++num_reads_of_field_of_external_object;
269
264
270
- std::string access_path_suffix=
271
- suffix_without_subtype == " " ?
272
- " []" :
273
- suffix_without_subtype;
274
265
const auto &extinit=to_external_value_set (expr);
275
266
276
- access_path_entry_exprt new_entry (
277
- access_path_suffix,
278
- function,
279
- std::to_string (location_number),
280
- declared_on_type);
281
267
// If we're reading from `EVS(A.b)` then initialize an entry for that
282
268
// EVS containing an initializer (e.g.
283
269
// `external_objects.A.b <- { EVS(A.b) }`.
284
270
if (extinit.can_extend_to_imprecise ())
285
271
{
272
+ std::string access_path_suffix =
273
+ suffix_without_supertypes.empty () ? " []" : suffix_without_supertypes;
274
+ access_path_entry_exprt new_entry (
275
+ access_path_suffix,
276
+ function,
277
+ std::to_string (location_number),
278
+ declared_on_type);
286
279
// / Create external value set for the type and suffix
287
280
external_value_set_exprt new_ext_set=extinit;
288
281
new_ext_set.extend_access_path (
@@ -300,6 +293,12 @@ void local_value_sett::get_value_set_rec(
300
293
301
294
if (extinit.can_extend_to_precise ())
302
295
{
296
+ std::string access_path_suffix = suffix.empty () ? " []" : suffix;
297
+ access_path_entry_exprt new_entry (
298
+ access_path_suffix,
299
+ function,
300
+ std::to_string (location_number),
301
+ declared_on_type);
303
302
// / Create external value set for the precise access path
304
303
external_value_set_exprt new_ext_set=extinit;
305
304
bool loop_found=new_ext_set.extend_access_path (
@@ -489,13 +488,13 @@ void local_value_sett::assign_rec(
489
488
const irep_idt &identifier=to_symbol_expr (lhs).get_identifier ();
490
489
491
490
typet declared_on_type;
492
- std::string suffix_without_subtype_ignored ;
491
+ std::string suffix_without_supertypes_ignored ;
493
492
type_from_suffix (
494
493
lhs.type (),
495
494
suffix,
496
495
ns,
497
496
declared_on_type,
498
- suffix_without_subtype_ignored );
497
+ suffix_without_supertypes_ignored );
499
498
entryt &e = get_entry (
500
499
entryt (identifier, suffix, declared_on_type, lhs), lhs.type (), ns);
501
500
@@ -512,13 +511,13 @@ void local_value_sett::assign_rec(
512
511
std::string name=get_dynamic_object_name (dynamic_object);
513
512
514
513
typet declared_on_type;
515
- std::string suffix_without_subtype_ignored ;
514
+ std::string suffix_without_supertypes_ignored ;
516
515
type_from_suffix (
517
516
lhs.type (),
518
517
suffix,
519
518
ns,
520
519
declared_on_type,
521
- suffix_without_subtype_ignored );
520
+ suffix_without_supertypes_ignored );
522
521
523
522
entryt &entry =
524
523
get_entry (entryt (name, suffix, declared_on_type, lhs), lhs.type (), ns);
@@ -544,15 +543,9 @@ void local_value_sett::assign_rec(
544
543
// Write through an opaque external value set.
545
544
const auto &evsi=to_external_value_set (lhs);
546
545
typet declared_on_type;
547
- std::string suffix_without_subtype;
548
- const typet &field_type=type_from_suffix (
549
- lhs.type (),
550
- suffix,
551
- ns,
552
- declared_on_type,
553
- suffix_without_subtype);
554
- std::string access_path_suffix=
555
- suffix_without_subtype.empty () ? " []" : suffix_without_subtype;
546
+ std::string suffix_without_supertypes;
547
+ const typet &field_type = type_from_suffix (
548
+ lhs.type (), suffix, ns, declared_on_type, suffix_without_supertypes);
556
549
557
550
if (field_type.id ()==ID_pointer)
558
551
{
@@ -564,6 +557,8 @@ void local_value_sett::assign_rec(
564
557
565
558
if (evsi.can_extend_to_imprecise ())
566
559
{
560
+ std::string access_path_suffix =
561
+ suffix_without_supertypes.empty () ? " []" : suffix_without_supertypes;
567
562
access_path_entry_exprt new_entry (
568
563
access_path_suffix,
569
564
function,
@@ -595,8 +590,9 @@ void local_value_sett::assign_rec(
595
590
596
591
if (evsi.can_extend_to_precise ())
597
592
{
593
+ std::string access_path_suffix = suffix.empty () ? " []" : suffix;
598
594
access_path_entry_exprt new_entry (
599
- suffix ,
595
+ access_path_suffix ,
600
596
function,
601
597
std::to_string (location_number),
602
598
declared_on_type);
0 commit comments