Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===- StoreRef.h - Smart pointer for store objects -------------*- 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 defined the type StoreRef.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
0014 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
0015 
0016 #include <cassert>
0017 
0018 namespace clang {
0019 namespace ento {
0020 
0021 class StoreManager;
0022 
0023 /// Store - This opaque type encapsulates an immutable mapping from
0024 ///  locations to values.  At a high-level, it represents the symbolic
0025 ///  memory model.  Different subclasses of StoreManager may choose
0026 ///  different types to represent the locations and values.
0027 using Store = const void *;
0028 
0029 class StoreRef {
0030   Store store;
0031   StoreManager &mgr;
0032 
0033 public:
0034   StoreRef(Store store, StoreManager &smgr);
0035   StoreRef(const StoreRef &sr);
0036   StoreRef &operator=(StoreRef const &newStore);
0037   ~StoreRef();
0038 
0039   bool operator==(const StoreRef &x) const {
0040     assert(&mgr == &x.mgr);
0041     return x.store == store;
0042   }
0043 
0044   bool operator!=(const StoreRef &x) const { return !operator==(x); }
0045 
0046   Store getStore() const { return store; }
0047   const StoreManager &getStoreManager() const { return mgr; }
0048 };
0049 
0050 } // namespace ento
0051 } // namespace clang
0052 
0053 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H