Refactoring; use range for loops
This commit is contained in:
parent
f7db818273
commit
c3cb0ddf8c
|
@ -2446,15 +2446,14 @@ void CheckClass::checkUnsafeClassDivZero(bool test)
|
||||||
for (const Scope * classScope : symbolDatabase->classAndStructScopes) {
|
for (const Scope * classScope : symbolDatabase->classAndStructScopes) {
|
||||||
if (!test && classScope->classDef->fileIndex() != 1)
|
if (!test && classScope->classDef->fileIndex() != 1)
|
||||||
continue;
|
continue;
|
||||||
std::list<Function>::const_iterator func;
|
for (const Function &func : classScope->functionList) {
|
||||||
for (func = classScope->functionList.begin(); func != classScope->functionList.end(); ++func) {
|
if (func.access != AccessControl::Public)
|
||||||
if (func->access != AccessControl::Public)
|
|
||||||
continue;
|
continue;
|
||||||
if (!func->hasBody())
|
if (!func.hasBody())
|
||||||
continue;
|
continue;
|
||||||
if (func->name().compare(0,8,"operator")==0)
|
if (func.name().compare(0,8,"operator")==0)
|
||||||
continue;
|
continue;
|
||||||
for (const Token *tok = func->functionScope->classStart; tok; tok = tok->next()) {
|
for (const Token *tok = func.functionScope->classStart; tok; tok = tok->next()) {
|
||||||
if (Token::Match(tok, "if|switch|while|for|do|}"))
|
if (Token::Match(tok, "if|switch|while|for|do|}"))
|
||||||
break;
|
break;
|
||||||
if (tok->str() != "/")
|
if (tok->str() != "/")
|
||||||
|
@ -2466,7 +2465,7 @@ void CheckClass::checkUnsafeClassDivZero(bool test)
|
||||||
const Variable *var = tok->astOperand2()->variable();
|
const Variable *var = tok->astOperand2()->variable();
|
||||||
if (!var || !var->isArgument())
|
if (!var || !var->isArgument())
|
||||||
continue;
|
continue;
|
||||||
unsafeClassDivZeroError(tok, classScope->className, func->name(), var->name());
|
unsafeClassDivZeroError(tok, classScope->className, func.name(), var->name());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue