forked from qt-creator/qt-creator
CppTools: Simplify ProjectUpdateInfo
...by using KitInfo. Change-Id: I17b4dd6c368ba8b10b765f12a4663c041c9be7e5 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -51,6 +51,9 @@ KitInfo::KitInfo(Project *project)
|
||||
cToolChain = ToolChainKitInformation::toolChain(kit, Constants::C_LANGUAGE_ID);
|
||||
cxxToolChain = ToolChainKitInformation::toolChain(kit, Constants::CXX_LANGUAGE_ID);
|
||||
}
|
||||
|
||||
// Sysroot
|
||||
sysRootPath = ProjectExplorer::SysRootKitInformation::sysRoot(kit).toString();
|
||||
}
|
||||
|
||||
bool KitInfo::isValid() const
|
||||
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
ProjectExplorer::ToolChain *cxxToolChain = nullptr;
|
||||
|
||||
ProjectPart::QtVersion projectPartQtVersion = ProjectPart::NoQt;
|
||||
|
||||
QString sysRootPath;
|
||||
};
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "projectinfo.h"
|
||||
|
||||
#include "cppkitinfo.h"
|
||||
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
@@ -33,7 +35,7 @@
|
||||
namespace CppTools {
|
||||
|
||||
ToolChainInfo::ToolChainInfo(const ProjectExplorer::ToolChain *toolChain,
|
||||
const ProjectExplorer::Kit *kit)
|
||||
const QString &sysRootPath)
|
||||
{
|
||||
if (toolChain) {
|
||||
// Keep the following cheap/non-blocking for the ui thread...
|
||||
@@ -46,36 +48,21 @@ ToolChainInfo::ToolChainInfo(const ProjectExplorer::ToolChain *toolChain,
|
||||
|
||||
// ...and save the potentially expensive operations for later so that
|
||||
// they can be run from a worker thread.
|
||||
sysRootPath = ProjectExplorer::SysRootKitInformation::sysRoot(kit).toString();
|
||||
this->sysRootPath = sysRootPath;
|
||||
headerPathsRunner = toolChain->createBuiltInHeaderPathsRunner();
|
||||
macroInspectionRunner = toolChain->createMacroInspectionRunner();
|
||||
}
|
||||
}
|
||||
|
||||
ProjectUpdateInfo::ProjectUpdateInfo(ProjectExplorer::Project *project,
|
||||
const ProjectExplorer::ToolChain *cToolChain,
|
||||
const ProjectExplorer::ToolChain *cxxToolChain,
|
||||
const ProjectExplorer::Kit *kit,
|
||||
const KitInfo &kitInfo,
|
||||
const RawProjectParts &rawProjectParts)
|
||||
: project(project)
|
||||
, rawProjectParts(rawProjectParts)
|
||||
, cToolChain(cToolChain)
|
||||
, cxxToolChain(cxxToolChain)
|
||||
, cToolChainInfo(ToolChainInfo(cToolChain, kit))
|
||||
, cxxToolChainInfo(ToolChainInfo(cxxToolChain, kit))
|
||||
{
|
||||
}
|
||||
|
||||
ProjectUpdateInfo::ProjectUpdateInfo(ProjectExplorer::Project *project,
|
||||
const ToolChainInfo &cToolChainInfo,
|
||||
const ToolChainInfo &cxxToolChainInfo,
|
||||
const RawProjectParts &rawProjectParts)
|
||||
: project(project)
|
||||
, rawProjectParts(rawProjectParts)
|
||||
, cToolChain(nullptr)
|
||||
, cxxToolChain(nullptr)
|
||||
, cToolChainInfo(cToolChainInfo)
|
||||
, cxxToolChainInfo(cxxToolChainInfo)
|
||||
, cToolChain(kitInfo.cToolChain)
|
||||
, cxxToolChain(kitInfo.cxxToolChain)
|
||||
, cToolChainInfo(ToolChainInfo(cToolChain, kitInfo.sysRootPath))
|
||||
, cxxToolChainInfo(ToolChainInfo(cxxToolChain, kitInfo.sysRootPath))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -40,12 +40,14 @@
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
class KitInfo;
|
||||
|
||||
class ToolChainInfo
|
||||
{
|
||||
public:
|
||||
ToolChainInfo() = default;
|
||||
ToolChainInfo(const ProjectExplorer::ToolChain *toolChain,
|
||||
const ProjectExplorer::Kit *kit);
|
||||
const QString &sysRootPath);
|
||||
|
||||
bool isValid() const { return type.isValid(); }
|
||||
|
||||
@@ -66,13 +68,7 @@ class CPPTOOLS_EXPORT ProjectUpdateInfo
|
||||
public:
|
||||
ProjectUpdateInfo() = default;
|
||||
ProjectUpdateInfo(ProjectExplorer::Project *project,
|
||||
const ProjectExplorer::ToolChain *cToolChain,
|
||||
const ProjectExplorer::ToolChain *cxxToolChain,
|
||||
const ProjectExplorer::Kit *kit,
|
||||
const RawProjectParts &rawProjectParts);
|
||||
ProjectUpdateInfo(ProjectExplorer::Project *project,
|
||||
const ToolChainInfo &cToolChainInfo,
|
||||
const ToolChainInfo &cxxToolChainInfo,
|
||||
const KitInfo &kitInfo,
|
||||
const RawProjectParts &rawProjectParts);
|
||||
bool isValid() const { return project && !rawProjectParts.isEmpty(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user