diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-05-31 16:19:58 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-06-04 20:08:23 (GMT) |
commit | d5dc4169ac1c4dd5abd385b1e8499119df88c657 (patch) | |
tree | edb2a3f9380bbdea10920da2b09963e8c1627bd6 /Source/cmMakefile.cxx | |
parent | 91cd014d6452371056bb3f96de29967f506b3bd7 (diff) | |
download | CMake-d5dc4169ac1c4dd5abd385b1e8499119df88c657.zip CMake-d5dc4169ac1c4dd5abd385b1e8499119df88c657.tar.gz CMake-d5dc4169ac1c4dd5abd385b1e8499119df88c657.tar.bz2 |
cmMakefile: Create a unified raii for function scopes.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b5d976a..7012701 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1562,6 +1562,26 @@ void cmMakefile::InitializeFromParent() this->ImportedTargets = parent->ImportedTargets; } +void cmMakefile::PushFunctionScope(const cmPolicies::PolicyMap& pm) +{ + this->PushScope(); + + this->PushFunctionBlockerBarrier(); + + this->PushPolicy(true, pm); + this->PushPolicyBarrier(); +} + +void cmMakefile::PopFunctionScope(bool reportError) +{ + this->PopPolicyBarrier(reportError); + this->PopPolicy(); + + this->PopFunctionBlockerBarrier(reportError); + + this->PopScope(); +} + //---------------------------------------------------------------------------- class cmMakefileCurrent { @@ -5418,3 +5438,16 @@ AddRequiredTargetCFeature(cmTarget *target, const std::string& feature) const } return true; } + + +cmMakefile::FunctionPushPop::FunctionPushPop(cmMakefile* mf, + cmPolicies::PolicyMap const& pm) + : Makefile(mf), ReportError(true) +{ + this->Makefile->PushFunctionScope(pm); +} + +cmMakefile::FunctionPushPop::~FunctionPushPop() +{ + this->Makefile->PopFunctionScope(this->ReportError); +} |