Skip to content

Commit 987edbe

Browse files
author
Owen Jones
committed
Use range-based for loops
1 parent 92ac82c commit 987edbe

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/goto-instrument/code_contracts.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,8 @@ void code_contractst::operator()()
388388
goto_functions.function_map.find(CPROVER_PREFIX "initialize");
389389
assert(i_it!=goto_functions.function_map.end());
390390

391-
for(std::unordered_set<irep_idt>::const_iterator it = summarized.begin();
392-
it != summarized.end();
393-
++it)
394-
add_contract_check(*it, i_it->second.body);
391+
for(const auto &contract : summarized)
392+
add_contract_check(contract, i_it->second.body);
395393

396394
// remove skips
397395
remove_skip(i_it->second.body);

src/linking/linking.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -1195,20 +1195,18 @@ void linkingt::do_type_dependencies(
11951195

11961196
while(!queue.empty())
11971197
{
1198-
irep_idt id=queue.top();
1198+
irep_idt id = queue.top();
11991199
queue.pop();
12001200

12011201
const std::unordered_set<irep_idt> &u = used_by[id];
12021202

1203-
for(std::unordered_set<irep_idt>::const_iterator d_it = u.begin();
1204-
d_it != u.end();
1205-
d_it++)
1206-
if(needs_to_be_renamed.insert(*d_it).second)
1203+
for(const auto &dep : u)
1204+
if(needs_to_be_renamed.insert(dep).second)
12071205
{
1208-
queue.push(*d_it);
1206+
queue.push(dep);
12091207
#ifdef DEBUG
12101208
debug() << "LINKING: needs to be renamed (dependency): "
1211-
<< *d_it << eom;
1209+
<< dep << eom;
12121210
#endif
12131211
}
12141212
}

0 commit comments

Comments
 (0)