Error message used when dereferencing an iterator that has been erased..
| 380 | |
| 381 | // Error message used when dereferencing an iterator that has been erased.. |
| 382 | void CheckStlImpl::dereferenceErasedError(const Token *erased, const Token* deref, const std::string &itername, bool inconclusive) |
| 383 | { |
| 384 | if (erased) { |
| 385 | std::list<const Token*> callstack = { deref, erased }; |
| 386 | reportError(callstack, Severity::error, "eraseDereference", |
| 387 | "$symbol:" + itername + "\n" |
| 388 | "Iterator '$symbol' used after element has been erased.\n" |
| 389 | "The iterator '$symbol' is invalid after the element it pointed to has been erased. " |
| 390 | "Dereferencing or comparing it with another iterator is invalid operation.", CWE664, inconclusive ? Certainty::inconclusive : Certainty::normal); |
| 391 | } else { |
| 392 | reportError(deref, Severity::error, "eraseDereference", |
| 393 | "$symbol:" + itername + "\n" |
| 394 | "Invalid iterator '$symbol' used.\n" |
| 395 | "The iterator '$symbol' is invalid before being assigned. " |
| 396 | "Dereferencing or comparing it with another iterator is invalid operation.", CWE664, inconclusive ? Certainty::inconclusive : Certainty::normal); |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | static const Token *skipMembers(const Token *tok) |
| 401 | { |
no test coverage detected