forked from qt-creator/qt-creator
ProjectExplorer: Drop Detection argument from ToolChain constructor
This was used wildly inconsistently. Use a setter instead in circumstances where the context is reasonably clear. The assumption is that this will always be done at some time in all code paths. Use a new 'Uninitialized' value to avoid triggering the first update. Change-Id: I82c38cb9da3ccdbd8fbae8beefcbfa0e559ff794 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -225,19 +225,20 @@ ToolChainList AndroidToolChainFactory::autodetectToolChainsForNdk(CToolChainList
|
||||
|
||||
// for fromMap
|
||||
AndroidToolChain::AndroidToolChain()
|
||||
: ClangToolChain(Constants::ANDROID_TOOLCHAIN_ID, ToolChain::ManualDetection)
|
||||
: ClangToolChain(Constants::ANDROID_TOOLCHAIN_ID)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
AndroidToolChain::AndroidToolChain(const QString& target, Core::Id languageId)
|
||||
: ClangToolChain(Constants::ANDROID_TOOLCHAIN_ID, ToolChain::AutoDetection)
|
||||
: ClangToolChain(Constants::ANDROID_TOOLCHAIN_ID)
|
||||
{
|
||||
setOriginalTargetTriple(target);
|
||||
setLanguage(languageId);
|
||||
setTargetAbi(ClangTargets[target]);
|
||||
setPlatformCodeGenFlags({"-target", target});
|
||||
setPlatformLinkerFlags({"-target", target});
|
||||
setDetection(AutoDetection);
|
||||
setDisplayName(QString::fromLatin1("Android Clang (%1, %2)")
|
||||
.arg(ToolChainManager::displayNameOfLanguageId(languageId),
|
||||
AndroidConfig::displayName(targetAbi())));
|
||||
|
@@ -225,8 +225,8 @@ static QString buildDisplayName(Abi::Architecture arch, Core::Id language,
|
||||
|
||||
// IarToolChain
|
||||
|
||||
IarToolChain::IarToolChain(Detection d) :
|
||||
ToolChain(Constants::IAREW_TOOLCHAIN_TYPEID, d)
|
||||
IarToolChain::IarToolChain() :
|
||||
ToolChain(Constants::IAREW_TOOLCHAIN_TYPEID)
|
||||
{ }
|
||||
|
||||
QString IarToolChain::typeDisplayName() const
|
||||
@@ -466,12 +466,12 @@ bool IarToolChainFactory::canCreate()
|
||||
|
||||
ToolChain *IarToolChainFactory::create()
|
||||
{
|
||||
return new IarToolChain(ToolChain::ManualDetection);
|
||||
return new IarToolChain;
|
||||
}
|
||||
|
||||
ToolChain *IarToolChainFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
const auto tc = new IarToolChain(ToolChain::ManualDetection);
|
||||
const auto tc = new IarToolChain;
|
||||
if (tc->fromMap(data))
|
||||
return tc;
|
||||
|
||||
@@ -516,7 +516,8 @@ QList<ToolChain *> IarToolChainFactory::autoDetectToolchain(
|
||||
return {};
|
||||
const Abi abi = guessAbi(macros);
|
||||
|
||||
const auto tc = new IarToolChain(ToolChain::AutoDetection);
|
||||
const auto tc = new IarToolChain;
|
||||
tc->setDetection(ToolChain::AutoDetection);
|
||||
tc->setLanguage(languageId);
|
||||
tc->setCompilerCommand(candidate.compilerPath);
|
||||
tc->setTargetAbi(abi);
|
||||
|
@@ -89,7 +89,7 @@ protected:
|
||||
IarToolChain(const IarToolChain &tc) = default;
|
||||
|
||||
private:
|
||||
explicit IarToolChain(Detection d);
|
||||
IarToolChain();
|
||||
|
||||
ProjectExplorer::Abi m_targetAbi;
|
||||
Utils::FileName m_compilerCommand;
|
||||
|
@@ -239,8 +239,8 @@ static QString buildDisplayName(Abi::Architecture arch, Core::Id language,
|
||||
|
||||
// KeilToolchain
|
||||
|
||||
KeilToolchain::KeilToolchain(Detection d) :
|
||||
ToolChain(Constants::KEIL_TOOLCHAIN_TYPEID, d)
|
||||
KeilToolchain::KeilToolchain() :
|
||||
ToolChain(Constants::KEIL_TOOLCHAIN_TYPEID)
|
||||
{ }
|
||||
|
||||
QString KeilToolchain::typeDisplayName() const
|
||||
@@ -465,12 +465,12 @@ bool KeilToolchainFactory::canCreate()
|
||||
|
||||
ToolChain *KeilToolchainFactory::create()
|
||||
{
|
||||
return new KeilToolchain(ToolChain::ManualDetection);
|
||||
return new KeilToolchain;
|
||||
}
|
||||
|
||||
ToolChain *KeilToolchainFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
const auto tc = new KeilToolchain(ToolChain::ManualDetection);
|
||||
const auto tc = new KeilToolchain;
|
||||
if (tc->fromMap(data))
|
||||
return tc;
|
||||
|
||||
@@ -521,7 +521,8 @@ QList<ToolChain *> KeilToolchainFactory::autoDetectToolchain(
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto tc = new KeilToolchain(ToolChain::AutoDetection);
|
||||
const auto tc = new KeilToolchain;
|
||||
tc->setDetection(ToolChain::AutoDetection);
|
||||
tc->setLanguage(language);
|
||||
tc->setCompilerCommand(candidate.compilerPath);
|
||||
tc->setTargetAbi(abi);
|
||||
|
@@ -89,7 +89,7 @@ protected:
|
||||
KeilToolchain(const KeilToolchain &tc) = default;
|
||||
|
||||
private:
|
||||
explicit KeilToolchain(Detection d);
|
||||
KeilToolchain();
|
||||
|
||||
ProjectExplorer::Abi m_targetAbi;
|
||||
Utils::FileName m_compilerCommand;
|
||||
|
@@ -216,8 +216,8 @@ static Utils::FileName compilerPathFromEnvironment(const QString &compilerName)
|
||||
|
||||
// SdccToolChain
|
||||
|
||||
SdccToolChain::SdccToolChain(Detection d) :
|
||||
ToolChain(Constants::SDCC_TOOLCHAIN_TYPEID, d)
|
||||
SdccToolChain::SdccToolChain() :
|
||||
ToolChain(Constants::SDCC_TOOLCHAIN_TYPEID)
|
||||
{ }
|
||||
|
||||
QString SdccToolChain::typeDisplayName() const
|
||||
@@ -442,12 +442,12 @@ bool SdccToolChainFactory::canCreate()
|
||||
|
||||
ToolChain *SdccToolChainFactory::create()
|
||||
{
|
||||
return new SdccToolChain(ToolChain::ManualDetection);
|
||||
return new SdccToolChain;
|
||||
}
|
||||
|
||||
ToolChain *SdccToolChainFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
const auto tc = new SdccToolChain(ToolChain::ManualDetection);
|
||||
const auto tc = new SdccToolChain;
|
||||
if (tc->fromMap(data))
|
||||
return tc;
|
||||
|
||||
@@ -489,7 +489,8 @@ QList<ToolChain *> SdccToolChainFactory::autoDetectToolchain(
|
||||
return {};
|
||||
const Abi abi = guessAbi(macros);
|
||||
|
||||
const auto tc = new SdccToolChain(ToolChain::AutoDetection);
|
||||
const auto tc = new SdccToolChain;
|
||||
tc->setDetection(ToolChain::AutoDetection);
|
||||
tc->setLanguage(language);
|
||||
tc->setCompilerCommand(candidate.compilerPath);
|
||||
tc->setTargetAbi(abi);
|
||||
|
@@ -89,7 +89,7 @@ protected:
|
||||
SdccToolChain(const SdccToolChain &tc) = default;
|
||||
|
||||
private:
|
||||
explicit SdccToolChain(Detection d);
|
||||
SdccToolChain();
|
||||
|
||||
ProjectExplorer::Abi m_targetAbi;
|
||||
Utils::FileName m_compilerCommand;
|
||||
|
@@ -586,7 +586,8 @@ static ClangToolChain *createToolChain(const XcodePlatform &platform,
|
||||
&& l != Core::Id(ProjectExplorer::Constants::CXX_LANGUAGE_ID))
|
||||
return nullptr;
|
||||
|
||||
auto toolChain = new ClangToolChain(ToolChain::AutoDetection);
|
||||
auto toolChain = new ClangToolChain;
|
||||
toolChain->setDetection(ToolChain::AutoDetection);
|
||||
toolChain->setLanguage(l);
|
||||
toolChain->setDisplayName(target.name);
|
||||
toolChain->setPlatformCodeGenFlags(target.backendFlags);
|
||||
|
@@ -39,12 +39,12 @@ using namespace Utils;
|
||||
|
||||
namespace Nim {
|
||||
|
||||
NimToolChain::NimToolChain(ToolChain::Detection d)
|
||||
: NimToolChain(Constants::C_NIMTOOLCHAIN_TYPEID, d)
|
||||
NimToolChain::NimToolChain()
|
||||
: NimToolChain(Constants::C_NIMTOOLCHAIN_TYPEID)
|
||||
{}
|
||||
|
||||
NimToolChain::NimToolChain(Core::Id typeId, ToolChain::Detection d)
|
||||
: ToolChain(typeId, d)
|
||||
NimToolChain::NimToolChain(Core::Id typeId)
|
||||
: ToolChain(typeId)
|
||||
, m_compilerCommand(FileName())
|
||||
, m_version(std::make_tuple(-1,-1,-1))
|
||||
{
|
||||
@@ -52,7 +52,7 @@ NimToolChain::NimToolChain(Core::Id typeId, ToolChain::Detection d)
|
||||
}
|
||||
|
||||
NimToolChain::NimToolChain(const NimToolChain &other)
|
||||
: ToolChain(other.typeId(), other.detection())
|
||||
: ToolChain(other.typeId())
|
||||
, m_compilerCommand(other.m_compilerCommand)
|
||||
, m_version(other.m_version)
|
||||
{
|
||||
|
@@ -33,8 +33,8 @@ namespace Nim {
|
||||
class NimToolChain : public ProjectExplorer::ToolChain
|
||||
{
|
||||
public:
|
||||
NimToolChain(Detection d);
|
||||
NimToolChain(Core::Id typeId, Detection d);
|
||||
NimToolChain();
|
||||
explicit NimToolChain(Core::Id typeId);
|
||||
|
||||
QString typeDisplayName() const override;
|
||||
ProjectExplorer::Abi targetAbi() const override;
|
||||
|
@@ -54,12 +54,12 @@ bool NimToolChainFactory::canCreate()
|
||||
|
||||
ToolChain *NimToolChainFactory::create()
|
||||
{
|
||||
return new NimToolChain(ToolChain::ManualDetection);
|
||||
return new NimToolChain;
|
||||
}
|
||||
|
||||
ToolChain *NimToolChainFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
auto tc = new NimToolChain(ToolChain::AutoDetection);
|
||||
auto tc = new NimToolChain;
|
||||
if (tc->fromMap(data))
|
||||
return tc;
|
||||
delete tc;
|
||||
@@ -83,7 +83,8 @@ QList<ToolChain *> NimToolChainFactory::autoDetect(const QList<ToolChain *> &alr
|
||||
if (!result.empty())
|
||||
return result;
|
||||
|
||||
auto tc = new NimToolChain(ToolChain::AutoDetection);
|
||||
auto tc = new NimToolChain;
|
||||
tc->setDetection(ToolChain::AutoDetection);
|
||||
tc->setCompilerCommand(compilerPath);
|
||||
result.append(tc);
|
||||
return result;
|
||||
@@ -93,7 +94,8 @@ QList<ToolChain *> NimToolChainFactory::autoDetect(const FileName &compilerPath,
|
||||
{
|
||||
QList<ToolChain *> result;
|
||||
if (language == Constants::C_NIMLANGUAGE_ID) {
|
||||
auto tc = new NimToolChain(ToolChain::ManualDetection);
|
||||
auto tc = new NimToolChain;
|
||||
tc->setDetection(ToolChain::ManualDetection); // FIXME: sure?
|
||||
tc->setCompilerCommand(compilerPath);
|
||||
result.append(tc);
|
||||
}
|
||||
|
@@ -81,8 +81,8 @@ static const char warningExampleKeyC[] = "ProjectExplorer.CustomToolChain.Warnin
|
||||
// CustomToolChain
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
CustomToolChain::CustomToolChain(Detection d) :
|
||||
ToolChain(Constants::CUSTOM_TOOLCHAIN_TYPEID, d),
|
||||
CustomToolChain::CustomToolChain() :
|
||||
ToolChain(Constants::CUSTOM_TOOLCHAIN_TYPEID),
|
||||
m_outputParserId(GccParser::id())
|
||||
{ }
|
||||
|
||||
@@ -430,12 +430,12 @@ bool CustomToolChainFactory::canCreate()
|
||||
|
||||
ToolChain *CustomToolChainFactory::create()
|
||||
{
|
||||
return new CustomToolChain(ToolChain::ManualDetection);
|
||||
return new CustomToolChain;
|
||||
}
|
||||
|
||||
ToolChain *CustomToolChainFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
auto tc = new CustomToolChain(ToolChain::ManualDetection);
|
||||
auto tc = new CustomToolChain;
|
||||
if (tc->fromMap(data))
|
||||
return tc;
|
||||
|
||||
|
@@ -117,7 +117,7 @@ protected:
|
||||
CustomToolChain(const CustomToolChain &) = default;
|
||||
|
||||
private:
|
||||
explicit CustomToolChain(Detection d);
|
||||
CustomToolChain();
|
||||
|
||||
Utils::FileName m_compilerCommand;
|
||||
Utils::FileName m_makeCommand;
|
||||
|
@@ -232,12 +232,12 @@ static QString gccVersion(const FileName &path, const QStringList &env)
|
||||
// GccToolChain
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
GccToolChain::GccToolChain(Detection d) :
|
||||
GccToolChain(Constants::GCC_TOOLCHAIN_TYPEID, d)
|
||||
GccToolChain::GccToolChain() :
|
||||
GccToolChain(Constants::GCC_TOOLCHAIN_TYPEID)
|
||||
{ }
|
||||
|
||||
GccToolChain::GccToolChain(Core::Id typeId, Detection d) :
|
||||
ToolChain(typeId, d)
|
||||
GccToolChain::GccToolChain(Core::Id typeId) :
|
||||
ToolChain(typeId)
|
||||
{ }
|
||||
|
||||
void GccToolChain::setCompilerCommand(const FileName &path)
|
||||
@@ -886,7 +886,7 @@ bool GccToolChainFactory::canCreate()
|
||||
|
||||
ToolChain *GccToolChainFactory::create()
|
||||
{
|
||||
return createToolChain(false);
|
||||
return createToolChain();
|
||||
}
|
||||
|
||||
QList<ToolChain *> GccToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
|
||||
@@ -920,7 +920,7 @@ QList<ToolChain *> GccToolChainFactory::autoDetect(const FileName &compilerPath,
|
||||
|
||||
ToolChain *GccToolChainFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
GccToolChain *tc = createToolChain(false);
|
||||
GccToolChain *tc = createToolChain();
|
||||
if (tc->fromMap(data))
|
||||
return tc;
|
||||
|
||||
@@ -928,9 +928,9 @@ ToolChain *GccToolChainFactory::restore(const QVariantMap &data)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GccToolChain *GccToolChainFactory::createToolChain(bool autoDetect)
|
||||
GccToolChain *GccToolChainFactory::createToolChain()
|
||||
{
|
||||
return new GccToolChain(autoDetect ? ToolChain::AutoDetection : ToolChain::ManualDetection);
|
||||
return new GccToolChain;
|
||||
}
|
||||
|
||||
Utils::FileName GccToolChainFactory::compilerPathFromEnvironment(const QString &compilerName)
|
||||
@@ -1039,11 +1039,12 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolChain(const FileName &comp
|
||||
systemEnvironment.toStringList(),
|
||||
macros);
|
||||
for (const Abi &abi : detectedAbis.supportedAbis) {
|
||||
std::unique_ptr<GccToolChain> tc(createToolChain(true));
|
||||
std::unique_ptr<GccToolChain> tc(createToolChain());
|
||||
if (!tc)
|
||||
return result;
|
||||
|
||||
tc->setLanguage(language);
|
||||
tc->setDetection(ToolChain::AutoDetection);
|
||||
tc->predefinedMacrosCache()
|
||||
->insert(QStringList(),
|
||||
ToolChain::MacroInspectionReport{macros,
|
||||
@@ -1296,14 +1297,14 @@ void ClangToolChain::syncAutodetectedWithParentToolchains()
|
||||
});
|
||||
}
|
||||
|
||||
ClangToolChain::ClangToolChain(Detection d) :
|
||||
GccToolChain(Constants::CLANG_TOOLCHAIN_TYPEID, d)
|
||||
ClangToolChain::ClangToolChain() :
|
||||
GccToolChain(Constants::CLANG_TOOLCHAIN_TYPEID)
|
||||
{
|
||||
syncAutodetectedWithParentToolchains();
|
||||
}
|
||||
|
||||
ClangToolChain::ClangToolChain(Core::Id typeId, ToolChain::Detection d) :
|
||||
GccToolChain(typeId, d)
|
||||
ClangToolChain::ClangToolChain(Core::Id typeId) :
|
||||
GccToolChain(typeId)
|
||||
{
|
||||
syncAutodetectedWithParentToolchains();
|
||||
}
|
||||
@@ -1524,9 +1525,9 @@ QList<ToolChain *> ClangToolChainFactory::autoDetect(const FileName &compilerPat
|
||||
return QList<ToolChain *>();
|
||||
}
|
||||
|
||||
GccToolChain *ClangToolChainFactory::createToolChain(bool autoDetect)
|
||||
GccToolChain *ClangToolChainFactory::createToolChain()
|
||||
{
|
||||
return new ClangToolChain(autoDetect ? ToolChain::AutoDetection : ToolChain::ManualDetection);
|
||||
return new ClangToolChain;
|
||||
}
|
||||
|
||||
ClangToolChainConfigWidget::ClangToolChainConfigWidget(ClangToolChain *tc) :
|
||||
@@ -1645,8 +1646,8 @@ void ClangToolChainConfigWidget::makeReadOnlyImpl()
|
||||
// MingwToolChain
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
MingwToolChain::MingwToolChain(Detection d) :
|
||||
GccToolChain(Constants::MINGW_TOOLCHAIN_TYPEID, d)
|
||||
MingwToolChain::MingwToolChain() :
|
||||
GccToolChain(Constants::MINGW_TOOLCHAIN_TYPEID)
|
||||
{ }
|
||||
|
||||
QString MingwToolChain::typeDisplayName() const
|
||||
@@ -1729,17 +1730,17 @@ QList<ToolChain *> MingwToolChainFactory::autoDetect(const FileName &compilerPat
|
||||
return QList<ToolChain *>();
|
||||
}
|
||||
|
||||
GccToolChain *MingwToolChainFactory::createToolChain(bool autoDetect)
|
||||
GccToolChain *MingwToolChainFactory::createToolChain()
|
||||
{
|
||||
return new MingwToolChain(autoDetect ? ToolChain::AutoDetection : ToolChain::ManualDetection);
|
||||
return new MingwToolChain;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// LinuxIccToolChain
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
LinuxIccToolChain::LinuxIccToolChain(Detection d) :
|
||||
GccToolChain(Constants::LINUXICC_TOOLCHAIN_TYPEID, d)
|
||||
LinuxIccToolChain::LinuxIccToolChain() :
|
||||
GccToolChain(Constants::LINUXICC_TOOLCHAIN_TYPEID)
|
||||
{ }
|
||||
|
||||
QString LinuxIccToolChain::typeDisplayName() const
|
||||
@@ -1815,9 +1816,9 @@ QList<ToolChain *> LinuxIccToolChainFactory::autoDetect(const FileName &compiler
|
||||
return {};
|
||||
}
|
||||
|
||||
GccToolChain *LinuxIccToolChainFactory::createToolChain(bool autoDetect)
|
||||
GccToolChain *LinuxIccToolChainFactory::createToolChain()
|
||||
{
|
||||
return new LinuxIccToolChain(autoDetect ? ToolChain::AutoDetection : ToolChain::ManualDetection);
|
||||
return new LinuxIccToolChain;
|
||||
}
|
||||
|
||||
GccToolChain::WarningFlagAdder::WarningFlagAdder(const QString &flag, WarningFlags &flags) :
|
||||
|
@@ -67,7 +67,7 @@ inline const QStringList gccPredefinedMacrosOptions(Core::Id languageId)
|
||||
class PROJECTEXPLORER_EXPORT GccToolChain : public ToolChain
|
||||
{
|
||||
public:
|
||||
GccToolChain(Core::Id typeId, Detection d);
|
||||
GccToolChain(Core::Id typeId);
|
||||
QString typeDisplayName() const override;
|
||||
Abi targetAbi() const override;
|
||||
QString originalTargetTriple() const override;
|
||||
@@ -179,7 +179,7 @@ protected:
|
||||
};
|
||||
|
||||
private:
|
||||
explicit GccToolChain(Detection d);
|
||||
explicit GccToolChain();
|
||||
|
||||
void updateSupportedAbis() const;
|
||||
static QStringList gccPrepareArguments(const QStringList &flags,
|
||||
@@ -215,8 +215,8 @@ private:
|
||||
class PROJECTEXPLORER_EXPORT ClangToolChain : public GccToolChain
|
||||
{
|
||||
public:
|
||||
explicit ClangToolChain(Detection d);
|
||||
ClangToolChain(Core::Id typeId, Detection d);
|
||||
ClangToolChain();
|
||||
explicit ClangToolChain(Core::Id typeId);
|
||||
ClangToolChain(const ClangToolChain &other);
|
||||
~ClangToolChain() override;
|
||||
QString typeDisplayName() const override;
|
||||
@@ -271,7 +271,7 @@ public:
|
||||
Utils::FileNameList suggestedMkspecList() const override;
|
||||
|
||||
private:
|
||||
explicit MingwToolChain(Detection d);
|
||||
MingwToolChain();
|
||||
|
||||
friend class Internal::MingwToolChainFactory;
|
||||
friend class ToolChainFactory;
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
Utils::FileNameList suggestedMkspecList() const override;
|
||||
|
||||
private:
|
||||
explicit LinuxIccToolChain(Detection d);
|
||||
LinuxIccToolChain();
|
||||
|
||||
friend class Internal::LinuxIccToolChainFactory;
|
||||
friend class ToolChainFactory;
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
ToolChain *restore(const QVariantMap &data) override;
|
||||
|
||||
protected:
|
||||
virtual GccToolChain *createToolChain(bool autoDetect);
|
||||
virtual GccToolChain *createToolChain();
|
||||
|
||||
Utils::FileName compilerPathFromEnvironment(const QString &compilerName);
|
||||
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
QList<ToolChain *> autoDetect(const Utils::FileName &compilerPath, const Core::Id &language) final;
|
||||
|
||||
protected:
|
||||
GccToolChain *createToolChain(bool autoDetect) override;
|
||||
GccToolChain *createToolChain() override;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
QList<ToolChain *> autoDetect(const Utils::FileName &compilerPath, const Core::Id &language) final;
|
||||
|
||||
protected:
|
||||
GccToolChain *createToolChain(bool autoDetect) override;
|
||||
GccToolChain *createToolChain() override;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -186,7 +186,7 @@ public:
|
||||
QList<ToolChain *> autoDetect(const Utils::FileName &compilerPath, const Core::Id &language) final;
|
||||
|
||||
protected:
|
||||
GccToolChain *createToolChain(bool autoDetect) override;
|
||||
GccToolChain *createToolChain() override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -781,9 +781,8 @@ Utils::Environment MsvcToolChain::readEnvironmentSetting(const Utils::Environmen
|
||||
MsvcToolChain::MsvcToolChain(const QString &name,
|
||||
const Abi &abi,
|
||||
const QString &varsBat,
|
||||
const QString &varsBatArg,
|
||||
Detection d)
|
||||
: MsvcToolChain(Constants::MSVC_TOOLCHAIN_TYPEID, name, abi, varsBat, varsBatArg, d)
|
||||
const QString &varsBatArg)
|
||||
: MsvcToolChain(Constants::MSVC_TOOLCHAIN_TYPEID, name, abi, varsBat, varsBatArg)
|
||||
{}
|
||||
|
||||
MsvcToolChain::MsvcToolChain(const MsvcToolChain &other)
|
||||
@@ -826,9 +825,8 @@ MsvcToolChain::MsvcToolChain(Core::Id typeId,
|
||||
const QString &name,
|
||||
const Abi &abi,
|
||||
const QString &varsBat,
|
||||
const QString &varsBatArg,
|
||||
Detection d)
|
||||
: ToolChain(typeId, d)
|
||||
const QString &varsBatArg)
|
||||
: ToolChain(typeId)
|
||||
, m_headerPathsMutex(new QMutex)
|
||||
, m_lastEnvironment(Utils::Environment::systemEnvironment())
|
||||
, m_abi(abi)
|
||||
@@ -848,8 +846,7 @@ MsvcToolChain::MsvcToolChain(Core::Id typeId,
|
||||
}
|
||||
|
||||
MsvcToolChain::MsvcToolChain(Core::Id typeId)
|
||||
: ToolChain(typeId, ManualDetection)
|
||||
, m_lastEnvironment(Utils::Environment::systemEnvironment())
|
||||
: ToolChain(typeId)
|
||||
{}
|
||||
|
||||
void MsvcToolChain::inferWarningsForLevel(int warningLevel, WarningFlags &flags)
|
||||
@@ -1421,7 +1418,8 @@ static QList<ToolChain *> detectClangClToolChainInPath(const QString &clangClPat
|
||||
clangClPath);
|
||||
}));
|
||||
if (!tc) {
|
||||
tc = new ClangClToolChain(name, clangClPath, ToolChain::AutoDetection);
|
||||
tc = new ClangClToolChain(name, clangClPath);
|
||||
tc->setDetection(ToolChain::AutoDetection);
|
||||
tc->setLanguage(language);
|
||||
tc->resetMsvcToolChain(toolChain);
|
||||
}
|
||||
@@ -1483,9 +1481,8 @@ void ClangClToolChainConfigWidget::makeReadOnlyImpl()
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
ClangClToolChain::ClangClToolChain(const QString &name,
|
||||
const QString &clangPath,
|
||||
Detection d)
|
||||
: MsvcToolChain(Constants::CLANG_CL_TOOLCHAIN_TYPEID, name, Abi(), "", "", d)
|
||||
const QString &clangPath)
|
||||
: MsvcToolChain(Constants::CLANG_CL_TOOLCHAIN_TYPEID, name, Abi(), "", "")
|
||||
, m_clangPath(clangPath)
|
||||
{}
|
||||
|
||||
@@ -1656,8 +1653,7 @@ static QList<ToolChain *> findOrCreateToolChain(const QList<ToolChain *> &alread
|
||||
const QString &name,
|
||||
const Abi &abi,
|
||||
const QString &varsBat,
|
||||
const QString &varsBatArg,
|
||||
ToolChain::Detection d = ToolChain::ManualDetection)
|
||||
const QString &varsBatArg)
|
||||
{
|
||||
QList<ToolChain *> res;
|
||||
for (auto language : {Constants::C_LANGUAGE_ID, Constants::CXX_LANGUAGE_ID}) {
|
||||
@@ -1672,7 +1668,7 @@ static QList<ToolChain *> findOrCreateToolChain(const QList<ToolChain *> &alread
|
||||
return mtc->varsBat() == varsBat && mtc->varsBatArg() == varsBatArg;
|
||||
});
|
||||
if (!tc) {
|
||||
tc = new MsvcToolChain(name, abi, varsBat, varsBatArg, d);
|
||||
tc = new MsvcToolChain(name, abi, varsBat, varsBatArg);
|
||||
tc->setLanguage(language);
|
||||
}
|
||||
res << tc;
|
||||
@@ -1712,8 +1708,8 @@ static void detectCppBuildTools2015(QList<ToolChain *> *list)
|
||||
auto tc = new MsvcToolChain(name + QLatin1String(e.postFix),
|
||||
abi,
|
||||
vcVarsBat,
|
||||
QLatin1String(e.varsBatArg),
|
||||
ToolChain::AutoDetection);
|
||||
QLatin1String(e.varsBatArg));
|
||||
tc->setDetection(ToolChain::AutoDetection);
|
||||
tc->setLanguage(language);
|
||||
list->append(tc);
|
||||
}
|
||||
@@ -1761,8 +1757,7 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect(const QList<ToolChain *> &al
|
||||
platform.first,
|
||||
sdkKey),
|
||||
fi.absoluteFilePath(),
|
||||
"/" + platform.second,
|
||||
ToolChain::AutoDetection));
|
||||
"/" + platform.second));
|
||||
}
|
||||
// Make sure the default is front.
|
||||
if (folder == defaultSdkPath)
|
||||
@@ -1797,14 +1792,16 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect(const QList<ToolChain *> &al
|
||||
generateDisplayName(i.vsName, MsvcToolChain::VS, platform),
|
||||
findAbiOfMsvc(MsvcToolChain::VS, platform, i.vsName),
|
||||
i.vcVarsAll,
|
||||
platformName(platform),
|
||||
ToolChain::AutoDetection));
|
||||
platformName(platform)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
detectCppBuildTools2015(&results);
|
||||
|
||||
for (ToolChain *tc : results)
|
||||
tc->setDetection(ToolChain::AutoDetection);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -1862,7 +1859,7 @@ QList<ToolChain *> ClangClToolChainFactory::autoDetect(const QList<ToolChain *>
|
||||
|
||||
ToolChain *ClangClToolChainFactory::create()
|
||||
{
|
||||
return new ClangClToolChain("clang-cl", "", ToolChain::ManualDetection);
|
||||
return new ClangClToolChain("clang-cl", "");
|
||||
}
|
||||
|
||||
bool MsvcToolChain::operator==(const ToolChain &other) const
|
||||
|
@@ -58,8 +58,7 @@ public:
|
||||
explicit MsvcToolChain(const QString &name,
|
||||
const Abi &abi,
|
||||
const QString &varsBat,
|
||||
const QString &varsBatArg,
|
||||
Detection d = ManualDetection);
|
||||
const QString &varsBatArg);
|
||||
MsvcToolChain(const MsvcToolChain &other);
|
||||
MsvcToolChain();
|
||||
~MsvcToolChain() override;
|
||||
@@ -127,8 +126,7 @@ protected:
|
||||
const QString &name,
|
||||
const Abi &abi,
|
||||
const QString &varsBat,
|
||||
const QString &varsBatArg,
|
||||
Detection d);
|
||||
const QString &varsBatArg);
|
||||
explicit MsvcToolChain(Core::Id typeId);
|
||||
|
||||
static void inferWarningsForLevel(int warningLevel, WarningFlags &flags);
|
||||
@@ -179,7 +177,7 @@ protected:
|
||||
class PROJECTEXPLORER_EXPORT ClangClToolChain : public MsvcToolChain
|
||||
{
|
||||
public:
|
||||
ClangClToolChain(const QString &name, const QString &llvmDir, Detection d);
|
||||
ClangClToolChain(const QString &name, const QString &llvmDir);
|
||||
ClangClToolChain();
|
||||
|
||||
bool isValid() const override;
|
||||
|
@@ -55,10 +55,9 @@ class ToolChainPrivate
|
||||
public:
|
||||
using Detection = ToolChain::Detection;
|
||||
|
||||
explicit ToolChainPrivate(Core::Id typeId, Detection d) :
|
||||
explicit ToolChainPrivate(Core::Id typeId) :
|
||||
m_id(QUuid::createUuid().toByteArray()),
|
||||
m_typeId(typeId),
|
||||
m_detection(d),
|
||||
m_predefinedMacrosCache(new ToolChain::MacrosCache::element_type()),
|
||||
m_headerPathsCache(new ToolChain::HeaderPathsCache::element_type())
|
||||
{
|
||||
@@ -71,7 +70,7 @@ public:
|
||||
mutable QString m_displayName;
|
||||
Core::Id m_typeId;
|
||||
Core::Id m_language;
|
||||
Detection m_detection;
|
||||
Detection m_detection = ToolChain::UninitializedDetection;
|
||||
|
||||
ToolChain::MacrosCache m_predefinedMacrosCache;
|
||||
ToolChain::HeaderPathsCache m_headerPathsCache;
|
||||
@@ -121,16 +120,18 @@ QString languageId(Language l)
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
ToolChain::ToolChain(Core::Id typeId, Detection d) :
|
||||
d(std::make_unique<Internal::ToolChainPrivate>(typeId, d))
|
||||
ToolChain::ToolChain(Core::Id typeId) :
|
||||
d(std::make_unique<Internal::ToolChainPrivate>(typeId))
|
||||
{
|
||||
}
|
||||
|
||||
ToolChain::ToolChain(const ToolChain &other) : ToolChain(other.d->m_typeId, ManualDetection)
|
||||
ToolChain::ToolChain(const ToolChain &other) : ToolChain(other.d->m_typeId)
|
||||
{
|
||||
d->m_language = other.d->m_language;
|
||||
|
||||
// leave the autodetection bit at false.
|
||||
// leave the autodetection bit at false. // FIXME: <- is this comment valid.
|
||||
d->m_detection = ManualDetection;
|
||||
|
||||
d->m_displayName = QCoreApplication::translate("ProjectExplorer::ToolChain", "Clone of %1")
|
||||
.arg(other.displayName());
|
||||
}
|
||||
@@ -246,8 +247,12 @@ void ToolChain::setDetection(ToolChain::Detection de)
|
||||
{
|
||||
if (d->m_detection == de)
|
||||
return;
|
||||
d->m_detection = de;
|
||||
toolChainUpdated();
|
||||
if (d->m_detection == ToolChain::UninitializedDetection) {
|
||||
d->m_detection = de;
|
||||
} else {
|
||||
d->m_detection = de;
|
||||
toolChainUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@@ -84,6 +84,7 @@ public:
|
||||
AutoDetection,
|
||||
AutoDetectionFromSettings,
|
||||
AutoDetectionFromSdk,
|
||||
UninitializedDetection,
|
||||
};
|
||||
|
||||
using Predicate = std::function<bool(const ToolChain *)>;
|
||||
@@ -156,11 +157,13 @@ public:
|
||||
virtual bool isJobCountSupported() const { return true; }
|
||||
|
||||
void setLanguage(Core::Id language);
|
||||
void setDetection(Detection d);
|
||||
|
||||
static Utils::LanguageVersion cxxLanguageVersion(const QByteArray &cplusplusMacroValue);
|
||||
static Utils::LanguageVersion languageVersion(const Core::Id &language, const Macros ¯os);
|
||||
|
||||
protected:
|
||||
explicit ToolChain(Core::Id typeId, Detection d);
|
||||
explicit ToolChain(Core::Id typeId);
|
||||
explicit ToolChain(const ToolChain &);
|
||||
|
||||
const MacrosCache &predefinedMacrosCache() const;
|
||||
@@ -172,8 +175,6 @@ protected:
|
||||
virtual bool fromMap(const QVariantMap &data);
|
||||
|
||||
private:
|
||||
void setDetection(Detection d);
|
||||
|
||||
const std::unique_ptr<Internal::ToolChainPrivate> d;
|
||||
|
||||
friend class Internal::ToolChainSettingsAccessor;
|
||||
|
@@ -513,6 +513,7 @@ void ToolChainOptionsWidget::createToolChain(ToolChainFactory *factory, const Co
|
||||
if (!tc)
|
||||
return;
|
||||
|
||||
tc->setDetection(ToolChain::ManualDetection);
|
||||
tc->setLanguage(language);
|
||||
|
||||
auto item = insertToolChain(tc, true);
|
||||
@@ -526,11 +527,13 @@ void ToolChainOptionsWidget::cloneToolChain()
|
||||
ToolChainTreeItem *current = currentTreeItem();
|
||||
if (!current)
|
||||
return;
|
||||
ToolChain *tc = current->toolChain->clone();
|
||||
|
||||
ToolChain *tc = current->toolChain->clone();
|
||||
if (!tc)
|
||||
return;
|
||||
|
||||
tc->setDetection(ToolChain::ManualDetection);
|
||||
|
||||
auto item = insertToolChain(tc, true);
|
||||
m_toAddList.append(item);
|
||||
|
||||
|
@@ -295,8 +295,8 @@ using TCList = QList<ToolChain *>;
|
||||
class TTC : public ToolChain
|
||||
{
|
||||
public:
|
||||
TTC(ToolChain::Detection d, const QByteArray &t, bool v = true) :
|
||||
ToolChain("TestToolChainType", d),
|
||||
TTC(const QByteArray &t, bool v = true) :
|
||||
ToolChain("TestToolChainType"),
|
||||
token(t),
|
||||
m_valid(v)
|
||||
{
|
||||
@@ -333,7 +333,7 @@ public:
|
||||
|
||||
private:
|
||||
TTC(const TTC &other) :
|
||||
ToolChain(other.typeId(), other.detection()),
|
||||
ToolChain(other.typeId()),
|
||||
token(other.token)
|
||||
{}
|
||||
|
||||
@@ -375,19 +375,29 @@ void ProjectExplorerPlugin::testToolChainMerging_data()
|
||||
TTC *auto3i = nullptr;
|
||||
|
||||
if (!TTC::hasToolChains()) {
|
||||
system1 = new TTC(ToolChain::AutoDetection, "system1"); Q_UNUSED(system1);
|
||||
system1 = new TTC("system1");
|
||||
system1->setDetection(ToolChain::AutoDetection);
|
||||
system1c = system1->clone(); Q_UNUSED(system1c);
|
||||
system2 = new TTC(ToolChain::AutoDetection, "system2"); Q_UNUSED(system2);
|
||||
system3i = new TTC(ToolChain::AutoDetection, "system3", false); Q_UNUSED(system3i);
|
||||
user1 = new TTC(ToolChain::ManualDetection, "user1"); Q_UNUSED(user1);
|
||||
system2 = new TTC("system2");
|
||||
system2->setDetection(ToolChain::AutoDetection);
|
||||
system3i = new TTC("system3", false);
|
||||
system3i->setDetection(ToolChain::AutoDetection);
|
||||
user1 = new TTC("user1");
|
||||
user1->setDetection(ToolChain::ManualDetection);
|
||||
user1c = user1->clone(); Q_UNUSED(user1c);
|
||||
user2 = new TTC(ToolChain::ManualDetection, "user2"); Q_UNUSED(user2);
|
||||
user3i = new TTC(ToolChain::ManualDetection, "user3", false); Q_UNUSED(user3i);
|
||||
auto1 = new TTC(ToolChain::AutoDetectionFromSettings, "auto1"); Q_UNUSED(auto1);
|
||||
user2 = new TTC("user2");
|
||||
user2->setDetection(ToolChain::ManualDetection);
|
||||
user3i = new TTC("user3", false);
|
||||
user3i->setDetection(ToolChain::ManualDetection);
|
||||
auto1 = new TTC("auto1");
|
||||
auto1->setDetection(ToolChain::AutoDetectionFromSettings);
|
||||
auto1c = auto1->clone(); Q_UNUSED(auto1c);
|
||||
auto1_2 = new TTC(ToolChain::AutoDetectionFromSettings, "auto1"); Q_UNUSED(auto1_2);
|
||||
auto2 = new TTC(ToolChain::AutoDetectionFromSettings, "auto2"); Q_UNUSED(auto2);
|
||||
auto3i = new TTC(ToolChain::AutoDetectionFromSettings, "auto3", false); Q_UNUSED(auto3i);
|
||||
auto1_2 = new TTC("auto1");
|
||||
auto1_2->setDetection(ToolChain::AutoDetectionFromSettings);
|
||||
auto2 = new TTC("auto2");
|
||||
auto2->setDetection(ToolChain::AutoDetectionFromSettings);
|
||||
auto3i = new TTC("auto3", false);
|
||||
auto3i->setDetection(ToolChain::AutoDetectionFromSettings);
|
||||
}
|
||||
|
||||
QTest::newRow("no toolchains")
|
||||
|
@@ -265,7 +265,8 @@ QVariant QnxConfiguration::createDebugger(const Target &target)
|
||||
|
||||
QnxToolChain *QnxConfiguration::createToolChain(const Target &target)
|
||||
{
|
||||
auto toolChain = new QnxToolChain(ToolChain::AutoDetection);
|
||||
auto toolChain = new QnxToolChain;
|
||||
toolChain->setDetection(ToolChain::AutoDetection);
|
||||
toolChain->setLanguage(ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
toolChain->setTargetAbi(target.m_abi);
|
||||
toolChain->setDisplayName(
|
||||
|
@@ -100,8 +100,8 @@ static QStringList reinterpretOptions(const QStringList &args)
|
||||
return arguments;
|
||||
}
|
||||
|
||||
QnxToolChain::QnxToolChain(ToolChain::Detection d)
|
||||
: GccToolChain(Constants::QNX_TOOLCHAIN_ID, d)
|
||||
QnxToolChain::QnxToolChain()
|
||||
: GccToolChain(Constants::QNX_TOOLCHAIN_ID)
|
||||
{
|
||||
setOptionsReinterpreter(&reinterpretOptions);
|
||||
}
|
||||
@@ -223,7 +223,7 @@ QList<ProjectExplorer::ToolChain *> QnxToolChainFactory::autoDetect(
|
||||
|
||||
ToolChain *QnxToolChainFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
auto tc = new QnxToolChain(ToolChain::ManualDetection);
|
||||
auto tc = new QnxToolChain;
|
||||
if (tc->fromMap(data))
|
||||
return tc;
|
||||
|
||||
@@ -238,7 +238,7 @@ bool QnxToolChainFactory::canCreate()
|
||||
|
||||
ToolChain *QnxToolChainFactory::create()
|
||||
{
|
||||
return new QnxToolChain(ToolChain::ManualDetection);
|
||||
return new QnxToolChain;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
|
@@ -34,7 +34,7 @@ namespace Internal {
|
||||
class QnxToolChain : public ProjectExplorer::GccToolChain
|
||||
{
|
||||
public:
|
||||
explicit QnxToolChain(Detection d);
|
||||
QnxToolChain();
|
||||
|
||||
QString typeDisplayName() const override;
|
||||
|
||||
|
Reference in New Issue
Block a user