Refactoring; Use range for loops

This commit is contained in:
Daniel Marjamäki 2018-08-10 10:04:10 +02:00
parent b707f6e476
commit 8032f64c15
1 changed files with 11 additions and 11 deletions

View File

@ -839,9 +839,9 @@ public:
const ValueFlow::Value * getValue(const MathLib::bigint val) const { const ValueFlow::Value * getValue(const MathLib::bigint val) const {
if (!mValues) if (!mValues)
return nullptr; return nullptr;
for (std::list<ValueFlow::Value>::const_iterator it = mValues->begin(); it != mValues->end(); ++it) { for (const ValueFlow::Value &value : *mValues) {
if (it->isIntValue() && it->intvalue == val) if (value.isIntValue() && value.intvalue == val)
return &(*it); return &value;
} }
return nullptr; return nullptr;
} }
@ -850,12 +850,12 @@ public:
if (!mValues) if (!mValues)
return nullptr; return nullptr;
const ValueFlow::Value *ret = nullptr; const ValueFlow::Value *ret = nullptr;
for (std::list<ValueFlow::Value>::const_iterator it = mValues->begin(); it != mValues->end(); ++it) { for (const ValueFlow::Value &value : *mValues) {
if (!it->isIntValue()) if (!value.isIntValue())
continue; continue;
if ((!ret || it->intvalue > ret->intvalue) && if ((!ret || value.intvalue > ret->intvalue) &&
((it->condition != nullptr) == condition)) ((value.condition != nullptr) == condition))
ret = &(*it); ret = &value;
} }
return ret; return ret;
} }
@ -863,9 +863,9 @@ public:
const ValueFlow::Value * getMovedValue() const { const ValueFlow::Value * getMovedValue() const {
if (!mValues) if (!mValues)
return nullptr; return nullptr;
for (std::list<ValueFlow::Value>::const_iterator it = mValues->begin(); it != mValues->end(); ++it) { for (const ValueFlow::Value &value : *mValues) {
if (it->isMovedValue() && it->moveKind != ValueFlow::Value::NonMovedVariable) if (value.isMovedValue() && value.moveKind != ValueFlow::Value::NonMovedVariable)
return &(*it); return &value;
} }
return nullptr; return nullptr;
} }