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

Method findVariableTypeInBase

lib/symboldatabase.cpp:5673–5693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5671//---------------------------------------------------------------------------
5672
5673const Type* SymbolDatabase::findVariableTypeInBase(const Scope* scope, const Token* typeTok)
5674{
5675 if (scope && scope->definedType && !scope->definedType->derivedFrom.empty()) {
5676 const std::vector<Type::BaseInfo> &derivedFrom = scope->definedType->derivedFrom;
5677 for (const Type::BaseInfo & i : derivedFrom) {
5678 const Type *base = i.type;
5679 if (base && base->classScope) {
5680 if (base->classScope == scope)
5681 return nullptr;
5682 const Type * type = base->classScope->findType(typeTok->str());
5683 if (type)
5684 return type;
5685 type = findVariableTypeInBase(base->classScope, typeTok);
5686 if (type)
5687 return type;
5688 }
5689 }
5690 }
5691
5692 return nullptr;
5693}
5694
5695//---------------------------------------------------------------------------
5696

Callers

nothing calls this directly

Calls 3

findTypeMethod · 0.80
emptyMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected