Memory leaks : Remove "if break|continue ;" that may otherwise cause false positives

This commit is contained in:
Daniel Marjamäki 2008-12-18 07:20:31 +00:00
parent 69137597f5
commit 8d6f77deed
1 changed files with 9 additions and 1 deletions

View File

@ -763,6 +763,14 @@ void CheckMemoryLeakClass::simplifycode(TOKEN *tok)
}
}
// Remove the "if break|continue ;" that follows "dealloc ; alloc ;"
if ( ! _settings._showAll && TOKEN::Match(tok2, "dealloc ; alloc ; if break|continue ;") )
{
tok2 = tok2->next()->next()->next();
erase(tok2, tok2->tokAt(3));
done = false;
}
// Reduce "if ; else %var% ;" => "if %var% ;"
if ( TOKEN::Match(tok2, "if ; else %var% ;") )
{