diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-01-02 10:23:25 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-01-02 10:23:32 (GMT) |
commit | 47a907413bb8aa2394a3003c90775b402b53d35a (patch) | |
tree | a2f5486213f7f51b7efbb196cc7bff3d63b2ad00 /Source/cmake.cxx | |
parent | e16fb762b5ed8fef3b7b65573787a385c1ee098d (diff) | |
parent | 5444a8095da50cdf4306d33fe137baa7711f1781 (diff) | |
download | CMake-47a907413bb8aa2394a3003c90775b402b53d35a.zip CMake-47a907413bb8aa2394a3003c90775b402b53d35a.tar.gz CMake-47a907413bb8aa2394a3003c90775b402b53d35a.tar.bz2 |
Merge topic 'modernize-memory-management'
5444a8095d cmGlobalGenerator: modernize memrory managemenbt
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4166
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8e4f629..5341971 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2,6 +2,15 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmake.h" +#include <algorithm> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <initializer_list> +#include <iostream> +#include <sstream> +#include <utility> + #include <cm/memory> #include <cm/string_view> #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) @@ -10,6 +19,10 @@ #include <cmext/algorithm> +#include "cmsys/FStream.hxx" +#include "cmsys/Glob.hxx" +#include "cmsys/RegularExpression.hxx" + #include "cm_sys_stat.h" #include "cmAlgorithms.h" @@ -108,19 +121,6 @@ # include <sys/time.h> #endif -#include <algorithm> -#include <cstdio> -#include <cstdlib> -#include <cstring> -#include <initializer_list> -#include <iostream> -#include <sstream> -#include <utility> - -#include "cmsys/FStream.hxx" -#include "cmsys/Glob.hxx" -#include "cmsys/RegularExpression.hxx" - namespace { #if !defined(CMAKE_BOOTSTRAP) @@ -513,8 +513,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args) cmSystemTools::GetCurrentWorkingDirectory()); // read in the list file to fill the cache snapshot.SetDefaultDefinitions(); - cmMakefile* mf = new cmMakefile(gg, snapshot); - gg->AddMakefile(mf); + auto mfu = cm::make_unique<cmMakefile>(gg, snapshot); + cmMakefile* mf = mfu.get(); + gg->AddMakefile(std::move(mfu)); mf->SetArgcArgv(args); @@ -1647,7 +1648,7 @@ int cmake::ActualConfigure() } } - cmMakefile* mf = this->GlobalGenerator->GetMakefiles()[0]; + auto& mf = this->GlobalGenerator->GetMakefiles()[0]; if (mf->IsOn("CTEST_USE_LAUNCHERS") && !this->State->GetGlobalProperty("RULE_LAUNCH_COMPILE")) { cmSystemTools::Error( |