Skip to content

Commit 388815c

Browse files
Avoid unnecessary copies in c_input_test_generator.cpp
Without the & here we are copying the items we iterate over, which is unnecessary in these cases.
1 parent 13e31f5 commit 388815c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cbmc/c_test_input_generator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void c_test_input_generatort::operator()(const goto_trace_storaget &traces)
137137
{
138138
case ui_message_handlert::uit::PLAIN:
139139
log.result() << "\nTest suite:\n";
140-
for(const auto trace : traces.all())
140+
for(const auto &trace : traces.all())
141141
{
142142
test_inputst test_inputs = (*this)(trace, ns);
143143
test_inputs.output_plain_text(log.result(), ns, trace);
@@ -153,15 +153,15 @@ void c_test_input_generatort::operator()(const goto_trace_storaget &traces)
153153
json_stream_arrayt &tests_array =
154154
json_result.push_back_stream_array("tests");
155155

156-
for(const auto trace : traces.all())
156+
for(const auto &trace : traces.all())
157157
{
158158
test_inputst test_inputs = (*this)(trace, ns);
159159
tests_array.push_back(test_inputs.to_json(ns, trace, print_trace));
160160
}
161161
break;
162162
}
163163
case ui_message_handlert::uit::XML_UI:
164-
for(const auto trace : traces.all())
164+
for(const auto &trace : traces.all())
165165
{
166166
test_inputst test_inputs = (*this)(trace, ns);
167167
log.result() << test_inputs.to_xml(ns, trace, print_trace);

0 commit comments

Comments
 (0)