@@ -365,7 +365,12 @@ std::string expr2ct::convert_rec(
365
365
{
366
366
const struct_typet &struct_type=to_struct_type (src);
367
367
368
- std::string dest=q+" struct" ;
368
+ std::string dest=q;
369
+
370
+ if (src.find (ID_typedef).is_not_nil ())
371
+ dest+=" typedef struct" ;
372
+ else
373
+ dest+=" struct" ;
369
374
370
375
const irep_idt &tag=struct_type.get_tag ();
371
376
if (tag!=" " ) dest+=" " +id2string (tag);
@@ -383,7 +388,10 @@ std::string expr2ct::convert_rec(
383
388
384
389
dest+=" }" ;
385
390
386
- dest+=d;
391
+ if (src.find (ID_typedef).is_not_nil ())
392
+ dest+=src.get_string (ID_typedef);
393
+ else
394
+ dest+=d;
387
395
388
396
return dest;
389
397
}
@@ -401,7 +409,12 @@ std::string expr2ct::convert_rec(
401
409
{
402
410
const union_typet &union_type=to_union_type (src);
403
411
404
- std::string dest=q+" union" ;
412
+ std::string dest=q;
413
+
414
+ if (src.find (ID_typedef).is_not_nil ())
415
+ dest+=" typedef union" ;
416
+ else
417
+ dest+=" union" ;
405
418
406
419
const irep_idt &tag=union_type.get_tag ();
407
420
if (tag!=" " ) dest+=" " +id2string (tag);
@@ -419,7 +432,10 @@ std::string expr2ct::convert_rec(
419
432
420
433
dest+=" }" ;
421
434
422
- dest+=d;
435
+ if (src.find (ID_typedef).is_not_nil ())
436
+ dest+=src.get_string (ID_typedef);
437
+ else
438
+ dest+=d;
423
439
424
440
return dest;
425
441
}
@@ -547,6 +563,8 @@ std::string expr2ct::convert_rec(
547
563
548
564
if (followed.id ()==ID_struct)
549
565
{
566
+ if (followed.find (ID_typedef).is_not_nil ())
567
+ return followed.get_string (ID_typedef)+d;
550
568
std::string dest=q+" struct" ;
551
569
const irep_idt &tag=to_struct_type (followed).get_tag ();
552
570
if (tag!=" " ) dest+=" " +id2string (tag);
@@ -555,6 +573,8 @@ std::string expr2ct::convert_rec(
555
573
}
556
574
else if (followed.id ()==ID_union)
557
575
{
576
+ if (followed.find (ID_typedef).is_not_nil ())
577
+ return followed.get_string (ID_typedef)+d;
558
578
std::string dest=q+" union" ;
559
579
const irep_idt &tag=to_union_type (followed).get_tag ();
560
580
if (tag!=" " ) dest+=" " +id2string (tag);
@@ -566,6 +586,8 @@ std::string expr2ct::convert_rec(
566
586
}
567
587
else if (src.id ()==ID_struct_tag)
568
588
{
589
+ if (src.find (ID_typedef).is_not_nil ())
590
+ return src.get_string (ID_typedef)+d;
569
591
const struct_tag_typet &struct_tag_type=
570
592
to_struct_tag_type (src);
571
593
@@ -578,6 +600,8 @@ std::string expr2ct::convert_rec(
578
600
}
579
601
else if (src.id ()==ID_union_tag)
580
602
{
603
+ if (src.find (ID_typedef).is_not_nil ())
604
+ return src.get_string (ID_typedef)+d;
581
605
const union_tag_typet &union_tag_type=
582
606
to_union_tag_type (src);
583
607
0 commit comments