]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h
Copy head to stable/9 as part of 9.0-RELEASE release cycle.
[FreeBSD/stable/9.git] / contrib / llvm / tools / clang / include / clang / StaticAnalyzer / Core / PathSensitive / BlockCounter.h
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   void* Data;
31
32   BlockCounter(void* D) : Data(D) {}
33
34 public:
35   BlockCounter() : Data(0) {}
36
37   unsigned getNumVisited(const StackFrameContext *CallSite, 
38                          unsigned BlockID) const;
39
40   class Factory {
41     void* F;
42   public:
43     Factory(llvm::BumpPtrAllocator& Alloc);
44     ~Factory();
45
46     BlockCounter GetEmptyCounter();
47     BlockCounter IncrementCount(BlockCounter BC, 
48                                   const StackFrameContext *CallSite,
49                                   unsigned BlockID);
50   };
51
52   friend class Factory;
53 };
54
55 } // end GR namespace
56
57 } // end clang namespace
58
59 #endif