| 573 | } |
| 574 | |
| 575 | Declaration* 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 | |
| 598 | DUContext* DUChainUtils::functionContext(Declaration* decl) { |
| 599 | DUContext* functionContext = decl->internalContext(); |
nothing calls this directly
no test coverage detected