diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 7bb78b34d..110da66dd 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -693,7 +693,7 @@ void CheckBufferOverrun::stringNotZeroTerminated() // Is the buffer zero terminated after the call? bool isZeroTerminated = false; for (const Token *tok2 = tok->next()->link(); tok2 != scope->bodyEnd; tok2 = tok2->next()) { - if (!Token::Match(tok2, "] =")) + if (!Token::simpleMatch(tok2, "] =")) continue; const Token *rhs = tok2->next()->astOperand2(); if (!rhs || !rhs->hasKnownIntValue() || rhs->getKnownIntValue() != 0) diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index deecca53e..7cafe41bb 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -1060,12 +1060,12 @@ void CheckMemoryLeakNoVar::checkForUnsafeArgAlloc(const Scope *scope) const Function *func = tok2->function(); const bool isNothrow = func && (func->isAttributeNothrow() || func->isThrow()); - if (Token::Match(tok2, "shared_ptr|unique_ptr <") && tok2->next()->link() && Token::Match(tok2->next()->link(), "> ( new %name%")) { + if (Token::Match(tok2, "shared_ptr|unique_ptr <") && Token::Match(tok2->next()->link(), "> ( new %name%")) { pointerType = tok2; } else if (!isNothrow) { if (Token::Match(tok2, "%name% (")) functionCalled = tok2; - else if (tok2->isName() && tok2->next()->link() && Token::simpleMatch(tok2->next()->link(), "> (")) + else if (tok2->isName() && Token::simpleMatch(tok2->next()->link(), "> (")) functionCalled = tok2; } } diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 920b058b5..53af4fc8d 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -873,7 +873,7 @@ void CheckOther::checkVariableScope() const Variable *otherVar = otherVarToken->variable(); if (otherVar && Token::Match(otherVar->nameToken(), "%var% :") && otherVar->nameToken()->next()->astParent() && - Token::Match(otherVar->nameToken()->next()->astParent()->previous(), "for (")) + Token::simpleMatch(otherVar->nameToken()->next()->astParent()->previous(), "for (")) continue; } diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index f8cc9f681..14d9ce862 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -9022,7 +9022,7 @@ void Tokenizer::findGarbageCode() const // Assign/increment/decrement literal for (const Token *tok = tokens(); tok; tok = tok->next()) { if (Token::Match(tok, "!!) %num%|%str%|%char% %assign%|++|--")) - syntaxError(tok, tok->next()->str() + " " + tok->tokAt(2)->str()); + syntaxError(tok, tok->next()->str() + " " + tok->strAt(2)); } for (const Token *tok = tokens(); tok; tok = tok->next()) { diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 49bc3611c..a96bf4c8a 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -884,7 +884,7 @@ static Token * valueFlowSetConstantValue(const Token *tok, const Settings *setti else tok2 = tok2->tokAt(2); } - if (Token::Match(tok, "sizeof ( *")) { + if (Token::simpleMatch(tok, "sizeof ( *")) { const ValueType *vt = tok->tokAt(2)->valueType(); const size_t sz = vt ? getSizeOf(*vt, settings) : 0; if (sz > 0) {