]>
Commit | Line | Data |
---|---|---|
223e47cc LB |
1 | //==- BlockCounter.h - ADT for counting block visits ---------------*- C++ -*-// |
2 | // | |
3 | // The LLVM Compiler Infrastructure | |
4 | // | |
5 | // This file is distributed under the University of Illinois Open Source | |
6 | // License. See LICENSE.TXT for details. | |
7 | // | |
8 | //===----------------------------------------------------------------------===// | |
9 | // | |
10 | // This file defines BlockCounter, an abstract data type used to count | |
11 | // the number of times a given block has been visited along a path | |
12 | // analyzed by CoreEngine. | |
13 | // | |
14 | //===----------------------------------------------------------------------===// | |
15 | ||
16 | #ifndef LLVM_CLANG_GR_BLOCKCOUNTER | |
17 | #define LLVM_CLANG_GR_BLOCKCOUNTER | |
18 | ||
19 | namespace llvm { | |
20 | class BumpPtrAllocator; | |
21 | } | |
22 | ||
23 | namespace clang { | |
24 | ||
25 | class StackFrameContext; | |
26 | ||
27 | namespace ento { | |
28 | ||
29 | /// \class BlockCounter | |
30 | /// \brief An abstract data type used to count the number of times a given | |
31 | /// block has been visited along a path analyzed by CoreEngine. | |
32 | class BlockCounter { | |
33 | void *Data; | |
34 | ||
35 | BlockCounter(void *D) : Data(D) {} | |
36 | ||
37 | public: | |
38 | BlockCounter() : Data(0) {} | |
39 | ||
40 | unsigned getNumVisited(const StackFrameContext *CallSite, | |
41 | unsigned BlockID) const; | |
42 | ||
43 | class Factory { | |
44 | void *F; | |
45 | public: | |
46 | Factory(llvm::BumpPtrAllocator& Alloc); | |
47 | ~Factory(); | |
48 | ||
49 | BlockCounter GetEmptyCounter(); | |
50 | BlockCounter IncrementCount(BlockCounter BC, | |
51 | const StackFrameContext *CallSite, | |
52 | unsigned BlockID); | |
53 | }; | |
54 | ||
55 | friend class Factory; | |
56 | }; | |
57 | ||
58 | } // end GR namespace | |
59 | ||
60 | } // end clang namespace | |
61 | ||
62 | #endif |