From c907589deba4d48469508e9a39a869077ec85eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 7 Dec 2008 08:47:56 +0000 Subject: [PATCH] Fixed a bug in Tokenizer::simplifyTokenList. The keyword operator is never used in a variable declaration --- tokenize.cpp | 50 +++++++++++++++++++------------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/tokenize.cpp b/tokenize.cpp index a47db7c00..16e15ec4f 100644 --- a/tokenize.cpp +++ b/tokenize.cpp @@ -846,7 +846,7 @@ void Tokenizer::simplifyTokenList() // Split up variable declarations if possible.. for (TOKEN *tok = _tokens; tok; tok = tok->next) { - if ( ! strchr("{};", tok->aaaa0()) ) + if ( ! TOKEN::Match(tok, "[{};]") ) continue; TOKEN *type0 = tok->next; @@ -858,61 +858,49 @@ void Tokenizer::simplifyTokenList() TOKEN *tok2 = NULL; unsigned int typelen = 0; - if ( TOKEN::Match(type0, "%type% %var% ,") ) - { - tok2 = _gettok(type0, 2); // The ',' token - typelen = 1; + if ( TOKEN::Match(type0, "%type% %var% ,|=") ) + { + if ( type0->next->str() != "operator" ) + { + tok2 = _gettok(type0, 2); // The ',' or '=' token + typelen = 1; + } } - else if ( TOKEN::Match(type0, "%type% * %var% ,") ) - { - tok2 = _gettok(type0, 3); // The ',' token - typelen = 1; + else if ( TOKEN::Match(type0, "%type% * %var% ,|=") ) + { + if ( type0->next->next->str() != "operator" ) + { + tok2 = _gettok(type0, 3); // The ',' token + typelen = 1; + } } - else if ( TOKEN::Match(type0, "%type% %var% [ %num% ] ,") ) + else if ( TOKEN::Match(type0, "%type% %var% [ %num% ] ,|=") ) { tok2 = _gettok(type0, 5); // The ',' token typelen = 1; } - else if ( TOKEN::Match(type0, "%type% * %var% [ %num% ] ,") ) + else if ( TOKEN::Match(type0, "%type% * %var% [ %num% ] ,|=") ) { tok2 = _gettok(type0, 6); // The ',' token typelen = 1; } - else if ( TOKEN::Match(type0, "struct %type% %var% ,") ) + else if ( TOKEN::Match(type0, "struct %type% %var% ,|=") ) { tok2 = _gettok(type0, 3); typelen = 2; } - else if ( TOKEN::Match(type0, "struct %type% * %var% ,") ) + else if ( TOKEN::Match(type0, "struct %type% * %var% ,|=") ) { tok2 = _gettok(type0, 4); typelen = 2; } - else if ( TOKEN::Match(type0, "%type% %var% =") ) - { - tok2 = _gettok(type0, 2); - typelen = 1; - } - - else if ( TOKEN::Match(type0, "%type% * %var% =") ) - { - tok2 = _gettok(type0, 3); - typelen = 1; - } - - else if ( TOKEN::Match(type0, "struct %type% * %var% =") ) - { - tok2 = _gettok(type0, 4); - typelen = 2; - } - if (tok2) { if (tok2->str() == ",")