@@ -105,16 +105,19 @@ class real_typet:public typet
105
105
}
106
106
};
107
107
108
- /* ! \brief A reference into the symbol table
108
+ /* ! \brief A generic tag-based type
109
109
*/
110
- class symbol_typet :public typet
110
+
111
+ class tag_typet :public typet
111
112
{
112
113
public:
113
- symbol_typet ( ):typet(ID_symbol )
114
+ explicit tag_typet ( const irep_idt &_id ):typet(_id )
114
115
{
115
116
}
116
117
117
- explicit symbol_typet (const irep_idt &identifier):typet(ID_symbol)
118
+ explicit tag_typet (
119
+ const irep_idt &_id,
120
+ const irep_idt &identifier):typet(_id)
118
121
{
119
122
set_identifier (identifier);
120
123
}
@@ -130,6 +133,52 @@ class symbol_typet:public typet
130
133
}
131
134
};
132
135
136
+ /* ! \brief Cast a generic typet to a \ref tag_typet
137
+ *
138
+ * This is an unchecked conversion. \a type must be known to be \ref
139
+ * tag_typet.
140
+ *
141
+ * \param type Source type
142
+ * \return Object of type \ref tag_typet
143
+ *
144
+ * \ingroup gr_std_types
145
+ */
146
+ inline const tag_typet &to_tag_type (const typet &type)
147
+ {
148
+ PRECONDITION (type.id ()==ID_symbol ||
149
+ type.id ()==ID_c_enum_tag ||
150
+ type.id ()==ID_struct_tag ||
151
+ type.id ()==ID_union_tag);
152
+ return static_cast <const tag_typet &>(type);
153
+ }
154
+
155
+ /* ! \copydoc to_tag_type(const typet &)
156
+ * \ingroup gr_std_types
157
+ */
158
+ inline tag_typet &to_tag_type (typet &type)
159
+ {
160
+ PRECONDITION (type.id ()==ID_symbol ||
161
+ type.id ()==ID_c_enum_tag ||
162
+ type.id ()==ID_struct_tag ||
163
+ type.id ()==ID_union_tag);
164
+ return static_cast <tag_typet &>(type);
165
+ }
166
+
167
+ /* ! \brief A reference into the symbol table, used for typedefs
168
+ */
169
+ class symbol_typet :public tag_typet
170
+ {
171
+ public:
172
+ symbol_typet ():tag_typet(ID_symbol)
173
+ {
174
+ }
175
+
176
+ explicit symbol_typet (const irep_idt &identifier):tag_typet(ID_symbol)
177
+ {
178
+ set_identifier (identifier);
179
+ }
180
+ };
181
+
133
182
/* ! \brief Cast a generic typet to a \ref symbol_typet
134
183
*
135
184
* This is an unchecked conversion. \a type must be known to be \ref
@@ -486,63 +535,6 @@ inline union_typet &to_union_type(typet &type)
486
535
return static_cast <union_typet &>(type);
487
536
}
488
537
489
- /* ! \brief A generic tag-based type
490
- */
491
-
492
- class tag_typet :public typet
493
- {
494
- public:
495
- explicit tag_typet (const irep_idt &_id):typet(_id)
496
- {
497
- }
498
-
499
- explicit tag_typet (
500
- const irep_idt &_id,
501
- const irep_idt &identifier):typet(_id)
502
- {
503
- set_identifier (identifier);
504
- }
505
-
506
- void set_identifier (const irep_idt &identifier)
507
- {
508
- set (ID_identifier, identifier);
509
- }
510
-
511
- const irep_idt &get_identifier () const
512
- {
513
- return get (ID_identifier);
514
- }
515
- };
516
-
517
- /* ! \brief Cast a generic typet to a \ref tag_typet
518
- *
519
- * This is an unchecked conversion. \a type must be known to be \ref
520
- * tag_typet.
521
- *
522
- * \param type Source type
523
- * \return Object of type \ref tag_typet
524
- *
525
- * \ingroup gr_std_types
526
- */
527
- inline const tag_typet &to_tag_type (const typet &type)
528
- {
529
- PRECONDITION (type.id ()==ID_c_enum_tag ||
530
- type.id ()==ID_struct_tag ||
531
- type.id ()==ID_union_tag);
532
- return static_cast <const tag_typet &>(type);
533
- }
534
-
535
- /* ! \copydoc to_tag_type(const typet &)
536
- * \ingroup gr_std_types
537
- */
538
- inline tag_typet &to_tag_type (typet &type)
539
- {
540
- PRECONDITION (type.id ()==ID_c_enum_tag ||
541
- type.id ()==ID_struct_tag ||
542
- type.id ()==ID_union_tag);
543
- return static_cast <tag_typet &>(type);
544
- }
545
-
546
538
/* ! \brief A struct tag type
547
539
*/
548
540
0 commit comments