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

Method findAssociatedScopes

lib/symboldatabase.cpp:5892–5908  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5890}
5891
5892std::vector<const Scope*> Scope::findAssociatedScopes() const
5893{
5894 std::vector<const Scope*> result = {this};
5895 if (isClassOrStruct() && definedType && !definedType->derivedFrom.empty()) {
5896 const std::vector<Type::BaseInfo>& derivedFrom = definedType->derivedFrom;
5897 for (const Type::BaseInfo& i : derivedFrom) {
5898 const Type* base = i.type;
5899 if (base && base->classScope) {
5900 if (contains(result, base->classScope))
5901 continue;
5902 std::vector<const Scope*> baseScopes = base->classScope->findAssociatedScopes();
5903 result.insert(result.end(), baseScopes.cbegin(), baseScopes.cend());
5904 }
5905 }
5906 }
5907 return result;
5908}
5909
5910//---------------------------------------------------------------------------
5911

Callers 1

exprDependsOnThisFunction · 0.80

Calls 4

isClassOrStructFunction · 0.85
containsFunction · 0.85
emptyMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected