File tree 2 files changed +46
-0
lines changed
2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,19 @@ bool rename_symbolt::rename(typet &dest) const
237
237
result=false ;
238
238
}
239
239
}
240
+ else if (dest.id ()==ID_c_enum_tag ||
241
+ dest.id ()==ID_struct_tag ||
242
+ dest.id ()==ID_union_tag)
243
+ {
244
+ type_mapt::const_iterator it=
245
+ type_map.find (to_tag_type (dest).get_identifier ());
246
+
247
+ if (it!=type_map.end ())
248
+ {
249
+ to_tag_type (dest).set_identifier (it->second );
250
+ result=false ;
251
+ }
252
+ }
240
253
else if (dest.id ()==ID_array)
241
254
{
242
255
array_typet &array_type=to_array_type (dest);
@@ -307,6 +320,10 @@ bool rename_symbolt::have_to_rename(const typet &dest) const
307
320
}
308
321
else if (dest.id ()==ID_symbol)
309
322
return type_map.find (dest.get (ID_identifier))!=type_map.end ();
323
+ else if (dest.id ()==ID_c_enum_tag ||
324
+ dest.id ()==ID_struct_tag ||
325
+ dest.id ()==ID_union_tag)
326
+ return type_map.find (to_tag_type (dest).get_identifier ())!=type_map.end ();
310
327
else if (dest.id ()==ID_array)
311
328
return have_to_rename (to_array_type (dest).size ());
312
329
Original file line number Diff line number Diff line change @@ -481,6 +481,35 @@ class tag_typet:public typet
481
481
}
482
482
};
483
483
484
+ /* ! \brief Cast a generic typet to a \ref tag_typet
485
+ *
486
+ * This is an unchecked conversion. \a type must be known to be \ref
487
+ * tag_typet.
488
+ *
489
+ * \param type Source type
490
+ * \return Object of type \ref tag_typet
491
+ *
492
+ * \ingroup gr_std_types
493
+ */
494
+ extern inline const tag_typet &to_tag_type (const typet &type)
495
+ {
496
+ assert (type.id ()==ID_c_enum_tag ||
497
+ type.id ()==ID_struct_tag ||
498
+ type.id ()==ID_union_tag);
499
+ return static_cast <const tag_typet &>(type);
500
+ }
501
+
502
+ /* ! \copydoc to_tag_type(const typet &)
503
+ * \ingroup gr_std_types
504
+ */
505
+ extern inline tag_typet &to_tag_type (typet &type)
506
+ {
507
+ assert (type.id ()==ID_c_enum_tag ||
508
+ type.id ()==ID_struct_tag ||
509
+ type.id ()==ID_union_tag);
510
+ return static_cast <tag_typet &>(type);
511
+ }
512
+
484
513
/* ! \brief A struct tag type
485
514
*/
486
515
You can’t perform that action at this time.
0 commit comments