Refactorization in valueflow.cpp: Removed redundant loop, rearranged code.
This commit is contained in:
parent
d44d6ad94a
commit
df080ab5c3
|
@ -471,25 +471,19 @@ static void valueFlowBeforeCondition(TokenList *tokenlist, ErrorLogger *errorLog
|
|||
// 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 (num != 0)
|
||||
continue;
|
||||
if (!var->typeStartToken()->isUnsigned())
|
||||
continue;
|
||||
}
|
||||
ValueFlow::Value val2;
|
||||
if (num==1U && Token::Match(tok,"<=|>=")) {
|
||||
bool isunsigned = false;
|
||||
for (const Token* type = var->typeStartToken(); type && type->varId() == 0U; type = type->next())
|
||||
isunsigned |= type->isUnsigned();
|
||||
if (isunsigned) {
|
||||
if (var->typeStartToken()->isUnsigned()) {
|
||||
val2 = ValueFlow::Value(tok,0);
|
||||
val2.varId = varid;
|
||||
}
|
||||
}
|
||||
if (Token::Match(tok,"<|>")) {
|
||||
if (num!=0)
|
||||
continue;
|
||||
bool isunsigned = false;
|
||||
for (const Token* type = var->typeStartToken(); type && type->varId() == 0U; type = type->next())
|
||||
isunsigned |= type->isUnsigned();
|
||||
if (!isunsigned)
|
||||
continue;
|
||||
}
|
||||
for (Token *tok2 = tok->previous(); ; tok2 = tok2->previous()) {
|
||||
if (!tok2) {
|
||||
if (settings->debugwarnings) {
|
||||
|
|
Loading…
Reference in New Issue