ProjectExplorer: Make FolderNodeFactory return an unique_ptr

Change-Id: I9b611c4a3ff0928b2078dc30a44eb39df67c8d89
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Tobias Hunger
2018-04-26 14:57:12 +02:00
parent 04057106ba
commit 147e6078ad
3 changed files with 15 additions and 13 deletions

View File

@@ -727,16 +727,14 @@ ServerModeReader::addCMakeLists(CMakeProjectNode *root, const QList<FileNode *>
= Utils::transform<QSet>(cmakeLists, [](const Node *n) { return n->filePath().parentDir(); });
root->addNestedNodes(cmakeLists, Utils::FileName(),
[&cmakeDirs, &cmakeListsNodes](const Utils::FileName &fp)
-> ProjectExplorer::FolderNode * {
FolderNode *fn = nullptr;
-> std::unique_ptr<ProjectExplorer::FolderNode> {
if (cmakeDirs.contains(fp)) {
CMakeListsNode *n = new CMakeListsNode(fp);
cmakeListsNodes.insert(fp, n);
fn = n;
} else {
fn = new FolderNode(fp);
auto fn = std::make_unique<CMakeListsNode>(fp);
cmakeListsNodes.insert(fp, fn.get());
return fn;
}
return fn;
return std::make_unique<FolderNode>(fp);
});
root->compress();
return cmakeListsNodes;