From a4fdef8d9e7552afbd38830f1c531033be99cc6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 13 Jul 2018 23:02:52 +0200 Subject: [PATCH] Refactoring; Use Token::isUnaryOp() to clarify code --- lib/checkautovariables.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/checkautovariables.cpp b/lib/checkautovariables.cpp index 26e1ff4a3..6c68ff6f3 100644 --- a/lib/checkautovariables.cpp +++ b/lib/checkautovariables.cpp @@ -106,7 +106,7 @@ static bool isAutoVarArray(const Token *tok) return false; // &x[..] - if (tok->str() == "&" && Token::simpleMatch(tok->astOperand1(), "[") && !tok->astOperand2()) + if (tok->isUnaryOp("&") && Token::simpleMatch(tok->astOperand1(), "[")) return isAutoVarArray(tok->astOperand1()->astOperand1()); // x+y @@ -474,7 +474,7 @@ static bool astHasAutoResult(const Token *tok) return false; if ((tok->str() == "<<" || tok->str() == ">>") && tok->astOperand1()) { const Token* tok2 = tok->astOperand1(); - while (tok2 && tok2->str() == "*" && !tok2->astOperand2()) + while (tok2 && tok2->isUnaryOp("*")) tok2 = tok2->astOperand1(); return tok2 && tok2->variable() && !tok2->variable()->isClass() && !tok2->variable()->isStlType(); // Class or unknown type on LHS: Assume it is a stream }