Skip to content

Commit c16443e

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 7d655bd commit c16443e

File tree

3 files changed

+24
-32
lines changed

3 files changed

+24
-32
lines changed

src/analyses/ai.cpp

Lines changed: 8 additions & 8 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
}
@@ -85,12 +85,12 @@ jsont ai_baset::output_json(
8585
/// Output the domains for a single function as JSON
8686
/// \param ns: The namespace
8787
/// \param goto_program: The goto program
88-
/// \param identifier: The identifier used to find a symbol to identify the
88+
/// \param function: The identifier used to find a symbol to identify the
8989
/// source language
9090
/// \return The JSON object
9191
jsont ai_baset::output_json(
9292
const namespacet &ns,
93-
const irep_idt &identifier,
93+
const irep_idt &function,
9494
const goto_programt &goto_program) const
9595
{
9696
json_arrayt contents;
@@ -99,7 +99,7 @@ jsont ai_baset::output_json(
9999
{
100100
// Ideally we need output_instruction_json
101101
std::ostringstream out;
102-
goto_program.output_instruction(ns, identifier, out, *i_it);
102+
goto_program.output_instruction(ns, function, out, *i_it);
103103

104104
json_objectt location(
105105
{{"locationNumber", json_numbert(std::to_string(i_it->location_number))},
@@ -141,12 +141,12 @@ xmlt ai_baset::output_xml(
141141
/// Output the domains for a single function as XML
142142
/// \param ns: The namespace
143143
/// \param goto_program: The goto program
144-
/// \param identifier: The identifier used to find a symbol to identify the
144+
/// \param function: The identifier used to find a symbol to identify the
145145
/// source language
146146
/// \return The XML object
147147
xmlt ai_baset::output_xml(
148148
const namespacet &ns,
149-
const irep_idt &identifier,
149+
const irep_idt &function,
150150
const goto_programt &goto_program) const
151151
{
152152
xmlt function_body;
@@ -161,7 +161,7 @@ xmlt ai_baset::output_xml(
161161

162162
// Ideally we need output_instruction_xml
163163
std::ostringstream out;
164-
goto_program.output_instruction(ns, identifier, out, *i_it);
164+
goto_program.output_instruction(ns, function, out, *i_it);
165165
location.set_attribute("instruction", out.str());
166166

167167
function_body.new_element(location);

src/analyses/ai.h

Lines changed: 15 additions & 23 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,18 +246,6 @@ 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
@@ -262,7 +254,7 @@ class ai_baset
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
@@ -273,7 +265,7 @@ class ai_baset
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)