Uninitialized variables: Experimental checking for passing const pointer to partially initialized struct to function. Ticket: #5586

This commit is contained in:
Daniel Marjamäki 2014-03-20 07:19:35 +01:00
parent 8de4246713
commit 22a5881bee
1 changed files with 6 additions and 0 deletions

View File

@ -1882,6 +1882,12 @@ bool CheckUninitVar::isMemberVariableUsage(const Token *tok, bool isPointer, boo
else if (!isPointer && Token::Match(tok->previous(), "[(,] %var% [,)]") && isVariableUsage(tok, isPointer, alloc, _tokenizer->isCPP())) else if (!isPointer && Token::Match(tok->previous(), "[(,] %var% [,)]") && isVariableUsage(tok, isPointer, alloc, _tokenizer->isCPP()))
return true; return true;
else if (_settings->experimental &&
!isPointer &&
Token::Match(tok->tokAt(-2), "[(,] & %var% [,)]") &&
isVariableUsage(tok, isPointer, alloc, _tokenizer->isCPP()))
return true;
return false; return false;
} }