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

Function evaluateInt

lib/vf_analyzers.cpp:676–695  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

674
675 template<class F>
676 std::vector<MathLib::bigint> evaluateInt(const Token* tok, F getProgramMemoryFunc) const
677 {
678 if (const ValueFlow::Value* v = tok->getKnownValue(ValueFlow::Value::ValueType::INT))
679 return {v->intvalue};
680 std::vector<MathLib::bigint> result;
681 ProgramMemory pm = getProgramMemoryFunc();
682 if (Token::Match(tok, "&&|%oror%")) {
683 if (conditionIsTrue(tok, pm, getSettings()))
684 result.push_back(1);
685 if (conditionIsFalse(tok, std::move(pm), getSettings()))
686 result.push_back(0);
687 } else {
688 MathLib::bigint out = 0;
689 bool error = false;
690 execute(tok, pm, &out, &error, getSettings());
691 if (!error)
692 result.push_back(out);
693 }
694 return result;
695 }
696
697 std::vector<MathLib::bigint> evaluateInt(const Token* tok) const
698 {

Callers 4

isModifiedFunction · 0.85
isWritableFunction · 0.85
writeValueFunction · 0.85
evaluateFunction · 0.85

Calls 5

conditionIsTrueFunction · 0.85
conditionIsFalseFunction · 0.85
executeFunction · 0.85
getKnownValueMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected