Skip to content

Commit 4908bd9

Browse files
Update valueflow.cpp [skip ci]
1 parent 4daa356 commit 4908bd9

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

lib/valueflow.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,19 @@ static void valueFlowImpossibleValues(TokenList& tokenList, const Settings& sett
11071107
for (const Token* tok2 : tokens) {
11081108
if (const ValueFlow::Value* v = tok2->getKnownValue(ValueFlow::Value::ValueType::INT)) {
11091109
values.emplace_back(*v);
1110-
}
1110+
} else {
1111+
ValueFlow::Value symValue{};
1112+
symValue.valueType = ValueFlow::Value::ValueType::SYMBOLIC;
1113+
symValue.tokvalue = tok2;
1114+
values.push_back(std::move(symValue));
1115+
std::copy_if(tok2->values().cbegin(),
1116+
tok2->values().cend(),
1117+
std::back_inserter(values),
1118+
[](const ValueFlow::Value& v) {
1119+
if (!v.isKnown())
1120+
return false;
1121+
return v.isSymbolicValue();
1122+
});
11111123
}
11121124
const bool isMin = Token::Match(condTok, "<|<=") ^ flipped;
11131125
for (ValueFlow::Value& value : values) {
@@ -4258,6 +4270,7 @@ static void valueFlowAfterAssign(const TokenList &tokenlist,
42584270
continue;
42594271
const Token* expr = value.tokvalue;
42604272
value.intvalue = -value.intvalue;
4273+
value.invertBound();
42614274
value.tokvalue = tok->astOperand1();
42624275

42634276
// Skip if it intersects with an already assigned symbol

0 commit comments

Comments
 (0)