Tokenizer: Optimised loop

This commit is contained in:
Daniel Marjamäki 2013-10-06 07:46:35 +02:00
parent 33e69df6ae
commit 9cfc1030cd
1 changed files with 11 additions and 9 deletions

View File

@ -5114,15 +5114,17 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, Token * tokEnd, bool only_k_r_
} else
continue;
} else if (tok->str() == "(") {
for (Token * tok2 = tok; tok2 != tok->link(); tok2 = tok2->next()) {
if (isCPP() && Token::Match(tok2, "[(,] [")) {
// lambda function at tok2->next()
// find start of lambda body
Token * lambdaBody = tok2;
while (lambdaBody && lambdaBody != tok2->link() && lambdaBody->str() != "{")
lambdaBody = lambdaBody->next();
if (lambdaBody && lambdaBody != tok2->link() && lambdaBody->link())
simplifyVarDecl(lambdaBody, lambdaBody->link()->next(), only_k_r_fpar);
if (isCPP()) {
for (Token * tok2 = tok; tok2 != tok->link(); tok2 = tok2->next()) {
if (Token::Match(tok2, "[(,] [")) {
// lambda function at tok2->next()
// find start of lambda body
Token * lambdaBody = tok2;
while (lambdaBody && lambdaBody != tok2->link() && lambdaBody->str() != "{")
lambdaBody = lambdaBody->next();
if (lambdaBody && lambdaBody != tok2->link() && lambdaBody->link())
simplifyVarDecl(lambdaBody, lambdaBody->link()->next(), only_k_r_fpar);
}
}
}
tok = tok->link();