Reduce variable lifetime
This commit is contained in:
parent
9700dfead0
commit
3bcd0e0535
|
@ -970,14 +970,14 @@ static void valueFlowBeforeCondition(TokenList *tokenlist, SymbolDatabase *symbo
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// extra logic for unsigned variables 'i>=1' => possible value can also be 0
|
// extra logic for unsigned variables 'i>=1' => possible value can also be 0
|
||||||
ValueFlow::Value val(tok, num);
|
|
||||||
val.varId = varid;
|
|
||||||
if (Token::Match(tok, "<|>")) {
|
if (Token::Match(tok, "<|>")) {
|
||||||
if (num != 0)
|
if (num != 0)
|
||||||
continue;
|
continue;
|
||||||
if (!var->typeStartToken()->isUnsigned())
|
if (!var->typeStartToken()->isUnsigned())
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
ValueFlow::Value val(tok, num);
|
||||||
|
val.varId = varid;
|
||||||
ValueFlow::Value val2;
|
ValueFlow::Value val2;
|
||||||
if (num==1U && Token::Match(tok,"<=|>=")) {
|
if (num==1U && Token::Match(tok,"<=|>=")) {
|
||||||
if (var->typeStartToken()->isUnsigned()) {
|
if (var->typeStartToken()->isUnsigned()) {
|
||||||
|
|
Loading…
Reference in New Issue