From 0c84475aaca9cbe02c91184c3ec769f230acc546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 14 Jul 2018 10:26:22 +0200 Subject: [PATCH] Clarify code with Token::isUnaryOp() --- lib/checknullpointer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index c426633d0..8e0b2c53a 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -177,7 +177,7 @@ bool CheckNullPointer::isPointerDeRef(const Token *tok, bool &unknown) } // 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; // array access @@ -188,7 +188,7 @@ bool CheckNullPointer::isPointerDeRef(const Token *tok, bool &unknown) const Token *parent2 = parent; while (Token::Match(parent2, "[|.")) parent2 = parent2->astParent(); - if (parent2 != parent && parent2 && parent2->str() == "&" && !parent2->astOperand2()) + if (parent2 != parent && parent2 && parent2->isUnaryOp("&")) return false; // read/write member variable