CheckOther: Use isLikelyStreamRead

This commit is contained in:
Daniel Marjamäki 2018-04-22 17:14:28 +02:00
parent b7a52c3811
commit b6e89f85d0
1 changed files with 2 additions and 2 deletions

View File

@ -1359,10 +1359,10 @@ static bool canBeConst(const Variable *var)
const Token* parent = tok2->astParent();
if (!parent)
;
else if (parent->str() == "<<" || parent->str() == ">>") {
else if (parent->str() == "<<" || isLikelyStreamRead(true, parent)) {
if (parent->str() == "<<" && parent->astOperand1() == tok2)
return false;
else if (parent->str() == ">>" && parent->astOperand2() == tok2)
if (parent->str() == ">>" && parent->astOperand2() == tok2)
return false;
} else if (parent->str() == "," || parent->str() == "(") { // function argument
const Token* tok3 = tok2->previous();