MCPcopy Create free account
hub / github.com/KDE/kdevelop / overridden

Method overridden

kdevplatform/language/duchain/duchainutils.cpp:575–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

573}
574
575Declaration* DUChainUtils::overridden(const Declaration* decl) {
576 const auto* classFunDecl = dynamic_cast<const ClassFunctionDeclaration*>(decl);
577 if(!classFunDecl || !classFunDecl->isVirtual())
578 return nullptr;
579
580 QList<Declaration*> decls;
581
582 const auto importedParentContexts = decl->context()->importedParentContexts();
583 for (const DUContext::Import &import : importedParentContexts) {
584 DUContext* ctx = import.context(decl->topContext());
585 if(ctx)
586 decls += ctx->findDeclarations(QualifiedIdentifier(decl->identifier()),
587 CursorInRevision::invalid(), decl->abstractType(), decl->topContext(), DUContext::DontSearchInParent);
588 }
589
590 auto it = std::find_if(decls.constBegin(), decls.constEnd(), [&](Declaration* found) {
591 const auto* foundClassFunDecl = dynamic_cast<const ClassFunctionDeclaration*>(found);
592 return (foundClassFunDecl && foundClassFunDecl->isVirtual());
593 });
594
595 return (it != decls.constEnd()) ? *it : nullptr;
596}
597
598DUContext* DUChainUtils::functionContext(Declaration* decl) {
599 DUContext* functionContext = decl->internalContext();

Callers

nothing calls this directly

Calls 11

isVirtualMethod · 0.80
findDeclarationsMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
QualifiedIdentifierClass · 0.70
invalidFunction · 0.50
contextMethod · 0.45
topContextMethod · 0.45
identifierMethod · 0.45
abstractTypeMethod · 0.45

Tested by

no test coverage detected