summaryrefslogtreecommitdiffstats
path: root/Source/cmFunctionBlocker.cxx
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-07-30 16:15:13 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2019-07-30 22:03:17 (GMT)
commitaf24e4ef6e216184b8c207728d6b0312ce3c1525 (patch)
treed6bf6ab881d5bac857339b2c0e86bb660d13d54c /Source/cmFunctionBlocker.cxx
parentef38ff22f71ad0ffe83db42d903d26d4a41f4114 (diff)
downloadCMake-af24e4ef6e216184b8c207728d6b0312ce3c1525.zip
CMake-af24e4ef6e216184b8c207728d6b0312ce3c1525.tar.gz
CMake-af24e4ef6e216184b8c207728d6b0312ce3c1525.tar.bz2
cmFunctionBlocker: Move common logic to base
Diffstat (limited to 'Source/cmFunctionBlocker.cxx')
-rw-r--r--Source/cmFunctionBlocker.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/cmFunctionBlocker.cxx b/Source/cmFunctionBlocker.cxx
new file mode 100644
index 0000000..2999691
--- /dev/null
+++ b/Source/cmFunctionBlocker.cxx
@@ -0,0 +1,24 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmFunctionBlocker.h"
+
+#include "cmExecutionStatus.h"
+#include "cmMakefile.h"
+
+bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
+ cmExecutionStatus& status)
+{
+ if (lff.Name.Lower == this->StartCommandName()) {
+ this->ScopeDepth++;
+ } else if (lff.Name.Lower == this->EndCommandName()) {
+ this->ScopeDepth--;
+ if (this->ScopeDepth == 0U) {
+ cmMakefile& mf = status.GetMakefile();
+ auto self = mf.RemoveFunctionBlocker(this, lff);
+ return this->Replay(this->Functions, status);
+ }
+ }
+
+ this->Functions.push_back(lff);
+ return true;
+}