svf-lib 1.0.992 → 1.0.995

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 (140) hide show
  1. package/SVF-linux/Release-build/lib/libSvf.a +0 -0
  2. package/SVF-linux/include/CFL/CFGNormalizer.h +6 -3
  3. package/SVF-linux/include/CFL/CFLAlias.h +26 -15
  4. package/SVF-linux/include/CFL/CFLGrammar.h +30 -16
  5. package/SVF-linux/include/CFL/CFLSolver.h +9 -5
  6. package/SVF-linux/include/CFL/GrammarBuilder.h +10 -7
  7. package/SVF-linux/include/CUDD/cudd.h +20 -11
  8. package/SVF-linux/include/CUDD/cuddInt.h +48 -31
  9. package/SVF-linux/include/CUDD/epd.h +35 -29
  10. package/SVF-linux/include/CUDD/mtr.h +4 -3
  11. package/SVF-linux/include/CUDD/st.h +7 -4
  12. package/SVF-linux/include/CUDD/util.h +6 -6
  13. package/SVF-linux/include/FastCluster/fastcluster.h +13 -12
  14. package/SVF-linux/include/Graphs/CFLGraph.h +16 -10
  15. package/SVF-linux/include/Graphs/CHG.h +2 -2
  16. package/SVF-linux/include/Graphs/ConsG.h +2 -1
  17. package/SVF-linux/include/Graphs/GenericGraph.h +3 -3
  18. package/SVF-linux/include/Graphs/ICFG.h +2 -2
  19. package/SVF-linux/include/Graphs/ICFGEdge.h +16 -9
  20. package/SVF-linux/include/Graphs/ICFGNode.h +2 -2
  21. package/SVF-linux/include/Graphs/IRGraph.h +10 -6
  22. package/SVF-linux/include/Graphs/PTACallGraph.h +1 -1
  23. package/SVF-linux/include/Graphs/SVFG.h +4 -3
  24. package/SVF-linux/include/Graphs/SVFGNode.h +14 -8
  25. package/SVF-linux/include/Graphs/ThreadCallGraph.h +4 -2
  26. package/SVF-linux/include/Graphs/VFG.h +45 -39
  27. package/SVF-linux/include/Graphs/VFGNode.h +8 -4
  28. package/SVF-linux/include/MSSA/MemSSA.h +1 -1
  29. package/SVF-linux/include/MTA/FSMPTA.h +55 -44
  30. package/SVF-linux/include/MTA/LockAnalysis.h +11 -9
  31. package/SVF-linux/include/MTA/LockResultValidator.h +64 -54
  32. package/SVF-linux/include/MTA/MHP.h +17 -13
  33. package/SVF-linux/include/MTA/MTAResultValidator.h +24 -20
  34. package/SVF-linux/include/MTA/PCG.h +9 -7
  35. package/SVF-linux/include/MTA/TCT.h +27 -22
  36. package/SVF-linux/include/MemoryModel/LocationSet.h +5 -3
  37. package/SVF-linux/include/MemoryModel/PersistentPointsToCache.h +28 -13
  38. package/SVF-linux/include/MemoryModel/PersistentPointsToDS.h +2 -2
  39. package/SVF-linux/include/MemoryModel/PointerAnalysis.h +5 -4
  40. package/SVF-linux/include/MemoryModel/PointsTo.h +8 -2
  41. package/SVF-linux/include/MemoryModel/SVFIR.h +6 -5
  42. package/SVF-linux/include/MemoryModel/SVFStatements.h +65 -45
  43. package/SVF-linux/include/MemoryModel/SVFVariables.h +6 -5
  44. package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +18 -15
  45. package/SVF-linux/include/SABER/PathCondAllocator.h +14 -7
  46. package/SVF-linux/include/SABER/ProgSlice.h +2 -1
  47. package/SVF-linux/include/SABER/SaberSVFGBuilder.h +1 -1
  48. package/SVF-linux/include/SABER/SrcSnkDDA.h +8 -4
  49. package/SVF-linux/include/SVF-FE/CHGBuilder.h +4 -2
  50. package/SVF-linux/include/SVF-FE/DataFlowUtil.h +10 -9
  51. package/SVF-linux/include/SVF-FE/IRAnnotator.h +8 -8
  52. package/SVF-linux/include/SVF-FE/LLVMModule.h +13 -12
  53. package/SVF-linux/include/SVF-FE/LLVMUtil.h +4 -4
  54. package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +13 -9
  55. package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +3 -2
  56. package/SVF-linux/include/Util/BDDExpr.h +32 -16
  57. package/SVF-linux/include/Util/BasicTypes.h +77 -25
  58. package/SVF-linux/include/Util/CoreBitVector.h +2 -1
  59. package/SVF-linux/include/Util/CxtStmt.h +37 -27
  60. package/SVF-linux/include/Util/ExeState.h +42 -22
  61. package/SVF-linux/include/Util/ExtAPI.h +1 -1
  62. package/SVF-linux/include/Util/NodeIDAllocator.h +7 -4
  63. package/SVF-linux/include/Util/Options.h +3 -3
  64. package/SVF-linux/include/Util/SVFBasicTypes.h +49 -40
  65. package/SVF-linux/include/Util/SVFModule.h +5 -5
  66. package/SVF-linux/include/Util/SVFUtil.h +12 -9
  67. package/SVF-linux/include/Util/Z3Expr.h +191 -144
  68. package/SVF-linux/include/WPA/Andersen.h +11 -11
  69. package/SVF-linux/include/WPA/VersionedFlowSensitive.h +4 -1
  70. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  71. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  72. package/SVF-osx/include/CFL/CFGNormalizer.h +6 -3
  73. package/SVF-osx/include/CFL/CFLAlias.h +26 -15
  74. package/SVF-osx/include/CFL/CFLGrammar.h +30 -16
  75. package/SVF-osx/include/CFL/CFLSolver.h +9 -5
  76. package/SVF-osx/include/CFL/GrammarBuilder.h +10 -7
  77. package/SVF-osx/include/CUDD/cudd.h +20 -11
  78. package/SVF-osx/include/CUDD/cuddInt.h +48 -31
  79. package/SVF-osx/include/CUDD/epd.h +35 -29
  80. package/SVF-osx/include/CUDD/mtr.h +4 -3
  81. package/SVF-osx/include/CUDD/st.h +7 -4
  82. package/SVF-osx/include/CUDD/util.h +6 -6
  83. package/SVF-osx/include/FastCluster/fastcluster.h +13 -12
  84. package/SVF-osx/include/Graphs/CFLGraph.h +16 -10
  85. package/SVF-osx/include/Graphs/CHG.h +2 -2
  86. package/SVF-osx/include/Graphs/ConsG.h +2 -1
  87. package/SVF-osx/include/Graphs/GenericGraph.h +3 -3
  88. package/SVF-osx/include/Graphs/ICFG.h +2 -2
  89. package/SVF-osx/include/Graphs/ICFGEdge.h +16 -9
  90. package/SVF-osx/include/Graphs/ICFGNode.h +2 -2
  91. package/SVF-osx/include/Graphs/IRGraph.h +10 -6
  92. package/SVF-osx/include/Graphs/PTACallGraph.h +1 -1
  93. package/SVF-osx/include/Graphs/SVFG.h +4 -3
  94. package/SVF-osx/include/Graphs/SVFGNode.h +14 -8
  95. package/SVF-osx/include/Graphs/ThreadCallGraph.h +4 -2
  96. package/SVF-osx/include/Graphs/VFG.h +45 -39
  97. package/SVF-osx/include/Graphs/VFGNode.h +8 -4
  98. package/SVF-osx/include/MSSA/MemSSA.h +1 -1
  99. package/SVF-osx/include/MTA/FSMPTA.h +55 -44
  100. package/SVF-osx/include/MTA/LockAnalysis.h +11 -9
  101. package/SVF-osx/include/MTA/LockResultValidator.h +64 -54
  102. package/SVF-osx/include/MTA/MHP.h +17 -13
  103. package/SVF-osx/include/MTA/MTAResultValidator.h +24 -20
  104. package/SVF-osx/include/MTA/PCG.h +9 -7
  105. package/SVF-osx/include/MTA/TCT.h +27 -22
  106. package/SVF-osx/include/MemoryModel/LocationSet.h +5 -3
  107. package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +28 -13
  108. package/SVF-osx/include/MemoryModel/PersistentPointsToDS.h +2 -2
  109. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +5 -4
  110. package/SVF-osx/include/MemoryModel/PointsTo.h +8 -2
  111. package/SVF-osx/include/MemoryModel/SVFIR.h +6 -5
  112. package/SVF-osx/include/MemoryModel/SVFStatements.h +65 -45
  113. package/SVF-osx/include/MemoryModel/SVFVariables.h +6 -5
  114. package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +18 -15
  115. package/SVF-osx/include/SABER/PathCondAllocator.h +14 -7
  116. package/SVF-osx/include/SABER/ProgSlice.h +2 -1
  117. package/SVF-osx/include/SABER/SaberSVFGBuilder.h +1 -1
  118. package/SVF-osx/include/SABER/SrcSnkDDA.h +8 -4
  119. package/SVF-osx/include/SVF-FE/CHGBuilder.h +4 -2
  120. package/SVF-osx/include/SVF-FE/DataFlowUtil.h +10 -9
  121. package/SVF-osx/include/SVF-FE/IRAnnotator.h +8 -8
  122. package/SVF-osx/include/SVF-FE/LLVMModule.h +13 -12
  123. package/SVF-osx/include/SVF-FE/LLVMUtil.h +4 -4
  124. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +13 -9
  125. package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +3 -2
  126. package/SVF-osx/include/Util/BDDExpr.h +32 -16
  127. package/SVF-osx/include/Util/BasicTypes.h +77 -25
  128. package/SVF-osx/include/Util/CoreBitVector.h +2 -1
  129. package/SVF-osx/include/Util/CxtStmt.h +37 -27
  130. package/SVF-osx/include/Util/ExeState.h +42 -22
  131. package/SVF-osx/include/Util/ExtAPI.h +1 -1
  132. package/SVF-osx/include/Util/NodeIDAllocator.h +7 -4
  133. package/SVF-osx/include/Util/Options.h +3 -3
  134. package/SVF-osx/include/Util/SVFBasicTypes.h +49 -40
  135. package/SVF-osx/include/Util/SVFModule.h +5 -5
  136. package/SVF-osx/include/Util/SVFUtil.h +12 -9
  137. package/SVF-osx/include/Util/Z3Expr.h +191 -144
  138. package/SVF-osx/include/WPA/Andersen.h +11 -11
  139. package/SVF-osx/include/WPA/VersionedFlowSensitive.h +4 -1
  140. package/package.json +1 -1
@@ -81,13 +81,16 @@ public:
81
81
  ~CFLGraph() override = default;
82
82
 
83
83
  /// Build graph by copying nodes and edges from any graph inherited from GenericGraph
84
- template<class N, class E>
85
- void build(GenericGraph<N,E>* graph){
86
- for(auto it = graph->begin(); it!= graph->end(); it++){
84
+ template<class N, class E>
85
+ void build(GenericGraph<N,E>* graph)
86
+ {
87
+ for(auto it = graph->begin(); it!= graph->end(); it++)
88
+ {
87
89
  CFLNode* node = new CFLNode((*it).first);
88
90
  addCFLNode((*it).first, node);
89
91
  }
90
- for(auto it = graph->begin(); it!= graph->end(); it++){
92
+ for(auto it = graph->begin(); it!= graph->end(); it++)
93
+ {
91
94
  N* node = (*it).second;
92
95
  for(E* edge : node->getOutEdges())
93
96
  {
@@ -97,18 +100,21 @@ public:
97
100
  }
98
101
 
99
102
  /// Build Bidirectional graph by copying nodes and edges from any graph inherited from GenericGraph
100
- template<class N, class E>
101
- void buildBigraph(GenericGraph<N,E>* graph){
102
- for(auto it = graph->begin(); it!= graph->end(); it++){
103
+ template<class N, class E>
104
+ void buildBigraph(GenericGraph<N,E>* graph)
105
+ {
106
+ for(auto it = graph->begin(); it!= graph->end(); it++)
107
+ {
103
108
  CFLNode* node = new CFLNode((*it).first);
104
109
  addCFLNode((*it).first, node);
105
110
  }
106
- for(auto it = graph->begin(); it!= graph->end(); it++){
111
+ for(auto it = graph->begin(); it!= graph->end(); it++)
112
+ {
107
113
  N* node = (*it).second;
108
114
  for(E* edge : node->getOutEdges())
109
115
  {
110
116
  addCFLEdge(getGNode(edge->getSrcID()), getGNode(edge->getDstID()), edge->getEdgeKind());
111
- std::string key = "";
117
+ std::string key = "";
112
118
  for (auto &i : this->label2SymMap)
113
119
  {
114
120
  if (i.second == edge->getEdgeKind())
@@ -134,7 +140,7 @@ public:
134
140
 
135
141
  /// Build graph from file
136
142
  void build(std::string filename);
137
-
143
+
138
144
  /// Build graph from Dot
139
145
  void buildFromDot(std::string filename);
140
146
 
@@ -25,7 +25,7 @@
25
25
  *
26
26
  * Created on: Apr 13, 2016
27
27
  * Author: Xiaokang Fan
28
- *
28
+ *
29
29
  * Created on: Aug 24, 2019
30
30
  * Author: Mohamad Barbar
31
31
  */
@@ -207,7 +207,7 @@ private:
207
207
  typedef GenericGraph<CHNode,CHEdge> GenericCHGraphTy;
208
208
  class CHGraph: public CommonCHGraph, public GenericCHGraphTy
209
209
  {
210
- friend class CHGBuilder;
210
+ friend class CHGBuilder;
211
211
 
212
212
  public:
213
213
  typedef Set<const CHNode*> CHNodeSetTy;
@@ -166,7 +166,8 @@ public:
166
166
  auto eit = LoadCGEdgeSet.find(&edge);
167
167
  return *eit;
168
168
  }
169
- else{
169
+ else
170
+ {
170
171
  assert(false && "no other kind!");
171
172
  return nullptr;
172
173
  }
@@ -157,8 +157,8 @@ public:
157
157
  /// Destructor
158
158
  virtual ~GenericNode()
159
159
  {
160
- for (auto * edge : OutEdges)
161
- delete edge;
160
+ for (auto * edge : OutEdges)
161
+ delete edge;
162
162
  }
163
163
 
164
164
  /// Get ID
@@ -354,7 +354,7 @@ public:
354
354
  void destroy()
355
355
  {
356
356
  for (auto &entry : IDToNodeMap)
357
- delete entry.second;
357
+ delete entry.second;
358
358
  }
359
359
  /// Iterators
360
360
  //@{
@@ -46,7 +46,7 @@ typedef GenericGraph<ICFGNode,ICFGEdge> GenericICFGTy;
46
46
  class ICFG : public GenericICFGTy
47
47
  {
48
48
 
49
- friend class ICFGBuilder;
49
+ friend class ICFGBuilder;
50
50
 
51
51
  public:
52
52
 
@@ -182,7 +182,7 @@ public:
182
182
  //@}
183
183
 
184
184
  private:
185
-
185
+
186
186
  /// Get/Add IntraBlock ICFGNode
187
187
  inline IntraICFGNode* getIntraBlock(const Instruction* inst)
188
188
  {
@@ -134,16 +134,19 @@ public:
134
134
  }
135
135
  //@}
136
136
 
137
- const Value* getCondition() const{
137
+ const Value* getCondition() const
138
+ {
138
139
  return conditionVar;
139
140
  }
140
141
 
141
- s32_t getSuccessorCondValue() const{
142
+ s32_t getSuccessorCondValue() const
143
+ {
142
144
  assert(getCondition() && "this is not a conditional branch edge");
143
145
  return branchCondVal;
144
146
  }
145
147
 
146
- void setBranchCondition(const Value* c, s32_t bVal){
148
+ void setBranchCondition(const Value* c, s32_t bVal)
149
+ {
147
150
  conditionVar = c;
148
151
  branchCondVal = bVal;
149
152
  }
@@ -166,7 +169,7 @@ class CallCFGEdge : public ICFGEdge
166
169
  {
167
170
 
168
171
  private:
169
- const Instruction* cs;
172
+ const Instruction* cs;
170
173
  std::vector<const CallPE*> callPEs;
171
174
  public:
172
175
  /// Constructor
@@ -180,11 +183,13 @@ public:
180
183
  return cs;
181
184
  }
182
185
  /// Add call parameter edge to this CallCFGEdge
183
- inline void addCallPE(const CallPE* callPE){
186
+ inline void addCallPE(const CallPE* callPE)
187
+ {
184
188
  callPEs.push_back(callPE);
185
189
  }
186
190
  /// Add get parameter edge to this CallCFGEdge
187
- inline const std::vector<const CallPE*>& getCallPEs() const{
191
+ inline const std::vector<const CallPE*>& getCallPEs() const
192
+ {
188
193
  return callPEs;
189
194
  }
190
195
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -212,7 +217,7 @@ class RetCFGEdge : public ICFGEdge
212
217
  {
213
218
 
214
219
  private:
215
- const Instruction* cs;
220
+ const Instruction* cs;
216
221
  const RetPE* retPE;
217
222
  public:
218
223
  /// Constructor
@@ -226,12 +231,14 @@ public:
226
231
  return cs;
227
232
  }
228
233
  /// Add call parameter edge to this CallCFGEdge
229
- inline void addRetPE(const RetPE* ret){
234
+ inline void addRetPE(const RetPE* ret)
235
+ {
230
236
  assert(retPE==nullptr && "we can only have one retPE for each RetCFGEdge");
231
237
  retPE = ret;
232
238
  }
233
239
  /// Add get parameter edge to this CallCFGEdge
234
- inline const RetPE* getRetPE() const{
240
+ inline const RetPE* getRetPE() const
241
+ {
235
242
  return retPE;
236
243
  }
237
244
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -145,7 +145,7 @@ class GlobalICFGNode : public ICFGNode
145
145
  public:
146
146
  GlobalICFGNode(NodeID id) : ICFGNode(id, GlobalBlock)
147
147
  {
148
- bb = nullptr;
148
+ bb = nullptr;
149
149
  }
150
150
 
151
151
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -385,7 +385,7 @@ public:
385
385
  /// Return callsite
386
386
  inline const RetICFGNode* getRetICFGNode() const
387
387
  {
388
- assert(ret && "RetICFGNode not set?");
388
+ assert(ret && "RetICFGNode not set?");
389
389
  return ret;
390
390
  }
391
391
 
@@ -21,7 +21,7 @@
21
21
  //===----------------------------------------------------------------------===//
22
22
 
23
23
  /*
24
- * IRGraph.h
24
+ * IRGraph.h
25
25
  *
26
26
  * Created on: Nov 1, 2013
27
27
  * Author: Yulei Sui
@@ -81,17 +81,20 @@ protected:
81
81
  inline void mapValueToEdge(const Value *V, SVFStmt *edge)
82
82
  {
83
83
  auto inserted = valueToEdgeMap.emplace(V, SVFStmtSet{edge});
84
- if (!inserted.second) {
84
+ if (!inserted.second)
85
+ {
85
86
  inserted.first->second.emplace(edge);
86
87
  }
87
88
  }
88
89
  /// get MemObj according to LLVM value
89
- inline const MemObj* getMemObj(const Value* val) const{
90
+ inline const MemObj* getMemObj(const Value* val) const
91
+ {
90
92
  return symInfo->getObj(symInfo->getObjSym(val));
91
93
  }
92
-
94
+
93
95
  public:
94
- IRGraph(bool buildFromFile): fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0){
96
+ IRGraph(bool buildFromFile): fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0)
97
+ {
95
98
  symInfo = SymbolTableInfo::SymbolInfo();
96
99
  // insert dummy value if a correct value cannot be found
97
100
  valueToEdgeMap[nullptr] = SVFStmtSet();
@@ -108,7 +111,8 @@ public:
108
111
  inline const SVFStmtSet& getValueEdges(const Value *V)
109
112
  {
110
113
  auto it = valueToEdgeMap.find(V);
111
- if (it == valueToEdgeMap.end()) {
114
+ if (it == valueToEdgeMap.end())
115
+ {
112
116
  //special empty set
113
117
  return valueToEdgeMap.at(nullptr);
114
118
  }
@@ -322,7 +322,7 @@ public:
322
322
  assert(it!=funToCallGraphNodeMap.end() && "call graph node not found!!");
323
323
  return it->second;
324
324
  }
325
-
325
+
326
326
  //@}
327
327
 
328
328
  /// Add/Get CallSiteID
@@ -251,7 +251,8 @@ public:
251
251
  }
252
252
 
253
253
  /// Return total SVFG node number
254
- inline u32_t getSVFGNodeNum() const {
254
+ inline u32_t getSVFGNodeNum() const
255
+ {
255
256
  return nodeNum;
256
257
  }
257
258
 
@@ -428,8 +429,8 @@ protected:
428
429
  }
429
430
 
430
431
  /// Add memory SSA PHI SVFG node
431
- inline void addIntraMSSAPHISVFGNode(ICFGNode* BlockICFGNode, const Map<u32_t,const MRVer*>::const_iterator opVerBegin,
432
- const Map<u32_t,const MRVer*>::const_iterator opVerEnd, const MRVer* resVer, const NodeID nodeId)
432
+ inline void addIntraMSSAPHISVFGNode(ICFGNode* BlockICFGNode, const Map<u32_t,const MRVer*>::const_iterator opVerBegin,
433
+ const Map<u32_t,const MRVer*>::const_iterator opVerEnd, const MRVer* resVer, const NodeID nodeId)
433
434
  {
434
435
  IntraMSSAPHISVFGNode* sNode = new IntraMSSAPHISVFGNode(nodeId, resVer);
435
436
  addSVFGNode(sNode, BlockICFGNode);
@@ -94,7 +94,7 @@ class FormalINSVFGNode : public MRSVFGNode
94
94
  {
95
95
  private:
96
96
  const MRVer* ver;
97
- const FunEntryICFGNode* funEntryNode;
97
+ const FunEntryICFGNode* funEntryNode;
98
98
 
99
99
  public:
100
100
  /// Constructor
@@ -102,7 +102,7 @@ public:
102
102
  {
103
103
  cpts = resVer->getMR()->getPointsTo();
104
104
  ver = resVer;
105
- funEntryNode = funEntry;
105
+ funEntryNode = funEntry;
106
106
  }
107
107
  inline const MRVer* getMRVer() const
108
108
  {
@@ -139,7 +139,7 @@ class FormalOUTSVFGNode : public MRSVFGNode
139
139
  {
140
140
  private:
141
141
  const MRVer* ver;
142
- const FunExitICFGNode* funExitNode;
142
+ const FunExitICFGNode* funExitNode;
143
143
 
144
144
  public:
145
145
  /// Constructor
@@ -279,7 +279,7 @@ public:
279
279
  typedef Map<u32_t,const MRVer*> OPVers;
280
280
 
281
281
  protected:
282
- const MRVer* ver;
282
+ const MRVer* ver;
283
283
  OPVers opVers;
284
284
 
285
285
  public:
@@ -287,9 +287,9 @@ public:
287
287
  MSSAPHISVFGNode(NodeID id, const MRVer* resVer,VFGNodeK k = MPhi): MRSVFGNode(id, k)
288
288
  {
289
289
  cpts = resVer->getMR()->getPointsTo();
290
- ver = resVer;
290
+ ver = resVer;
291
291
  }
292
- /// Ver
292
+ /// Ver
293
293
  inline const MRVer* getResVer() const
294
294
  {
295
295
  return ver;
@@ -473,8 +473,14 @@ public:
473
473
  : VFGNode(id, DummyVProp), object(object), version(version)
474
474
  { }
475
475
 
476
- NodeID getObject(void) const { return object; }
477
- Version getVersion(void) const { return version; }
476
+ NodeID getObject(void) const
477
+ {
478
+ return object;
479
+ }
480
+ Version getVersion(void) const
481
+ {
482
+ return version;
483
+ }
478
484
 
479
485
  /// Methods to support type inquiry through isa, cast, and dyn_cast:
480
486
  //@{
@@ -67,7 +67,8 @@ public:
67
67
  }
68
68
  //@}
69
69
 
70
- virtual const std::string toString() const {
70
+ virtual const std::string toString() const
71
+ {
71
72
  std::string str;
72
73
  raw_string_ostream rawstr(str);
73
74
  rawstr << "ThreadForkEdge ";
@@ -106,7 +107,8 @@ public:
106
107
  return edge->getEdgeKind() == PTACallGraphEdge::TDJoinEdge;
107
108
  }
108
109
 
109
- virtual const std::string toString() const {
110
+ virtual const std::string toString() const
111
+ {
110
112
  std::string str;
111
113
  raw_string_ostream rawstr(str);
112
114
  rawstr << "ThreadJoinEdge ";
@@ -281,28 +281,33 @@ public:
281
281
  return false;
282
282
  }
283
283
 
284
- /// Return all the VFGNodes of a function
285
- ///@{
286
- inline VFGNodeSet& getVFGNodes(const SVFFunction *fun) {
287
- return funToVFGNodesMap[fun];
288
- }
289
- inline bool hasVFGNodes(const SVFFunction *fun) const {
290
- return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
291
- }
292
- inline bool VFGNodes(const SVFFunction *fun) const {
293
- return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
294
- }
295
- inline VFGNodeSet::const_iterator getVFGNodeBegin(const SVFFunction *fun) const {
296
- FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
297
- assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
298
- return it->second.begin();
299
- }
300
- inline VFGNodeSet::const_iterator getVFGNodeEnd(const SVFFunction *fun) const {
301
- FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
302
- assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
303
- return it->second.end();
304
- }
305
- ///@}
284
+ /// Return all the VFGNodes of a function
285
+ ///@{
286
+ inline VFGNodeSet& getVFGNodes(const SVFFunction *fun)
287
+ {
288
+ return funToVFGNodesMap[fun];
289
+ }
290
+ inline bool hasVFGNodes(const SVFFunction *fun) const
291
+ {
292
+ return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
293
+ }
294
+ inline bool VFGNodes(const SVFFunction *fun) const
295
+ {
296
+ return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
297
+ }
298
+ inline VFGNodeSet::const_iterator getVFGNodeBegin(const SVFFunction *fun) const
299
+ {
300
+ FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
301
+ assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
302
+ return it->second.begin();
303
+ }
304
+ inline VFGNodeSet::const_iterator getVFGNodeEnd(const SVFFunction *fun) const
305
+ {
306
+ FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
307
+ assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
308
+ return it->second.end();
309
+ }
310
+ ///@}
306
311
  /// Add control-flow edges for top level pointers
307
312
  //@{
308
313
  VFGEdge* addIntraDirectVFEdge(NodeID srcId, NodeID dstId);
@@ -462,9 +467,9 @@ protected:
462
467
  icfgNode->addVFGNode(vfgNode);
463
468
 
464
469
  if(const SVFFunction* fun = icfgNode->getFun())
465
- funToVFGNodesMap[fun].insert(vfgNode);
470
+ funToVFGNodesMap[fun].insert(vfgNode);
466
471
  else
467
- globalVFGNodes.insert(vfgNode);
472
+ globalVFGNodes.insert(vfgNode);
468
473
  }
469
474
 
470
475
  /// Add a VFG node for program statement
@@ -545,20 +550,21 @@ protected:
545
550
  /// Otherwise, we need to handle formalRet using <PAGNodeID,CallSiteID> pair to find FormalRetVFG node same as handling actual parameters
546
551
  inline void addFormalRetVFGNode(const PAGNode* uniqueFunRet, const SVFFunction* fun, RetPESet& retPEs)
547
552
  {
548
- FormalRetVFGNode *sNode = new FormalRetVFGNode(totalVFGNode++, uniqueFunRet, fun);
549
- addVFGNode(sNode, pag->getICFG()->getFunExitICFGNode(fun));
550
- for (RetPESet::const_iterator it = retPEs.begin(), eit = retPEs.end(); it != eit; ++it)
551
- sNode->addRetPE(*it);
552
-
553
- PAGNodeToFormalRetMap[uniqueFunRet] = sNode;
554
- /// if this uniqueFunRet is a phi node, which means it will receive values from multiple return instructions of fun
555
- /// we will set this phi node's def later
556
- /// Ideally, every function uniqueFunRet should be a PhiNode (SVFIRBuilder.cpp), unless it does not have ret instruction
557
- if (!pag->isPhiNode(uniqueFunRet)){
558
- std::string warn = fun->getName();
559
- SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
560
- setDef(uniqueFunRet, sNode);
561
- }
553
+ FormalRetVFGNode *sNode = new FormalRetVFGNode(totalVFGNode++, uniqueFunRet, fun);
554
+ addVFGNode(sNode, pag->getICFG()->getFunExitICFGNode(fun));
555
+ for (RetPESet::const_iterator it = retPEs.begin(), eit = retPEs.end(); it != eit; ++it)
556
+ sNode->addRetPE(*it);
557
+
558
+ PAGNodeToFormalRetMap[uniqueFunRet] = sNode;
559
+ /// if this uniqueFunRet is a phi node, which means it will receive values from multiple return instructions of fun
560
+ /// we will set this phi node's def later
561
+ /// Ideally, every function uniqueFunRet should be a PhiNode (SVFIRBuilder.cpp), unless it does not have ret instruction
562
+ if (!pag->isPhiNode(uniqueFunRet))
563
+ {
564
+ std::string warn = fun->getName();
565
+ SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
566
+ setDef(uniqueFunRet, sNode);
567
+ }
562
568
  }
563
569
  /// Add a callsite Receive VFG node
564
570
  inline void addActualRetVFGNode(const PAGNode* ret,const CallICFGNode* cs)
@@ -619,7 +625,7 @@ protected:
619
625
  setDef(edge->getRes(),sNode);
620
626
  PAGNodeToUnaryOPVFGNodeMap[edge->getRes()] = sNode;
621
627
  }
622
- /// Add a BranchVFGNode
628
+ /// Add a BranchVFGNode
623
629
  inline void addBranchVFGNode(const BranchStmt* edge)
624
630
  {
625
631
  BranchVFGNode* sNode = new BranchVFGNode(totalVFGNode++, edge);
@@ -563,18 +563,22 @@ public:
563
563
  //@}
564
564
 
565
565
  /// Return the branch statement
566
- const BranchStmt* getBranchStmt() const{
566
+ const BranchStmt* getBranchStmt() const
567
+ {
567
568
  return brstmt;
568
569
  }
569
570
  /// Successors of this branch statement
570
571
  ///@{
571
- u32_t getNumSuccessors() const{
572
+ u32_t getNumSuccessors() const
573
+ {
572
574
  return brstmt->getNumSuccessors();
573
575
  }
574
- const BranchStmt::SuccAndCondPairVec& getSuccessors() const{
576
+ const BranchStmt::SuccAndCondPairVec& getSuccessors() const
577
+ {
575
578
  return brstmt->getSuccessors();
576
579
  }
577
- const ICFGNode* getSuccessor (u32_t i) const{
580
+ const ICFGNode* getSuccessor (u32_t i) const
581
+ {
578
582
  return brstmt->getSuccessor(i);
579
583
  }
580
584
  ///@}
@@ -343,7 +343,7 @@ public:
343
343
  inline bool hasCHI(const PAGEdge* inst) const
344
344
  {
345
345
  if (const StoreStmt* store = SVFUtil::dyn_cast<StoreStmt>(
346
- inst))
346
+ inst))
347
347
  {
348
348
  assert(0 != store2ChiSetMap.count(store)
349
349
  && "not associated with mem region!");
@@ -22,40 +22,48 @@ class MHP;
22
22
  class LockAnalysis;
23
23
 
24
24
 
25
- class SVFGNodeLockSpan {
25
+ class SVFGNodeLockSpan
26
+ {
26
27
  public:
27
- SVFGNodeLockSpan(const StmtSVFGNode* SVFGnode, LockAnalysis::LockSpan lockspan) :
28
- SVFGNode(SVFGnode), lockSpan(lockspan) {}
29
- virtual ~SVFGNodeLockSpan() {}
30
-
31
- inline bool operator< (const SVFGNodeLockSpan& rhs) const {
32
- if (SVFGNode != rhs.getSVFGNode())
33
- return SVFGNode < rhs.getSVFGNode();
34
- return lockSpan.size() < rhs.getLockSpan().size();
35
- }
36
- inline SVFGNodeLockSpan& operator= (const SVFGNodeLockSpan& rhs) {
37
- if(*this != rhs) {
38
- SVFGNode = rhs.getSVFGNode();
39
- lockSpan = rhs.getLockSpan();
40
- }
41
- return *this;
42
- }
43
- inline bool operator== (const SVFGNodeLockSpan& rhs) const {
44
- return (SVFGNode == rhs.getSVFGNode() && lockSpan == rhs.getLockSpan());
45
- }
46
- inline bool operator!= (const SVFGNodeLockSpan& rhs) const {
47
- return !(*this == rhs);
48
- }
49
- inline const StmtSVFGNode* getSVFGNode() const {
50
- return SVFGNode;
51
- }
52
- inline const LockAnalysis::LockSpan getLockSpan() const {
53
- return lockSpan;
54
- }
28
+ SVFGNodeLockSpan(const StmtSVFGNode* SVFGnode, LockAnalysis::LockSpan lockspan) :
29
+ SVFGNode(SVFGnode), lockSpan(lockspan) {}
30
+ virtual ~SVFGNodeLockSpan() {}
31
+
32
+ inline bool operator< (const SVFGNodeLockSpan& rhs) const
33
+ {
34
+ if (SVFGNode != rhs.getSVFGNode())
35
+ return SVFGNode < rhs.getSVFGNode();
36
+ return lockSpan.size() < rhs.getLockSpan().size();
37
+ }
38
+ inline SVFGNodeLockSpan& operator= (const SVFGNodeLockSpan& rhs)
39
+ {
40
+ if(*this != rhs)
41
+ {
42
+ SVFGNode = rhs.getSVFGNode();
43
+ lockSpan = rhs.getLockSpan();
44
+ }
45
+ return *this;
46
+ }
47
+ inline bool operator== (const SVFGNodeLockSpan& rhs) const
48
+ {
49
+ return (SVFGNode == rhs.getSVFGNode() && lockSpan == rhs.getLockSpan());
50
+ }
51
+ inline bool operator!= (const SVFGNodeLockSpan& rhs) const
52
+ {
53
+ return !(*this == rhs);
54
+ }
55
+ inline const StmtSVFGNode* getSVFGNode() const
56
+ {
57
+ return SVFGNode;
58
+ }
59
+ inline const LockAnalysis::LockSpan getLockSpan() const
60
+ {
61
+ return lockSpan;
62
+ }
55
63
  private:
56
- const StmtSVFGNode* SVFGNode;
57
- LockAnalysis::LockSpan lockSpan;
58
- };
64
+ const StmtSVFGNode* SVFGNode;
65
+ LockAnalysis::LockSpan lockSpan;
66
+ };
59
67
 
60
68
  /*!
61
69
  * SVFG builder for DDA
@@ -73,7 +81,7 @@ public:
73
81
  typedef Set<const Instruction*> InstSet;
74
82
  typedef std::pair<NodeID,NodeID> NodeIDPair;
75
83
  typedef Map<SVFGNodeLockSpan, bool> PairToBoolMap;
76
-
84
+
77
85
  /// Constructor
78
86
  MTASVFGBuilder(MHP* m, LockAnalysis* la) : SVFGBuilder(), mhp(m), lockana(la)
79
87
  {
@@ -183,11 +191,12 @@ public:
183
191
 
184
192
  /// Initialize analysis
185
193
  void initialize(SVFModule* module);
186
-
187
- inline SVFIR* getPAG() {
188
- return mhp->getTCT()->getPTA()->getPAG();
189
- }
190
-
194
+
195
+ inline SVFIR* getPAG()
196
+ {
197
+ return mhp->getTCT()->getPTA()->getPAG();
198
+ }
199
+
191
200
  /// Create signle instance of flow-sensitive pointer analysis
192
201
  static FSMPTA* createFSMPTA(SVFModule* module, MHP* m, LockAnalysis* la)
193
202
  {
@@ -222,12 +231,14 @@ private:
222
231
 
223
232
  } // End namespace SVF
224
233
 
225
- template <> struct std::hash<SVF::SVFGNodeLockSpan> {
226
- size_t operator()(const SVF::SVFGNodeLockSpan &cs) const {
227
- std::hash<SVF::StmtSVFGNode* >h;
228
- SVF::StmtSVFGNode* node = const_cast<SVF::StmtSVFGNode* > (cs.getSVFGNode());
229
- return h(node);
230
- }
234
+ template <> struct std::hash<SVF::SVFGNodeLockSpan>
235
+ {
236
+ size_t operator()(const SVF::SVFGNodeLockSpan &cs) const
237
+ {
238
+ std::hash<SVF::StmtSVFGNode* >h;
239
+ SVF::StmtSVFGNode* node = const_cast<SVF::StmtSVFGNode* > (cs.getSVFGNode());
240
+ return h(node);
241
+ }
231
242
  };
232
243
 
233
244
  #endif /* FSPTANALYSIS_H_ */