Break loop early

This commit is contained in:
Dmitry-Me 2017-08-24 18:10:33 +03:00
parent d160d27417
commit 2582bbd0f6
1 changed files with 3 additions and 1 deletions

View File

@ -979,8 +979,10 @@ void CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(const Scope* const
{
const Token *parent = tok->astParent();
while (parent) {
if (Token::simpleMatch(parent->previous(), "while ("))
if (Token::simpleMatch(parent->previous(), "while (")) {
inwhile = true;
break;
}
parent = parent->astParent();
}
}