Fix simplifyRedundantParanthesis() to work after '}'
This commit is contained in:
parent
5a0a5422c3
commit
036f3894f1
|
@ -3408,7 +3408,7 @@ bool Tokenizer::simplifyRedundantParanthesis()
|
|||
ret = true;
|
||||
}
|
||||
|
||||
if (Token::Match(tok->previous(), "[(!*;] ( %var% )") && tok->next()->varId() != 0)
|
||||
if (Token::Match(tok->previous(), "[(!*;}] ( %var% )") && tok->next()->varId() != 0)
|
||||
{
|
||||
// We have "( var )", remove the paranthesis
|
||||
tok = tok->previous();
|
||||
|
|
|
@ -421,6 +421,7 @@ private:
|
|||
ASSERT_EQUALS("void f ( ) { int p [ 10 ] ; p [ 0 ] = 1 ; }", tok("void f(){int p[10]; (p)[0] = 1;}"));
|
||||
ASSERT_EQUALS("void f ( ) { int p ; if ( ! p ) { } }", tok("void f(){int p; if ((p) == 0) {}}"));
|
||||
ASSERT_EQUALS("void f ( ) { int * p ; * p = 1 ; }", tok("void f(){int *p; *(p) = 1;}"));
|
||||
ASSERT_EQUALS("void f ( ) { int p ; if ( p ) { } p = 1 ; }", tok("void f(){int p; if ( p ) { } (p) = 1;}"));
|
||||
|
||||
// keep parantheses..
|
||||
ASSERT_EQUALS("= a ;", tok("= (char)a;"));
|
||||
|
|
Loading…
Reference in New Issue