forked from qt-creator/qt-creator
ClangTools: Add automatic clang tool runner for open documents
Fixes: QTCREATORBUG-23349 Change-Id: I81197180c9d69c7df6184f8fcbf05f2256eaf7f6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -42,7 +42,7 @@ static const char clazyStandaloneExecutableKey[] = "ClazyStandaloneExecutable";
|
||||
|
||||
static const char parallelJobsKey[] = "ParallelJobs";
|
||||
static const char buildBeforeAnalysisKey[] = "BuildBeforeAnalysis";
|
||||
|
||||
static const char analyzeOpenFilesKey[] = "AnalyzeOpenFiles";
|
||||
static const char oldDiagnosticConfigIdKey[] = "diagnosticConfigId";
|
||||
|
||||
using namespace CppTools;
|
||||
@@ -66,6 +66,7 @@ void RunSettings::fromMap(const QVariantMap &map, const QString &prefix)
|
||||
m_diagnosticConfigId = Utils::Id::fromSetting(map.value(prefix + diagnosticConfigIdKey));
|
||||
m_parallelJobs = map.value(prefix + parallelJobsKey).toInt();
|
||||
m_buildBeforeAnalysis = map.value(prefix + buildBeforeAnalysisKey).toBool();
|
||||
m_analyzeOpenFiles = map.value(prefix + analyzeOpenFilesKey).toBool();
|
||||
}
|
||||
|
||||
void RunSettings::toMap(QVariantMap &map, const QString &prefix) const
|
||||
@@ -73,6 +74,7 @@ void RunSettings::toMap(QVariantMap &map, const QString &prefix) const
|
||||
map.insert(prefix + diagnosticConfigIdKey, m_diagnosticConfigId.toSetting());
|
||||
map.insert(prefix + parallelJobsKey, m_parallelJobs);
|
||||
map.insert(prefix + buildBeforeAnalysisKey, m_buildBeforeAnalysis);
|
||||
map.insert(prefix + analyzeOpenFilesKey, m_analyzeOpenFiles);
|
||||
}
|
||||
|
||||
Utils::Id RunSettings::diagnosticConfigId() const
|
||||
@@ -82,6 +84,14 @@ Utils::Id RunSettings::diagnosticConfigId() const
|
||||
return m_diagnosticConfigId;
|
||||
}
|
||||
|
||||
bool RunSettings::operator==(const RunSettings &other) const
|
||||
{
|
||||
return m_diagnosticConfigId == other.m_diagnosticConfigId
|
||||
&& m_parallelJobs == other.m_parallelJobs
|
||||
&& m_buildBeforeAnalysis == other.m_buildBeforeAnalysis
|
||||
&& m_analyzeOpenFiles == other.m_analyzeOpenFiles;
|
||||
}
|
||||
|
||||
ClangToolsSettings::ClangToolsSettings()
|
||||
{
|
||||
readSettings();
|
||||
@@ -154,6 +164,7 @@ void ClangToolsSettings::readSettings()
|
||||
defaults.insert(diagnosticConfigIdKey, defaultDiagnosticId().toSetting());
|
||||
defaults.insert(parallelJobsKey, m_runSettings.parallelJobs());
|
||||
defaults.insert(buildBeforeAnalysisKey, m_runSettings.buildBeforeAnalysis());
|
||||
defaults.insert(analyzeOpenFilesKey, m_runSettings.analyzeOpenFiles());
|
||||
map = defaults;
|
||||
for (QVariantMap::ConstIterator it = defaults.constBegin(); it != defaults.constEnd(); ++it)
|
||||
map.insert(it.key(), s->value(it.key(), it.value()));
|
||||
|
||||
Reference in New Issue
Block a user