| 4981 | |
| 4982 | struct SimpleConditionHandler : ConditionHandler { |
| 4983 | std::vector<Condition> parse(const Token* tok, const Settings& /*settings*/) const override { |
| 4984 | |
| 4985 | std::vector<Condition> conds; |
| 4986 | parseCompareEachInt(tok, [&](const Token* vartok, ValueFlow::Value true_value, ValueFlow::Value false_value) { |
| 4987 | if (vartok->hasKnownIntValue()) |
| 4988 | return; |
| 4989 | if (vartok->str() == "=" && vartok->astOperand1() && vartok->astOperand2()) |
| 4990 | vartok = vartok->astOperand1(); |
| 4991 | Condition cond; |
| 4992 | cond.true_values.push_back(std::move(true_value)); |
| 4993 | cond.false_values.push_back(std::move(false_value)); |
| 4994 | cond.vartok = vartok; |
| 4995 | conds.push_back(std::move(cond)); |
| 4996 | }); |
| 4997 | if (!conds.empty()) |
| 4998 | return conds; |
| 4999 | |
| 5000 | const Token* vartok = getConditionVariable(tok); |
| 5001 | if (!vartok) |
| 5002 | return {}; |
| 5003 | Condition cond; |
| 5004 | cond.true_values.emplace_back(tok, 0LL); |
| 5005 | cond.false_values.emplace_back(tok, 0LL); |
| 5006 | cond.vartok = vartok; |
| 5007 | |
| 5008 | return {std::move(cond)}; |
| 5009 | } |
| 5010 | }; |
| 5011 | |
| 5012 | struct IteratorInferModel : InferModel { |
nothing calls this directly
no test coverage detected