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

Method operatorEqRetRefThis

lib/checkclass.cpp:1664–1681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1662//---------------------------------------------------------------------------
1663
1664void CheckClassImpl::operatorEqRetRefThis()
1665{
1666 if (!mSettings.severity.isEnabled(Severity::style) && !mSettings.isPremiumEnabled("operatorEqRetRefThis"))
1667 return;
1668
1669 logChecker("CheckClass::operatorEqRetRefThis"); // style
1670
1671 for (const Scope * scope : mSymbolDatabase->classAndStructScopes) {
1672 for (auto func = scope->functionList.cbegin(); func != scope->functionList.cend(); ++func) {
1673 if (func->type == FunctionType::eOperatorEqual && func->hasBody()) {
1674 // make sure return signature is correct
1675 if (func->retType == func->nestedIn->definedType && func->tokenDef->strAt(-1) == "&") {
1676 checkReturnPtrThis(scope, &(*func), func->functionScope->bodyStart, func->functionScope->bodyEnd);
1677 }
1678 }
1679 }
1680 }
1681}
1682
1683void CheckClassImpl::checkReturnPtrThis(const Scope *scope, const Function *func, const Token *tok, const Token *last)
1684{

Callers 2

runChecksMethod · 0.80

Calls 2

isPremiumEnabledMethod · 0.80
isEnabledMethod · 0.45

Tested by 1