Uninitialized variables: Fix false positives for '= { .. }'. Ticket: #3369

This commit is contained in:
Daniel Marjamäki 2011-12-16 18:04:10 +01:00
parent 3153650be3
commit e723ef0569
1 changed files with 4 additions and 0 deletions

View File

@ -1123,6 +1123,10 @@ bool CheckUninitVar::checkScopeForVariable(const Token *tok, const unsigned int
}
}
// skip = { .. }
if (Token::simpleMatch(tok, "= {"))
tok = tok->next()->link();
// TODO: handle loops, try, etc
if (tok->str() == "for" || Token::simpleMatch(tok, ") {") || Token::Match(tok, "%var% {")) {
return true;