diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2014-11-18 15:34:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-11-25 19:14:15 (GMT) |
commit | bae604d9a80d5d97c676c85848e37783a153ff19 (patch) | |
tree | f2b423072548cf614d9a4248381ad15f8800960a /Source/cmWhileCommand.cxx | |
parent | 66ba7ea831ca8d44b137e59e8271de3c7756cfe3 (diff) | |
download | CMake-bae604d9a80d5d97c676c85848e37783a153ff19.zip CMake-bae604d9a80d5d97c676c85848e37783a153ff19.tar.gz CMake-bae604d9a80d5d97c676c85848e37783a153ff19.tar.bz2 |
Track nested loop levels in CMake language with a stack of counters
It gets incremented while entering a loop block (e.g. foreach or while)
and gets decremented when leaving the block. Because scope borders for
example at function borders must be taken into account the counter is
put into a stack. With every new scope an empty counter is pushed on the
stack, when leaving the scope the original value is restored.
This will allow easy querying if the break command is properly nested
within a loop scope.
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Diffstat (limited to 'Source/cmWhileCommand.cxx')
-rw-r--r-- | Source/cmWhileCommand.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index 851c4cb..d36095e 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -27,6 +27,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // if this is the endwhile for this while loop then execute if (!this->Depth) { + cmMakefile::LoopBlockPop loopBlockPop(&mf); + // Remove the function blocker for this scope or bail. cmsys::auto_ptr<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff)); @@ -138,6 +140,8 @@ bool cmWhileCommand f->Args = args; this->Makefile->AddFunctionBlocker(f); + this->Makefile->PushLoopBlock(); + return true; } |