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

Function hasOverloadedAssignment

lib/checkautovariables.cpp:240–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240static bool hasOverloadedAssignment(const Token* tok, bool& inconclusive)
241{
242 inconclusive = false;
243 if (tok->isC())
244 return false;
245 if (const ValueType* vt = tok->valueType()) {
246 if (vt->pointer && !Token::simpleMatch(tok->astParent(), "*"))
247 return false;
248 if (vt->container && vt->container->stdStringLike)
249 return true;
250 if (vt->typeScope)
251 return std::any_of(vt->typeScope->functionList.begin(), vt->typeScope->functionList.end(), [](const Function& f) { // TODO: compare argument type
252 return f.name() == "operator=";
253 });
254 return false;
255 }
256 inconclusive = true;
257 return true;
258}
259
260static bool isMemberAssignment(const Token* tok, const Token*& rhs, const Settings& settings)
261{

Callers 1

autoVariablesMethod · 0.85

Calls 6

isCMethod · 0.80
astParentMethod · 0.80
simpleMatchFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected