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_GR_STOREREF_H 15#define LLVM_CLANG_GR_STOREREF_H 16 17#include <cassert> 18 19namespace clang { 20namespace 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. 26typedef const void *Store; 27 28class StoreManager; 29 30class StoreRef { 31 Store store; 32 StoreManager &mgr; 33public: 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 46 Store getStore() const { return store; } 47 const StoreManager &getStoreManager() const { return mgr; } 48}; 49 50}} 51#endif 52