File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -365,7 +365,7 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value)
365365 // is condition only depending on 1 variable?
366366 std::stack<const Token*> tokens;
367367 tokens.push (parent->astOperand1 ());
368- std::set< unsigned int > variables; // used variables
368+ unsigned int varId = 0 ;
369369 while (!tokens.empty ()) {
370370 const Token *t = tokens.top ();
371371 tokens.pop ();
@@ -374,9 +374,9 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value)
374374 tokens.push (t->astOperand1 ());
375375 tokens.push (t->astOperand2 ());
376376 if (t->varId ()) {
377- variables.insert (t->varId ());
378- if (variables.size () > 1U || value.varId != 0U )
377+ if (varId > 0 || value.varId != 0U )
379378 return ;
379+ varId = t->varId ();
380380 } else if (t->str () == " (" && Token::Match (t->previous (), " %name%" ))
381381 return ; // function call
382382 }
@@ -385,8 +385,8 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value)
385385 v.conditional = true ;
386386 v.changeKnownToPossible ();
387387
388- if (!variables. empty () )
389- v.varId = *(variables. begin ()) ;
388+ if (varId )
389+ v.varId = varId ;
390390
391391 setTokenValue (parent, v);
392392 }
You can’t perform that action at this time.
0 commit comments