1 //==- BlockCounter.h - ADT for counting block visits ---------------*- C++ -*-//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file defines BlockCounter, an abstract data type used to count
10 // the number of times a given block has been visited along a path
11 // analyzed by CoreEngine.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BLOCKCOUNTER_H
16 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BLOCKCOUNTER_H
18 #include "llvm/Support/Allocator.h"
22 class StackFrameContext;
26 /// \class BlockCounter
27 /// An abstract data type used to count the number of times a given
28 /// block has been visited along a path analyzed by CoreEngine.
32 BlockCounter(void *D) : Data(D) {}
35 BlockCounter() : Data(nullptr) {}
37 unsigned getNumVisited(const StackFrameContext *CallSite,
38 unsigned BlockID) const;
43 Factory(llvm::BumpPtrAllocator& Alloc);
46 BlockCounter GetEmptyCounter();
47 BlockCounter IncrementCount(BlockCounter BC,
48 const StackFrameContext *CallSite,
57 } // end clang namespace