Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:07

0001 //==- BlockCounter.h - ADT for counting block visits ---------------*- C++ -*-//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 //  This file defines BlockCounter, an abstract data type used to count
0010 //  the number of times a given block has been visited along a path
0011 //  analyzed by CoreEngine.
0012 //
0013 //===----------------------------------------------------------------------===//
0014 
0015 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BLOCKCOUNTER_H
0016 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BLOCKCOUNTER_H
0017 
0018 #include "llvm/Support/Allocator.h"
0019 
0020 namespace clang {
0021 
0022 class StackFrameContext;
0023 
0024 namespace ento {
0025 
0026 /// \class BlockCounter
0027 /// An abstract data type used to count the number of times a given
0028 /// block has been visited along a path analyzed by CoreEngine.
0029 class BlockCounter {
0030   void *Data;
0031 
0032   BlockCounter(void *D) : Data(D) {}
0033 
0034 public:
0035   BlockCounter() : Data(nullptr) {}
0036 
0037   unsigned getNumVisited(const StackFrameContext *CallSite,
0038                          unsigned BlockID) const;
0039 
0040   class Factory {
0041     void *F;
0042   public:
0043     Factory(llvm::BumpPtrAllocator& Alloc);
0044     ~Factory();
0045 
0046     BlockCounter GetEmptyCounter();
0047     BlockCounter IncrementCount(BlockCounter BC,
0048                                   const StackFrameContext *CallSite,
0049                                   unsigned BlockID);
0050   };
0051 
0052   friend class Factory;
0053 };
0054 
0055 } // end GR namespace
0056 
0057 } // end clang namespace
0058 
0059 #endif