CheckUninitVar: don't rely on Tokenizer::simplifyKnownVar() to simplify references
This commit is contained in:
parent
ad007ca2d7
commit
ab38ab800e
|
@ -828,8 +828,14 @@ bool CheckUninitVar::isVariableUsage(const Token *vartok, bool pointer, Alloc al
|
|||
}
|
||||
}
|
||||
|
||||
if (alloc == NO_ALLOC && Token::Match(vartok->previous(), "= %name% ;|%cop%"))
|
||||
if (alloc == NO_ALLOC && Token::Match(vartok->previous(), "= %name% ;|%cop%")) {
|
||||
// taking reference?
|
||||
const Token *prev = vartok->tokAt(-2);
|
||||
while (Token::Match(prev, "%name%|*"))
|
||||
prev = prev->previous();
|
||||
if (!Token::Match(prev, "&"))
|
||||
return true;
|
||||
}
|
||||
|
||||
bool unknown = false;
|
||||
if (pointer && CheckNullPointer::isPointerDeRef(vartok, unknown)) {
|
||||
|
|
Loading…
Reference in New Issue