14
14
#include < util/namespace.h>
15
15
#include < util/symbol.h>
16
16
#include < util/symbol_table.h>
17
+ #include < util/pointer_offset_size.h>
18
+ #include < util/invariant.h>
17
19
18
20
#include " type2name.h"
19
21
@@ -81,6 +83,15 @@ static std::string type2name_symbol(
81
83
return result;
82
84
}
83
85
86
+ static std::string pointer_offset_bits_as_string (
87
+ const typet &type,
88
+ const namespacet &ns)
89
+ {
90
+ mp_integer bits = pointer_offset_bits (type, ns);
91
+ CHECK_RETURN (bits != -1 );
92
+ return integer2string (bits);
93
+ }
94
+
84
95
static bool parent_is_sym_check=false ;
85
96
static std::string type2name (
86
97
const typet &type,
@@ -115,9 +126,9 @@ static std::string type2name(
115
126
else if (type.id ()==ID_empty)
116
127
result+=' V' ;
117
128
else if (type.id ()==ID_signedbv)
118
- result+=" S" + type. get_string (ID_width );
129
+ result+=" S" + pointer_offset_bits_as_string (type, ns );
119
130
else if (type.id ()==ID_unsignedbv)
120
- result+=" U" + type. get_string (ID_width );
131
+ result+=" U" + pointer_offset_bits_as_string (type, ns );
121
132
else if (type.id ()==ID_bool ||
122
133
type.id ()==ID_c_bool)
123
134
result+=' B' ;
@@ -128,13 +139,13 @@ static std::string type2name(
128
139
else if (type.id ()==ID_complex)
129
140
result+=' C' ;
130
141
else if (type.id ()==ID_floatbv)
131
- result+=" F" + type. get_string (ID_width );
142
+ result+=" F" + pointer_offset_bits_as_string (type, ns );
132
143
else if (type.id ()==ID_fixedbv)
133
- result+=" X" + type. get_string (ID_width );
144
+ result+=" X" + pointer_offset_bits_as_string (type, ns );
134
145
else if (type.id ()==ID_natural)
135
146
result+=' N' ;
136
147
else if (type.id ()==ID_pointer)
137
- result+=' * ' ;
148
+ result+=" * " + pointer_offset_bits_as_string (type, ns) ;
138
149
else if (type.id ()==ID_reference)
139
150
result+=' &' ;
140
151
else if (type.id ()==ID_code)
@@ -168,7 +179,7 @@ static std::string type2name(
168
179
const array_typet &t=to_array_type (type);
169
180
mp_integer size;
170
181
if (t.size ().id ()==ID_symbol)
171
- result+=" ARR" +t.size ().get_string (ID_identifier);
182
+ result+=" ARR" +id2string ( t.size ().get (ID_identifier) );
172
183
else if (to_integer (t.size (), size))
173
184
result+=" ARR?" ;
174
185
else
@@ -202,7 +213,9 @@ static std::string type2name(
202
213
if (it!=components.begin ())
203
214
result+=' |' ;
204
215
result+=type2name (it->type (), ns, symbol_number);
205
- result+=" '" +it->get_string (ID_name)+" '" ;
216
+ irep_idt component_name = it->get_name ();
217
+ CHECK_RETURN (!component_name.empty ());
218
+ result+=" '" +id2string (component_name)+" '" ;
206
219
}
207
220
result+=' ]' ;
208
221
}
@@ -230,7 +243,7 @@ static std::string type2name(
230
243
else if (type.id ()==ID_incomplete_c_enum)
231
244
result +=" EN?" ;
232
245
else if (type.id ()==ID_c_bit_field)
233
- result+=" BF" +type. get_string (ID_width );
246
+ result+=" BF" +pointer_offset_bits_as_string (type, ns );
234
247
else if (type.id ()==ID_vector)
235
248
result+=" VEC" +type.get_string (ID_size);
236
249
else
0 commit comments