| 5788 | } |
| 5789 | |
| 5790 | static std::vector<ValueFlow::Value> getCommonValuesFromTokens(const std::vector<const Token*>& toks) |
| 5791 | { |
| 5792 | if (toks.empty()) |
| 5793 | return {}; |
| 5794 | std::vector<ValueFlow::Value> result; |
| 5795 | std::copy_if(toks.front()->values().begin(), |
| 5796 | toks.front()->values().end(), |
| 5797 | std::back_inserter(result), |
| 5798 | [&](const ValueFlow::Value& v) { |
| 5799 | if (!v.isKnown() && !v.isImpossible()) |
| 5800 | return false; |
| 5801 | return (v.isIntValue() || v.isContainerSizeValue() || v.isFloatValue()); |
| 5802 | }); |
| 5803 | std::for_each(toks.begin() + 1, toks.end(), [&](const Token* tok) { |
| 5804 | auto it = std::remove_if(result.begin(), result.end(), [&](const ValueFlow::Value& v) { |
| 5805 | return std::none_of(tok->values().begin(), tok->values().end(), [&](const ValueFlow::Value& v2) { |
| 5806 | return v.equalValue(v2) && v.valueKind == v2.valueKind; |
| 5807 | }); |
| 5808 | }); |
| 5809 | result.erase(it, result.end()); |
| 5810 | }); |
| 5811 | return result; |
| 5812 | } |
| 5813 | |
| 5814 | static void setFunctionReturnValue(const Function* f, |
| 5815 | Token* tok, |
no test coverage detected