Fixed #993 (Latest Git drop aborts at 63% of wine tree)
This commit is contained in:
parent
ebdd74c43e
commit
7f6f41fd53
|
@ -2870,6 +2870,13 @@ void Tokenizer::simplifyVarDecl()
|
|||
// "int a=4;" => "int a; a=4;"
|
||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||
{
|
||||
if (Token::simpleMatch(tok, "= {"))
|
||||
{
|
||||
tok = tok->next()->link();
|
||||
if (!tok)
|
||||
break;
|
||||
}
|
||||
|
||||
if (tok->previous() && !Token::Match(tok->previous(), "[{};)]"))
|
||||
continue;
|
||||
|
||||
|
@ -2900,6 +2907,10 @@ void Tokenizer::simplifyVarDecl()
|
|||
if (isconst && Token::Match(tok2, "%type% %var% ="))
|
||||
continue;
|
||||
|
||||
// strange looking variable declaration => don't split up.
|
||||
if (Token::Match(tok2, "%type% *| %var% , %type% *| %var%"))
|
||||
continue;
|
||||
|
||||
if (Token::Match(tok2, "%type% *| %var% ,|="))
|
||||
{
|
||||
const bool isPointer = (tok2->next()->str() == "*");
|
||||
|
|
|
@ -40,6 +40,7 @@ private:
|
|||
void run()
|
||||
{
|
||||
TEST_CASE(tokenize1);
|
||||
TEST_CASE(tokenize2);
|
||||
|
||||
TEST_CASE(minus);
|
||||
|
||||
|
@ -225,6 +226,12 @@ private:
|
|||
ASSERT_EQUALS(code, tokenizeAndStringify(code.c_str()));
|
||||
}
|
||||
|
||||
void tokenize2()
|
||||
{
|
||||
const std::string code("{ sizeof a, sizeof b }");
|
||||
ASSERT_EQUALS("{ sizeof a , sizeof b }", tokenizeAndStringify(code.c_str()));
|
||||
}
|
||||
|
||||
void minus()
|
||||
{
|
||||
ASSERT_EQUALS("i = -12", tokenizeAndStringify("i = -12"));
|
||||
|
|
Loading…
Reference in New Issue