16
16
#include < util/namespace.h>
17
17
#include < util/symbol.h>
18
18
#include < util/symbol_table.h>
19
+ #include < util/pointer_offset_size.h>
20
+ #include < util/invariant.h>
19
21
20
22
typedef std::unordered_map<irep_idt, std::pair<size_t , bool >, irep_id_hash>
21
23
symbol_numbert;
@@ -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,9 +139,9 @@ 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)
@@ -171,7 +182,7 @@ static std::string type2name(
171
182
const array_typet &t=to_array_type (type);
172
183
mp_integer size;
173
184
if (t.size ().id ()==ID_symbol)
174
- result+=" ARR" +t.size ().get_string (ID_identifier);
185
+ result+=" ARR" +id2string ( t.size ().get (ID_identifier) );
175
186
else if (to_integer (t.size (), size))
176
187
result+=" ARR?" ;
177
188
else
@@ -205,7 +216,9 @@ static std::string type2name(
205
216
if (it!=components.begin ())
206
217
result+=' |' ;
207
218
result+=type2name (it->type (), ns, symbol_number);
208
- result+=" '" +it->get_string (ID_name)+" '" ;
219
+ irep_idt component_name = it->get_name ();
220
+ CHECK_RETURN (!component_name.empty ());
221
+ result+=" '" +id2string (component_name)+" '" ;
209
222
}
210
223
result+=' ]' ;
211
224
}
@@ -233,7 +246,7 @@ static std::string type2name(
233
246
else if (type.id ()==ID_incomplete_c_enum)
234
247
result +=" EN?" ;
235
248
else if (type.id ()==ID_c_bit_field)
236
- result+=" BF" +type. get_string (ID_size );
249
+ result+=" BF" +pointer_offset_bits_as_string (type, ns );
237
250
else if (type.id ()==ID_vector)
238
251
result+=" VEC" +type.get_string (ID_size);
239
252
else
0 commit comments