diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-07-12 10:15:21 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-07-17 12:58:27 (GMT) |
commit | 3bed969dace917e5bf551c6783da425f5e2217c7 (patch) | |
tree | c5dc37940f62022d52518e2d73ecaf6d5cc5ceda /Source/cmForEachCommand.cxx | |
parent | faacb90a13f87d32aaf3e5c45cfd48af7e84b733 (diff) | |
download | CMake-3bed969dace917e5bf551c6783da425f5e2217c7.zip CMake-3bed969dace917e5bf551c6783da425f5e2217c7.tar.gz CMake-3bed969dace917e5bf551c6783da425f5e2217c7.tar.bz2 |
cmMakefile: Modernize AddFunctionBlocker method to accept a std::unique_ptr
Diffstat (limited to 'Source/cmForEachCommand.cxx')
-rw-r--r-- | Source/cmForEachCommand.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 94c1b1a..a30ebe1 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -5,6 +5,7 @@ #include <sstream> #include <stdio.h> #include <stdlib.h> +#include <utility> #include "cm_memory.hxx" @@ -121,7 +122,7 @@ bool cmForEachCommand::InitialPass(std::vector<std::string> const& args, } // create a function blocker - auto f = cm::make_unique<cmForEachFunctionBlocker>(this->Makefile); + auto fb = cm::make_unique<cmForEachFunctionBlocker>(this->Makefile); if (args.size() > 1) { if (args[1] == "RANGE") { int start = 0; @@ -168,23 +169,22 @@ bool cmForEachCommand::InitialPass(std::vector<std::string> const& args, break; } } - f->Args = range; + fb->Args = range; } else { - f->Args = args; + fb->Args = args; } } else { - f->Args = args; + fb->Args = args; } - this->Makefile->AddFunctionBlocker(f.release()); + this->Makefile->AddFunctionBlocker(std::move(fb)); return true; } bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args) { - std::unique_ptr<cmForEachFunctionBlocker> f( - new cmForEachFunctionBlocker(this->Makefile)); - f->Args.push_back(args[0]); + auto fb = cm::make_unique<cmForEachFunctionBlocker>(this->Makefile); + fb->Args.push_back(args[0]); enum Doing { @@ -195,7 +195,7 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args) Doing doing = DoingNone; for (unsigned int i = 2; i < args.size(); ++i) { if (doing == DoingItems) { - f->Args.push_back(args[i]); + fb->Args.push_back(args[i]); } else if (args[i] == "LISTS") { doing = DoingLists; } else if (args[i] == "ITEMS") { @@ -203,7 +203,7 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args) } else if (doing == DoingLists) { const char* value = this->Makefile->GetDefinition(args[i]); if (value && *value) { - cmSystemTools::ExpandListArgument(value, f->Args, true); + cmSystemTools::ExpandListArgument(value, fb->Args, true); } } else { std::ostringstream e; @@ -214,7 +214,7 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args) } } - this->Makefile->AddFunctionBlocker(f.release()); // TODO: pass unique_ptr + this->Makefile->AddFunctionBlocker(std::move(fb)); return true; } |