From 70d98c7176b67b8face45947522fa70ce7bcdbf2 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 10 Sep 2015 17:59:20 +0300 Subject: [PATCH] Get rid of set object --- lib/valueflow.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 9ea4a549c..a0d1661ba 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -365,7 +365,7 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value) // is condition only depending on 1 variable? std::stack tokens; tokens.push(parent->astOperand1()); - std::set variables; // used variables + unsigned int varId = 0; while (!tokens.empty()) { const Token *t = tokens.top(); tokens.pop(); @@ -374,9 +374,9 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value) tokens.push(t->astOperand1()); tokens.push(t->astOperand2()); if (t->varId()) { - variables.insert(t->varId()); - if (variables.size() > 1U || value.varId != 0U) + if (varId > 0 || value.varId != 0U) return; + varId = t->varId(); } else if (t->str() == "(" && Token::Match(t->previous(), "%name%")) return; // function call } @@ -385,8 +385,8 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value) v.conditional = true; v.changeKnownToPossible(); - if (!variables.empty()) - v.varId = *(variables.begin()); + if (varId) + v.varId = varId; setTokenValue(parent, v); }