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

Function isVariableCopyNeeded

lib/checkclass.cpp:75–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75static bool isVariableCopyNeeded(const Variable &var, FunctionType type)
76{
77 bool isOpEqual = false;
78 switch (type) {
79 case FunctionType::eOperatorEqual:
80 isOpEqual = true;
81 break;
82 case FunctionType::eCopyConstructor:
83 case FunctionType::eMoveConstructor:
84 break;
85 default:
86 return true;
87 }
88
89 return (!var.hasDefault() || isOpEqual) && // default init does not matter for operator=
90 (var.isPointer() ||
91 (var.type() && var.type()->needInitialization == Type::NeedInitialization::True) ||
92 (var.valueType() && var.valueType()->type >= ValueType::Type::CHAR));
93}
94
95static bool isVclTypeInit(const Type *type)
96{

Callers 1

constructorsMethod · 0.85

Calls 1

typeMethod · 0.80

Tested by

no test coverage detected