Skip to content

Commit b0b08a3

Browse files
committed
Refactoring: Use range for loop
1 parent dbcdb19 commit b0b08a3

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

lib/checkbool.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -380,18 +380,18 @@ void CheckBool::pointerArithBool()
380380
{
381381
const SymbolDatabase* symbolDatabase = _tokenizer->getSymbolDatabase();
382382

383-
for (std::list<Scope>::const_iterator scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) {
384-
if (scope->type != Scope::eIf && scope->type != Scope::eWhile && scope->type != Scope::eDo && scope->type != Scope::eFor)
383+
for (const Scope &scope : symbolDatabase->scopeList) {
384+
if (scope.type != Scope::eIf && scope.type != Scope::eWhile && scope.type != Scope::eDo && scope.type != Scope::eFor)
385385
continue;
386-
const Token* tok = scope->classDef->next()->astOperand2();
387-
if (scope->type == Scope::eFor) {
388-
tok = Token::findsimplematch(scope->classDef->tokAt(2), ";");
386+
const Token* tok = scope.classDef->next()->astOperand2();
387+
if (scope.type == Scope::eFor) {
388+
tok = Token::findsimplematch(scope.classDef->tokAt(2), ";");
389389
if (tok)
390390
tok = tok->astOperand2();
391391
if (tok)
392392
tok = tok->astOperand1();
393-
} else if (scope->type == Scope::eDo)
394-
tok = (scope->classEnd->tokAt(2)) ? scope->classEnd->tokAt(2)->astOperand2() : nullptr;
393+
} else if (scope.type == Scope::eDo)
394+
tok = (scope.classEnd->tokAt(2)) ? scope.classEnd->tokAt(2)->astOperand2() : nullptr;
395395

396396
pointerArithBoolCond(tok);
397397
}

0 commit comments

Comments
 (0)