mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-23 23:49:02 -06:00
cmInstalledFile: modernize memory management
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "cmAlgorithms.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmListFileCache.h"
|
||||
#include "cmMakefile.h"
|
||||
@@ -12,17 +11,11 @@
|
||||
|
||||
cmInstalledFile::cmInstalledFile() = default;
|
||||
|
||||
cmInstalledFile::~cmInstalledFile()
|
||||
{
|
||||
delete NameExpression;
|
||||
}
|
||||
cmInstalledFile::~cmInstalledFile() = default;
|
||||
|
||||
cmInstalledFile::Property::Property() = default;
|
||||
|
||||
cmInstalledFile::Property::~Property()
|
||||
{
|
||||
cmDeleteAll(this->ValueExpressions);
|
||||
}
|
||||
cmInstalledFile::Property::~Property() = default;
|
||||
|
||||
void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name)
|
||||
{
|
||||
@@ -30,7 +23,7 @@ void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name)
|
||||
cmGeneratorExpression ge(backtrace);
|
||||
|
||||
this->Name = name;
|
||||
this->NameExpression = ge.Parse(name).release();
|
||||
this->NameExpression = ge.Parse(name);
|
||||
}
|
||||
|
||||
std::string const& cmInstalledFile::GetName() const
|
||||
@@ -63,7 +56,7 @@ void cmInstalledFile::AppendProperty(cmMakefile const* mf,
|
||||
cmGeneratorExpression ge(backtrace);
|
||||
|
||||
Property& property = this->Properties[prop];
|
||||
property.ValueExpressions.push_back(ge.Parse(value).release());
|
||||
property.ValueExpressions.push_back(ge.Parse(value));
|
||||
}
|
||||
|
||||
bool cmInstalledFile::HasProperty(const std::string& prop) const
|
||||
@@ -84,7 +77,7 @@ bool cmInstalledFile::GetProperty(const std::string& prop,
|
||||
std::string output;
|
||||
std::string separator;
|
||||
|
||||
for (auto ve : property.ValueExpressions) {
|
||||
for (const auto& ve : property.ValueExpressions) {
|
||||
output += separator;
|
||||
output += ve->GetInput();
|
||||
separator = ";";
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
using CompiledGeneratorExpressionPtrType =
|
||||
std::unique_ptr<cmCompiledGeneratorExpression>;
|
||||
|
||||
using ExpressionVectorType = std::vector<cmCompiledGeneratorExpression*>;
|
||||
using ExpressionVectorType = std::vector<CompiledGeneratorExpressionPtrType>;
|
||||
|
||||
struct Property
|
||||
{
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
|
||||
private:
|
||||
std::string Name;
|
||||
cmCompiledGeneratorExpression* NameExpression = nullptr;
|
||||
CompiledGeneratorExpressionPtrType NameExpression;
|
||||
PropertyMapType Properties;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user