2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 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
|
2018-01-17 15:08:30 +01:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-01-11 15:32:46 +01:00
|
|
|
#include "clangfileinfo.h"
|
2023-01-11 01:07:33 +01:00
|
|
|
|
2023-01-10 17:51:34 +01:00
|
|
|
#include <cppeditor/clangdiagnosticconfig.h>
|
|
|
|
|
|
|
|
|
|
#include <utils/environment.h>
|
2018-01-17 15:08:30 +01:00
|
|
|
|
2023-01-11 23:48:53 +01:00
|
|
|
namespace Utils::Tasking { class TaskItem; }
|
2019-08-29 14:25:49 +02:00
|
|
|
|
2018-01-17 15:08:30 +01:00
|
|
|
namespace ClangTools {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2023-01-11 15:32:46 +01:00
|
|
|
struct AnalyzeUnit {
|
|
|
|
|
AnalyzeUnit(const FileInfo &fileInfo,
|
|
|
|
|
const Utils::FilePath &clangResourceDir,
|
|
|
|
|
const QString &clangVersion);
|
|
|
|
|
|
|
|
|
|
QString file;
|
|
|
|
|
QStringList arguments; // without file itself and "-o somePath"
|
|
|
|
|
};
|
|
|
|
|
using AnalyzeUnits = QList<AnalyzeUnit>;
|
|
|
|
|
|
2023-01-10 17:51:34 +01:00
|
|
|
struct AnalyzeInputData
|
|
|
|
|
{
|
|
|
|
|
CppEditor::ClangToolType tool = CppEditor::ClangToolType::Tidy;
|
|
|
|
|
CppEditor::ClangDiagnosticConfig config;
|
|
|
|
|
Utils::FilePath outputDirPath;
|
|
|
|
|
Utils::Environment environment;
|
2023-01-11 01:07:33 +01:00
|
|
|
AnalyzeUnit unit;
|
2023-01-10 18:23:24 +01:00
|
|
|
QString overlayFilePath = {};
|
2023-01-10 17:51:34 +01:00
|
|
|
};
|
2023-01-11 15:32:46 +01:00
|
|
|
|
|
|
|
|
struct AnalyzeOutputData
|
|
|
|
|
{
|
|
|
|
|
bool success = true;
|
|
|
|
|
QString fileToAnalyze;
|
|
|
|
|
QString outputFilePath;
|
2023-01-12 02:12:33 +01:00
|
|
|
CppEditor::ClangToolType toolType;
|
2023-01-11 15:32:46 +01:00
|
|
|
QString errorMessage = {};
|
|
|
|
|
QString errorDetails = {};
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-11 23:48:53 +01:00
|
|
|
using AnalyzeSetupHandler = std::function<bool()>;
|
|
|
|
|
using AnalyzeOutputHandler = std::function<void(const AnalyzeOutputData &)>;
|
2018-01-17 15:08:30 +01:00
|
|
|
|
2023-01-11 23:48:53 +01:00
|
|
|
Utils::Tasking::TaskItem clangToolTask(const AnalyzeInputData &input,
|
|
|
|
|
const AnalyzeSetupHandler &setupHandler,
|
|
|
|
|
const AnalyzeOutputHandler &outputHandler);
|
2018-01-17 15:08:30 +01:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace ClangTools
|