Clarify valueFlowUninit (#2136)
https://github.com/danmar/cppcheck/pull/2129#issuecomment-526916467
This commit is contained in:
parent
8865fb544d
commit
005765a561
|
@ -1333,7 +1333,7 @@ void CheckUninitVar::valueFlowUninit()
|
||||||
for (const Scope &scope : symbolDatabase->scopeList) {
|
for (const Scope &scope : symbolDatabase->scopeList) {
|
||||||
if (!scope.isExecutable())
|
if (!scope.isExecutable())
|
||||||
continue;
|
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 (")) {
|
if (Token::simpleMatch(tok, "sizeof (")) {
|
||||||
tok = tok->linkAt(1);
|
tok = tok->linkAt(1);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1364,6 +1364,8 @@ void CheckUninitVar::valueFlowUninit()
|
||||||
while (Token::simpleMatch(nextTok->astParent(), "."))
|
while (Token::simpleMatch(nextTok->astParent(), "."))
|
||||||
nextTok = nextTok->astParent();
|
nextTok = nextTok->astParent();
|
||||||
nextTok = nextAfterAstRightmostLeaf(nextTok);
|
nextTok = nextAfterAstRightmostLeaf(nextTok);
|
||||||
|
if(nextTok == scope.bodyEnd)
|
||||||
|
break;
|
||||||
tok = nextTok ? nextTok : tok;
|
tok = nextTok ? nextTok : tok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue