Commit 32edac6f authored by Brad King's avatar Brad King
Browse files

cmState: Enforce policy scope balancing around variable scopes

Everywhere we use cmMakefile::ScopePushPop to manage variable scopes
also expects policy scopes to be balanced.  There is no place that we
use cmMakefile::PolicyPushPop without also using ScopePushPop.  Relieve
PolicyPushPop of responsibility for policy scope balance checks by
moving it to ScopePushPop.
parent 0fa7f143
......@@ -4233,9 +4233,7 @@ void cmMakefile::PopScope()
this->CheckForUnusedVariables();
this->StateSnapshot =
this->GetState()->Pop(this->StateSnapshot);
assert(this->StateSnapshot.IsValid());
this->PopSnapshot();
}
void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
......@@ -4603,8 +4601,6 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
//----------------------------------------------------------------------------
cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m): Makefile(m)
{
this->Makefile->StateSnapshot = this->Makefile->StateSnapshot.GetState()
->CreatePolicyScopeSnapshot(this->Makefile->StateSnapshot);
this->Makefile->PushPolicy();
}
......@@ -4612,7 +4608,6 @@ cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m): Makefile(m)
cmMakefile::PolicyPushPop::~PolicyPushPop()
{
this->Makefile->PopPolicy();
this->Makefile->PopSnapshot();
}
//----------------------------------------------------------------------------
......
......@@ -884,6 +884,7 @@ cmState::CreateVariableScopeSnapshot(cmState::Snapshot originSnapshot,
pos->EntryPointLine = entryPointLine;
pos->EntryPointCommand = entryPointCommand;
pos->SnapshotType = VariableScopeType;
pos->PolicyScope = originSnapshot.Position->Policies;
assert(originSnapshot.Position->Vars.IsValid());
cmLinkedTree<cmDefinitions>::iterator origin =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment