clang  8.0.0svn
StoreRef.h
Go to the documentation of this file.
1 //===- StoreRef.h - Smart pointer for store objects -------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defined the type StoreRef.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
15 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
16 
17 #include <cassert>
18 
19 namespace clang {
20 namespace ento {
21 
22 class StoreManager;
23 
24 /// Store - This opaque type encapsulates an immutable mapping from
25 /// locations to values. At a high-level, it represents the symbolic
26 /// memory model. Different subclasses of StoreManager may choose
27 /// different types to represent the locations and values.
28 using Store = const void *;
29 
30 class StoreRef {
31  Store store;
32  StoreManager &mgr;
33 
34 public:
35  StoreRef(Store store, StoreManager &smgr);
36  StoreRef(const StoreRef &sr);
37  StoreRef &operator=(StoreRef const &newStore);
38  ~StoreRef();
39 
40  bool operator==(const StoreRef &x) const {
41  assert(&mgr == &x.mgr);
42  return x.store == store;
43  }
44 
45  bool operator!=(const StoreRef &x) const { return !operator==(x); }
46 
47  Store getStore() const { return store; }
48  const StoreManager &getStoreManager() const { return mgr; }
49 };
50 
51 } // namespace ento
52 } // namespace clang
53 
54 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
Store getStore() const
Definition: StoreRef.h:47
const StoreManager & getStoreManager() const
Definition: StoreRef.h:48
bool operator!=(const StoreRef &x) const
Definition: StoreRef.h:45
StoreRef(Store store, StoreManager &smgr)
Definition: Store.h:301
const void * Store
Store - This opaque type encapsulates an immutable mapping from locations to values.
Definition: StoreRef.h:28
StoreRef & operator=(StoreRef const &newStore)
Definition: Store.h:319
Dataflow Directional Tag Classes.
bool operator==(const StoreRef &x) const
Definition: StoreRef.h:40