File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -2337,6 +2337,31 @@ Function: expr2ct::convert_struct
2337
2337
std::string expr2ct::convert_struct (
2338
2338
const exprt &src,
2339
2339
unsigned &precedence)
2340
+ {
2341
+ return convert_struct (src, precedence, true );
2342
+ }
2343
+
2344
+ /* ******************************************************************\
2345
+
2346
+ Function: expr2ct::convert_struct
2347
+
2348
+ Inputs:
2349
+ src - The struct declaration expression
2350
+ precedence
2351
+ include_padding_members - Should the generated C code
2352
+ include the padding members added
2353
+ to structs for GOTOs benifit
2354
+
2355
+ Outputs: A string representation of the struct expression
2356
+
2357
+ Purpose: To generate a C-like string representing a struct. Can optionally
2358
+ include the padding parameters.
2359
+
2360
+ \*******************************************************************/
2361
+ std::string expr2ct::convert_struct (
2362
+ const exprt &src,
2363
+ unsigned &precedence,
2364
+ bool include_padding_members)
2340
2365
{
2341
2366
const typet full_type=ns.follow (src.type ());
2342
2367
@@ -2368,6 +2393,12 @@ std::string expr2ct::convert_struct(
2368
2393
if (o_it->type ().id ()==ID_code)
2369
2394
continue ;
2370
2395
2396
+ if (c_it->get_is_padding () && !include_padding_members)
2397
+ {
2398
+ ++o_it;
2399
+ continue ;
2400
+ }
2401
+
2371
2402
if (first)
2372
2403
first=false ;
2373
2404
else
Original file line number Diff line number Diff line change @@ -209,6 +209,11 @@ class expr2ct
209
209
std::string convert_designated_initializer (const exprt &src, unsigned &precedence);
210
210
std::string convert_concatenation (const exprt &src, unsigned &precedence);
211
211
std::string convert_sizeof (const exprt &src, unsigned &precedence);
212
+
213
+ std::string convert_struct (
214
+ const exprt &src,
215
+ unsigned &precedence,
216
+ bool include_padding_members);
212
217
};
213
218
214
219
#endif // CPROVER_ANSI_C_EXPR2C_CLASS_H
You can’t perform that action at this time.
0 commit comments