CheckCondition: Use isLikelyStreamRead

This commit is contained in:
Daniel Marjamäki 2018-04-22 09:48:54 +02:00
parent 0263452f5d
commit 3d78320d04
1 changed files with 3 additions and 6 deletions

View File

@ -648,13 +648,10 @@ void CheckCondition::multiCondition2()
if (Token::Match(parent->astParent(), "%assign%"))
break;
}
if (_tokenizer->isCPP() && Token::Match(tok, "%name% <<|>>") && (!tok->valueType() || !tok->valueType()->isIntegral()))
if (_tokenizer->isCPP() && Token::Match(tok, "%name% <<") && (!tok->valueType() || !tok->valueType()->isIntegral()))
break;
if (_tokenizer->isCPP() && Token::simpleMatch(tok->previous(), ">>")) {
const Token *rhs = tok->previous()->astOperand1();
if (!rhs || !rhs->valueType() || !rhs->valueType()->isIntegral())
if (isLikelyStreamRead(_tokenizer->isCPP(), tok->next()) || isLikelyStreamRead(_tokenizer->isCPP(), tok->previous()))
break;
}
if (Token::Match(tok, "%name% [")) {
const Token *tok2 = tok->linkAt(1);
while (Token::simpleMatch(tok2, "] ["))