Tokenizer: Don't simplify '({..})' wrongly
This commit is contained in:
parent
5d7fa590af
commit
8c707876ed
|
@ -6868,6 +6868,9 @@ bool Tokenizer::simplifyRedundantParentheses()
|
||||||
if (tok->str() != "(")
|
if (tok->str() != "(")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (Token::simpleMatch(tok, "( {"))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (Token::Match(tok->link(), ") %num%")) {
|
if (Token::Match(tok->link(), ") %num%")) {
|
||||||
tok = tok->link();
|
tok = tok->link();
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1007,8 +1007,8 @@ private:
|
||||||
"}\n";
|
"}\n";
|
||||||
const char expected1[] = "1: void f ( ) {\n"
|
const char expected1[] = "1: void f ( ) {\n"
|
||||||
"2: for ( int i@1 ;\n"
|
"2: for ( int i@1 ;\n"
|
||||||
"3: { for ( int i@2 ; i@2 ; ++ i@2 ) { i@2 ++ ; } i@1 ++ ; } , i@1 ;\n"
|
"3: ( { for ( int i@2 ; i@2 ; ++ i@2 ) { i@2 ++ ; } i@1 ++ ; } ) , i@1 ;\n"
|
||||||
"4: { for ( int i@3 ; i@3 ; ++ i@3 ) { i@3 ++ ; } i@1 ++ ; } , i@1 ++ ) {\n"
|
"4: ( { for ( int i@3 ; i@3 ; ++ i@3 ) { i@3 ++ ; } i@1 ++ ; } ) , i@1 ++ ) {\n"
|
||||||
"5: i@1 ++ ;\n"
|
"5: i@1 ++ ;\n"
|
||||||
"6: }\n"
|
"6: }\n"
|
||||||
"7: }\n";
|
"7: }\n";
|
||||||
|
|
Loading…
Reference in New Issue