only break when we know we are inc/dec a member variable in CheckClass::checkConstFunc
This commit is contained in:
parent
168db82fd6
commit
c27ecf5aeb
|
@ -1545,24 +1545,32 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Token *tok)
|
||||||
tok1->previous()->str() != "return")
|
tok1->previous()->str() != "return")
|
||||||
{
|
{
|
||||||
if (isMemberVar(scope, tok1->previous()))
|
if (isMemberVar(scope, tok1->previous()))
|
||||||
|
{
|
||||||
isconst = false;
|
isconst = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// var[...]++ and var[...]--
|
// var[...]++ and var[...]--
|
||||||
else if (tok1->previous()->str() == "]")
|
else if (tok1->previous()->str() == "]")
|
||||||
{
|
{
|
||||||
if (isMemberVar(scope, tok1->previous()->link()->previous()))
|
if (isMemberVar(scope, tok1->previous()->link()->previous()))
|
||||||
|
{
|
||||||
isconst = false;
|
isconst = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ++var and --var
|
// ++var and --var
|
||||||
else if (Token::Match(tok1->next(), "%var%"))
|
else if (Token::Match(tok1->next(), "%var%"))
|
||||||
{
|
{
|
||||||
if (isMemberVar(scope, tok1->next()))
|
if (isMemberVar(scope, tok1->next()))
|
||||||
|
{
|
||||||
isconst = false;
|
isconst = false;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// function call..
|
// function call..
|
||||||
else if (Token::Match(tok1, "%var% (") &&
|
else if (Token::Match(tok1, "%var% (") &&
|
||||||
|
|
Loading…
Reference in New Issue