forked from qt-creator/qt-creator
DocumentClangToolRunner: Reuse TaskTreeRunner
Change-Id: I6db7f83de1bcc22d668e671ea006830c470c9160 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -57,6 +57,7 @@ DocumentClangToolRunner::DocumentClangToolRunner(IDocument *document)
|
|||||||
connect(ClangToolsSettings::instance(), &ClangToolsSettings::changed,
|
connect(ClangToolsSettings::instance(), &ClangToolsSettings::changed,
|
||||||
this, &DocumentClangToolRunner::scheduleRun);
|
this, &DocumentClangToolRunner::scheduleRun);
|
||||||
connect(&m_runTimer, &QTimer::timeout, this, &DocumentClangToolRunner::run);
|
connect(&m_runTimer, &QTimer::timeout, this, &DocumentClangToolRunner::run);
|
||||||
|
connect(&m_taskTreeRunner, &TaskTreeRunner::done, this, &DocumentClangToolRunner::finalize);
|
||||||
run();
|
run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +156,7 @@ void DocumentClangToolRunner::run()
|
|||||||
{
|
{
|
||||||
if (m_projectSettingsUpdate)
|
if (m_projectSettingsUpdate)
|
||||||
disconnect(m_projectSettingsUpdate);
|
disconnect(m_projectSettingsUpdate);
|
||||||
m_taskTree.reset();
|
m_taskTreeRunner.reset();
|
||||||
QScopeGuard cleanup([this] { finalize(); });
|
QScopeGuard cleanup([this] { finalize(); });
|
||||||
|
|
||||||
auto isEditorForCurrentDocument = [this](const IEditor *editor) {
|
auto isEditorForCurrentDocument = [this](const IEditor *editor) {
|
||||||
@@ -223,9 +224,7 @@ void DocumentClangToolRunner::run()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
cleanup.dismiss();
|
cleanup.dismiss();
|
||||||
m_taskTree.reset(new TaskTree(tasks));
|
m_taskTreeRunner.start(tasks);
|
||||||
connect(m_taskTree.get(), &TaskTree::done, this, &DocumentClangToolRunner::finalize);
|
|
||||||
m_taskTree->start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void updateLocation(Debugger::DiagnosticLocation &location)
|
static void updateLocation(Debugger::DiagnosticLocation &location)
|
||||||
@@ -301,8 +300,6 @@ void DocumentClangToolRunner::onDone(const AnalyzeOutputData &output)
|
|||||||
|
|
||||||
void DocumentClangToolRunner::finalize()
|
void DocumentClangToolRunner::finalize()
|
||||||
{
|
{
|
||||||
if (m_taskTree)
|
|
||||||
m_taskTree.release()->deleteLater();
|
|
||||||
// remove all disabled marks
|
// remove all disabled marks
|
||||||
const auto [newMarks, toDelete] = Utils::partition(m_marks, &DiagnosticMark::enabled);
|
const auto [newMarks, toDelete] = Utils::partition(m_marks, &DiagnosticMark::enabled);
|
||||||
m_marks = newMarks;
|
m_marks = newMarks;
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#include "clangtoolsdiagnostic.h"
|
#include "clangtoolsdiagnostic.h"
|
||||||
#include "clangtoolsprojectsettings.h"
|
#include "clangtoolsprojectsettings.h"
|
||||||
|
|
||||||
|
#include <solutions/tasking/tasktreerunner.h>
|
||||||
|
|
||||||
#include <utils/filepath.h>
|
#include <utils/filepath.h>
|
||||||
#include <utils/temporarydirectory.h>
|
#include <utils/temporarydirectory.h>
|
||||||
|
|
||||||
@@ -14,7 +16,6 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
namespace Core { class IDocument; }
|
namespace Core { class IDocument; }
|
||||||
namespace Tasking { class TaskTree; }
|
|
||||||
namespace TextEditor { class TextEditorWidget; }
|
namespace TextEditor { class TextEditorWidget; }
|
||||||
|
|
||||||
namespace ClangTools {
|
namespace ClangTools {
|
||||||
@@ -51,7 +52,7 @@ private:
|
|||||||
QList<QPointer<TextEditor::TextEditorWidget>> m_editorsWithMarkers;
|
QList<QPointer<TextEditor::TextEditorWidget>> m_editorsWithMarkers;
|
||||||
SuppressedDiagnosticsList m_suppressed;
|
SuppressedDiagnosticsList m_suppressed;
|
||||||
Utils::FilePath m_lastProjectDirectory;
|
Utils::FilePath m_lastProjectDirectory;
|
||||||
std::unique_ptr<Tasking::TaskTree> m_taskTree;
|
Tasking::TaskTreeRunner m_taskTreeRunner;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user