about summary refs log tree commit diff homepage
path: root/lib/Core/PTree.h
blob: 01632ebfe8825b2e85707d128f50db67e68f7d10 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//===-- PTree.h -------------------------------------------------*- C++ -*-===//
//
//                     The KLEE Symbolic Virtual Machine
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef KLEE_PTREE_H
#define KLEE_PTREE_H

#include "klee/Expr/Expr.h"

namespace klee {
  class ExecutionState;

  class PTreeNode {
  public:
    PTreeNode *parent = nullptr;
    std::unique_ptr<PTreeNode> left;
    std::unique_ptr<PTreeNode> right;
    ExecutionState *state = nullptr;

    PTreeNode(const PTreeNode&) = delete;
    PTreeNode(PTreeNode *parent, ExecutionState *state);
    ~PTreeNode() = default;
  };

  class PTree {
  public:
    std::unique_ptr<PTreeNode> root;
    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 */