diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index c7843414f..3d4cc39a4 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3512,7 +3512,7 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::map %name% )")) { if (Token::Match(tok2->linkAt(2)->previous(), "if|for|while (")) return false; - if (!Token::Match(tok2->linkAt(2)->previous(), "%name% (")) + if (!Token::Match(tok2->linkAt(2)->previous(), "%name%|] (")) return false; } } else if (Token::Match(tok2, "&|&&")) { @@ -5232,6 +5232,14 @@ bool Tokenizer::simplifyTokenList1(const char FileName[]) // Link < with > createLinks2(); + if (mTimerResults) { + Timer t("Tokenizer::tokenize::setVarId (2)", mSettings->showtime, mTimerResults); + setVarId(); + } + else { + setVarId(); + } + // Mark C++ casts for (Token *tok = list.front(); tok; tok = tok->next()) { if (Token::Match(tok, "const_cast|dynamic_cast|reinterpret_cast|static_cast <") && Token::simpleMatch(tok->linkAt(1), "> (")) { diff --git a/test/testvarid.cpp b/test/testvarid.cpp index e5751557a..fd18373ff 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -2636,7 +2636,7 @@ private: { const char code[] = "auto g = [](std::function p) {};\n"; const char exp[] = "1: auto g@1 ; g@1 = [ ] ( std :: function < void ( ) > p@2 ) { } ;\n"; - TODO_ASSERT_EQUALS(exp, "1: auto g@1 ; g@1 = [ ] ( std :: function < void ( ) > p ) { } ;\n", tokenize(code)); + ASSERT_EQUALS(exp, tokenize(code)); } }