Tweaking CheckUninitVar (<< and >> handling)

This commit is contained in:
Daniel Marjamäki 2018-04-22 16:39:57 +02:00
parent 7b10375683
commit cc4977e140
1 changed files with 2 additions and 3 deletions

View File

@ -1012,7 +1012,7 @@ bool CheckUninitVar::isVariableUsage(const Token *vartok, bool pointer, Alloc al
return true;
}
if (_tokenizer->isCPP() && Token::Match(vartok->next(), "<<|>>")) {
if (_tokenizer->isCPP() && Token::simpleMatch(vartok->next(), "<<")) {
// Is this calculation done in rhs?
const Token *tok = vartok;
while (Token::Match(tok, "%name%|.|::"))
@ -1022,8 +1022,7 @@ bool CheckUninitVar::isVariableUsage(const Token *vartok, bool pointer, Alloc al
// Is variable a known POD type then this is a variable usage,
// otherwise we assume it's not.
const Variable *var = vartok->variable();
return (var && (var->typeStartToken()->isStandardType() || var->typeStartToken()->isEnumType()));
return (vartok->valueType() && vartok->valueType()->isIntegral());
}
if (alloc == NO_ALLOC && vartok->next() && vartok->next()->isOp() && !vartok->next()->isAssignmentOp())