about summary refs log tree commit diff homepage
path: root/include/klee/Module/KInstIterator.h
blob: e5bd37f89de3c6d63eb6b666d95c22cab1bb2078 (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
//===-- KInstIterator.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_KINSTITERATOR_H
#define KLEE_KINSTITERATOR_H

namespace klee {
  struct KInstruction;

  class KInstIterator {
    KInstruction **it;

  public:
    KInstIterator() : it(0) {}
    KInstIterator(KInstruction **_it) : it(_it) {}

    bool operator==(const KInstIterator &b) const {
      return it==b.it;
    }
    bool operator!=(const KInstIterator &b) const {
      return !(*this == b);
    }

    KInstIterator &operator++() {
      ++it;
      return *this;
    }

    operator KInstruction*() const { return it ? *it : 0;}
    operator bool() const { return it != 0; }

    KInstruction *operator ->() const { return *it; }
  };
} // End klee namespace

#endif /* KLEE_KINSTITERATOR_H */