Kaynağa Gözat

cmState: Add GetCallStackParent method.

Stephen Kelly 10 yıl önce
ebeveyn
işleme
94704d759c
2 değiştirilmiş dosya ile 23 ekleme ve 0 silme
  1. 22 0
      Source/cmState.cxx
  2. 1 0
      Source/cmState.h

+ 22 - 0
Source/cmState.cxx

@@ -854,6 +854,28 @@ cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const
   return snapshot;
 }
 
+cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
+{
+  assert(this->State);
+  assert(this->Position != this->State->SnapshotData.Root());
+
+  Snapshot snapshot;
+  if (this->Position->SnapshotType == cmState::BuildsystemDirectoryType)
+    {
+    return snapshot;
+    }
+
+  PositionType parentPos = this->Position;
+  ++parentPos;
+  if (parentPos == this->State->SnapshotData.Root())
+    {
+    return snapshot;
+    }
+
+  snapshot = Snapshot(this->State, parentPos);
+  return snapshot;
+}
+
 cmState* cmState::Snapshot::GetState() const
 {
   return this->State;

+ 1 - 0
Source/cmState.h

@@ -59,6 +59,7 @@ public:
 
     bool IsValid() const;
     Snapshot GetBuildsystemDirectoryParent() const;
+    Snapshot GetCallStackParent() const;
 
     cmState* GetState() const;