@@ -360,7 +360,7 @@ static bool match(const Token *tok, const std::string &rhs)
360360{
361361 if (tok->str () == rhs)
362362 return true ;
363- if (!tok->varId () && tok->hasKnownIntValue () && MathLib::toString (tok->values (). front (). intvalue ) == rhs)
363+ if (!tok->varId () && tok->hasKnownIntValue () && MathLib::toString (tok->getKnownIntValue () ) == rhs)
364364 return true ;
365365 return false ;
366366}
@@ -1524,7 +1524,7 @@ bool isUsedAsBool(const Token* const tok, const Settings& settings)
15241524 if (parent->isUnaryOp (" *" ))
15251525 return isUsedAsBool (parent, settings);
15261526 if (Token::Match (parent, " ==|!=" ) && (tok->astSibling ()->isNumber () || tok->astSibling ()->isKeyword ()) && tok->astSibling ()->hasKnownIntValue () &&
1527- tok->astSibling ()->values (). front (). intvalue == 0 )
1527+ tok->astSibling ()->getKnownIntValue () == 0 )
15281528 return true ;
15291529 if (parent->str () == " (" && astIsRHS (tok) && Token::Match (parent->astOperand1 (), " if|while" ))
15301530 return true ;
@@ -1656,11 +1656,11 @@ bool isSameExpression(bool macro, const Token *tok1, const Token *tok2, const Se
16561656 const Token* varTok1 = nullptr ;
16571657 const Token* varTok2 = exprTok;
16581658 const ValueFlow::Value* value = nullptr ;
1659- if (condTok->astOperand1 ()->hasKnownIntValue ( )) {
1660- value = &condTok-> astOperand1 ()-> values (). front () ;
1659+ if (const ValueFlow::Value* vi1 = condTok->astOperand1 ()->getKnownValue (ValueFlow::Value::ValueType::INT )) {
1660+ value = vi1 ;
16611661 varTok1 = condTok->astOperand2 ();
1662- } else if (condTok->astOperand2 ()->hasKnownIntValue ( )) {
1663- value = &condTok-> astOperand2 ()-> values (). front () ;
1662+ } else if (const ValueFlow::Value* vi2 = condTok->astOperand2 ()->getKnownValue (ValueFlow::Value::ValueType::INT )) {
1663+ value = vi2 ;
16641664 varTok1 = condTok->astOperand1 ();
16651665 }
16661666 const bool exprIsNot = Token::simpleMatch (exprTok, " !" );
@@ -3715,8 +3715,8 @@ static std::set<MathLib::bigint> getSwitchValues(const Token *startbrace, bool &
37153715 }
37163716 if (Token::simpleMatch (tok, " case" )) {
37173717 const Token *valueTok = tok->astOperand1 ();
3718- if (valueTok->hasKnownIntValue ( ))
3719- values.insert (valueTok-> getKnownIntValue () );
3718+ if (const ValueFlow::Value* v = valueTok->getKnownValue (ValueFlow::Value::ValueType::INT ))
3719+ values.insert (v-> intvalue );
37203720 continue ;
37213721 }
37223722 }
0 commit comments