ValueFlow: restricted bailouts in for loops

This commit is contained in:
Daniel Marjamäki 2014-03-21 08:48:49 +01:00
parent fc014f055f
commit 045e9e692b
1 changed files with 3 additions and 2 deletions

View File

@ -787,9 +787,10 @@ static void valueFlowForLoopSimplify(Token * const bodyStart, const unsigned int
setTokenValue(tok2, value1); setTokenValue(tok2, value1);
} }
if (tok2->str() == "{") { else if (Token::Match(tok2, ") {") && Token::findmatch(tok2->link(), "%varid%", tok2, varid)) {
const Token *start = tok2->link();
if (settings->debugwarnings) if (settings->debugwarnings)
bailout(tokenlist, errorLogger, tok2, "For loop variable " + tok2->str() + " stopping on {"); bailout(tokenlist, errorLogger, tok2, "For loop variable stopping on {");
break; break;
} }
} }