there is no need to have "if(tok && Token::Match(tok,..." since Token::Match checks "tok" by itselfs already.

This commit is contained in:
Matthias Krüger 2016-11-26 17:08:36 +01:00
parent 59bbe6cd42
commit b3ace258ab
5 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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% ."))

View File

@ -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);
}

View File

@ -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;