StoreRef.h revision 226633
1221339Sdim//== StoreRef.h - Smart pointer for store objects ---------------*- C++ -*--==//
2221339Sdim//
3221339Sdim//                     The LLVM Compiler Infrastructure
4221339Sdim//
5221339Sdim// This file is distributed under the University of Illinois Open Source
6221339Sdim// License. See LICENSE.TXT for details.
7221339Sdim//
8221339Sdim//===----------------------------------------------------------------------===//
9221339Sdim//
10221339Sdim//  This file defined the type StoreRef.
11221339Sdim//
12221339Sdim//===----------------------------------------------------------------------===//
13221339Sdim
14221339Sdim#ifndef LLVM_CLANG_GR_STOREREF_H
15221339Sdim#define LLVM_CLANG_GR_STOREREF_H
16221339Sdim
17221339Sdim#include <cassert>
18221339Sdim
19221339Sdimnamespace clang {
20221339Sdimnamespace ento {
21221339Sdim
22221339Sdim/// Store - This opaque type encapsulates an immutable mapping from
23221339Sdim///  locations to values.  At a high-level, it represents the symbolic
24221339Sdim///  memory model.  Different subclasses of StoreManager may choose
25221339Sdim///  different types to represent the locations and values.
26226633Sdimtypedef const void *Store;
27221339Sdim
28221339Sdimclass StoreManager;
29221339Sdim
30221339Sdimclass StoreRef {
31221339Sdim  Store store;
32221339Sdim  StoreManager &mgr;
33221339Sdimpublic:
34221339Sdim  StoreRef(Store, StoreManager &);
35221339Sdim  StoreRef(const StoreRef &);
36221339Sdim  StoreRef &operator=(StoreRef const &);
37221339Sdim
38221339Sdim  bool operator==(const StoreRef &x) const {
39221339Sdim    assert(&mgr == &x.mgr);
40221339Sdim    return x.store == store;
41221339Sdim  }
42221339Sdim  bool operator!=(const StoreRef &x) const { return !operator==(x); }
43221339Sdim
44221339Sdim  ~StoreRef();
45221339Sdim
46221339Sdim  Store getStore() const { return store; }
47226633Sdim  const StoreManager &getStoreManager() const { return mgr; }
48221339Sdim};
49221339Sdim
50221339Sdim}}
51221339Sdim#endif
52