Commit 1f1dcb77 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

kdevplastform/language/checks: port foreach -> range-based for

parent 31e4e528
......@@ -71,14 +71,17 @@ void clearNodeRecursively(ControlFlowNode* node, QSet<ControlFlowNode*>& deleted
void ControlFlowGraph::clear()
{
QSet<ControlFlowNode*> deleted;
foreach (ControlFlowNode* node, d->m_funcNodes)
for (ControlFlowNode* node : qAsConst(d->m_funcNodes)) {
clearNodeRecursively(node, deleted);
}
foreach (ControlFlowNode* node, d->m_nodes)
for (ControlFlowNode* node : qAsConst(d->m_nodes)) {
clearNodeRecursively(node, deleted);
}
foreach (ControlFlowNode* node, d->m_deadNodes)
for (ControlFlowNode* node : qAsConst(d->m_deadNodes)) {
clearNodeRecursively(node, deleted);
}
d->m_nodes.clear();
d->m_funcNodes.clear();
......
......@@ -51,18 +51,17 @@ QList<DataAccess*> DataAccessRepository::modifications() const { return d->m_mod
DataAccess* DataAccessRepository::accessAt(const CursorInRevision& cursor) const
{
foreach (DataAccess* a, d->m_modifications) {
if (a->pos() == cursor)
return a;
}
auto it = std::find_if(d->m_modifications.constBegin(), d->m_modifications.constEnd(), [&](DataAccess* a) {
return (a->pos() == cursor);
});
return nullptr;
return (it != d->m_modifications.constEnd()) ? *it : nullptr;
}
QList<DataAccess*> DataAccessRepository::accessesInRange(const RangeInRevision& range) const
{
QList<DataAccess*> ret;
foreach (DataAccess* a, d->m_modifications) {
for (DataAccess* a : qAsConst(d->m_modifications)) {
if (range.contains(a->pos()))
ret += a;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment