StoreRef.h revision 353358
1235537Sgber//===- StoreRef.h - Smart pointer for store objects -------------*- C++ -*-===// 2235537Sgber// 3235537Sgber// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4235537Sgber// See https://llvm.org/LICENSE.txt for license information. 5235537Sgber// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6235537Sgber// 7235537Sgber//===----------------------------------------------------------------------===// 8235537Sgber// 9235537Sgber// This file defined the type StoreRef. 10235537Sgber// 11235537Sgber//===----------------------------------------------------------------------===// 12235537Sgber 13235537Sgber#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H 14235537Sgber#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H 15235537Sgber 16235537Sgber#include <cassert> 17235537Sgber 18235537Sgbernamespace clang { 19235537Sgbernamespace ento { 20235537Sgber 21235537Sgberclass StoreManager; 22235537Sgber 23235537Sgber/// Store - This opaque type encapsulates an immutable mapping from 24235537Sgber/// locations to values. At a high-level, it represents the symbolic 25235537Sgber/// memory model. Different subclasses of StoreManager may choose 26235537Sgber/// different types to represent the locations and values. 27235537Sgberusing Store = const void *; 28235537Sgber 29235537Sgberclass StoreRef { 30235537Sgber Store store; 31235537Sgber StoreManager &mgr; 32235537Sgber 33235537Sgberpublic: 34235537Sgber StoreRef(Store store, StoreManager &smgr); 35235537Sgber StoreRef(const StoreRef &sr); 36235537Sgber StoreRef &operator=(StoreRef const &newStore); 37235537Sgber ~StoreRef(); 38235537Sgber 39235537Sgber bool operator==(const StoreRef &x) const { 40235537Sgber assert(&mgr == &x.mgr); 41235537Sgber return x.store == store; 42235537Sgber } 43235537Sgber 44235537Sgber bool operator!=(const StoreRef &x) const { return !operator==(x); } 45235537Sgber 46235537Sgber Store getStore() const { return store; } 47235537Sgber const StoreManager &getStoreManager() const { return mgr; } 48235537Sgber}; 49235537Sgber 50235537Sgber} // namespace ento 51235537Sgber} // namespace clang 52235537Sgber 53235537Sgber#endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H 54235537Sgber