BlockCounter.h revision 9c378f705405d37f49795d5e915989de774fe11f
1df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov//==- BlockCounter.h - ADT for counting block visits ---------------*- C++ -*-// 2df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov// 3df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov// The LLVM Compiler Infrastructure 4df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov// 5df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov// This file is distributed under the University of Illinois Open Source 6df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov// License. See LICENSE.TXT for details. 7df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov// 8df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov//===----------------------------------------------------------------------===// 9df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov// 10df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov// This file defines BlockCounter, an abstract data type used to count 11df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov// the number of times a given block has been visited along a path 12191cbad91f19c14316810c806c4b0560d9386c8cBrian Carlstrom// analyzed by CoreEngine. 13191cbad91f19c14316810c806c4b0560d9386c8cBrian Carlstrom// 14191cbad91f19c14316810c806c4b0560d9386c8cBrian Carlstrom//===----------------------------------------------------------------------===// 15df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov 16df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov#ifndef LLVM_CLANG_GR_BLOCKCOUNTER 17df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov#define LLVM_CLANG_GR_BLOCKCOUNTER 18df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganov 19df6444931b030d3cdd9769e23f16f0a16fe9c654Svet Ganovnamespace llvm { 20 class BumpPtrAllocator; 21} 22 23namespace clang { 24 25class StackFrameContext; 26 27namespace ento { 28 29class BlockCounter { 30 void *Data; 31 32 BlockCounter(void *D) : Data(D) {} 33 34public: 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 60