@@ -57,9 +57,7 @@ class document_propertiest
57
57
58
58
static void strip_space (std::list<linet> &lines);
59
59
60
- void get_code (
61
- const source_locationt &source_location,
62
- std::string &dest);
60
+ std::string get_code (const source_locationt &source_location);
63
61
64
62
struct doc_claimt
65
63
{
@@ -148,26 +146,25 @@ bool is_empty(const std::string &s)
148
146
return true ;
149
147
}
150
148
151
- void document_propertiest::get_code (
152
- const source_locationt &source_location,
153
- std::string &dest)
149
+ std::string
150
+ document_propertiest::get_code (const source_locationt &source_location)
154
151
{
155
- dest=" " ;
156
-
157
152
const irep_idt &file=source_location.get_file ();
158
153
const irep_idt &source_line = source_location.get_line ();
159
154
160
- if (file == " " || source_line == " " )
161
- return ;
155
+ if (file. empty () || source_line. empty () )
156
+ return " " ;
162
157
163
158
std::ifstream in (id2string (file));
164
159
160
+ std::string dest;
161
+
165
162
if (!in)
166
163
{
167
164
dest+=" ERROR: unable to open " ;
168
165
dest+=id2string (file);
169
166
dest+=" \n " ;
170
- return ;
167
+ return dest ;
171
168
}
172
169
173
170
int line_int = unsafe_string2int (id2string (source_line));
@@ -268,6 +265,8 @@ void document_propertiest::get_code(
268
265
269
266
dest+=tmp+" \n " ;
270
267
}
268
+
269
+ return dest;
271
270
}
272
271
273
272
void document_propertiest::doit ()
@@ -298,10 +297,9 @@ void document_propertiest::doit()
298
297
for (claim_sett::const_iterator it=claim_set.begin ();
299
298
it!=claim_set.end (); it++)
300
299
{
301
- std::string code;
302
300
const source_locationt &source_location=it->first ;
303
301
304
- get_code (source_location, code );
302
+ std::string code = get_code (source_location);
305
303
306
304
switch (format)
307
305
{
0 commit comments