• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /// Store - This opaque type encapsulates an immutable mapping from
23 ///  locations to values.  At a high-level, it represents the symbolic
24 ///  memory model.  Different subclasses of StoreManager may choose
25 ///  different types to represent the locations and values.
26 typedef const void *Store;
27 
28 class StoreManager;
29 
30 class StoreRef {
31   Store store;
32   StoreManager &mgr;
33 public:
34   StoreRef(Store, StoreManager &);
35   StoreRef(const StoreRef &);
36   StoreRef &operator=(StoreRef const &);
37 
38   bool operator==(const StoreRef &x) const {
39     assert(&mgr == &x.mgr);
40     return x.store == store;
41   }
42   bool operator!=(const StoreRef &x) const { return !operator==(x); }
43 
44   ~StoreRef();
45 
getStore()46   Store getStore() const { return store; }
getStoreManager()47   const StoreManager &getStoreManager() const { return mgr; }
48 };
49 
50 }}
51 #endif
52