Clarify code with Token::isUnaryOp()

This commit is contained in:
Daniel Marjamäki 2018-07-14 10:26:22 +02:00
parent 449c48f6a7
commit 0c84475aac
1 changed files with 2 additions and 2 deletions

View File

@ -177,7 +177,7 @@ bool CheckNullPointer::isPointerDeRef(const Token *tok, bool &unknown)
} }
// Dereferencing pointer.. // Dereferencing pointer..
if (parent->str() == "*" && !parent->astOperand2() && !Token::Match(parent->tokAt(-2), "sizeof|decltype|typeof")) if (parent->isUnaryOp("*") && !Token::Match(parent->tokAt(-2), "sizeof|decltype|typeof"))
return true; return true;
// array access // array access
@ -188,7 +188,7 @@ bool CheckNullPointer::isPointerDeRef(const Token *tok, bool &unknown)
const Token *parent2 = parent; const Token *parent2 = parent;
while (Token::Match(parent2, "[|.")) while (Token::Match(parent2, "[|."))
parent2 = parent2->astParent(); parent2 = parent2->astParent();
if (parent2 != parent && parent2 && parent2->str() == "&" && !parent2->astOperand2()) if (parent2 != parent && parent2 && parent2->isUnaryOp("&"))
return false; return false;
// read/write member variable // read/write member variable