diff options
Diffstat (limited to 'Source/cmMacroCommand.cxx')
-rw-r--r-- | Source/cmMacroCommand.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index e9c6aea..3d553b7 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -6,6 +6,8 @@ #include <stdio.h> #include <utility> +#include "cm_memory.hxx" + #include "cmAlgorithms.h" #include "cmExecutionStatus.h" #include "cmMakefile.h" @@ -21,15 +23,15 @@ public: /** * This is a virtual constructor for the command. */ - cmCommand* Clone() override + std::unique_ptr<cmCommand> Clone() override { - cmMacroHelperCommand* newC = new cmMacroHelperCommand; + auto newC = cm::make_unique<cmMacroHelperCommand>(); // we must copy when we clone newC->Args = this->Args; newC->Functions = this->Functions; newC->FilePath = this->FilePath; newC->Policies = this->Policies; - return newC; + return std::unique_ptr<cmCommand>(std::move(newC)); } /** @@ -164,12 +166,12 @@ bool cmMacroFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, if (!this->Depth) { mf.AppendProperty("MACROS", this->Args[0].c_str()); // create a new command and add it to cmake - cmMacroHelperCommand* f = new cmMacroHelperCommand(); + auto f = cm::make_unique<cmMacroHelperCommand>(); f->Args = this->Args; f->Functions = this->Functions; f->FilePath = this->GetStartingContext().FilePath; mf.RecordPolicies(f->Policies); - mf.GetState()->AddScriptedCommand(this->Args[0], f); + mf.GetState()->AddScriptedCommand(this->Args[0], std::move(f)); // remove the function blocker now that the macro is defined mf.RemoveFunctionBlocker(this, lff); return true; |