1
1
/* ******************************************************************\
2
2
3
- Module: Linking: Zero Initialization
3
+ Module: Zero Initialization
4
4
5
5
Author: Daniel Kroening, [email protected]
6
6
7
7
\*******************************************************************/
8
8
9
9
// / \file
10
- // / Linking: Zero Initialization
10
+ // / Zero Initialization
11
11
12
12
#include " zero_initializer.h"
13
13
14
- #include < util/ arith_tools.h>
15
- #include < util/ c_types.h>
16
- #include < util/message.h >
17
- #include < util/namespace.h >
18
- #include < util/pointer_offset_size.h >
19
- #include < util/std_expr.h >
20
-
21
- #include < ansi-c/expr2c.h >
14
+ #include " arith_tools.h"
15
+ #include " c_types.h"
16
+ #include " format_expr.h "
17
+ #include " format_type.h "
18
+ #include " message.h "
19
+ #include " namespace.h "
20
+ # include " pointer_offset_size.h "
21
+ #include " std_expr.h "
22
22
23
23
class zero_initializert :public messaget
24
24
{
@@ -41,16 +41,6 @@ class zero_initializert:public messaget
41
41
protected:
42
42
const namespacet &ns;
43
43
44
- std::string to_string (const exprt &src)
45
- {
46
- return expr2c (src, ns);
47
- }
48
-
49
- std::string to_string (const typet &src)
50
- {
51
- return type2c (src, ns);
52
- }
53
-
54
44
exprt zero_initializer_rec (
55
45
const typet &type,
56
46
const source_locationt &source_location);
@@ -137,15 +127,14 @@ exprt zero_initializert::zero_initializer_rec(
137
127
{
138
128
error ().source_location =source_location;
139
129
error () << " failed to zero-initialize array of non-fixed size `"
140
- << to_string (array_type.size ()) << " '" << eom;
130
+ << format (array_type.size ()) << " '" << eom;
141
131
throw 0 ;
142
132
}
143
133
144
134
if (array_size<0 )
145
135
{
146
136
error ().source_location =source_location;
147
- error () << " failed to zero-initialize array of with negative size"
148
- << eom;
137
+ error () << " failed to zero-initialize array with negative size" << eom;
149
138
throw 0 ;
150
139
}
151
140
@@ -167,15 +156,14 @@ exprt zero_initializert::zero_initializer_rec(
167
156
{
168
157
error ().source_location =source_location;
169
158
error () << " failed to zero-initialize vector of non-fixed size `"
170
- << to_string (vector_type.size ()) << " '" << eom;
159
+ << format (vector_type.size ()) << " '" << eom;
171
160
throw 0 ;
172
161
}
173
162
174
163
if (vector_size<0 )
175
164
{
176
165
error ().source_location =source_location;
177
- error () << " failed to zero-initialize vector of with negative size"
178
- << eom;
166
+ error () << " failed to zero-initialize vector with negative size" << eom;
179
167
throw 0 ;
180
168
}
181
169
@@ -299,8 +287,7 @@ exprt zero_initializert::zero_initializer_rec(
299
287
else
300
288
{
301
289
error ().source_location =source_location;
302
- error () << " failed to zero-initialize `" << to_string (type)
303
- << " '" << eom;
290
+ error () << " failed to zero-initialize `" << format (type) << " '" << eom;
304
291
throw 0 ;
305
292
}
306
293
}
0 commit comments