diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-01-02 16:07:09 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-01-07 10:03:11 (GMT) |
commit | a00960288bedb3cd9495222e7917c9a1092ce4c9 (patch) | |
tree | 03843ce4517050e051c1a225912841c5dabb8174 /Source/cmGlobalVisualStudio12Generator.cxx | |
parent | e353d8bd9bfd90396089e514d5b77f027ac27e99 (diff) | |
download | CMake-a00960288bedb3cd9495222e7917c9a1092ce4c9.zip CMake-a00960288bedb3cd9495222e7917c9a1092ce4c9.tar.gz CMake-a00960288bedb3cd9495222e7917c9a1092ce4c9.tar.bz2 |
GlobalGenerator family: modernize memory management
Diffstat (limited to 'Source/cmGlobalVisualStudio12Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio12Generator.cxx | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index d9702c9..5a27994 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -28,27 +28,30 @@ class cmGlobalVisualStudio12Generator::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 = cmVS12GenName(name, genName); if (!p) { - return 0; + return std::unique_ptr<cmGlobalGenerator>(); } if (!*p) { - return new cmGlobalVisualStudio12Generator(cm, genName, ""); + return std::unique_ptr<cmGlobalGenerator>( + new cmGlobalVisualStudio12Generator(cm, genName, "")); } if (*p++ != ' ') { - return 0; + return std::unique_ptr<cmGlobalGenerator>(); } if (strcmp(p, "Win64") == 0) { - return new cmGlobalVisualStudio12Generator(cm, genName, "x64"); + return std::unique_ptr<cmGlobalGenerator>( + new cmGlobalVisualStudio12Generator(cm, genName, "x64")); } if (strcmp(p, "ARM") == 0) { - return new cmGlobalVisualStudio12Generator(cm, genName, "ARM"); + return std::unique_ptr<cmGlobalGenerator>( + new cmGlobalVisualStudio12Generator(cm, genName, "ARM")); } - return 0; + return std::unique_ptr<cmGlobalGenerator>(); } void GetDocumentation(cmDocumentationEntry& entry) const override @@ -88,9 +91,10 @@ public: std::string GetDefaultPlatformName() const override { return "Win32"; } }; -cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory() +std::unique_ptr<cmGlobalGeneratorFactory> +cmGlobalVisualStudio12Generator::NewFactory() { - return new Factory; + return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory); } cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( |