Fixed #1220 (False memory leak when using while)
This commit is contained in:
parent
3fabe53570
commit
f65bf6d565
|
@ -1528,6 +1528,13 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok, bool &all)
|
|||
done = false;
|
||||
}
|
||||
|
||||
// Reduce "{ loop ;" => ";"
|
||||
if (Token::Match(tok2, "{ loop ;"))
|
||||
{
|
||||
tok2->deleteNext();
|
||||
done = false;
|
||||
}
|
||||
|
||||
// Reduce "loop if break ; => ";"
|
||||
if (Token::Match(tok2->next(), "loop if break|continue ; !!else"))
|
||||
{
|
||||
|
|
|
@ -592,7 +592,9 @@ private:
|
|||
|
||||
// switch..
|
||||
ASSERT_EQUALS("; alloc ; dealloc ;", simplifycode(";alloc;switch{case;break;};dealloc;"));
|
||||
ASSERT_EQUALS("; if return ; }", simplifycode("; switch { case ; return ; default ; break ; } }"));
|
||||
ASSERT_EQUALS("; if return ; else use ; }", simplifycode("; switch { case ; return ; default ; use ; break ; } }"));
|
||||
ASSERT_EQUALS("; use ; }", simplifycode("; while1 { loop { ; } switch { case ; dealloc ; return ; default ; break ; } } }"));
|
||||
|
||||
// loops..
|
||||
ASSERT_EQUALS(";", simplifycode("; loop { break; }"));
|
||||
|
|
Loading…
Reference in New Issue