| 1662 | //--------------------------------------------------------------------------- |
| 1663 | |
| 1664 | void 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 | |
| 1683 | void CheckClassImpl::checkReturnPtrThis(const Scope *scope, const Function *func, const Token *tok, const Token *last) |
| 1684 | { |