Skip to content

Commit 81dc8d5

Browse files
Update valueflow.cpp
1 parent a294079 commit 81dc8d5

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

‎lib/valueflow.cpp‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -696,19 +696,6 @@ static bool isNonZero(const Token* tok)
696696
return tok && (!tok->hasKnownIntValue() || tok->getKnownIntValue() != 0);
697697
}
698698

699-
static const Token* getOtherOperand(const Token* tok)
700-
{
701-
if (!tok)
702-
return nullptr;
703-
if (!tok->astParent())
704-
return nullptr;
705-
if (tok->astParent()->astOperand1() != tok)
706-
return tok->astParent()->astOperand1();
707-
if (tok->astParent()->astOperand2() != tok)
708-
return tok->astParent()->astOperand2();
709-
return nullptr;
710-
}
711-
712699
static void valueFlowArrayBool(TokenList& tokenlist, const Settings& settings)
713700
{
714701
for (Token* tok = tokenlist.front(); tok; tok = tok->next()) {
@@ -729,7 +716,7 @@ static void valueFlowArrayBool(TokenList& tokenlist, const Settings& settings)
729716
continue;
730717
if (!var->isArray() || var->isArgument() || var->isStlType())
731718
continue;
732-
if (isNonZero(getOtherOperand(tok)) && Token::Match(tok->astParent(), "%comp%"))
719+
if (isNonZero(tok->astSibling()) && Token::Match(tok->astParent(), "%comp%"))
733720
continue;
734721
// TODO: Check for function argument
735722
if ((astIsBool(tok->astParent()) && !Token::Match(tok->astParent(), "(|%name%")) ||

0 commit comments

Comments
 (0)