Skip to content

Commit 22f775c

Browse files
author
martin
committed
s/const auto/const auto &/ in loops
This was inefficient but now causes build failures on OS X as it uses -Werror -Wrange-loop-analysis
1 parent 41606b0 commit 22f775c

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/analyses/variable-sensitivity/abstract_enviroment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ abstract_environmentt::modified_symbols(
474474
first.map.get_view(view);
475475
for(const auto &entry : view)
476476
{
477-
const auto second_entry = second.map.find(entry.first);
477+
const auto &second_entry = second.map.find(entry.first);
478478
if(second_entry.has_value())
479479
{
480480
if(second_entry.value().get()->has_been_modified(entry.second))

src/analyses/variable-sensitivity/data_dependency_context.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ std::set<goto_programt::const_targett>
318318
data_dependency_contextt::get_data_dependencies() const
319319
{
320320
std::set<goto_programt::const_targett> result;
321-
for(const auto d : data_deps)
321+
for(const auto &d : data_deps)
322322
result.insert(d);
323323
return result;
324324
}
@@ -332,7 +332,7 @@ std::set<goto_programt::const_targett>
332332
data_dependency_contextt::get_data_dominators() const
333333
{
334334
std::set<goto_programt::const_targett> result;
335-
for(const auto d : data_dominators)
335+
for(const auto &d : data_dominators)
336336
result.insert(d);
337337
return result;
338338
}

src/analyses/variable-sensitivity/full_struct_abstract_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ void full_struct_abstract_objectt::output(
213213
bool first = true;
214214

215215
out << "{";
216-
for(const auto field : type_decl.components())
216+
for(const auto &field : type_decl.components())
217217
{
218218
auto value = map.find(field.get_name());
219219
if(value.has_value())

src/analyses/variable-sensitivity/variable_sensitivity_dependence_graph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void variable_sensitivity_dependence_domaint::eval_data_deps(
3434
{
3535
// If the expression was able to be eval'ed to something with data
3636
// dependencies, then that's all we need to gather.
37-
for(const auto dep : res->get_data_dependencies())
37+
for(const auto &dep : res->get_data_dependencies())
3838
deps[dep].insert(expr);
3939
}
4040
else
@@ -188,7 +188,7 @@ void variable_sensitivity_dependence_domaint::data_dependencies(
188188
{
189189
const code_function_callt &call = to_code_function_call(to->code);
190190
const code_function_callt::argumentst &args = call.arguments();
191-
for(const auto arg : args)
191+
for(const auto &arg : args)
192192
{
193193
eval_data_deps(arg, ns, domain_data_deps);
194194
}

0 commit comments

Comments
 (0)