diff --git a/src/checkclass.cpp b/src/checkclass.cpp index e666c60c5..c8757ec33 100644 --- a/src/checkclass.cpp +++ b/src/checkclass.cpp @@ -713,7 +713,7 @@ void CheckClass::virtualDestructor() base = Token::findmatch(base->next(), (std::string("%any% ~ ") + baseName[0] + " (").c_str()); const Token *reverseTok = base; - while (Token::Match(base, "%var%") && !Token::Match(base, "virtual")) + while (Token::Match(base, "%var%") && base->str() != "virtual") base = base->previous(); // Check that there is a destructor.. diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 57101e354..a96b9bf8f 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -946,8 +946,7 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::listtokAt(tokIdx), ".") && - Token::Match(tok->tokAt(tokIdx + 1), "%var%")) + while (Token::Match(tok->tokAt(tokIdx), ". %var%")) tokIdx += 2; if (Token::simpleMatch(tok->tokAt(tokIdx), ") (")) diff --git a/src/checkother.cpp b/src/checkother.cpp index ba1fb2722..69cfe6b19 100644 --- a/src/checkother.cpp +++ b/src/checkother.cpp @@ -158,8 +158,7 @@ void CheckOther::warningRedundantCode() } } - if (Token::simpleMatch(tok2, "this .") || - Token::Match(tok2, "%var% ::")) + if (Token::Match(tok2, "%var% ::|.")) { tok2 = tok2->tokAt(2); } @@ -1056,7 +1055,7 @@ void CheckOther::nullPointer() // Reassignment of the struct else if (tok2->varId() == varid1) { - if (Token::Match(tok2->next(), "=")) + if (tok2->next()->str() == "=") break; if (Token::Match(tok2->tokAt(-2), "[,(] &")) break;