@@ -5113,32 +5113,6 @@ struct SimpleConditionHandler : ConditionHandler {
51135113 }
51145114};
51155115
5116- struct IteratorInferModel : InferModel {
5117- virtual ValueFlow::Value::ValueType getType () const = 0;
5118- bool match (const ValueFlow::Value& value) const override {
5119- return value.valueType == getType ();
5120- }
5121- ValueFlow::Value yield (MathLib::bigint value) const override
5122- {
5123- ValueFlow::Value result (value);
5124- result.valueType = getType ();
5125- result.setKnown ();
5126- return result;
5127- }
5128- };
5129-
5130- struct EndIteratorInferModel : IteratorInferModel {
5131- ValueFlow::Value::ValueType getType () const override {
5132- return ValueFlow::Value::ValueType::ITERATOR_END;
5133- }
5134- };
5135-
5136- struct StartIteratorInferModel : IteratorInferModel {
5137- ValueFlow::Value::ValueType getType () const override {
5138- return ValueFlow::Value::ValueType::ITERATOR_END;
5139- }
5140- };
5141-
51425116static bool isIntegralOnlyOperator (const Token* tok) {
51435117 return Token::Match (tok, " %|<<|>>|&|^|~|%or%" );
51445118}
@@ -5174,8 +5148,8 @@ static void valueFlowInferCondition(TokenList& tokenlist, const Settings& settin
51745148 continue ;
51755149 if (Token::Match (tok, " %comp%|-" ) && tok->astOperand1 () && tok->astOperand2 ()) {
51765150 if (astIsIterator (tok->astOperand1 ()) || astIsIterator (tok->astOperand2 ())) {
5177- static const std::array<ValuePtr<InferModel>, 2 > iteratorModels = {EndIteratorInferModel{} ,
5178- StartIteratorInferModel{} };
5151+ static const std::array<ValuePtr<InferModel>, 2 > iteratorModels = {makeEndIteratorInferModel () ,
5152+ makeStartIteratorInferModel () };
51795153 for (const ValuePtr<InferModel>& model : iteratorModels) {
51805154 std::vector<ValueFlow::Value> result =
51815155 infer (model, tok->str (), tok->astOperand1 ()->values (), tok->astOperand2 ()->values ());
0 commit comments