Merge pull request #633 from Dmitry-Me/runCheaperChecksFirst
Run cheaper checks first
This commit is contained in:
commit
f5eae166ac
|
@ -400,9 +400,9 @@ void CheckCondition::oppositeInnerCondition()
|
||||||
nonlocal |= (var && (!var->isLocal() || var->isStatic()) && !var->isArgument());
|
nonlocal |= (var && (!var->isLocal() || var->isStatic()) && !var->isArgument());
|
||||||
// TODO: if var is pointer check what it points at
|
// TODO: if var is pointer check what it points at
|
||||||
nonlocal |= (var && (var->isPointer() || var->isReference()));
|
nonlocal |= (var && (var->isPointer() || var->isReference()));
|
||||||
} else if (cond->isName()) {
|
} else if (!nonlocal && cond->isName()) {
|
||||||
// varid is 0. this is possibly a nonlocal variable..
|
// varid is 0. this is possibly a nonlocal variable..
|
||||||
nonlocal |= Token::Match(cond->astParent(), "%cop%|(");
|
nonlocal = Token::Match(cond->astParent(), "%cop%|(");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,8 +429,8 @@ void CheckCondition::oppositeInnerCondition()
|
||||||
if (Token::Match(tok->previous(), "++|--|& %name%"))
|
if (Token::Match(tok->previous(), "++|--|& %name%"))
|
||||||
break;
|
break;
|
||||||
if (tok->variable() &&
|
if (tok->variable() &&
|
||||||
Token::Match(tok, "%name% . %name% (") &&
|
!tok->variable()->isConst() &&
|
||||||
!tok->variable()->isConst()) {
|
Token::Match(tok, "%name% . %name% (")) {
|
||||||
const Function* function = tok->tokAt(2)->function();
|
const Function* function = tok->tokAt(2)->function();
|
||||||
if (!function || !function->isConst())
|
if (!function || !function->isConst())
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue