Fixed #903 (segmentation fault of cppcheck)
http://sourceforge.net/apps/trac/cppcheck/ticket/903
This commit is contained in:
parent
c337b4eb33
commit
b6cda12251
|
@ -3198,6 +3198,8 @@ void Tokenizer::simplifyIfAssign()
|
||||||
if (tok3 && indentlevel == 1)
|
if (tok3 && indentlevel == 1)
|
||||||
{
|
{
|
||||||
tok3 = tok3->previous();
|
tok3 = tok3->previous();
|
||||||
|
std::list<Token *> braces2;
|
||||||
|
|
||||||
for (tok2 = tok2->next(); tok2 && tok2 != tok; tok2 = tok2->previous())
|
for (tok2 = tok2->next(); tok2 && tok2 != tok; tok2 = tok2->previous())
|
||||||
{
|
{
|
||||||
tok3->insertToken(tok2->strAt(0));
|
tok3->insertToken(tok2->strAt(0));
|
||||||
|
@ -3211,11 +3213,20 @@ void Tokenizer::simplifyIfAssign()
|
||||||
{
|
{
|
||||||
braces.push_back(newTok);
|
braces.push_back(newTok);
|
||||||
}
|
}
|
||||||
|
else if (newTok->str() == "]")
|
||||||
|
{
|
||||||
|
braces2.push_back(newTok);
|
||||||
|
}
|
||||||
else if (newTok->str() == "(")
|
else if (newTok->str() == "(")
|
||||||
{
|
{
|
||||||
Token::createMutualLinks(newTok, braces.back());
|
Token::createMutualLinks(newTok, braces.back());
|
||||||
braces.pop_back();
|
braces.pop_back();
|
||||||
}
|
}
|
||||||
|
else if (newTok->str() == "[")
|
||||||
|
{
|
||||||
|
Token::createMutualLinks(newTok, braces2.back());
|
||||||
|
braces2.pop_back();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue