Skip to content

Commit 8bf3ea6

Browse files
authored
Merge pull request #6896 from tautschnig/cleanup/output_instruction
Replace all uses of goto_programt::output_instruction
2 parents f403924 + f7a33df commit 8bf3ea6

27 files changed

+79
-87
lines changed

src/analyses/ai.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ void ai_baset::output(
4343
const goto_programt &goto_program,
4444
std::ostream &out) const
4545
{
46+
(void)function_id; // unused parameter
47+
4648
forall_goto_program_instructions(i_it, goto_program)
4749
{
4850
out << "**** " << i_it->location_number << " " << i_it->source_location()
@@ -51,7 +53,7 @@ void ai_baset::output(
5153
abstract_state_before(i_it)->output(out, *this, ns);
5254
out << "\n";
5355
#if 1
54-
goto_program.output_instruction(ns, function_id, out, *i_it);
56+
i_it->output(out);
5557
out << "\n";
5658
#endif
5759
}
@@ -84,13 +86,15 @@ jsont ai_baset::output_json(
8486
const irep_idt &function_id,
8587
const goto_programt &goto_program) const
8688
{
89+
(void)function_id; // unused parameter
90+
8791
json_arrayt contents;
8892

8993
forall_goto_program_instructions(i_it, goto_program)
9094
{
9195
// Ideally we need output_instruction_json
9296
std::ostringstream out;
93-
goto_program.output_instruction(ns, function_id, out, *i_it);
97+
i_it->output(out);
9498

9599
json_objectt location{
96100
{"locationNumber", json_numbert(std::to_string(i_it->location_number))},
@@ -135,6 +139,8 @@ xmlt ai_baset::output_xml(
135139
const irep_idt &function_id,
136140
const goto_programt &goto_program) const
137141
{
142+
(void)function_id; // unused parameter
143+
138144
xmlt function_body;
139145

140146
forall_goto_program_instructions(i_it, goto_program)
@@ -147,7 +153,7 @@ xmlt ai_baset::output_xml(
147153

148154
// Ideally we need output_instruction_xml
149155
std::ostringstream out;
150-
goto_program.output_instruction(ns, function_id, out, *i_it);
156+
i_it->output(out);
151157
location.set_attribute("instruction", out.str());
152158

153159
function_body.new_element(location);

src/analyses/flow_insensitive_analysis.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,16 @@ bool flow_insensitive_analysis_baset::visit(
173173
// if (id2string(l->function).find("debug")!=std::string::npos)
174174
// std::cout << l->function << '\n'; //=="messages::debug")
175175

176-
// {
177-
// static unsigned state_cntr=0;
178-
// std::string s("pastate"); s += std::to_string(state_cntr);
179-
// std::ofstream f(s.c_str());
180-
// goto_program.output_instruction(ns, "", f, l);
181-
// f << '\n';
182-
// get_state().output(ns, f);
183-
// f.close();
184-
// state_cntr++;
185-
// }
176+
// {
177+
// static unsigned state_cntr=0;
178+
// std::string s("pastate"); s += std::to_string(state_cntr);
179+
// std::ofstream f(s.c_str());
180+
// l->output(f);
181+
// f << '\n';
182+
// get_state().output(ns, f);
183+
// f.close();
184+
// state_cntr++;
185+
// }
186186

187187
return new_data;
188188
}

src/analyses/local_bitvector_analysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ void local_bitvector_analysist::output(
365365
}
366366

367367
out << "\n";
368-
goto_function.body.output_instruction(ns, irep_idt(), out, instruction);
368+
instruction.output(out);
369369
out << "\n";
370370

371371
l++;

src/analyses/local_may_alias.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ void local_may_aliast::output(
497497
}
498498

499499
out << "\n";
500-
goto_function.body.output_instruction(ns, irep_idt(), out, instruction);
500+
instruction.output(out);
501501
out << "\n";
502502

503503
l++;

src/analyses/local_safe_pointers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void local_safe_pointerst::output(
217217
}
218218

219219
out << '\n';
220-
goto_program.output_instruction(ns, irep_idt(), out, instruction);
220+
instruction.output(out);
221221
out << '\n';
222222
}
223223
}
@@ -268,7 +268,7 @@ void local_safe_pointerst::output_safe_dereferences(
268268
}
269269

270270
out << '\n';
271-
goto_program.output_instruction(ns, irep_idt(), out, instruction);
271+
instruction.output(out);
272272
out << '\n';
273273
}
274274
}

src/analyses/sese_regions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static std::string brief_instruction_string(
221221
&program_relative_instruction_indices)
222222
{
223223
std::ostringstream ostr;
224-
goto_program.output_instruction(ns, "", ostr, *instruction);
224+
instruction->output(ostr);
225225
return instruction_ordinals(
226226
instruction, program_relative_instruction_indices) +
227227
" " + trimmed_last_line(ostr.str());

src/analyses/static_analysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void static_analysis_baset::output(
9494
get_state(i_it).output(ns, out);
9595
out << "\n";
9696
#if 0
97-
goto_program.output_instruction(ns, identifier, out, i_it);
97+
i_it->output(out);
9898
out << "\n";
9999
#endif
100100
}

src/goto-analyzer/unreachable_instructions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static void output_dead_plain(
7575
for(dead_mapt::const_iterator it=dead_map.begin();
7676
it!=dead_map.end();
7777
++it)
78-
goto_program.output_instruction(ns, function_identifier, os, *it->second);
78+
it->second->output(os);
7979
}
8080

8181
static void add_to_xml(
@@ -136,7 +136,7 @@ static void add_to_json(
136136
++it)
137137
{
138138
std::ostringstream oss;
139-
goto_program.output_instruction(ns, function_identifier, oss, *it->second);
139+
it->second->output(oss);
140140
std::string s=oss.str();
141141

142142
std::string::size_type n=s.find('\n');

src/goto-diff/change_impact.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ class change_impactt
284284
char prefix,
285285
const goto_programt &goto_program,
286286
const namespacet &ns,
287-
const irep_idt &function_id,
288287
goto_programt::const_targett &target) const;
289288
};
290289

@@ -606,7 +605,7 @@ void change_impactt::output_change_impact(
606605
else
607606
UNREACHABLE;
608607

609-
output_instruction(prefix, goto_program, ns, function_id, target);
608+
output_instruction(prefix, goto_program, ns, target);
610609
}
611610
}
612611

@@ -644,7 +643,7 @@ void change_impactt::output_change_impact(
644643

645644
if(old_mod_flags&DELETED)
646645
{
647-
output_instruction('-', goto_program, o_ns, function_id, o_target);
646+
output_instruction('-', goto_program, o_ns, o_target);
648647
++o_target;
649648
--target;
650649
continue;
@@ -696,7 +695,7 @@ void change_impactt::output_change_impact(
696695
else
697696
UNREACHABLE;
698697

699-
output_instruction(prefix, goto_program, n_ns, function_id, target);
698+
output_instruction(prefix, goto_program, n_ns, target);
700699
}
701700
for( ;
702701
o_target!=old_goto_program.instructions.end();
@@ -724,15 +723,14 @@ void change_impactt::output_change_impact(
724723
else
725724
UNREACHABLE;
726725

727-
output_instruction(prefix, goto_program, o_ns, function_id, o_target);
726+
output_instruction(prefix, goto_program, o_ns, o_target);
728727
}
729728
}
730729

731730
void change_impactt::output_instruction(
732731
char prefix,
733732
const goto_programt &goto_program,
734733
const namespacet &ns,
735-
const irep_idt &function_id,
736734
goto_programt::const_targett &target) const
737735
{
738736
if(compact_output)
@@ -748,7 +746,7 @@ void change_impactt::output_instruction(
748746
else
749747
{
750748
std::cout << prefix;
751-
goto_program.output_instruction(ns, function_id, std::cout, *target);
749+
target->output(std::cout);
752750
}
753751
}
754752

src/goto-diff/unified_diff.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ void unified_difft::output_diff(
130130
{
131131
case differencet::SAME:
132132
os << ' ';
133-
new_goto_program.output_instruction(ns_new, identifier, os, *d.first);
133+
d.first->output(os);
134134
break;
135135
case differencet::DELETED:
136136
os << '-';
137-
old_goto_program.output_instruction(ns_old, identifier, os, *d.first);
137+
d.first->output(os);
138138
break;
139139
case differencet::NEW:
140140
os << '+';
141-
new_goto_program.output_instruction(ns_new, identifier, os, *d.first);
141+
d.first->output(os);
142142
break;
143143
}
144144
}

0 commit comments

Comments
 (0)