Refactoring ExprEngine
This commit is contained in:
parent
b97250e0fa
commit
b27fabaacb
|
@ -1295,19 +1295,19 @@ static ExprEngine::ValuePtr executeAssign(const Token *tok, Data &data)
|
||||||
ExprEngine::ValuePtr rhsValue = executeExpression(tok->astOperand2(), data);
|
ExprEngine::ValuePtr rhsValue = executeExpression(tok->astOperand2(), data);
|
||||||
|
|
||||||
if (!rhsValue) {
|
if (!rhsValue) {
|
||||||
const ValueType *vt = tok->astOperand1() ? tok->astOperand1()->valueType() : nullptr;
|
const ValueType * const vt1 = tok->astOperand1() ? tok->astOperand1()->valueType() : nullptr;
|
||||||
if (vt && vt->pointer == 0 && vt->isIntegral())
|
const ValueType * const vt2 = tok->astOperand2() ? tok->astOperand2()->valueType() : nullptr;
|
||||||
rhsValue = getValueRangeFromValueType(data.getNewSymbolName(), vt, *data.settings);
|
|
||||||
else {
|
if (vt1 && vt1->pointer == 0 && vt1->isIntegral())
|
||||||
vt = tok->astOperand2() ? tok->astOperand2()->valueType() : nullptr;
|
rhsValue = getValueRangeFromValueType(data.getNewSymbolName(), vt1, *data.settings);
|
||||||
if (vt && vt->container && vt->container->stdStringLike) {
|
|
||||||
|
else if (vt2 && vt2->container && vt2->container->stdStringLike) {
|
||||||
auto size = std::make_shared<ExprEngine::IntRange>(data.getNewSymbolName(), 0, ~0ULL);
|
auto size = std::make_shared<ExprEngine::IntRange>(data.getNewSymbolName(), 0, ~0ULL);
|
||||||
auto value = std::make_shared<ExprEngine::IntRange>(data.getNewSymbolName(), -128, 127);
|
auto value = std::make_shared<ExprEngine::IntRange>(data.getNewSymbolName(), -128, 127);
|
||||||
rhsValue = std::make_shared<ExprEngine::ArrayValue>(data.getNewSymbolName(), size, value, false, false, false);
|
rhsValue = std::make_shared<ExprEngine::ArrayValue>(data.getNewSymbolName(), size, value, false, false, false);
|
||||||
call(data.callbacks, tok->astOperand2(), rhsValue, &data);
|
call(data.callbacks, tok->astOperand2(), rhsValue, &data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!rhsValue)
|
if (!rhsValue)
|
||||||
throw VerifyException(tok, "Expression '" + tok->expressionString() + "'; Failed to evaluate RHS");
|
throw VerifyException(tok, "Expression '" + tok->expressionString() + "'; Failed to evaluate RHS");
|
||||||
|
|
Loading…
Reference in New Issue