forked from qt-creator/qt-creator
ProjectExplorer: Remove SysRootKitInformation::hasSysRoot()
This function is exactly the same as SysrootKitInformation::sysroot(), except that is returns a boolean. And it's always used like this: if (SysRootKitInformation::hasSysRoot(k)) sysroot = SysRootKitInformation::SysrootKitInformation::sysroot(k); Which means that the same code is executed twice in a row. There is no point in this, so let's just remove it. Change-Id: I95e4de101d6164ed48558b888e22ed8892fc6d9b Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -551,9 +551,7 @@ static Utils::FileNameList collectQtIncludePaths(const ProjectExplorer::Kit *kit
|
||||
|
||||
static Utils::FileName sysroot(const Kit *kit)
|
||||
{
|
||||
if (kit && SysRootKitInformation::hasSysRoot(kit))
|
||||
return SysRootKitInformation::sysRoot(kit);
|
||||
return Utils::FileName();
|
||||
return SysRootKitInformation::sysRoot(kit);
|
||||
}
|
||||
|
||||
static Utils::FileNameList sourceFiles(const Project *currentProject = nullptr)
|
||||
|
@@ -117,13 +117,6 @@ Core::Id SysRootKitInformation::id()
|
||||
return "PE.Profile.SysRoot";
|
||||
}
|
||||
|
||||
bool SysRootKitInformation::hasSysRoot(const Kit *k)
|
||||
{
|
||||
if (k)
|
||||
return !k->value(SysRootKitInformation::id()).toString().isEmpty();
|
||||
return false;
|
||||
}
|
||||
|
||||
Utils::FileName SysRootKitInformation::sysRoot(const Kit *k)
|
||||
{
|
||||
if (!k)
|
||||
|
@@ -60,7 +60,6 @@ public:
|
||||
void addToMacroExpander(Kit *kit, Utils::MacroExpander *expander) const override;
|
||||
|
||||
static Core::Id id();
|
||||
static bool hasSysRoot(const Kit *k);
|
||||
static Utils::FileName sysRoot(const Kit *k);
|
||||
static void setSysRoot(Kit *k, const Utils::FileName &v);
|
||||
};
|
||||
|
@@ -223,7 +223,7 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor
|
||||
QVariantMap data = defaultData;
|
||||
|
||||
const QString sysroot = ProjectExplorer::SysRootKitInformation::sysRoot(k).toUserOutput();
|
||||
if (ProjectExplorer::SysRootKitInformation::hasSysRoot(k))
|
||||
if (!sysroot.isEmpty())
|
||||
data.insert(QLatin1String(QBS_SYSROOT), sysroot);
|
||||
|
||||
ProjectExplorer::ToolChain *tcC
|
||||
|
@@ -684,8 +684,7 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFile *
|
||||
}
|
||||
|
||||
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k);
|
||||
m_qmakeSysroot = SysRootKitInformation::hasSysRoot(k)
|
||||
? SysRootKitInformation::sysRoot(k).toString() : QString();
|
||||
m_qmakeSysroot = SysRootKitInformation::sysRoot(k).toString();
|
||||
|
||||
if (qtVersion && qtVersion->isValid()) {
|
||||
m_qmakeGlobals->qmake_abslocation = QDir::cleanPath(qtVersion->qmakeCommand().toString());
|
||||
|
@@ -88,9 +88,7 @@ public:
|
||||
QString host;
|
||||
|
||||
if (kit) {
|
||||
if (SysRootKitInformation::hasSysRoot(kit))
|
||||
systemRoot = SysRootKitInformation::sysRoot(kit).toString();
|
||||
|
||||
systemRoot = SysRootKitInformation::sysRoot(kit).toString();
|
||||
const IDevice::ConstPtr deviceConfiguration = DeviceKitInformation::device(kit);
|
||||
host = deviceConfiguration->sshParameters().host();
|
||||
}
|
||||
|
Reference in New Issue
Block a user