| 1725 | } |
| 1726 | |
| 1727 | ValueFlow::Value execute(const Token* expr) |
| 1728 | { |
| 1729 | depth--; |
| 1730 | OnExit onExit{[&] { |
| 1731 | depth++; |
| 1732 | }}; |
| 1733 | if (depth < 0) |
| 1734 | return unknown(); |
| 1735 | ValueFlow::Value v = unknown(); |
| 1736 | if (updateValue(v, executeImpl(expr))) |
| 1737 | return v; |
| 1738 | if (!expr) |
| 1739 | return v; |
| 1740 | if (expr->exprId() > 0 && pm->hasValue(expr->exprId())) { |
| 1741 | if (updateValue(v, utils::as_const(*pm).at(expr->exprId()))) |
| 1742 | return v; |
| 1743 | } |
| 1744 | // Find symbolic values |
| 1745 | for (const ValueFlow::Value& value : expr->values()) { |
| 1746 | if (!value.isSymbolicValue()) |
| 1747 | continue; |
| 1748 | if (!value.isKnown()) |
| 1749 | continue; |
| 1750 | if (value.tokvalue->exprId() > 0 && !pm->hasValue(value.tokvalue->exprId())) |
| 1751 | continue; |
| 1752 | const ValueFlow::Value& v_ref = utils::as_const(*pm).at(value.tokvalue->exprId()); |
| 1753 | if (!v_ref.isIntValue() && value.intvalue != 0) |
| 1754 | continue; |
| 1755 | ValueFlow::Value v2 = v_ref; |
| 1756 | v2.intvalue += value.intvalue; |
| 1757 | return v2; |
| 1758 | } |
| 1759 | if (v.isImpossible() && v.isIntValue()) |
| 1760 | return v; |
| 1761 | if (const ValueFlow::Value* value = getImpossibleValue(expr)) |
| 1762 | return *value; |
| 1763 | return v; |
| 1764 | } |
| 1765 | |
| 1766 | std::vector<ValueFlow::Value> execute(const Scope* scope) |
| 1767 | { |
no test coverage detected