@@ -706,7 +706,7 @@ Function: expr2ct::convert_struct_type
706
706
declarator - the declarator on the type
707
707
inc_struct_body - when generating the code, should we include
708
708
a complete definition of the struct
709
- inc_padding_parameters - should the padding parameters be included
709
+ inc_padding_components - should the padding parameters be included
710
710
Note this only makes sense if inc_struct_body
711
711
712
712
Outputs: Returns a type declaration for a struct, optionally containing the
@@ -721,12 +721,12 @@ std::string expr2ct::convert_struct_type(
721
721
const std::string &qualifiers,
722
722
const std::string &declarator,
723
723
bool inc_struct_body,
724
- bool inc_padding_parameters )
724
+ bool inc_padding_components )
725
725
{
726
726
// Either we are including the body (in which case it makes sense to include
727
727
// or exclude the parameters) or there is no body so therefore we definitely
728
728
// shouldn't be including the parameters
729
- assert (inc_struct_body || !inc_padding_parameters );
729
+ assert (inc_struct_body || !inc_padding_components );
730
730
731
731
const struct_typet &struct_type=to_struct_type (src);
732
732
@@ -740,20 +740,21 @@ std::string expr2ct::convert_struct_type(
740
740
{
741
741
dest+=" {" ;
742
742
743
- for (struct_typet::componentst::const_iterator
744
- it=struct_type.components ().begin ();
745
- it!=struct_type.components ().end ();
746
- it++)
743
+ for (const struct_union_typet::componentt &component :
744
+ struct_type.components ())
747
745
{
748
746
// Skip padding parameters unless we including them
749
- if (it-> get_is_padding () && !inc_padding_parameters )
747
+ if (component. get_is_padding () && !inc_padding_components )
750
748
{
751
749
continue ;
752
750
}
753
751
754
- dest+= ' ' ;
755
- dest+=convert_rec (it->type (), c_qualifierst (), id2string (it->get_name ()));
756
- dest+= ' ;' ;
752
+ dest+=' ' ;
753
+ dest+=convert_rec (
754
+ component.type (),
755
+ c_qualifierst (),
756
+ id2string (component.get_name ()));
757
+ dest+=' ;' ;
757
758
}
758
759
759
760
dest+=" }" ;
@@ -2267,7 +2268,7 @@ std::string expr2ct::convert_constant(
2267
2268
}
2268
2269
else if (type.id ()==ID_bool)
2269
2270
{
2270
- dest = convert_constant_bool (src.is_true ());
2271
+ dest= convert_constant_bool (src.is_true ());
2271
2272
}
2272
2273
else if (type.id ()==ID_unsignedbv ||
2273
2274
type.id ()==ID_signedbv ||
@@ -2283,7 +2284,7 @@ std::string expr2ct::convert_constant(
2283
2284
2284
2285
if (type.id ()==ID_c_bool)
2285
2286
{
2286
- dest = convert_constant_bool (int_value != 0 );
2287
+ dest= convert_constant_bool (int_value!= 0 );
2287
2288
}
2288
2289
else if (type==char_type () && type!=signed_int_type () && type!=unsigned_int_type ())
2289
2290
{
@@ -2482,7 +2483,7 @@ Function: expr2ct::convert_struct
2482
2483
Inputs:
2483
2484
src - The struct declaration expression
2484
2485
precedence
2485
- include_padding_members - Should the generated C code
2486
+ include_padding_components - Should the generated C code
2486
2487
include the padding members added
2487
2488
to structs for GOTOs benifit
2488
2489
@@ -2495,7 +2496,7 @@ Function: expr2ct::convert_struct
2495
2496
std::string expr2ct::convert_struct (
2496
2497
const exprt &src,
2497
2498
unsigned &precedence,
2498
- bool include_padding_members )
2499
+ bool include_padding_components )
2499
2500
{
2500
2501
const typet full_type=ns.follow (src.type ());
2501
2502
@@ -2519,15 +2520,13 @@ std::string expr2ct::convert_struct(
2519
2520
bool newline=false ;
2520
2521
size_t last_size=0 ;
2521
2522
2522
- for (struct_typet::componentst::const_iterator
2523
- c_it=components.begin ();
2524
- c_it!=components.end ();
2525
- c_it++)
2523
+ for (const struct_union_typet::componentt &component :
2524
+ struct_type.components ())
2526
2525
{
2527
2526
if (o_it->type ().id ()==ID_code)
2528
2527
continue ;
2529
2528
2530
- if (c_it-> get_is_padding () && !include_padding_members )
2529
+ if (component. get_is_padding () && !include_padding_components )
2531
2530
{
2532
2531
++o_it;
2533
2532
continue ;
@@ -2556,7 +2555,7 @@ std::string expr2ct::convert_struct(
2556
2555
newline=false ;
2557
2556
2558
2557
dest+=' .' ;
2559
- dest+=c_it-> get_string (ID_name);
2558
+ dest+=component. get_string (ID_name);
2560
2559
dest+=' =' ;
2561
2560
dest+=tmp;
2562
2561
0 commit comments