diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-01-02 17:07:09 +0100 |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-01-07 11:03:11 +0100 |
commit | a00960288bedb3cd9495222e7917c9a1092ce4c9 (patch) | |
tree | 03843ce4517050e051c1a225912841c5dabb8174 /Source/cmGlobalVisualStudio10Generator.cxx | |
parent | e353d8bd9bfd90396089e514d5b77f027ac27e99 (diff) | |
download | cmake-a00960288bedb3cd9495222e7917c9a1092ce4c9.tar.gz |
GlobalGenerator family: modernize memory management
Diffstat (limited to 'Source/cmGlobalVisualStudio10Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index bdf4cf2eab..a720cc3e14 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -57,27 +57,30 @@ class cmGlobalVisualStudio10Generator::Factory : public cmGlobalGeneratorFactory { public: - cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, - cmake* cm) const override + std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator( + const std::string& name, cmake* cm) const override { std::string genName; const char* p = cmVS10GenName(name, genName); if (!p) { - return 0; + return std::unique_ptr<cmGlobalGenerator>(); } if (!*p) { - return new cmGlobalVisualStudio10Generator(cm, genName, ""); + return std::unique_ptr<cmGlobalGenerator>( + new cmGlobalVisualStudio10Generator(cm, genName, "")); } if (*p++ != ' ') { - return 0; + return std::unique_ptr<cmGlobalGenerator>(); } if (strcmp(p, "Win64") == 0) { - return new cmGlobalVisualStudio10Generator(cm, genName, "x64"); + return std::unique_ptr<cmGlobalGenerator>( + new cmGlobalVisualStudio10Generator(cm, genName, "x64")); } if (strcmp(p, "IA64") == 0) { - return new cmGlobalVisualStudio10Generator(cm, genName, "Itanium"); + return std::unique_ptr<cmGlobalGenerator>( + new cmGlobalVisualStudio10Generator(cm, genName, "Itanium")); } - return 0; + return std::unique_ptr<cmGlobalGenerator>(); } void GetDocumentation(cmDocumentationEntry& entry) const override @@ -117,9 +120,10 @@ public: std::string GetDefaultPlatformName() const override { return "Win32"; } }; -cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() +std::unique_ptr<cmGlobalGeneratorFactory> +cmGlobalVisualStudio10Generator::NewFactory() { - return new Factory; + return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory); } cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( |