clang API Documentation
00001 //== StoreRef.h - Smart pointer for store objects ---------------*- C++ -*--==// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defined the type StoreRef. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H 00015 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H 00016 00017 #include <cassert> 00018 00019 namespace clang { 00020 namespace ento { 00021 00022 /// Store - This opaque type encapsulates an immutable mapping from 00023 /// locations to values. At a high-level, it represents the symbolic 00024 /// memory model. Different subclasses of StoreManager may choose 00025 /// different types to represent the locations and values. 00026 typedef const void *Store; 00027 00028 class StoreManager; 00029 00030 class StoreRef { 00031 Store store; 00032 StoreManager &mgr; 00033 public: 00034 StoreRef(Store, StoreManager &); 00035 StoreRef(const StoreRef &); 00036 StoreRef &operator=(StoreRef const &); 00037 00038 bool operator==(const StoreRef &x) const { 00039 assert(&mgr == &x.mgr); 00040 return x.store == store; 00041 } 00042 bool operator!=(const StoreRef &x) const { return !operator==(x); } 00043 00044 ~StoreRef(); 00045 00046 Store getStore() const { return store; } 00047 const StoreManager &getStoreManager() const { return mgr; } 00048 }; 00049 00050 }} 00051 #endif