Break loop early, simplify check
This commit is contained in:
parent
6ae32ed98c
commit
f4ddf43cba
|
@ -526,12 +526,10 @@ void CheckOther::checkRedundantAssignment()
|
||||||
bool bailout = false;
|
bool bailout = false;
|
||||||
for (const Token *tok3 = tok2->link(); tok3 != tok2; tok3 = tok3->previous()) {
|
for (const Token *tok3 = tok2->link(); tok3 != tok2; tok3 = tok3->previous()) {
|
||||||
if (tok3->varId()) {
|
if (tok3->varId()) {
|
||||||
if (!tok3->variable())
|
const Variable *var = tok3->variable();
|
||||||
|
if (!var || !var->isConst() || var->isReference() || var->isPointer()) {
|
||||||
bailout = true;
|
bailout = true;
|
||||||
else {
|
break;
|
||||||
const Variable *var = tok3->variable();
|
|
||||||
if (!var->isConst() || var->isReference() || var->isPointer())
|
|
||||||
bailout = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue