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

Function isAutoDealloc

lib/checkleakautovar.cpp:80–89  ·  view source on GitHub ↗

* @brief Is variable type some class with automatic deallocation? * @param var variable token * @return true unless it can be seen there is no automatic deallocation */

Source from the content-addressed store, hash-verified

78 * @return true unless it can be seen there is no automatic deallocation
79 */
80static bool isAutoDealloc(const Variable *var)
81{
82 if (var->valueType() && var->valueType()->type != ValueType::Type::RECORD && var->valueType()->type != ValueType::Type::UNKNOWN_TYPE)
83 return false;
84
85 // return false if the type is a simple record type without side effects
86 // a type that has no side effects (no constructors and no members with constructors)
87 /** @todo false negative: check constructors for side effects */
88 return isAutoDeallocType(var->type());
89}
90
91template<std::size_t N>
92static bool isVarTokComparison(const Token * tok, const Token ** vartok,

Callers 1

isLocalVarNoAutoDeallocFunction · 0.85

Calls 2

isAutoDeallocTypeFunction · 0.85
typeMethod · 0.80

Tested by

no test coverage detected