Reduce variable scope
This commit is contained in:
parent
dbb410cdae
commit
0def5d7a9a
|
@ -4078,12 +4078,12 @@ struct ValueFlowConditionHandler {
|
||||||
}
|
}
|
||||||
if (parent) {
|
if (parent) {
|
||||||
const std::string &op(parent->str());
|
const std::string &op(parent->str());
|
||||||
bool assign = false;
|
|
||||||
std::list<ValueFlow::Value> values = cond.true_values;
|
std::list<ValueFlow::Value> values = cond.true_values;
|
||||||
if (Token::Match(tok, "==|!="))
|
if (Token::Match(tok, "==|!="))
|
||||||
changePossibleToKnown(values);
|
changePossibleToKnown(values);
|
||||||
if ((op == "&&" && Token::Match(tok, "==|>=|<=|!")) ||
|
if ((op == "&&" && Token::Match(tok, "==|>=|<=|!")) ||
|
||||||
(op == "||" && Token::Match(tok, "%name%|!="))) {
|
(op == "||" && Token::Match(tok, "%name%|!="))) {
|
||||||
|
bool assign = false;
|
||||||
visitAstNodes(parent->astOperand2(), [&](Token* tok2) {
|
visitAstNodes(parent->astOperand2(), [&](Token* tok2) {
|
||||||
if (isSameExpression(tokenlist->isCPP(), false, cond.vartok, tok2, settings->library, true, false))
|
if (isSameExpression(tokenlist->isCPP(), false, cond.vartok, tok2, settings->library, true, false))
|
||||||
setTokenValue(tok2, values.front(), settings);
|
setTokenValue(tok2, values.front(), settings);
|
||||||
|
|
Loading…
Reference in New Issue