valueFlowLifetime: Try to cleanup the loop a little. No functional change is intended.

This commit is contained in:
Daniel Marjamäki 2018-11-27 06:43:59 +01:00
parent 5a6f9ac82a
commit 0ad757fc78
1 changed files with 2 additions and 8 deletions

View File

@ -1168,14 +1168,8 @@ static void valueFlowTerminatingCondition(TokenList *tokenlist, SymbolDatabase*
for (Condition cond:conds) { for (Condition cond:conds) {
if (!cond.first) if (!cond.first)
continue; continue;
for (Token* tok = cond.first->next(); tok != scope->bodyEnd; tok = tok->next()) { Token *const startToken = cond.first->findExpressionStartEndTokens().second->next();
if (tok == cond.first) for (Token* tok = startToken; tok != scope->bodyEnd; tok = tok->next()) {
continue;
const Token *tokParent = tok->astParent();
while (tokParent && tokParent != cond.first)
tokParent = tokParent->astParent();
if (tokParent == cond.first)
continue;
if (!Token::Match(tok, "%comp%")) if (!Token::Match(tok, "%comp%"))
continue; continue;
// Skip known values // Skip known values