CheckNullPointer: Use Tokenizer::IsScopeNoReturn

This commit is contained in:
Daniel Marjamäki 2011-12-28 08:17:58 +01:00
parent e4422558b6
commit 379440e2a4
1 changed files with 10 additions and 4 deletions

View File

@ -894,6 +894,16 @@ void CheckNullPointer::nullPointerByCheckAndDeRef()
break; break;
--indentlevel; --indentlevel;
// calling exit function?
bool unknown = false;
if (_tokenizer->IsScopeNoReturn(tok2, &unknown))
{
if (_settings->inconclusive && unknown)
inconclusive = true;
else
break;
}
if (null && indentlevel == 0) { if (null && indentlevel == 0) {
// skip all "else" blocks because they are not executed in this execution path // skip all "else" blocks because they are not executed in this execution path
while (Token::simpleMatch(tok2, "} else {")) while (Token::simpleMatch(tok2, "} else {"))
@ -912,10 +922,6 @@ void CheckNullPointer::nullPointerByCheckAndDeRef()
break; break;
} }
if (Token::Match(tok2, "exit ( %num% ) ;")) {
break;
}
// parameters to sizeof are not dereferenced // parameters to sizeof are not dereferenced
if (Token::Match(tok2, "decltype|sizeof")) { if (Token::Match(tok2, "decltype|sizeof")) {
if (tok2->strAt(1) != "(") if (tok2->strAt(1) != "(")