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