Commit e6d1141e authored by Tobias Hunger's avatar Tobias Hunger

ToolChain: Get rid of type() in favor of typeId()

Change-Id: I8fc68c266acb55a7c3e014697a7b526784914f7a
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent 3b364f70
......@@ -1218,9 +1218,9 @@ static bool equalKits(Kit *a, Kit *b)
ToolChain *btc = ToolChainKitInformation::toolChain(b);
if (atc == btc)
return true;
if (!atc || atc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
if (!atc || atc->typeId() != Constants::ANDROID_TOOLCHAIN_TYPE)
return false;
if (!btc || btc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
if (!btc || btc->typeId() != Constants::ANDROID_TOOLCHAIN_TYPE)
return false;
AndroidToolChain *aatc = static_cast<AndroidToolChain *>(atc);
AndroidToolChain *bbtc = static_cast<AndroidToolChain *>(btc);
......@@ -1252,7 +1252,7 @@ void AndroidConfigurations::registerNewToolChains()
void AndroidConfigurations::removeOldToolChains()
{
foreach (ToolChain *tc, ToolChainManager::toolChains()) {
if (tc->type() == QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE)) {
if (tc->typeId() == Constants::ANDROID_TOOLCHAIN_TYPE) {
if (!tc->isValid())
ToolChainManager::deregisterToolChain(tc);
}
......@@ -1268,7 +1268,7 @@ void AndroidConfigurations::updateAutomaticKitList()
foreach (ToolChain *tc, ToolChainManager::toolChains()) {
if (!tc->isAutoDetected())
continue;
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
if (tc->typeId() != Constants::ANDROID_TOOLCHAIN_TYPE)
continue;
if (!tc->isValid()) // going to be deleted
continue;
......@@ -1369,7 +1369,7 @@ void AndroidConfigurations::updateAutomaticKitList()
foreach (Kit *k, existingKits) {
ToolChain *tc = ToolChainKitInformation::toolChain(k);
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k);
if (tc && tc->type() == QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE)
if (tc && tc->typeId() == Constants::ANDROID_TOOLCHAIN_TYPE
&& tc->isValid()
&& qtVersion && qtVersion->type() == QLatin1String(Constants::ANDROIDQT)) {
k->makeUnSticky();
......
......@@ -90,7 +90,7 @@ bool AndroidGdbServerKitInformation::isAndroidKit(const Kit *kit)
ToolChain *tc = ToolChainKitInformation::toolChain(kit);
if (qt && tc)
return qt->type() == QLatin1String(Constants::ANDROIDQT)
&& tc->type() == QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE);
&& tc->typeId() == Constants::ANDROID_TOOLCHAIN_TYPE;
return false;
}
......@@ -108,7 +108,7 @@ void AndroidGdbServerKitInformation::setGdbSever(Kit *kit, const FileName &gdbSe
FileName AndroidGdbServerKitInformation::autoDetect(Kit *kit)
{
ToolChain *tc = ToolChainKitInformation::toolChain(kit);
if (!tc || tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
if (!tc || tc->typeId() != Constants::ANDROID_TOOLCHAIN_TYPE)
return FileName();
AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
return atc->suggestedGdbServer();
......
......@@ -92,11 +92,6 @@ AndroidToolChain::AndroidToolChain(const AndroidToolChain &tc) :
AndroidToolChain::~AndroidToolChain()
{ }
QString AndroidToolChain::type() const
{
return QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE);
}
QString AndroidToolChain::typeDisplayName() const
{
return AndroidToolChainFactory::tr("Android GCC");
......
......@@ -42,7 +42,6 @@ class AndroidToolChain : public ProjectExplorer::GccToolChain
public:
~AndroidToolChain() override;
QString type() const override;
QString typeDisplayName() const override;
bool isValid() const override;
......
......@@ -113,7 +113,7 @@ void ProjectPart::evaluateToolchain(const ToolChain *tc,
}
toolchainDefines = tc->predefinedMacros(commandLineFlags);
toolchainType = tc->type();
toolchainType = tc->typeId();
updateLanguageFeatures();
}
......@@ -711,7 +711,7 @@ bool CompilerOptionsBuilder::excludeDefineLine(const QByteArray &defineLine) con
// The right-hand sides are gcc built-ins that clang does not understand, and they'd
// override clang's own (non-macro, it seems) definitions of the symbols on the left-hand
// side.
const bool isGccToolchain = m_projectPart->toolchainType == QLatin1String("gcc");
const bool isGccToolchain = m_projectPart->toolchainType == ProjectExplorer::Constants::GCC_TOOLCHAIN_ID;
if (isGccToolchain && defineLine.contains("has_include"))
return true;
......
......@@ -130,7 +130,7 @@ public: // fields
QString projectConfigFile; // currently only used by the Generic Project Manager
QByteArray projectDefines;
QByteArray toolchainDefines;
QString toolchainType;
Core::Id toolchainType;
QList<HeaderPath> headerPaths;
QStringList precompiledHeaders;
LanguageVersion languageVersion;
......
......@@ -201,7 +201,8 @@ QStringList IosBuildStep::defaultArguments() const
qCWarning(iosLog) << "IosBuildStep had an unknown buildType "
<< target()->activeBuildConfiguration()->buildType();
}
if (tc->type() == QLatin1String("gcc") || tc->type() == QLatin1String("clang")) {
if (tc->typeId() == ProjectExplorer::Constants::GCC_TOOLCHAIN_ID
|| tc->typeId() == ProjectExplorer::Constants::CLANG_TOOLCHAIN_ID) {
GccToolChain *gtc = static_cast<GccToolChain *>(tc);
res << gtc->platformCodeGenFlags();
}
......
......@@ -100,7 +100,8 @@ void IosConfigurations::updateAutomaticKitList()
foreach (ToolChain *tc, ToolChainManager::toolChains()) {
if (!tc->isAutoDetected()) // use also user toolchains?
continue;
if (tc->type() != QLatin1String("clang") && tc->type() != QLatin1String("gcc"))
if (tc->typeId() != ProjectExplorer::Constants::CLANG_TOOLCHAIN_ID
&& tc->typeId() != ProjectExplorer::Constants::GCC_TOOLCHAIN_ID)
continue;
GccToolChain *toolchain = static_cast<GccToolChain *>(tc);
QMapIterator<QString, Platform> iter(platforms);
......
......@@ -82,11 +82,6 @@ CustomToolChain::CustomToolChain(Detection d) :
m_outputParser(Gcc)
{ }
QString CustomToolChain::type() const
{
return QLatin1String("custom");
}
QString CustomToolChain::typeDisplayName() const
{
return Internal::CustomToolChainFactory::tr("Custom");
......
......@@ -76,7 +76,6 @@ public:
OutputParserCount
};
QString type() const override;
QString typeDisplayName() const override;
Abi targetAbi() const override;
void setTargetAbi(const Abi &);
......
......@@ -313,11 +313,6 @@ ToolChain::CompilerFlags GccToolChain::defaultCompilerFlags() const
return CompilerFlags(GnuExtensions);
}
QString GccToolChain::type() const
{
return QLatin1String("gcc");
}
QString GccToolChain::typeDisplayName() const
{
return GccToolChainFactory::tr("GCC");
......@@ -1016,11 +1011,6 @@ ClangToolChain::ClangToolChain(Detection d) :
GccToolChain(Constants::CLANG_TOOLCHAIN_ID, d)
{ }
QString ClangToolChain::type() const
{
return QLatin1String("clang");
}
QString ClangToolChain::typeDisplayName() const
{
return ClangToolChainFactory::tr("Clang");
......@@ -1164,11 +1154,6 @@ MingwToolChain::MingwToolChain(Detection d) :
GccToolChain(Constants::MINGW_TOOLCHAIN_ID, d)
{ }
QString MingwToolChain::type() const
{
return QLatin1String("mingw");
}
QString MingwToolChain::typeDisplayName() const
{
return MingwToolChainFactory::tr("MinGW");
......@@ -1270,11 +1255,6 @@ LinuxIccToolChain::LinuxIccToolChain(Detection d) :
GccToolChain(Constants::LINUXICC_TOOLCHAIN_ID, d)
{ }
QString LinuxIccToolChain::type() const
{
return QLatin1String("icc");
}
QString LinuxIccToolChain::typeDisplayName() const
{
return LinuxIccToolChainFactory::tr("Linux ICC");
......
......@@ -58,7 +58,6 @@ class PROJECTEXPLORER_EXPORT GccToolChain : public ToolChain
{
public:
GccToolChain(Core::Id typeId, Detection d);
QString type() const override;
QString typeDisplayName() const override;
Abi targetAbi() const override;
QString version() const;
......@@ -163,7 +162,6 @@ class PROJECTEXPLORER_EXPORT ClangToolChain : public GccToolChain
{
public:
explicit ClangToolChain(Detection d);
QString type() const override;
QString typeDisplayName() const override;
QString makeCommand(const Utils::Environment &environment) const override;
......@@ -192,7 +190,6 @@ private:
class PROJECTEXPLORER_EXPORT MingwToolChain : public GccToolChain
{
public:
QString type() const override;
QString typeDisplayName() const override;
QString makeCommand(const Utils::Environment &environment) const override;
......@@ -214,7 +211,6 @@ private:
class PROJECTEXPLORER_EXPORT LinuxIccToolChain : public GccToolChain
{
public:
QString type() const override;
QString typeDisplayName() const override;
CompilerFlags compilerFlags(const QStringList &cxxflags) const override;
......
......@@ -373,11 +373,6 @@ MsvcToolChain *MsvcToolChain::readFromMap(const QVariantMap &data)
return 0;
}
QString MsvcToolChain::type() const
{
return QLatin1String("msvc");
}
QString MsvcToolChain::typeDisplayName() const
{
return MsvcToolChainFactory::tr("MSVC");
......
......@@ -65,7 +65,6 @@ public:
static MsvcToolChain *readFromMap(const QVariantMap &data);
QString type() const override;
QString typeDisplayName() const override;
QVariantMap toMap() const override;
......
......@@ -82,7 +82,6 @@ public:
virtual QList<Utils::FileName> suggestedMkspecList() const;
virtual Utils::FileName suggestedDebugger() const;
virtual QString type() const = 0;
Core::Id typeId() const;
virtual QString typeDisplayName() const = 0;
virtual Abi targetAbi() const = 0;
......
......@@ -271,11 +271,6 @@ WinCEToolChain *WinCEToolChain::readFromMap(const QVariantMap &data)
return 0;
}
QString WinCEToolChain::type() const
{
return QLatin1String("wince");
}
QString WinCEToolChain::typeDisplayName() const
{
return WinCEToolChainFactory::tr("WinCE");
......
......@@ -55,7 +55,6 @@ public:
static WinCEToolChain *readFromMap(const QVariantMap &data);
QString type() const override;
QString typeDisplayName() const override;
QString ceVer() const;
......
......@@ -133,13 +133,13 @@ static QStringList targetOSList(const ProjectExplorer::Abi &abi, const ProjectEx
static QStringList toolchainList(const ProjectExplorer::ToolChain *tc)
{
QStringList list;
if (tc->type() == QLatin1String("clang"))
if (tc->typeId() == ProjectExplorer::Constants::CLANG_TOOLCHAIN_ID)
list << QLatin1String("clang") << QLatin1String("llvm") << QLatin1String("gcc");
else if (tc->type() == QLatin1String("gcc"))
else if (tc->typeId() == ProjectExplorer::Constants::GCC_TOOLCHAIN_ID)
list << QLatin1String("gcc"); // TODO: Detect llvm-gcc
else if (tc->type() == QLatin1String("mingw"))
else if (tc->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID)
list << QLatin1String("mingw") << QLatin1String("gcc");
else if (tc->type() == QLatin1String("msvc"))
else if (tc->typeId() == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID)
list << QLatin1String("msvc");
return list;
}
......
......@@ -67,11 +67,6 @@ QnxToolChain::QnxToolChain(ToolChain::Detection d)
: GccToolChain(Constants::QNX_TOOLCHAIN_ID, d)
{ }
QString QnxToolChain::type() const
{
return QLatin1String(Constants::QNX_TOOLCHAIN_ID);
}
QString QnxToolChain::typeDisplayName() const
{
return QnxToolChainFactory::tr("QCC");
......
......@@ -44,7 +44,6 @@ class QnxToolChain : public ProjectExplorer::GccToolChain
public:
explicit QnxToolChain(Detection d);
QString type() const override;
QString typeDisplayName() const override;
ProjectExplorer::ToolChainConfigWidget *configurationWidget() override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment