summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2019-06-21 00:41:48 (GMT)
committerBrad King <brad.king@kitware.com>2019-06-24 13:36:09 (GMT)
commit5e52de7d5708c5d2faf00837bf5f10ed024cced1 (patch)
tree78012dbe66b15c98b4bee75730d7693583a99d4f /Source/cmake.cxx
parentcecf7e61c4816e4a3bb55df243c6bf84f6df6e58 (diff)
downloadCMake-5e52de7d5708c5d2faf00837bf5f10ed024cced1.zip
CMake-5e52de7d5708c5d2faf00837bf5f10ed024cced1.tar.gz
CMake-5e52de7d5708c5d2faf00837bf5f10ed024cced1.tar.bz2
modermize: replace some raw pointers w/ `unique_ptr`
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx25
1 files changed, 7 insertions, 18 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 3772f09..8f2f86d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -141,12 +141,12 @@ cmake::cmake(Role role, cmState::Mode mode)
this->DebugOutput = false;
this->DebugTryCompile = false;
this->ClearBuildSystem = false;
- this->FileTimeCache = new cmFileTimeCache;
+ this->FileTimeCache = cm::make_unique<cmFileTimeCache>();
- this->State = new cmState;
+ this->State = cm::make_unique<cmState>();
this->State->SetMode(mode);
this->CurrentSnapshot = this->State->CreateBaseSnapshot();
- this->Messenger = new cmMessenger;
+ this->Messenger = cm::make_unique<cmMessenger>();
#ifdef __APPLE__
struct rlimit rlp;
@@ -165,7 +165,7 @@ cmake::cmake(Role role, cmState::Mode mode)
this->CurrentWorkingMode = NORMAL_MODE;
#ifdef CMAKE_BUILD_WITH_CMAKE
- this->VariableWatch = new cmVariableWatch;
+ this->VariableWatch = cm::make_unique<cmVariableWatch>();
#endif
this->AddDefaultGenerators();
@@ -222,17 +222,11 @@ cmake::cmake(Role role, cmState::Mode mode)
cmake::~cmake()
{
- delete this->State;
- delete this->Messenger;
if (this->GlobalGenerator) {
delete this->GlobalGenerator;
this->GlobalGenerator = nullptr;
}
cmDeleteAll(this->Generators);
-#ifdef CMAKE_BUILD_WITH_CMAKE
- delete this->VariableWatch;
-#endif
- delete this->FileTimeCache;
}
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -460,7 +454,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
return false;
}
// Register fake project commands that hint misuse in script mode.
- GetProjectCommandsInScriptMode(this->State);
+ GetProjectCommandsInScriptMode(this->GetState());
this->ReadListFile(args, path);
} else if (arg.find("--find-package", 0) == 0) {
findPackageMode = true;
@@ -1898,12 +1892,12 @@ const char* cmake::GetCacheDefinition(const std::string& name) const
void cmake::AddScriptingCommands()
{
- GetScriptingCommands(this->State);
+ GetScriptingCommands(this->GetState());
}
void cmake::AddProjectCommands()
{
- GetProjectCommands(this->State);
+ GetProjectCommands(this->GetState());
}
void cmake::AddDefaultGenerators()
@@ -2607,11 +2601,6 @@ std::vector<std::string> cmake::GetDebugConfigs()
return configs;
}
-cmMessenger* cmake::GetMessenger() const
-{
- return this->Messenger;
-}
-
int cmake::Build(int jobs, const std::string& dir,
const std::vector<std::string>& targets,
const std::string& config,