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
@@ -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_ */
@@ -224,10 +224,11 @@ public:
224
224
  }
225
225
  return find;
226
226
  }
227
-
228
- CxtStmtToCxtLockSet getCSTCLS() {
229
- return cxtStmtToCxtLockSet;
230
- }
227
+
228
+ CxtStmtToCxtLockSet getCSTCLS()
229
+ {
230
+ return cxtStmtToCxtLockSet;
231
+ }
231
232
  /// Touch this context statement
232
233
  inline void touchCxtStmt(CxtStmt& cts)
233
234
  {
@@ -297,11 +298,12 @@ public:
297
298
  }
298
299
  /// Print locks and spans
299
300
  void printLocks(const CxtStmt& cts);
300
-
301
- /// Get tct
302
- TCT* getTCT() {
303
- return tct;
304
- }
301
+
302
+ /// Get tct
303
+ TCT* getTCT()
304
+ {
305
+ return tct;
306
+ }
305
307
  private:
306
308
  /// Handle fork
307
309
  void handleFork(const CxtStmt& cts);
@@ -13,53 +13,61 @@
13
13
 
14
14
  /* Validate the result of lock analysis */
15
15
 
16
- namespace SVF {
17
- class LockResultValidator {
16
+ namespace SVF
17
+ {
18
+ class LockResultValidator
19
+ {
18
20
  public:
19
- typedef Set<std::string> CxtLockSetStr;
20
- typedef Map<const Instruction*, CxtLockSetStr> CxtStmtToCxtLockS;
21
-
22
- typedef unsigned LOCK_FLAG;
23
-
24
- LockResultValidator(LockAnalysis* la) : _la(la) {
25
- _mod = _la->getTCT()->getSVFModule();
26
- }
27
-
28
- ~LockResultValidator() {}
29
-
30
- void analyze();
31
-
32
- inline SVFModule* getModule() const {
33
- return _mod;
34
- }
21
+ typedef Set<std::string> CxtLockSetStr;
22
+ typedef Map<const Instruction*, CxtLockSetStr> CxtStmtToCxtLockS;
23
+
24
+ typedef unsigned LOCK_FLAG;
25
+
26
+ LockResultValidator(LockAnalysis* la) : _la(la)
27
+ {
28
+ _mod = _la->getTCT()->getSVFModule();
29
+ }
30
+
31
+ ~LockResultValidator() {}
32
+
33
+ void analyze();
34
+
35
+ inline SVFModule* getModule() const
36
+ {
37
+ return _mod;
38
+ }
35
39
  private:
36
- // Get CallICFGNode
37
- inline CallICFGNode* getCBN(const Instruction* inst) {
38
- return _la->getTCT()->getCallICFGNode(inst);
39
- }
40
- const Instruction *getPreviousMemoryAccessInst( const Instruction *I) {
40
+ // Get CallICFGNode
41
+ inline CallICFGNode* getCBN(const Instruction* inst)
42
+ {
43
+ return _la->getTCT()->getCallICFGNode(inst);
44
+ }
45
+ const Instruction *getPreviousMemoryAccessInst( const Instruction *I)
46
+ {
41
47
  I = I->getPrevNode();
42
48
  while (I)
43
49
  {
44
50
  if (SVFUtil::isa<LoadInst>(I) || SVFUtil::isa<StoreInst>(I))
45
51
  return I;
46
52
  SVFFunction* callee = nullptr;
47
-
48
- if(SVFUtil::isa<CallInst> (I)) {
49
- PTACallGraph::FunctionSet callees;
50
- _la->getTCT()->getThreadCallGraph()->getCallees(getCBN(I), callees);
51
-
52
- for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
53
- ecit = callees.end(); cit!=ecit; cit++)
54
- {
55
- if(*cit != nullptr) {
56
- callee = const_cast<SVFFunction*> (*cit);
57
- break;
58
- }
59
-
60
- }
53
+
54
+ if(SVFUtil::isa<CallInst> (I))
55
+ {
56
+ PTACallGraph::FunctionSet callees;
57
+ _la->getTCT()->getThreadCallGraph()->getCallees(getCBN(I), callees);
58
+
59
+ for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
60
+ ecit = callees.end(); cit!=ecit; cit++)
61
+ {
62
+ if(*cit != nullptr)
63
+ {
64
+ callee = const_cast<SVFFunction*> (*cit);
65
+ break;
66
+ }
67
+
68
+ }
61
69
  }
62
-
70
+
63
71
  if (callee)
64
72
  {
65
73
  if (ExtAPI::EFT_L_A0__A0R_A1R == ExtAPI::getExtAPI()->get_type(callee)
@@ -70,39 +78,41 @@ private:
70
78
  }
71
79
  return nullptr;
72
80
  }
73
-
74
- inline bool inFilter(std::string name) {
75
- return filterFun.find(name) != filterFun.end();
81
+
82
+ inline bool inFilter(std::string name)
83
+ {
84
+ return filterFun.find(name) != filterFun.end();
76
85
  }
77
-
78
- inline bool match(std::string lockName, CxtLockSetStr LS) {
79
- return LS.find(lockName) != LS.end();
86
+
87
+ inline bool match(std::string lockName, CxtLockSetStr LS)
88
+ {
89
+ return LS.find(lockName) != LS.end();
80
90
  }
81
-
91
+
82
92
  Set<std::string> &split(const std::string &s, char delim, Set<std::string> &elems);
83
93
  Set<std::string> split(const std::string &s, char delim);
84
-
94
+
85
95
  std::string getOutput(const char* scenario, LOCK_FLAG analysisRes);
86
-
96
+
87
97
  Set<std::string> getStringArg(const Instruction* inst, unsigned int arg_num);
88
-
98
+
89
99
  bool collectLockTargets();
90
100
  LOCK_FLAG validateStmtInLock();
91
-
101
+
92
102
  CxtStmtToCxtLockS instToCxtLockSet;
93
103
  LockAnalysis::CxtStmtToCxtLockSet cxtStmtToCxtLockSet;
94
104
  LockAnalysis::CxtLockSet cxtLockSet;
95
-
105
+
96
106
  LockAnalysis* _la;
97
107
  SVFModule* _mod;
98
-
108
+
99
109
  static const LOCK_FLAG LOCK_TRUE = 0x01;
100
110
  static const LOCK_FLAG LOCK_IMPRECISE = 0x02;
101
111
  static const LOCK_FLAG LOCK_UNSOUND = 0x04;
102
-
112
+
103
113
  static constexpr char const *LOCK = "LOCK";
104
-
114
+
105
115
  Set<std::string> filterFun = {"LOCK", "INTERLEV_ACCESS", "PAUSE", "CXT_THREAD", "TCT_ACCESS"};
106
- };
116
+ };
107
117
  } // End namespace SVF
108
118
  #endif /* LOCKRESULTVALIDATOR_H_ */
@@ -60,11 +60,12 @@ public:
60
60
  {
61
61
  return tct;
62
62
  }
63
-
64
- // Get CallICFGNode
65
- inline CallICFGNode* getCBN(const Instruction* inst) {
66
- return tct->getCallICFGNode(inst);
67
- }
63
+
64
+ // Get CallICFGNode
65
+ inline CallICFGNode* getCBN(const Instruction* inst)
66
+ {
67
+ return tct->getCallICFGNode(inst);
68
+ }
68
69
 
69
70
  /// Whether the function is connected from main function in thread call graph
70
71
  bool isConnectedfromMain(const Function* fun);
@@ -115,11 +116,12 @@ public:
115
116
  void printInterleaving();
116
117
 
117
118
  private:
118
-
119
- inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees) {
119
+
120
+ inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees)
121
+ {
120
122
  tcg->getCallees(getCBN(inst), callees);
121
123
  return callees;
122
- }
124
+ }
123
125
  /// Update non-candidate functions' interleaving.
124
126
  /// Copy interleaving threads of the entry inst to other insts.
125
127
  void updateNonCandidateFunInterleaving();
@@ -380,9 +382,10 @@ private:
380
382
  return tct->getPTA()->alias(getForkedThread(forkSite), getJoinedThread(joinSite)) && isSameSCEV(forkSite,joinSite);
381
383
  }
382
384
  // Get CallICFGNode
383
- inline CallICFGNode* getCBN(const Instruction* inst) {
384
- return tct->getCallICFGNode(inst);
385
- }
385
+ inline CallICFGNode* getCBN(const Instruction* inst)
386
+ {
387
+ return tct->getCallICFGNode(inst);
388
+ }
386
389
  /// Mark thread flags for cxtStmt
387
390
  //@{
388
391
  /// Get the flag for a cxtStmt
@@ -485,10 +488,11 @@ private:
485
488
  {
486
489
  return getTCG()->getThreadAPI()->getJoinedThread(call);
487
490
  }
488
- inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees) {
491
+ inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees)
492
+ {
489
493
  getTCG()->getCallees(getCBN(inst), callees);
490
494
  return callees;
491
- }
495
+ }
492
496
  /// ThreadCallGraph
493
497
  inline ThreadCallGraph* getTCG() const
494
498
  {
@@ -14,9 +14,10 @@
14
14
  * Validate the result of context-sensitive analysis, including context-sensitive
15
15
  * thread detection and thread interleaving.
16
16
  */
17
- namespace SVF{
18
- typedef unsigned NodeID;
19
-
17
+ namespace SVF
18
+ {
19
+ typedef unsigned NodeID;
20
+
20
21
  class MTAResultValidator
21
22
  {
22
23
 
@@ -36,9 +37,10 @@ public:
36
37
 
37
38
  // Analysis
38
39
  void analyze();
39
- inline SVFModule* getModule() const {
40
- return mod;
41
- }
40
+ inline SVFModule* getModule() const
41
+ {
42
+ return mod;
43
+ }
42
44
  protected:
43
45
 
44
46
  /*
@@ -132,12 +134,12 @@ private:
132
134
  ThreadAPI* tdAPI;
133
135
  ThreadCallGraph* tcg;
134
136
  MHP* mhp;
135
- vthdToCxtMap vthdToCxt;
136
- vthdTorthdMap vthdTorthd;
137
- rthdTovthdMap rthdTovthd;
138
- csnumToInst csnumToInstMap;
139
- rthdToChildrenMap rthdToChildren;
140
- SVFModule* mod;
137
+ vthdToCxtMap vthdToCxt;
138
+ vthdTorthdMap vthdTorthd;
139
+ rthdTovthdMap rthdTovthd;
140
+ csnumToInst csnumToInstMap;
141
+ rthdToChildrenMap rthdToChildren;
142
+ SVFModule* mod;
141
143
  /// Constant INTERLEV_FLAG values
142
144
  //@{
143
145
  static const INTERLEV_FLAG INTERLEV_TRUE = 0x01;
@@ -274,13 +276,15 @@ protected:
274
276
  // Collect call sites of all RC_ACCESS function calls.
275
277
  std::vector<const CallInst*> csInsts;
276
278
  const Function *F = nullptr;
277
- for(auto it = M->llvmFunBegin(); it != M->llvmFunEnd(); it++){
278
- const std::string fName = (*it)->getName().str();
279
- if(fName.find(RC_ACCESS) != std::string::npos) {
280
- F = (*it);
281
- break;
282
- }
283
- }
279
+ for(auto it = M->llvmFunBegin(); it != M->llvmFunEnd(); it++)
280
+ {
281
+ const std::string fName = (*it)->getName().str();
282
+ if(fName.find(RC_ACCESS) != std::string::npos)
283
+ {
284
+ F = (*it);
285
+ break;
286
+ }
287
+ }
284
288
  if (!F) return;
285
289
 
286
290
  for (Value::const_use_iterator it = F->use_begin(), ie =
@@ -409,7 +413,7 @@ private:
409
413
  {
410
414
  if (SVFUtil::isa<LoadInst>(I) || SVFUtil::isa<StoreInst>(I))
411
415
  return I;
412
-
416
+
413
417
  if (const SVFFunction *callee = SVFUtil::getCallee(I))
414
418
  {
415
419
  if (ExtAPI::EFT_L_A0__A0R_A1R == ExtAPI::getExtAPI()->get_type(callee)
@@ -122,13 +122,15 @@ public:
122
122
  virtual ~PCG()
123
123
  {
124
124
  }
125
-
126
- CallICFGNode* getCallICFGNode(const Instruction* inst) {
127
- return pta->getICFG()->getCallICFGNode(inst);
128
- }
129
- const SVFFunction* getSVFFun(const Function* fun) const {
130
- return LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
131
- }
125
+
126
+ CallICFGNode* getCallICFGNode(const Instruction* inst)
127
+ {
128
+ return pta->getICFG()->getCallICFGNode(inst);
129
+ }
130
+ const SVFFunction* getSVFFun(const Function* fun) const
131
+ {
132
+ return LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
133
+ }
132
134
  /// Interface to query whether two function may happen-in-parallel
133
135
  virtual bool mayHappenInParallel(const Instruction* i1, const Instruction* i2) const;
134
136
  bool mayHappenInParallelBetweenFunctions(const Function* fun1, const Function* fun2) const;
@@ -148,18 +148,21 @@ public:
148
148
  destroy();
149
149
  }
150
150
  /// Get CallICFGNode given inst
151
- CallICFGNode* getCallICFGNode(const Instruction* inst) {
152
- return pta->getICFG()->getCallICFGNode(inst);
153
- }
154
- /// Get SVFFuntion given Function
155
- const SVFFunction* getSVFFun(const Function* fun) const {
156
- return LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
157
- }
158
- /// Get SVFFModule
159
- SVFModule* getSVFModule() const {
160
- return pta->getModule();
161
- }
162
-
151
+ CallICFGNode* getCallICFGNode(const Instruction* inst)
152
+ {
153
+ return pta->getICFG()->getCallICFGNode(inst);
154
+ }
155
+ /// Get SVFFuntion given Function
156
+ const SVFFunction* getSVFFun(const Function* fun) const
157
+ {
158
+ return LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
159
+ }
160
+ /// Get SVFFModule
161
+ SVFModule* getSVFModule() const
162
+ {
163
+ return pta->getModule();
164
+ }
165
+
163
166
  /// Get TCG
164
167
  inline ThreadCallGraph* getThreadCallGraph() const
165
168
  {
@@ -245,20 +248,22 @@ public:
245
248
  /// Whether it is a candidate function for indirect call
246
249
  inline bool isCandidateFun(const PTACallGraph::FunctionSet& callees) const
247
250
  {
248
- for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
249
- ecit = callees.end(); cit!=ecit; cit++)
251
+ for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
252
+ ecit = callees.end(); cit!=ecit; cit++)
250
253
  {
251
- if(candidateFuncSet.find((*cit)->getLLVMFun())!=candidateFuncSet.end())
252
- return true;
254
+ if(candidateFuncSet.find((*cit)->getLLVMFun())!=candidateFuncSet.end())
255
+ return true;
253
256
  }
254
257
  return false;
255
258
  }
256
- inline bool isCandidateFun(const Function* fun) const {
257
- return candidateFuncSet.find(fun)!=candidateFuncSet.end();
258
- }
259
- inline bool isCandidateFun(const SVFFunction* fun) const {
260
- return isCandidateFun(fun->getLLVMFun());
261
- }
259
+ inline bool isCandidateFun(const Function* fun) const
260
+ {
261
+ return candidateFuncSet.find(fun)!=candidateFuncSet.end();
262
+ }
263
+ inline bool isCandidateFun(const SVFFunction* fun) const
264
+ {
265
+ return isCandidateFun(fun->getLLVMFun());
266
+ }
262
267
  /// Whether two functions in the same callgraph scc
263
268
  inline bool inSameCallGraphSCC(const PTACallGraphNode* src,const PTACallGraphNode* dst)
264
269
  {
@@ -104,7 +104,7 @@ public:
104
104
  /// Return accumulated constant offset given OffsetValueVec
105
105
  s32_t accumulateConstantOffset() const;
106
106
 
107
- /// Return element number of a type.
107
+ /// Return element number of a type.
108
108
  u32_t getElementNum(const Type* type) const;
109
109
 
110
110
  bool addOffsetValue(const Value* offsetValue, const Type* type);
@@ -135,8 +135,10 @@ private:
135
135
 
136
136
  } // End namespace SVF
137
137
 
138
- template <> struct std::hash<SVF::LocationSet> {
139
- size_t operator()(const SVF::LocationSet &ls) const {
138
+ template <> struct std::hash<SVF::LocationSet>
139
+ {
140
+ size_t operator()(const SVF::LocationSet &ls) const
141
+ {
140
142
  SVF::Hash<std::pair<SVF::NodeID, SVF::NodeID>> h;
141
143
  std::hash<SVF::LocationSet::OffsetValueVec> v;
142
144
  return h(std::make_pair(ls.accumulateConstantFieldIdx(), v(ls.getOffsetValueVec())));
@@ -34,7 +34,10 @@ public:
34
34
  // TODO: an unordered pair type may be better.
35
35
  typedef Map<std::pair<PointsToID, PointsToID>, PointsToID> OpCache;
36
36
 
37
- static PointsToID emptyPointsToId(void) { return 0; };
37
+ static PointsToID emptyPointsToId(void)
38
+ {
39
+ return 0;
40
+ };
38
41
 
39
42
  public:
40
43
  PersistentPointsToCache(void) : idCounter(1)
@@ -48,13 +51,13 @@ public:
48
51
  /// Clear the cache.
49
52
  void clear()
50
53
  {
51
- for (const Data *d : idToPts) delete d;
52
- idToPts.clear();
53
- ptsToId.clear();
54
+ for (const Data *d : idToPts) delete d;
55
+ idToPts.clear();
56
+ ptsToId.clear();
54
57
 
55
- unionCache.clear();
56
- complementCache.clear();
57
- intersectionCache.clear();
58
+ unionCache.clear();
59
+ complementCache.clear();
60
+ intersectionCache.clear();
58
61
  }
59
62
 
60
63
  /// Resets the cache removing everything except the emptyData it was initialised with.
@@ -108,7 +111,10 @@ public:
108
111
  /// Unions lhs and rhs and returns their union's ID.
109
112
  PointsToID unionPts(PointsToID lhs, PointsToID rhs)
110
113
  {
111
- static const DataOp unionOp = [](const Data &lhs, const Data &rhs) { return lhs | rhs; };
114
+ static const DataOp unionOp = [](const Data &lhs, const Data &rhs)
115
+ {
116
+ return lhs | rhs;
117
+ };
112
118
 
113
119
  ++totalUnions;
114
120
 
@@ -155,7 +161,8 @@ public:
155
161
  ++preemptiveUnions;
156
162
  ++totalUnions;
157
163
  }
158
- } else ++lookupUnions;
164
+ }
165
+ else ++lookupUnions;
159
166
 
160
167
  return result;
161
168
  }
@@ -163,7 +170,10 @@ public:
163
170
  /// Relatively complements lhs and rhs (lhs \ rhs) and returns it's ID.
164
171
  PointsToID complementPts(PointsToID lhs, PointsToID rhs)
165
172
  {
166
- static const DataOp complementOp = [](const Data &lhs, const Data &rhs) { return lhs - rhs; };
173
+ static const DataOp complementOp = [](const Data &lhs, const Data &rhs)
174
+ {
175
+ return lhs - rhs;
176
+ };
167
177
 
168
178
  ++totalComplements;
169
179
 
@@ -214,7 +224,8 @@ public:
214
224
  ++preemptiveComplements;
215
225
  ++totalComplements;
216
226
  }
217
- } else ++lookupComplements;
227
+ }
228
+ else ++lookupComplements;
218
229
 
219
230
  return result;
220
231
  }
@@ -222,7 +233,10 @@ public:
222
233
  /// Intersects lhs and rhs (lhs AND rhs) and returns the intersection's ID.
223
234
  PointsToID intersectPts(PointsToID lhs, PointsToID rhs)
224
235
  {
225
- static const DataOp intersectionOp = [](const Data &lhs, const Data &rhs) { return lhs & rhs; };
236
+ static const DataOp intersectionOp = [](const Data &lhs, const Data &rhs)
237
+ {
238
+ return lhs & rhs;
239
+ };
226
240
 
227
241
  ++totalIntersections;
228
242
 
@@ -287,7 +301,8 @@ public:
287
301
  ++totalUnions;
288
302
  }
289
303
  }
290
- } else ++lookupIntersections;
304
+ }
305
+ else ++lookupIntersections;
291
306
 
292
307
  return result;
293
308
  }