summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGeneratorFactory.h
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-01-02 16:07:09 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2020-01-07 10:03:11 (GMT)
commita00960288bedb3cd9495222e7917c9a1092ce4c9 (patch)
tree03843ce4517050e051c1a225912841c5dabb8174 /Source/cmGlobalGeneratorFactory.h
parente353d8bd9bfd90396089e514d5b77f027ac27e99 (diff)
downloadCMake-a00960288bedb3cd9495222e7917c9a1092ce4c9.zip
CMake-a00960288bedb3cd9495222e7917c9a1092ce4c9.tar.gz
CMake-a00960288bedb3cd9495222e7917c9a1092ce4c9.tar.bz2
GlobalGenerator family: modernize memory management
Diffstat (limited to 'Source/cmGlobalGeneratorFactory.h')
-rw-r--r--Source/cmGlobalGeneratorFactory.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h
index bb5f74c..3709365 100644
--- a/Source/cmGlobalGeneratorFactory.h
+++ b/Source/cmGlobalGeneratorFactory.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include <cm/memory>
+
class cmGlobalGenerator;
class cmake;
struct cmDocumentationEntry;
@@ -23,8 +25,8 @@ public:
virtual ~cmGlobalGeneratorFactory() = default;
/** Create a GlobalGenerator */
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& n,
- cmake* cm) const = 0;
+ virtual std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& n, cmake* cm) const = 0;
/** Get the documentation entry for this factory */
virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
@@ -51,13 +53,13 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
{
public:
/** Create a GlobalGenerator */
- cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const override
+ std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
+ const std::string& name, cmake* cm) const override
{
if (name != T::GetActualName()) {
- return nullptr;
+ return std::unique_ptr<cmGlobalGenerator>();
}
- return new T(cm);
+ return std::unique_ptr<cmGlobalGenerator>(cm::make_unique<T>(cm));
}
/** Get the documentation entry for this factory */