cmLinkedTree: Rename 'Extend' method to 'Push'
Logically the method pushes a nested scope on top of a given scope because the "up" pointer sequence forms a stack independent of any other branches of the tree.
This commit is contained in:
parent
32edac6fdd
commit
518d6b22f6
|
@ -24,7 +24,7 @@
|
||||||
needs of the cmState. For example, the Truncate() method is a specific
|
needs of the cmState. For example, the Truncate() method is a specific
|
||||||
requirement of the cmState.
|
requirement of the cmState.
|
||||||
|
|
||||||
An empty cmLinkedTree provides a Root() method, and an Extend() method,
|
An empty cmLinkedTree provides a Root() method, and an Push() method,
|
||||||
each of which return iterators. A Tree can be built up by extending
|
each of which return iterators. A Tree can be built up by extending
|
||||||
from the root, and then extending from any other iterator.
|
from the root, and then extending from any other iterator.
|
||||||
|
|
||||||
|
@ -142,14 +142,14 @@ public:
|
||||||
return iterator(const_cast<cmLinkedTree*>(this), 0);
|
return iterator(const_cast<cmLinkedTree*>(this), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator Extend(iterator it)
|
iterator Push(iterator it)
|
||||||
{
|
{
|
||||||
return Extend_impl(it, T());
|
return Push_impl(it, T());
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator Extend(iterator it, T t)
|
iterator Push(iterator it, T t)
|
||||||
{
|
{
|
||||||
return Extend_impl(it, t);
|
return Push_impl(it, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator Truncate()
|
iterator Truncate()
|
||||||
|
@ -179,7 +179,7 @@ private:
|
||||||
return &this->Data[pos];
|
return &this->Data[pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator Extend_impl(iterator it, T t)
|
iterator Push_impl(iterator it, T t)
|
||||||
{
|
{
|
||||||
assert(this->UpPositions.size() == this->Data.size());
|
assert(this->UpPositions.size() == this->Data.size());
|
||||||
assert(it.Position <= this->UpPositions.size());
|
assert(it.Position <= this->UpPositions.size());
|
||||||
|
|
|
@ -288,7 +288,7 @@ cmState::Snapshot cmState::Reset()
|
||||||
assert(pos->Policies.IsValid());
|
assert(pos->Policies.IsValid());
|
||||||
assert(pos->PolicyRoot.IsValid());
|
assert(pos->PolicyRoot.IsValid());
|
||||||
this->VarTree.Clear();
|
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->Parent = this->VarTree.Root();
|
||||||
pos->Root = this->VarTree.Root();
|
pos->Root = this->VarTree.Root();
|
||||||
|
|
||||||
|
@ -751,14 +751,14 @@ void cmState::Directory::ComputeRelativePathTopBinary()
|
||||||
|
|
||||||
cmState::Snapshot cmState::CreateBaseSnapshot()
|
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->DirectoryParent = this->SnapshotData.Root();
|
||||||
pos->ScopeParent = this->SnapshotData.Root();
|
pos->ScopeParent = this->SnapshotData.Root();
|
||||||
pos->SnapshotType = BaseType;
|
pos->SnapshotType = BaseType;
|
||||||
pos->BuildSystemDirectory =
|
pos->BuildSystemDirectory =
|
||||||
this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root());
|
this->BuildsystemDirectory.Push(this->BuildsystemDirectory.Root());
|
||||||
pos->ExecutionListFile =
|
pos->ExecutionListFile =
|
||||||
this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root());
|
this->ExecutionListFiles.Push(this->ExecutionListFiles.Root());
|
||||||
pos->IncludeDirectoryPosition = 0;
|
pos->IncludeDirectoryPosition = 0;
|
||||||
pos->CompileDefinitionsPosition = 0;
|
pos->CompileDefinitionsPosition = 0;
|
||||||
pos->CompileOptionsPosition = 0;
|
pos->CompileOptionsPosition = 0;
|
||||||
|
@ -768,7 +768,7 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
|
||||||
pos->PolicyScope = this->PolicyStack.Root();
|
pos->PolicyScope = this->PolicyStack.Root();
|
||||||
assert(pos->Policies.IsValid());
|
assert(pos->Policies.IsValid());
|
||||||
assert(pos->PolicyRoot.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());
|
assert(pos->Vars.IsValid());
|
||||||
pos->Parent = this->VarTree.Root();
|
pos->Parent = this->VarTree.Root();
|
||||||
pos->Root = this->VarTree.Root();
|
pos->Root = this->VarTree.Root();
|
||||||
|
@ -781,17 +781,17 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
|
||||||
long entryPointLine)
|
long entryPointLine)
|
||||||
{
|
{
|
||||||
assert(originSnapshot.IsValid());
|
assert(originSnapshot.IsValid());
|
||||||
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position);
|
PositionType pos = this->SnapshotData.Push(originSnapshot.Position);
|
||||||
pos->EntryPointLine = entryPointLine;
|
pos->EntryPointLine = entryPointLine;
|
||||||
pos->EntryPointCommand = entryPointCommand;
|
pos->EntryPointCommand = entryPointCommand;
|
||||||
pos->DirectoryParent = originSnapshot.Position;
|
pos->DirectoryParent = originSnapshot.Position;
|
||||||
pos->ScopeParent = originSnapshot.Position;
|
pos->ScopeParent = originSnapshot.Position;
|
||||||
pos->SnapshotType = BuildsystemDirectoryType;
|
pos->SnapshotType = BuildsystemDirectoryType;
|
||||||
pos->BuildSystemDirectory =
|
pos->BuildSystemDirectory =
|
||||||
this->BuildsystemDirectory.Extend(
|
this->BuildsystemDirectory.Push(
|
||||||
originSnapshot.Position->BuildSystemDirectory);
|
originSnapshot.Position->BuildSystemDirectory);
|
||||||
pos->ExecutionListFile =
|
pos->ExecutionListFile =
|
||||||
this->ExecutionListFiles.Extend(
|
this->ExecutionListFiles.Push(
|
||||||
originSnapshot.Position->ExecutionListFile);
|
originSnapshot.Position->ExecutionListFile);
|
||||||
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
||||||
pos->Policies = originSnapshot.Position->Policies;
|
pos->Policies = originSnapshot.Position->Policies;
|
||||||
|
@ -804,7 +804,7 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
|
||||||
originSnapshot.Position->Vars;
|
originSnapshot.Position->Vars;
|
||||||
pos->Parent = origin;
|
pos->Parent = origin;
|
||||||
pos->Root = origin;
|
pos->Root = origin;
|
||||||
pos->Vars = this->VarTree.Extend(origin);
|
pos->Vars = this->VarTree.Push(origin);
|
||||||
cmState::Snapshot snapshot = cmState::Snapshot(this, pos);
|
cmState::Snapshot snapshot = cmState::Snapshot(this, pos);
|
||||||
originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot);
|
originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot);
|
||||||
return snapshot;
|
return snapshot;
|
||||||
|
@ -816,13 +816,13 @@ cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot,
|
||||||
long entryPointLine,
|
long entryPointLine,
|
||||||
std::string const& fileName)
|
std::string const& fileName)
|
||||||
{
|
{
|
||||||
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
||||||
*originSnapshot.Position);
|
*originSnapshot.Position);
|
||||||
pos->ScopeParent = originSnapshot.Position;
|
pos->ScopeParent = originSnapshot.Position;
|
||||||
pos->EntryPointLine = entryPointLine;
|
pos->EntryPointLine = entryPointLine;
|
||||||
pos->EntryPointCommand = entryPointCommand;
|
pos->EntryPointCommand = entryPointCommand;
|
||||||
pos->SnapshotType = FunctionCallType;
|
pos->SnapshotType = FunctionCallType;
|
||||||
pos->ExecutionListFile = this->ExecutionListFiles.Extend(
|
pos->ExecutionListFile = this->ExecutionListFiles.Push(
|
||||||
originSnapshot.Position->ExecutionListFile, fileName);
|
originSnapshot.Position->ExecutionListFile, fileName);
|
||||||
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
||||||
pos->PolicyScope = originSnapshot.Position->Policies;
|
pos->PolicyScope = originSnapshot.Position->Policies;
|
||||||
|
@ -830,7 +830,7 @@ cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot,
|
||||||
cmLinkedTree<cmDefinitions>::iterator origin =
|
cmLinkedTree<cmDefinitions>::iterator origin =
|
||||||
originSnapshot.Position->Vars;
|
originSnapshot.Position->Vars;
|
||||||
pos->Parent = origin;
|
pos->Parent = origin;
|
||||||
pos->Vars = this->VarTree.Extend(origin);
|
pos->Vars = this->VarTree.Push(origin);
|
||||||
return cmState::Snapshot(this, pos);
|
return cmState::Snapshot(this, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,12 +841,12 @@ cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot,
|
||||||
long entryPointLine,
|
long entryPointLine,
|
||||||
std::string const& fileName)
|
std::string const& fileName)
|
||||||
{
|
{
|
||||||
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
||||||
*originSnapshot.Position);
|
*originSnapshot.Position);
|
||||||
pos->EntryPointLine = entryPointLine;
|
pos->EntryPointLine = entryPointLine;
|
||||||
pos->EntryPointCommand = entryPointCommand;
|
pos->EntryPointCommand = entryPointCommand;
|
||||||
pos->SnapshotType = MacroCallType;
|
pos->SnapshotType = MacroCallType;
|
||||||
pos->ExecutionListFile = this->ExecutionListFiles.Extend(
|
pos->ExecutionListFile = this->ExecutionListFiles.Push(
|
||||||
originSnapshot.Position->ExecutionListFile, fileName);
|
originSnapshot.Position->ExecutionListFile, fileName);
|
||||||
assert(originSnapshot.Position->Vars.IsValid());
|
assert(originSnapshot.Position->Vars.IsValid());
|
||||||
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
||||||
|
@ -860,12 +860,12 @@ cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot,
|
||||||
long entryPointLine,
|
long entryPointLine,
|
||||||
const std::string& fileName)
|
const std::string& fileName)
|
||||||
{
|
{
|
||||||
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
||||||
*originSnapshot.Position);
|
*originSnapshot.Position);
|
||||||
pos->EntryPointLine = entryPointLine;
|
pos->EntryPointLine = entryPointLine;
|
||||||
pos->EntryPointCommand = entryPointCommand;
|
pos->EntryPointCommand = entryPointCommand;
|
||||||
pos->SnapshotType = CallStackType;
|
pos->SnapshotType = CallStackType;
|
||||||
pos->ExecutionListFile = this->ExecutionListFiles.Extend(
|
pos->ExecutionListFile = this->ExecutionListFiles.Push(
|
||||||
originSnapshot.Position->ExecutionListFile, fileName);
|
originSnapshot.Position->ExecutionListFile, fileName);
|
||||||
assert(originSnapshot.Position->Vars.IsValid());
|
assert(originSnapshot.Position->Vars.IsValid());
|
||||||
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
||||||
|
@ -878,7 +878,7 @@ cmState::CreateVariableScopeSnapshot(cmState::Snapshot originSnapshot,
|
||||||
std::string const& entryPointCommand,
|
std::string const& entryPointCommand,
|
||||||
long entryPointLine)
|
long entryPointLine)
|
||||||
{
|
{
|
||||||
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
||||||
*originSnapshot.Position);
|
*originSnapshot.Position);
|
||||||
pos->ScopeParent = originSnapshot.Position;
|
pos->ScopeParent = originSnapshot.Position;
|
||||||
pos->EntryPointLine = entryPointLine;
|
pos->EntryPointLine = entryPointLine;
|
||||||
|
@ -890,7 +890,7 @@ cmState::CreateVariableScopeSnapshot(cmState::Snapshot originSnapshot,
|
||||||
cmLinkedTree<cmDefinitions>::iterator origin =
|
cmLinkedTree<cmDefinitions>::iterator origin =
|
||||||
originSnapshot.Position->Vars;
|
originSnapshot.Position->Vars;
|
||||||
pos->Parent = origin;
|
pos->Parent = origin;
|
||||||
pos->Vars = this->VarTree.Extend(origin);
|
pos->Vars = this->VarTree.Push(origin);
|
||||||
assert(pos->Vars.IsValid());
|
assert(pos->Vars.IsValid());
|
||||||
return cmState::Snapshot(this, pos);
|
return cmState::Snapshot(this, pos);
|
||||||
}
|
}
|
||||||
|
@ -901,12 +901,12 @@ cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot,
|
||||||
long entryPointLine,
|
long entryPointLine,
|
||||||
const std::string& fileName)
|
const std::string& fileName)
|
||||||
{
|
{
|
||||||
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
||||||
*originSnapshot.Position);
|
*originSnapshot.Position);
|
||||||
pos->EntryPointLine = entryPointLine;
|
pos->EntryPointLine = entryPointLine;
|
||||||
pos->EntryPointCommand = entryPointCommand;
|
pos->EntryPointCommand = entryPointCommand;
|
||||||
pos->SnapshotType = InlineListFileType;
|
pos->SnapshotType = InlineListFileType;
|
||||||
pos->ExecutionListFile = this->ExecutionListFiles.Extend(
|
pos->ExecutionListFile = this->ExecutionListFiles.Push(
|
||||||
originSnapshot.Position->ExecutionListFile, fileName);
|
originSnapshot.Position->ExecutionListFile, fileName);
|
||||||
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
||||||
pos->PolicyScope = originSnapshot.Position->Policies;
|
pos->PolicyScope = originSnapshot.Position->Policies;
|
||||||
|
@ -916,7 +916,7 @@ cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot,
|
||||||
cmState::Snapshot
|
cmState::Snapshot
|
||||||
cmState::CreatePolicyScopeSnapshot(cmState::Snapshot originSnapshot)
|
cmState::CreatePolicyScopeSnapshot(cmState::Snapshot originSnapshot)
|
||||||
{
|
{
|
||||||
PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
|
PositionType pos = this->SnapshotData.Push(originSnapshot.Position,
|
||||||
*originSnapshot.Position);
|
*originSnapshot.Position);
|
||||||
pos->SnapshotType = PolicyScopeType;
|
pos->SnapshotType = PolicyScopeType;
|
||||||
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
pos->BuildSystemDirectory->DirectoryEnd = pos;
|
||||||
|
@ -1113,7 +1113,7 @@ void cmState::Snapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak)
|
||||||
{
|
{
|
||||||
PositionType pos = this->Position;
|
PositionType pos = this->Position;
|
||||||
pos->Policies =
|
pos->Policies =
|
||||||
this->State->PolicyStack.Extend(pos->Policies,
|
this->State->PolicyStack.Push(pos->Policies,
|
||||||
PolicyStackEntry(entry, weak));
|
PolicyStackEntry(entry, weak));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue