Merge topic 'unique'

9ecb3f8d5c Ninja,Makefile: use `unique_ptr` for memory management

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3230
This commit is contained in:
Brad King
2019-04-18 15:06:58 +00:00
committed by Kitware Robot
7 changed files with 21 additions and 30 deletions
@@ -9,6 +9,7 @@
#include <utility>
#include <vector>
#include "cmAlgorithms.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
@@ -35,14 +36,12 @@ cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator(
this->GeneratorTarget->GetExecutableNames(this->ConfigName);
this->OSXBundleGenerator =
new cmOSXBundleGenerator(target, this->ConfigName);
cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
}
cmMakefileExecutableTargetGenerator::~cmMakefileExecutableTargetGenerator()
{
delete this->OSXBundleGenerator;
}
cmMakefileExecutableTargetGenerator::~cmMakefileExecutableTargetGenerator() =
default;
void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
{
+4 -5
View File
@@ -9,6 +9,7 @@
#include <utility>
#include <vector>
#include "cmAlgorithms.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
@@ -37,14 +38,12 @@ cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator(
}
this->OSXBundleGenerator =
new cmOSXBundleGenerator(target, this->ConfigName);
cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
}
cmMakefileLibraryTargetGenerator::~cmMakefileLibraryTargetGenerator()
{
delete this->OSXBundleGenerator;
}
cmMakefileLibraryTargetGenerator::~cmMakefileLibraryTargetGenerator() =
default;
void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
{
+1 -1
View File
@@ -235,7 +235,7 @@ protected:
// macOS content info.
std::set<std::string> MacContentFolders;
cmOSXBundleGenerator* OSXBundleGenerator;
std::unique_ptr<cmOSXBundleGenerator> OSXBundleGenerator;
MacOSXContentGeneratorType* MacOSXContentGenerator;
};
+4 -5
View File
@@ -7,6 +7,7 @@
#include <utility>
#include <vector>
#include "cmAlgorithms.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
@@ -21,14 +22,12 @@ cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator(
{
this->CustomCommandDriver = OnUtility;
this->OSXBundleGenerator =
new cmOSXBundleGenerator(target, this->ConfigName);
cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
}
cmMakefileUtilityTargetGenerator::~cmMakefileUtilityTargetGenerator()
{
delete this->OSXBundleGenerator;
}
cmMakefileUtilityTargetGenerator::~cmMakefileUtilityTargetGenerator() =
default;
void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
{
+2 -5
View File
@@ -54,14 +54,11 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
}
this->OSXBundleGenerator =
new cmOSXBundleGenerator(target, this->GetConfigName());
cm::make_unique<cmOSXBundleGenerator>(target, this->GetConfigName());
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
}
cmNinjaNormalTargetGenerator::~cmNinjaNormalTargetGenerator()
{
delete this->OSXBundleGenerator;
}
cmNinjaNormalTargetGenerator::~cmNinjaNormalTargetGenerator() = default;
void cmNinjaNormalTargetGenerator::Generate()
{
+4 -7
View File
@@ -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) {
+2 -2
View File
@@ -153,9 +153,9 @@ protected:
};
friend struct MacOSXContentGeneratorType;
MacOSXContentGeneratorType* MacOSXContentGenerator;
std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator;
// Properly initialized by sub-classes.
cmOSXBundleGenerator* OSXBundleGenerator;
std::unique_ptr<cmOSXBundleGenerator> OSXBundleGenerator;
std::set<std::string> MacContentFolders;
void addPoolNinjaVariable(const std::string& pool_property,