danmar/cppcheck — comment on commit 612b3c59ca85d5f33f30ab0c4ce2457567962ea8
File:  line 0
By edward-san:

imho if Token::eraseTokens should be changed, let it delete also the end token, but not the beginning one. Removing also the beginning one makes it easy to do this kind of code:
{{{
for (Token *tok = _tokens; tok; tok = tok->next()) {
if (somecondition)
Token::eraseTokens(tok, tok->tokAt(5));
}
}}}
this code would cause a memory corruption IIRC (if not, whatever it happens, valgrind would write tons of errors), because you lose 'tok'.