@@ -56,51 +56,68 @@ class ansi_c_convert_typet
56
56
// qualifiers
57
57
c_qualifierst c_qualifiers;
58
58
59
- virtual void read (const typet &type);
60
59
virtual void write (typet &type);
61
60
62
61
source_locationt source_location;
63
62
64
63
std::list<typet> other;
65
64
66
- explicit ansi_c_convert_typet (message_handlert &_message_handler)
67
- : message_handler(_message_handler)
68
- // class members are initialized by calling read()
69
- {
70
- }
71
-
72
- virtual void clear ()
65
+ ansi_c_convert_typet (message_handlert &_message_handler, const typet &type)
66
+ : ansi_c_convert_typet(_message_handler)
73
67
{
74
- unsigned_cnt=signed_cnt=char_cnt=int_cnt=short_cnt=
75
- long_cnt=double_cnt=float_cnt=c_bool_cnt=proper_bool_cnt=complex_cnt=
76
- int8_cnt=int16_cnt=int32_cnt=int64_cnt=
77
- ptr32_cnt=ptr64_cnt=
78
- gcc_float16_cnt=
79
- gcc_float32_cnt=gcc_float32x_cnt=
80
- gcc_float64_cnt=gcc_float64x_cnt=
81
- gcc_float128_cnt=gcc_float128x_cnt=
82
- gcc_int128_cnt=bv_cnt=floatbv_cnt=fixedbv_cnt=0 ;
83
- vector_size.make_nil ();
84
- alignment.make_nil ();
85
- bv_width.make_nil ();
86
- fraction_width.make_nil ();
87
- msc_based.make_nil ();
88
- gcc_attribute_mode.make_nil ();
89
-
90
- assigns.clear ();
91
- requires.clear ();
92
- ensures.clear ();
93
-
94
- packed=aligned=constructor=destructor=false ;
95
-
96
- other.clear ();
97
- c_storage_spec.clear ();
98
- c_qualifiers.clear ();
68
+ source_location = type.source_location ();
69
+ read_rec (type);
99
70
}
100
71
101
72
protected:
102
73
message_handlert &message_handler;
103
74
75
+ // Default-initialize all members. To be used by classes deriving from this
76
+ // one to make sure additional members can be initialized before invoking
77
+ // read_rec.
78
+ explicit ansi_c_convert_typet (message_handlert &_message_handler)
79
+ : unsigned_cnt(0 ),
80
+ signed_cnt(0 ),
81
+ char_cnt(0 ),
82
+ int_cnt(0 ),
83
+ short_cnt(0 ),
84
+ long_cnt(0 ),
85
+ double_cnt(0 ),
86
+ float_cnt(0 ),
87
+ c_bool_cnt(0 ),
88
+ proper_bool_cnt(0 ),
89
+ complex_cnt(0 ),
90
+ int8_cnt(0 ),
91
+ int16_cnt(0 ),
92
+ int32_cnt(0 ),
93
+ int64_cnt(0 ),
94
+ ptr32_cnt(0 ),
95
+ ptr64_cnt(0 ),
96
+ gcc_float16_cnt(0 ),
97
+ gcc_float32_cnt(0 ),
98
+ gcc_float32x_cnt(0 ),
99
+ gcc_float64_cnt(0 ),
100
+ gcc_float64x_cnt(0 ),
101
+ gcc_float128_cnt(0 ),
102
+ gcc_float128x_cnt(0 ),
103
+ gcc_int128_cnt(0 ),
104
+ bv_cnt(0 ),
105
+ floatbv_cnt(0 ),
106
+ fixedbv_cnt(0 ),
107
+ gcc_attribute_mode(static_cast <const typet &>(get_nil_irep())),
108
+ packed(false ),
109
+ aligned(false ),
110
+ vector_size(nil_exprt{}),
111
+ alignment(nil_exprt{}),
112
+ bv_width(nil_exprt{}),
113
+ fraction_width(nil_exprt{}),
114
+ msc_based(nil_exprt{}),
115
+ constructor(false ),
116
+ destructor(false ),
117
+ message_handler(_message_handler)
118
+ {
119
+ }
120
+
104
121
virtual void read_rec (const typet &type);
105
122
virtual void build_type_with_subtype (typet &type) const ;
106
123
virtual void set_attributes (typet &type) const ;
0 commit comments