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

Method findRecordInBase

lib/symboldatabase.cpp:5868–5890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5866}
5867
5868const Scope *Scope::findRecordInBase(const std::string & name) const
5869{
5870 if (isClassOrStruct() && definedType && !definedType->derivedFrom.empty()) {
5871 const std::vector<Type::BaseInfo> &derivedFrom = definedType->derivedFrom;
5872 for (const Type::BaseInfo & i : derivedFrom) {
5873 const Type *base = i.type;
5874 if (base && base->classScope) {
5875 if (base->classScope == this) // Recursive class; tok should have been found already
5876 continue;
5877
5878 if (base->name() == name) {
5879 return base->classScope;
5880 }
5881
5882 const ::Type * t = base->classScope->findType(name);
5883 if (t)
5884 return t->classScope;
5885 }
5886 }
5887 }
5888
5889 return nullptr;
5890}
5891
5892std::vector<const Scope*> Scope::findAssociatedScopes() const
5893{

Callers 1

findTypeMethod · 0.80

Calls 4

isClassOrStructFunction · 0.85
findTypeMethod · 0.80
emptyMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected