MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / execute

Method execute

lib/programmemory.cpp:1727–1764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 3

executeAllMethod · 0.45
executeImplMethod · 0.45
executeFunction · 0.45

Calls 15

unknownFunction · 0.85
precedesFunction · 0.85
executeFunction · 0.85
isTrueFunction · 0.85
isFalseFunction · 0.85
atMethod · 0.80
isKnownMethod · 0.80
isImpossibleMethod · 0.80
nextMethod · 0.80
astTopMethod · 0.80
astOperand1Method · 0.80

Tested by

no test coverage detected