ProjectExplorer: Make ToolchainManager::toolchains() overloads explicit

Saves a few cycles for the plain access.

Also sprinkle a few 'const'.

Change-Id: I238dfd9352ee39caa3aa48cd04a9f1cf827b029e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-01-18 18:40:41 +01:00
parent 1720256e59
commit e695109078
14 changed files with 44 additions and 39 deletions

View File

@@ -241,11 +241,11 @@ void QmakeProjectImporter::deleteDirectoryData(void *directoryData) const
delete static_cast<DirectoryData *>(directoryData);
}
static const QList<ToolChain *> preferredToolChains(BaseQtVersion *qtVersion, const QString &ms)
static const Toolchains preferredToolChains(BaseQtVersion *qtVersion, const QString &ms)
{
const QString spec = ms.isEmpty() ? qtVersion->mkspec() : ms;
const QList<ToolChain *> toolchains = ToolChainManager::toolChains();
const Toolchains toolchains = ToolChainManager::toolchains();
const Abis qtAbis = qtVersion->qtAbis();
const auto matcher = [&](const ToolChain *tc) {
return qtAbis.contains(tc->targetAbi()) && tc->suggestedMkspecList().contains(spec);
@@ -256,7 +256,7 @@ static const QList<ToolChain *> preferredToolChains(BaseQtVersion *qtVersion, co
ToolChain * const cToolchain = findOrDefault(toolchains, [matcher](const ToolChain *tc) {
return tc->language() == ProjectExplorer::Constants::C_LANGUAGE_ID && matcher(tc);
});
QList<ToolChain *> chosenToolchains;
Toolchains chosenToolchains;
for (ToolChain * const tc : {cxxToolchain, cToolchain}) {
if (tc)
chosenToolchains << tc;