From 0ad757fc78fb3f5dab6959ddd66c2f832b846ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 27 Nov 2018 06:43:59 +0100 Subject: [PATCH] valueFlowLifetime: Try to cleanup the loop a little. No functional change is intended. --- lib/valueflow.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 06b6ed084..6ebf7a1c0 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1168,14 +1168,8 @@ static void valueFlowTerminatingCondition(TokenList *tokenlist, SymbolDatabase* for (Condition cond:conds) { if (!cond.first) continue; - for (Token* tok = cond.first->next(); tok != scope->bodyEnd; tok = tok->next()) { - if (tok == cond.first) - continue; - const Token *tokParent = tok->astParent(); - while (tokParent && tokParent != cond.first) - tokParent = tokParent->astParent(); - if (tokParent == cond.first) - continue; + Token *const startToken = cond.first->findExpressionStartEndTokens().second->next(); + for (Token* tok = startToken; tok != scope->bodyEnd; tok = tok->next()) { if (!Token::Match(tok, "%comp%")) continue; // Skip known values