@@ -263,7 +263,7 @@ static bool isEscapeScope(const Token* tok, TokenList * tokenlist, bool unknown
263263static ValueFlow::Value castValue (ValueFlow::Value value, const ValueType::Sign sign, nonneg int bit)
264264{
265265 if (value.isFloatValue ()) {
266- value.valueType = ValueFlow::Value::INT;
266+ value.valueType = ValueFlow::Value::ValueType:: INT;
267267 if (value.floatValue >= std::numeric_limits<int >::min () && value.floatValue <= std::numeric_limits<int >::max ()) {
268268 value.intvalue = value.floatValue ;
269269 } else { // don't perform UB
@@ -431,7 +431,7 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value, const Setti
431431
432432 // cast..
433433 if (const Token *castType = getCastTypeStartToken (parent)) {
434- if (((tok->valueType () == nullptr && value.isImpossible ()) || astIsPointer (tok)) && value.valueType == ValueFlow::Value::INT &&
434+ if (((tok->valueType () == nullptr && value.isImpossible ()) || astIsPointer (tok)) && value.valueType == ValueFlow::Value::ValueType:: INT &&
435435 Token::simpleMatch (parent->astOperand1 (), " dynamic_cast" ))
436436 return ;
437437 const ValueType &valueType = ValueType::parseDecl (castType, settings);
@@ -546,7 +546,7 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value, const Setti
546546 if (value1.isTokValue () || value2.isTokValue ())
547547 break ;
548548 if (value1.isFloatValue () || value2.isFloatValue ()) {
549- result.valueType = ValueFlow::Value::FLOAT;
549+ result.valueType = ValueFlow::Value::ValueType:: FLOAT;
550550 result.floatValue = floatValue1 + floatValue2;
551551 } else {
552552 result.intvalue = value1.intvalue + value2.intvalue ;
@@ -557,7 +557,7 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value, const Setti
557557 if (value1.isTokValue () || value2.isTokValue ())
558558 break ;
559559 if (value1.isFloatValue () || value2.isFloatValue ()) {
560- result.valueType = ValueFlow::Value::FLOAT;
560+ result.valueType = ValueFlow::Value::ValueType:: FLOAT;
561561 result.floatValue = floatValue1 - floatValue2;
562562 } else {
563563 // Avoid overflow
@@ -575,7 +575,7 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value, const Setti
575575 if (value1.isTokValue () || value2.isTokValue ())
576576 break ;
577577 if (value1.isFloatValue () || value2.isFloatValue ()) {
578- result.valueType = ValueFlow::Value::FLOAT;
578+ result.valueType = ValueFlow::Value::ValueType:: FLOAT;
579579 result.floatValue = floatValue1 * floatValue2;
580580 } else {
581581 result.intvalue = value1.intvalue * value2.intvalue ;
@@ -586,7 +586,7 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value, const Setti
586586 if (value1.isTokValue () || value2.isTokValue () || value2.intvalue == 0 )
587587 break ;
588588 if (value1.isFloatValue () || value2.isFloatValue ()) {
589- result.valueType = ValueFlow::Value::FLOAT;
589+ result.valueType = ValueFlow::Value::ValueType:: FLOAT;
590590 result.floatValue = floatValue1 / floatValue2;
591591 } else {
592592 result.intvalue = value1.intvalue / value2.intvalue ;
@@ -905,7 +905,7 @@ static Token * valueFlowSetConstantValue(Token *tok, const Settings *settings, b
905905 setTokenValue (tok, value, settings);
906906 } else if (tok->isNumber () && MathLib::isFloat (tok->str ())) {
907907 ValueFlow::Value value;
908- value.valueType = ValueFlow::Value::FLOAT;
908+ value.valueType = ValueFlow::Value::ValueType:: FLOAT;
909909 value.floatValue = MathLib::toDoubleNumber (tok->str ());
910910 if (!tok->isTemplateArg ())
911911 value.setKnown ();
@@ -1085,7 +1085,7 @@ static void valueFlowString(TokenList *tokenlist)
10851085 for (Token *tok = tokenlist->front (); tok; tok = tok->next ()) {
10861086 if (tok->tokType () == Token::eString) {
10871087 ValueFlow::Value strvalue;
1088- strvalue.valueType = ValueFlow::Value::TOK;
1088+ strvalue.valueType = ValueFlow::Value::ValueType:: TOK;
10891089 strvalue.tokvalue = tok;
10901090 strvalue.setKnown ();
10911091 setTokenValue (tok, strvalue, tokenlist->getSettings ());
@@ -1103,7 +1103,7 @@ static void valueFlowArray(TokenList *tokenlist)
11031103 const std::map<int , const Token *>::const_iterator it = constantArrays.find (tok->varId ());
11041104 if (it != constantArrays.end ()) {
11051105 ValueFlow::Value value;
1106- value.valueType = ValueFlow::Value::TOK;
1106+ value.valueType = ValueFlow::Value::ValueType:: TOK;
11071107 value.tokvalue = it->second ;
11081108 value.setKnown ();
11091109 setTokenValue (tok, value, tokenlist->getSettings ());
@@ -1118,7 +1118,7 @@ static void valueFlowArray(TokenList *tokenlist)
11181118 tok->astParent ()->astOperand1 ()->variable () &&
11191119 tok->astParent ()->astOperand1 ()->variable ()->isPointer ()) {
11201120 ValueFlow::Value value;
1121- value.valueType = ValueFlow::Value::TOK;
1121+ value.valueType = ValueFlow::Value::ValueType:: TOK;
11221122 value.tokvalue = tok;
11231123 value.setKnown ();
11241124 setTokenValue (tok, value, tokenlist->getSettings ());
@@ -1220,7 +1220,7 @@ static void valueFlowPointerAlias(TokenList *tokenlist)
12201220 continue ;
12211221
12221222 ValueFlow::Value value;
1223- value.valueType = ValueFlow::Value::TOK;
1223+ value.valueType = ValueFlow::Value::ValueType:: TOK;
12241224 value.tokvalue = tok;
12251225 setTokenValue (tok, value, tokenlist->getSettings ());
12261226 }
@@ -3229,7 +3229,7 @@ struct LifetimeStore {
32293229 er.emplace_back (argtok, message);
32303230
32313231 ValueFlow::Value value;
3232- value.valueType = ValueFlow::Value::LIFETIME;
3232+ value.valueType = ValueFlow::Value::ValueType:: LIFETIME;
32333233 value.lifetimeScope = ValueFlow::Value::LifetimeScope::Local;
32343234 value.tokvalue = lt.token ;
32353235 value.errorPath = std::move (er);
@@ -3263,7 +3263,7 @@ struct LifetimeStore {
32633263 const Variable *var = getLifetimeVariable (argtok, er);
32643264 if (var && var->isArgument ()) {
32653265 ValueFlow::Value value;
3266- value.valueType = ValueFlow::Value::LIFETIME;
3266+ value.valueType = ValueFlow::Value::ValueType:: LIFETIME;
32673267 value.lifetimeScope = ValueFlow::Value::LifetimeScope::Argument;
32683268 value.tokvalue = var->nameToken ();
32693269 value.errorPath = er;
@@ -3293,7 +3293,7 @@ struct LifetimeStore {
32933293 er.insert (er.end (), errorPath.begin (), errorPath.end ());
32943294
32953295 ValueFlow::Value value;
3296- value.valueType = ValueFlow::Value::LIFETIME;
3296+ value.valueType = ValueFlow::Value::ValueType:: LIFETIME;
32973297 value.lifetimeScope = v.lifetimeScope ;
32983298 value.path = v.path ;
32993299 value.tokvalue = lt.token ;
@@ -3992,7 +3992,7 @@ static std::list<ValueFlow::Value> truncateValues(std::list<ValueFlow::Value> va
39923992 for (ValueFlow::Value &value : values) {
39933993 if (value.isFloatValue ()) {
39943994 value.intvalue = value.floatValue ;
3995- value.valueType = ValueFlow::Value::INT;
3995+ value.valueType = ValueFlow::Value::ValueType:: INT;
39963996 }
39973997
39983998 if (value.isIntValue () && sz > 0 && sz < 8 ) {
@@ -4066,7 +4066,7 @@ static void valueFlowAfterAssign(TokenList *tokenlist, SymbolDatabase* symboldat
40664066 // Remove container size if its not a container
40674067 if (!astIsContainer (tok->astOperand2 ()))
40684068 values.remove_if ([&](const ValueFlow::Value& value) {
4069- return value.valueType == ValueFlow::Value::CONTAINER_SIZE;
4069+ return value.valueType == ValueFlow::Value::ValueType:: CONTAINER_SIZE;
40704070 });
40714071 if (values.empty ())
40724072 continue ;
@@ -4534,7 +4534,7 @@ static const ValueFlow::Value* proveNotEqual(const std::list<ValueFlow::Value>&
45344534{
45354535 const ValueFlow::Value* result = nullptr ;
45364536 for (const ValueFlow::Value& value : values) {
4537- if (value.valueType != ValueFlow::Value::INT)
4537+ if (value.valueType != ValueFlow::Value::ValueType:: INT)
45384538 continue ;
45394539 if (result && !isInBounds (value, result->intvalue ))
45404540 continue ;
@@ -5167,7 +5167,7 @@ static bool evaluate(const Token *expr, const std::vector<std::list<ValueFlow::V
51675167 if (argvalue.isTokValue () && argvalue.tokvalue ->tokType () == Token::eString) {
51685168 ValueFlow::Value res (argvalue); // copy all "inconclusive", "condition", etc attributes
51695169 // set return value..
5170- res.valueType = ValueFlow::Value::INT;
5170+ res.valueType = ValueFlow::Value::ValueType:: INT;
51715171 res.tokvalue = nullptr ;
51725172 res.intvalue = Token::getStrLength (argvalue.tokvalue );
51735173 result->emplace_back (std::move (res));
@@ -5549,7 +5549,7 @@ static void valueFlowUninit(TokenList *tokenlist, SymbolDatabase * /*symbolDatab
55495549
55505550 ValueFlow::Value uninitValue;
55515551 uninitValue.setKnown ();
5552- uninitValue.valueType = ValueFlow::Value::UNINIT;
5552+ uninitValue.valueType = ValueFlow::Value::ValueType:: UNINIT;
55535553 uninitValue.tokvalue = vardecl;
55545554 std::list<ValueFlow::Value> values;
55555555 values.push_back (uninitValue);
@@ -5923,10 +5923,10 @@ static void valueFlowIterators(TokenList *tokenlist, const Settings *settings)
59235923 ValueFlow::Value v (0 );
59245924 v.setKnown ();
59255925 if (yield == Library::Container::Yield::START_ITERATOR) {
5926- v.valueType = ValueFlow::Value::ITERATOR_START;
5926+ v.valueType = ValueFlow::Value::ValueType:: ITERATOR_START;
59275927 setTokenValue (tok->astParent ()->tokAt (2 ), v, settings);
59285928 } else if (yield == Library::Container::Yield::END_ITERATOR) {
5929- v.valueType = ValueFlow::Value::ITERATOR_END;
5929+ v.valueType = ValueFlow::Value::ValueType:: ITERATOR_END;
59305930 setTokenValue (tok->astParent ()->tokAt (2 ), v, settings);
59315931 }
59325932 }
@@ -6157,8 +6157,8 @@ struct ContainerConditionHandler : ConditionHandler {
61576157 vartok = vartok->tokAt (-3 );
61586158 if (!isContainerSize (vartok))
61596159 return cond;
6160- true_value.valueType = ValueFlow::Value::CONTAINER_SIZE;
6161- false_value.valueType = ValueFlow::Value::CONTAINER_SIZE;
6160+ true_value.valueType = ValueFlow::Value::ValueType:: CONTAINER_SIZE;
6161+ false_value.valueType = ValueFlow::Value::ValueType:: CONTAINER_SIZE;
61626162 cond.true_values .push_back (true_value);
61636163 cond.false_values .push_back (false_value);
61646164 cond.vartok = vartok;
@@ -6508,7 +6508,7 @@ static void valueFlowUnknownFunctionReturn(TokenList *tokenlist, const Settings
65086508}
65096509
65106510ValueFlow::Value::Value (const Token* c, long long val)
6511- : valueType(INT),
6511+ : valueType(ValueType:: INT),
65126512 bound(Bound::Point),
65136513 intvalue(val),
65146514 tokvalue(nullptr ),
@@ -6538,24 +6538,24 @@ void ValueFlow::Value::assumeCondition(const Token* tok)
65386538std::string ValueFlow::Value::infoString () const
65396539{
65406540 switch (valueType) {
6541- case INT:
6541+ case ValueType:: INT:
65426542 return MathLib::toString (intvalue);
6543- case TOK:
6543+ case ValueType:: TOK:
65446544 return tokvalue->str ();
6545- case FLOAT:
6545+ case ValueType:: FLOAT:
65466546 return MathLib::toString (floatValue);
6547- case MOVED:
6547+ case ValueType:: MOVED:
65486548 return " <Moved>" ;
6549- case UNINIT:
6549+ case ValueType:: UNINIT:
65506550 return " <Uninit>" ;
6551- case BUFFER_SIZE:
6552- case CONTAINER_SIZE:
6551+ case ValueType:: BUFFER_SIZE:
6552+ case ValueType:: CONTAINER_SIZE:
65536553 return " size=" + MathLib::toString (intvalue);
6554- case ITERATOR_START:
6554+ case ValueType:: ITERATOR_START:
65556555 return " start=" + MathLib::toString (intvalue);
6556- case ITERATOR_END:
6556+ case ValueType:: ITERATOR_END:
65576557 return " end=" + MathLib::toString (intvalue);
6558- case LIFETIME:
6558+ case ValueType:: LIFETIME:
65596559 return " lifetime=" + tokvalue->str ();
65606560 }
65616561 throw InternalError (nullptr , " Invalid ValueFlow Value type" );
0 commit comments