memory leaks: simplify 'callfunc ; ;'

This commit is contained in:
Daniel Marjamäki 2010-08-02 21:59:47 +02:00
parent df44703ee9
commit ae0252dc91
2 changed files with 3 additions and 1 deletions

View File

@ -1465,7 +1465,8 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok)
// reduce "; callfunc ; %var%"
for (Token *tok2 = tok; tok2; tok2 = tok2->next())
{
if (Token::Match(tok2, ";|{|} callfunc ; %type%"))
if (Token::Match(tok2, ";|{|} callfunc ; %type%") ||
Token::Match(tok2, ";|{|} callfunc ; ;"))
tok2->deleteNext();
}

View File

@ -708,6 +708,7 @@ private:
// callfunc..
ASSERT_EQUALS("; callfunc ;", simplifycode(";callfunc;"));
ASSERT_EQUALS(";", simplifycode(";callfunc;;"));
ASSERT_EQUALS("while1 { dealloc ; alloc ; } return ; }", simplifycode("while1 { dealloc ; alloc ; } callfunc ; return ; }"));
// exit..