Fixed a bug in Tokenizer::simplifyTokenList. The keyword operator is

never used in a variable declaration
This commit is contained in:
Daniel Marjamäki 2008-12-07 08:47:56 +00:00
parent ea57f2b820
commit c907589deb
1 changed files with 19 additions and 31 deletions

View File

@ -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% ,") )
if ( TOKEN::Match(type0, "%type% %var% ,|=") )
{
tok2 = _gettok(type0, 2); // The ',' token
if ( type0->next->str() != "operator" )
{
tok2 = _gettok(type0, 2); // The ',' or '=' token
typelen = 1;
}
}
else if ( TOKEN::Match(type0, "%type% * %var% ,") )
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() == ",")