| 555 | } |
| 556 | |
| 557 | QList<ClangProblem::Ptr> ParseSession::createRequestedHereProblems(int indexInTU, CXDiagnostic diagnostic, CXFile file) const |
| 558 | { |
| 559 | QList<ClangProblem::Ptr> results; |
| 560 | |
| 561 | auto childDiagnostics = clang_getChildDiagnostics(diagnostic); |
| 562 | auto numChildDiagnostics = clang_getNumDiagnosticsInSet(childDiagnostics); |
| 563 | for (uint j = 0; j < numChildDiagnostics; ++j) { |
| 564 | auto childDiagnostic = clang_getDiagnosticInSet(childDiagnostics, j); |
| 565 | CXSourceLocation childLocation = clang_getDiagnosticLocation(childDiagnostic); |
| 566 | CXFile childDiagnosticFile; |
| 567 | clang_getFileLocation(childLocation, &childDiagnosticFile, nullptr, nullptr, nullptr); |
| 568 | if (childDiagnosticFile == file) { |
| 569 | QString description = ClangString(clang_getDiagnosticSpelling(childDiagnostic)).toString(); |
| 570 | if (description.endsWith(QLatin1String("requested here"))) { |
| 571 | // Note: Using the index j here assumes a 1:1 mapping from clang child diagnostics to KDevelop |
| 572 | // problem diagnostics (i.e., child problems). If we wanted to avoid making this assumption, we'd have |
| 573 | // to use ClangDiagnosticEvaluator::createProblem() first and then search within its |
| 574 | // child problems to find the correct index. |
| 575 | results << createExternalProblem(indexInTU, diagnostic, ki18n("Requested here: %1"), j); |
| 576 | } |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | return results; |
| 581 | } |
| 582 | |
| 583 | QList<ProblemPointer> ParseSession::problemsForFile(CXFile file) const |
| 584 | { |
nothing calls this directly
no test coverage detected