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

Method memsetError

lib/checkclass.cpp:1630–1640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1628}
1629
1630void CheckClassImpl::memsetError(const Token *tok, const std::string &memfunc, const std::string &classname, const std::string &type, bool isContainer)
1631{
1632 const std::string typeStr = isContainer ? std::string() : (type + " that contains a ");
1633 const std::string msg = "$symbol:" + memfunc + "\n"
1634 "$symbol:" + classname + "\n"
1635 "Using '" + memfunc + "' on " + typeStr + classname + ".\n"
1636 "Using '" + memfunc + "' on " + typeStr + classname + " is unsafe, because constructor, destructor "
1637 "and copy operator calls are omitted. These are necessary for this non-POD type to ensure that a valid object "
1638 "is created.";
1639 reportError(tok, Severity::error, "memsetClass", msg, CWE762, Certainty::normal);
1640}
1641
1642void CheckClassImpl::memsetErrorReference(const Token *tok, const std::string &memfunc, const std::string &type)
1643{

Callers 1

getErrorMessagesMethod · 0.80

Calls 1

reportErrorFunction · 0.70

Tested by

no test coverage detected