summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-07-26 10:56:10 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-08-02 06:56:57 (GMT)
commit348354333a82ce98d733dc2ee939186c53c506f9 (patch)
tree6cccb581d9ce5af3498dab650a30348ad0cad9a6
parentaf0de01c6b3395fb1dba5d2ee0a94c19a9b464e9 (diff)
downloadCMake-348354333a82ce98d733dc2ee939186c53c506f9.zip
CMake-348354333a82ce98d733dc2ee939186c53c506f9.tar.gz
CMake-348354333a82ce98d733dc2ee939186c53c506f9.tar.bz2
cmState: Add Type for policy scope.
-rw-r--r--Source/cmMakefile.cxx11
-rw-r--r--Source/cmState.cxx22
-rw-r--r--Source/cmState.h4
3 files changed, 34 insertions, 3 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 2c854dd..9fb3d06 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -189,6 +189,9 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
this->cmAtVarRegex.compile("(@[A-Za-z_0-9/.+-]+@)");
this->cmNamedCurly.compile("^[A-Za-z0-9/_.+-]+{");
+ this->StateSnapshot = this->StateSnapshot.GetState()
+ ->CreatePolicyScopeSnapshot(this->StateSnapshot);
+
// Protect the directory-level policies.
this->PushPolicyBarrier();
@@ -1705,6 +1708,8 @@ public:
this->Makefile->StateSnapshot.GetDirectory().GetCurrentSource();
currentStart += "/CMakeLists.txt";
this->Makefile->StateSnapshot.SetListFile(currentStart);
+ this->Makefile->StateSnapshot = this->Makefile->StateSnapshot.GetState()
+ ->CreatePolicyScopeSnapshot(this->Makefile->StateSnapshot);
this->Makefile->PushPolicyBarrier();
this->Makefile->PushFunctionBlockerBarrier();
@@ -1722,6 +1727,8 @@ public:
{
this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
this->Makefile->PopPolicyBarrier(this->ReportError);
+ this->Makefile->StateSnapshot = this->Makefile->StateSnapshot.GetState()
+ ->Pop(this->Makefile->StateSnapshot);
#if defined(CMAKE_BUILD_WITH_CMAKE)
this->GG->GetFileLockPool().PopFileScope();
#endif
@@ -4841,6 +4848,8 @@ cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m, bool weak,
cmPolicies::PolicyMap const& pm):
Makefile(m), ReportError(true)
{
+ this->Makefile->StateSnapshot = this->Makefile->StateSnapshot.GetState()
+ ->CreatePolicyScopeSnapshot(this->Makefile->StateSnapshot);
this->Makefile->PushPolicyBarrier();
this->Makefile->PushPolicy(weak, pm);
}
@@ -4850,6 +4859,8 @@ cmMakefile::PolicyPushPop::~PolicyPushPop()
{
this->Makefile->PopPolicy();
this->Makefile->PopPolicyBarrier(this->ReportError);
+ this->Makefile->StateSnapshot = this->Makefile->StateSnapshot.GetState()
+ ->Pop(this->Makefile->StateSnapshot);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index a7df040..09446bb 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -809,6 +809,15 @@ cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot,
return cmState::Snapshot(this, pos);
}
+cmState::Snapshot
+cmState::CreatePolicyScopeSnapshot(cmState::Snapshot originSnapshot)
+{
+ PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
+ *originSnapshot.Position);
+ pos->SnapshotType = PolicyScopeType;
+ return cmState::Snapshot(this, pos);
+}
+
cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot)
{
PositionType pos = originSnapshot.Position;
@@ -959,13 +968,22 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
assert(this->Position != this->State->SnapshotData.Root());
Snapshot snapshot;
- if (this->Position->SnapshotType == cmState::BuildsystemDirectoryType)
+ PositionType parentPos = this->Position;
+ while(parentPos->SnapshotType == cmState::PolicyScopeType)
+ {
+ ++parentPos;
+ }
+ if (parentPos->SnapshotType == cmState::BuildsystemDirectoryType)
{
return snapshot;
}
- PositionType parentPos = this->Position;
++parentPos;
+ while(parentPos->SnapshotType == cmState::PolicyScopeType)
+ {
+ ++parentPos;
+ }
+
if (parentPos == this->State->SnapshotData.Root())
{
return snapshot;
diff --git a/Source/cmState.h b/Source/cmState.h
index 23fbc79..63b60ef 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -37,7 +37,8 @@ public:
FunctionCallType,
MacroCallType,
CallStackType,
- InlineListFileType
+ InlineListFileType,
+ PolicyScopeType
};
class Directory;
@@ -148,6 +149,7 @@ public:
const std::string& entryPointCommand,
long entryPointLine,
std::string const& fileName);
+ Snapshot CreatePolicyScopeSnapshot(Snapshot originSnapshot);
Snapshot Pop(Snapshot originSnapshot);
enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,