summaryrefslogtreecommitdiffstats
path: root/Source/cmIfCommand.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-07-12 10:15:21 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-07-17 12:58:27 (GMT)
commit3bed969dace917e5bf551c6783da425f5e2217c7 (patch)
treec5dc37940f62022d52518e2d73ecaf6d5cc5ceda /Source/cmIfCommand.cxx
parentfaacb90a13f87d32aaf3e5c45cfd48af7e84b733 (diff)
downloadCMake-3bed969dace917e5bf551c6783da425f5e2217c7.zip
CMake-3bed969dace917e5bf551c6783da425f5e2217c7.tar.gz
CMake-3bed969dace917e5bf551c6783da425f5e2217c7.tar.bz2
cmMakefile: Modernize AddFunctionBlocker method to accept a std::unique_ptr
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r--Source/cmIfCommand.cxx22
1 files changed, 14 insertions, 8 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index c58ad06..625dd45 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmIfCommand.h"
+#include "cm_memory.hxx"
+
#include "cmConditionEvaluator.h"
#include "cmExecutionStatus.h"
#include "cmExpandedCommandArgument.h"
@@ -11,6 +13,8 @@
#include "cmSystemTools.h"
#include "cmake.h"
+#include <utility>
+
static std::string cmIfCommandError(
std::vector<cmExpandedCommandArgument> const& args)
{
@@ -200,15 +204,17 @@ bool cmIfCommand::InvokeInitialPass(
this->Makefile->IssueMessage(status, err);
}
- cmIfFunctionBlocker* f = new cmIfFunctionBlocker();
- // if is isn't true block the commands
- f->ScopeDepth = 1;
- f->IsBlocking = !isTrue;
- if (isTrue) {
- f->HasRun = true;
+ {
+ auto fb = cm::make_unique<cmIfFunctionBlocker>();
+ // if is isn't true block the commands
+ fb->ScopeDepth = 1;
+ fb->IsBlocking = !isTrue;
+ if (isTrue) {
+ fb->HasRun = true;
+ }
+ fb->Args = args;
+ this->Makefile->AddFunctionBlocker(std::move(fb));
}
- f->Args = args;
- this->Makefile->AddFunctionBlocker(f);
return true;
}