memory leaks: fixed todo test case. reduce exit better

This commit is contained in:
Daniel Marjamäki 2009-08-29 16:03:23 +02:00
parent 085187b445
commit 8f1f89ae2b
2 changed files with 8 additions and 5 deletions

View File

@ -1263,6 +1263,13 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok, bool &all)
done = false;
}
// Reduce "; if(!var) exit ;" => ";"
if (Token::Match(tok2, "; if(!var) exit ;"))
{
Token::eraseTokens(tok2, tok2->tokAt(3));
done = false;
}
// Remove "catch ;"
if (Token::simpleMatch(tok2->next(), "catch ;"))
{

View File

@ -456,11 +456,7 @@ private:
// exit..
ASSERT_EQUALS(";", simplifycode("; if { alloc; exit; }"));
ASSERT_EQUALS("; alloc ;", simplifycode("; alloc ; if { use; exit; }"));
// Todo..
ASSERT_EQUALS("; alloc ; if(!var) exit ;", simplifycode("; alloc ; if(!var) { exit; }"));
TODO_ASSERT_EQUALS("; alloc ;", simplifycode("; alloc ; if(!var) { exit; }"));
ASSERT_EQUALS("; alloc ;", simplifycode("; alloc ; if(!var) { exit; }"));
TODO_ASSERT_EQUALS(";", simplifycode("; alloc ; if(var) { exit; }"));
TODO_ASSERT_EQUALS(";", simplifycode("; alloc ; ifv { exit; }", false));
TODO_ASSERT_EQUALS("; alloc ;", simplifycode("; alloc ; ifv { exit; }", true));