Skip to content

Commit dbff05b

Browse files
committed
Replace iterator with const value_type& in output_instruction signature
1 parent 36ac8c9 commit dbff05b

19 files changed

+26
-63
lines changed

src/analyses/ai.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void ai_baset::output(
122122
find_state(i_it).output(out, *this, ns);
123123
out << "\n";
124124
#if 1
125-
goto_program.output_instruction(ns, identifier, out, i_it);
125+
goto_program.output_instruction(ns, identifier, out, *i_it);
126126
out << "\n";
127127
#endif
128128
}
@@ -174,7 +174,7 @@ jsont ai_baset::output_json(
174174

175175
// Ideally we need output_instruction_json
176176
std::ostringstream out;
177-
goto_program.output_instruction(ns, identifier, out, i_it);
177+
goto_program.output_instruction(ns, identifier, out, *i_it);
178178
location["instruction"]=json_stringt(out.str());
179179

180180
contents.push_back(location);
@@ -235,7 +235,7 @@ xmlt ai_baset::output_xml(
235235

236236
// Ideally we need output_instruction_xml
237237
std::ostringstream out;
238-
goto_program.output_instruction(ns, identifier, out, i_it);
238+
goto_program.output_instruction(ns, identifier, out, *i_it);
239239
location.set_attribute("instruction", out.str());
240240

241241
function_body.new_element(location);

src/analyses/local_bitvector_analysis.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ void local_bitvector_analysist::output(
349349
}
350350

351351
out << "\n";
352-
goto_function.body.output_instruction(ns, "", out, i_it);
352+
goto_function.body.output_instruction(ns, "", out, *i_it);
353353
out << "\n";
354354

355355
l++;

src/analyses/local_may_alias.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ void local_may_aliast::output(
466466
}
467467

468468
out << "\n";
469-
goto_function.body.output_instruction(ns, "", out, i_it);
469+
goto_function.body.output_instruction(ns, "", out, *i_it);
470470
out << "\n";
471471

472472
l++;

src/goto-analyzer/unreachable_instructions.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void output_dead_plain(
7171
for(dead_mapt::const_iterator it=dead_map.begin();
7272
it!=dead_map.end();
7373
++it)
74-
goto_program.output_instruction(ns, "", os, it->second);
74+
goto_program.output_instruction(ns, "", os, *it->second);
7575
}
7676

7777
static void add_to_json(
@@ -101,7 +101,7 @@ static void add_to_json(
101101
++it)
102102
{
103103
std::ostringstream oss;
104-
goto_program.output_instruction(ns, "", oss, it->second);
104+
goto_program.output_instruction(ns, "", oss, *it->second);
105105
std::string s=oss.str();
106106

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

src/goto-diff/change_impact.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ void change_impactt::output_instruction(char prefix,
732732
else
733733
{
734734
std::cout << prefix;
735-
goto_program.output_instruction(ns, function, std::cout, target);
735+
goto_program.output_instruction(ns, function, std::cout, *target);
736736
}
737737
}
738738

src/goto-diff/unified_diff.cpp

+3-15
Original file line numberDiff line numberDiff line change
@@ -132,27 +132,15 @@ void unified_difft::output_diff(
132132
{
133133
case differencet::SAME:
134134
os << ' ';
135-
new_goto_program.output_instruction(
136-
ns_new,
137-
identifier,
138-
os,
139-
d.first);
135+
new_goto_program.output_instruction(ns_new, identifier, os, *d.first);
140136
break;
141137
case differencet::DELETED:
142138
os << '-';
143-
old_goto_program.output_instruction(
144-
ns_old,
145-
identifier,
146-
os,
147-
d.first);
139+
old_goto_program.output_instruction(ns_old, identifier, os, *d.first);
148140
break;
149141
case differencet::NEW:
150142
os << '+';
151-
new_goto_program.output_instruction(
152-
ns_new,
153-
identifier,
154-
os,
155-
d.first);
143+
new_goto_program.output_instruction(ns_new, identifier, os, *d.first);
156144
break;
157145
}
158146
}

src/goto-instrument/accelerate/disjunctive_polynomial_acceleration.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ bool disjunctive_polynomial_accelerationt::accelerate(
6565
{
6666
if(loop.find(it)!=loop.end())
6767
{
68-
goto_program.output_instruction(ns, "scratch", std::cout, it);
68+
goto_program.output_instruction(ns, "scratch", std::cout, *it);
6969
}
7070
}
7171

src/goto-instrument/accelerate/enumerating_loop_acceleration.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ bool enumerating_loop_accelerationt::accelerate(
3232
it!=path.end();
3333
++it)
3434
{
35-
goto_program.output_instruction(ns, "OMG", std::cout, it->loc);
35+
goto_program.output_instruction(ns, "OMG", std::cout, *it->loc);
3636
}
3737
#endif
3838

src/goto-instrument/accelerate/path.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ void output_path(
2222
std::ostream &str)
2323
{
2424
for(const auto &step : path)
25-
program.output_instruction(ns, "path", str, step.loc);
25+
program.output_instruction(ns, "path", str, *step.loc);
2626
}

src/goto-instrument/accelerate/polynomial_accelerator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ bool polynomial_acceleratort::accelerate(
7171
it!=body.end();
7272
++it)
7373
{
74-
program.output_instruction(ns, "scratch", std::cout, it);
74+
program.output_instruction(ns, "scratch", std::cout, *it);
7575
}
7676

7777
std::cout << "Modified:\n";

src/goto-instrument/goto_instrument_parse_options.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ int goto_instrument_parse_optionst::doit()
250250

251251
forall_goto_program_instructions(i_it, goto_program)
252252
{
253-
goto_program.output_instruction(ns, "", std::cout, i_it);
253+
goto_program.output_instruction(ns, "", std::cout, *i_it);
254254
std::cout << "Is threaded: " << (is_threaded(i_it)?"True":"False")
255255
<< "\n\n";
256256
}

src/goto-instrument/unwind.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ void goto_unwindt::unwind(
328328
symbol_tablet st;
329329
namespacet ns(st);
330330
std::cout << "Instruction:\n";
331-
goto_program.output_instruction(ns, "", std::cout, i_it);
331+
goto_program.output_instruction(ns, "", std::cout, *i_it);
332332
#endif
333333

334334
if(!i_it->is_backwards_goto())

src/goto-programs/goto_inline_class.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ void goto_inlinet::expand_function_call(
444444

445445
#ifdef DEBUG
446446
std::cout << "Expanding call:\n";
447-
dest.output_instruction(ns, "", std::cout, target);
447+
dest.output_instruction(ns, "", std::cout, *target);
448448
#endif
449449

450450
exprt lhs;
@@ -815,7 +815,7 @@ void goto_inlinet::output_inline_map(
815815
bool transitive=call.second;
816816

817817
out << " Call:\n";
818-
goto_program.output_instruction(ns, "", out, target);
818+
goto_program.output_instruction(ns, "", out, *target);
819819
out << " Transitive: " << transitive << "\n";
820820
}
821821
}

src/goto-programs/goto_program.cpp

-16
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,6 @@ Author: Daniel Kroening, [email protected]
1717

1818
#include <langapi/language_util.h>
1919

20-
/// See below.
21-
/// \param ns: the namespace to resolve the expressions in
22-
/// \param identifier: the identifier used to find a symbol to identify the
23-
/// source language
24-
/// \param out: the stream to write the goto string to
25-
/// \param it: an iterator pointing to the instruction to convert
26-
/// \return See below.
27-
std::ostream &goto_programt::output_instruction(
28-
const class namespacet &ns,
29-
const irep_idt &identifier,
30-
std::ostream &out,
31-
instructionst::const_iterator it) const
32-
{
33-
return output_instruction(ns, identifier, out, *it);
34-
}
35-
3620
/// Writes to \p out a two/three line string representation of a given
3721
/// \p instruction. The output is of the format:
3822
/// ```

src/goto-programs/goto_program.h

+1-7
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,7 @@ class goto_programt:public goto_program_templatet<codet, exprt>
2828
const class namespacet &ns,
2929
const irep_idt &identifier,
3030
std::ostream &out,
31-
instructionst::const_iterator it) const;
32-
33-
std::ostream &output_instruction(
34-
const class namespacet &ns,
35-
const irep_idt &identifier,
36-
std::ostream &out,
37-
const instructiont &instruction) const;
31+
const instructiont &instruction) const override;
3832

3933
goto_programt() { }
4034

src/goto-programs/goto_program_template.h

+3-6
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ class goto_program_templatet
503503
const namespacet &ns,
504504
const irep_idt &identifier,
505505
std::ostream &out,
506-
typename instructionst::const_iterator it) const=0;
506+
const typename instructionst::value_type &it) const = 0;
507507

508508
/// Compute the target numbers
509509
void compute_target_numbers();
@@ -665,11 +665,8 @@ std::ostream &goto_program_templatet<codeT, guardT>::output(
665665
{
666666
// output program
667667

668-
for(typename instructionst::const_iterator
669-
it=instructions.begin();
670-
it!=instructions.end();
671-
++it)
672-
output_instruction(ns, identifier, out, it);
668+
for(const auto &instruction : instructions)
669+
output_instruction(ns, identifier, out, instruction);
673670

674671
return out;
675672
}

src/goto-programs/interpreter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void interpretert::show_state()
114114
ns,
115115
function->first,
116116
status(),
117-
pc);
117+
*pc);
118118

119119
status() << eom;
120120
}

src/pointer-analysis/value_set_analysis_fivr.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class value_set_analysis_fivrt:
5353
out << "**** " << it->source_location << '\n';
5454
output(it, out);
5555
out << '\n';
56-
goto_program.output_instruction(ns, "", out, it);
56+
goto_program.output_instruction(ns, "", out, *it);
5757
out << '\n';
5858
}
5959
}

src/pointer-analysis/value_set_analysis_fivrns.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class value_set_analysis_fivrnst:
5555
out << "**** " << it->source_location << '\n';
5656
output(it, out);
5757
out << '\n';
58-
goto_program.output_instruction(ns, "", out, it);
58+
goto_program.output_instruction(ns, "", out, *it);
5959
out << '\n';
6060
}
6161
}

0 commit comments

Comments
 (0)