svf-lib 1.0.1375 → 1.0.1376
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.
- package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-osx/svf/include/include/AbstractExecution/AbstractValue.h +79 -0
- package/SVF-osx/svf/include/include/AbstractExecution/AddressValue.h +210 -0
- package/SVF-osx/svf/include/include/AbstractExecution/ExeState.h +223 -0
- package/SVF-osx/svf/include/include/AbstractExecution/IntervalExeState.h +425 -0
- package/SVF-osx/svf/include/include/AbstractExecution/IntervalValue.h +868 -0
- package/SVF-osx/svf/include/include/AbstractExecution/NumericLiteral.h +406 -0
- package/SVF-osx/svf/include/include/AbstractExecution/RelExeState.h +225 -0
- package/SVF-osx/svf/include/include/AbstractExecution/RelationSolver.h +68 -0
- package/SVF-osx/svf/include/include/AbstractExecution/SVFIR2ItvExeState.h +186 -0
- package/SVF-osx/svf/include/include/AbstractExecution/WTO.h +845 -0
- package/SVF-osx/svf/include/include/CFL/CFGNormalizer.h +84 -0
- package/SVF-osx/svf/include/include/CFL/CFLAlias.h +176 -0
- package/SVF-osx/svf/include/include/CFL/CFLBase.h +115 -0
- package/SVF-osx/svf/include/include/CFL/CFLData.h +316 -0
- package/SVF-osx/svf/include/include/CFL/CFLDataBuilder.h +91 -0
- package/SVF-osx/svf/include/include/CFL/CFLGramGraphChecker.h +74 -0
- package/SVF-osx/svf/include/include/CFL/CFLGrammar.h +468 -0
- package/SVF-osx/svf/include/include/CFL/CFLGrammar.txt +15 -0
- package/SVF-osx/svf/include/include/CFL/CFLGraphBuilder.h +193 -0
- package/SVF-osx/svf/include/include/CFL/CFLSolver.h +136 -0
- package/SVF-osx/svf/include/include/CFL/CFLStat.h +67 -0
- package/SVF-osx/svf/include/include/CFL/CFLVF.h +65 -0
- package/SVF-osx/svf/include/include/CFL/GrammarBuilder.h +100 -0
- package/SVF-osx/svf/include/include/CFL/PEGGrammar.txt +11 -0
- package/SVF-osx/svf/include/include/CFL/VFG.txt +7 -0
- package/SVF-osx/svf/include/include/DDA/ContextDDA.h +230 -0
- package/SVF-osx/svf/include/include/DDA/DDAClient.h +168 -0
- package/SVF-osx/svf/include/include/DDA/DDAPass.h +99 -0
- package/SVF-osx/svf/include/include/DDA/DDAStat.h +138 -0
- package/SVF-osx/svf/include/include/DDA/DDAVFSolver.h +789 -0
- package/SVF-osx/svf/include/include/DDA/FlowDDA.h +178 -0
- package/SVF-osx/svf/include/include/FastCluster/LICENSE.TXT +13 -0
- package/SVF-osx/svf/include/include/FastCluster/fastcluster.h +80 -0
- package/SVF-osx/svf/include/include/Graphs/CFLGraph.h +215 -0
- package/SVF-osx/svf/include/include/Graphs/CHG.h +351 -0
- package/SVF-osx/svf/include/include/Graphs/ConsG.h +408 -0
- package/SVF-osx/svf/include/include/Graphs/ConsGEdge.h +353 -0
- package/SVF-osx/svf/include/include/Graphs/ConsGNode.h +391 -0
- package/SVF-osx/svf/include/include/Graphs/DOTGraphTraits.h +188 -0
- package/SVF-osx/svf/include/include/Graphs/GenericGraph.h +620 -0
- package/SVF-osx/svf/include/include/Graphs/GraphPrinter.h +111 -0
- package/SVF-osx/svf/include/include/Graphs/GraphTraits.h +150 -0
- package/SVF-osx/svf/include/include/Graphs/GraphWriter.h +380 -0
- package/SVF-osx/svf/include/include/Graphs/ICFG.h +331 -0
- package/SVF-osx/svf/include/include/Graphs/ICFGEdge.h +264 -0
- package/SVF-osx/svf/include/include/Graphs/ICFGNode.h +523 -0
- package/SVF-osx/svf/include/include/Graphs/ICFGStat.h +164 -0
- package/SVF-osx/svf/include/include/Graphs/IRGraph.h +243 -0
- package/SVF-osx/svf/include/include/Graphs/PTACallGraph.h +471 -0
- package/SVF-osx/svf/include/include/Graphs/SVFG.h +490 -0
- package/SVF-osx/svf/include/include/Graphs/SVFGEdge.h +237 -0
- package/SVF-osx/svf/include/include/Graphs/SVFGNode.h +513 -0
- package/SVF-osx/svf/include/include/Graphs/SVFGOPT.h +362 -0
- package/SVF-osx/svf/include/include/Graphs/SVFGStat.h +273 -0
- package/SVF-osx/svf/include/include/Graphs/ThreadCallGraph.h +422 -0
- package/SVF-osx/svf/include/include/Graphs/VFG.h +664 -0
- package/SVF-osx/svf/include/include/Graphs/VFGEdge.h +295 -0
- package/SVF-osx/svf/include/include/Graphs/VFGNode.h +1197 -0
- package/SVF-osx/svf/include/include/MSSA/MSSAMuChi.h +722 -0
- package/SVF-osx/svf/include/include/MSSA/MemPartition.h +169 -0
- package/SVF-osx/svf/include/include/MSSA/MemRegion.h +491 -0
- package/SVF-osx/svf/include/include/MSSA/MemSSA.h +452 -0
- package/SVF-osx/svf/include/include/MSSA/SVFGBuilder.h +98 -0
- package/SVF-osx/svf/include/include/MTA/FSMPTA.h +270 -0
- package/SVF-osx/svf/include/include/MTA/LockAnalysis.h +517 -0
- package/SVF-osx/svf/include/include/MTA/MHP.h +565 -0
- package/SVF-osx/svf/include/include/MTA/MTA.h +101 -0
- package/SVF-osx/svf/include/include/MTA/MTAResultValidator.h +448 -0
- package/SVF-osx/svf/include/include/MTA/MTAStat.h +74 -0
- package/SVF-osx/svf/include/include/MTA/PCG.h +229 -0
- package/SVF-osx/svf/include/include/MTA/TCT.h +599 -0
- package/SVF-osx/svf/include/include/MemoryModel/AbstractPointsToDS.h +316 -0
- package/SVF-osx/svf/include/include/MemoryModel/ConditionalPT.h +878 -0
- package/SVF-osx/svf/include/include/MemoryModel/LocationSet.h +148 -0
- package/SVF-osx/svf/include/include/MemoryModel/MutablePointsToDS.h +1025 -0
- package/SVF-osx/svf/include/include/MemoryModel/PersistentPointsToCache.h +463 -0
- package/SVF-osx/svf/include/include/MemoryModel/PersistentPointsToDS.h +955 -0
- package/SVF-osx/svf/include/include/MemoryModel/PointerAnalysis.h +452 -0
- package/SVF-osx/svf/include/include/MemoryModel/PointerAnalysisImpl.h +590 -0
- package/SVF-osx/svf/include/include/MemoryModel/PointsTo.h +255 -0
- package/SVF-osx/svf/include/include/MemoryModel/SVFLoop.h +164 -0
- package/SVF-osx/svf/include/include/SABER/DoubleFreeChecker.h +76 -0
- package/SVF-osx/svf/include/include/SABER/FileChecker.h +82 -0
- package/SVF-osx/svf/include/include/SABER/LeakChecker.h +124 -0
- package/SVF-osx/svf/include/include/SABER/ProgSlice.h +313 -0
- package/SVF-osx/svf/include/include/SABER/SaberCheckerAPI.h +166 -0
- package/SVF-osx/svf/include/include/SABER/SaberCondAllocator.h +310 -0
- package/SVF-osx/svf/include/include/SABER/SaberSVFGBuilder.h +104 -0
- package/SVF-osx/svf/include/include/SABER/SrcSnkDDA.h +321 -0
- package/SVF-osx/svf/include/include/SABER/SrcSnkSolver.h +186 -0
- package/SVF-osx/svf/include/include/SVFIR/PAGBuilderFromFile.h +80 -0
- package/SVF-osx/svf/include/include/SVFIR/SVFIR.h +659 -0
- package/SVF-osx/svf/include/include/SVFIR/SVFModule.h +233 -0
- package/SVF-osx/svf/include/include/SVFIR/SVFStatements.h +1136 -0
- package/SVF-osx/svf/include/include/SVFIR/SVFType.h +527 -0
- package/SVF-osx/svf/include/include/SVFIR/SVFValue.h +1120 -0
- package/SVF-osx/svf/include/include/SVFIR/SVFVariables.h +721 -0
- package/SVF-osx/svf/include/include/SVFIR/SymbolTableInfo.h +597 -0
- package/SVF-osx/svf/include/include/Util/Annotator.h +180 -0
- package/SVF-osx/svf/include/include/Util/BitVector.h +55 -0
- package/SVF-osx/svf/include/include/Util/CallGraphBuilder.h +74 -0
- package/SVF-osx/svf/include/include/Util/Casting.h +426 -0
- package/SVF-osx/svf/include/include/Util/CommandLine.h +530 -0
- package/SVF-osx/svf/include/include/Util/CoreBitVector.h +214 -0
- package/SVF-osx/svf/include/include/Util/CppUtil.h +81 -0
- package/SVF-osx/svf/include/include/Util/CxtStmt.h +501 -0
- package/SVF-osx/svf/include/include/Util/DPItem.h +618 -0
- package/SVF-osx/svf/include/include/Util/ExtAPI.h +339 -0
- package/SVF-osx/svf/include/include/Util/ExtAPI.json +5707 -0
- package/SVF-osx/svf/include/include/Util/GraphReachSolver.h +186 -0
- package/SVF-osx/svf/include/include/Util/NodeIDAllocator.h +194 -0
- package/SVF-osx/svf/include/include/Util/Options.h +266 -0
- package/SVF-osx/svf/include/include/Util/PTAStat.h +65 -0
- package/SVF-osx/svf/include/include/Util/SCC.h +354 -0
- package/SVF-osx/svf/include/include/Util/SVFStat.h +100 -0
- package/SVF-osx/svf/include/include/Util/SVFUtil.h +660 -0
- package/SVF-osx/svf/include/include/Util/SparseBitVector.h +1202 -0
- package/SVF-osx/svf/include/include/Util/ThreadAPI.h +330 -0
- package/SVF-osx/svf/include/include/Util/WorkList.h +317 -0
- package/SVF-osx/svf/include/include/Util/Z3Expr.h +318 -0
- package/SVF-osx/svf/include/include/Util/cJSON.h +300 -0
- package/SVF-osx/svf/include/include/Util/iterator.h +407 -0
- package/SVF-osx/svf/include/include/Util/iterator_range.h +76 -0
- package/SVF-osx/svf/include/include/WPA/Andersen.h +416 -0
- package/SVF-osx/svf/include/include/WPA/AndersenPWC.h +160 -0
- package/SVF-osx/svf/include/include/WPA/CSC.h +95 -0
- package/SVF-osx/svf/include/include/WPA/FlowSensitive.h +317 -0
- package/SVF-osx/svf/include/include/WPA/Steensgaard.h +126 -0
- package/SVF-osx/svf/include/include/WPA/TypeAnalysis.h +83 -0
- package/SVF-osx/svf/include/include/WPA/VersionedFlowSensitive.h +287 -0
- package/SVF-osx/svf/include/include/WPA/WPAFSSolver.h +254 -0
- package/SVF-osx/svf/include/include/WPA/WPAPass.h +119 -0
- package/SVF-osx/svf/include/include/WPA/WPASolver.h +205 -0
- package/SVF-osx/svf/include/include/WPA/WPAStat.h +222 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/BasicTypes.h +250 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/BreakConstantExpr.h +94 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/CHGBuilder.h +73 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/DCHG.h +484 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/GEPTypeBridgeIterator.h +183 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/ICFGBuilder.h +106 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMLoopAnalysis.h +61 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMModule.h +360 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMUtil.h +466 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/SVFIRBuilder.h +417 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/SymbolTableBuilder.h +110 -0
- package/package.json +1 -1
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
//===- CxtStmt.h -- Context- and Thread-Sensitive Statement-------------------//
|
|
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
|
+
* CxtStmt.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: Jan 21, 2014
|
|
27
|
+
* Author: Yulei Sui
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef INCLUDE_UTIL_CXTSTMT_H_
|
|
31
|
+
#define INCLUDE_UTIL_CXTSTMT_H_
|
|
32
|
+
|
|
33
|
+
#include "SVFIR/SVFValue.h"
|
|
34
|
+
|
|
35
|
+
namespace SVF
|
|
36
|
+
{
|
|
37
|
+
|
|
38
|
+
/*!
|
|
39
|
+
* Context-sensitive thread statement <c,s>
|
|
40
|
+
*/
|
|
41
|
+
class CxtStmt
|
|
42
|
+
{
|
|
43
|
+
public:
|
|
44
|
+
/// Constructor
|
|
45
|
+
CxtStmt(const CallStrCxt& c, const SVFInstruction* f) :cxt(c), inst(f)
|
|
46
|
+
{
|
|
47
|
+
}
|
|
48
|
+
/// Copy constructor
|
|
49
|
+
CxtStmt(const CxtStmt& ctm) : cxt(ctm.getContext()),inst(ctm.getStmt())
|
|
50
|
+
{
|
|
51
|
+
}
|
|
52
|
+
/// Destructor
|
|
53
|
+
virtual ~CxtStmt()
|
|
54
|
+
{
|
|
55
|
+
}
|
|
56
|
+
/// Return current context
|
|
57
|
+
inline const CallStrCxt& getContext() const
|
|
58
|
+
{
|
|
59
|
+
return cxt;
|
|
60
|
+
}
|
|
61
|
+
/// Return current statement
|
|
62
|
+
inline const SVFInstruction* getStmt() const
|
|
63
|
+
{
|
|
64
|
+
return inst;
|
|
65
|
+
}
|
|
66
|
+
/// Enable compare operator to avoid duplicated item insertion in map or set
|
|
67
|
+
/// to be noted that two vectors can also overload operator()
|
|
68
|
+
inline bool operator< (const CxtStmt& rhs) const
|
|
69
|
+
{
|
|
70
|
+
if(inst!=rhs.getStmt())
|
|
71
|
+
return inst < rhs.getStmt();
|
|
72
|
+
else
|
|
73
|
+
return cxt < rhs.getContext();
|
|
74
|
+
}
|
|
75
|
+
/// Overloading operator=
|
|
76
|
+
inline CxtStmt& operator= (const CxtStmt& rhs)
|
|
77
|
+
{
|
|
78
|
+
if(*this!=rhs)
|
|
79
|
+
{
|
|
80
|
+
inst = rhs.getStmt();
|
|
81
|
+
cxt = rhs.getContext();
|
|
82
|
+
}
|
|
83
|
+
return *this;
|
|
84
|
+
}
|
|
85
|
+
/// Overloading operator==
|
|
86
|
+
inline bool operator== (const CxtStmt& rhs) const
|
|
87
|
+
{
|
|
88
|
+
return (inst == rhs.getStmt() && cxt == rhs.getContext());
|
|
89
|
+
}
|
|
90
|
+
/// Overloading operator==
|
|
91
|
+
inline bool operator!= (const CxtStmt& rhs) const
|
|
92
|
+
{
|
|
93
|
+
return !(*this==rhs);
|
|
94
|
+
}
|
|
95
|
+
/// Return context in string format
|
|
96
|
+
inline std::string cxtToStr() const
|
|
97
|
+
{
|
|
98
|
+
std::string str;
|
|
99
|
+
std::stringstream rawstr(str);
|
|
100
|
+
rawstr << "[:";
|
|
101
|
+
for(CallStrCxt::const_iterator it = cxt.begin(), eit = cxt.end(); it!=eit; ++it)
|
|
102
|
+
{
|
|
103
|
+
rawstr << *it << " ";
|
|
104
|
+
}
|
|
105
|
+
rawstr << " ]";
|
|
106
|
+
return rawstr.str();
|
|
107
|
+
}
|
|
108
|
+
/// Dump CxtStmt
|
|
109
|
+
inline void dump() const
|
|
110
|
+
{
|
|
111
|
+
SVFUtil::outs() << "[ Current Stmt: " << inst->getSourceLoc() << " " << inst->toString() << "\t Contexts: " << cxtToStr() << " ]\n";
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
protected:
|
|
115
|
+
CallStrCxt cxt;
|
|
116
|
+
const SVFInstruction* inst;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
/*!
|
|
121
|
+
* Context-sensitive thread statement <t,c,s>
|
|
122
|
+
*/
|
|
123
|
+
class CxtThreadStmt : public CxtStmt
|
|
124
|
+
{
|
|
125
|
+
public:
|
|
126
|
+
/// Constructor
|
|
127
|
+
CxtThreadStmt(NodeID t, const CallStrCxt& c, const SVFInstruction* f) :CxtStmt(c,f), tid(t)
|
|
128
|
+
{
|
|
129
|
+
}
|
|
130
|
+
/// Copy constructor
|
|
131
|
+
CxtThreadStmt(const CxtThreadStmt& ctm) :CxtStmt(ctm), tid(ctm.getTid())
|
|
132
|
+
{
|
|
133
|
+
}
|
|
134
|
+
/// Destructor
|
|
135
|
+
virtual ~CxtThreadStmt()
|
|
136
|
+
{
|
|
137
|
+
}
|
|
138
|
+
/// Return current context
|
|
139
|
+
inline NodeID getTid() const
|
|
140
|
+
{
|
|
141
|
+
return tid;
|
|
142
|
+
}
|
|
143
|
+
/// Enable compare operator to avoid duplicated item insertion in map or set
|
|
144
|
+
/// to be noted that two vectors can also overload operator()
|
|
145
|
+
inline bool operator< (const CxtThreadStmt& rhs) const
|
|
146
|
+
{
|
|
147
|
+
if (tid != rhs.getTid())
|
|
148
|
+
return tid < rhs.getTid();
|
|
149
|
+
else if(inst!=rhs.getStmt())
|
|
150
|
+
return inst < rhs.getStmt();
|
|
151
|
+
else
|
|
152
|
+
return cxt < rhs.getContext();
|
|
153
|
+
}
|
|
154
|
+
/// Overloading operator=
|
|
155
|
+
inline CxtThreadStmt& operator= (const CxtThreadStmt& rhs)
|
|
156
|
+
{
|
|
157
|
+
if(*this!=rhs)
|
|
158
|
+
{
|
|
159
|
+
CxtStmt::operator=(rhs);
|
|
160
|
+
tid = rhs.getTid();
|
|
161
|
+
}
|
|
162
|
+
return *this;
|
|
163
|
+
}
|
|
164
|
+
/// Overloading operator==
|
|
165
|
+
inline bool operator== (const CxtThreadStmt& rhs) const
|
|
166
|
+
{
|
|
167
|
+
return (tid == rhs.getTid() && inst == rhs.getStmt() && cxt == rhs.getContext());
|
|
168
|
+
}
|
|
169
|
+
/// Overloading operator==
|
|
170
|
+
inline bool operator!= (const CxtThreadStmt& rhs) const
|
|
171
|
+
{
|
|
172
|
+
return !(*this==rhs);
|
|
173
|
+
}
|
|
174
|
+
/// Dump CxtThreadStmt
|
|
175
|
+
inline void dump() const
|
|
176
|
+
{
|
|
177
|
+
SVFUtil::outs() << "[ Current Thread id: " << tid << " Stmt: " << inst->getSourceLoc() << " " << inst->toString() << "\t Contexts: " << cxtToStr() << " ]\n";
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private:
|
|
181
|
+
NodeID tid;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
/*!
|
|
186
|
+
* Context-sensitive thread <c,t>
|
|
187
|
+
*/
|
|
188
|
+
class CxtThread
|
|
189
|
+
{
|
|
190
|
+
public:
|
|
191
|
+
/// Constructor
|
|
192
|
+
CxtThread(const CallStrCxt& c, const SVFInstruction* fork) : cxt(c), forksite(fork), inloop(false), incycle(false)
|
|
193
|
+
{
|
|
194
|
+
}
|
|
195
|
+
/// Copy constructor
|
|
196
|
+
CxtThread(const CxtThread& ct) :
|
|
197
|
+
cxt(ct.getContext()), forksite(ct.getThread()), inloop(ct.isInloop()), incycle(ct.isIncycle())
|
|
198
|
+
{
|
|
199
|
+
}
|
|
200
|
+
/// Destructor
|
|
201
|
+
virtual ~CxtThread()
|
|
202
|
+
{
|
|
203
|
+
}
|
|
204
|
+
/// Return context of the thread
|
|
205
|
+
inline const CallStrCxt& getContext() const
|
|
206
|
+
{
|
|
207
|
+
return cxt;
|
|
208
|
+
}
|
|
209
|
+
/// Return forksite
|
|
210
|
+
inline const SVFInstruction* getThread() const
|
|
211
|
+
{
|
|
212
|
+
return forksite;
|
|
213
|
+
}
|
|
214
|
+
/// Enable compare operator to avoid duplicated item insertion in map or set
|
|
215
|
+
/// to be noted that two vectors can also overload operator()
|
|
216
|
+
inline bool operator< (const CxtThread& rhs) const
|
|
217
|
+
{
|
|
218
|
+
if (forksite != rhs.getThread())
|
|
219
|
+
return forksite < rhs.getThread();
|
|
220
|
+
else
|
|
221
|
+
return cxt < rhs.getContext();
|
|
222
|
+
}
|
|
223
|
+
/// Overloading operator=
|
|
224
|
+
inline CxtThread& operator= (const CxtThread& rhs)
|
|
225
|
+
{
|
|
226
|
+
if(*this!=rhs)
|
|
227
|
+
{
|
|
228
|
+
forksite = rhs.getThread();
|
|
229
|
+
cxt = rhs.getContext();
|
|
230
|
+
}
|
|
231
|
+
return *this;
|
|
232
|
+
}
|
|
233
|
+
/// Overloading operator==
|
|
234
|
+
inline bool operator== (const CxtThread& rhs) const
|
|
235
|
+
{
|
|
236
|
+
return (forksite == rhs.getThread() && cxt == rhs.getContext());
|
|
237
|
+
}
|
|
238
|
+
/// Overloading operator==
|
|
239
|
+
inline bool operator!= (const CxtThread& rhs) const
|
|
240
|
+
{
|
|
241
|
+
return !(*this==rhs);
|
|
242
|
+
}
|
|
243
|
+
/// Return context in string format
|
|
244
|
+
inline std::string cxtToStr() const
|
|
245
|
+
{
|
|
246
|
+
std::string str;
|
|
247
|
+
std::stringstream rawstr(str);
|
|
248
|
+
rawstr << "[:";
|
|
249
|
+
for(CallStrCxt::const_iterator it = cxt.begin(), eit = cxt.end(); it!=eit; ++it)
|
|
250
|
+
{
|
|
251
|
+
rawstr << *it << " ";
|
|
252
|
+
}
|
|
253
|
+
rawstr << " ]";
|
|
254
|
+
return rawstr.str();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/// inloop, incycle attributes
|
|
258
|
+
//@{
|
|
259
|
+
inline void setInloop(bool in)
|
|
260
|
+
{
|
|
261
|
+
inloop = in;
|
|
262
|
+
}
|
|
263
|
+
inline bool isInloop() const
|
|
264
|
+
{
|
|
265
|
+
return inloop;
|
|
266
|
+
}
|
|
267
|
+
inline void setIncycle(bool in)
|
|
268
|
+
{
|
|
269
|
+
incycle = in;
|
|
270
|
+
}
|
|
271
|
+
inline bool isIncycle() const
|
|
272
|
+
{
|
|
273
|
+
return incycle;
|
|
274
|
+
}
|
|
275
|
+
//@}
|
|
276
|
+
|
|
277
|
+
/// Dump CxtThread
|
|
278
|
+
inline void dump() const
|
|
279
|
+
{
|
|
280
|
+
std::string loop = inloop?", inloop":"";
|
|
281
|
+
std::string cycle = incycle?", incycle":"";
|
|
282
|
+
|
|
283
|
+
if(forksite)
|
|
284
|
+
{
|
|
285
|
+
SVFUtil::outs() << "[ Thread: $" << forksite->getSourceLoc() << "$ "
|
|
286
|
+
<< forksite->toString() << "\t Contexts: " << cxtToStr()
|
|
287
|
+
<< loop << cycle <<" ]\n";
|
|
288
|
+
}
|
|
289
|
+
else
|
|
290
|
+
{
|
|
291
|
+
SVFUtil::outs() << "[ Thread: " << "main " << "\t Contexts: " << cxtToStr()
|
|
292
|
+
<< loop << cycle <<" ]\n";
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
protected:
|
|
296
|
+
CallStrCxt cxt;
|
|
297
|
+
const SVFInstruction* forksite;
|
|
298
|
+
bool inloop;
|
|
299
|
+
bool incycle;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
/*!
|
|
304
|
+
* Context-sensitive procedure <c,m>
|
|
305
|
+
* c represent current context
|
|
306
|
+
* m represent current procedure
|
|
307
|
+
*/
|
|
308
|
+
class CxtProc
|
|
309
|
+
{
|
|
310
|
+
public:
|
|
311
|
+
/// Constructor
|
|
312
|
+
CxtProc(const CallStrCxt& c, const SVFFunction* f) :
|
|
313
|
+
cxt(c), fun(f)
|
|
314
|
+
{
|
|
315
|
+
}
|
|
316
|
+
/// Copy constructor
|
|
317
|
+
CxtProc(const CxtProc& ctm) :
|
|
318
|
+
cxt(ctm.getContext()), fun(ctm.getProc())
|
|
319
|
+
{
|
|
320
|
+
}
|
|
321
|
+
/// Destructor
|
|
322
|
+
virtual ~CxtProc()
|
|
323
|
+
{
|
|
324
|
+
}
|
|
325
|
+
/// Return current procedure
|
|
326
|
+
inline const SVFFunction* getProc() const
|
|
327
|
+
{
|
|
328
|
+
return fun;
|
|
329
|
+
}
|
|
330
|
+
/// Return current context
|
|
331
|
+
inline const CallStrCxt& getContext() const
|
|
332
|
+
{
|
|
333
|
+
return cxt;
|
|
334
|
+
}
|
|
335
|
+
/// Enable compare operator to avoid duplicated item insertion in map or set
|
|
336
|
+
/// to be noted that two vectors can also overload operator()
|
|
337
|
+
inline bool operator<(const CxtProc& rhs) const
|
|
338
|
+
{
|
|
339
|
+
if (fun != rhs.getProc())
|
|
340
|
+
return fun < rhs.getProc();
|
|
341
|
+
else
|
|
342
|
+
return cxt < rhs.getContext();
|
|
343
|
+
}
|
|
344
|
+
/// Overloading operator=
|
|
345
|
+
inline CxtProc& operator=(const CxtProc& rhs)
|
|
346
|
+
{
|
|
347
|
+
if (*this != rhs)
|
|
348
|
+
{
|
|
349
|
+
fun = rhs.getProc();
|
|
350
|
+
cxt = rhs.getContext();
|
|
351
|
+
}
|
|
352
|
+
return *this;
|
|
353
|
+
}
|
|
354
|
+
/// Overloading operator==
|
|
355
|
+
inline bool operator==(const CxtProc& rhs) const
|
|
356
|
+
{
|
|
357
|
+
return (fun == rhs.getProc() && cxt == rhs.getContext());
|
|
358
|
+
}
|
|
359
|
+
/// Overloading operator==
|
|
360
|
+
inline bool operator!=(const CxtProc& rhs) const
|
|
361
|
+
{
|
|
362
|
+
return !(*this == rhs);
|
|
363
|
+
}
|
|
364
|
+
/// Return context in string format
|
|
365
|
+
inline std::string cxtToStr() const
|
|
366
|
+
{
|
|
367
|
+
std::string str;
|
|
368
|
+
std::stringstream rawstr(str);
|
|
369
|
+
rawstr << "[:";
|
|
370
|
+
for (CallStrCxt::const_iterator it = cxt.begin(), eit = cxt.end(); it != eit; ++it)
|
|
371
|
+
{
|
|
372
|
+
rawstr << *it << " ";
|
|
373
|
+
}
|
|
374
|
+
rawstr << " ]";
|
|
375
|
+
return rawstr.str();
|
|
376
|
+
}
|
|
377
|
+
/// Dump CxtProc
|
|
378
|
+
inline void dump() const
|
|
379
|
+
{
|
|
380
|
+
SVFUtil::outs() << "[ Proc: " << fun->getName() << "\t Contexts: " << cxtToStr() << " ]\n";
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
protected:
|
|
384
|
+
CallStrCxt cxt;
|
|
385
|
+
const SVFFunction* fun;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
/*!
|
|
390
|
+
* Context-sensitive procedure <t,c,m>
|
|
391
|
+
* t represent current thread during traversing
|
|
392
|
+
* c represent current context
|
|
393
|
+
* m represent current procedure
|
|
394
|
+
*/
|
|
395
|
+
class CxtThreadProc : public CxtProc
|
|
396
|
+
{
|
|
397
|
+
public:
|
|
398
|
+
/// Constructor
|
|
399
|
+
CxtThreadProc(NodeID t, const CallStrCxt& c, const SVFFunction* f) :CxtProc(c,f),tid(t)
|
|
400
|
+
{
|
|
401
|
+
}
|
|
402
|
+
/// Copy constructor
|
|
403
|
+
CxtThreadProc(const CxtThreadProc& ctm) : CxtProc(ctm.getContext(),ctm.getProc()), tid(ctm.getTid())
|
|
404
|
+
{
|
|
405
|
+
}
|
|
406
|
+
/// Destructor
|
|
407
|
+
virtual ~CxtThreadProc()
|
|
408
|
+
{
|
|
409
|
+
}
|
|
410
|
+
/// Return current thread id
|
|
411
|
+
inline NodeID getTid() const
|
|
412
|
+
{
|
|
413
|
+
return tid;
|
|
414
|
+
}
|
|
415
|
+
/// Enable compare operator to avoid duplicated item insertion in map or set
|
|
416
|
+
/// to be noted that two vectors can also overload operator()
|
|
417
|
+
inline bool operator< (const CxtThreadProc& rhs) const
|
|
418
|
+
{
|
|
419
|
+
if (tid != rhs.getTid())
|
|
420
|
+
return tid < rhs.getTid();
|
|
421
|
+
else if(fun!=rhs.getProc())
|
|
422
|
+
return fun < rhs.getProc();
|
|
423
|
+
else
|
|
424
|
+
return cxt < rhs.getContext();
|
|
425
|
+
}
|
|
426
|
+
/// Overloading operator=
|
|
427
|
+
inline CxtThreadProc& operator= (const CxtThreadProc& rhs)
|
|
428
|
+
{
|
|
429
|
+
if(*this!=rhs)
|
|
430
|
+
{
|
|
431
|
+
tid = rhs.getTid();
|
|
432
|
+
fun = rhs.getProc();
|
|
433
|
+
cxt = rhs.getContext();
|
|
434
|
+
}
|
|
435
|
+
return *this;
|
|
436
|
+
}
|
|
437
|
+
/// Overloading operator==
|
|
438
|
+
inline bool operator== (const CxtThreadProc& rhs) const
|
|
439
|
+
{
|
|
440
|
+
return (tid == rhs.getTid() && fun == rhs.getProc() && cxt == rhs.getContext());
|
|
441
|
+
}
|
|
442
|
+
/// Overloading operator==
|
|
443
|
+
inline bool operator!= (const CxtThreadProc& rhs) const
|
|
444
|
+
{
|
|
445
|
+
return !(*this==rhs);
|
|
446
|
+
}
|
|
447
|
+
/// Dump CxtThreadProc
|
|
448
|
+
inline void dump() const
|
|
449
|
+
{
|
|
450
|
+
SVFUtil::outs() << "[ Current Thread id: " << tid << " Proc: " << fun->getName() << "\t Contexts: " << cxtToStr() << " ]\n";
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
private:
|
|
454
|
+
NodeID tid;
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
} // End namespace SVF
|
|
458
|
+
// Specialise has for class defined in this header file
|
|
459
|
+
template <> struct std::hash<SVF::CxtThread>
|
|
460
|
+
{
|
|
461
|
+
size_t operator()(const SVF::CxtThread& cs) const
|
|
462
|
+
{
|
|
463
|
+
std::hash<SVF::CallStrCxt> h;
|
|
464
|
+
return h(cs.getContext());
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
template <> struct std::hash<SVF::CxtThreadProc>
|
|
468
|
+
{
|
|
469
|
+
size_t operator()(const SVF::CxtThreadProc& ctp) const
|
|
470
|
+
{
|
|
471
|
+
std::hash<SVF::NodeID> h;
|
|
472
|
+
return h(ctp.getTid());
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
template <> struct std::hash<SVF::CxtThreadStmt>
|
|
476
|
+
{
|
|
477
|
+
size_t operator()(const SVF::CxtThreadStmt& cts) const
|
|
478
|
+
{
|
|
479
|
+
std::hash<SVF::NodeID> h;
|
|
480
|
+
return h(cts.getTid());
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
template <> struct std::hash<SVF::CxtStmt>
|
|
484
|
+
{
|
|
485
|
+
size_t operator()(const SVF::CxtStmt& cs) const
|
|
486
|
+
{
|
|
487
|
+
std::hash<SVF::SVFInstruction*> h;
|
|
488
|
+
SVF::SVFInstruction* inst = const_cast<SVF::SVFInstruction*> (cs.getStmt());
|
|
489
|
+
return h(inst);
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
template <> struct std::hash<SVF::CxtProc>
|
|
493
|
+
{
|
|
494
|
+
size_t operator()(const SVF::CxtProc& cs) const
|
|
495
|
+
{
|
|
496
|
+
std::hash<SVF::SVFFunction*> h;
|
|
497
|
+
SVF::SVFFunction* fun = const_cast<SVF::SVFFunction*> (cs.getProc());
|
|
498
|
+
return h(fun);
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
#endif /* INCLUDE_UTIL_CXTSTMT_H_ */
|