diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2018-04-26 14:57:12 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2018-05-02 11:34:47 +0000 |
commit | 147e6078ad8c6a59a87789ad5bbfad196345286c (patch) | |
tree | 189cd8a597880556587f4b76a8e52c3f4b09fce0 /src/plugins/cmakeprojectmanager/servermodereader.cpp | |
parent | 04057106ba4f34eeeec86ef44dcf138eaccd55dd (diff) | |
download | qt-creator-147e6078ad8c6a59a87789ad5bbfad196345286c.tar.gz |
ProjectExplorer: Make FolderNodeFactory return an unique_ptr
Change-Id: I9b611c4a3ff0928b2078dc30a44eb39df67c8d89
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/servermodereader.cpp')
-rw-r--r-- | src/plugins/cmakeprojectmanager/servermodereader.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/plugins/cmakeprojectmanager/servermodereader.cpp b/src/plugins/cmakeprojectmanager/servermodereader.cpp index 4d71947ff2..5a0379227f 100644 --- a/src/plugins/cmakeprojectmanager/servermodereader.cpp +++ b/src/plugins/cmakeprojectmanager/servermodereader.cpp @@ -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; |