about summary refs log tree commit diff homepage
path: root/lib/Core/PTree.h
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2019-09-11 21:19:24 +0100
committerMartinNowack <martin.nowack@gmail.com>2019-09-20 15:45:39 +0100
commitd773e3f762affd7189d34fbd6d1e7e0e5af3f712 (patch)
tree1a3b6aff102055d84caefdc2ccf758aaefb1b8b4 /lib/Core/PTree.h
parent6b2c98ba795a1edf81647482ae9f2560397f56bb (diff)
downloadklee-d773e3f762affd7189d34fbd6d1e7e0e5af3f712.tar.gz
refactor PTree: remove split(), add attach() method
Diffstat (limited to 'lib/Core/PTree.h')
-rw-r--r--lib/Core/PTree.h36
1 files changed, 14 insertions, 22 deletions
diff --git a/lib/Core/PTree.h b/lib/Core/PTree.h
index 7618e86e..6456b57f 100644
--- a/lib/Core/PTree.h
+++ b/lib/Core/PTree.h
@@ -15,36 +15,28 @@
 namespace klee {
   class ExecutionState;
 
-  class PTree { 
-    typedef ExecutionState* data_type;
-
-  public:
-    typedef class PTreeNode Node;
-    Node *root;
-
-    explicit PTree(const data_type &_root);
-    ~PTree() = default;
-    
-    std::pair<Node*,Node*> split(Node *n,
-                                 const data_type &leftData,
-                                 const data_type &rightData);
-    void remove(Node *n);
-
-    void dump(llvm::raw_ostream &os);
-  };
-
   class PTreeNode {
-    friend class PTree;
   public:
     PTreeNode *parent = nullptr;
     PTreeNode *left = nullptr;
     PTreeNode *right = nullptr;
-    ExecutionState *data = nullptr;
+    ExecutionState *state = nullptr;
 
-  private:
-    PTreeNode(PTreeNode * parent, ExecutionState * data);
+    PTreeNode(const PTreeNode&) = delete;
+    PTreeNode(PTreeNode *parent, ExecutionState *state);
     ~PTreeNode() = default;
   };
+
+  class PTree {
+  public:
+    PTreeNode * root = nullptr;
+    explicit PTree(ExecutionState *initialState);
+    ~PTree() = default;
+
+    static void attach(PTreeNode *node, ExecutionState *leftState, ExecutionState *rightState);
+    static void remove(PTreeNode *node);
+    void dump(llvm::raw_ostream &os);
+  };
 }
 
 #endif /* KLEE_PTREE_H */