svf-lib 1.0.1048 → 1.0.1049
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
//===- SymState.h -- Symbolic State----------------------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-2017> <Yulei Sui>
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// This program is free software: you can redistribute it and/or modify
|
|
9
|
+
// it under the terms of the GNU General Public License as published by
|
|
10
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
// (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
// This program is distributed in the hope that it will be useful,
|
|
14
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
// GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* SymState.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: 2022/6/21
|
|
27
|
+
* Author: Xiao Cheng
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef SVF_SYMSTATE_H
|
|
31
|
+
#define SVF_SYMSTATE_H
|
|
32
|
+
|
|
33
|
+
#include "ExeState.h"
|
|
34
|
+
|
|
35
|
+
namespace SVF
|
|
36
|
+
{
|
|
37
|
+
class SymState
|
|
38
|
+
{
|
|
39
|
+
public:
|
|
40
|
+
typedef std::string AbstractState;
|
|
41
|
+
|
|
42
|
+
SymState(const ExeState &_es, const AbstractState &_as) : exeState(_es), absState(_as)
|
|
43
|
+
{
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
virtual ~SymState()
|
|
48
|
+
{
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
SymState(const SymState &symState) : absState(symState.getAbstractState()),
|
|
53
|
+
exeState(symState.getExecutionState())
|
|
54
|
+
{
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
const AbstractState& getAbstractState() const
|
|
59
|
+
{
|
|
60
|
+
return absState;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const ExeState& getExecutionState() const
|
|
64
|
+
{
|
|
65
|
+
return exeState;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
SymState &operator=(const SymState &rhs)
|
|
69
|
+
{
|
|
70
|
+
if (*this != rhs)
|
|
71
|
+
{
|
|
72
|
+
exeState = rhs.getExecutionState();
|
|
73
|
+
absState = rhs.getAbstractState();
|
|
74
|
+
}
|
|
75
|
+
return *this;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/// Overloading Operator==
|
|
79
|
+
inline bool operator==(const SymState &rhs) const
|
|
80
|
+
{
|
|
81
|
+
return absState == rhs.getAbstractState() && exeState = rhs.getExecutionState();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/// Overloading Operator!=
|
|
85
|
+
inline bool operator!=(const SymState &rhs) const
|
|
86
|
+
{
|
|
87
|
+
return !(*this == rhs);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/// Overloading Operator==
|
|
91
|
+
inline bool operator<(const SymState &rhs) const
|
|
92
|
+
{
|
|
93
|
+
if (absState != rhs.getAbstractState())
|
|
94
|
+
return absState < rhs.getAbstractState();
|
|
95
|
+
if (exeState != rhs.getExecutionState())
|
|
96
|
+
return exeState < rhs.getExecutionState();
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private:
|
|
101
|
+
ExeState exeState;
|
|
102
|
+
AbstractState absState;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
template<>
|
|
107
|
+
struct std::hash<SVF::SymState>
|
|
108
|
+
{
|
|
109
|
+
size_t operator()(const SVF::SymState &symState) const
|
|
110
|
+
{
|
|
111
|
+
|
|
112
|
+
SVF::Hash<std::pair<SVF::AbstractState, SVF::ExeState>> pairH;
|
|
113
|
+
|
|
114
|
+
return pairH(make_pair(symState.getAbstractState(), symState.getExecutionState()));
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
#endif //SVF_SYMSTATE_H
|