Memory leaks: simplify 'use use'
This commit is contained in:
parent
424fe064cb
commit
7aa0504692
|
@ -1919,6 +1919,13 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok)
|
|||
done = false;
|
||||
}
|
||||
|
||||
// use use => use
|
||||
if (Token::simpleMatch(tok2, "use use"))
|
||||
{
|
||||
tok2->deleteThis();
|
||||
done = false;
|
||||
}
|
||||
|
||||
// use; if| use; => use;
|
||||
while (Token::Match(tok2, "[;{}] use ; if| use ;"))
|
||||
{
|
||||
|
|
|
@ -659,6 +659,7 @@ private:
|
|||
ASSERT_EQUALS("alloc ;", simplifycode("alloc ; if ; else ;"));
|
||||
|
||||
// use..
|
||||
ASSERT_EQUALS("; use ; }", simplifycode("; use use ; }"));
|
||||
ASSERT_EQUALS("; alloc ; dealloc ; }", simplifycode("; alloc ; use ; use ; if use ; dealloc ; }"));
|
||||
|
||||
// if, else..
|
||||
|
|
Loading…
Reference in New Issue