| 6374 | } |
| 6375 | |
| 6376 | static void valueFlowIterators(TokenList& tokenlist, const Settings& settings) |
| 6377 | { |
| 6378 | for (Token* tok = tokenlist.front(); tok; tok = tok->next()) { |
| 6379 | if (!tok->scope()) |
| 6380 | continue; |
| 6381 | if (!tok->scope()->isExecutable()) |
| 6382 | continue; |
| 6383 | if (!astIsContainer(tok)) |
| 6384 | continue; |
| 6385 | const Token* ftok = nullptr; |
| 6386 | const Library::Container::Yield yield = findIteratorYield(tok, ftok, settings.library); |
| 6387 | if (!ftok) |
| 6388 | continue; |
| 6389 | if (yield == Library::Container::Yield::START_ITERATOR) { |
| 6390 | ValueFlow::Value v(0); |
| 6391 | v.setKnown(); |
| 6392 | v.valueType = ValueFlow::Value::ValueType::ITERATOR_START; |
| 6393 | setTokenValue(const_cast<Token*>(ftok)->next(), std::move(v), settings); |
| 6394 | } else if (yield == Library::Container::Yield::END_ITERATOR) { |
| 6395 | ValueFlow::Value v(0); |
| 6396 | v.setKnown(); |
| 6397 | v.valueType = ValueFlow::Value::ValueType::ITERATOR_END; |
| 6398 | setTokenValue(const_cast<Token*>(ftok)->next(), std::move(v), settings); |
| 6399 | } |
| 6400 | } |
| 6401 | } |
| 6402 | |
| 6403 | static std::list<ValueFlow::Value> getIteratorValues(std::list<ValueFlow::Value> values, |
| 6404 | const ValueFlow::Value::ValueKind* kind = nullptr) |
no test coverage detected