clang
20.0.0git
include
clang
StaticAnalyzer
Core
PathSensitive
StoreRef.h
Go to the documentation of this file.
1
//===- StoreRef.h - Smart pointer for store objects -------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file defined the type StoreRef.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
14
#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
15
16
#include <cassert>
17
18
namespace
clang
{
19
namespace
ento {
20
21
class
StoreManager;
22
23
/// Store - This opaque type encapsulates an immutable mapping from
24
/// locations to values. At a high-level, it represents the symbolic
25
/// memory model. Different subclasses of StoreManager may choose
26
/// different types to represent the locations and values.
27
using
Store
=
const
void
*;
28
29
class
StoreRef
{
30
Store
store;
31
StoreManager
&mgr;
32
33
public
:
34
StoreRef
(
Store
store,
StoreManager
&smgr);
35
StoreRef
(
const
StoreRef
&sr);
36
StoreRef
&
operator=
(
StoreRef
const
&newStore);
37
~StoreRef
();
38
39
bool
operator==
(
const
StoreRef
&x)
const
{
40
assert(&mgr == &x.mgr);
41
return
x.store == store;
42
}
43
44
bool
operator!=
(
const
StoreRef
&x)
const
{
return
!
operator==
(x); }
45
46
Store
getStore
()
const
{
return
store; }
47
const
StoreManager
&
getStoreManager
()
const
{
return
mgr; }
48
};
49