| 48 | } |
| 49 | |
| 50 | void ProblemCollector::addProblem(const Problem &problem) |
| 51 | { |
| 52 | auto self = instance(); |
| 53 | |
| 54 | auto i = std::find(self->m_problems.begin(), self->m_problems.end(), problem); |
| 55 | if (i != self->m_problems.end()) { |
| 56 | // if an already reported problem is reported a second time, but with a different source location, |
| 57 | // then the problem involves multiple source locations. So let's keep all of them. |
| 58 | std::remove_copy_if(problem.locations.begin(), problem.locations.end(), std::back_inserter(i->locations), |
| 59 | [&](const SourceLocation &loc) { return i->locations.contains(loc); }); |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | emit self->aboutToAddProblem(self->m_problems.size()); |
| 64 | self->m_problems.push_back(problem); |
| 65 | emit self->problemAdded(); |
| 66 | } |
| 67 | void ProblemCollector::removeProblem(const QString &problemId) |
| 68 | { |
| 69 | auto self = instance(); |