We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
ValueFlow::Value::ValueType::INT
getKnownValue()
1 parent 51e9023 commit 86de5f8Copy full SHA for 86de5f8
lib/token.cpp
@@ -2522,6 +2522,15 @@ const ValueFlow::Value* Token::getKnownValue(ValueFlow::Value::ValueType t) cons
2522
{
2523
if (!mImpl->mValues)
2524
return nullptr;
2525
+ if (mImpl->mValues->empty())
2526
+ return nullptr;
2527
+ // known INT values are always the first entry
2528
+ if (t == ValueFlow::Value::ValueType::INT) {
2529
+ const auto& v = mImpl->mValues->front();
2530
+ if (!v.isKnown() || !v.isIntValue())
2531
2532
+ return &v;
2533
+ }
2534
auto it = std::find_if(mImpl->mValues->begin(), mImpl->mValues->end(), [&](const ValueFlow::Value& value) {
2535
return value.isKnown() && value.valueType == t;
2536
});
0 commit comments