2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2020 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2020-07-22 14:52:06 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "clangfileinfo.h"
|
2020-08-25 06:18:26 +02:00
|
|
|
#include "clangtoolsdiagnostic.h"
|
2020-10-01 14:39:21 +02:00
|
|
|
#include "clangtoolsprojectsettings.h"
|
2020-07-22 14:52:06 +02:00
|
|
|
|
2023-01-11 20:15:33 +01:00
|
|
|
#include <utils/filepath.h>
|
2020-07-22 14:52:06 +02:00
|
|
|
#include <utils/temporarydirectory.h>
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
|
|
namespace Core { class IDocument; }
|
2020-08-25 06:18:26 +02:00
|
|
|
namespace TextEditor { class TextEditorWidget; }
|
2023-01-11 23:48:53 +01:00
|
|
|
namespace Utils { class TaskTree; }
|
2020-07-22 14:52:06 +02:00
|
|
|
|
|
|
|
|
namespace ClangTools {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2023-01-12 12:22:21 +02:00
|
|
|
struct AnalyzeOutputData;
|
2020-07-22 14:52:06 +02:00
|
|
|
class DiagnosticMark;
|
|
|
|
|
|
|
|
|
|
class DocumentClangToolRunner : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
DocumentClangToolRunner(Core::IDocument *doc);
|
|
|
|
|
~DocumentClangToolRunner();
|
|
|
|
|
|
2020-08-25 06:18:26 +02:00
|
|
|
Utils::FilePath filePath() const;
|
|
|
|
|
Diagnostics diagnosticsAtLine(int lineNumber) const;
|
|
|
|
|
|
2020-07-22 14:52:06 +02:00
|
|
|
private:
|
|
|
|
|
void scheduleRun();
|
|
|
|
|
void run();
|
|
|
|
|
|
2023-01-11 15:32:46 +01:00
|
|
|
void onDone(const AnalyzeOutputData &output);
|
2020-07-22 14:52:06 +02:00
|
|
|
void finalize();
|
|
|
|
|
|
2020-10-01 14:39:21 +02:00
|
|
|
bool isSuppressed(const Diagnostic &diagnostic) const;
|
2020-08-25 06:18:26 +02:00
|
|
|
|
2020-07-22 14:52:06 +02:00
|
|
|
QTimer m_runTimer;
|
|
|
|
|
Core::IDocument *m_document = nullptr;
|
|
|
|
|
Utils::TemporaryDirectory m_temporaryDir;
|
|
|
|
|
QList<DiagnosticMark *> m_marks;
|
|
|
|
|
FileInfo m_fileInfo;
|
|
|
|
|
QMetaObject::Connection m_projectSettingsUpdate;
|
2020-11-25 14:54:19 +01:00
|
|
|
QList<QPointer<TextEditor::TextEditorWidget>> m_editorsWithMarkers;
|
2020-10-01 14:39:21 +02:00
|
|
|
SuppressedDiagnosticsList m_suppressed;
|
|
|
|
|
Utils::FilePath m_lastProjectDirectory;
|
2023-01-11 23:48:53 +01:00
|
|
|
std::unique_ptr<Utils::TaskTree> m_taskTree;
|
2020-07-22 14:52:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace ClangTools
|