| 1232 | } |
| 1233 | |
| 1234 | void CheckStlImpl::invalidContainerLoopError(const Token* tok, const Token* loopTok, ErrorPath errorPath) |
| 1235 | { |
| 1236 | const std::string method = tok ? tok->str() : "erase"; |
| 1237 | errorPath.emplace_back(loopTok, "Iterating container here."); |
| 1238 | |
| 1239 | // Remove duplicate entries from error path |
| 1240 | errorPath.remove_if([&](const ErrorPathItem& epi) { |
| 1241 | return epi.first == tok; |
| 1242 | }); |
| 1243 | |
| 1244 | const std::string msg = "Calling '" + method + "' while iterating the container is invalid."; |
| 1245 | errorPath.emplace_back(tok, ""); |
| 1246 | reportError(std::move(errorPath), Severity::error, "invalidContainerLoop", msg, CWE664, Certainty::normal); |
| 1247 | } |
| 1248 | |
| 1249 | void CheckStlImpl::invalidContainerError(const Token *tok, const ValueFlow::Value *val, ErrorPath errorPath) |
| 1250 | { |
no test coverage detected