svf-tools 1.0.577 → 1.0.578
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-doxygen/html/html/CFLAlias_8cpp.html +0 -1
- package/SVF-doxygen/html/html/CFLAlias_8cpp_source.html +18 -25
- package/SVF-doxygen/html/html/CFLAlias_8h.html +1 -8
- package/SVF-doxygen/html/html/CFLAlias_8h_source.html +23 -49
- package/SVF-doxygen/html/html/CFLBase_8h.html +103 -0
- package/SVF-doxygen/html/html/CFLBase_8h_source.html +124 -0
- package/SVF-doxygen/html/html/CFLGraph_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/CFLGraph_8h_source.html +5 -4
- package/SVF-doxygen/html/html/CFLStat_8cpp_source.html +24 -19
- package/SVF-doxygen/html/html/CFLStat_8h.html +1 -0
- package/SVF-doxygen/html/html/CFLStat_8h_source.html +22 -21
- package/SVF-doxygen/html/html/CFLVF_8cpp.html +0 -2
- package/SVF-doxygen/html/html/CFLVF_8cpp_source.html +5 -8
- package/SVF-doxygen/html/html/CFLVF_8h.html +3 -8
- package/SVF-doxygen/html/html/CFLVF_8h_source.html +12 -26
- package/SVF-doxygen/html/html/CHG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/CHG_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ConsGNode_8h_source.html +5 -5
- package/SVF-doxygen/html/html/ConsG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ConsG_8h_source.html +1 -1
- package/SVF-doxygen/html/html/DCHG_8h_source.html +1 -1
- package/SVF-doxygen/html/html/DataFlowUtil_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/GEPTypeBridgeIterator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/GenericGraph_8h_source.html +1 -1
- package/SVF-doxygen/html/html/GraphPrinter_8h_source.html +1 -1
- package/SVF-doxygen/html/html/ICFG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ICFG_8h_source.html +1 -1
- package/SVF-doxygen/html/html/IRGraph_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/IRGraph_8h_source.html +1 -1
- package/SVF-doxygen/html/html/PTACallGraph_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PTACallGraph_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFG_8h_source.html +1 -1
- package/SVF-doxygen/html/html/TCT_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/TCT_8h_source.html +1 -1
- package/SVF-doxygen/html/html/VFG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/VFG_8h_source.html +1 -1
- package/SVF-doxygen/html/html/annotated.html +271 -270
- package/SVF-doxygen/html/html/cfl_8cpp.html +6 -9
- package/SVF-doxygen/html/html/cfl_8cpp_source.html +6 -8
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +9 -8
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLAlias-members.html +75 -71
- package/SVF-doxygen/html/html/classSVF_1_1CFLAlias.html +239 -679
- package/SVF-doxygen/html/html/classSVF_1_1CFLAlias.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLBase-members.html +275 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLBase.html +1341 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLBase.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1CFLGraph-members.html +21 -20
- package/SVF-doxygen/html/html/classSVF_1_1CFLGraph.html +33 -3
- package/SVF-doxygen/html/html/classSVF_1_1CFLStat-members.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1CFLStat.html +58 -58
- package/SVF-doxygen/html/html/classSVF_1_1CFLVF-members.html +91 -72
- package/SVF-doxygen/html/html/classSVF_1_1CFLVF.html +243 -274
- package/SVF-doxygen/html/html/classSVF_1_1CFLVF.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode-members.html +26 -26
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode.html +43 -43
- package/SVF-doxygen/html/html/classSVF_1_1GenericNode.html +21 -20
- package/SVF-doxygen/html/html/classSVF_1_1GenericNode.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +12 -11
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.png +0 -0
- package/SVF-doxygen/html/html/classes.html +96 -95
- package/SVF-doxygen/html/html/dda_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/dir_ae8aa099e368efaa962140c6624142bc.html +2 -0
- package/SVF-doxygen/html/html/files.html +8 -7
- package/SVF-doxygen/html/html/functions_0x7e.html +2 -5
- package/SVF-doxygen/html/html/functions_a.html +10 -9
- package/SVF-doxygen/html/html/functions_c.html +28 -28
- package/SVF-doxygen/html/html/functions_f.html +17 -16
- package/SVF-doxygen/html/html/functions_func.html +6 -5
- package/SVF-doxygen/html/html/functions_func_0x7e.html +2 -5
- package/SVF-doxygen/html/html/functions_func_c.html +29 -21
- package/SVF-doxygen/html/html/functions_func_f.html +4 -1
- package/SVF-doxygen/html/html/functions_func_g.html +14 -11
- package/SVF-doxygen/html/html/functions_func_i.html +10 -7
- package/SVF-doxygen/html/html/functions_func_p.html +1 -1
- package/SVF-doxygen/html/html/functions_func_s.html +2 -2
- package/SVF-doxygen/html/html/functions_g.html +18 -17
- package/SVF-doxygen/html/html/functions_i.html +10 -7
- package/SVF-doxygen/html/html/functions_l.html +6 -6
- package/SVF-doxygen/html/html/functions_m.html +2 -2
- package/SVF-doxygen/html/html/functions_n.html +14 -11
- package/SVF-doxygen/html/html/functions_o.html +15 -15
- package/SVF-doxygen/html/html/functions_p.html +19 -15
- package/SVF-doxygen/html/html/functions_r.html +3 -7
- package/SVF-doxygen/html/html/functions_s.html +16 -16
- package/SVF-doxygen/html/html/functions_t.html +9 -6
- package/SVF-doxygen/html/html/functions_type_c.html +0 -1
- package/SVF-doxygen/html/html/functions_v.html +6 -6
- package/SVF-doxygen/html/html/functions_vars_a.html +1 -1
- package/SVF-doxygen/html/html/functions_vars_c.html +0 -1
- package/SVF-doxygen/html/html/functions_vars_g.html +2 -4
- package/SVF-doxygen/html/html/functions_vars_m.html +1 -1
- package/SVF-doxygen/html/html/functions_vars_n.html +11 -8
- package/SVF-doxygen/html/html/functions_vars_p.html +1 -1
- package/SVF-doxygen/html/html/functions_vars_s.html +2 -4
- package/SVF-doxygen/html/html/functions_vars_t.html +9 -6
- package/SVF-doxygen/html/html/hierarchy.html +58 -57
- package/SVF-doxygen/html/html/mta_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/namespaceSVF.html +2 -0
- package/SVF-doxygen/html/html/saber_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/search/all_1.js +2 -2
- package/SVF-doxygen/html/html/search/all_10.js +11 -11
- package/SVF-doxygen/html/html/search/all_11.js +2 -2
- package/SVF-doxygen/html/html/search/all_12.js +11 -11
- package/SVF-doxygen/html/html/search/all_13.js +9 -8
- package/SVF-doxygen/html/html/search/all_15.js +4 -4
- package/SVF-doxygen/html/html/search/all_16.js +1 -1
- package/SVF-doxygen/html/html/search/all_19.js +1 -2
- package/SVF-doxygen/html/html/search/all_3.js +5 -2
- package/SVF-doxygen/html/html/search/all_6.js +2 -2
- package/SVF-doxygen/html/html/search/all_7.js +4 -3
- package/SVF-doxygen/html/html/search/all_9.js +2 -2
- package/SVF-doxygen/html/html/search/all_c.js +4 -4
- package/SVF-doxygen/html/html/search/all_d.js +3 -3
- package/SVF-doxygen/html/html/search/all_e.js +11 -10
- package/SVF-doxygen/html/html/search/all_f.js +2 -2
- package/SVF-doxygen/html/html/search/classes_2.js +1 -0
- package/SVF-doxygen/html/html/search/files_2.js +1 -0
- package/SVF-doxygen/html/html/search/functions_0.js +1 -1
- package/SVF-doxygen/html/html/search/functions_11.js +1 -1
- package/SVF-doxygen/html/html/search/functions_17.js +1 -2
- package/SVF-doxygen/html/html/search/functions_2.js +3 -1
- package/SVF-doxygen/html/html/search/functions_5.js +1 -1
- package/SVF-doxygen/html/html/search/functions_6.js +2 -1
- package/SVF-doxygen/html/html/search/functions_8.js +1 -1
- package/SVF-doxygen/html/html/search/functions_f.js +1 -1
- package/SVF-doxygen/html/html/search/typedefs_2.js +1 -1
- package/SVF-doxygen/html/html/search/variables_1.js +1 -1
- package/SVF-doxygen/html/html/search/variables_10.js +1 -1
- package/SVF-doxygen/html/html/search/variables_12.js +2 -2
- package/SVF-doxygen/html/html/search/variables_13.js +9 -8
- package/SVF-doxygen/html/html/search/variables_3.js +1 -1
- package/SVF-doxygen/html/html/search/variables_7.js +2 -2
- package/SVF-doxygen/html/html/search/variables_9.js +1 -1
- package/SVF-doxygen/html/html/search/variables_c.js +1 -1
- package/SVF-doxygen/html/html/search/variables_d.js +1 -1
- package/SVF-doxygen/html/html/search/variables_e.js +9 -8
- package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01Inverse_3_01SVF_1_1CFLNode_01_5_01_4_01_4.html +1 -1
- package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01SVF_1_1CFLGraph_01_5_01_4.html +2 -2
- package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01SVF_1_1CFLNode_01_5_01_4.html +1 -1
- package/SVF-doxygen/html/html/svf-ex_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/wpa_8cpp_source.html +1 -1
- package/include/CFL/CFLAlias.h +10 -47
- package/include/CFL/CFLBase.h +111 -0
- package/include/CFL/CFLStat.h +4 -2
- package/include/CFL/CFLVF.h +13 -23
- package/include/Graphs/CFLGraph.h +5 -0
- package/lib/CFL/CFLAlias.cpp +60 -52
- package/lib/CFL/CFLStat.cpp +11 -19
- package/lib/CFL/CFLVF.cpp +40 -35
- package/package.json +1 -1
- package/tools/CFL/cfl.cpp +12 -25
package/lib/CFL/CFLAlias.cpp
CHANGED
|
@@ -28,30 +28,18 @@
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
#include "CFL/CFLAlias.h"
|
|
31
|
-
#include "Util/SVFBasicTypes.h"
|
|
32
31
|
|
|
33
32
|
using namespace SVF;
|
|
34
33
|
using namespace cppUtil;
|
|
35
34
|
using namespace SVFUtil;
|
|
36
35
|
|
|
37
|
-
u32_t
|
|
38
|
-
u32_t
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
u32_t CFLAlias::numOfSCCDetection = 0;
|
|
46
|
-
double CFLAlias::timeOfSCCDetection = 0;
|
|
47
|
-
double CFLAlias::timeOfSCCMerges = 0;
|
|
48
|
-
double CFLAlias::timeOfCollapse = 0;
|
|
49
|
-
|
|
50
|
-
u32_t CFLAlias::AveragePointsToSetSize = 0;
|
|
51
|
-
u32_t CFLAlias::MaxPointsToSetSize = 0;
|
|
52
|
-
double CFLAlias::timeOfProcessCopyGep = 0;
|
|
53
|
-
double CFLAlias::timeOfProcessLoadStore = 0;
|
|
54
|
-
double CFLAlias::timeOfUpdateCallGraph = 0;
|
|
36
|
+
u32_t CFLBase::AveragePointsToSetSize = 0;
|
|
37
|
+
u32_t CFLBase::MaxPointsToSetSize = 0;
|
|
38
|
+
double CFLBase::timeOfProcessCopyGep = 0;
|
|
39
|
+
double CFLBase::timeOfProcessLoadStore = 0;
|
|
40
|
+
double CFLBase::timeOfUpdateCallGraph = 0;
|
|
41
|
+
double CFLBase::timeOfSolving = 0;
|
|
42
|
+
double CFLBase::numOfSumEdges=0;
|
|
55
43
|
|
|
56
44
|
/*!
|
|
57
45
|
* On the fly call graph construction
|
|
@@ -193,9 +181,6 @@ void CFLAlias::heapAllocatorViaIndCall(CallSite cs)
|
|
|
193
181
|
*/
|
|
194
182
|
bool CFLAlias::updateCallGraph(const CallSiteToFunPtrMap& callsites)
|
|
195
183
|
{
|
|
196
|
-
|
|
197
|
-
// double cgUpdateStart = stat->getClk();
|
|
198
|
-
|
|
199
184
|
CallEdgeMap newEdges;
|
|
200
185
|
onTheFlyCallGraphSolve(callsites,newEdges);
|
|
201
186
|
for(CallEdgeMap::iterator it = newEdges.begin(), eit = newEdges.end(); it!=eit; ++it )
|
|
@@ -203,65 +188,88 @@ bool CFLAlias::updateCallGraph(const CallSiteToFunPtrMap& callsites)
|
|
|
203
188
|
CallSite cs = SVFUtil::getLLVMCallSite(it->first->getCallSite());
|
|
204
189
|
for(FunctionSet::iterator cit = it->second.begin(), ecit = it->second.end(); cit!=ecit; ++cit)
|
|
205
190
|
{
|
|
206
|
-
std::cout << cs.arg_size();
|
|
207
191
|
connectCaller2CalleeParams(cs,*cit);
|
|
208
192
|
}
|
|
209
193
|
}
|
|
210
194
|
|
|
211
|
-
// double cgUpdateEnd = stat->getClk();
|
|
212
|
-
//timeOfUpdateCallGraph += (cgUpdateEnd - cgUpdateStart) / TIMEINTERVAL;
|
|
213
|
-
|
|
214
195
|
return (!solver->isWorklistEmpty());
|
|
215
196
|
}
|
|
216
197
|
|
|
217
|
-
void CFLAlias::
|
|
198
|
+
void CFLAlias::initialize()
|
|
218
199
|
{
|
|
219
200
|
stat = new CFLStat(this);
|
|
201
|
+
|
|
202
|
+
// Build CFL Grammar
|
|
220
203
|
GrammarBuilder grammarBuilder = GrammarBuilder(Options::GrammarFilename);
|
|
221
|
-
|
|
204
|
+
GrammarBase *grammarBase = grammarBuilder.build();
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
// Build CFL Graph
|
|
222
208
|
AliasCFLGraphBuilder cflGraphBuilder = AliasCFLGraphBuilder();
|
|
223
|
-
|
|
224
|
-
if (Options::CFLGraph.empty())
|
|
209
|
+
if (Options::CFLGraph.empty()) // built from svfir
|
|
225
210
|
{
|
|
226
211
|
PointerAnalysis::initialize();
|
|
227
|
-
GrammarBase *grammarBase = grammarBuilder.build();
|
|
228
212
|
ConstraintGraph *consCG = new ConstraintGraph(svfir);
|
|
229
213
|
if (Options::PEGTransfer)
|
|
230
|
-
{
|
|
231
214
|
graph = cflGraphBuilder.buildBiPEGgraph(consCG, grammarBase->getStartKind(), grammarBase, svfir);
|
|
232
|
-
}
|
|
233
215
|
else
|
|
234
|
-
{
|
|
235
216
|
graph = cflGraphBuilder.buildBigraph(consCG, grammarBase->getStartKind(), grammarBase);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
cflChecker.check(grammarBase, &cflGraphBuilder, graph);
|
|
239
|
-
grammar = normalizer.normalize(grammarBase);
|
|
240
|
-
cflChecker.check(grammar, &cflGraphBuilder, graph);
|
|
241
217
|
delete consCG;
|
|
242
|
-
delete grammarBase;
|
|
243
218
|
}
|
|
244
219
|
else
|
|
245
|
-
{
|
|
246
|
-
GrammarBase *grammarBase = grammarBuilder.build();
|
|
247
220
|
graph = cflGraphBuilder.buildFromDot(Options::CFLGraph, grammarBase);
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
221
|
+
|
|
222
|
+
// Check CFL Graph and Grammar are accordance with grammar
|
|
223
|
+
CFLGramGraphChecker cflChecker = CFLGramGraphChecker();
|
|
224
|
+
cflChecker.check(grammarBase, &cflGraphBuilder, graph);
|
|
225
|
+
|
|
226
|
+
// Normalize grammar
|
|
227
|
+
CFGNormalizer normalizer = CFGNormalizer();
|
|
228
|
+
grammar = normalizer.normalize(grammarBase);
|
|
229
|
+
|
|
253
230
|
solver = new CFLSolver(graph, grammar);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
231
|
+
delete grammarBase;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
void CFLAlias::finalize()
|
|
235
|
+
{
|
|
257
236
|
if(Options::PrintCFL == true)
|
|
258
237
|
{
|
|
259
|
-
|
|
238
|
+
if (Options::CFLGraph.empty())
|
|
239
|
+
svfir->dump("IR");
|
|
260
240
|
grammar->dump("Grammar");
|
|
261
241
|
graph->dump("CFLGraph");
|
|
262
242
|
}
|
|
263
243
|
if (Options::CFLGraph.empty())
|
|
264
|
-
{
|
|
265
244
|
PointerAnalysis::finalize();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
void CFLAlias::analyze()
|
|
248
|
+
{
|
|
249
|
+
initialize();
|
|
250
|
+
|
|
251
|
+
// Start solving
|
|
252
|
+
double start = stat->getClk(true);
|
|
253
|
+
|
|
254
|
+
solver->solve();
|
|
255
|
+
if (Options::CFLGraph.empty())
|
|
256
|
+
{
|
|
257
|
+
while (updateCallGraph(svfir->getIndirectCallsites()))
|
|
258
|
+
solver->solve();
|
|
259
|
+
} // Only cflgraph built from bc could reanlyze by update call graph
|
|
260
|
+
|
|
261
|
+
double end = stat->getClk(true);
|
|
262
|
+
timeOfSolving += (end - start) / TIMEINTERVAL;
|
|
263
|
+
|
|
264
|
+
finalize();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
void CFLAlias::countSumEdges()
|
|
268
|
+
{
|
|
269
|
+
numOfSumEdges = 0;
|
|
270
|
+
for(auto it = getCFLGraph()->getCFLEdges().begin(); it != getCFLGraph()->getCFLEdges().end(); it++ )
|
|
271
|
+
{
|
|
272
|
+
if ((*it)->getEdgeKind() == grammar->getStartKind())
|
|
273
|
+
numOfSumEdges++;
|
|
266
274
|
}
|
|
267
275
|
}
|
package/lib/CFL/CFLStat.cpp
CHANGED
|
@@ -44,11 +44,8 @@ const char* CFLStat::CollapseTime = "CollapseTime";
|
|
|
44
44
|
/*!
|
|
45
45
|
* Constructor
|
|
46
46
|
*/
|
|
47
|
-
CFLStat::CFLStat(
|
|
47
|
+
CFLStat::CFLStat(CFLBase* p): PTAStat(p),pta(p)
|
|
48
48
|
{
|
|
49
|
-
_NumOfNullPtr = 0;
|
|
50
|
-
_NumOfConstantPtr= 0;
|
|
51
|
-
_NumOfBlackholePtr = 0;
|
|
52
49
|
startClk();
|
|
53
50
|
}
|
|
54
51
|
|
|
@@ -57,11 +54,10 @@ CFLStat::CFLStat(CFLAlias* p): PTAStat(p),pta(p)
|
|
|
57
54
|
*/
|
|
58
55
|
void CFLStat::collectCFLInfo(CFLGraph* CFLGraph)
|
|
59
56
|
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
repNodes.clear();
|
|
57
|
+
PTNumStatMap["NumOfNodes"] = CFLGraph->getTotalNodeNum();
|
|
58
|
+
PTNumStatMap["NumOfEdges"] = CFLGraph->getCFLEdges().size();
|
|
59
|
+
|
|
60
|
+
PTAStat::printStat("CFLGraph Stats");
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
|
|
@@ -219,19 +215,15 @@ void CFLStat::statNullPtr()
|
|
|
219
215
|
*/
|
|
220
216
|
void CFLStat::performStat()
|
|
221
217
|
{
|
|
222
|
-
|
|
223
|
-
assert(SVFUtil::isa<CFLAlias>(pta) && "not an CFLAlias pass!! what else??");
|
|
218
|
+
assert((SVFUtil::isa<CFLAlias>(pta)||SVFUtil::isa<CFLVF>(pta)) && "not an CFLAlias pass!! what else??");
|
|
224
219
|
endClk();
|
|
225
|
-
|
|
220
|
+
|
|
226
221
|
CFLGraph* CFLGraph = pta->getCFLGraph();
|
|
227
|
-
// collect cfl graph infor
|
|
228
222
|
collectCFLInfo(CFLGraph);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
// stat null ptr number
|
|
234
|
-
statNullPtr();
|
|
223
|
+
pta->countSumEdges();
|
|
224
|
+
timeStatMap["AnalysisTime"] = pta->timeOfSolving;
|
|
225
|
+
PTNumStatMap["SumEdges"] = pta->numOfSumEdges;
|
|
226
|
+
PTAStat::printStat("CFL-reachability analysis Stats");
|
|
235
227
|
|
|
236
228
|
u32_t totalPointers = 0;
|
|
237
229
|
u32_t totalTopLevPointers = 0;
|
package/lib/CFL/CFLVF.cpp
CHANGED
|
@@ -28,62 +28,67 @@
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
#include "CFL/CFLVF.h"
|
|
31
|
-
#include "Util/SVFBasicTypes.h"
|
|
32
|
-
#include "WPA/Andersen.h"
|
|
33
31
|
|
|
34
32
|
using namespace SVF;
|
|
35
33
|
using namespace cppUtil;
|
|
36
34
|
using namespace SVFUtil;
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
void CFLVF::analyze()
|
|
36
|
+
void CFLVF::initialize()
|
|
41
37
|
{
|
|
38
|
+
// Build CFL Grammar and Normalize
|
|
42
39
|
GrammarBuilder grammarBuilder = GrammarBuilder(Options::GrammarFilename);
|
|
43
|
-
|
|
40
|
+
GrammarBase *grammarBase = grammarBuilder.build();
|
|
41
|
+
|
|
42
|
+
// Build CFL Graph
|
|
44
43
|
VFCFLGraphBuilder cflGraphBuilder = VFCFLGraphBuilder();
|
|
45
|
-
|
|
46
|
-
if (Options::CFLGraph.empty())
|
|
44
|
+
if (Options::CFLGraph.empty()) // built from svfir
|
|
47
45
|
{
|
|
48
46
|
PointerAnalysis::initialize();
|
|
49
|
-
GrammarBase *grammarBase = grammarBuilder.build();
|
|
50
47
|
AndersenWaveDiff* ander = AndersenWaveDiff::createAndersenWaveDiff(pag);
|
|
51
48
|
svfg = memSSA.buildFullSVFG(ander);
|
|
52
|
-
|
|
53
|
-
if (Options::PEGTransfer)
|
|
54
|
-
{
|
|
55
|
-
graph = cflGraphBuilder.buildBiPEGgraph(consCG, grammarBase->getStartKind(), grammarBase, svfir);
|
|
56
|
-
}
|
|
57
|
-
else
|
|
58
|
-
{
|
|
59
|
-
graph = cflGraphBuilder.buildBigraph(svfg, grammarBase->getStartKind(), grammarBase);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
cflChecker.check(grammarBase, &cflGraphBuilder, graph);
|
|
63
|
-
grammar = normalizer.normalize(grammarBase);
|
|
64
|
-
cflChecker.check(grammar, &cflGraphBuilder, graph);
|
|
65
|
-
delete consCG;
|
|
66
|
-
delete grammarBase;
|
|
49
|
+
graph = cflGraphBuilder.buildBigraph(svfg, grammarBase->getStartKind(), grammarBase);
|
|
67
50
|
}
|
|
68
51
|
else
|
|
69
|
-
{
|
|
70
|
-
GrammarBase *grammarBase = grammarBuilder.build();
|
|
71
52
|
graph = cflGraphBuilder.buildFromDot(Options::CFLGraph, grammarBase);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
53
|
+
|
|
54
|
+
// Check CFL Graph and Grammar are accordance with grammar
|
|
55
|
+
CFLGramGraphChecker cflChecker = CFLGramGraphChecker();
|
|
56
|
+
cflChecker.check(grammarBase, &cflGraphBuilder, graph);
|
|
57
|
+
|
|
58
|
+
// Normalize grammar
|
|
59
|
+
CFGNormalizer normalizer = CFGNormalizer();
|
|
60
|
+
grammar = normalizer.normalize(grammarBase);
|
|
61
|
+
|
|
77
62
|
solver = new CFLSolver(graph, grammar);
|
|
78
|
-
|
|
63
|
+
delete grammarBase;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void CFLVF::finalize()
|
|
67
|
+
{
|
|
79
68
|
if(Options::PrintCFL == true)
|
|
80
69
|
{
|
|
81
|
-
|
|
70
|
+
if (Options::CFLGraph.empty())
|
|
71
|
+
svfir->dump("IR");
|
|
82
72
|
grammar->dump("Grammar");
|
|
83
73
|
graph->dump("CFLGraph");
|
|
84
74
|
}
|
|
85
|
-
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
void CFLVF::analyze()
|
|
78
|
+
{
|
|
79
|
+
initialize();
|
|
80
|
+
|
|
81
|
+
solver->solve();
|
|
82
|
+
|
|
83
|
+
finalize();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
void CFLVF::countSumEdges()
|
|
87
|
+
{
|
|
88
|
+
numOfSumEdges = 0;
|
|
89
|
+
for(auto it = getCFLGraph()->getCFLEdges().begin(); it != getCFLGraph()->getCFLEdges().end(); it++ )
|
|
86
90
|
{
|
|
87
|
-
|
|
91
|
+
if ((*it)->getEdgeKind() == grammar->getStartKind())
|
|
92
|
+
numOfSumEdges++;
|
|
88
93
|
}
|
|
89
94
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.578",
|
|
4
4
|
"description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
package/tools/CFL/cfl.cpp
CHANGED
|
@@ -28,11 +28,9 @@
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
#include "SVF-FE/LLVMUtil.h"
|
|
31
|
-
#include "
|
|
31
|
+
#include "SVF-FE/SVFIRBuilder.h"
|
|
32
32
|
#include "CFL/CFLAlias.h"
|
|
33
33
|
#include "CFL/CFLVF.h"
|
|
34
|
-
#include "SVF-FE/SVFIRBuilder.h"
|
|
35
|
-
#include "CFL/CFGNormalizer.h"
|
|
36
34
|
|
|
37
35
|
using namespace llvm;
|
|
38
36
|
using namespace SVF;
|
|
@@ -57,35 +55,24 @@ int main(int argc, char ** argv)
|
|
|
57
55
|
{
|
|
58
56
|
LLVMModuleSet::getLLVMModuleSet()->preProcessBCs(moduleNameVec);
|
|
59
57
|
}
|
|
58
|
+
|
|
59
|
+
SVFIR* svfir = nullptr;
|
|
60
60
|
if (Options::CFLGraph.empty())
|
|
61
61
|
{
|
|
62
62
|
SVFModule* svfModule = LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec);
|
|
63
63
|
svfModule->buildSymbolTableInfo();
|
|
64
|
-
|
|
65
|
-
/// Build Program Assignment Graph (SVFIR)
|
|
66
64
|
SVFIRBuilder builder;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
else
|
|
75
|
-
{
|
|
76
|
-
CFLAlias* cflaa = new CFLAlias(svfir);
|
|
77
|
-
cflaa->analyze();
|
|
78
|
-
delete cflaa;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
65
|
+
svfir = builder.build(svfModule);
|
|
66
|
+
} // if no dot form CFLGraph is specified, we use svfir from .bc.
|
|
67
|
+
|
|
68
|
+
BVDataPTAImpl* cfl;
|
|
69
|
+
if (Options::CFLSVFG)
|
|
70
|
+
cfl = new CFLVF(svfir);
|
|
81
71
|
else
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
CFLAlias* cflaa = new CFLAlias(svfir);
|
|
85
|
-
cflaa->analyze();
|
|
86
|
-
delete cflaa;
|
|
87
|
-
}
|
|
72
|
+
cfl = new CFLAlias(svfir); // if no svfg is specified, we use CFLAlias as the default one.
|
|
73
|
+
cfl->analyze();
|
|
88
74
|
|
|
75
|
+
delete cfl;
|
|
89
76
|
SVFIR::releaseSVFIR();
|
|
90
77
|
SVF::LLVMModuleSet::releaseLLVMModuleSet();
|
|
91
78
|
|