aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis/PathSensitive/GRBlockCounter.h
blob: b4fd2704b81a6e5e5e34e1b0e2437d1a4f2caff2 (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
45
46
47
48
49
50
//==- GRBlockCounter.h - ADT for counting block visits -------------*- C++ -*-//
//             
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines GRBlockCounter, an abstract data type used to count
//  the number of times a given block has been visited along a path
//  analyzed by GRCoreEngine.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_ANALYSIS_GRBLOCKCOUNTER
#define LLVM_CLANG_ANALYSIS_GRBLOCKCOUNTER

namespace llvm {
  class BumpPtrAllocator;
}

namespace clang {

class GRBlockCounter {
  void* Data;
  
  GRBlockCounter(void* D) : Data(D) {}  

public:
  GRBlockCounter() : Data(0) {}
  
  unsigned getNumVisited(unsigned BlockID) const;
  
  class Factory {
    void* F;
  public:
    Factory(llvm::BumpPtrAllocator& Alloc);
    ~Factory();
    
    GRBlockCounter GetEmptyCounter();
    GRBlockCounter IncrementCount(GRBlockCounter BC, unsigned BlockID);
  };
  
  friend class Factory;
};

} // end clang namespace
  
#endif