Bug hunting; Avoid some bailout false positives in uninit checker

This commit is contained in:
Daniel Marjamäki 2020-07-14 08:12:40 +02:00
parent e0be224f4e
commit 6030ab72ab
1 changed files with 4 additions and 0 deletions

View File

@ -226,6 +226,10 @@ static void uninit(const Token *tok, const ExprEngine::Value &value, ExprEngine:
if (tok->astParent()->str() == "::" && tok == tok->astParent()->astOperand1())
return;
// Object allocated on the stack
if (tok->valueType() && tok->valueType()->pointer == 0 && Token::Match(tok, "%var% ."))
return;
// Containers are not uninitialized
std::vector<const Token *> tokens{tok, tok->astOperand1(), tok->astOperand2()};
if (Token::Match(tok->previous(), ". %name%"))