Refactoring; Use Token::isUnaryOp() to clarify code
This commit is contained in:
parent
5712366a8f
commit
a4fdef8d9e
|
@ -106,7 +106,7 @@ static bool isAutoVarArray(const Token *tok)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// &x[..]
|
// &x[..]
|
||||||
if (tok->str() == "&" && Token::simpleMatch(tok->astOperand1(), "[") && !tok->astOperand2())
|
if (tok->isUnaryOp("&") && Token::simpleMatch(tok->astOperand1(), "["))
|
||||||
return isAutoVarArray(tok->astOperand1()->astOperand1());
|
return isAutoVarArray(tok->astOperand1()->astOperand1());
|
||||||
|
|
||||||
// x+y
|
// x+y
|
||||||
|
@ -474,7 +474,7 @@ static bool astHasAutoResult(const Token *tok)
|
||||||
return false;
|
return false;
|
||||||
if ((tok->str() == "<<" || tok->str() == ">>") && tok->astOperand1()) {
|
if ((tok->str() == "<<" || tok->str() == ">>") && tok->astOperand1()) {
|
||||||
const Token* tok2 = tok->astOperand1();
|
const Token* tok2 = tok->astOperand1();
|
||||||
while (tok2 && tok2->str() == "*" && !tok2->astOperand2())
|
while (tok2 && tok2->isUnaryOp("*"))
|
||||||
tok2 = tok2->astOperand1();
|
tok2 = tok2->astOperand1();
|
||||||
return tok2 && tok2->variable() && !tok2->variable()->isClass() && !tok2->variable()->isStlType(); // Class or unknown type on LHS: Assume it is a stream
|
return tok2 && tok2->variable() && !tok2->variable()->isClass() && !tok2->variable()->isStlType(); // Class or unknown type on LHS: Assume it is a stream
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue