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

Function evaluate

lib/vf_analyzers.cpp:704–724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

702 }
703
704 std::vector<MathLib::bigint> evaluate(Evaluate e, const Token* tok, const Token* ctx = nullptr) const override
705 {
706 if (e == Evaluate::Integral) {
707 return evaluateInt(tok, [&] {
708 return pms.get(tok, ctx, getProgramState());
709 });
710 }
711 if (e == Evaluate::ContainerEmpty) {
712 const ValueFlow::Value* value = ValueFlow::findValue(tok->values(), settings, [](const ValueFlow::Value& v) {
713 return v.isKnown() && v.isContainerSizeValue();
714 });
715 if (value)
716 return {value->intvalue == 0};
717 ProgramMemory pm = pms.get(tok, ctx, getProgramState());
718 MathLib::bigint out = 0;
719 if (pm.getContainerEmptyValue(tok->exprId(), out))
720 return {out};
721 return {};
722 }
723 return {};
724 }
725
726 void assume(const Token* tok, bool state, unsigned int flags) override {
727 // Update program state

Callers 2

analyzeConditionFunction · 0.70
isSameSymbolicValueFunction · 0.70

Calls 4

evaluateIntFunction · 0.85
isKnownMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected