From 0076ebe08d8efc96556bdf40ff0eb3f62e0444c7 Mon Sep 17 00:00:00 2001 From: Frank Zingsheim Date: Sun, 12 May 2013 11:19:10 +0200 Subject: [PATCH] More general fix to #4187 (False positive: Variable inside a lambda is reported as uninitialized) Travis: Problems with matchcompiler.py --- lib/tokenize.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index ca97cc792..74112289c 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5007,8 +5007,10 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, Token * tokEnd, bool only_k_r_ if (isCPP() && Token::Match(tok2, "[(,] [")) { // lambda function at tok2->next() // find start of lambda body - Token * lambdaBody = Token::findsimplematch(tok2, "{", tok->link()); - if (lambdaBody && lambdaBody->link()) + Token * lambdaBody = tok2; + while (lambdaBody && lambdaBody != tok2->link() && lambdaBody->str() != "{") + lambdaBody = lambdaBody->next(); + if (lambdaBody && lambdaBody != tok2->link() && lambdaBody->link()) simplifyVarDecl(lambdaBody, lambdaBody->link(), only_k_r_fpar); } }