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

Function hasUse

kdevplatform/language/duchain/duchainutils.cpp:535–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

533}
534
535static bool hasUse(DUContext* context, int usedDeclarationIndex) {
536 if(usedDeclarationIndex == std::numeric_limits<int>::max())
537 return false;
538
539 for(int a = 0; a < context->usesCount(); ++a)
540 if(context->uses()[a].m_declarationIndex == usedDeclarationIndex)
541 return true;
542
543 const auto childContexts = context->childContexts();
544 return std::any_of(childContexts.begin(), childContexts.end(), [&](DUContext* child) {
545 return hasUse(child, usedDeclarationIndex);
546 });
547}
548
549bool DUChainUtils::contextHasUse(DUContext* context, Declaration* declaration) {
550 return hasUse(context, context->topContext()->indexForUsedDeclaration(declaration, false));

Callers 1

contextHasUseMethod · 0.85

Calls 5

childContextsMethod · 0.80
usesCountMethod · 0.45
usesMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected