ClangTools: Get rid of OutputFileFormat enum

This enum contains only one value now, so it's no-op.

Amends 9fc2fda07e

Change-Id: Ifa144dafb6155db93c06e3faecc40e38e464dac0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-01-06 12:23:18 +01:00
parent b7731b58a8
commit bf864ff371
7 changed files with 6 additions and 32 deletions

View File

@@ -3,7 +3,6 @@
#include "clangtidyclazyrunner.h"
#include "clangtoolssettings.h"
#include "clangtoolsutils.h"
#include <coreplugin/icore.h>
@@ -16,7 +15,6 @@
#include <utils/qtcprocess.h>
#include <QDebug>
#include <QDir>
#include <QLoggingCategory>
static Q_LOGGING_CATEGORY(LOG, "qtc.clangtools.runner", QtWarningMsg)
@@ -69,7 +67,6 @@ ClangTidyRunner::ClangTidyRunner(const ClangDiagnosticConfig &config, QObject *p
: ClangToolRunner(parent)
{
setName(tr("Clang-Tidy"));
setOutputFileFormat(OutputFileFormat::Yaml);
setExecutable(clangTidyExecutable());
setArgsCreator([this, config](const QStringList &baseOptions) {
return QStringList() << tidyChecksArguments(config)
@@ -83,7 +80,6 @@ ClazyStandaloneRunner::ClazyStandaloneRunner(const ClangDiagnosticConfig &config
: ClangToolRunner(parent)
{
setName(tr("Clazy"));
setOutputFileFormat(OutputFileFormat::Yaml);
setExecutable(clazyStandaloneExecutable());
setArgsCreator([this, config](const QStringList &baseOptions) {
return QStringList() << clazyChecksArguments(config)

View File

@@ -51,10 +51,8 @@
#include <QAction>
#include <QCheckBox>
#include <QDesktopServices>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QLabel>
#include <QSortFilterProxyModel>
#include <QToolButton>
using namespace Core;
@@ -681,22 +679,15 @@ void ClangTool::startTool(ClangTool::FileSelection fileSelection,
ProjectExplorerPlugin::startRunControl(m_runControl);
}
Diagnostics ClangTool::read(OutputFileFormat outputFileFormat,
const QString &logFilePath,
Diagnostics ClangTool::read(const QString &logFilePath,
const QSet<FilePath> &projectFiles,
QString *errorMessage) const
{
const auto acceptFromFilePath = [projectFiles](const Utils::FilePath &filePath) {
return projectFiles.contains(filePath);
};
if (outputFileFormat == OutputFileFormat::Yaml) {
return readExportedDiagnostics(Utils::FilePath::fromString(logFilePath),
acceptFromFilePath,
errorMessage);
}
return {};
return readExportedDiagnostics(Utils::FilePath::fromString(logFilePath),
acceptFromFilePath, errorMessage);
}
FileInfos ClangTool::collectFileInfos(Project *project, FileSelection fileSelection)

View File

@@ -6,7 +6,6 @@
#include "clangfileinfo.h"
#include "clangtoolsdiagnostic.h"
#include "clangtoolsdiagnosticmodel.h"
#include "clangtoolslogfilereader.h"
#include <debugger/debuggermainwindow.h>
@@ -66,8 +65,7 @@ public:
const RunSettings &runSettings,
const CppEditor::ClangDiagnosticConfig &diagnosticConfig);
Diagnostics read(OutputFileFormat outputFileFormat,
const QString &logFilePath,
Diagnostics read(const QString &logFilePath,
const QSet<Utils::FilePath> &projectFiles,
QString *errorMessage) const;

View File

@@ -5,8 +5,6 @@
#include "clangtidyclazyrunner.h"
#include "clangtool.h"
#include "clangtoolslogfilereader.h"
#include "clangtoolsprojectsettings.h"
#include "clangtoolssettings.h"
#include "clangtoolsutils.h"
#include "executableinfo.h"
@@ -323,10 +321,7 @@ void ClangToolRunWorker::onRunnerFinishedWithSuccess(ClangToolRunner *runner,
emit runnerFinished();
QString errorMessage;
const Diagnostics diagnostics = m_tool->read(runner->outputFileFormat(),
outputFilePath,
m_projectFiles,
&errorMessage);
const Diagnostics diagnostics = m_tool->read(outputFilePath, m_projectFiles, &errorMessage);
if (!errorMessage.isEmpty()) {
m_filesAnalyzed.remove(filePath);

View File

@@ -3,8 +3,6 @@
#pragma once
#include "clangtoolslogfilereader.h"
#include <utils/commandline.h>
#include <utils/qtcprocess.h>
@@ -26,12 +24,10 @@ public:
void setName(const QString &name) { m_name = name; }
void setExecutable(const Utils::FilePath &executable) { m_executable = executable; }
void setArgsCreator(const ArgsCreator &argsCreator) { m_argsCreator = argsCreator; }
void setOutputFileFormat(const OutputFileFormat &format) { m_outputFileFormat = format; }
void setVFSOverlay(const QString overlayFilePath) { m_overlayFilePath = overlayFilePath; }
QString name() const { return m_name; }
Utils::FilePath executable() const { return m_executable; }
OutputFileFormat outputFileFormat() const { return m_outputFileFormat; }
QString fileToAnalyze() const { return m_fileToAnalyze; }
QString outputFilePath() const { return m_outputFilePath; }
QStringList mainToolArguments() const;
@@ -62,7 +58,6 @@ private:
QString m_name;
Utils::FilePath m_executable;
ArgsCreator m_argsCreator;
OutputFileFormat m_outputFileFormat = OutputFileFormat::Yaml;
QString m_fileToAnalyze;
QString m_outputFilePath;

View File

@@ -13,8 +13,6 @@ namespace Utils { class FilePath; }
namespace ClangTools {
namespace Internal {
enum class OutputFileFormat { Yaml };
using AcceptDiagsFromFilePath = std::function<bool(const Utils::FilePath &)>;
// Reads diagnostics generated by "clang-tidy/clazy-standalone -export-fixes=path/to/file"

View File

@@ -7,6 +7,7 @@
#include "clangtidyclazyrunner.h"
#include "clangtoolruncontrol.h"
#include "clangtoolsconstants.h"
#include "clangtoolslogfilereader.h"
#include "clangtoolsprojectsettings.h"
#include "clangtoolsutils.h"
#include "diagnosticmark.h"