|
|
@@ -28,6 +28,7 @@ struct cmState::SnapshotDataType
|
|
|
cmLinkedTree<cmState::PolicyStackEntry>::iterator PolicyRoot;
|
|
|
cmLinkedTree<cmState::PolicyStackEntry>::iterator PolicyScope;
|
|
|
cmState::SnapshotType SnapshotType;
|
|
|
+ bool Keep;
|
|
|
cmLinkedTree<std::string>::iterator ExecutionListFile;
|
|
|
cmLinkedTree<cmState::BuildsystemDirectoryStateType>::iterator
|
|
|
BuildSystemDirectory;
|
|
|
@@ -341,7 +342,7 @@ cmState::Snapshot cmState::Reset()
|
|
|
std::string binDir =
|
|
|
cmDefinitions::Get("CMAKE_BINARY_DIR", pos->Vars, pos->Root);
|
|
|
this->VarTree.Clear();
|
|
|
- pos->Vars = this->VarTree.Extend(this->VarTree.Root());
|
|
|
+ pos->Vars = this->VarTree.Push(this->VarTree.Root());
|
|
|
pos->Parent = this->VarTree.Root();
|
|
|
pos->Root = this->VarTree.Root();
|
|
|
|
|
|
@@ -818,14 +819,15 @@ void cmState::Directory::ComputeRelativePathTopBinary()
|
|
|
|
|
|
cmState::Snapshot cmState::CreateBaseSnapshot()
|
|
|
{
|
|
|
- PositionType pos = this->SnapshotData.Extend(this->SnapshotData.Root());
|
|
|
+ PositionType pos = this->SnapshotData.Push(this->SnapshotData.Root());
|
|
|
pos->DirectoryParent = this->SnapshotData.Root();
|
|
|
pos->ScopeParent = this->SnapshotData.Root();
|
|
|
pos->SnapshotType = BaseType;
|
|
|
+ pos->Keep = true;
|
|
|
pos->BuildSystemDirectory =
|
|
|
- this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root());
|
|
|
+ this->BuildsystemDirectory.Push(this->BuildsystemDirectory.Root());
|
|
|
pos->ExecutionListFile =
|
|
|
- this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root());
|
|
|
+ this->ExecutionListFiles.Push(this->ExecutionListFiles.Root());
|
|
|
pos->IncludeDirectoryPosition = 0;
|
|
|
pos->CompileDefinitionsPosition = 0;
|
|
|
pos->CompileOptionsPosition = 0;
|
|
|
@@ -835,7 +837,7 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
|
|
|
pos->PolicyScope = this->PolicyStack.Root();
|
|
|
assert(pos->Policies.IsValid());
|
|
|
assert(pos->PolicyRoot.IsValid());
|
|
|
- pos->Vars = this->VarTree.Extend(this->VarTree.Root());
|
|
|
+ pos->Vars = this->VarTree.Push(this->VarTree.Root());
|
|
|
assert(pos->Vars.IsValid());
|
|
|
pos->Parent = this->VarTree.Root();
|
|
|
pos->Root = this->VarTree.Root();
|
|
|
@@ -848,17 +850,18 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
|
|
|
long entryPointLine)
|
|
|
{
|
|
|
assert(originSnapshot.IsValid());
|
|
|
- PositionType pos = this->SnapshotData.Extend(originSnapshot.Position);
|
|
|
+ PositionType pos = this->SnapshotData.Push(originSnapshot.Position);
|
|
|
pos->EntryPointLine = entryPointLine;
|
|
|
pos->EntryPointCommand = entryPointCommand;
|
|
|
pos->DirectoryParent = originSnapshot.Position;
|
|
|
pos->ScopeParent = originSnapshot.Position;
|
|
|
pos->SnapshotType = BuildsystemDirectoryType;
|
|
|
+ pos->Keep = true;
|
|
|
pos->BuildSystemDirectory =
|
|
|
- this->BuildsystemDirectory.Extend(
|
|
|
+ this->BuildsystemDirectory.Push(
|
|
|
originSnapshot.Position->BuildSystemDirectory);
|
|
|
pos->ExecutionListFile =
|
|
|
- this->ExecutionListFiles.Extend(
|
|
|
+ this->ExecutionListFiles.Push(
|
|
|
originSnapshot.Position->ExecutionListFile);
|
|
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
|
|
pos->Policies = originSnapshot.Position->Policies;
|
|
|
@@ -871,7 +874,7 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
|
|
|
originSnapshot.Position->Vars;
|
|
|
pos->Parent = origin;
|
|
|
pos->Root = origin;
|
|
|
- pos->Vars = this->VarTree.Extend(origin);
|
|
|
+ pos->Vars = this->VarTree.Push(origin);
|
|
|
|
|
|
cmState::Snapshot snapshot = cmState::Snapshot(this, pos);
|
|
|
originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot);
|
|
|
@@ -887,13 +890,14 @@ cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot,
|
|
|
long entryPointLine,
|
|
|
std::string const& fileName)
|
|
|
{
|
|
|
- PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
|
|
- *originSnapshot.Position);
|
|
|
+ PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
|
|
+ *originSnapshot.Position);
|
|
|
pos->ScopeParent = originSnapshot.Position;
|
|
|
pos->EntryPointLine = entryPointLine;
|
|
|
pos->EntryPointCommand = entryPointCommand;
|
|
|
pos->SnapshotType = FunctionCallType;
|
|
|
- pos->ExecutionListFile = this->ExecutionListFiles.Extend(
|
|
|
+ pos->Keep = false;
|
|
|
+ pos->ExecutionListFile = this->ExecutionListFiles.Push(
|
|
|
originSnapshot.Position->ExecutionListFile, fileName);
|
|
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
|
|
pos->PolicyScope = originSnapshot.Position->Policies;
|
|
|
@@ -901,7 +905,7 @@ cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot,
|
|
|
cmLinkedTree<cmDefinitions>::iterator origin =
|
|
|
originSnapshot.Position->Vars;
|
|
|
pos->Parent = origin;
|
|
|
- pos->Vars = this->VarTree.Extend(origin);
|
|
|
+ pos->Vars = this->VarTree.Push(origin);
|
|
|
return cmState::Snapshot(this, pos);
|
|
|
}
|
|
|
|
|
|
@@ -912,12 +916,13 @@ cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot,
|
|
|
long entryPointLine,
|
|
|
std::string const& fileName)
|
|
|
{
|
|
|
- PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
|
|
- *originSnapshot.Position);
|
|
|
+ PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
|
|
+ *originSnapshot.Position);
|
|
|
pos->EntryPointLine = entryPointLine;
|
|
|
pos->EntryPointCommand = entryPointCommand;
|
|
|
pos->SnapshotType = MacroCallType;
|
|
|
- pos->ExecutionListFile = this->ExecutionListFiles.Extend(
|
|
|
+ pos->Keep = false;
|
|
|
+ pos->ExecutionListFile = this->ExecutionListFiles.Push(
|
|
|
originSnapshot.Position->ExecutionListFile, fileName);
|
|
|
assert(originSnapshot.Position->Vars.IsValid());
|
|
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
|
|
@@ -931,12 +936,13 @@ cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot,
|
|
|
long entryPointLine,
|
|
|
const std::string& fileName)
|
|
|
{
|
|
|
- PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
|
|
- *originSnapshot.Position);
|
|
|
+ PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
|
|
+ *originSnapshot.Position);
|
|
|
pos->EntryPointLine = entryPointLine;
|
|
|
pos->EntryPointCommand = entryPointCommand;
|
|
|
pos->SnapshotType = CallStackType;
|
|
|
- pos->ExecutionListFile = this->ExecutionListFiles.Extend(
|
|
|
+ pos->Keep = true;
|
|
|
+ pos->ExecutionListFile = this->ExecutionListFiles.Push(
|
|
|
originSnapshot.Position->ExecutionListFile, fileName);
|
|
|
assert(originSnapshot.Position->Vars.IsValid());
|
|
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
|
|
@@ -949,18 +955,20 @@ cmState::CreateVariableScopeSnapshot(cmState::Snapshot originSnapshot,
|
|
|
std::string const& entryPointCommand,
|
|
|
long entryPointLine)
|
|
|
{
|
|
|
- PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
|
|
- *originSnapshot.Position);
|
|
|
+ PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
|
|
+ *originSnapshot.Position);
|
|
|
pos->ScopeParent = originSnapshot.Position;
|
|
|
pos->EntryPointLine = entryPointLine;
|
|
|
pos->EntryPointCommand = entryPointCommand;
|
|
|
pos->SnapshotType = VariableScopeType;
|
|
|
+ pos->Keep = false;
|
|
|
+ pos->PolicyScope = originSnapshot.Position->Policies;
|
|
|
assert(originSnapshot.Position->Vars.IsValid());
|
|
|
|
|
|
cmLinkedTree<cmDefinitions>::iterator origin =
|
|
|
originSnapshot.Position->Vars;
|
|
|
pos->Parent = origin;
|
|
|
- pos->Vars = this->VarTree.Extend(origin);
|
|
|
+ pos->Vars = this->VarTree.Push(origin);
|
|
|
assert(pos->Vars.IsValid());
|
|
|
return cmState::Snapshot(this, pos);
|
|
|
}
|
|
|
@@ -971,12 +979,13 @@ cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot,
|
|
|
long entryPointLine,
|
|
|
const std::string& fileName)
|
|
|
{
|
|
|
- PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
|
|
- *originSnapshot.Position);
|
|
|
+ PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
|
|
+ *originSnapshot.Position);
|
|
|
pos->EntryPointLine = entryPointLine;
|
|
|
pos->EntryPointCommand = entryPointCommand;
|
|
|
pos->SnapshotType = InlineListFileType;
|
|
|
- pos->ExecutionListFile = this->ExecutionListFiles.Extend(
|
|
|
+ pos->Keep = true;
|
|
|
+ pos->ExecutionListFile = this->ExecutionListFiles.Push(
|
|
|
originSnapshot.Position->ExecutionListFile, fileName);
|
|
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
|
|
pos->PolicyScope = originSnapshot.Position->Policies;
|
|
|
@@ -986,9 +995,10 @@ cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot,
|
|
|
cmState::Snapshot
|
|
|
cmState::CreatePolicyScopeSnapshot(cmState::Snapshot originSnapshot)
|
|
|
{
|
|
|
- PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
|
|
- *originSnapshot.Position);
|
|
|
+ PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
|
|
+ *originSnapshot.Position);
|
|
|
pos->SnapshotType = PolicyScopeType;
|
|
|
+ pos->Keep = false;
|
|
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
|
|
pos->PolicyScope = originSnapshot.Position->Policies;
|
|
|
return cmState::Snapshot(this, pos);
|
|
|
@@ -1007,6 +1017,21 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot)
|
|
|
prevPos->BuildSystemDirectory->CompileOptions.size();
|
|
|
prevPos->BuildSystemDirectory->DirectoryEnd = prevPos;
|
|
|
|
|
|
+ if (!pos->Keep && this->SnapshotData.IsLast(pos))
|
|
|
+ {
|
|
|
+ if (pos->Vars != prevPos->Vars)
|
|
|
+ {
|
|
|
+ assert(this->VarTree.IsLast(pos->Vars));
|
|
|
+ this->VarTree.Pop(pos->Vars);
|
|
|
+ }
|
|
|
+ if (pos->ExecutionListFile != prevPos->ExecutionListFile)
|
|
|
+ {
|
|
|
+ assert(this->ExecutionListFiles.IsLast(pos->ExecutionListFile));
|
|
|
+ this->ExecutionListFiles.Pop(pos->ExecutionListFile);
|
|
|
+ }
|
|
|
+ this->SnapshotData.Pop(pos);
|
|
|
+ }
|
|
|
+
|
|
|
return Snapshot(this, prevPos);
|
|
|
}
|
|
|
|
|
|
@@ -1073,6 +1098,11 @@ void cmState::Directory::SetCurrentBinary(std::string const& dir)
|
|
|
this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc.c_str());
|
|
|
}
|
|
|
|
|
|
+void cmState::Snapshot::Keep()
|
|
|
+{
|
|
|
+ this->Position->Keep = true;
|
|
|
+}
|
|
|
+
|
|
|
void cmState::Snapshot::SetListFile(const std::string& listfile)
|
|
|
{
|
|
|
*this->Position->ExecutionListFile = listfile;
|
|
|
@@ -1187,8 +1217,8 @@ void cmState::Snapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak)
|
|
|
{
|
|
|
PositionType pos = this->Position;
|
|
|
pos->Policies =
|
|
|
- this->State->PolicyStack.Extend(pos->Policies,
|
|
|
- PolicyStackEntry(entry, weak));
|
|
|
+ this->State->PolicyStack.Push(pos->Policies,
|
|
|
+ PolicyStackEntry(entry, weak));
|
|
|
}
|
|
|
|
|
|
bool cmState::Snapshot::PopPolicy()
|
|
|
@@ -1198,7 +1228,7 @@ bool cmState::Snapshot::PopPolicy()
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
- ++pos->Policies;
|
|
|
+ pos->Policies = this->State->PolicyStack.Pop(pos->Policies);
|
|
|
return true;
|
|
|
}
|
|
|
|