Tokenizer: use list.back() when we start the loop backwards.
This commit is contained in:
parent
233b7ddb4c
commit
e214d94589
|
@ -4003,11 +4003,7 @@ bool Tokenizer::simplifyIfAddBraces()
|
|||
void Tokenizer::simplifyDoWhileAddBraces()
|
||||
{
|
||||
//start from the last token and proceed backwards
|
||||
Token *last = list.front();
|
||||
while (last && last->next())
|
||||
last = last->next();
|
||||
|
||||
for (Token *tok = last; tok; tok = tok->previous()) {
|
||||
for (Token *tok = list.back(); tok; tok = tok->previous()) {
|
||||
// fix for #988
|
||||
if (tok->str() == ")" || tok->str() == "]" ||
|
||||
(tok->str() == "}" && tok->link()->previous() &&
|
||||
|
|
Loading…
Reference in New Issue