Tokenizer::simplifyVarDecl(): join 2 conditions.
No functional change.
This commit is contained in:
parent
9983066f62
commit
8dc9528a74
|
@ -2621,29 +2621,15 @@ void Tokenizer::simplifyVarDecl()
|
||||||
if (isconst && Token::Match(tok2, "%type% %var% ="))
|
if (isconst && Token::Match(tok2, "%type% %var% ="))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Token::Match(tok2, "%type% %var% ,|="))
|
if (Token::Match(tok2, "%type% *| %var% ,|="))
|
||||||
{
|
{
|
||||||
if (tok2->next()->str() != "operator")
|
const bool isPointer = (tok2->next()->str() == "*");
|
||||||
{
|
const Token *varName = tok2->tokAt((isPointer ? 2 : 1));
|
||||||
tok2 = tok2->tokAt(2); // The ',' or '=' token
|
Token *endDeclaration = varName->next();
|
||||||
|
|
||||||
if (isstatic && tok2->str() == "=")
|
if (varName->str() != "operator")
|
||||||
{
|
{
|
||||||
if (Token::Match(tok2->next(), "%num% ,"))
|
tok2 = endDeclaration; // The ',' or '=' token
|
||||||
tok2 = tok2->tokAt(2);
|
|
||||||
else
|
|
||||||
tok2 = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
tok2 = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (Token::Match(tok2, "%type% * %var% ,|="))
|
|
||||||
{
|
|
||||||
if (tok2->tokAt(2)->str() != "operator")
|
|
||||||
{
|
|
||||||
tok2 = tok2->tokAt(3); // The ',' token
|
|
||||||
|
|
||||||
if (isstatic && tok2->str() == "=")
|
if (isstatic && tok2->str() == "=")
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue