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

Method checkOverride

lib/checkclass.cpp:3315–3337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3313}
3314
3315void CheckClassImpl::checkOverride()
3316{
3317 if (!mSettings.severity.isEnabled(Severity::style) && !mSettings.isPremiumEnabled("missingOverride"))
3318 return;
3319 if (mSettings.standards.cpp < Standards::CPP11)
3320 return;
3321 logChecker("CheckClass::checkMissingOverride"); // style,c++03
3322 for (const Scope * classScope : mSymbolDatabase->classAndStructScopes) {
3323 if (!classScope->definedType || classScope->definedType->derivedFrom.empty())
3324 continue;
3325 for (const Function &func : classScope->functionList) {
3326 if (func.hasOverrideSpecifier() || func.hasFinalSpecifier())
3327 continue;
3328 if (func.tokenDef->isExpandedMacro())
3329 continue;
3330 if (func.templateDef)
3331 continue;
3332 const Function *baseFunc = func.getOverriddenFunction();
3333 if (baseFunc)
3334 overrideError(baseFunc, &func);
3335 }
3336 }
3337}
3338
3339void CheckClassImpl::overrideError(const Function *funcInBase, const Function *funcInDerived)
3340{

Callers 1

runChecksMethod · 0.80

Calls 4

isPremiumEnabledMethod · 0.80
getOverriddenFunctionMethod · 0.80
isEnabledMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected