@@ -668,42 +668,6 @@ static void valueFlowArrayElement(TokenList& tokenlist, const Settings& settings
668668 }
669669}
670670
671- static void valueFlowSameExpressions (TokenList &tokenlist, const Settings& settings)
672- {
673- for (Token *tok = tokenlist.front (); tok; tok = tok->next ()) {
674- if (tok->hasKnownIntValue ())
675- continue ;
676-
677- if (!tok->astOperand1 () || !tok->astOperand2 ())
678- continue ;
679-
680- if (tok->astOperand1 ()->isLiteral () || tok->astOperand2 ()->isLiteral ())
681- continue ;
682-
683- if (!astIsIntegral (tok->astOperand1 (), false ) && !astIsIntegral (tok->astOperand2 (), false ))
684- continue ;
685-
686- ValueFlow::Value val;
687-
688- if (Token::Match (tok, " ==|>=|<=|/" )) {
689- val = ValueFlow::Value (1 );
690- val.setKnown ();
691- }
692-
693- if (Token::Match (tok, " !=|>|<|%|-" )) {
694- val = ValueFlow::Value (0 );
695- val.setKnown ();
696- }
697-
698- if (!val.isKnown ())
699- continue ;
700-
701- if (isSameExpression (false , tok->astOperand1 (), tok->astOperand2 (), settings, true , true , &val.errorPath )) {
702- setTokenValue (tok, std::move (val), settings);
703- }
704- }
705- }
706-
707671static bool getExpressionRange (const Token *expr, MathLib::bigint *minvalue, MathLib::bigint *maxvalue)
708672{
709673 if (expr->hasKnownIntValue ()) {
@@ -8382,7 +8346,7 @@ void ValueFlow::setValues(TokenList& tokenlist,
83828346 VFA (valueFlowLifetime (tokenlist, errorLogger, settings)),
83838347 VFA (valueFlowSymbolic (tokenlist, symboldatabase, errorLogger, settings)),
83848348 VFA (analyzeBitAnd (tokenlist, settings)),
8385- VFA (valueFlowSameExpressions (tokenlist, settings)),
8349+ VFA (analyzeSameExpressions (tokenlist, settings)),
83868350 VFA (valueFlowConditionExpressions (tokenlist, symboldatabase, errorLogger, settings)),
83878351 });
83888352
0 commit comments