summaryrefslogtreecommitdiffstats
path: root/Source/cmMacroCommand.cxx
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-07-23 21:50:33 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2019-07-30 22:03:17 (GMT)
commitef38ff22f71ad0ffe83db42d903d26d4a41f4114 (patch)
tree91700b2676898bbb638b19c574e4ad77425f7c3b /Source/cmMacroCommand.cxx
parentb51fba6298012c3b697c461486ce06c9e5c97c16 (diff)
downloadCMake-ef38ff22f71ad0ffe83db42d903d26d4a41f4114.zip
CMake-ef38ff22f71ad0ffe83db42d903d26d4a41f4114.tar.gz
CMake-ef38ff22f71ad0ffe83db42d903d26d4a41f4114.tar.bz2
cm*FunctionBlocker: Extract function Replay
Diffstat (limited to 'Source/cmMacroCommand.cxx')
-rw-r--r--Source/cmMacroCommand.cxx32
1 files changed, 20 insertions, 12 deletions
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index a123f22..e82d6fa 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -144,6 +144,8 @@ public:
bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
cmExecutionStatus&) override;
bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override;
+ bool Replay(std::vector<cmListFileFunction> const& functions,
+ cmExecutionStatus& status);
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
@@ -152,7 +154,7 @@ public:
bool cmMacroFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
cmMakefile& mf,
- cmExecutionStatus&)
+ cmExecutionStatus& status)
{
// record commands until we hit the ENDMACRO
// at the ENDMACRO call we shift gears and start looking for invocations
@@ -161,17 +163,8 @@ bool cmMacroFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
} else if (lff.Name.Lower == "endmacro") {
// if this is the endmacro for this macro then execute
if (!this->Depth) {
- mf.AppendProperty("MACROS", this->Args[0].c_str());
- // create a new command and add it to cmake
- cmMacroHelperCommand f;
- f.Args = this->Args;
- f.Functions = this->Functions;
- f.FilePath = this->GetStartingContext().FilePath;
- mf.RecordPolicies(f.Policies);
- 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;
+ auto self = mf.RemoveFunctionBlocker(this, lff);
+ return this->Replay(this->Functions, status);
}
// decrement for each nested macro that ends
this->Depth--;
@@ -201,6 +194,21 @@ bool cmMacroFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
return false;
}
+bool cmMacroFunctionBlocker::Replay(
+ std::vector<cmListFileFunction> const& functions, cmExecutionStatus& status)
+{
+ cmMakefile& mf = status.GetMakefile();
+ mf.AppendProperty("MACROS", this->Args[0].c_str());
+ // create a new command and add it to cmake
+ cmMacroHelperCommand f;
+ f.Args = this->Args;
+ f.Functions = functions;
+ f.FilePath = this->GetStartingContext().FilePath;
+ mf.RecordPolicies(f.Policies);
+ mf.GetState()->AddScriptedCommand(this->Args[0], std::move(f));
+ return true;
+}
+
bool cmMacroCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{