ClangTools: Allow selecting diagnostic config for project

When starting the Clazy/Tidy tool, allow to select the diagnostic
configuration for the run.

As a side effect, fix a race condition where the runner could end up
with no diagnostic config (removed during run) - copy the diagnostic
config instead of referencing/querying it by the id.

Change-Id: Iedafa8f31a3bbd233d65818fe8de16add1e4d443
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-05-14 11:40:40 +02:00
parent 2522275b69
commit 9b74948a61
12 changed files with 206 additions and 25 deletions

View File

@@ -27,6 +27,7 @@
#include <QObject>
#include <coreplugin/id.h>
#include <projectexplorer/project.h>
#include <utils/fileutils.h>
@@ -74,6 +75,12 @@ public:
ClangToolsProjectSettings(ProjectExplorer::Project *project);
~ClangToolsProjectSettings() override;
bool useGlobalSettings() const;
void setUseGlobalSettings(bool useGlobalSettings);
Core::Id diagnosticConfig() const;
void setDiagnosticConfig(const Core::Id &diagnosticConfig);
QSet<Utils::FileName> selectedDirs() const { return m_selectedDirs; }
void setSelectedDirs(const QSet<Utils::FileName> &value) { m_selectedDirs = value; }
@@ -93,6 +100,8 @@ private:
void store();
ProjectExplorer::Project *m_project;
bool m_useGlobalSettings = true;
Core::Id m_diagnosticConfig;
QSet<Utils::FileName> m_selectedDirs;
QSet<Utils::FileName> m_selectedFiles;
SuppressedDiagnosticsList m_suppressedDiagnostics;