cmMakefile: Clarify purpose of method that pops a scope snapshot

The `PopPolicyBarrier` method is actually responsible for closing any
scope opened by creating a snapshot.  Rename it to `PopSnapshot` and add
a comment explaining the purpose of the poilcy-scope-specific part of
the method.
This commit is contained in:
Brad King 2015-11-24 11:44:57 -05:00
parent 62126b67e0
commit 8e1be7bf68
2 changed files with 11 additions and 8 deletions

View File

@ -435,7 +435,7 @@ cmMakefile::IncludeScope::~IncludeScope()
this->EnforceCMP0011(); this->EnforceCMP0011();
} }
} }
this->Makefile->PopPolicyBarrier(this->ReportError); this->Makefile->PopSnapshot(this->ReportError);
this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
} }
@ -549,7 +549,7 @@ public:
~ListFileScope() ~ListFileScope()
{ {
this->Makefile->PopPolicyBarrier(this->ReportError); this->Makefile->PopSnapshot(this->ReportError);
this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
} }
@ -1551,7 +1551,7 @@ void cmMakefile::PopFunctionScope(bool reportError)
{ {
this->PopPolicy(); this->PopPolicy();
this->PopPolicyBarrier(reportError); this->PopSnapshot(reportError);
this->PopFunctionBlockerBarrier(reportError); this->PopFunctionBlockerBarrier(reportError);
@ -1582,7 +1582,7 @@ void cmMakefile::PushMacroScope(std::string const& fileName,
void cmMakefile::PopMacroScope(bool reportError) void cmMakefile::PopMacroScope(bool reportError)
{ {
this->PopPolicy(); this->PopPolicy();
this->PopPolicyBarrier(reportError); this->PopSnapshot(reportError);
this->PopFunctionBlockerBarrier(reportError); this->PopFunctionBlockerBarrier(reportError);
} }
@ -1619,7 +1619,7 @@ public:
~BuildsystemFileScope() ~BuildsystemFileScope()
{ {
this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
this->Makefile->PopPolicyBarrier(this->ReportError); this->Makefile->PopSnapshot(this->ReportError);
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
this->GG->GetFileLockPool().PopFileScope(); this->GG->GetFileLockPool().PopFileScope();
#endif #endif
@ -4614,7 +4614,7 @@ cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m, bool weak,
cmMakefile::PolicyPushPop::~PolicyPushPop() cmMakefile::PolicyPushPop::~PolicyPushPop()
{ {
this->Makefile->PopPolicy(); this->Makefile->PopPolicy();
this->Makefile->PopPolicyBarrier(this->ReportError); this->Makefile->PopSnapshot(this->ReportError);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -4634,8 +4634,11 @@ void cmMakefile::PopPolicy()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefile::PopPolicyBarrier(bool reportError) void cmMakefile::PopSnapshot(bool reportError)
{ {
// cmState::Snapshot manages nested policy scopes within it.
// Since the scope corresponding to the snapshot is closing,
// reject any still-open nested policy scopes with an error.
while (!this->StateSnapshot.CanPopPolicyScope()) while (!this->StateSnapshot.CanPopPolicyScope())
{ {
if(reportError) if(reportError)

View File

@ -904,7 +904,7 @@ private:
void PushPolicy(bool weak = false, void PushPolicy(bool weak = false,
cmPolicies::PolicyMap const& pm = cmPolicies::PolicyMap()); cmPolicies::PolicyMap const& pm = cmPolicies::PolicyMap());
void PopPolicy(); void PopPolicy();
void PopPolicyBarrier(bool reportError = true); void PopSnapshot(bool reportError = true);
friend class cmCMakePolicyCommand; friend class cmCMakePolicyCommand;
class IncludeScope; class IncludeScope;
friend class IncludeScope; friend class IncludeScope;