there is no need to have "if(tok && Token::Match(tok,..." since Token::Match checks "tok" by itselfs already.
This commit is contained in:
parent
59bbe6cd42
commit
b3ace258ab
|
@ -1723,7 +1723,7 @@ bool CheckIO::ArgumentInfo::isArrayOrPointer() const
|
|||
return variableInfo->isArrayOrPointer();
|
||||
} else {
|
||||
const Token *tok = typeToken;
|
||||
while (tok && Token::Match(tok, "const|struct"))
|
||||
while (Token::Match(tok, "const|struct"))
|
||||
tok = tok->next();
|
||||
if (tok && tok->strAt(1) == "*")
|
||||
return true;
|
||||
|
|
|
@ -985,7 +985,7 @@ bool CheckUninitVar::isVariableUsage(const Token *vartok, bool pointer, Alloc al
|
|||
if (_tokenizer->isCPP() && Token::Match(vartok->next(), "<<|>>")) {
|
||||
// Is this calculation done in rhs?
|
||||
const Token *tok = vartok;
|
||||
while (tok && Token::Match(tok, "%name%|.|::"))
|
||||
while (Token::Match(tok, "%name%|.|::"))
|
||||
tok = tok->previous();
|
||||
if (Token::Match(tok, "[;{}]"))
|
||||
return false;
|
||||
|
|
|
@ -449,7 +449,7 @@ static const Token* doAssignment(Variables &variables, const Token *tok, bool de
|
|||
tok = tok->next();
|
||||
|
||||
if (Token::Match(tok, "(| &| %name%") ||
|
||||
(tok && Token::Match(tok->next(), "< const| struct|union| %type% *| > ( &| %name%"))) {
|
||||
(Token::Match(tok->next(), "< const| struct|union| %type% *| > ( &| %name%"))) {
|
||||
bool addressOf = false;
|
||||
|
||||
if (Token::Match(tok, "%var% ."))
|
||||
|
|
|
@ -240,7 +240,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
|||
tok = tok->tokAt(3);
|
||||
|
||||
// skip over qualification
|
||||
while (tok && Token::Match(tok, "%type% ::"))
|
||||
while (Token::Match(tok, "%type% ::"))
|
||||
tok = tok->tokAt(2);
|
||||
}
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
|
|||
}
|
||||
|
||||
// Skip '=', '?', ':'
|
||||
if (tok && Token::Match(tok, "=|?|:"))
|
||||
if (Token::Match(tok, "=|?|:"))
|
||||
tok = tok->next();
|
||||
if (!tok)
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue