about summary refs log tree commit diff homepage
path: root/include/klee/Expr/ExprHashMap.h
blob: 0143668dac4ee8cf47845b9a1bce3ee5a0d86c6d (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
43
44
//===-- ExprHashMap.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_EXPRHASHMAP_H
#define KLEE_EXPRHASHMAP_H

#include "klee/Expr/Expr.h"

#include <unordered_map>
#include <unordered_set>

namespace klee {

  namespace util {
    struct ExprHash  {
      unsigned operator()(const ref<Expr> e) const {
        return e->hash();
      }
    };
    
    struct ExprCmp {
      bool operator()(const ref<Expr> &a, const ref<Expr> &b) const {
        return a==b;
      }
    };
  }

  template <class T>
  class ExprHashMap
      : public std::unordered_map<ref<Expr>, T, klee::util::ExprHash,
                                  klee::util::ExprCmp> {};

  typedef std::unordered_set<ref<Expr>, klee::util::ExprHash,
                             klee::util::ExprCmp>
      ExprHashSet;
} // namespace klee

#endif /* KLEE_EXPRHASHMAP_H */