Fix Tokenizer::setVarId for pointers and two types variable declaration

This commit is contained in:
Nicolas Le Cam 2009-01-20 23:31:54 +00:00
parent acdc381ff3
commit 001a4b588e
1 changed files with 4 additions and 2 deletions

View File

@ -476,15 +476,17 @@ void Tokenizer::setVarId()
tok->varId(0); tok->varId(0);
// Set variable ids.. // Set variable ids..
bool firstMatch;
unsigned int _varId = 0; unsigned int _varId = 0;
for (Token *tok = _tokens; tok; tok = tok->next()) for (Token *tok = _tokens; tok; tok = tok->next())
{ {
if (! Token::Match(tok, "[;{}(] %type% %var%")) if ( !(firstMatch = Token::Match(tok, "[;{}(] %type% *| %var%"))
&& !Token::Match(tok, "[;{}(] %type% %type% *| %var%") )
continue; continue;
// Determine name of declared variable.. // Determine name of declared variable..
const char *varname = 0; const char *varname = 0;
Token *tok2 = tok->next(); Token *tok2 = tok->tokAt(firstMatch ? 2 : 3);
while (tok2 && ! Token::Match(tok2, "[;[=(]")) while (tok2 && ! Token::Match(tok2, "[;[=(]"))
{ {
if (tok2->isName()) if (tok2->isName())