clang 23.0.0git
BlockCounter.h
Go to the documentation of this file.
1//==- BlockCounter.h - ADT for counting block visits ---------------*- C++ -*-//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
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.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BLOCKCOUNTER_H
16#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BLOCKCOUNTER_H
17
18#include "llvm/Support/Allocator.h"
19
20namespace clang {
21
22class StackFrame;
23
24namespace ento {
25
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.
29class BlockCounter {
30 void *Data;
31
32 BlockCounter(void *D) : Data(D) {}
33
34public:
35 BlockCounter() : Data(nullptr) {}
36
37 unsigned getNumVisited(const StackFrame *CallSite, unsigned BlockID) const;
38
39 class Factory {
40 void *F;
41 public:
42 Factory(llvm::BumpPtrAllocator& Alloc);
43 ~Factory();
44
45 BlockCounter GetEmptyCounter();
46 BlockCounter IncrementCount(BlockCounter BC, const StackFrame *CallSite,
47 unsigned BlockID);
48 };
49
50 friend class Factory;
51};
52
53} // end GR namespace
54
55} // end clang namespace
56
57#endif
It represents a stack frame of the call stack (based on CallEvent).
Factory(llvm::BumpPtrAllocator &Alloc)
BlockCounter IncrementCount(BlockCounter BC, const StackFrame *CallSite, unsigned BlockID)
unsigned getNumVisited(const StackFrame *CallSite, unsigned BlockID) const
The JSON file list parser is used to communicate input to InstallAPI.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...