From 8d5863133c0cc4ad1bdf7981caf43cd803743e14 Mon Sep 17 00:00:00 2001 From: Raphael Geissert Date: Wed, 2 Feb 2011 09:48:00 -0600 Subject: [PATCH] Use Token::simpleMatch where no patterns are used --- lib/checkautovariables.cpp | 2 +- lib/checkbufferoverrun.cpp | 2 +- lib/checkclass.cpp | 2 +- lib/checkmemoryleak.cpp | 2 +- lib/checknullpointer.cpp | 2 +- lib/checkother.cpp | 2 +- lib/checkstl.cpp | 2 +- lib/executionpath.cpp | 2 +- lib/preprocessor.cpp | 2 +- lib/tokenize.cpp | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/checkautovariables.cpp b/lib/checkautovariables.cpp index 414ae527e..f33a9a8ae 100644 --- a/lib/checkautovariables.cpp +++ b/lib/checkautovariables.cpp @@ -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); diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index b2affa275..d4340048c 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -766,7 +766,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector(varname.empty() ? 0U : (varname.size() - 1) * 2U)); - if (Token::Match(tok, "return")) + if (Token::simpleMatch(tok, "return")) { tok = tok->next(); if (!tok) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 2067142f9..8f71226ad 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -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); } } diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 0ffab12c7..f539e431c 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -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)) diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index bd36a4e37..df8c49495 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -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"? diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 1b41bb1cd..bf96eedf7 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -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() != "}") diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index 87044e4d2..6ae97742b 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -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); } diff --git a/lib/executionpath.cpp b/lib/executionpath.cpp index fad18cc58..7e8b6c4c7 100644 --- a/lib/executionpath.cpp +++ b/lib/executionpath.cpp @@ -348,7 +348,7 @@ void ExecutionPath::checkScope(const Token *tok, std::list &che } } - if (Token::Match(tok, "= {")) + if (Token::simpleMatch(tok, "= {")) { // GCC struct initialization.. bail out if (Token::Match(tok->tokAt(2), ". %var% =")) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 4cdd5f729..5aa45a0ee 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -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 += " "; } } diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index aa3707c8e..210fe3702 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -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%") &&