Merge pull request #400 from Dmitry-Me/makeLoopTerminationMoreExplicit2

Make loop termination more explicit. This saves one call to tok->nextArgument()
This commit is contained in:
PKEuS 2014-08-18 12:09:39 +02:00
commit 3251aa912b
1 changed files with 4 additions and 2 deletions

View File

@ -2589,9 +2589,11 @@ void Tokenizer::setVarId()
const Token *tok3 = tok2->next(); const Token *tok3 = tok2->next();
if (!tok3->isStandardType() && tok3->str() != "void" && !Token::Match(tok3, "struct|union|class %type%") && tok3->str() != "." && !Token::Match(tok2->link()->previous(), "[&*]")) { if (!tok3->isStandardType() && tok3->str() != "void" && !Token::Match(tok3, "struct|union|class %type%") && tok3->str() != "." && !Token::Match(tok2->link()->previous(), "[&*]")) {
bool isDecl = true; bool isDecl = true;
for (; tok3 && isDecl; tok3 = tok3->nextArgument()) { for (; tok3; tok3 = tok3->nextArgument()) {
if (tok3->strAt(-1) == "&" || tok3->strAt(-1) == "*" || (notstart.find(tok3->str()) == notstart.end() && setVarIdParseDeclaration(&tok3, variableId, executableScope.top(), isCPP()))) if (tok3->strAt(-1) == "&" || tok3->strAt(-1) == "*" || (notstart.find(tok3->str()) == notstart.end() && setVarIdParseDeclaration(&tok3, variableId, executableScope.top(), isCPP()))) {
isDecl = false; isDecl = false;
break;
}
} }
if (isDecl) { if (isDecl) {
variableId[tok2->previous()->str()] = ++_varId; variableId[tok2->previous()->str()] = ++_varId;