| 2550 | } |
| 2551 | |
| 2552 | const ValueFlow::Value* Token::getKnownValue(ValueFlow::Value::ValueType t) const |
| 2553 | { |
| 2554 | if (!mImpl->mValues) |
| 2555 | return nullptr; |
| 2556 | if (mImpl->mValues->empty()) |
| 2557 | return nullptr; |
| 2558 | // known INT values are always the first entry |
| 2559 | if (t == ValueFlow::Value::ValueType::INT) { |
| 2560 | const auto& v = mImpl->mValues->front(); |
| 2561 | if (!v.isKnown() || !v.isIntValue()) |
| 2562 | return nullptr; |
| 2563 | return &v; |
| 2564 | } |
| 2565 | auto it = std::find_if(mImpl->mValues->begin(), mImpl->mValues->end(), [&](const ValueFlow::Value& value) { |
| 2566 | return value.isKnown() && value.valueType == t; |
| 2567 | }); |
| 2568 | return it == mImpl->mValues->end() ? nullptr : &*it; |
| 2569 | } |
| 2570 | |
| 2571 | const ValueFlow::Value* Token::getValue(const MathLib::bigint val) const |
| 2572 | { |
no test coverage detected