@@ -35,15 +35,15 @@ void ai_baset::output(
35
35
out << " ////\n " ;
36
36
out << " \n " ;
37
37
38
- output (ns, f_it->second . body , f_it->first , out);
38
+ output (ns, f_it->first , f_it->second . body , out);
39
39
}
40
40
}
41
41
}
42
42
43
43
void ai_baset::output (
44
44
const namespacet &ns,
45
+ const irep_idt &function_id,
45
46
const goto_programt &goto_program,
46
- const irep_idt &identifier,
47
47
std::ostream &out) const
48
48
{
49
49
forall_goto_program_instructions (i_it, goto_program)
@@ -54,7 +54,7 @@ void ai_baset::output(
54
54
abstract_state_before (i_it)->output (out, *this , ns);
55
55
out << " \n " ;
56
56
#if 1
57
- goto_program.output_instruction (ns, identifier , out, *i_it);
57
+ goto_program.output_instruction (ns, function_id , out, *i_it);
58
58
out << " \n " ;
59
59
#endif
60
60
}
@@ -70,8 +70,8 @@ jsont ai_baset::output_json(
70
70
{
71
71
if (f_it->second .body_available ())
72
72
{
73
- result[id2string (f_it->first )]=
74
- output_json (ns, f_it->second . body , f_it->first );
73
+ result[id2string (f_it->first )] =
74
+ output_json (ns, f_it->first , f_it->second . body );
75
75
}
76
76
else
77
77
{
@@ -82,24 +82,18 @@ jsont ai_baset::output_json(
82
82
return std::move (result);
83
83
}
84
84
85
- // / Output the domains for a single function as JSON
86
- // / \param ns: The namespace
87
- // / \param goto_program: The goto program
88
- // / \param identifier: The identifier used to find a symbol to identify the
89
- // / source language
90
- // / \return The JSON object
91
85
jsont ai_baset::output_json (
92
86
const namespacet &ns,
93
- const goto_programt &goto_program ,
94
- const irep_idt &identifier ) const
87
+ const irep_idt &function_id ,
88
+ const goto_programt &goto_program ) const
95
89
{
96
90
json_arrayt contents;
97
91
98
92
forall_goto_program_instructions (i_it, goto_program)
99
93
{
100
94
// Ideally we need output_instruction_json
101
95
std::ostringstream out;
102
- goto_program.output_instruction (ns, identifier , out, *i_it);
96
+ goto_program.output_instruction (ns, function_id , out, *i_it);
103
97
104
98
json_objectt location (
105
99
{{" locationNumber" , json_numbert (std::to_string (i_it->location_number ))},
@@ -129,7 +123,7 @@ xmlt ai_baset::output_xml(
129
123
130
124
if (f_it->second .body_available ())
131
125
{
132
- function.new_element (output_xml (ns, f_it->second . body , f_it->first ));
126
+ function.new_element (output_xml (ns, f_it->first , f_it->second . body ));
133
127
}
134
128
135
129
program.new_element (function);
@@ -138,16 +132,10 @@ xmlt ai_baset::output_xml(
138
132
return program;
139
133
}
140
134
141
- // / Output the domains for a single function as XML
142
- // / \param ns: The namespace
143
- // / \param goto_program: The goto program
144
- // / \param identifier: The identifier used to find a symbol to identify the
145
- // / source language
146
- // / \return The XML object
147
135
xmlt ai_baset::output_xml (
148
136
const namespacet &ns,
149
- const goto_programt &goto_program ,
150
- const irep_idt &identifier ) const
137
+ const irep_idt &function_id ,
138
+ const goto_programt &goto_program ) const
151
139
{
152
140
xmlt function_body;
153
141
@@ -161,7 +149,7 @@ xmlt ai_baset::output_xml(
161
149
162
150
// Ideally we need output_instruction_xml
163
151
std::ostringstream out;
164
- goto_program.output_instruction (ns, identifier , out, *i_it);
152
+ goto_program.output_instruction (ns, function_id , out, *i_it);
165
153
location.set_attribute (" instruction" , out.str ());
166
154
167
155
function_body.new_element (location);
@@ -187,12 +175,14 @@ void ai_baset::entry_state(const goto_programt &goto_program)
187
175
get_state (goto_program.instructions .begin ()).make_entry ();
188
176
}
189
177
190
- void ai_baset::initialize (const goto_functionst::goto_functiont &goto_function)
178
+ void ai_baset::initialize (
179
+ const irep_idt &function_id,
180
+ const goto_functionst::goto_functiont &goto_function)
191
181
{
192
- initialize (goto_function.body );
182
+ initialize (function_id, goto_function.body );
193
183
}
194
184
195
- void ai_baset::initialize (const goto_programt &goto_program)
185
+ void ai_baset::initialize (const irep_idt &, const goto_programt &goto_program)
196
186
{
197
187
// we mark everything as unreachable as starting point
198
188
@@ -203,7 +193,7 @@ void ai_baset::initialize(const goto_programt &goto_program)
203
193
void ai_baset::initialize (const goto_functionst &goto_functions)
204
194
{
205
195
forall_goto_functions (it, goto_functions)
206
- initialize (it->second );
196
+ initialize (it->first , it-> second );
207
197
}
208
198
209
199
void ai_baset::finalize ()
@@ -224,7 +214,7 @@ ai_baset::locationt ai_baset::get_next(
224
214
}
225
215
226
216
bool ai_baset::fixedpoint (
227
- const irep_idt &function_identifier ,
217
+ const irep_idt &function_id ,
228
218
const goto_programt &goto_program,
229
219
const goto_functionst &goto_functions,
230
220
const namespacet &ns)
@@ -244,16 +234,15 @@ bool ai_baset::fixedpoint(
244
234
locationt l=get_next (working_set);
245
235
246
236
// goto_program is really only needed for iterator manipulation
247
- if (visit (
248
- function_identifier, l, working_set, goto_program, goto_functions, ns))
237
+ if (visit (function_id, l, working_set, goto_program, goto_functions, ns))
249
238
new_data=true ;
250
239
}
251
240
252
241
return new_data;
253
242
}
254
243
255
244
bool ai_baset::visit (
256
- const irep_idt &function_identifier ,
245
+ const irep_idt &function_id ,
257
246
locationt l,
258
247
working_sett &working_set,
259
248
const goto_programt &goto_program,
@@ -284,7 +273,7 @@ bool ai_baset::visit(
284
273
to_code_function_call (l->code );
285
274
286
275
if (do_function_call_rec (
287
- function_identifier ,
276
+ function_id ,
288
277
l,
289
278
to_l,
290
279
code.function (),
@@ -298,8 +287,7 @@ bool ai_baset::visit(
298
287
// initialize state, if necessary
299
288
get_state (to_l);
300
289
301
- new_values.transform (
302
- function_identifier, l, function_identifier, to_l, *this , ns);
290
+ new_values.transform (function_id, l, function_id, to_l, *this , ns);
303
291
304
292
if (merge (new_values, l, to_l))
305
293
have_new_values=true ;
@@ -316,7 +304,7 @@ bool ai_baset::visit(
316
304
}
317
305
318
306
bool ai_baset::do_function_call (
319
- const irep_idt &calling_function_identifier ,
307
+ const irep_idt &calling_function_id ,
320
308
locationt l_call,
321
309
locationt l_return,
322
310
const goto_functionst &goto_functions,
@@ -337,12 +325,7 @@ bool ai_baset::do_function_call(
337
325
// If we don't have a body, we just do an edge call -> return
338
326
std::unique_ptr<statet> tmp_state (make_temporary_state (get_state (l_call)));
339
327
tmp_state->transform (
340
- calling_function_identifier,
341
- l_call,
342
- calling_function_identifier,
343
- l_return,
344
- *this ,
345
- ns);
328
+ calling_function_id, l_call, calling_function_id, l_return, *this , ns);
346
329
347
330
return merge (*tmp_state, l_call, l_return);
348
331
}
@@ -360,7 +343,7 @@ bool ai_baset::do_function_call(
360
343
// do the edge from the call site to the beginning of the function
361
344
std::unique_ptr<statet> tmp_state (make_temporary_state (get_state (l_call)));
362
345
tmp_state->transform (
363
- calling_function_identifier , l_call, f_it->first , l_begin, *this , ns);
346
+ calling_function_id , l_call, f_it->first , l_begin, *this , ns);
364
347
365
348
bool new_data=false ;
366
349
@@ -388,15 +371,15 @@ bool ai_baset::do_function_call(
388
371
389
372
std::unique_ptr<statet> tmp_state (make_temporary_state (end_state));
390
373
tmp_state->transform (
391
- f_it->first , l_end, calling_function_identifier , l_return, *this , ns);
374
+ f_it->first , l_end, calling_function_id , l_return, *this , ns);
392
375
393
376
// Propagate those
394
377
return merge (*tmp_state, l_end, l_return);
395
378
}
396
379
}
397
380
398
381
bool ai_baset::do_function_call_rec (
399
- const irep_idt &calling_function_identifier ,
382
+ const irep_idt &calling_function_id ,
400
383
locationt l_call,
401
384
locationt l_return,
402
385
const exprt &function,
@@ -424,13 +407,7 @@ bool ai_baset::do_function_call_rec(
424
407
" Function " + id2string (identifier) + " not in function map" );
425
408
426
409
new_data = do_function_call (
427
- calling_function_identifier,
428
- l_call,
429
- l_return,
430
- goto_functions,
431
- it,
432
- arguments,
433
- ns);
410
+ calling_function_id, l_call, l_return, goto_functions, it, arguments, ns);
434
411
435
412
return new_data;
436
413
}
@@ -464,16 +441,16 @@ void ai_baset::concurrent_fixedpoint(
464
441
struct wl_entryt
465
442
{
466
443
wl_entryt (
467
- const irep_idt &_function_identifier ,
444
+ const irep_idt &_function_id ,
468
445
const goto_programt &_goto_program,
469
446
locationt _location)
470
- : function_identifier(_function_identifier ),
447
+ : function_id(_function_id ),
471
448
goto_program (&_goto_program),
472
449
location(_location)
473
450
{
474
451
}
475
452
476
- irep_idt function_identifier ;
453
+ irep_idt function_id ;
477
454
const goto_programt *goto_program;
478
455
locationt location;
479
456
};
@@ -516,7 +493,7 @@ void ai_baset::concurrent_fixedpoint(
516
493
goto_programt::const_targett l=get_next (working_set);
517
494
518
495
visit (
519
- wl_entry.function_identifier ,
496
+ wl_entry.function_id ,
520
497
l,
521
498
working_set,
522
499
*(wl_entry.goto_program ),
0 commit comments