Merge pull request #369 from Dmitry-Me/useBoolFlagToAvoidComparisonDuplication
Use boolean flag to avoid comparison duplication
This commit is contained in:
commit
c252885bf8
|
@ -1590,13 +1590,16 @@ void CheckClass::checkConst()
|
||||||
} else if (Token::Match(previous->previous(), "*|& >")) {
|
} else if (Token::Match(previous->previous(), "*|& >")) {
|
||||||
const Token *temp = previous;
|
const Token *temp = previous;
|
||||||
|
|
||||||
|
bool foundConst = false;
|
||||||
while (!Token::Match(temp->previous(), ";|}|{|public:|protected:|private:")) {
|
while (!Token::Match(temp->previous(), ";|}|{|public:|protected:|private:")) {
|
||||||
temp = temp->previous();
|
temp = temp->previous();
|
||||||
if (temp->str() == "const")
|
if (temp->str() == "const") {
|
||||||
|
foundConst = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (temp->str() != "const")
|
if (!foundConst)
|
||||||
continue;
|
continue;
|
||||||
} else if (func->isOperator && Token::Match(previous, ";|{|}|public:|private:|protected:")) { // Operator without return type: conversion operator
|
} else if (func->isOperator && Token::Match(previous, ";|{|}|public:|private:|protected:")) { // Operator without return type: conversion operator
|
||||||
const std::string& opName = func->tokenDef->str();
|
const std::string& opName = func->tokenDef->str();
|
||||||
|
|
Loading…
Reference in New Issue