Clarify valueFlowUninit (#2136)

https://github.com/danmar/cppcheck/pull/2129#issuecomment-526916467
This commit is contained in:
Ken-Patrick Lehrmann 2019-09-02 06:50:56 +02:00 committed by Daniel Marjamäki
parent 8865fb544d
commit 005765a561
1 changed files with 3 additions and 1 deletions

View File

@ -1333,7 +1333,7 @@ void CheckUninitVar::valueFlowUninit()
for (const Scope &scope : symbolDatabase->scopeList) {
if (!scope.isExecutable())
continue;
for (const Token* tok = scope.bodyStart; tok && tok != scope.bodyEnd; tok = tok->next()) {
for (const Token* tok = scope.bodyStart; tok != scope.bodyEnd; tok = tok->next()) {
if (Token::simpleMatch(tok, "sizeof (")) {
tok = tok->linkAt(1);
continue;
@ -1364,6 +1364,8 @@ void CheckUninitVar::valueFlowUninit()
while (Token::simpleMatch(nextTok->astParent(), "."))
nextTok = nextTok->astParent();
nextTok = nextAfterAstRightmostLeaf(nextTok);
if(nextTok == scope.bodyEnd)
break;
tok = nextTok ? nextTok : tok;
}
}