diff options
author | Daniel Eiband <daniel.eiband@brainlab.com> | 2019-09-21 22:17:22 (GMT) |
---|---|---|
committer | Daniel Eiband <daniel.eiband@brainlab.com> | 2019-09-22 07:51:20 (GMT) |
commit | c7c59dae82594557dc2fddc4ef881dafeaad076a (patch) | |
tree | f9ba032c61d023afb7a670ea365ae17109c85d18 /Source | |
parent | c12222db86859a5a5ce9163a5309bb0da10ec616 (diff) | |
download | CMake-c7c59dae82594557dc2fddc4ef881dafeaad076a.zip CMake-c7c59dae82594557dc2fddc4ef881dafeaad076a.tar.gz CMake-c7c59dae82594557dc2fddc4ef881dafeaad076a.tar.bz2 |
cmCustomCommandGenerator: Replace generator expression member
Replace generator expression member variable by stack variable in the
constructor.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCustomCommandGenerator.cxx | 20 | ||||
-rw-r--r-- | Source/cmCustomCommandGenerator.h | 3 |
2 files changed, 7 insertions, 16 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index ddb855b..7f3e052 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -19,7 +19,7 @@ namespace { void AppendPaths(const std::vector<std::string>& inputs, - cmGeneratorExpression& ge, cmLocalGenerator* lg, + cmGeneratorExpression const& ge, cmLocalGenerator* lg, std::string const& config, std::vector<std::string>& output) { for (std::string const& in : inputs) { @@ -45,15 +45,15 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, , LG(lg) , OldStyle(cc.GetEscapeOldStyle()) , MakeVars(cc.GetEscapeAllowMakeVars()) - , GE(new cmGeneratorExpression(cc.GetBacktrace())) , EmulatorsWithArguments(cc.GetCommandLines().size()) { + cmGeneratorExpression ge(cc.GetBacktrace()); + const cmCustomCommandLines& cmdlines = this->CC.GetCommandLines(); for (cmCustomCommandLine const& cmdline : cmdlines) { cmCustomCommandLine argv; for (std::string const& clarg : cmdline) { - std::unique_ptr<cmCompiledGeneratorExpression> cge = - this->GE->Parse(clarg); + std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(clarg); std::string parsed_arg = cge->Evaluate(this->LG, this->Config); if (this->CC.GetCommandExpandLists()) { cmAppend(argv, cmExpandedList(parsed_arg)); @@ -72,15 +72,14 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, this->CommandLines.push_back(std::move(argv)); } - AppendPaths(cc.GetByproducts(), *this->GE, this->LG, this->Config, + AppendPaths(cc.GetByproducts(), ge, this->LG, this->Config, this->Byproducts); - AppendPaths(cc.GetDepends(), *this->GE, this->LG, this->Config, - this->Depends); + AppendPaths(cc.GetDepends(), ge, this->LG, this->Config, this->Depends); const std::string& workingdirectory = this->CC.GetWorkingDirectory(); if (!workingdirectory.empty()) { std::unique_ptr<cmCompiledGeneratorExpression> cge = - this->GE->Parse(workingdirectory); + ge.Parse(workingdirectory); this->WorkingDirectory = cge->Evaluate(this->LG, this->Config); // Convert working directory to a full path. if (!this->WorkingDirectory.empty()) { @@ -93,11 +92,6 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, this->FillEmulatorsWithArguments(); } -cmCustomCommandGenerator::~cmCustomCommandGenerator() -{ - delete this->GE; -} - unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const { return static_cast<unsigned int>(this->CC.GetCommandLines().size()); diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index d614302..50f292e 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -10,7 +10,6 @@ #include <vector> class cmCustomCommand; -class cmGeneratorExpression; class cmLocalGenerator; class cmCustomCommandGenerator @@ -20,7 +19,6 @@ class cmCustomCommandGenerator cmLocalGenerator* LG; bool OldStyle; bool MakeVars; - cmGeneratorExpression* GE; cmCustomCommandLines CommandLines; std::vector<std::vector<std::string>> EmulatorsWithArguments; std::vector<std::string> Byproducts; @@ -34,7 +32,6 @@ class cmCustomCommandGenerator public: cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config, cmLocalGenerator* lg); - ~cmCustomCommandGenerator(); cmCustomCommandGenerator(const cmCustomCommandGenerator&) = delete; cmCustomCommandGenerator& operator=(const cmCustomCommandGenerator&) = delete; |