ProjectExplorer: Refactor BuildSystem::extraCompilerForSource

Factor out backend into more generic function to easily support new
accessors.
No functional changes.

Change-Id: I715ce2842d2c63574bdf6ada0d0e32fbfd5d08fb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2023-01-25 14:15:15 +01:00
parent 49f3b8efd7
commit 97976fd3cb
10 changed files with 31 additions and 21 deletions

View File

@@ -1401,11 +1401,9 @@ void CMakeBuildSystem::runGenerator(Id id)
proc->start();
}
ExtraCompiler *CMakeBuildSystem::extraCompilerForSource(const Utils::FilePath &source)
ExtraCompiler *CMakeBuildSystem::findExtraCompiler(const ExtraCompilerFilter &filter) const
{
return Utils::findOrDefault(m_extraCompilers, [source](ExtraCompiler *ec) {
return ec->source() == source;
});
return Utils::findOrDefault(m_extraCompilers, filter);
}
} // CMakeProjectManager::Internal

View File

@@ -122,7 +122,8 @@ signals:
private:
QList<QPair<Utils::Id, QString>> generators() const override;
void runGenerator(Utils::Id id) override;
ProjectExplorer::ExtraCompiler *extraCompilerForSource(const Utils::FilePath &source) override;
ProjectExplorer::ExtraCompiler *findExtraCompiler(
const ExtraCompilerFilter &filter) const override;
enum ForceEnabledChanged { False, True };
void clearError(ForceEnabledChanged fec = ForceEnabledChanged::False);