Memory leak : Fixed issue 2429936 - false positive reported on the break in the code "loop { dealloc ; alloc ; if break ; }"

This commit is contained in:
Daniel Marjamäki 2008-12-16 19:01:15 +00:00
parent 87de37bcb4
commit b145bf3650
2 changed files with 12 additions and 1 deletions

View File

@ -787,6 +787,17 @@ void CheckMemoryLeakClass::simplifycode(TOKEN *tok)
done = false;
}
// Reduce "loop { assign|dealloc|use ; alloc ; if break ; }" to "assign|dealloc|use ; alloc ;"
if ( TOKEN::Match( tok2->next(), "loop { assign|dealloc|use ; alloc ; if break|continue ; }" ) )
{
// erase "loop {"
erase( tok2, tok2->tokAt(3) );
// erase "if break|continue ; }"
tok2 = tok2->next()->next()->next()->next();
erase( tok2, tok2->tokAt(5) );
done = false;
}
// Reduce "if(true) X ;" => "X ;"
if (TOKEN::Match(tok2->next(), "if(true) %var% ; !!else") )
{

View File

@ -97,7 +97,7 @@ private:
TEST_CASE( forwhile5 );
TEST_CASE( forwhile6 );
TEST_CASE( forwhile7 );
// TODO TEST_CASE( forwhile8 ); // Bug 2429936
TEST_CASE( forwhile8 ); // Bug 2429936
TEST_CASE( dowhile1 );