2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2018 Sergey Morozov
|
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
|
2018-07-30 21:42:47 +03:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-07-17 08:44:12 +02:00
|
|
|
#include <utils/id.h>
|
2018-07-30 21:42:47 +03:00
|
|
|
|
2020-11-12 10:05:19 +01:00
|
|
|
#include <QFutureInterface>
|
2018-07-30 21:42:47 +03:00
|
|
|
#include <QPointer>
|
|
|
|
|
#include <QRegularExpression>
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
namespace Utils {
|
2019-05-28 13:49:26 +02:00
|
|
|
class FilePath;
|
2019-12-17 14:07:53 +01:00
|
|
|
using FilePaths = QList<FilePath>;
|
2023-01-09 18:08:30 +01:00
|
|
|
} // Utils
|
2018-07-30 21:42:47 +03:00
|
|
|
|
2023-01-09 18:08:30 +01:00
|
|
|
namespace CppEditor { class ProjectPart; }
|
2018-07-30 21:42:47 +03:00
|
|
|
|
2023-01-09 18:08:30 +01:00
|
|
|
namespace ProjectExplorer { class Project; }
|
2018-07-30 21:42:47 +03:00
|
|
|
|
2023-01-09 18:08:30 +01:00
|
|
|
namespace Cppcheck::Internal {
|
2018-07-30 21:42:47 +03:00
|
|
|
|
|
|
|
|
class CppcheckRunner;
|
2019-11-03 23:00:16 +03:00
|
|
|
class CppcheckDiagnosticManager;
|
2018-07-30 21:42:47 +03:00
|
|
|
|
|
|
|
|
class CppcheckTool final : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2023-07-17 08:44:12 +02:00
|
|
|
CppcheckTool(CppcheckDiagnosticManager &manager, const Utils::Id &progressId);
|
2018-07-30 21:42:47 +03:00
|
|
|
~CppcheckTool() override;
|
|
|
|
|
|
2023-05-15 18:00:42 +02:00
|
|
|
void updateOptions();
|
2018-07-30 21:42:47 +03:00
|
|
|
void setProject(ProjectExplorer::Project *project);
|
2019-12-17 14:07:53 +01:00
|
|
|
void check(const Utils::FilePaths &files);
|
|
|
|
|
void stop(const Utils::FilePaths &files);
|
2018-07-30 21:42:47 +03:00
|
|
|
|
|
|
|
|
void startParsing();
|
|
|
|
|
void parseOutputLine(const QString &line);
|
|
|
|
|
void parseErrorLine(const QString &line);
|
|
|
|
|
void finishParsing();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void updateArguments();
|
2021-08-30 10:58:08 +02:00
|
|
|
void addToQueue(const Utils::FilePaths &files, const CppEditor::ProjectPart &part);
|
|
|
|
|
QStringList additionalArguments(const CppEditor::ProjectPart &part) const;
|
2018-07-30 21:42:47 +03:00
|
|
|
|
2019-11-03 23:00:16 +03:00
|
|
|
CppcheckDiagnosticManager &m_manager;
|
2018-07-30 21:42:47 +03:00
|
|
|
QPointer<ProjectExplorer::Project> m_project;
|
|
|
|
|
std::unique_ptr<CppcheckRunner> m_runner;
|
|
|
|
|
std::unique_ptr<QFutureInterface<void>> m_progress;
|
|
|
|
|
QHash<QString, QString> m_cachedAdditionalArguments;
|
2020-07-13 11:33:34 +02:00
|
|
|
QVector<QRegularExpression> m_filters;
|
2018-07-30 21:42:47 +03:00
|
|
|
QRegularExpression m_progressRegexp;
|
|
|
|
|
QRegularExpression m_messageRegexp;
|
2020-06-26 13:59:38 +02:00
|
|
|
Utils::Id m_progressId;
|
2018-07-30 21:42:47 +03:00
|
|
|
};
|
|
|
|
|
|
2023-01-09 18:08:30 +01:00
|
|
|
} // Cppcheck::Internal
|