| 47 | } |
| 48 | |
| 49 | std::pair<bool, bool> PathAnalysis::checkCond(const Token * tok, bool& known) |
| 50 | { |
| 51 | if (const ValueFlow::Value* v = tok->getKnownValue(ValueFlow::Value::ValueType::INT)) { |
| 52 | known = true; |
| 53 | return std::make_pair(!!v->intvalue, !v->intvalue); |
| 54 | } |
| 55 | auto it = std::find_if(tok->values().cbegin(), tok->values().cend(), [](const ValueFlow::Value& v) { |
| 56 | return v.isIntValue(); |
| 57 | }); |
| 58 | // If all possible values are the same, then assume all paths have the same value |
| 59 | if (it != tok->values().cend() && std::all_of(it, tok->values().cend(), [&](const ValueFlow::Value& v) { |
| 60 | if (v.isIntValue()) |
| 61 | return v.intvalue == it->intvalue; |
| 62 | return true; |
| 63 | })) { |
| 64 | known = false; |
| 65 | return std::make_pair(!!it->intvalue, !it->intvalue); |
| 66 | } |
| 67 | return std::make_pair(true, true); |
| 68 | } |
| 69 | |
| 70 | PathAnalysis::Progress PathAnalysis::forwardRecursive(const Token* tok, Info info, const std::function<PathAnalysis::Progress(const Info&)>& f) |
| 71 | { |
nothing calls this directly
no test coverage detected