cmState: Store snapshots for more different types.

Adjust cmMakefile implementation to create the snapshots.
This commit is contained in:
Stephen Kelly
2015-06-21 21:26:36 +02:00
parent dbafb01580
commit a8e5446024
3 changed files with 100 additions and 2 deletions
+33
View File
@@ -463,11 +463,19 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf,
this->Makefile->PushPolicyBarrier();
this->Makefile->ListFileStack.push_back(filenametoread);
this->Makefile->PushFunctionBlockerBarrier();
this->Makefile->StateSnapshot =
this->Makefile->GetState()->CreateCallStackSnapshot(
this->Makefile->StateSnapshot);
}
//----------------------------------------------------------------------------
cmMakefile::IncludeScope::~IncludeScope()
{
this->Makefile->StateSnapshot =
this->Makefile->GetState()->Pop(this->Makefile->StateSnapshot);
assert(this->Makefile->StateSnapshot.IsValid());
this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
// Enforce matching policy scopes inside the included file.
this->Makefile->PopPolicyBarrier(this->ReportError);
@@ -567,11 +575,20 @@ public:
{
this->Makefile->ListFileStack.push_back(filenametoread);
this->Makefile->PushPolicyBarrier();
this->Makefile->StateSnapshot =
this->Makefile->GetState()->CreateInlineListFileSnapshot(
this->Makefile->StateSnapshot);
assert(this->Makefile->StateSnapshot.IsValid());
this->Makefile->PushFunctionBlockerBarrier();
}
~ListFileScope()
{
this->Makefile->StateSnapshot =
this->Makefile->GetState()->Pop(this->Makefile->StateSnapshot);
assert(this->Makefile->StateSnapshot.IsValid());
this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
this->Makefile->PopPolicyBarrier(this->ReportError);
this->Makefile->ListFileStack.pop_back();
@@ -1575,6 +1592,11 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
void cmMakefile::PushFunctionScope(const cmPolicies::PolicyMap& pm)
{
this->StateSnapshot =
this->GetState()->CreateFunctionCallSnapshot(
this->StateSnapshot);
assert(this->StateSnapshot.IsValid());
this->Internal->PushDefinitions();
this->PushLoopBlockBarrier();
@@ -1594,6 +1616,9 @@ void cmMakefile::PopFunctionScope(bool reportError)
this->PopPolicyBarrier(reportError);
this->PopPolicy();
this->StateSnapshot = this->GetState()->Pop(this->StateSnapshot);
assert(this->StateSnapshot.IsValid());
this->PopFunctionBlockerBarrier(reportError);
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -1609,6 +1634,11 @@ void cmMakefile::PopFunctionScope(bool reportError)
void cmMakefile::PushMacroScope(const cmPolicies::PolicyMap& pm)
{
this->StateSnapshot =
this->GetState()->CreateMacroCallSnapshot(
this->StateSnapshot);
assert(this->StateSnapshot.IsValid());
this->PushFunctionBlockerBarrier();
this->PushPolicy(true, pm);
@@ -1620,6 +1650,9 @@ void cmMakefile::PopMacroScope(bool reportError)
this->PopPolicyBarrier(reportError);
this->PopPolicy();
this->StateSnapshot = this->GetState()->Pop(this->StateSnapshot);
assert(this->StateSnapshot.IsValid());
this->PopFunctionBlockerBarrier(reportError);
}