Tokenizer: Fix another Valgrind error in simplifyErrNoInWhile. Add more jumping patterns to simplifyIfAddBraces and simplifyDoWhileAddBraces.
This commit is contained in:
parent
5f5c912f3f
commit
626f13ae7e
|
@ -4926,7 +4926,7 @@ bool Tokenizer::simplifyIfAddBraces()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tempToken->str() == "(") {
|
if (tempToken->str() == "(" || tempToken->str() == "[") {
|
||||||
tempToken = tempToken->link();
|
tempToken = tempToken->link();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -4973,7 +4973,8 @@ void Tokenizer::simplifyDoWhileAddBraces()
|
||||||
for (Token *tok = last; tok; tok = tok->previous()) {
|
for (Token *tok = last; tok; tok = tok->previous()) {
|
||||||
// fix for #988
|
// fix for #988
|
||||||
if (tok->str() == ")" || tok->str() == "]" ||
|
if (tok->str() == ")" || tok->str() == "]" ||
|
||||||
(tok->str() == "}" && Token::simpleMatch(tok->link()->previous(), "= {")))
|
(tok->str() == "}" && tok->link()->previous() &&
|
||||||
|
tok->link()->previous()->str() == "="))
|
||||||
tok = tok->link();
|
tok = tok->link();
|
||||||
|
|
||||||
if (!Token::Match(tok, "do !!{"))
|
if (!Token::Match(tok, "do !!{"))
|
||||||
|
@ -9059,8 +9060,8 @@ void Tokenizer::simplifyErrNoInWhile()
|
||||||
tok1 = tok1->previous();
|
tok1 = tok1->previous();
|
||||||
|
|
||||||
// erase "&& errno == EINTR"
|
// erase "&& errno == EINTR"
|
||||||
|
tok1 = tok1->previous();
|
||||||
Token::eraseTokens(tok1, endpar);
|
Token::eraseTokens(tok1, endpar);
|
||||||
tok1->deleteThis();
|
|
||||||
|
|
||||||
// tok is invalid.. move to endpar
|
// tok is invalid.. move to endpar
|
||||||
tok = endpar;
|
tok = endpar;
|
||||||
|
|
Loading…
Reference in New Issue