Refactoring; reuse isLikelyStreamRead
This commit is contained in:
parent
8e53f17922
commit
7825eb8670
|
@ -1030,12 +1030,7 @@ static void valueFlowGlobalStaticVar(TokenList *tokenList, const Settings *setti
|
||||||
vars.erase(tok->variable());
|
vars.erase(tok->variable());
|
||||||
else if (tokenList->isCPP() && Token::Match(tok->astParent()->tokAt(-2), "& %name% ="))
|
else if (tokenList->isCPP() && Token::Match(tok->astParent()->tokAt(-2), "& %name% ="))
|
||||||
vars.erase(tok->variable());
|
vars.erase(tok->variable());
|
||||||
} else if (tokenList->isCPP() && tok->astParent()->str() == ">>") {
|
} else if (isLikelyStreamRead(tokenList->isCPP(), tok->astParent())) {
|
||||||
const Token *lhs = tok->astParent();
|
|
||||||
while (Token::simpleMatch(lhs->astParent(), ">>"))
|
|
||||||
lhs = lhs->astParent();
|
|
||||||
lhs = lhs->astOperand1();
|
|
||||||
if (!lhs || !lhs->valueType() || !lhs->valueType()->isIntegral())
|
|
||||||
vars.erase(tok->variable());
|
vars.erase(tok->variable());
|
||||||
} else if (Token::Match(tok->astParent(), "[(,]"))
|
} else if (Token::Match(tok->astParent(), "[(,]"))
|
||||||
vars.erase(tok->variable());
|
vars.erase(tok->variable());
|
||||||
|
|
Loading…
Reference in New Issue