Skip to content

Commit 6c6c205

Browse files
Update checkother.cpp [skip ci]
1 parent a32896b commit 6c6c205

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎lib/checkother.cpp‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,12 @@ void CheckOtherImpl::checkConstVariable()
18161816
result = true;
18171817
return ChildrenToVisit::done;
18181818
}
1819+
ValueFlow::Value ltVal = ValueFlow::getLifetimeObjValue(tok);
1820+
if ((ltVal.isLifetimeValue() && ltVal.tokvalue->varId() == var->declarationId()) ||
1821+
ValueFlow::hasLifetimeToken(getParentLifetime(tok), var->nameToken(), mSettings)) {
1822+
result = true;
1823+
return ChildrenToVisit::done;
1824+
}
18191825
if (tok->isCast())
18201826
return tok->astOperand2() ? ChildrenToVisit::op2 : ChildrenToVisit::op1;
18211827
if (tok->str() == ".")
@@ -1826,13 +1832,6 @@ void CheckOtherImpl::checkConstVariable()
18261832
return ChildrenToVisit::op2;
18271833
if (tok->str() == ":")
18281834
return ChildrenToVisit::op1_and_op2;
1829-
1830-
ValueFlow::Value ltVal = ValueFlow::getLifetimeObjValue(tok);
1831-
if ((ltVal.isLifetimeValue() && ltVal.tokvalue->varId() == var->declarationId()) ||
1832-
ValueFlow::hasLifetimeToken(getParentLifetime(tok), var->nameToken(), mSettings)) {
1833-
result = true;
1834-
return ChildrenToVisit::done;
1835-
}
18361835
return ChildrenToVisit::none;
18371836
});
18381837
return result;

0 commit comments

Comments
 (0)