@@ -518,28 +518,40 @@ std::string expr2ct::convert_rec(
518
518
}
519
519
else if (src.id ()==ID_symbol)
520
520
{
521
- const typet &followed=ns.follow (src);
521
+ symbol_typet symbolic_type=to_symbol_type (src);
522
+ const irep_idt &typedef_identifer=symbolic_type.get (ID_typedef);
522
523
523
- if (followed.id ()==ID_struct)
524
+ // Providing we have a valid identifer, we can just use that rather than
525
+ // trying to find the concrete type
526
+ if (typedef_identifer!=" " )
524
527
{
525
- std::string dest=q+" struct" ;
526
- const irep_idt &tag=to_struct_type (followed).get_tag ();
527
- if (tag!=" " )
528
- dest+=" " +id2string (tag);
529
- dest+=d;
530
- return dest;
528
+ return q+id2string (typedef_identifer)+d;
531
529
}
532
- else if (followed. id ()==ID_union)
530
+ else
533
531
{
534
- std::string dest=q+" union" ;
535
- const irep_idt &tag=to_union_type (followed).get_tag ();
536
- if (tag!=" " )
537
- dest+=" " +id2string (tag);
538
- dest+=d;
539
- return dest;
532
+ const typet &followed=ns.follow (src);
533
+
534
+ if (followed.id ()==ID_struct)
535
+ {
536
+ std::string dest=q+" struct" ;
537
+ const irep_idt &tag=to_struct_type (followed).get_tag ();
538
+ if (tag!=" " )
539
+ dest+=" " +id2string (tag);
540
+ dest+=d;
541
+ return dest;
542
+ }
543
+ else if (followed.id ()==ID_union)
544
+ {
545
+ std::string dest=q+" union" ;
546
+ const irep_idt &tag=to_union_type (followed).get_tag ();
547
+ if (tag!=" " )
548
+ dest+=" " +id2string (tag);
549
+ dest+=d;
550
+ return dest;
551
+ }
552
+ else
553
+ return convert_rec (followed, new_qualifiers, declarator);
540
554
}
541
- else
542
- return convert_rec (followed, new_qualifiers, declarator);
543
555
}
544
556
else if (src.id ()==ID_struct_tag)
545
557
{
0 commit comments