ProjectExplorer: Introduce ToolChainKitAspect::{c,cxx}ToolChain

Special accessors to the repeatedly used C and C++ cases to denoise
and slim down user code.  Plus some code cosmetics nearby.

Change-Id: Iba4662bd4731d8c4256e658529f39d5c995691ce
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-02-18 18:25:26 +01:00
parent 57662de841
commit 3f68292dbe
32 changed files with 97 additions and 103 deletions

View File

@@ -62,8 +62,7 @@ void ClangToolsUnitTests::initTestCase()
const QList<Kit *> allKits = KitManager::kits();
if (allKits.count() != 1)
QSKIP("This test requires exactly one kit to be present");
const ToolChain *const toolchain = ToolChainKitAspect::toolChain(allKits.first(),
Constants::CXX_LANGUAGE_ID);
const ToolChain *const toolchain = ToolChainKitAspect::cxxToolChain(allKits.first());
if (!toolchain)
QSKIP("This test requires that there is a kit with a toolchain.");
@@ -100,9 +99,7 @@ void ClangToolsUnitTests::testProject()
QFETCH(int, expectedDiagCount);
QFETCH(ClangDiagnosticConfig, diagnosticConfig);
if (projectFilePath.contains("mingw")) {
const ToolChain *const toolchain
= ToolChainKitAspect::toolChain(KitManager::kits().constFirst(),
Constants::CXX_LANGUAGE_ID);
const auto toolchain = ToolChainKitAspect::cxxToolChain(KitManager::kits().constFirst());
if (toolchain->typeId() != ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID)
QSKIP("This test is mingw specific, does not run for other toolchains");
}