@@ -691,57 +691,6 @@ static void valueFlowArray(TokenList& tokenlist, const Settings& settings)
691691 }
692692}
693693
694- static bool isNonZero (const Token* tok)
695- {
696- return tok && (!tok->hasKnownIntValue () || tok->getKnownIntValue () != 0 );
697- }
698-
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-
712- static void valueFlowArrayBool (TokenList& tokenlist, const Settings& settings)
713- {
714- for (Token* tok = tokenlist.front (); tok; tok = tok->next ()) {
715- if (tok->hasKnownIntValue ())
716- continue ;
717- const Variable* var = nullptr ;
718- bool known = false ;
719- const auto val =
720- std::find_if (tok->values ().cbegin (), tok->values ().cend (), std::mem_fn (&ValueFlow::Value::isTokValue));
721- if (val == tok->values ().end ()) {
722- var = tok->variable ();
723- known = true ;
724- } else {
725- var = val->tokvalue ->variable ();
726- known = val->isKnown ();
727- }
728- if (!var)
729- continue ;
730- if (!var->isArray () || var->isArgument () || var->getTypeName () == " std::array" )
731- continue ;
732- if (isNonZero (getOtherOperand (tok)) && Token::Match (tok->astParent (), " %comp%" ))
733- continue ;
734- // TODO: Check for function argument
735- if ((astIsBool (tok->astParent ()) && !Token::Match (tok->astParent (), " (|%name%" )) ||
736- (tok->astParent () && Token::Match (tok->astParent ()->previous (), " if|while|for (" ))) {
737- ValueFlow::Value value{1 };
738- if (known)
739- value.setKnown ();
740- setTokenValue (tok, std::move (value), settings);
741- }
742- }
743- }
744-
745694static void valueFlowArrayElement (TokenList& tokenlist, const Settings& settings)
746695{
747696 for (Token* tok = tokenlist.front (); tok; tok = tok->next ()) {
@@ -7540,7 +7489,6 @@ void ValueFlow::setValues(TokenList& tokenlist,
75407489 VFA (valueFlowSymbolicOperators (symboldatabase, settings)),
75417490 VFA (valueFlowCondition (SymbolicConditionHandler{}, tokenlist, symboldatabase, errorLogger, settings, skippedFunctions)),
75427491 VFA (valueFlowSymbolicInfer (symboldatabase, settings)),
7543- VFA (valueFlowArrayBool (tokenlist, settings)),
75447492 VFA (valueFlowArrayElement (tokenlist, settings)),
75457493 VFA (valueFlowRightShift (tokenlist, settings)),
75467494 VFA_CPP (
0 commit comments