Refactoring: Use range for loop

This commit is contained in:
Daniel Marjamäki 2018-04-24 18:17:47 +02:00
parent dbcdb19b73
commit b0b08a3bb0
1 changed files with 7 additions and 7 deletions

View File

@ -380,18 +380,18 @@ void CheckBool::pointerArithBool()
{ {
const SymbolDatabase* symbolDatabase = _tokenizer->getSymbolDatabase(); const SymbolDatabase* symbolDatabase = _tokenizer->getSymbolDatabase();
for (std::list<Scope>::const_iterator scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) { for (const Scope &scope : symbolDatabase->scopeList) {
if (scope->type != Scope::eIf && scope->type != Scope::eWhile && scope->type != Scope::eDo && scope->type != Scope::eFor) if (scope.type != Scope::eIf && scope.type != Scope::eWhile && scope.type != Scope::eDo && scope.type != Scope::eFor)
continue; continue;
const Token* tok = scope->classDef->next()->astOperand2(); const Token* tok = scope.classDef->next()->astOperand2();
if (scope->type == Scope::eFor) { if (scope.type == Scope::eFor) {
tok = Token::findsimplematch(scope->classDef->tokAt(2), ";"); tok = Token::findsimplematch(scope.classDef->tokAt(2), ";");
if (tok) if (tok)
tok = tok->astOperand2(); tok = tok->astOperand2();
if (tok) if (tok)
tok = tok->astOperand1(); tok = tok->astOperand1();
} else if (scope->type == Scope::eDo) } else if (scope.type == Scope::eDo)
tok = (scope->classEnd->tokAt(2)) ? scope->classEnd->tokAt(2)->astOperand2() : nullptr; tok = (scope.classEnd->tokAt(2)) ? scope.classEnd->tokAt(2)->astOperand2() : nullptr;
pointerArithBoolCond(tok); pointerArithBoolCond(tok);
} }