Skip to content

Commit 500d485

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 fc0e2a2 commit 500d485

File tree

3 files changed

+24
-44
lines changed

3 files changed

+24
-44
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,
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, 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,
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, out, *i_it);
165153
location.set_attribute("instruction", out.str());
166154

167155
function_body.new_element(location);

src/analyses/ai.h

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

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

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-
151155
/// Output the abstract states for a function
152156
void output(
153157
const namespacet &ns,
@@ -242,38 +246,26 @@ class ai_baset
242246
/// entry state required by the analysis
243247
void entry_state(const goto_functionst &goto_functions);
244248

245-
/// Output the abstract states for a single function
246-
/// \param ns: The namespace
247-
/// \param goto_program: The goto program
248-
/// \param identifier: The identifier used to find a symbol to identify the
249-
/// source language
250-
/// \param out: The ostream to direct output to
251-
virtual void output(
252-
const namespacet &ns,
253-
const goto_programt &goto_program,
254-
const irep_idt &identifier,
255-
std::ostream &out) const;
256-
257249
/// Output the abstract states for a single function as JSON
258250
/// \param ns: The namespace
259251
/// \param goto_program: The goto program
260-
/// \param identifier: The identifier used to find a symbol to identify the
252+
/// \param function: The identifier used to find a symbol to identify the
261253
/// source language
262254
/// \return The JSON object
263255
virtual jsont output_json(
264256
const namespacet &ns,
265-
const irep_idt &identifier,
257+
const irep_idt &function,
266258
const goto_programt &goto_program) const;
267259

268260
/// Output the abstract states for a single function as XML
269261
/// \param ns: The namespace
270262
/// \param goto_program: The goto program
271-
/// \param identifier: The identifier used to find a symbol to identify the
263+
/// \param function: The identifier used to find a symbol to identify the
272264
/// source language
273265
/// \return The XML object
274266
virtual xmlt output_xml(
275267
const namespacet &ns,
276-
const irep_idt &identifier,
268+
const irep_idt &function,
277269
const goto_programt &goto_program) const;
278270

279271
/// 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)