ProjectExplorer: Use unique_ptr for Project::setRootProjectNode

Change-Id: If63a49d0eecfb93adcc6076fcb3208c87603af10
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Tobias Hunger
2018-04-26 14:41:46 +02:00
parent 1f55ba9012
commit 5754d5accf
15 changed files with 38 additions and 42 deletions

View File

@@ -272,7 +272,7 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
auto newRoot = generateProjectTree(m_allFiles);
if (newRoot) {
setDisplayName(newRoot->displayName());
setRootProjectNode(newRoot);
setRootProjectNode(std::move(newRoot));
}
updateApplicationAndDeploymentTargets();
@@ -348,14 +348,15 @@ void CMakeProject::updateQmlJSCodeModel()
modelManager->updateProjectInfo(projectInfo, this);
}
CMakeProjectNode *CMakeProject::generateProjectTree(const QList<const FileNode *> &allFiles) const
std::unique_ptr<CMakeProjectNode>
CMakeProject::generateProjectTree(const QList<const FileNode *> &allFiles) const
{
if (m_buildDirManager.isParsing())
return nullptr;
auto root = std::make_unique<CMakeProjectNode>(projectDirectory());
m_buildDirManager.generateProjectTree(root.get(), allFiles);
return root ? root.release() : nullptr;
return root;
}
bool CMakeProject::knowsAllBuildExecutables() const