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

Function calculateAssign

lib/vf_analyzers.cpp:481–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479
480 template<class T, class U>
481 static T calculateAssign(const std::string& assign, const T& x, const U& y, bool* error = nullptr)
482 {
483 if (assign.empty() || assign.back() != '=') {
484 if (error)
485 *error = true;
486 return T{};
487 }
488 if (assign == "=")
489 return static_cast<T>(y);
490 return calculate<T, T>(removeAssign(assign), x, y, error);
491 }
492
493 template<class Value, REQUIRES("Value must ValueFlow::Value", std::is_convertible<Value&, const ValueFlow::Value&> )>
494 static bool evalAssignment(Value& lhsValue, const std::string& assign, const ValueFlow::Value& rhsValue)

Callers 1

evalAssignmentFunction · 0.85

Calls 2

removeAssignFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected