File tree 1 file changed +34
-0
lines changed 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,9 @@ static exprt unpack_rec(
205
205
}
206
206
207
207
member_exprt member (src, comp.get_name (), comp.type ());
208
+ if (src.id ()==ID_struct)
209
+ simplify (member, ns);
210
+
208
211
exprt sub=
209
212
unpack_rec (
210
213
member,
@@ -250,6 +253,37 @@ static exprt unpack_rec(
250
253
array.copy_to_operands (op);
251
254
}
252
255
}
256
+ else if (src.id ()==ID_string_constant ||
257
+ (src.id ()==ID_constant && type.id ()==ID_string))
258
+ {
259
+ // string constants
260
+ std::string value=id2string (src.get (ID_value));
261
+
262
+ // create an array of characters and unpack that one
263
+ array_exprt char_array (
264
+ array_typet (
265
+ unsignedbv_typet (8 ), from_integer (value.size (), size_type ())));
266
+
267
+ exprt::operandst chars;
268
+ chars.reserve (value.size ());
269
+ for (const char c : value)
270
+ chars.push_back (from_integer (c, unsignedbv_typet (8 )));
271
+
272
+ char_array.operands ().swap (chars);
273
+
274
+ if (!unpack_byte_array)
275
+ return char_array;
276
+
277
+ unpack_array_vector (
278
+ char_array,
279
+ to_array_type (char_array.type ()).size (),
280
+ 8 ,
281
+ little_endian,
282
+ offset,
283
+ max_bytes,
284
+ ns,
285
+ array);
286
+ }
253
287
else if (type.id ()!=ID_empty)
254
288
{
255
289
// a basic type; we turn that into extractbits while considering
You can’t perform that action at this time.
0 commit comments