Skip to content

Commit c94cf4c

Browse files
Daniel Kroeningtautschnig
Daniel Kroening
authored andcommitted
ai_baset: output now requires function identifier
We are working towards removing the "function" field from goto_programt::instructionst::instructiont, and thus need to pass the identifier of the function whenever it actually is required.
1 parent 286f5b2 commit c94cf4c

File tree

3 files changed

+25
-46
lines changed

3 files changed

+25
-46
lines changed

src/analyses/ai.cpp

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void ai_baset::output(
4242

4343
void ai_baset::output(
4444
const namespacet &ns,
45-
const irep_idt &identifier,
45+
const irep_idt &function_identifier,
4646
const goto_programt &goto_program,
4747
std::ostream &out) const
4848
{
@@ -54,7 +54,7 @@ void ai_baset::output(
5454
abstract_state_before(i_it)->output(out, *this, ns);
5555
out << "\n";
5656
#if 1
57-
goto_program.output_instruction(ns, identifier, out, *i_it);
57+
goto_program.output_instruction(ns, function_identifier, out, *i_it);
5858
out << "\n";
5959
#endif
6060
}
@@ -82,15 +82,9 @@ jsont ai_baset::output_json(
8282
return std::move(result);
8383
}
8484

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
9185
jsont ai_baset::output_json(
9286
const namespacet &ns,
93-
const irep_idt &identifier,
87+
const irep_idt &function_identifier,
9488
const goto_programt &goto_program) const
9589
{
9690
json_arrayt contents;
@@ -99,7 +93,7 @@ jsont ai_baset::output_json(
9993
{
10094
// Ideally we need output_instruction_json
10195
std::ostringstream out;
102-
goto_program.output_instruction(ns, identifier, out, *i_it);
96+
goto_program.output_instruction(ns, function_identifier, out, *i_it);
10397

10498
json_objectt location(
10599
{{"locationNumber", json_numbert(std::to_string(i_it->location_number))},
@@ -138,15 +132,9 @@ xmlt ai_baset::output_xml(
138132
return program;
139133
}
140134

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
147135
xmlt ai_baset::output_xml(
148136
const namespacet &ns,
149-
const irep_idt &identifier,
137+
const irep_idt &function_identifier,
150138
const goto_programt &goto_program) const
151139
{
152140
xmlt function_body;
@@ -161,7 +149,7 @@ xmlt ai_baset::output_xml(
161149

162150
// Ideally we need output_instruction_xml
163151
std::ostringstream out;
164-
goto_program.output_instruction(ns, identifier, out, *i_it);
152+
goto_program.output_instruction(ns, function_identifier, out, *i_it);
165153
location.set_attribute("instruction", out.str());
166154

167155
function_body.new_element(location);

src/analyses/ai.h

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,18 @@ class ai_baset
124124
{
125125
}
126126

127+
/// Output the abstract states for a single function
128+
/// \param ns: The namespace
129+
/// \param function_identifier: The identifier used to find a symbol to
130+
/// identify the \p goto_program's source language
131+
/// \param goto_program: The goto program
132+
/// \param out: The ostream to direct output to
133+
virtual void output(
134+
const namespacet &ns,
135+
const irep_idt &function_identifier,
136+
const goto_programt &goto_program,
137+
std::ostream &out) const;
138+
127139
/// Output the abstract states for a whole program
128140
virtual void output(
129141
const namespacet &ns,
@@ -139,15 +151,6 @@ class ai_baset
139151
output(ns, goto_model.goto_functions, out);
140152
}
141153

142-
/// Output the abstract states for a function
143-
void output(
144-
const namespacet &ns,
145-
const goto_programt &goto_program,
146-
std::ostream &out) const
147-
{
148-
output(ns, "", goto_program, out);
149-
}
150-
151154
/// Output the abstract states for a function
152155
void output(
153156
const namespacet &ns,
@@ -243,38 +246,26 @@ class ai_baset
243246
/// entry state required by the analysis
244247
void entry_state(const goto_functionst &goto_functions);
245248

246-
/// Output the abstract states for a single function
247-
/// \param ns: The namespace
248-
/// \param goto_program: The goto program
249-
/// \param identifier: The identifier used to find a symbol to identify the
250-
/// source language
251-
/// \param out: The ostream to direct output to
252-
virtual void output(
253-
const namespacet &ns,
254-
const goto_programt &goto_program,
255-
const irep_idt &identifier,
256-
std::ostream &out) const;
257-
258249
/// Output the abstract states for a single function as JSON
259250
/// \param ns: The namespace
260251
/// \param goto_program: The goto program
261-
/// \param identifier: The identifier used to find a symbol to identify the
262-
/// source language
252+
/// \param function_identifier: The identifier used to find a symbol to
253+
/// identify the source language
263254
/// \return The JSON object
264255
virtual jsont output_json(
265256
const namespacet &ns,
266-
const irep_idt &identifier,
257+
const irep_idt &function_identifier,
267258
const goto_programt &goto_program) const;
268259

269260
/// Output the abstract states for a single function as XML
270261
/// \param ns: The namespace
271262
/// \param goto_program: The goto program
272-
/// \param identifier: The identifier used to find a symbol to identify the
273-
/// source language
263+
/// \param function_identifier: The identifier used to find a symbol to
264+
/// identify the source language
274265
/// \return The XML object
275266
virtual xmlt output_xml(
276267
const namespacet &ns,
277-
const irep_idt &identifier,
268+
const irep_idt &function_identifier,
278269
const goto_programt &goto_program) const;
279270

280271
/// The work queue, sorted by location number

src/goto-instrument/uninitialized.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void show_uninitialized(
223223
out << "////\n\n";
224224
uninitialized_analysist uninitialized_analysis;
225225
uninitialized_analysis(f_it->first, f_it->second.body, ns);
226-
uninitialized_analysis.output(ns, f_it->second.body, out);
226+
uninitialized_analysis.output(ns, f_it->first, f_it->second.body, out);
227227
}
228228
}
229229
}

0 commit comments

Comments
 (0)