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 e60f7ae commit 19cd3caCopy full SHA for 19cd3ca
lib/token.cpp
@@ -2537,6 +2537,15 @@ const ValueFlow::Value* Token::getKnownValue(ValueFlow::Value::ValueType t) cons
2537
{
2538
if (!mImpl->mValues)
2539
return nullptr;
2540
+ if (mImpl->mValues->empty())
2541
+ return nullptr;
2542
+ // known INT values are always the first entry
2543
+ if (t == ValueFlow::Value::ValueType::INT) {
2544
+ const auto& v = mImpl->mValues->front();
2545
+ if (!v.isKnown() || !v.isIntValue())
2546
2547
+ return &v;
2548
+ }
2549
auto it = std::find_if(mImpl->mValues->begin(), mImpl->mValues->end(), [&](const ValueFlow::Value& value) {
2550
return value.isKnown() && value.valueType == t;
2551
});
0 commit comments