diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2019-04-13 20:01:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-04-18 15:05:25 (GMT) |
commit | 9ecb3f8d5c82a86734ee3af3c17a3a08e6b8daa2 (patch) | |
tree | 35402853bea619f284764c056a76b79a0649f5e2 /Source/cmNinjaTargetGenerator.cxx | |
parent | d38d7747fe91db4753e9aa26e9b7dd8d065e1cdc (diff) | |
download | CMake-9ecb3f8d5c82a86734ee3af3c17a3a08e6b8daa2.zip CMake-9ecb3f8d5c82a86734ee3af3c17a3a08e6b8daa2.tar.gz CMake-9ecb3f8d5c82a86734ee3af3c17a3a08e6b8daa2.tar.bz2 |
Ninja,Makefile: use `unique_ptr` for memory management
Use a `unique_ptr` to manage the lifetime of the `MacOSXContentGenerator`
and 'OSXBundleGenerator` rather than manually handling the lifetime.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1ad26dd..2324839 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -59,13 +59,10 @@ cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) , LocalGenerator( static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator())) { - MacOSXContentGenerator = new MacOSXContentGeneratorType(this); + MacOSXContentGenerator = cm::make_unique<MacOSXContentGeneratorType>(this); } -cmNinjaTargetGenerator::~cmNinjaTargetGenerator() -{ - delete this->MacOSXContentGenerator; -} +cmNinjaTargetGenerator::~cmNinjaTargetGenerator() = default; cmGeneratedFileStream& cmNinjaTargetGenerator::GetBuildFileStream() const { @@ -813,11 +810,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements() std::vector<cmSourceFile const*> headerSources; this->GeneratorTarget->GetHeaderSources(headerSources, config); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - headerSources, this->MacOSXContentGenerator); + headerSources, this->MacOSXContentGenerator.get()); std::vector<cmSourceFile const*> extraSources; this->GeneratorTarget->GetExtraSources(extraSources, config); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - extraSources, this->MacOSXContentGenerator); + extraSources, this->MacOSXContentGenerator.get()); std::vector<cmSourceFile const*> externalObjects; this->GeneratorTarget->GetExternalObjects(externalObjects, config); for (cmSourceFile const* sf : externalObjects) { |