clang API Documentation
00001 //==- BlockCounter.h - ADT for counting block visits ---------------*- C++ -*-// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines BlockCounter, an abstract data type used to count 00011 // the number of times a given block has been visited along a path 00012 // analyzed by CoreEngine. 00013 // 00014 //===----------------------------------------------------------------------===// 00015 00016 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BLOCKCOUNTER_H 00017 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BLOCKCOUNTER_H 00018 00019 #include "llvm/Support/Allocator.h" 00020 00021 namespace clang { 00022 00023 class StackFrameContext; 00024 00025 namespace ento { 00026 00027 /// \class BlockCounter 00028 /// \brief An abstract data type used to count the number of times a given 00029 /// block has been visited along a path analyzed by CoreEngine. 00030 class BlockCounter { 00031 void *Data; 00032 00033 BlockCounter(void *D) : Data(D) {} 00034 00035 public: 00036 BlockCounter() : Data(nullptr) {} 00037 00038 unsigned getNumVisited(const StackFrameContext *CallSite, 00039 unsigned BlockID) const; 00040 00041 class Factory { 00042 void *F; 00043 public: 00044 Factory(llvm::BumpPtrAllocator& Alloc); 00045 ~Factory(); 00046 00047 BlockCounter GetEmptyCounter(); 00048 BlockCounter IncrementCount(BlockCounter BC, 00049 const StackFrameContext *CallSite, 00050 unsigned BlockID); 00051 }; 00052 00053 friend class Factory; 00054 }; 00055 00056 } // end GR namespace 00057 00058 } // end clang namespace 00059 00060 #endif