clang  19.0.0git
StoreRef.h
Go to the documentation of this file.
1 //===- StoreRef.h - Smart pointer for store objects -------------*- 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 defined the type StoreRef.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
14 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
15 
16 #include <cassert>
17 
18 namespace clang {
19 namespace ento {
20 
21 class StoreManager;
22 
23 /// Store - This opaque type encapsulates an immutable mapping from
24 /// locations to values. At a high-level, it represents the symbolic
25 /// memory model. Different subclasses of StoreManager may choose
26 /// different types to represent the locations and values.
27 using Store = const void *;
28 
29 class StoreRef {
30  Store store;
31  StoreManager &mgr;
32 
33 public:
34  StoreRef(Store store, StoreManager &smgr);
35  StoreRef(const StoreRef &sr);
36  StoreRef &operator=(StoreRef const &newStore);
37  ~StoreRef();
38 
39  bool operator==(const StoreRef &x) const {
40  assert(&mgr == &x.mgr);
41  return x.store == store;
42  }
43 
44  bool operator!=(const StoreRef &x) const { return !operator==(x); }
45 
46  Store getStore() const { return store; }
47  const StoreManager &getStoreManager() const { return mgr; }
48 };
49 
50 } // namespace ento
51 } // namespace clang
52 
53 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
Store getStore() const
Definition: StoreRef.h:46
StoreRef & operator=(StoreRef const &newStore)
Definition: Store.h:303
bool operator!=(const StoreRef &x) const
Definition: StoreRef.h:44
const StoreManager & getStoreManager() const
Definition: StoreRef.h:47
StoreRef(Store store, StoreManager &smgr)
Definition: Store.h:285
bool operator==(const StoreRef &x) const
Definition: StoreRef.h:39
const void * Store
Store - This opaque type encapsulates an immutable mapping from locations to values.
Definition: StoreRef.h:27
The JSON file list parser is used to communicate input to InstallAPI.