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:
Brad King 2015-11-25 10:23:05 -05:00
parent 32edac6fdd
commit 518d6b22f6
2 changed files with 35 additions and 35 deletions

View File

@ -24,7 +24,7 @@
needs of the cmState. For example, the Truncate() method is a specific
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
from the root, and then extending from any other iterator.
@ -142,14 +142,14 @@ public:
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()
@ -179,7 +179,7 @@ private:
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(it.Position <= this->UpPositions.size());

View File

@ -288,7 +288,7 @@ cmState::Snapshot cmState::Reset()
assert(pos->Policies.IsValid());
assert(pos->PolicyRoot.IsValid());
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();
@ -751,14 +751,14 @@ 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->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;
@ -768,7 +768,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();
@ -781,17 +781,17 @@ 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->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;
@ -804,7 +804,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);
return snapshot;
@ -816,13 +816,13 @@ 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->ExecutionListFile = this->ExecutionListFiles.Push(
originSnapshot.Position->ExecutionListFile, fileName);
pos->BuildSystemDirectory->DirectoryEnd = pos;
pos->PolicyScope = originSnapshot.Position->Policies;
@ -830,7 +830,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);
}
@ -841,12 +841,12 @@ 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->ExecutionListFile = this->ExecutionListFiles.Push(
originSnapshot.Position->ExecutionListFile, fileName);
assert(originSnapshot.Position->Vars.IsValid());
pos->BuildSystemDirectory->DirectoryEnd = pos;
@ -860,12 +860,12 @@ 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->ExecutionListFile = this->ExecutionListFiles.Push(
originSnapshot.Position->ExecutionListFile, fileName);
assert(originSnapshot.Position->Vars.IsValid());
pos->BuildSystemDirectory->DirectoryEnd = pos;
@ -878,8 +878,8 @@ 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;
@ -890,7 +890,7 @@ cmState::CreateVariableScopeSnapshot(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);
assert(pos->Vars.IsValid());
return cmState::Snapshot(this, pos);
}
@ -901,12 +901,12 @@ 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->ExecutionListFile = this->ExecutionListFiles.Push(
originSnapshot.Position->ExecutionListFile, fileName);
pos->BuildSystemDirectory->DirectoryEnd = pos;
pos->PolicyScope = originSnapshot.Position->Policies;
@ -916,8 +916,8 @@ 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->BuildSystemDirectory->DirectoryEnd = pos;
pos->PolicyScope = originSnapshot.Position->Policies;
@ -1113,8 +1113,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()