mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 05:26:58 +08:00
cmFunctionBlocker: Recycle functions
This commit is contained in:

committed by
Kyle Edwards

parent
6491270e0d
commit
41364824ad
@@ -31,7 +31,7 @@ public:
|
|||||||
bool ArgumentsMatch(cmListFileFunction const& lff,
|
bool ArgumentsMatch(cmListFileFunction const& lff,
|
||||||
cmMakefile& mf) const override;
|
cmMakefile& mf) const override;
|
||||||
|
|
||||||
bool Replay(std::vector<cmListFileFunction> const& functions,
|
bool Replay(std::vector<cmListFileFunction> functions,
|
||||||
cmExecutionStatus& inStatus) override;
|
cmExecutionStatus& inStatus) override;
|
||||||
|
|
||||||
std::vector<std::string> Args;
|
std::vector<std::string> Args;
|
||||||
@@ -60,8 +60,7 @@ bool cmForEachFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cmForEachFunctionBlocker::Replay(
|
bool cmForEachFunctionBlocker::Replay(
|
||||||
std::vector<cmListFileFunction> const& functions,
|
std::vector<cmListFileFunction> functions, cmExecutionStatus& inStatus)
|
||||||
cmExecutionStatus& inStatus)
|
|
||||||
{
|
{
|
||||||
cmMakefile& mf = inStatus.GetMakefile();
|
cmMakefile& mf = inStatus.GetMakefile();
|
||||||
// at end of for each execute recorded commands
|
// at end of for each execute recorded commands
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "cmExecutionStatus.h"
|
#include "cmExecutionStatus.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
@@ -36,7 +37,7 @@ bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
|
|||||||
mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
|
mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this->Replay(this->Functions, status);
|
return this->Replay(std::move(this->Functions), status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ private:
|
|||||||
virtual bool ArgumentsMatch(cmListFileFunction const& lff,
|
virtual bool ArgumentsMatch(cmListFileFunction const& lff,
|
||||||
cmMakefile& mf) const = 0;
|
cmMakefile& mf) const = 0;
|
||||||
|
|
||||||
virtual bool Replay(std::vector<cmListFileFunction> const& functions,
|
virtual bool Replay(std::vector<cmListFileFunction> functions,
|
||||||
cmExecutionStatus& status) = 0;
|
cmExecutionStatus& status) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -116,7 +116,7 @@ public:
|
|||||||
bool ArgumentsMatch(cmListFileFunction const&,
|
bool ArgumentsMatch(cmListFileFunction const&,
|
||||||
cmMakefile& mf) const override;
|
cmMakefile& mf) const override;
|
||||||
|
|
||||||
bool Replay(std::vector<cmListFileFunction> const& functions,
|
bool Replay(std::vector<cmListFileFunction> functions,
|
||||||
cmExecutionStatus& status) override;
|
cmExecutionStatus& status) override;
|
||||||
|
|
||||||
std::vector<std::string> Args;
|
std::vector<std::string> Args;
|
||||||
@@ -132,13 +132,13 @@ bool cmFunctionFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cmFunctionFunctionBlocker::Replay(
|
bool cmFunctionFunctionBlocker::Replay(
|
||||||
std::vector<cmListFileFunction> const& functions, cmExecutionStatus& status)
|
std::vector<cmListFileFunction> functions, cmExecutionStatus& status)
|
||||||
{
|
{
|
||||||
cmMakefile& mf = status.GetMakefile();
|
cmMakefile& mf = status.GetMakefile();
|
||||||
// create a new command and add it to cmake
|
// create a new command and add it to cmake
|
||||||
cmFunctionHelperCommand f;
|
cmFunctionHelperCommand f;
|
||||||
f.Args = this->Args;
|
f.Args = this->Args;
|
||||||
f.Functions = functions;
|
f.Functions = std::move(functions);
|
||||||
f.FilePath = this->GetStartingContext().FilePath;
|
f.FilePath = this->GetStartingContext().FilePath;
|
||||||
mf.RecordPolicies(f.Policies);
|
mf.RecordPolicies(f.Policies);
|
||||||
mf.GetState()->AddScriptedCommand(this->Args[0], std::move(f));
|
mf.GetState()->AddScriptedCommand(this->Args[0], std::move(f));
|
||||||
|
@@ -41,7 +41,7 @@ public:
|
|||||||
bool ArgumentsMatch(cmListFileFunction const& lff,
|
bool ArgumentsMatch(cmListFileFunction const& lff,
|
||||||
cmMakefile&) const override;
|
cmMakefile&) const override;
|
||||||
|
|
||||||
bool Replay(std::vector<cmListFileFunction> const& functions,
|
bool Replay(std::vector<cmListFileFunction> functions,
|
||||||
cmExecutionStatus& inStatus) override;
|
cmExecutionStatus& inStatus) override;
|
||||||
|
|
||||||
std::vector<cmListFileArgument> Args;
|
std::vector<cmListFileArgument> Args;
|
||||||
@@ -56,8 +56,7 @@ bool cmIfFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
|
|||||||
return lff.Arguments.empty() || lff.Arguments == this->Args;
|
return lff.Arguments.empty() || lff.Arguments == this->Args;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmIfFunctionBlocker::Replay(
|
bool cmIfFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
|
||||||
std::vector<cmListFileFunction> const& functions,
|
|
||||||
cmExecutionStatus& inStatus)
|
cmExecutionStatus& inStatus)
|
||||||
{
|
{
|
||||||
cmMakefile& mf = inStatus.GetMakefile();
|
cmMakefile& mf = inStatus.GetMakefile();
|
||||||
|
@@ -149,7 +149,7 @@ public:
|
|||||||
bool ArgumentsMatch(cmListFileFunction const&,
|
bool ArgumentsMatch(cmListFileFunction const&,
|
||||||
cmMakefile& mf) const override;
|
cmMakefile& mf) const override;
|
||||||
|
|
||||||
bool Replay(std::vector<cmListFileFunction> const& functions,
|
bool Replay(std::vector<cmListFileFunction> functions,
|
||||||
cmExecutionStatus& status) override;
|
cmExecutionStatus& status) override;
|
||||||
|
|
||||||
std::vector<std::string> Args;
|
std::vector<std::string> Args;
|
||||||
@@ -164,15 +164,15 @@ bool cmMacroFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
|
|||||||
return expandedArguments.empty() || expandedArguments[0] == this->Args[0];
|
return expandedArguments.empty() || expandedArguments[0] == this->Args[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmMacroFunctionBlocker::Replay(
|
bool cmMacroFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
|
||||||
std::vector<cmListFileFunction> const& functions, cmExecutionStatus& status)
|
cmExecutionStatus& status)
|
||||||
{
|
{
|
||||||
cmMakefile& mf = status.GetMakefile();
|
cmMakefile& mf = status.GetMakefile();
|
||||||
mf.AppendProperty("MACROS", this->Args[0].c_str());
|
mf.AppendProperty("MACROS", this->Args[0].c_str());
|
||||||
// create a new command and add it to cmake
|
// create a new command and add it to cmake
|
||||||
cmMacroHelperCommand f;
|
cmMacroHelperCommand f;
|
||||||
f.Args = this->Args;
|
f.Args = this->Args;
|
||||||
f.Functions = functions;
|
f.Functions = std::move(functions);
|
||||||
f.FilePath = this->GetStartingContext().FilePath;
|
f.FilePath = this->GetStartingContext().FilePath;
|
||||||
mf.RecordPolicies(f.Policies);
|
mf.RecordPolicies(f.Policies);
|
||||||
mf.GetState()->AddScriptedCommand(this->Args[0], std::move(f));
|
mf.GetState()->AddScriptedCommand(this->Args[0], std::move(f));
|
||||||
|
@@ -30,7 +30,7 @@ public:
|
|||||||
bool ArgumentsMatch(cmListFileFunction const& lff,
|
bool ArgumentsMatch(cmListFileFunction const& lff,
|
||||||
cmMakefile& mf) const override;
|
cmMakefile& mf) const override;
|
||||||
|
|
||||||
bool Replay(std::vector<cmListFileFunction> const& functions,
|
bool Replay(std::vector<cmListFileFunction> functions,
|
||||||
cmExecutionStatus& inStatus) override;
|
cmExecutionStatus& inStatus) override;
|
||||||
|
|
||||||
std::vector<cmListFileArgument> Args;
|
std::vector<cmListFileArgument> Args;
|
||||||
@@ -56,8 +56,7 @@ bool cmWhileFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
|
|||||||
return lff.Arguments.empty() || lff.Arguments == this->Args;
|
return lff.Arguments.empty() || lff.Arguments == this->Args;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmWhileFunctionBlocker::Replay(
|
bool cmWhileFunctionBlocker::Replay(std::vector<cmListFileFunction> functions,
|
||||||
std::vector<cmListFileFunction> const& functions,
|
|
||||||
cmExecutionStatus& inStatus)
|
cmExecutionStatus& inStatus)
|
||||||
{
|
{
|
||||||
cmMakefile& mf = inStatus.GetMakefile();
|
cmMakefile& mf = inStatus.GetMakefile();
|
||||||
|
Reference in New Issue
Block a user