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

Function countUses

kdevplatform/language/duchain/duchainutils.cpp:553–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551}
552
553static uint countUses(DUContext* context, int usedDeclarationIndex) {
554 if(usedDeclarationIndex == std::numeric_limits<int>::max())
555 return 0;
556
557 uint ret = 0;
558
559 for(int a = 0; a < context->usesCount(); ++a)
560 if(context->uses()[a].m_declarationIndex == usedDeclarationIndex)
561 ++ret;
562
563 const auto childContexts = context->childContexts();
564 for (DUContext* child : childContexts) {
565 ret += countUses(child, usedDeclarationIndex);
566 }
567
568 return ret;
569}
570
571uint DUChainUtils::contextCountUses(DUContext* context, Declaration* declaration) {
572 return countUses(context, context->topContext()->indexForUsedDeclaration(declaration, false));

Callers 1

contextCountUsesMethod · 0.70

Calls 3

childContextsMethod · 0.80
usesCountMethod · 0.45
usesMethod · 0.45

Tested by

no test coverage detected