2020-07-22 14:52:06 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2020 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "documentclangtoolrunner.h"
|
|
|
|
|
|
|
|
|
|
#include "clangfileinfo.h"
|
2020-08-25 06:18:26 +02:00
|
|
|
#include "clangfixitsrefactoringchanges.h"
|
2020-07-22 14:52:06 +02:00
|
|
|
#include "clangtidyclazyrunner.h"
|
|
|
|
|
#include "clangtoolruncontrol.h"
|
2020-08-25 06:18:26 +02:00
|
|
|
#include "clangtoolsconstants.h"
|
2020-07-22 14:52:06 +02:00
|
|
|
#include "clangtoolsprojectsettings.h"
|
|
|
|
|
#include "clangtoolsutils.h"
|
|
|
|
|
#include "diagnosticmark.h"
|
|
|
|
|
#include "executableinfo.h"
|
|
|
|
|
#include "virtualfilesystemoverlay.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/documentmanager.h>
|
|
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
|
|
|
|
#include <coreplugin/editormanager/ieditor.h>
|
|
|
|
|
#include <cpptools/cppmodelmanager.h>
|
|
|
|
|
#include <projectexplorer/buildtargettype.h>
|
|
|
|
|
#include <projectexplorer/session.h>
|
|
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
#include <texteditor/textdocument.h>
|
2020-08-25 06:18:26 +02:00
|
|
|
#include <texteditor/texteditor.h>
|
2020-07-22 14:52:06 +02:00
|
|
|
#include <texteditor/textmark.h>
|
|
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
#include <utils/utilsicons.h>
|
|
|
|
|
|
|
|
|
|
#include <QLoggingCategory>
|
|
|
|
|
|
|
|
|
|
static Q_LOGGING_CATEGORY(LOG, "qtc.clangtools.cftr", QtWarningMsg)
|
|
|
|
|
|
|
|
|
|
namespace ClangTools {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
DocumentClangToolRunner::DocumentClangToolRunner(Core::IDocument *document)
|
|
|
|
|
: QObject(document)
|
|
|
|
|
, m_document(document)
|
|
|
|
|
, m_temporaryDir("clangtools-single-XXXXXX")
|
|
|
|
|
{
|
|
|
|
|
using namespace CppTools;
|
|
|
|
|
|
|
|
|
|
m_runTimer.setInterval(500);
|
|
|
|
|
m_runTimer.setSingleShot(true);
|
|
|
|
|
|
|
|
|
|
connect(m_document,
|
|
|
|
|
&Core::IDocument::contentsChanged,
|
|
|
|
|
this,
|
|
|
|
|
&DocumentClangToolRunner::scheduleRun);
|
|
|
|
|
connect(CppModelManager::instance(),
|
|
|
|
|
&CppModelManager::projectPartsUpdated,
|
|
|
|
|
this,
|
|
|
|
|
&DocumentClangToolRunner::scheduleRun);
|
|
|
|
|
connect(ClangToolsSettings::instance(),
|
|
|
|
|
&ClangToolsSettings::changed,
|
|
|
|
|
this,
|
|
|
|
|
&DocumentClangToolRunner::scheduleRun);
|
|
|
|
|
connect(&m_runTimer, &QTimer::timeout, this, &DocumentClangToolRunner::run);
|
|
|
|
|
run();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DocumentClangToolRunner::~DocumentClangToolRunner()
|
|
|
|
|
{
|
|
|
|
|
cancel();
|
|
|
|
|
qDeleteAll(m_marks);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-25 06:18:26 +02:00
|
|
|
Utils::FilePath DocumentClangToolRunner::filePath() const
|
|
|
|
|
{
|
|
|
|
|
return m_document->filePath();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Diagnostics DocumentClangToolRunner::diagnosticsAtLine(int lineNumber) const
|
|
|
|
|
{
|
|
|
|
|
Diagnostics diagnostics;
|
|
|
|
|
if (auto textDocument = qobject_cast<TextEditor::TextDocument *>(m_document)) {
|
|
|
|
|
for (auto mark : textDocument->marksAt(lineNumber)) {
|
|
|
|
|
if (mark->category() == Constants::DIAGNOSTIC_MARK_ID)
|
|
|
|
|
diagnostics << static_cast<DiagnosticMark *>(mark)->diagnostic();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return diagnostics;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-25 14:54:19 +01:00
|
|
|
static void removeClangToolRefactorMarkers(TextEditor::TextEditorWidget *editor)
|
|
|
|
|
{
|
|
|
|
|
if (!editor)
|
|
|
|
|
return;
|
|
|
|
|
editor->setRefactorMarkers(
|
|
|
|
|
TextEditor::RefactorMarker::filterOutType(editor->refactorMarkers(),
|
|
|
|
|
Constants::CLANG_TOOL_FIXIT_AVAILABLE_MARKER_ID));
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-22 14:52:06 +02:00
|
|
|
void DocumentClangToolRunner::scheduleRun()
|
|
|
|
|
{
|
2021-02-16 20:44:17 +01:00
|
|
|
for (DiagnosticMark *mark : qAsConst(m_marks))
|
2020-07-22 14:52:06 +02:00
|
|
|
mark->disable();
|
2021-02-16 20:44:17 +01:00
|
|
|
for (TextEditor::TextEditorWidget *editor : qAsConst(m_editorsWithMarkers))
|
2020-11-25 14:54:19 +01:00
|
|
|
removeClangToolRefactorMarkers(editor);
|
2020-07-22 14:52:06 +02:00
|
|
|
m_runTimer.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ProjectExplorer::Project *findProject(const Utils::FilePath &file)
|
|
|
|
|
{
|
|
|
|
|
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::projectForFile(file);
|
|
|
|
|
return project ? project : ProjectExplorer::SessionManager::startupProject();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static VirtualFileSystemOverlay &vfso()
|
|
|
|
|
{
|
|
|
|
|
static VirtualFileSystemOverlay overlay("clangtools-vfso-XXXXXX");
|
|
|
|
|
return overlay;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static FileInfo getFileInfo(const Utils::FilePath &file, ProjectExplorer::Project *project)
|
|
|
|
|
{
|
|
|
|
|
CppTools::ProjectInfo projectInfo = CppTools::CppModelManager::instance()->projectInfo(project);
|
|
|
|
|
if (!projectInfo.isValid())
|
|
|
|
|
return {};
|
|
|
|
|
|
|
|
|
|
FileInfo candidate;
|
|
|
|
|
for (const CppTools::ProjectPart::Ptr &projectPart : projectInfo.projectParts()) {
|
|
|
|
|
QTC_ASSERT(projectPart, continue);
|
|
|
|
|
|
|
|
|
|
for (const CppTools::ProjectFile &projectFile : qAsConst(projectPart->files)) {
|
|
|
|
|
QTC_ASSERT(projectFile.kind != CppTools::ProjectFile::Unclassified, continue);
|
|
|
|
|
QTC_ASSERT(projectFile.kind != CppTools::ProjectFile::Unsupported, continue);
|
|
|
|
|
if (projectFile.path == CppTools::CppModelManager::configurationFileName())
|
|
|
|
|
continue;
|
2020-11-26 08:57:30 +01:00
|
|
|
const auto projectFilePath = Utils::FilePath::fromString(projectFile.path);
|
|
|
|
|
if (file != projectFilePath)
|
2020-07-22 14:52:06 +02:00
|
|
|
continue;
|
|
|
|
|
if (!projectFile.active)
|
|
|
|
|
continue;
|
2020-11-26 08:57:30 +01:00
|
|
|
// found the best candidate, early return
|
|
|
|
|
if (projectPart->buildTargetType != ProjectExplorer::BuildTargetType::Unknown)
|
|
|
|
|
return FileInfo(projectFilePath, projectFile.kind, projectPart);
|
|
|
|
|
// found something but keep looking for better candidates
|
|
|
|
|
if (candidate.projectPart.isNull())
|
|
|
|
|
candidate = FileInfo(projectFilePath, projectFile.kind, projectPart);
|
2020-07-22 14:52:06 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return candidate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Utils::Environment projectBuildEnvironment(ProjectExplorer::Project *project)
|
|
|
|
|
{
|
|
|
|
|
Utils::Environment env;
|
|
|
|
|
if (ProjectExplorer::Target *target = project->activeTarget()) {
|
|
|
|
|
if (ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration())
|
|
|
|
|
env = buildConfig->environment();
|
|
|
|
|
}
|
|
|
|
|
if (env.size() == 0)
|
|
|
|
|
env = Utils::Environment::systemEnvironment();
|
|
|
|
|
return env;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DocumentClangToolRunner::run()
|
|
|
|
|
{
|
|
|
|
|
cancel();
|
|
|
|
|
auto isEditorForCurrentDocument = [this](const Core::IEditor *editor) {
|
|
|
|
|
return editor->document() == m_document;
|
|
|
|
|
};
|
|
|
|
|
if (Utils::anyOf(Core::EditorManager::visibleEditors(), isEditorForCurrentDocument)) {
|
|
|
|
|
const Utils::FilePath filePath = m_document->filePath();
|
|
|
|
|
if (ProjectExplorer::Project *project = findProject(filePath)) {
|
|
|
|
|
m_fileInfo = getFileInfo(filePath, project);
|
|
|
|
|
if (m_fileInfo.file.exists()) {
|
|
|
|
|
const auto projectSettings = ClangToolsProjectSettings::getSettings(project);
|
|
|
|
|
|
|
|
|
|
const RunSettings &runSettings = projectSettings->useGlobalSettings()
|
|
|
|
|
? ClangToolsSettings::instance()->runSettings()
|
|
|
|
|
: projectSettings->runSettings();
|
2020-10-01 14:39:21 +02:00
|
|
|
|
|
|
|
|
m_suppressed = projectSettings->suppressedDiagnostics();
|
|
|
|
|
m_lastProjectDirectory = project->projectDirectory();
|
2020-07-22 14:52:06 +02:00
|
|
|
m_projectSettingsUpdate = connect(projectSettings.data(),
|
|
|
|
|
&ClangToolsProjectSettings::changed,
|
|
|
|
|
this,
|
|
|
|
|
&DocumentClangToolRunner::run);
|
|
|
|
|
|
|
|
|
|
if (runSettings.analyzeOpenFiles()) {
|
|
|
|
|
vfso().update();
|
|
|
|
|
|
|
|
|
|
CppTools::ClangDiagnosticConfig config = diagnosticConfig(
|
|
|
|
|
runSettings.diagnosticConfigId());
|
|
|
|
|
|
|
|
|
|
Utils::Environment env = projectBuildEnvironment(project);
|
|
|
|
|
if (config.isClangTidyEnabled()) {
|
|
|
|
|
m_runnerCreators << [this, env, config]() {
|
|
|
|
|
return createRunner<ClangTidyRunner>(config, env);
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-08-25 06:18:26 +02:00
|
|
|
if (config.isClazyEnabled()) {
|
2020-07-22 14:52:06 +02:00
|
|
|
m_runnerCreators << [this, env, config]() {
|
|
|
|
|
return createRunner<ClazyStandaloneRunner>(config, env);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
deleteLater();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
runNext();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QPair<Utils::FilePath, QString> getClangIncludeDirAndVersion(ClangToolRunner *runner)
|
|
|
|
|
{
|
|
|
|
|
static QMap<Utils::FilePath, QPair<Utils::FilePath, QString>> cache;
|
|
|
|
|
const Utils::FilePath tool = Utils::FilePath::fromString(runner->executable());
|
|
|
|
|
auto it = cache.find(tool);
|
|
|
|
|
if (it == cache.end())
|
|
|
|
|
it = cache.insert(tool, getClangIncludeDirAndVersion(tool));
|
|
|
|
|
return it.value();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DocumentClangToolRunner::runNext()
|
|
|
|
|
{
|
|
|
|
|
m_currentRunner.reset(m_runnerCreators.isEmpty() ? nullptr : m_runnerCreators.takeFirst()());
|
|
|
|
|
if (m_currentRunner) {
|
|
|
|
|
auto [clangIncludeDir, clangVersion] = getClangIncludeDirAndVersion(m_currentRunner.get());
|
|
|
|
|
qCDebug(LOG) << Q_FUNC_INFO << m_currentRunner->executable() << clangIncludeDir
|
|
|
|
|
<< clangVersion << m_fileInfo.file;
|
2021-01-06 09:14:21 +01:00
|
|
|
if (m_currentRunner->executable().isEmpty() || clangIncludeDir.isEmpty() || clangVersion.isEmpty()
|
2020-08-25 06:18:26 +02:00
|
|
|
|| (m_document->isModified() && !m_currentRunner->supportsVFSOverlay())) {
|
2020-07-22 14:52:06 +02:00
|
|
|
runNext();
|
2020-08-28 10:31:38 +02:00
|
|
|
} else {
|
|
|
|
|
AnalyzeUnit unit(m_fileInfo, clangIncludeDir, clangVersion);
|
|
|
|
|
QTC_ASSERT(Utils::FilePath::fromString(unit.file).exists(), runNext(); return;);
|
|
|
|
|
m_currentRunner->setVFSOverlay(vfso().overlayFilePath().toString());
|
|
|
|
|
if (!m_currentRunner->run(unit.file, unit.arguments))
|
|
|
|
|
runNext();
|
|
|
|
|
}
|
2020-07-22 14:52:06 +02:00
|
|
|
} else {
|
|
|
|
|
finalize();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-25 06:18:26 +02:00
|
|
|
static void updateLocation(Debugger::DiagnosticLocation &location)
|
|
|
|
|
{
|
2021-05-28 12:37:35 +02:00
|
|
|
location.filePath = vfso().originalFilePath(location.filePath);
|
2020-08-25 06:18:26 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-22 14:52:06 +02:00
|
|
|
void DocumentClangToolRunner::onSuccess()
|
|
|
|
|
{
|
|
|
|
|
QString errorMessage;
|
2020-08-25 06:18:26 +02:00
|
|
|
Utils::FilePath mappedPath = vfso().autoSavedFilePath(m_document);
|
2020-07-22 14:52:06 +02:00
|
|
|
Diagnostics diagnostics = readExportedDiagnostics(
|
|
|
|
|
Utils::FilePath::fromString(m_currentRunner->outputFilePath()),
|
|
|
|
|
[&](const Utils::FilePath &path) { return path == mappedPath; },
|
|
|
|
|
&errorMessage);
|
|
|
|
|
|
2020-08-25 06:18:26 +02:00
|
|
|
for (Diagnostic &diag : diagnostics) {
|
|
|
|
|
updateLocation(diag.location);
|
|
|
|
|
for (ExplainingStep &explainingStep : diag.explainingSteps) {
|
|
|
|
|
updateLocation(explainingStep.location);
|
|
|
|
|
for (Debugger::DiagnosticLocation &rangeLocation : explainingStep.ranges)
|
|
|
|
|
updateLocation(rangeLocation);
|
|
|
|
|
}
|
2020-07-22 14:52:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// remove outdated marks of the current runner
|
|
|
|
|
auto [toDelete, newMarks] = Utils::partition(m_marks, [this](DiagnosticMark *mark) {
|
|
|
|
|
return mark->source == m_currentRunner->name();
|
|
|
|
|
});
|
|
|
|
|
m_marks = newMarks;
|
|
|
|
|
qDeleteAll(toDelete);
|
|
|
|
|
|
2020-08-25 06:18:26 +02:00
|
|
|
auto doc = qobject_cast<TextEditor::TextDocument *>(m_document);
|
|
|
|
|
|
|
|
|
|
TextEditor::RefactorMarkers markers;
|
|
|
|
|
|
|
|
|
|
for (const Diagnostic &diagnostic : diagnostics) {
|
2020-10-01 14:39:21 +02:00
|
|
|
if (isSuppressed(diagnostic))
|
|
|
|
|
continue;
|
|
|
|
|
|
2020-07-22 14:52:06 +02:00
|
|
|
auto mark = new DiagnosticMark(diagnostic);
|
|
|
|
|
mark->source = m_currentRunner->name();
|
2020-08-25 06:18:26 +02:00
|
|
|
|
|
|
|
|
if (doc && Utils::anyOf(diagnostic.explainingSteps, &ExplainingStep::isFixIt)) {
|
|
|
|
|
TextEditor::RefactorMarker marker;
|
|
|
|
|
marker.tooltip = diagnostic.description;
|
|
|
|
|
QTextCursor cursor(doc->document());
|
|
|
|
|
cursor.setPosition(Utils::Text::positionInText(doc->document(),
|
|
|
|
|
diagnostic.location.line,
|
|
|
|
|
diagnostic.location.column));
|
|
|
|
|
cursor.movePosition(QTextCursor::EndOfLine);
|
|
|
|
|
marker.cursor = cursor;
|
|
|
|
|
marker.type = Constants::CLANG_TOOL_FIXIT_AVAILABLE_MARKER_ID;
|
|
|
|
|
marker.callback = [marker](TextEditor::TextEditorWidget *editor) {
|
|
|
|
|
editor->setTextCursor(marker.cursor);
|
|
|
|
|
editor->invokeAssist(TextEditor::QuickFix);
|
|
|
|
|
};
|
|
|
|
|
markers << marker;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_marks << mark;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto editor : TextEditor::BaseTextEditor::textEditorsForDocument(doc)) {
|
|
|
|
|
if (TextEditor::TextEditorWidget *widget = editor->editorWidget()) {
|
|
|
|
|
widget->setRefactorMarkers(markers + widget->refactorMarkers());
|
2020-11-25 14:54:19 +01:00
|
|
|
if (!m_editorsWithMarkers.contains(widget))
|
|
|
|
|
m_editorsWithMarkers << widget;
|
2020-08-25 06:18:26 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-22 14:52:06 +02:00
|
|
|
runNext();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DocumentClangToolRunner::onFailure(const QString &errorMessage, const QString &errorDetails)
|
|
|
|
|
{
|
|
|
|
|
qCDebug(LOG) << "Failed to analyze " << m_fileInfo.file << ":" << errorMessage << errorDetails;
|
|
|
|
|
runNext();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DocumentClangToolRunner::finalize()
|
|
|
|
|
{
|
|
|
|
|
// remove all disabled textMarks
|
|
|
|
|
auto [newMarks, toDelete] = Utils::partition(m_marks, &DiagnosticMark::enabled);
|
|
|
|
|
m_marks = newMarks;
|
|
|
|
|
qDeleteAll(toDelete);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DocumentClangToolRunner::cancel()
|
|
|
|
|
{
|
|
|
|
|
if (m_projectSettingsUpdate)
|
|
|
|
|
disconnect(m_projectSettingsUpdate);
|
|
|
|
|
m_runnerCreators.clear();
|
|
|
|
|
if (m_currentRunner) {
|
|
|
|
|
m_currentRunner->disconnect(this);
|
|
|
|
|
m_currentRunner.reset(nullptr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-01 14:39:21 +02:00
|
|
|
bool DocumentClangToolRunner::isSuppressed(const Diagnostic &diagnostic) const
|
|
|
|
|
{
|
|
|
|
|
auto equalsSuppressed = [this, &diagnostic](const SuppressedDiagnostic &suppressed) {
|
|
|
|
|
if (suppressed.description != diagnostic.description)
|
|
|
|
|
return false;
|
2021-05-28 12:37:35 +02:00
|
|
|
Utils::FilePath filePath = suppressed.filePath;
|
|
|
|
|
if (filePath.toFileInfo().isRelative())
|
|
|
|
|
filePath = m_lastProjectDirectory.pathAppended(filePath.toString());
|
2020-10-01 14:39:21 +02:00
|
|
|
return filePath == diagnostic.location.filePath;
|
|
|
|
|
};
|
|
|
|
|
return Utils::anyOf(m_suppressed, equalsSuppressed);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-22 14:52:06 +02:00
|
|
|
const CppTools::ClangDiagnosticConfig DocumentClangToolRunner::getDiagnosticConfig(ProjectExplorer::Project *project)
|
|
|
|
|
{
|
|
|
|
|
const auto projectSettings = ClangToolsProjectSettings::getSettings(project);
|
|
|
|
|
m_projectSettingsUpdate = connect(projectSettings.data(),
|
|
|
|
|
&ClangToolsProjectSettings::changed,
|
|
|
|
|
this,
|
|
|
|
|
&DocumentClangToolRunner::run);
|
|
|
|
|
|
|
|
|
|
const Utils::Id &id = projectSettings->useGlobalSettings()
|
|
|
|
|
? ClangToolsSettings::instance()->runSettings().diagnosticConfigId()
|
|
|
|
|
: projectSettings->runSettings().diagnosticConfigId();
|
|
|
|
|
return diagnosticConfig(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
|
ClangToolRunner *DocumentClangToolRunner::createRunner(const CppTools::ClangDiagnosticConfig &config,
|
|
|
|
|
const Utils::Environment &env)
|
|
|
|
|
{
|
|
|
|
|
auto runner = new T(config, this);
|
|
|
|
|
runner->init(m_temporaryDir.path(), env);
|
|
|
|
|
connect(runner, &ClangToolRunner::finishedWithSuccess,
|
|
|
|
|
this, &DocumentClangToolRunner::onSuccess);
|
|
|
|
|
connect(runner, &ClangToolRunner::finishedWithFailure,
|
|
|
|
|
this, &DocumentClangToolRunner::onFailure);
|
|
|
|
|
return runner;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace ClangTools
|