| 618 | } |
| 619 | |
| 620 | static std::string noMemberErrorMessage(const Scope *scope, const char function[], bool isdefault) |
| 621 | { |
| 622 | const std::string &classname = scope ? scope->className : "class"; |
| 623 | const std::string type = (scope && scope->type == ScopeType::eStruct) ? "Struct" : "Class"; |
| 624 | const bool isDestructor = (function[0] == 'd'); |
| 625 | std::string errmsg = "$symbol:" + classname + '\n'; |
| 626 | |
| 627 | if (isdefault) { |
| 628 | errmsg += type + " '$symbol' has dynamic memory/resource allocation(s). The " + function + " is explicitly defaulted but the default " + function + " does not work well."; |
| 629 | if (isDestructor) |
| 630 | errmsg += " It is recommended to define the " + std::string(function) + '.'; |
| 631 | else |
| 632 | errmsg += " It is recommended to define or delete the " + std::string(function) + '.'; |
| 633 | } else { |
| 634 | errmsg += type + " '$symbol' does not have a " + function + " which is recommended since it has dynamic memory/resource management."; |
| 635 | } |
| 636 | |
| 637 | return errmsg; |
| 638 | } |
| 639 | |
| 640 | void CheckClassImpl::noCopyConstructorError(const Scope *scope, bool isdefault, const Token *alloc, bool inconclusive) |
| 641 | { |
no outgoing calls
no test coverage detected