Merge pull request #366 from Dmitry-Me/useTempVariableToOmitRecomputation

Use temp variable to omit recomputing the same value.
This commit is contained in:
Daniel Marjamäki 2014-07-17 10:27:47 +02:00
commit 425e7527bb
1 changed files with 2 additions and 1 deletions

View File

@ -108,7 +108,8 @@ static bool variableIsUsedInScope(const Token* start, unsigned int varId, const
for (const Token *tok = start; tok && tok != scope->classEnd; tok = tok->next()) {
if (tok->varId() == varId)
return true;
if (tok->scope()->type == Scope::eFor || tok->scope()->type == Scope::eDo || tok->scope()->type == Scope::eWhile) // In case of loops, better checking would be necessary
const Scope::ScopeType scopeType = tok->scope()->type;
if (scopeType == Scope::eFor || scopeType == Scope::eDo || scopeType == Scope::eWhile) // In case of loops, better checking would be necessary
return true;
if (Token::simpleMatch(tok, "asm ("))
return true;