From 7825eb867031493cddac32e909ee967527d64fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 17 Apr 2018 19:51:27 +0200 Subject: [PATCH] Refactoring; reuse isLikelyStreamRead --- lib/valueflow.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 22a992ecf..c56c76c03 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1030,13 +1030,8 @@ static void valueFlowGlobalStaticVar(TokenList *tokenList, const Settings *setti vars.erase(tok->variable()); else if (tokenList->isCPP() && Token::Match(tok->astParent()->tokAt(-2), "& %name% =")) vars.erase(tok->variable()); - } else if (tokenList->isCPP() && tok->astParent()->str() == ">>") { - 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()); + } else if (isLikelyStreamRead(tokenList->isCPP(), tok->astParent())) { + vars.erase(tok->variable()); } else if (Token::Match(tok->astParent(), "[(,]")) vars.erase(tok->variable()); }