Remove some redundant semicolons - part 3
This commit is contained in:
parent
c2ddb67316
commit
42a557432d
|
@ -4453,14 +4453,15 @@ void Tokenizer::removeRedundantAssignment()
|
||||||
}
|
}
|
||||||
localvars.erase(0);
|
localvars.erase(0);
|
||||||
if (!localvars.empty()) {
|
if (!localvars.empty()) {
|
||||||
for (Token *tok2 = tok->next(); tok2 && tok2 != end; tok2 = tok2->next()) {
|
for (Token *tok2 = tok->next(); tok2 && tok2 != end;) {
|
||||||
if (Token::Match(tok2, "[;{}] %type% %var% ;") && localvars.find(tok2->tokAt(2)->varId()) != localvars.end()) {
|
if (Token::Match(tok2, "[;{}] %type% %var% ;") && localvars.find(tok2->tokAt(2)->varId()) != localvars.end()) {
|
||||||
Token::eraseTokens(tok2, tok2->tokAt(3));
|
Token::eraseTokens(tok2, tok2->tokAt(4));
|
||||||
} else if (Token::Match(tok2, "[;{}] %type% * %var% ;") && localvars.find(tok2->tokAt(3)->varId()) != localvars.end()) {
|
} else if (Token::Match(tok2, "[;{}] %type% * %var% ;") && localvars.find(tok2->tokAt(3)->varId()) != localvars.end()) {
|
||||||
Token::eraseTokens(tok2, tok2->tokAt(4));
|
Token::eraseTokens(tok2, tok2->tokAt(5));
|
||||||
} else if (Token::Match(tok2, "[;{}] %var% = %any% ;") && localvars.find(tok2->next()->varId()) != localvars.end()) {
|
} else if (Token::Match(tok2, "[;{}] %var% = %any% ;") && localvars.find(tok2->next()->varId()) != localvars.end()) {
|
||||||
Token::eraseTokens(tok2, tok2->tokAt(4));
|
Token::eraseTokens(tok2, tok2->tokAt(5));
|
||||||
}
|
} else
|
||||||
|
tok2 = tok2->next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -523,7 +523,7 @@ private:
|
||||||
|
|
||||||
{
|
{
|
||||||
const char code1[] = "void f() { int a; bool use = true; if( use ) a=0; else if( bb ) a=1; else if( cc ) a=33; else { gg = 0; } int c=1; }";
|
const char code1[] = "void f() { int a; bool use = true; if( use ) a=0; else if( bb ) a=1; else if( cc ) a=33; else { gg = 0; } int c=1; }";
|
||||||
const char code2[] = "void f ( ) { ; }";
|
const char code2[] = "void f ( ) { }";
|
||||||
ASSERT_EQUALS(code2, tok(code1));
|
ASSERT_EQUALS(code2, tok(code1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,7 +999,7 @@ private:
|
||||||
"}\n";
|
"}\n";
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << sizeofFromTokenizer("*");
|
oss << sizeofFromTokenizer("*");
|
||||||
ASSERT_EQUALS("void f ( ) { ; a = " + oss.str() + " ; }", sizeof_(code));
|
ASSERT_EQUALS("void f ( ) { a = " + oss.str() + " ; }", sizeof_(code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1174,7 +1174,7 @@ private:
|
||||||
|
|
||||||
const char expected[] = "void f ( ) "
|
const char expected[] = "void f ( ) "
|
||||||
"{"
|
"{"
|
||||||
" ;"
|
""
|
||||||
" 4 ; "
|
" 4 ; "
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
|
@ -1566,7 +1566,7 @@ private:
|
||||||
"f<int>(10);";
|
"f<int>(10);";
|
||||||
|
|
||||||
const std::string expected("; f<int> ( 10 ) ; "
|
const std::string expected("; f<int> ( 10 ) ; "
|
||||||
"void f<int> ( int val ) { ; }");
|
"void f<int> ( int val ) { }");
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
}
|
}
|
||||||
|
@ -2645,7 +2645,7 @@ private:
|
||||||
" bool x = false;\n"
|
" bool x = false;\n"
|
||||||
" int b = x ? 44 : 3;\n"
|
" int b = x ? 44 : 3;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
ASSERT_EQUALS("void f ( ) { ; }", tok(code));
|
ASSERT_EQUALS("void f ( ) { }", tok(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -6251,7 +6251,7 @@ private:
|
||||||
"}\n"
|
"}\n"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
ASSERT_EQUALS("void f ( ) { ; { g ( ) ; } }", tok(code));
|
ASSERT_EQUALS("void f ( ) { g ( ) ; }", tok(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -6264,7 +6264,7 @@ private:
|
||||||
"}\n"
|
"}\n"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
ASSERT_EQUALS("void f ( ) { ; }", tok(code));
|
ASSERT_EQUALS("void f ( ) { }", tok(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -6277,7 +6277,7 @@ private:
|
||||||
"}\n"
|
"}\n"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
ASSERT_EQUALS("void f ( ) { ; }", tok(code));
|
ASSERT_EQUALS("void f ( ) { }", tok(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -6290,7 +6290,7 @@ private:
|
||||||
"}\n"
|
"}\n"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
ASSERT_EQUALS("void f ( ) { ; { g ( ) ; } }", tok(code));
|
ASSERT_EQUALS("void f ( ) { g ( ) ; }", tok(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -6508,7 +6508,7 @@ private:
|
||||||
"}\n";
|
"}\n";
|
||||||
const char expected[] = "int f ( ) "
|
const char expected[] = "int f ( ) "
|
||||||
"{"
|
"{"
|
||||||
" ; return 5 ; "
|
" return 5 ; "
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(expected, tok(code));
|
ASSERT_EQUALS(expected, tok(code));
|
||||||
}
|
}
|
||||||
|
@ -6529,10 +6529,10 @@ private:
|
||||||
|
|
||||||
void while0for() {
|
void while0for() {
|
||||||
// for (condition is always false)
|
// for (condition is always false)
|
||||||
ASSERT_EQUALS("void f ( ) { ; }", tok("void f() { int i; for (i = 0; i < 0; i++) { a; } }"));
|
ASSERT_EQUALS("void f ( ) { }", tok("void f() { int i; for (i = 0; i < 0; i++) { a; } }"));
|
||||||
//ticket #3140
|
//ticket #3140
|
||||||
ASSERT_EQUALS("void f ( ) { ; }", tok("void f() { int i; for (i = 0; i < 0; i++) { foo(); break; } }"));
|
ASSERT_EQUALS("void f ( ) { }", tok("void f() { int i; for (i = 0; i < 0; i++) { foo(); break; } }"));
|
||||||
ASSERT_EQUALS("void f ( ) { ; }", tok("void f() { int i; for (i = 0; i < 0; i++) { foo(); continue; } }"));
|
ASSERT_EQUALS("void f ( ) { }", tok("void f() { int i; for (i = 0; i < 0; i++) { foo(); continue; } }"));
|
||||||
ASSERT_EQUALS("void f ( ) { }", tok("void f() { for (int i = 0; i < 0; i++) { a; } }"));
|
ASSERT_EQUALS("void f ( ) { }", tok("void f() { for (int i = 0; i < 0; i++) { a; } }"));
|
||||||
ASSERT_EQUALS("void f ( ) { }", tok("void f() { for (unsigned int i = 0; i < 0; i++) { a; } }"));
|
ASSERT_EQUALS("void f ( ) { }", tok("void f() { for (unsigned int i = 0; i < 0; i++) { a; } }"));
|
||||||
ASSERT_EQUALS("void f ( ) { }", tok("void f() { for (long long i = 0; i < 0; i++) { a; } }"));
|
ASSERT_EQUALS("void f ( ) { }", tok("void f() { for (long long i = 0; i < 0; i++) { a; } }"));
|
||||||
|
@ -6953,17 +6953,17 @@ private:
|
||||||
// ticket #1005 - int *p(0); => int *p = 0;
|
// ticket #1005 - int *p(0); => int *p = 0;
|
||||||
{
|
{
|
||||||
const char code[] = "void foo() { int *p(0); }";
|
const char code[] = "void foo() { int *p(0); }";
|
||||||
ASSERT_EQUALS("void foo ( ) { ; }", tok(code));
|
ASSERT_EQUALS("void foo ( ) { }", tok(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const char code[] = "void foo() { int p(0); }";
|
const char code[] = "void foo() { int p(0); }";
|
||||||
ASSERT_EQUALS("void foo ( ) { ; }", tok(code));
|
ASSERT_EQUALS("void foo ( ) { }", tok(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const char code[] = "void a() { foo *p(0); }";
|
const char code[] = "void a() { foo *p(0); }";
|
||||||
ASSERT_EQUALS("void a ( ) { ; }", tok(code));
|
ASSERT_EQUALS("void a ( ) { }", tok(code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1614,7 +1614,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: int foo ( int u@1 , int v@2 )\n"
|
"1: int foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 + v@2 ;\n"
|
"5: return u@1 + v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1631,7 +1631,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: int foo ( int u@1 , int v@2 )\n"
|
"1: int foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 - v@2 ;\n"
|
"5: return u@1 - v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1648,7 +1648,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: int foo ( int u@1 , int v@2 )\n"
|
"1: int foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 * v@2 ;\n"
|
"5: return u@1 * v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1665,7 +1665,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: int foo ( int u@1 , int v@2 )\n"
|
"1: int foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 / v@2 ;\n"
|
"5: return u@1 / v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1682,7 +1682,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: int foo ( int u@1 , int v@2 )\n"
|
"1: int foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 & v@2 ;\n"
|
"5: return u@1 & v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1699,7 +1699,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: int foo ( int u@1 , int v@2 )\n"
|
"1: int foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 | v@2 ;\n"
|
"5: return u@1 | v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1716,7 +1716,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: int foo ( int u@1 , int v@2 )\n"
|
"1: int foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 ^ v@2 ;\n"
|
"5: return u@1 ^ v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1733,7 +1733,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: int foo ( int u@1 , int v@2 )\n"
|
"1: int foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 % v@2 ;\n"
|
"5: return u@1 % v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1750,7 +1750,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: int foo ( int u@1 , int v@2 )\n"
|
"1: int foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 >> v@2 ;\n"
|
"5: return u@1 >> v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1767,7 +1767,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: int foo ( int u@1 , int v@2 )\n"
|
"1: int foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 << v@2 ;\n"
|
"5: return u@1 << v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1784,7 +1784,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 == v@2 ;\n"
|
"5: return u@1 == v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1801,7 +1801,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 != v@2 ;\n"
|
"5: return u@1 != v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1818,7 +1818,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 > v@2 ;\n"
|
"5: return u@1 > v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1835,7 +1835,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 >= v@2 ;\n"
|
"5: return u@1 >= v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1852,7 +1852,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 < v@2 ;\n"
|
"5: return u@1 < v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1869,7 +1869,7 @@ private:
|
||||||
const char expected[] = "\n\n##file 0\n"
|
const char expected[] = "\n\n##file 0\n"
|
||||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4:\n"
|
"4:\n"
|
||||||
"5: return u@1 <= v@2 ;\n"
|
"5: return u@1 <= v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
|
@ -1886,11 +1886,11 @@ private:
|
||||||
const char wanted[] = "\n\n##file 0\n"
|
const char wanted[] = "\n\n##file 0\n"
|
||||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4: ;\n"
|
"4:\n"
|
||||||
"5: return u@1 && v@2 ;\n"
|
"5: return u@1 && v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3: ;\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 && i@4 ;\n6: }\n";
|
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3:\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 && i@4 ;\n6: }\n";
|
||||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1908,7 +1908,7 @@ private:
|
||||||
"4: ;\n"
|
"4: ;\n"
|
||||||
"5: return u@1 || v@2 ;\n"
|
"5: return u@1 || v@2 ;\n"
|
||||||
"6: }\n";
|
"6: }\n";
|
||||||
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3: ;\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 || i@4 ;\n6: }\n";
|
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3:\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 || i@4 ;\n6: }\n";
|
||||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2019,9 +2019,9 @@ private:
|
||||||
const char expected[] = "void f ( ) {\n"
|
const char expected[] = "void f ( ) {\n"
|
||||||
"double x ; x = 0 ;\n"
|
"double x ; x = 0 ;\n"
|
||||||
"for ( int iter = 0 ; iter < 42 ; iter ++ ) {\n"
|
"for ( int iter = 0 ; iter < 42 ; iter ++ ) {\n"
|
||||||
";\n"
|
"\n"
|
||||||
"{\n"
|
"\n"
|
||||||
"Eval ( x ) ; }\n"
|
"Eval ( x ) ;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
|
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
|
||||||
|
@ -2035,9 +2035,9 @@ private:
|
||||||
" if (x || y);\n"
|
" if (x || y);\n"
|
||||||
"}";
|
"}";
|
||||||
const char expected[] = "void f ( ) {\n"
|
const char expected[] = "void f ( ) {\n"
|
||||||
|
"\n"
|
||||||
|
"\n"
|
||||||
";\n"
|
";\n"
|
||||||
"\n"
|
|
||||||
"\n"
|
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
|
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
|
||||||
}
|
}
|
||||||
|
@ -2068,7 +2068,7 @@ private:
|
||||||
" char c1 = 'a';\n"
|
" char c1 = 'a';\n"
|
||||||
" char c2 = { c1 };\n"
|
" char c2 = { c1 };\n"
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS("void f ( ) {\n;\nchar c2 ; c2 = { 'a' } ;\n}", tokenizeAndStringify(code, true));
|
ASSERT_EQUALS("void f ( ) {\n\nchar c2 ; c2 = { 'a' } ;\n}", tokenizeAndStringify(code, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyKnownVariables41() {
|
void simplifyKnownVariables41() {
|
||||||
|
@ -2308,7 +2308,7 @@ private:
|
||||||
" x(10 / a);\n"
|
" x(10 / a);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
const char expected[] = "void f ( ) {\n;\nx ( 0.25 ) ;\n}";
|
const char expected[] = "void f ( ) {\n\nx ( 0.25 ) ;\n}";
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, tokenizeAndStringify(code,true));
|
ASSERT_EQUALS(expected, tokenizeAndStringify(code,true));
|
||||||
}
|
}
|
||||||
|
@ -2478,7 +2478,7 @@ private:
|
||||||
const std::string expected("\n\n##file 0\n"
|
const std::string expected("\n\n##file 0\n"
|
||||||
"1: void f ( )\n"
|
"1: void f ( )\n"
|
||||||
"2: {\n"
|
"2: {\n"
|
||||||
"3: ;\n"
|
"3:\n"
|
||||||
"4: }\n");
|
"4: }\n");
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, actual);
|
ASSERT_EQUALS(expected, actual);
|
||||||
|
@ -3945,7 +3945,7 @@ private:
|
||||||
" int x;"
|
" int x;"
|
||||||
" { }"
|
" { }"
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS("void foo ( ) { if ( x ) { ; } { } }", tokenizeAndStringify(code, true));
|
ASSERT_EQUALS("void foo ( ) { if ( x ) { } { } }", tokenizeAndStringify(code, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4155,7 +4155,7 @@ private:
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next())
|
for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next())
|
||||||
ostr << " " << tok->str();
|
ostr << " " << tok->str();
|
||||||
ASSERT_EQUALS(" void f ( ) { ; } void g ( ) { ; }", ostr.str());
|
ASSERT_EQUALS(" void f ( ) { } void g ( ) { }", ostr.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplify_constants2() {
|
void simplify_constants2() {
|
||||||
|
@ -4990,8 +4990,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeRedundantAssignment() {
|
void removeRedundantAssignment() {
|
||||||
ASSERT_EQUALS("void f ( ) { ; int * q ; }", tokenizeAndStringify("void f() { int *p, *q; p = q; }", true));
|
ASSERT_EQUALS("void f ( ) { int * q ; }", tokenizeAndStringify("void f() { int *p, *q; p = q; }", true));
|
||||||
ASSERT_EQUALS("void f ( ) { ; int * q ; }", tokenizeAndStringify("void f() { int *p = 0, *q; p = q; }", true));
|
ASSERT_EQUALS("void f ( ) { int * q ; }", tokenizeAndStringify("void f() { int *p = 0, *q; p = q; }", true));
|
||||||
ASSERT_EQUALS("int f ( int * x ) { return * x ; }", tokenizeAndStringify("int f(int *x) { return *x; }", true));
|
ASSERT_EQUALS("int f ( int * x ) { return * x ; }", tokenizeAndStringify("int f(int *x) { return *x; }", true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5753,7 +5753,7 @@ private:
|
||||||
tokenizeAndStringify("void foo ( int b ) { int a = 0 | b ; bar ( a ) ; }", true));
|
tokenizeAndStringify("void foo ( int b ) { int a = 0 | b ; bar ( a ) ; }", true));
|
||||||
|
|
||||||
// ticket #3093
|
// ticket #3093
|
||||||
ASSERT_EQUALS("int f ( ) { ; return 15 ; }",
|
ASSERT_EQUALS("int f ( ) { return 15 ; }",
|
||||||
tokenizeAndStringify("int f() { int a = 10; int b = 5; return a + b; }", true));
|
tokenizeAndStringify("int f() { int a = 10; int b = 5; return a + b; }", true));
|
||||||
ASSERT_EQUALS("int f ( ) { return a ; }",
|
ASSERT_EQUALS("int f ( ) { return a ; }",
|
||||||
tokenizeAndStringify("int f() { return a * 1; }", true));
|
tokenizeAndStringify("int f() { return a * 1; }", true));
|
||||||
|
|
Loading…
Reference in New Issue