cmState: Add Snapshot method to get bottom of call stack

The bottom of the call stack is always a long-lived snapshot and can be
saved for later use with cmOutputConverter.
This commit is contained in:
Brad King 2016-04-13 09:41:24 -04:00
parent 2faa8b3620
commit 18b6676bff
2 changed files with 16 additions and 0 deletions

View File

@ -1213,6 +1213,21 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
return snapshot; return snapshot;
} }
cmState::Snapshot cmState::Snapshot::GetCallStackBottom() const
{
assert(this->State);
assert(this->Position != this->State->SnapshotData.Root());
PositionType pos = this->Position;
while (pos->SnapshotType != cmState::BaseType &&
pos->SnapshotType != cmState::BuildsystemDirectoryType &&
pos != this->State->SnapshotData.Root())
{
++pos;
}
return Snapshot(this->State, pos);
}
void cmState::Snapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak) void cmState::Snapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak)
{ {
PositionType pos = this->Position; PositionType pos = this->Position;

View File

@ -75,6 +75,7 @@ public:
bool IsValid() const; bool IsValid() const;
Snapshot GetBuildsystemDirectoryParent() const; Snapshot GetBuildsystemDirectoryParent() const;
Snapshot GetCallStackParent() const; Snapshot GetCallStackParent() const;
Snapshot GetCallStackBottom() const;
SnapshotType GetType() const; SnapshotType GetType() const;
void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status); void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status);