From 7a4462dac52c783b9f82b2c991120a514c074a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 8 Dec 2020 16:53:55 +0100 Subject: [PATCH] Tokenizer: Refactoring, use isFunctionHead in setVarId. It should be more reliable. --- lib/tokenize.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 009caaa1a..f3dceed02 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3845,8 +3845,16 @@ void Tokenizer::setVarIdPass2() for (Token *tok2 = tokStart->next(); tok2 && tok2 != tokStart->link(); tok2 = tok2->next()) { // skip parentheses.. if (tok2->link()) { + if (tok2->str() == "(") { + Token *funcstart = const_cast(isFunctionHead(tok2, "{")); + if (funcstart) { + setVarIdClassFunction(scopeName2 + classname, funcstart, funcstart->link(), thisClassVars, structMembers, &mVarId); + tok2 = funcstart->link(); + continue; + } + } if (tok2->str() == "{") { - if (tok2->strAt(-1) == ")" || tok2->strAt(-2) == ")") + if (tok2->strAt(-1) == ")") setVarIdClassFunction(scopeName2 + classname, tok2, tok2->link(), thisClassVars, structMembers, &mVarId); tok2 = tok2->link(); } else if (Token::Match(tok2, "( %name%|)") && !Token::Match(tok2->link(), "(|[")) {