| 3337 | } |
| 3338 | |
| 3339 | void CheckClassImpl::overrideError(const Function *funcInBase, const Function *funcInDerived) |
| 3340 | { |
| 3341 | const std::string functionName = funcInDerived ? ((funcInDerived->isDestructor() ? "~" : "") + funcInDerived->name()) : ""; |
| 3342 | const std::string funcType = (funcInDerived && funcInDerived->isDestructor()) ? "destructor" : "function"; |
| 3343 | |
| 3344 | ErrorPath errorPath; |
| 3345 | if (funcInBase && funcInDerived) { |
| 3346 | errorPath.emplace_back(funcInBase->tokenDef, "Virtual " + funcType + " in base class"); |
| 3347 | errorPath.emplace_back(funcInDerived->tokenDef, char(std::toupper(funcType[0])) + funcType.substr(1) + " in derived class"); |
| 3348 | } |
| 3349 | |
| 3350 | reportError(std::move(errorPath), Severity::style, "missingOverride", |
| 3351 | "$symbol:" + functionName + "\n" |
| 3352 | "The " + funcType + " '$symbol' overrides a " + funcType + " in a base class but is not marked with a 'override' specifier.", |
| 3353 | CWE(0U) /* Unknown CWE! */, |
| 3354 | Certainty::normal); |
| 3355 | } |
| 3356 | |
| 3357 | void CheckClassImpl::uselessOverrideError(const Function *funcInBase, const Function *funcInDerived, bool isSameCode) |
| 3358 | { |
no test coverage detected