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

Method findFunctionInBase

lib/symboldatabase.cpp:5841–5866  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5839}
5840
5841void Scope::findFunctionInBase(const Token* tok, nonneg int args, std::vector<const Function *> & matches) const
5842{
5843 if (isClassOrStruct() && definedType && !definedType->derivedFrom.empty()) {
5844 const std::vector<Type::BaseInfo> &derivedFrom = definedType->derivedFrom;
5845 for (const Type::BaseInfo & i : derivedFrom) {
5846 const Type *base = i.type;
5847 if (base && base->classScope) {
5848 if (base->classScope == this) // Ticket #5120, #5125: Recursive class; tok should have been found already
5849 continue;
5850
5851 auto range = base->classScope->functionMap.equal_range(tok->str());
5852 for (auto it = range.first; it != range.second; ++it) {
5853 const Function *func = it->second;
5854 if (func->isDestructor() && !Token::simpleMatch(tok->tokAt(-1), "~"))
5855 continue;
5856 if ((func->isVariadic() && args >= (func->argCount() - 1)) ||
5857 (args == func->argCount() || (args < func->argCount() && args >= func->minArgCount()))) {
5858 matches.push_back(func);
5859 }
5860 }
5861
5862 base->classScope->findFunctionInBase(tok, args, matches);
5863 }
5864 }
5865 }
5866}
5867
5868const Scope *Scope::findRecordInBase(const std::string & name) const
5869{

Callers

nothing calls this directly

Calls 7

isClassOrStructFunction · 0.85
isVariadicMethod · 0.80
simpleMatchFunction · 0.70
emptyMethod · 0.45
strMethod · 0.45
tokAtMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected