| 533 | } |
| 534 | |
| 535 | static 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 | |
| 549 | bool DUChainUtils::contextHasUse(DUContext* context, Declaration* declaration) { |
| 550 | return hasUse(context, context->topContext()->indexForUsedDeclaration(declaration, false)); |
no test coverage detected