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

Method createExternalProblem

plugins/clang/duchain/parsesession.cpp:521–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521ClangProblem::Ptr ParseSession::createExternalProblem(int indexInTU,
522 CXDiagnostic diagnostic,
523 const KLocalizedString& descriptionTemplate,
524 int childProblemFinalLocationIndex) const
525{
526 // Make a copy of the original (cached) problem since it is modified later
527 auto problem = ClangProblem::Ptr(new ClangProblem(*getOrCreateProblem(indexInTU, diagnostic)));
528
529 // Insert a copy of the parent problem (without child problems) as the first
530 // child problem to preserve its location.
531 auto* problemCopy = new ClangProblem();
532 problemCopy->setSource(problem->source());
533 problemCopy->setFinalLocation(problem->finalLocation());
534 problemCopy->setFinalLocationMode(problem->finalLocationMode());
535 problemCopy->setDescription(problem->description());
536 problemCopy->setExplanation(problem->explanation());
537 problemCopy->setSeverity(problem->severity());
538
539 auto childProblems = problem->diagnostics();
540 childProblems.prepend(IProblem::Ptr(problemCopy));
541 problem->setDiagnostics(childProblems);
542
543 // Override the problem's finalLocation with that of the child problem in this document.
544 // This is required to make the problem show up in the problem reporter for this
545 // file, since it filters by finalLocation. It will also lead the user to the correct
546 // location when clicking the problem and cause proper error highlighting.
547 int index = (childProblemFinalLocationIndex >= 0) ?
548 (1 + childProblemFinalLocationIndex) :
549 (childProblems.size() - 1);
550 problem->setFinalLocation(childProblems[index]->finalLocation());
551
552 problem->setDescription(descriptionTemplate.subs(problem->description()).toString());
553
554 return problem;
555}
556
557QList<ClangProblem::Ptr> ParseSession::createRequestedHereProblems(int indexInTU, CXDiagnostic diagnostic, CXFile file) const
558{

Callers

nothing calls this directly

Calls 15

setSourceMethod · 0.45
sourceMethod · 0.45
setFinalLocationMethod · 0.45
finalLocationMethod · 0.45
setFinalLocationModeMethod · 0.45
finalLocationModeMethod · 0.45
setDescriptionMethod · 0.45
descriptionMethod · 0.45
setExplanationMethod · 0.45
explanationMethod · 0.45
setSeverityMethod · 0.45
severityMethod · 0.45

Tested by

no test coverage detected