Fixed #2241 (Segfault checking a file)

This commit is contained in:
Daniel Marjamäki 2010-11-28 07:35:42 +01:00
parent c9c6de24a6
commit ea405d95c6
1 changed files with 10 additions and 0 deletions

View File

@ -1984,12 +1984,16 @@ bool Tokenizer::tokenize(std::istream &code,
while (tok->str() != "{")
tok = tok->next();
tok = tok->link();
if (!tok)
break;
}
// skip executing scopes (ticket #1984)..
if (Token::simpleMatch(tok, "; {"))
{
tok = tok->next()->link();
if (!tok)
break;
}
// skip executing scopes (ticket #1985)..
@ -2002,6 +2006,8 @@ bool Tokenizer::tokenize(std::istream &code,
if (Token::simpleMatch(tok, ") {"))
tok = tok->next()->link();
}
if (!tok)
break;
}
// not start of statement?
@ -8650,7 +8656,11 @@ void Tokenizer::simplifyBorland()
for (Token *tok = _tokens; tok; tok = tok->next())
{
if (tok->str() == "{")
{
tok = tok->link();
if (!tok)
break;
}
if (Token::Match(tok, "class %var% :|{"))
{