summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-10-22 17:37:41 (GMT)
committerBrad King <brad.king@kitware.com>2020-10-27 18:58:15 (GMT)
commit2a640d41998b2b61ed23090cc6edaf6445caf6ed (patch)
treec53af558ab4d2e19877ee7d0035b9ff50bf29b2c
parentfab772c3e16862c7e8200b1e6a77d7f8abc1055e (diff)
downloadCMake-2a640d41998b2b61ed23090cc6edaf6445caf6ed.zip
CMake-2a640d41998b2b61ed23090cc6edaf6445caf6ed.tar.gz
CMake-2a640d41998b2b61ed23090cc6edaf6445caf6ed.tar.bz2
cmCustomCommandGenerator: Add move operations
-rw-r--r--Source/cmCustomCommandGenerator.cxx14
-rw-r--r--Source/cmCustomCommandGenerator.h6
2 files changed, 11 insertions, 9 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 6f5c8e9..13d2c37 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -47,7 +47,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
std::string config,
cmLocalGenerator* lg,
bool transformDepfile)
- : CC(cc)
+ : CC(&cc)
, Config(std::move(config))
, LG(lg)
, OldStyle(cc.GetEscapeOldStyle())
@@ -56,13 +56,13 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
{
cmGeneratorExpression ge(cc.GetBacktrace());
- const cmCustomCommandLines& cmdlines = this->CC.GetCommandLines();
+ const cmCustomCommandLines& cmdlines = this->CC->GetCommandLines();
for (cmCustomCommandLine const& cmdline : cmdlines) {
cmCustomCommandLine argv;
for (std::string const& clarg : cmdline) {
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(clarg);
std::string parsed_arg = cge->Evaluate(this->LG, this->Config);
- if (this->CC.GetCommandExpandLists()) {
+ if (this->CC->GetCommandExpandLists()) {
cm::append(argv, cmExpandedList(parsed_arg));
} else {
argv.push_back(std::move(parsed_arg));
@@ -113,7 +113,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
this->Byproducts);
AppendPaths(cc.GetDepends(), ge, this->LG, this->Config, this->Depends);
- const std::string& workingdirectory = this->CC.GetWorkingDirectory();
+ const std::string& workingdirectory = this->CC->GetWorkingDirectory();
if (!workingdirectory.empty()) {
std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(workingdirectory);
@@ -270,7 +270,7 @@ void cmCustomCommandGenerator::AppendArguments(unsigned int c,
std::string cmCustomCommandGenerator::GetFullDepfile() const
{
- std::string depfile = this->CC.GetDepfile();
+ std::string depfile = this->CC->GetDepfile();
if (depfile.empty()) {
return "";
}
@@ -304,7 +304,7 @@ std::string cmCustomCommandGenerator::GetInternalDepfile() const
const char* cmCustomCommandGenerator::GetComment() const
{
- return this->CC.GetComment();
+ return this->CC->GetComment();
}
std::string cmCustomCommandGenerator::GetWorkingDirectory() const
@@ -314,7 +314,7 @@ std::string cmCustomCommandGenerator::GetWorkingDirectory() const
std::vector<std::string> const& cmCustomCommandGenerator::GetOutputs() const
{
- return this->CC.GetOutputs();
+ return this->CC->GetOutputs();
}
std::vector<std::string> const& cmCustomCommandGenerator::GetByproducts() const
diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h
index 8b5259d..c783b65 100644
--- a/Source/cmCustomCommandGenerator.h
+++ b/Source/cmCustomCommandGenerator.h
@@ -14,7 +14,7 @@ class cmLocalGenerator;
class cmCustomCommandGenerator
{
- cmCustomCommand const& CC;
+ cmCustomCommand const* CC;
std::string Config;
cmLocalGenerator* LG;
bool OldStyle;
@@ -33,9 +33,11 @@ public:
cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config,
cmLocalGenerator* lg, bool transformDepfile = true);
cmCustomCommandGenerator(const cmCustomCommandGenerator&) = delete;
+ cmCustomCommandGenerator(cmCustomCommandGenerator&&) = default;
cmCustomCommandGenerator& operator=(const cmCustomCommandGenerator&) =
delete;
- cmCustomCommand const& GetCC() const { return this->CC; }
+ cmCustomCommandGenerator& operator=(cmCustomCommandGenerator&&) = default;
+ cmCustomCommand const& GetCC() const { return *(this->CC); }
unsigned int GetNumberOfCommands() const;
std::string GetCommand(unsigned int c) const;
void AppendArguments(unsigned int c, std::string& cmd) const;