Refactoring: Use continue in loop

This commit is contained in:
Daniel Marjamäki 2017-07-26 20:32:14 +02:00
parent 2d4f64027a
commit 32940c023a
1 changed files with 45 additions and 45 deletions

View File

@ -1409,7 +1409,8 @@ void CheckStl::checkDereferenceInvalidIterator()
// be an iterator that is dereferenced before being checked for validity. // be an iterator that is dereferenced before being checked for validity.
const std::list<Scope>& scopeList = _tokenizer->getSymbolDatabase()->scopeList; const std::list<Scope>& scopeList = _tokenizer->getSymbolDatabase()->scopeList;
for (std::list<Scope>::const_iterator i = scopeList.begin(); i != scopeList.end(); ++i) { for (std::list<Scope>::const_iterator i = scopeList.begin(); i != scopeList.end(); ++i) {
if (i->type == Scope::eIf || i->type == Scope::eDo || i->type == Scope::eWhile || i->type == Scope::eFor) { if (!(i->type == Scope::eIf || i->type == Scope::eDo || i->type == Scope::eWhile || i->type == Scope::eFor))
continue;
const Token* const tok = i->classDef; const Token* const tok = i->classDef;
const Token* startOfCondition = tok->next(); const Token* startOfCondition = tok->next();
@ -1459,7 +1460,6 @@ void CheckStl::checkDereferenceInvalidIterator()
if (dereferenceTok) if (dereferenceTok)
dereferenceInvalidIteratorError(dereferenceTok, dereferenceTok->strAt(1)); dereferenceInvalidIteratorError(dereferenceTok, dereferenceTok->strAt(1));
} }
}
} }
void CheckStl::dereferenceInvalidIteratorError(const Token* deref, const std::string &iterName) void CheckStl::dereferenceInvalidIteratorError(const Token* deref, const std::string &iterName)