Use Token::simpleMatch where no patterns are used
This commit is contained in:
parent
cf2b6f7bc1
commit
8d5863133c
|
@ -448,7 +448,7 @@ void CheckAutoVariables::returncstr()
|
|||
}
|
||||
|
||||
// have we reached a function that returns a reference?
|
||||
if (Token::Match(tok, "const char *"))
|
||||
if (Token::simpleMatch(tok, "const char *"))
|
||||
{
|
||||
// go to the '('
|
||||
const Token *tok2 = tok->tokAt(3);
|
||||
|
|
|
@ -766,7 +766,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::str
|
|||
|
||||
const unsigned char varc(static_cast<unsigned char>(varname.empty() ? 0U : (varname.size() - 1) * 2U));
|
||||
|
||||
if (Token::Match(tok, "return"))
|
||||
if (Token::simpleMatch(tok, "return"))
|
||||
{
|
||||
tok = tok->next();
|
||||
if (!tok)
|
||||
|
|
|
@ -931,7 +931,7 @@ void CheckClass::checkReturnPtrThis(const Scope *scope, const Function *func, co
|
|||
// check of *this is returned
|
||||
else if (!(Token::Match(tok->tokAt(1), "(| * this ;|=") ||
|
||||
Token::Match(tok->tokAt(1), "(| * this +=") ||
|
||||
Token::Match(tok->tokAt(1), "operator= (")))
|
||||
Token::simpleMatch(tok->tokAt(1), "operator= (")))
|
||||
operatorEqRetRefThisError(func->token);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getDeallocationType(const Token *tok
|
|||
return gMalloc;
|
||||
|
||||
if (Token::Match(tok, "fclose ( %varid% )", varid) ||
|
||||
Token::Match(tok, "fcloseall ( )"))
|
||||
Token::simpleMatch(tok, "fcloseall ( )"))
|
||||
return File;
|
||||
|
||||
if (Token::Match(tok, "close ( %varid% )", varid))
|
||||
|
|
|
@ -544,7 +544,7 @@ void CheckNullPointer::nullPointerByCheckAndDeRef()
|
|||
if (Token::Match(tok, "* %var% [;,)=]"))
|
||||
pointerVariables.insert(tok->next()->varId());
|
||||
|
||||
else if (Token::Match(tok, "if ("))
|
||||
else if (Token::simpleMatch(tok, "if ("))
|
||||
{
|
||||
// TODO: investigate false negatives:
|
||||
// - handle "while"?
|
||||
|
|
|
@ -1491,7 +1491,7 @@ void CheckOther::functionVariableUsage()
|
|||
variables.read(nametok->tokAt(2)->varId());
|
||||
|
||||
// look at initializers
|
||||
if (Token::Match(nametok->tokAt(4), "= {"))
|
||||
if (Token::simpleMatch(nametok->tokAt(4), "= {"))
|
||||
{
|
||||
tok = nametok->tokAt(6);
|
||||
while (tok->str() != "}")
|
||||
|
|
|
@ -572,7 +572,7 @@ void CheckStl::pushback()
|
|||
}
|
||||
|
||||
// Using push_back or push_front inside a loop..
|
||||
if (Token::Match(tok2, "for ("))
|
||||
if (Token::simpleMatch(tok2, "for ("))
|
||||
{
|
||||
tok2 = tok2->tokAt(2);
|
||||
}
|
||||
|
|
|
@ -348,7 +348,7 @@ void ExecutionPath::checkScope(const Token *tok, std::list<ExecutionPath *> &che
|
|||
}
|
||||
}
|
||||
|
||||
if (Token::Match(tok, "= {"))
|
||||
if (Token::simpleMatch(tok, "= {"))
|
||||
{
|
||||
// GCC struct initialization.. bail out
|
||||
if (Token::Match(tok->tokAt(2), ". %var% ="))
|
||||
|
|
|
@ -2142,7 +2142,7 @@ public:
|
|||
if (Token::Match(tok, "%var% %var%") ||
|
||||
Token::Match(tok, "%var% %num%") ||
|
||||
Token::Match(tok, "%num% %var%") ||
|
||||
Token::Match(tok, "> >"))
|
||||
Token::simpleMatch(tok, "> >"))
|
||||
macrocode += " ";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -552,7 +552,7 @@ bool Tokenizer::duplicateTypedef(Token **tokPtr, const Token *name)
|
|||
|
||||
if (end)
|
||||
{
|
||||
if (Token::Match(end, ") {")) // function parameter ?
|
||||
if (Token::simpleMatch(end, ") {")) // function parameter ?
|
||||
{
|
||||
// look backwards
|
||||
if (Token::Match(tok->previous(), "%type%") &&
|
||||
|
|
Loading…
Reference in New Issue