| 24 | namespace ClangIntegration { |
| 25 | |
| 26 | KTextEditor::Range DUChainUtils::functionSignatureRange(const Declaration* decl) |
| 27 | { |
| 28 | if (!decl->isFunctionDeclaration()) { |
| 29 | qCWarning(KDEV_CLANG) << "Invalid declaration:" << decl; |
| 30 | return {}; |
| 31 | } |
| 32 | |
| 33 | auto functionContext = decl->internalContext(); |
| 34 | Q_ASSERT(functionContext); |
| 35 | auto childContexts = functionContext->childContexts(); |
| 36 | if (childContexts.isEmpty()) { |
| 37 | return functionContext->rangeInCurrentRevision(); |
| 38 | } |
| 39 | |
| 40 | const auto start = functionContext->rangeInCurrentRevision().start(); |
| 41 | const auto end = childContexts[0]->rangeInCurrentRevision().start(); |
| 42 | return {start, end}; |
| 43 | } |
| 44 | |
| 45 | void DUChainUtils::registerDUChainItems() |
| 46 | { |
nothing calls this directly
no test coverage detected