File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -2490,13 +2490,15 @@ std::shared_ptr<ScopeInfo2> Token::scopeInfo() const
2490
2490
return mImpl ->mScopeInfo ;
2491
2491
}
2492
2492
2493
+ // if there is a known INT value it will always be the first entry
2493
2494
bool Token::hasKnownIntValue () const
2494
2495
{
2495
2496
if (!mImpl ->mValues )
2496
2497
return false ;
2497
- return std::any_of (mImpl ->mValues ->begin (), mImpl ->mValues ->end (), [](const ValueFlow::Value& value) {
2498
- return value.isKnown () && value.isIntValue ();
2499
- });
2498
+ if (mImpl ->mValues ->empty ())
2499
+ return false ;
2500
+ const ValueFlow::Value& value = mImpl ->mValues ->front ();
2501
+ return value.isIntValue () && value.isKnown ();
2500
2502
}
2501
2503
2502
2504
bool Token::hasKnownValue () const
Original file line number Diff line number Diff line change @@ -1307,7 +1307,6 @@ class CPPCHECKLIB Token {
1307
1307
const ValueFlow::Value* getKnownValue () const ;
1308
1308
const ValueFlow::Value* getKnownValue (ValueFlow::Value::ValueType t) const ;
1309
1309
MathLib::bigint getKnownIntValue () const {
1310
- // TODO: need to perform lookup
1311
1310
assert (!mImpl ->mValues ->empty ());
1312
1311
assert (mImpl ->mValues ->front ().isKnown ());
1313
1312
assert (mImpl ->mValues ->front ().valueType == ValueFlow::Value::ValueType::INT);
You can’t perform that action at this time.
0 commit comments