File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -2475,13 +2475,15 @@ std::shared_ptr<ScopeInfo2> Token::scopeInfo() const
2475
2475
return mImpl ->mScopeInfo ;
2476
2476
}
2477
2477
2478
+ // if there is a known INT value it will always be the first entry
2478
2479
bool Token::hasKnownIntValue () const
2479
2480
{
2480
2481
if (!mImpl ->mValues )
2481
2482
return false ;
2482
- return std::any_of (mImpl ->mValues ->begin (), mImpl ->mValues ->end (), [](const ValueFlow::Value& value) {
2483
- return value.isKnown () && value.isIntValue ();
2484
- });
2483
+ if (mImpl ->mValues ->empty ())
2484
+ return false ;
2485
+ const ValueFlow::Value& value = mImpl ->mValues ->front ();
2486
+ return value.isIntValue () && value.isKnown ();
2485
2487
}
2486
2488
2487
2489
bool Token::hasKnownValue () const
Original file line number Diff line number Diff line change @@ -1291,7 +1291,6 @@ class CPPCHECKLIB Token {
1291
1291
const ValueFlow::Value* getKnownValue () const ;
1292
1292
const ValueFlow::Value* getKnownValue (ValueFlow::Value::ValueType t) const ;
1293
1293
MathLib::bigint getKnownIntValue () const {
1294
- // TODO: need to perform lookup
1295
1294
assert (!mImpl ->mValues ->empty ());
1296
1295
assert (mImpl ->mValues ->front ().isKnown ());
1297
1296
assert (mImpl ->mValues ->front ().valueType == ValueFlow::Value::ValueType::INT);
You can’t perform that action at this time.
0 commit comments