Tokenizer(simplifyIfAssign): fixed to link() just inserted tokens.
Fixed segfault on samba sources.
This commit is contained in:
parent
d6017756f4
commit
840bbcfcbb
|
@ -2683,9 +2683,22 @@ bool Tokenizer::simplifyIfAssign()
|
||||||
tok3 = tok3->previous();
|
tok3 = tok3->previous();
|
||||||
for (tok2 = tok2->next(); tok2 && tok2 != tok; tok2 = tok2->previous())
|
for (tok2 = tok2->next(); tok2 && tok2 != tok; tok2 = tok2->previous())
|
||||||
{
|
{
|
||||||
tok3->insertToken(tok2->str().c_str());
|
tok3->insertToken(tok2->strAt(0));
|
||||||
tok3->next()->fileIndex(tok2->fileIndex());
|
|
||||||
tok3->next()->linenr(tok2->linenr());
|
Token *newTok = tok3->next();
|
||||||
|
newTok->fileIndex(tok2->fileIndex());
|
||||||
|
newTok->linenr(tok2->linenr());
|
||||||
|
|
||||||
|
// link() newly tokens manually
|
||||||
|
if (newTok->str() == ")")
|
||||||
|
{
|
||||||
|
braces.push_back(newTok);
|
||||||
|
}
|
||||||
|
else if (newTok->str() == "(")
|
||||||
|
{
|
||||||
|
Token::createMutualLinks(newTok, braces.back());
|
||||||
|
braces.pop_back();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue