1341825Sdim//===- StoreRef.h - Smart pointer for store objects -------------*- C++ -*-===//
2221339Sdim//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6221339Sdim//
7221339Sdim//===----------------------------------------------------------------------===//
8221339Sdim//
9221339Sdim//  This file defined the type StoreRef.
10221339Sdim//
11221339Sdim//===----------------------------------------------------------------------===//
12221339Sdim
13280031Sdim#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
14280031Sdim#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
15221339Sdim
16221339Sdim#include <cassert>
17221339Sdim
18221339Sdimnamespace clang {
19221339Sdimnamespace ento {
20341825Sdim
21341825Sdimclass StoreManager;
22341825Sdim
23221339Sdim/// Store - This opaque type encapsulates an immutable mapping from
24221339Sdim///  locations to values.  At a high-level, it represents the symbolic
25221339Sdim///  memory model.  Different subclasses of StoreManager may choose
26221339Sdim///  different types to represent the locations and values.
27341825Sdimusing Store = const void *;
28341825Sdim
29221339Sdimclass StoreRef {
30221339Sdim  Store store;
31221339Sdim  StoreManager &mgr;
32341825Sdim
33221339Sdimpublic:
34341825Sdim  StoreRef(Store store, StoreManager &smgr);
35341825Sdim  StoreRef(const StoreRef &sr);
36341825Sdim  StoreRef &operator=(StoreRef const &newStore);
37341825Sdim  ~StoreRef();
38341825Sdim
39221339Sdim  bool operator==(const StoreRef &x) const {
40221339Sdim    assert(&mgr == &x.mgr);
41221339Sdim    return x.store == store;
42221339Sdim  }
43341825Sdim
44221339Sdim  bool operator!=(const StoreRef &x) const { return !operator==(x); }
45341825Sdim
46221339Sdim  Store getStore() const { return store; }
47226633Sdim  const StoreManager &getStoreManager() const { return mgr; }
48221339Sdim};
49221339Sdim
50341825Sdim} // namespace ento
51341825Sdim} // namespace clang
52341825Sdim
53341825Sdim#endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
54