CMakeProject: Update attribute in update method

createGeneratedCodeModelSupport() can now be marked const and is renamed
since it doesn't create GeneratedCodeModelSupport instances any longer.

Change-Id: I8b4b8e8980623841889bd3a03e5fe8c1d4342cb3
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Bernhard Beschow
2019-01-20 15:03:55 +01:00
parent 14834e6b0a
commit 719a51a03d
2 changed files with 8 additions and 7 deletions

View File

@@ -280,7 +280,9 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
t->updateDefaultRunConfigurations(); t->updateDefaultRunConfigurations();
createGeneratedCodeModelSupport(); qDeleteAll(m_extraCompilers);
m_extraCompilers = findExtraCompilers();
CppTools::GeneratedCodeModelSupport::update(m_extraCompilers);
QtSupport::CppKitInfo kitInfo(this); QtSupport::CppKitInfo kitInfo(this);
QTC_ASSERT(kitInfo.isValid(), return); QTC_ASSERT(kitInfo.isValid(), return);
@@ -579,10 +581,9 @@ bool CMakeProject::mustUpdateCMakeStateBeforeBuild()
return m_delayedParsingTimer.isActive(); return m_delayedParsingTimer.isActive();
} }
void CMakeProject::createGeneratedCodeModelSupport() QList<ProjectExplorer::ExtraCompiler *> CMakeProject::findExtraCompilers() const
{ {
qDeleteAll(m_extraCompilers); QList<ProjectExplorer::ExtraCompiler *> extraCompilers;
m_extraCompilers.clear();
const QList<ExtraCompilerFactory *> factories = const QList<ExtraCompilerFactory *> factories =
ExtraCompilerFactory::extraCompilerFactories(); ExtraCompilerFactory::extraCompilerFactories();
@@ -612,10 +613,10 @@ void CMakeProject::createGeneratedCodeModelSupport()
const FileNameList fileNames const FileNameList fileNames
= transform(generated, = transform(generated,
[](const QString &s) { return FileName::fromString(s); }); [](const QString &s) { return FileName::fromString(s); });
m_extraCompilers.append(factory->create(this, file, fileNames)); extraCompilers.append(factory->create(this, file, fileNames));
} }
CppTools::GeneratedCodeModelSupport::update(m_extraCompilers); return extraCompilers;
} }
} // namespace CMakeProjectManager } // namespace CMakeProjectManager

View File

@@ -100,7 +100,7 @@ private:
std::unique_ptr<Internal::CMakeProjectNode> std::unique_ptr<Internal::CMakeProjectNode>
generateProjectTree(const QList<const ProjectExplorer::FileNode*> &allFiles) const; generateProjectTree(const QList<const ProjectExplorer::FileNode*> &allFiles) const;
void createGeneratedCodeModelSupport(); QList<ProjectExplorer::ExtraCompiler *> findExtraCompilers() const;
QStringList filesGeneratedFrom(const QString &sourceFile) const final; QStringList filesGeneratedFrom(const QString &sourceFile) const final;
// TODO probably need a CMake specific node structure // TODO probably need a CMake specific node structure