svf-tools 1.0.620 → 1.0.621

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.
Files changed (163) hide show
  1. package/SVF-doxygen/html/html/CFLAlias_8cpp_source.html +7 -2
  2. package/SVF-doxygen/html/html/CFLAlias_8h.html +4 -0
  3. package/SVF-doxygen/html/html/CFLAlias_8h_source.html +19 -10
  4. package/SVF-doxygen/html/html/CFLBase_8cpp_source.html +1 -1
  5. package/SVF-doxygen/html/html/CFLBase_8h_source.html +1 -1
  6. package/SVF-doxygen/html/html/CFLDataBuilder_8h.html +96 -0
  7. package/SVF-doxygen/html/html/CFLDataBuilder_8h_source.html +99 -0
  8. package/SVF-doxygen/html/html/CFLData_8h.html +106 -0
  9. package/SVF-doxygen/html/html/CFLData_8h_source.html +136 -0
  10. package/SVF-doxygen/html/html/CFLSolver_8cpp_source.html +7 -7
  11. package/SVF-doxygen/html/html/CFLSolver_8h.html +4 -0
  12. package/SVF-doxygen/html/html/CFLSolver_8h_source.html +22 -16
  13. package/SVF-doxygen/html/html/CFLVF_8cpp_source.html +1 -1
  14. package/SVF-doxygen/html/html/GraphWriter_8cpp_source.html +2 -1
  15. package/SVF-doxygen/html/html/GraphWriter_8h_source.html +2 -1
  16. package/SVF-doxygen/html/html/LLVMLoopAnalysis_8cpp_source.html +1 -1
  17. package/SVF-doxygen/html/html/Options_8cpp_source.html +4 -3
  18. package/SVF-doxygen/html/html/Options_8h_source.html +4 -3
  19. package/SVF-doxygen/html/html/annotated.html +357 -351
  20. package/SVF-doxygen/html/html/cfl_8cpp.html +1 -1
  21. package/SVF-doxygen/html/html/cfl_8cpp_source.html +1 -1
  22. package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +1 -0
  23. package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.png +0 -0
  24. package/SVF-doxygen/html/html/classSVF_1_1CFLAlias.html +27 -24
  25. package/SVF-doxygen/html/html/classSVF_1_1CFLAlias.png +0 -0
  26. package/SVF-doxygen/html/html/classSVF_1_1CFLBase.html +2 -1
  27. package/SVF-doxygen/html/html/classSVF_1_1CFLBase.png +0 -0
  28. package/SVF-doxygen/html/html/classSVF_1_1CFLData-members.html +110 -0
  29. package/SVF-doxygen/html/html/classSVF_1_1CFLData.html +1126 -0
  30. package/SVF-doxygen/html/html/classSVF_1_1CFLDataBuilder-members.html +88 -0
  31. package/SVF-doxygen/html/html/classSVF_1_1CFLDataBuilder.html +380 -0
  32. package/SVF-doxygen/html/html/classSVF_1_1CFLSolver.html +48 -39
  33. package/SVF-doxygen/html/html/classSVF_1_1CFLSolver.png +0 -0
  34. package/SVF-doxygen/html/html/classSVF_1_1CFLVF.html +1 -1
  35. package/SVF-doxygen/html/html/classSVF_1_1GraphWriter.html +3 -2
  36. package/SVF-doxygen/html/html/classSVF_1_1HybridData-members.html +89 -0
  37. package/SVF-doxygen/html/html/classSVF_1_1HybridData.html +449 -0
  38. package/SVF-doxygen/html/html/classSVF_1_1LLVMLoopAnalysis.html +1 -1
  39. package/SVF-doxygen/html/html/classSVF_1_1Options-members.html +45 -44
  40. package/SVF-doxygen/html/html/classSVF_1_1Options.html +28 -2
  41. package/SVF-doxygen/html/html/classSVF_1_1POCRAlias-members.html +281 -0
  42. package/SVF-doxygen/html/html/classSVF_1_1POCRAlias.html +828 -0
  43. package/SVF-doxygen/html/html/classSVF_1_1POCRAlias.png +0 -0
  44. package/SVF-doxygen/html/html/classSVF_1_1POCRSolver-members.html +98 -0
  45. package/SVF-doxygen/html/html/classSVF_1_1POCRSolver.html +245 -0
  46. package/SVF-doxygen/html/html/classSVF_1_1POCRSolver.png +0 -0
  47. package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +2 -1
  48. package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.png +0 -0
  49. package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +1 -1
  50. package/SVF-doxygen/html/html/classes.html +110 -109
  51. package/SVF-doxygen/html/html/dir_ae8aa099e368efaa962140c6624142bc.html +4 -0
  52. package/SVF-doxygen/html/html/files.html +9 -7
  53. package/SVF-doxygen/html/html/functions.html +7 -1
  54. package/SVF-doxygen/html/html/functions_0x7e.html +18 -0
  55. package/SVF-doxygen/html/html/functions_a.html +38 -14
  56. package/SVF-doxygen/html/html/functions_b.html +9 -4
  57. package/SVF-doxygen/html/html/functions_c.html +59 -38
  58. package/SVF-doxygen/html/html/functions_d.html +7 -1
  59. package/SVF-doxygen/html/html/functions_e.html +5 -1
  60. package/SVF-doxygen/html/html/functions_func.html +35 -11
  61. package/SVF-doxygen/html/html/functions_func_0x7e.html +18 -0
  62. package/SVF-doxygen/html/html/functions_func_b.html +8 -3
  63. package/SVF-doxygen/html/html/functions_func_c.html +42 -27
  64. package/SVF-doxygen/html/html/functions_func_e.html +2 -1
  65. package/SVF-doxygen/html/html/functions_func_g.html +20 -7
  66. package/SVF-doxygen/html/html/functions_func_h.html +10 -3
  67. package/SVF-doxygen/html/html/functions_func_i.html +14 -10
  68. package/SVF-doxygen/html/html/functions_func_m.html +3 -2
  69. package/SVF-doxygen/html/html/functions_func_o.html +13 -11
  70. package/SVF-doxygen/html/html/functions_func_p.html +6 -3
  71. package/SVF-doxygen/html/html/functions_func_t.html +3 -0
  72. package/SVF-doxygen/html/html/functions_g.html +22 -9
  73. package/SVF-doxygen/html/html/functions_h.html +12 -5
  74. package/SVF-doxygen/html/html/functions_i.html +20 -11
  75. package/SVF-doxygen/html/html/functions_l.html +3 -3
  76. package/SVF-doxygen/html/html/functions_m.html +2 -1
  77. package/SVF-doxygen/html/html/functions_n.html +3 -3
  78. package/SVF-doxygen/html/html/functions_o.html +26 -24
  79. package/SVF-doxygen/html/html/functions_p.html +23 -14
  80. package/SVF-doxygen/html/html/functions_r.html +3 -5
  81. package/SVF-doxygen/html/html/functions_s.html +11 -10
  82. package/SVF-doxygen/html/html/functions_t.html +13 -4
  83. package/SVF-doxygen/html/html/functions_type_c.html +2 -1
  84. package/SVF-doxygen/html/html/functions_type_d.html +3 -0
  85. package/SVF-doxygen/html/html/functions_type_i.html +2 -1
  86. package/SVF-doxygen/html/html/functions_type_t.html +3 -0
  87. package/SVF-doxygen/html/html/functions_v.html +3 -3
  88. package/SVF-doxygen/html/html/functions_vars.html +7 -1
  89. package/SVF-doxygen/html/html/functions_vars_c.html +3 -0
  90. package/SVF-doxygen/html/html/functions_vars_d.html +3 -0
  91. package/SVF-doxygen/html/html/functions_vars_e.html +3 -0
  92. package/SVF-doxygen/html/html/functions_vars_i.html +4 -0
  93. package/SVF-doxygen/html/html/functions_vars_p.html +6 -0
  94. package/SVF-doxygen/html/html/functions_vars_s.html +3 -0
  95. package/SVF-doxygen/html/html/functions_vars_t.html +3 -0
  96. package/SVF-doxygen/html/html/hierarchy.html +517 -511
  97. package/SVF-doxygen/html/html/namespaceSVF.html +29 -0
  98. package/SVF-doxygen/html/html/namespaceSVF_1_1DOT.html +3 -2
  99. package/SVF-doxygen/html/html/namespacemembers_l.html +3 -0
  100. package/SVF-doxygen/html/html/namespacemembers_type_l.html +3 -0
  101. package/SVF-doxygen/html/html/search/all_0.js +2 -1
  102. package/SVF-doxygen/html/html/search/all_1.js +8 -1
  103. package/SVF-doxygen/html/html/search/all_10.js +8 -5
  104. package/SVF-doxygen/html/html/search/all_11.js +3 -3
  105. package/SVF-doxygen/html/html/search/all_12.js +7 -6
  106. package/SVF-doxygen/html/html/search/all_13.js +7 -4
  107. package/SVF-doxygen/html/html/search/all_15.js +1 -1
  108. package/SVF-doxygen/html/html/search/all_19.js +6 -0
  109. package/SVF-doxygen/html/html/search/all_2.js +3 -2
  110. package/SVF-doxygen/html/html/search/all_3.js +11 -6
  111. package/SVF-doxygen/html/html/search/all_4.js +2 -1
  112. package/SVF-doxygen/html/html/search/all_5.js +2 -1
  113. package/SVF-doxygen/html/html/search/all_7.js +5 -1
  114. package/SVF-doxygen/html/html/search/all_8.js +4 -2
  115. package/SVF-doxygen/html/html/search/all_9.js +7 -5
  116. package/SVF-doxygen/html/html/search/all_c.js +3 -2
  117. package/SVF-doxygen/html/html/search/all_d.js +1 -1
  118. package/SVF-doxygen/html/html/search/all_e.js +2 -2
  119. package/SVF-doxygen/html/html/search/all_f.js +4 -4
  120. package/SVF-doxygen/html/html/search/classes_10.js +1 -0
  121. package/SVF-doxygen/html/html/search/classes_2.js +2 -0
  122. package/SVF-doxygen/html/html/search/classes_7.js +2 -1
  123. package/SVF-doxygen/html/html/search/classes_d.js +2 -0
  124. package/SVF-doxygen/html/html/search/files_2.js +2 -0
  125. package/SVF-doxygen/html/html/search/functions_0.js +8 -1
  126. package/SVF-doxygen/html/html/search/functions_1.js +3 -2
  127. package/SVF-doxygen/html/html/search/functions_11.js +1 -1
  128. package/SVF-doxygen/html/html/search/functions_12.js +1 -0
  129. package/SVF-doxygen/html/html/search/functions_17.js +6 -0
  130. package/SVF-doxygen/html/html/search/functions_2.js +4 -1
  131. package/SVF-doxygen/html/html/search/functions_4.js +1 -1
  132. package/SVF-doxygen/html/html/search/functions_6.js +5 -1
  133. package/SVF-doxygen/html/html/search/functions_7.js +4 -2
  134. package/SVF-doxygen/html/html/search/functions_8.js +3 -2
  135. package/SVF-doxygen/html/html/search/functions_c.js +1 -1
  136. package/SVF-doxygen/html/html/search/functions_e.js +2 -2
  137. package/SVF-doxygen/html/html/search/functions_f.js +1 -0
  138. package/SVF-doxygen/html/html/search/typedefs_11.js +2 -1
  139. package/SVF-doxygen/html/html/search/typedefs_2.js +1 -1
  140. package/SVF-doxygen/html/html/search/typedefs_3.js +1 -0
  141. package/SVF-doxygen/html/html/search/typedefs_7.js +1 -1
  142. package/SVF-doxygen/html/html/search/typedefs_a.js +1 -0
  143. package/SVF-doxygen/html/html/search/variables_0.js +2 -1
  144. package/SVF-doxygen/html/html/search/variables_10.js +2 -0
  145. package/SVF-doxygen/html/html/search/variables_12.js +1 -0
  146. package/SVF-doxygen/html/html/search/variables_13.js +2 -1
  147. package/SVF-doxygen/html/html/search/variables_3.js +1 -0
  148. package/SVF-doxygen/html/html/search/variables_4.js +1 -0
  149. package/SVF-doxygen/html/html/search/variables_5.js +1 -0
  150. package/SVF-doxygen/html/html/search/variables_9.js +2 -1
  151. package/SVF-doxygen/html/html/search/variables_c.js +1 -1
  152. package/SVF-doxygen/html/html/search/variables_e.js +1 -1
  153. package/SVF-doxygen/html/html/structSVF_1_1HybridData_1_1TreeNode-members.html +86 -0
  154. package/SVF-doxygen/html/html/structSVF_1_1HybridData_1_1TreeNode.html +255 -0
  155. package/include/CFL/CFLAlias.h +34 -0
  156. package/include/CFL/CFLData.h +316 -0
  157. package/include/CFL/CFLDataBuilder.h +91 -0
  158. package/include/CFL/CFLSolver.h +21 -0
  159. package/include/Util/Options.h +1 -0
  160. package/lib/CFL/CFLAlias.cpp +36 -0
  161. package/lib/Util/Options.cpp +5 -0
  162. package/package.json +1 -1
  163. package/tools/CFL/cfl.cpp +2 -0
@@ -0,0 +1,316 @@
1
+ //===----- CFLData.h -- Context Free Language Reachability Graph Data Structure--------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-> <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
+ * CFLData.h
25
+ *
26
+ * Created on: Nov 22, 2019
27
+ * Author: Yuxiang Lei
28
+ *
29
+ * The implementation is based on
30
+ * Yuxiang Lei, Yulei Sui, Shuo Ding, and Qirun Zhang.
31
+ * Taming Transitive Redundancy for Context-Free Language Reachability.
32
+ * ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications
33
+ */
34
+
35
+ #ifndef INCLUDE_CFL_CFGDATA_H_
36
+ #define INCLUDE_CFL_CFGDATA_H_
37
+
38
+ #include "Util/WorkList.h"
39
+ #include "CFL/CFLGrammar.h"
40
+
41
+ namespace SVF
42
+ {
43
+ typedef GrammarBase::Symbol Label;
44
+ /*!
45
+ * Adjacency-list graph representation
46
+ */
47
+ class CFLData
48
+ {
49
+ public:
50
+ typedef std::map<const Label, NodeBS> TypeMap; // Label with SparseBitVector of NodeID
51
+ typedef std::unordered_map<NodeID, TypeMap> DataMap; // Each Node has a TypeMap
52
+ typedef typename DataMap::iterator iterator; // iterator for each node
53
+ typedef typename DataMap::const_iterator const_iterator; // const iterator
54
+
55
+ protected:
56
+ DataMap succMap; // succ map for nodes contains Label: Edgeset
57
+ DataMap predMap; // pred map for nodes contains Label: edgeset
58
+ const NodeBS emptyData; // ??
59
+ NodeBS diff; // ??
60
+
61
+ // union/add data
62
+ //@{
63
+ inline bool addPred(const NodeID key, const NodeID src, const Label ty)
64
+ {
65
+ return predMap[key][ty].test_and_set(src);
66
+ };
67
+
68
+ inline bool addSucc(const NodeID key, const NodeID dst, const Label ty)
69
+ {
70
+ return succMap[key][ty].test_and_set(dst);
71
+ };
72
+
73
+ inline bool addPreds(const NodeID key, const NodeBS& data, const Label ty)
74
+ {
75
+ if (data.empty())
76
+ return false;
77
+ return predMap[key][ty] |= data; // union of sparsebitvector (add to LHS)
78
+ }
79
+
80
+ inline bool addSuccs(const NodeID key, const NodeBS& data, const Label ty)
81
+ {
82
+ if (data.empty())
83
+ return false;
84
+ return succMap[key][ty] |= data; // // union of sparsebitvector (add to LHS)
85
+ }
86
+ //@}
87
+
88
+ public:
89
+ // Constructor
90
+ CFLData()
91
+ {}
92
+
93
+ // Destructor
94
+ virtual ~CFLData()
95
+ {}
96
+
97
+ virtual void clear()
98
+ {
99
+ succMap.clear();
100
+ predMap.clear();
101
+ }
102
+
103
+ inline const_iterator begin() const
104
+ {
105
+ return succMap.begin();
106
+ }
107
+
108
+ inline const_iterator end() const
109
+ {
110
+ return succMap.end();
111
+ }
112
+
113
+ inline iterator begin()
114
+ {
115
+ return succMap.begin();
116
+ }
117
+
118
+ inline iterator end()
119
+ {
120
+ return succMap.end();
121
+ }
122
+
123
+ inline DataMap& getSuccMap()
124
+ {
125
+ return succMap;
126
+ }
127
+
128
+ inline DataMap& getPredMap()
129
+ {
130
+ return predMap;
131
+ }
132
+
133
+ inline TypeMap& getSuccMap(const NodeID key)
134
+ {
135
+ return succMap[key];
136
+ }
137
+
138
+ inline TypeMap& getPredMap(const NodeID key)
139
+ {
140
+ return predMap[key];
141
+ }
142
+
143
+ inline NodeBS& getSuccs(const NodeID key, const Label ty)
144
+ {
145
+ return succMap[key][ty];
146
+ }
147
+
148
+ inline NodeBS& getPreds(const NodeID key, const Label ty)
149
+ {
150
+ return predMap[key][ty];
151
+ }
152
+
153
+ // Alias data operations
154
+ //@{
155
+ inline bool addEdge(const NodeID src, const NodeID dst, const Label ty)
156
+ {
157
+ addSucc(src, dst, ty);
158
+ return addPred(dst, src, ty);
159
+ }
160
+
161
+ /// add edges and return the set of added edges (dst) for src
162
+ inline NodeBS addEdges(const NodeID src, const NodeBS& dstData, const Label ty)
163
+ {
164
+ NodeBS newDsts;
165
+ if (addSuccs(src, dstData, ty))
166
+ {
167
+ for (const NodeID datum: dstData)
168
+ if (addPred(datum, src, ty))
169
+ newDsts.set(datum);
170
+ }
171
+ return newDsts;
172
+ }
173
+
174
+ /// add edges and return the set of added edges (src) for dst
175
+ inline NodeBS addEdges(const NodeBS& srcData, const NodeID dst, const Label ty)
176
+ {
177
+ NodeBS newSrcs;
178
+ if (addPreds(dst, srcData, ty))
179
+ {
180
+ for (const NodeID datum: srcData)
181
+ if (addSucc(datum, dst, ty))
182
+ newSrcs.set(datum);
183
+ }
184
+ return newSrcs;
185
+ }
186
+
187
+ /// find src -> find src[ty] -> find dst in set
188
+ inline bool hasEdge(const NodeID src, const NodeID dst, const Label ty)
189
+ {
190
+ const_iterator iter1 = succMap.find(src);
191
+ if (iter1 == succMap.end())
192
+ return false;
193
+
194
+ auto iter2 = iter1->second.find(ty);
195
+ if (iter2 == iter1->second.end())
196
+ return false;
197
+
198
+ return iter2->second.test(dst);
199
+ }
200
+
201
+ /* This is a dataset version, to be modified to a cflData version */
202
+ inline void clearEdges(const NodeID key)
203
+ {
204
+ succMap[key].clear();
205
+ predMap[key].clear();
206
+ }
207
+ //@}
208
+ };
209
+
210
+
211
+ /*!
212
+ * Hybrid graph representation for transitive relations
213
+ */
214
+ class HybridData
215
+ {
216
+ public:
217
+ struct TreeNode
218
+ {
219
+ NodeID id;
220
+ std::unordered_set<TreeNode*> children;
221
+
222
+ TreeNode(NodeID nId) : id(nId)
223
+ {}
224
+
225
+ ~TreeNode()
226
+ {
227
+ }
228
+
229
+ inline bool operator==(const TreeNode& rhs) const
230
+ {
231
+ return id == rhs.id;
232
+ }
233
+
234
+ inline bool operator<(const TreeNode& rhs) const
235
+ {
236
+ return id < rhs.id;
237
+ }
238
+ };
239
+
240
+
241
+ public:
242
+ Map<NodeID, std::unordered_map<NodeID, TreeNode*>> indMap; // indMap[v][u] points to node v in tree(u)
243
+
244
+ HybridData()
245
+ {}
246
+
247
+ ~HybridData()
248
+ {
249
+ for (auto iter1: indMap)
250
+ {
251
+ for (auto iter2: iter1.second)
252
+ {
253
+ delete iter2.second;
254
+ iter2.second = NULL;
255
+ }
256
+ }
257
+ }
258
+
259
+ bool hasInd(NodeID src, NodeID dst)
260
+ {
261
+ auto it = indMap.find(dst);
262
+ if (it == indMap.end())
263
+ return false;
264
+ return (it->second.find(src) != it->second.end());
265
+ }
266
+
267
+ /// Add a node dst to tree(src)
268
+ TreeNode* addInd(NodeID src, NodeID dst)
269
+ {
270
+ auto resIns = indMap[dst].insert(std::make_pair(src, new TreeNode(dst)));
271
+ if (resIns.second)
272
+ return resIns.first->second;
273
+ return nullptr;
274
+ }
275
+
276
+ /// Get the node dst in tree(src)
277
+ TreeNode* getNode(NodeID src, NodeID dst)
278
+ {
279
+ return indMap[dst][src];
280
+ }
281
+
282
+ /// add v into desc(x) as a child of u
283
+ void insertEdge(TreeNode* u, TreeNode* v)
284
+ {
285
+ u->children.insert(v);
286
+ }
287
+
288
+ void addArc(NodeID src, NodeID dst)
289
+ {
290
+ if (!hasInd(src, dst))
291
+ {
292
+ for (auto iter: indMap[src])
293
+ {
294
+ meld(iter.first, getNode(iter.first, src), getNode(dst, dst));
295
+ }
296
+ }
297
+ }
298
+
299
+ void meld(NodeID x, TreeNode* uNode, TreeNode* vNode)
300
+ {
301
+ TreeNode* newVNode = addInd(x, vNode->id);
302
+ if (!newVNode)
303
+ return;
304
+
305
+ insertEdge(uNode, newVNode);
306
+ for (TreeNode* vChild: vNode->children)
307
+ {
308
+ meld(x, newVNode, vChild);
309
+ }
310
+ }
311
+ };
312
+
313
+
314
+ } // end namespace SVF
315
+
316
+ #endif
@@ -0,0 +1,91 @@
1
+ //===----- CFLDataBuilder.h -- CFL Data Builder --------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-> <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
+ * CFLGraphBuilder.h
25
+ *
26
+ * Created on: Nov 6, 2022
27
+ * Author: Pei Xu
28
+ */
29
+
30
+ #ifndef INCLUDE_CFL_CFLDATABUILDER_H_
31
+ #define INCLUDE_CFL_CFLDATABUILDER_H_
32
+
33
+ #include "CFL/CFLData.h"
34
+ #include "Graphs/CFLGraph.h"
35
+
36
+ namespace SVF
37
+ {
38
+
39
+ /*!
40
+ * Build CFLData from CFL graph
41
+
42
+ */
43
+
44
+ class CFLDataBuilder
45
+ {
46
+ protected:
47
+ CFLData* _cflData;
48
+ CFLGraph* _graph;
49
+
50
+ public:
51
+ /// Constructor
52
+ CFLDataBuilder(CFLGraph* cflgraph) : _cflData(NULL), _graph(cflgraph)
53
+ {
54
+ if (!_cflData)
55
+ _cflData = new CFLData();
56
+ }
57
+
58
+ /// Destructor
59
+ virtual ~CFLDataBuilder()
60
+ {
61
+ }
62
+
63
+ CFLData* cflData()
64
+ {
65
+ return _cflData;
66
+ }
67
+
68
+ //CFL data operations
69
+ //@{
70
+ virtual bool addEdge(const NodeID srcId, const NodeID dstId, const Label ty)
71
+ {
72
+ return cflData()->addEdge(srcId, dstId, ty);
73
+ }
74
+
75
+ virtual NodeBS addEdges(const NodeID srcId, const NodeBS& dstData, const Label ty)
76
+ {
77
+ return cflData()->addEdges(srcId, dstData, ty);
78
+ }
79
+ //@}
80
+ CFLData* build()
81
+ {
82
+ for (CFLEdge* edge: _graph->getCFLEdges())
83
+ addEdge(edge->getSrcID(), edge->getDstID(), edge->getEdgeKind());
84
+ return cflData();
85
+ }
86
+
87
+
88
+ };
89
+ }// SVF
90
+
91
+ #endif /* INCLUDE_CFL_CFLGRAPHBUILDER_H_*/
@@ -33,6 +33,7 @@
33
33
  #include "Graphs/CFLGraph.h"
34
34
  #include "CFL/CFLGrammar.h"
35
35
  #include "Util/WorkList.h"
36
+ #include "CFL/CFLData.h"
36
37
 
37
38
 
38
39
  namespace SVF
@@ -110,6 +111,26 @@ private:
110
111
 
111
112
  };
112
113
 
114
+ /// Solver Utilize CFLData
115
+ class POCRSolver : public CFLSolver
116
+ {
117
+ /// Destructor
118
+ virtual ~POCRSolver()
119
+ {
120
+ delete _cflData;
121
+ }
122
+
123
+ CFLData* cflData()
124
+ {
125
+ return _cflData;
126
+ }
127
+
128
+ //virtual void initialize();
129
+
130
+ private:
131
+ CFLData* _cflData;
132
+
133
+ };
113
134
  }
114
135
 
115
136
  #endif /* INCLUDE_CFL_CFLSolver_H_*/
@@ -255,6 +255,7 @@ public:
255
255
  static const Option<bool> FlexSymMap;
256
256
  static const Option<bool> PEGTransfer;
257
257
  static const Option<bool> CFLSVFG;
258
+ static const Option<bool> POCRAlias;
258
259
 
259
260
  // Loop Analysis
260
261
  static const Option<bool> LoopAnalysis;
@@ -237,3 +237,39 @@ void CFLAlias::solve()
237
237
  double end = stat->getClk(true);
238
238
  timeOfSolving += (end - start) / TIMEINTERVAL;
239
239
  }
240
+
241
+ double POCRAlias::timeOfBuildCFLData = 0; // Time of building CFLData from CFLGraph
242
+
243
+ void POCRAlias::initialize()
244
+ {
245
+ stat = new CFLStat(this);
246
+
247
+ // Build CFL Grammar
248
+ buildCFLGrammar();
249
+
250
+ // Build CFL Graph
251
+ buildCFLGraph();
252
+
253
+ // Build CFL Data
254
+ buildCFLData();
255
+
256
+ // Normalize CFL Grammar
257
+ normalizeCFLGrammar();
258
+
259
+ // Initialize sovler
260
+ solver = new CFLSolver(graph, grammar);
261
+ }
262
+
263
+
264
+ void POCRAlias::buildCFLData()
265
+ {
266
+ // Start building CFLGraph
267
+ double start = stat->getClk(true);
268
+
269
+ CFLDataBuilder cflDataBuilder = CFLDataBuilder(graph);
270
+ _cflData = cflDataBuilder.build();
271
+
272
+ // Get time of build graph
273
+ double end = stat->getClk(true);
274
+ timeOfBuildCFLData += (end - start) / TIMEINTERVAL;
275
+ }
@@ -823,6 +823,11 @@ const Option<bool> Options::CFLSVFG(
823
823
  false
824
824
  );
825
825
 
826
+ const Option<bool> Options::POCRAlias(
827
+ "pocr-alias",
828
+ "When explicit to true, cfl data builder will transfer CFL graph to CFLData.",
829
+ false
830
+ );
826
831
 
827
832
  const Option<bool> Options::LoopAnalysis(
828
833
  "loop-analysis",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.620",
3
+ "version": "1.0.621",
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
@@ -59,6 +59,8 @@ int main(int argc, char ** argv)
59
59
  std::unique_ptr<CFLBase> cfl;
60
60
  if (Options::CFLSVFG())
61
61
  cfl = std::make_unique<CFLVF>(svfir);
62
+ else if (Options::POCRAlias())
63
+ cfl = std::make_unique<POCRAlias>(svfir);
62
64
  else
63
65
  cfl = std::make_unique<CFLAlias>(svfir); // if no svfg is specified, we use CFLAlias as the default one.
64
66
  cfl->analyze();