Fix some null checks to actually test the part that needs checking.
[oota-llvm.git] / include / llvm / Analysis / ET-Forest.h
index b05776a9e0f1b3aaccf24d200e7abd69839c5e28..8bd5e447bca6db63e5c5712e377776a6a667cbff 100644 (file)
@@ -141,6 +141,7 @@ public:
   // removeFromForest()
   ~ETNode() {
     delete RightmostOcc;
+    delete ParentOcc;
   }
 
   void removeFromForest() {
@@ -250,16 +251,7 @@ public:
     return this->Below(other);
   }
 
-  void assignDFSNumber(int &num) {
-    DFSNumIn = num++;
-    
-    if (Son) {
-      Son->assignDFSNumber(num);
-      for (ETNode *son = Son->Right; son != Son; son = son->Right)
-        son->assignDFSNumber(num);
-    }
-    DFSNumOut = num++;
-  }
+  void assignDFSNumber (int);
   
   bool hasFather() const {
     return Father != NULL;
@@ -283,6 +275,14 @@ public:
     return DFSNumOut;
   }
 
+  const ETNode *getSon() const {
+    return Son;
+  }
+  
+  const ETNode *getBrother() const {
+    return Left;
+  }
+
  private:
   // Data represented by the node
   void *data;