Skip to content

Commit 180e46f

Browse files
committed
Merge pull request cppcheck-opensource#780 from Dmitry-Me/reduceVariableScope5
Reduce variable lifetime
2 parents 9700dfe + 3bcd0e0 commit 180e46f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/valueflow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,14 +970,14 @@ static void valueFlowBeforeCondition(TokenList *tokenlist, SymbolDatabase *symbo
970970
continue;
971971

972972
// extra logic for unsigned variables 'i>=1' => possible value can also be 0
973-
ValueFlow::Value val(tok, num);
974-
val.varId = varid;
975973
if (Token::Match(tok, "<|>")) {
976974
if (num != 0)
977975
continue;
978976
if (!var->typeStartToken()->isUnsigned())
979977
continue;
980978
}
979+
ValueFlow::Value val(tok, num);
980+
val.varId = varid;
981981
ValueFlow::Value val2;
982982
if (num==1U && Token::Match(tok,"<=|>=")) {
983983
if (var->typeStartToken()->isUnsigned()) {

0 commit comments

Comments
 (0)