svf-lib 1.0.2237 → 1.0.2239

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 (165) hide show
  1. package/SVF-linux-aarch64/Release-build/bin/ae +0 -0
  2. package/SVF-linux-aarch64/Release-build/bin/cfl +0 -0
  3. package/SVF-linux-aarch64/Release-build/bin/dvf +0 -0
  4. package/SVF-linux-aarch64/Release-build/bin/llvm2svf +0 -0
  5. package/SVF-linux-aarch64/Release-build/bin/mta +0 -0
  6. package/SVF-linux-aarch64/Release-build/bin/saber +0 -0
  7. package/SVF-linux-aarch64/Release-build/bin/svf-ex +0 -0
  8. package/SVF-linux-aarch64/Release-build/bin/wpa +0 -0
  9. package/SVF-linux-aarch64/Release-build/include/AE/Core/AbstractState.h +406 -0
  10. package/SVF-linux-aarch64/Release-build/include/AE/Core/AbstractValue.h +157 -0
  11. package/SVF-linux-aarch64/Release-build/include/AE/Core/AddressValue.h +232 -0
  12. package/SVF-linux-aarch64/Release-build/include/AE/Core/ICFGWTO.h +82 -0
  13. package/SVF-linux-aarch64/Release-build/include/AE/Core/IntervalValue.h +1055 -0
  14. package/SVF-linux-aarch64/Release-build/include/AE/Core/NumericValue.h +1292 -0
  15. package/SVF-linux-aarch64/Release-build/include/AE/Core/RelExeState.h +226 -0
  16. package/SVF-linux-aarch64/Release-build/include/AE/Core/RelationSolver.h +91 -0
  17. package/SVF-linux-aarch64/Release-build/include/AE/Svfexe/AEDetector.h +323 -0
  18. package/SVF-linux-aarch64/Release-build/include/AE/Svfexe/AbsExtAPI.h +140 -0
  19. package/SVF-linux-aarch64/Release-build/include/AE/Svfexe/AbstractInterpretation.h +350 -0
  20. package/SVF-linux-aarch64/Release-build/include/CFL/CFGNormalizer.h +84 -0
  21. package/SVF-linux-aarch64/Release-build/include/CFL/CFGrammar.h +468 -0
  22. package/SVF-linux-aarch64/Release-build/include/CFL/CFLAlias.h +168 -0
  23. package/SVF-linux-aarch64/Release-build/include/CFL/CFLBase.h +118 -0
  24. package/SVF-linux-aarch64/Release-build/include/CFL/CFLGramGraphChecker.h +74 -0
  25. package/SVF-linux-aarch64/Release-build/include/CFL/CFLGraphBuilder.h +166 -0
  26. package/SVF-linux-aarch64/Release-build/include/CFL/CFLSVFGBuilder.h +58 -0
  27. package/SVF-linux-aarch64/Release-build/include/CFL/CFLSolver.h +374 -0
  28. package/SVF-linux-aarch64/Release-build/include/CFL/CFLStat.h +67 -0
  29. package/SVF-linux-aarch64/Release-build/include/CFL/CFLVF.h +68 -0
  30. package/SVF-linux-aarch64/Release-build/include/CFL/GrammarBuilder.h +100 -0
  31. package/SVF-linux-aarch64/Release-build/include/CFL/grammar/PAGGrammar.txt +15 -0
  32. package/SVF-linux-aarch64/Release-build/include/CFL/grammar/PEGGrammar.txt +11 -0
  33. package/SVF-linux-aarch64/Release-build/include/CFL/grammar/VFGGrammar.txt +7 -0
  34. package/SVF-linux-aarch64/Release-build/include/DDA/ContextDDA.h +230 -0
  35. package/SVF-linux-aarch64/Release-build/include/DDA/DDAClient.h +163 -0
  36. package/SVF-linux-aarch64/Release-build/include/DDA/DDAPass.h +102 -0
  37. package/SVF-linux-aarch64/Release-build/include/DDA/DDAStat.h +121 -0
  38. package/SVF-linux-aarch64/Release-build/include/DDA/DDAVFSolver.h +794 -0
  39. package/SVF-linux-aarch64/Release-build/include/DDA/FlowDDA.h +178 -0
  40. package/SVF-linux-aarch64/Release-build/include/FastCluster/LICENSE.TXT +13 -0
  41. package/SVF-linux-aarch64/Release-build/include/FastCluster/fastcluster.h +80 -0
  42. package/SVF-linux-aarch64/Release-build/include/Graphs/BasicBlockG.h +318 -0
  43. package/SVF-linux-aarch64/Release-build/include/Graphs/CDG.h +482 -0
  44. package/SVF-linux-aarch64/Release-build/include/Graphs/CFLGraph.h +232 -0
  45. package/SVF-linux-aarch64/Release-build/include/Graphs/CHG.h +369 -0
  46. package/SVF-linux-aarch64/Release-build/include/Graphs/CallGraph.h +498 -0
  47. package/SVF-linux-aarch64/Release-build/include/Graphs/ConsG.h +402 -0
  48. package/SVF-linux-aarch64/Release-build/include/Graphs/ConsGEdge.h +355 -0
  49. package/SVF-linux-aarch64/Release-build/include/Graphs/ConsGNode.h +418 -0
  50. package/SVF-linux-aarch64/Release-build/include/Graphs/DOTGraphTraits.h +188 -0
  51. package/SVF-linux-aarch64/Release-build/include/Graphs/GenericGraph.h +628 -0
  52. package/SVF-linux-aarch64/Release-build/include/Graphs/GraphPrinter.h +111 -0
  53. package/SVF-linux-aarch64/Release-build/include/Graphs/GraphTraits.h +150 -0
  54. package/SVF-linux-aarch64/Release-build/include/Graphs/GraphWriter.h +380 -0
  55. package/SVF-linux-aarch64/Release-build/include/Graphs/ICFG.h +331 -0
  56. package/SVF-linux-aarch64/Release-build/include/Graphs/ICFGEdge.h +281 -0
  57. package/SVF-linux-aarch64/Release-build/include/Graphs/ICFGNode.h +669 -0
  58. package/SVF-linux-aarch64/Release-build/include/Graphs/ICFGStat.h +164 -0
  59. package/SVF-linux-aarch64/Release-build/include/Graphs/IRGraph.h +398 -0
  60. package/SVF-linux-aarch64/Release-build/include/Graphs/SCC.h +375 -0
  61. package/SVF-linux-aarch64/Release-build/include/Graphs/SVFG.h +491 -0
  62. package/SVF-linux-aarch64/Release-build/include/Graphs/SVFGEdge.h +237 -0
  63. package/SVF-linux-aarch64/Release-build/include/Graphs/SVFGNode.h +501 -0
  64. package/SVF-linux-aarch64/Release-build/include/Graphs/SVFGOPT.h +363 -0
  65. package/SVF-linux-aarch64/Release-build/include/Graphs/SVFGStat.h +273 -0
  66. package/SVF-linux-aarch64/Release-build/include/Graphs/ThreadCallGraph.h +400 -0
  67. package/SVF-linux-aarch64/Release-build/include/Graphs/VFG.h +664 -0
  68. package/SVF-linux-aarch64/Release-build/include/Graphs/VFGEdge.h +295 -0
  69. package/SVF-linux-aarch64/Release-build/include/Graphs/VFGNode.h +1266 -0
  70. package/SVF-linux-aarch64/Release-build/include/Graphs/WTO.h +872 -0
  71. package/SVF-linux-aarch64/Release-build/include/MSSA/MSSAMuChi.h +722 -0
  72. package/SVF-linux-aarch64/Release-build/include/MSSA/MemPartition.h +169 -0
  73. package/SVF-linux-aarch64/Release-build/include/MSSA/MemRegion.h +489 -0
  74. package/SVF-linux-aarch64/Release-build/include/MSSA/MemSSA.h +452 -0
  75. package/SVF-linux-aarch64/Release-build/include/MSSA/SVFGBuilder.h +98 -0
  76. package/SVF-linux-aarch64/Release-build/include/MTA/LockAnalysis.h +533 -0
  77. package/SVF-linux-aarch64/Release-build/include/MTA/MHP.h +546 -0
  78. package/SVF-linux-aarch64/Release-build/include/MTA/MTA.h +98 -0
  79. package/SVF-linux-aarch64/Release-build/include/MTA/MTAStat.h +73 -0
  80. package/SVF-linux-aarch64/Release-build/include/MTA/TCT.h +620 -0
  81. package/SVF-linux-aarch64/Release-build/include/MemoryModel/AbstractPointsToDS.h +316 -0
  82. package/SVF-linux-aarch64/Release-build/include/MemoryModel/AccessPath.h +194 -0
  83. package/SVF-linux-aarch64/Release-build/include/MemoryModel/ConditionalPT.h +878 -0
  84. package/SVF-linux-aarch64/Release-build/include/MemoryModel/MutablePointsToDS.h +1025 -0
  85. package/SVF-linux-aarch64/Release-build/include/MemoryModel/PersistentPointsToCache.h +463 -0
  86. package/SVF-linux-aarch64/Release-build/include/MemoryModel/PersistentPointsToDS.h +955 -0
  87. package/SVF-linux-aarch64/Release-build/include/MemoryModel/PointerAnalysis.h +429 -0
  88. package/SVF-linux-aarch64/Release-build/include/MemoryModel/PointerAnalysisImpl.h +602 -0
  89. package/SVF-linux-aarch64/Release-build/include/MemoryModel/PointsTo.h +255 -0
  90. package/SVF-linux-aarch64/Release-build/include/MemoryModel/SVFLoop.h +167 -0
  91. package/SVF-linux-aarch64/Release-build/include/SABER/DoubleFreeChecker.h +76 -0
  92. package/SVF-linux-aarch64/Release-build/include/SABER/FileChecker.h +80 -0
  93. package/SVF-linux-aarch64/Release-build/include/SABER/LeakChecker.h +122 -0
  94. package/SVF-linux-aarch64/Release-build/include/SABER/ProgSlice.h +327 -0
  95. package/SVF-linux-aarch64/Release-build/include/SABER/SaberCheckerAPI.h +151 -0
  96. package/SVF-linux-aarch64/Release-build/include/SABER/SaberCondAllocator.h +317 -0
  97. package/SVF-linux-aarch64/Release-build/include/SABER/SaberSVFGBuilder.h +114 -0
  98. package/SVF-linux-aarch64/Release-build/include/SABER/SrcSnkDDA.h +327 -0
  99. package/SVF-linux-aarch64/Release-build/include/SABER/SrcSnkSolver.h +186 -0
  100. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/BasicTypes.h +280 -0
  101. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/BreakConstantExpr.h +94 -0
  102. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/CHGBuilder.h +78 -0
  103. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/CppUtil.h +184 -0
  104. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/DCHG.h +477 -0
  105. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/GEPTypeBridgeIterator.h +183 -0
  106. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/ICFGBuilder.h +160 -0
  107. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/LLVMLoopAnalysis.h +60 -0
  108. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/LLVMModule.h +594 -0
  109. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/LLVMUtil.h +438 -0
  110. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/ObjTypeInference.h +130 -0
  111. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SVFIRBuilder.h +520 -0
  112. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SVFLLVMValue.h +387 -0
  113. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SVFModule.h +186 -0
  114. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SymbolTableBuilder.h +132 -0
  115. package/SVF-linux-aarch64/Release-build/include/SVFIR/ObjTypeInfo.h +224 -0
  116. package/SVF-linux-aarch64/Release-build/include/SVFIR/PAGBuilderFromFile.h +80 -0
  117. package/SVF-linux-aarch64/Release-build/include/SVFIR/SVFIR.h +856 -0
  118. package/SVF-linux-aarch64/Release-build/include/SVFIR/SVFStatements.h +1328 -0
  119. package/SVF-linux-aarch64/Release-build/include/SVFIR/SVFType.h +578 -0
  120. package/SVF-linux-aarch64/Release-build/include/SVFIR/SVFValue.h +338 -0
  121. package/SVF-linux-aarch64/Release-build/include/SVFIR/SVFVariables.h +2204 -0
  122. package/SVF-linux-aarch64/Release-build/include/Util/Annotator.h +180 -0
  123. package/SVF-linux-aarch64/Release-build/include/Util/BitVector.h +55 -0
  124. package/SVF-linux-aarch64/Release-build/include/Util/CDGBuilder.h +107 -0
  125. package/SVF-linux-aarch64/Release-build/include/Util/CallGraphBuilder.h +62 -0
  126. package/SVF-linux-aarch64/Release-build/include/Util/Casting.h +426 -0
  127. package/SVF-linux-aarch64/Release-build/include/Util/CommandLine.h +530 -0
  128. package/SVF-linux-aarch64/Release-build/include/Util/CoreBitVector.h +214 -0
  129. package/SVF-linux-aarch64/Release-build/include/Util/CxtStmt.h +502 -0
  130. package/SVF-linux-aarch64/Release-build/include/Util/DPItem.h +618 -0
  131. package/SVF-linux-aarch64/Release-build/include/Util/ExtAPI.h +117 -0
  132. package/SVF-linux-aarch64/Release-build/include/Util/GeneralType.h +127 -0
  133. package/SVF-linux-aarch64/Release-build/include/Util/GraphReachSolver.h +186 -0
  134. package/SVF-linux-aarch64/Release-build/include/Util/NodeIDAllocator.h +203 -0
  135. package/SVF-linux-aarch64/Release-build/include/Util/Options.h +272 -0
  136. package/SVF-linux-aarch64/Release-build/include/Util/PTAStat.h +83 -0
  137. package/SVF-linux-aarch64/Release-build/include/Util/SVFBugReport.h +427 -0
  138. package/SVF-linux-aarch64/Release-build/include/Util/SVFLoopAndDomInfo.h +169 -0
  139. package/SVF-linux-aarch64/Release-build/include/Util/SVFStat.h +103 -0
  140. package/SVF-linux-aarch64/Release-build/include/Util/SVFUtil.h +478 -0
  141. package/SVF-linux-aarch64/Release-build/include/Util/SparseBitVector.h +1252 -0
  142. package/SVF-linux-aarch64/Release-build/include/Util/ThreadAPI.h +189 -0
  143. package/SVF-linux-aarch64/Release-build/include/Util/WorkList.h +317 -0
  144. package/SVF-linux-aarch64/Release-build/include/Util/Z3Expr.h +325 -0
  145. package/SVF-linux-aarch64/Release-build/include/Util/cJSON.h +300 -0
  146. package/SVF-linux-aarch64/Release-build/include/Util/config.h +26 -0
  147. package/SVF-linux-aarch64/Release-build/include/Util/iterator.h +407 -0
  148. package/SVF-linux-aarch64/Release-build/include/Util/iterator_range.h +76 -0
  149. package/SVF-linux-aarch64/Release-build/include/WPA/Andersen.h +435 -0
  150. package/SVF-linux-aarch64/Release-build/include/WPA/AndersenPWC.h +160 -0
  151. package/SVF-linux-aarch64/Release-build/include/WPA/CSC.h +95 -0
  152. package/SVF-linux-aarch64/Release-build/include/WPA/FlowSensitive.h +323 -0
  153. package/SVF-linux-aarch64/Release-build/include/WPA/Steensgaard.h +131 -0
  154. package/SVF-linux-aarch64/Release-build/include/WPA/TypeAnalysis.h +90 -0
  155. package/SVF-linux-aarch64/Release-build/include/WPA/VersionedFlowSensitive.h +295 -0
  156. package/SVF-linux-aarch64/Release-build/include/WPA/WPAFSSolver.h +246 -0
  157. package/SVF-linux-aarch64/Release-build/include/WPA/WPAPass.h +116 -0
  158. package/SVF-linux-aarch64/Release-build/include/WPA/WPASolver.h +205 -0
  159. package/SVF-linux-aarch64/Release-build/include/WPA/WPAStat.h +222 -0
  160. package/SVF-linux-aarch64/Release-build/lib/cmake/SVF/SVFConfig.cmake +58 -0
  161. package/SVF-linux-aarch64/Release-build/lib/cmake/SVF/SVFConfigVersion.cmake +43 -0
  162. package/SVF-linux-aarch64/Release-build/lib/extapi.bc +2449 -0
  163. package/SVF-linux-aarch64/Release-build/lib/libSvfCore.so +0 -0
  164. package/SVF-linux-aarch64/Release-build/lib/libSvfLLVM.so.16 +0 -0
  165. package/package.json +1 -1
@@ -0,0 +1,429 @@
1
+ //===- PointerAnalysis.h -- Base class of pointer analyses--------------------//
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 Affero 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 Affero General Public License for more details.
17
+
18
+ // You should have received a copy of the GNU Affero General Public License
19
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ //
21
+ //===----------------------------------------------------------------------===//
22
+
23
+ /*
24
+ * PointerAnalysis.h
25
+ *
26
+ * Created on: Nov 12, 2013
27
+ * Author: Yulei Sui
28
+ */
29
+
30
+ #ifndef POINTERANALYSIS_H_
31
+ #define POINTERANALYSIS_H_
32
+
33
+ #include <unistd.h>
34
+ #include <signal.h>
35
+
36
+ #include "Graphs/CHG.h"
37
+ #include "Graphs/ThreadCallGraph.h"
38
+ #include "Graphs/SCC.h"
39
+ #include "MemoryModel/AbstractPointsToDS.h"
40
+ #include "MemoryModel/ConditionalPT.h"
41
+ #include "MemoryModel/MutablePointsToDS.h"
42
+ #include "MemoryModel/PersistentPointsToDS.h"
43
+ #include "MemoryModel/PointsTo.h"
44
+ #include "SVFIR/SVFIR.h"
45
+
46
+ namespace SVF
47
+ {
48
+
49
+ class CommonCHGraph;
50
+
51
+ class SVFModule;
52
+ class ICFG;
53
+ class PTAStat;
54
+ /*
55
+ * Pointer Analysis Base Class
56
+ */
57
+ class PointerAnalysis
58
+ {
59
+
60
+ public:
61
+ /// Pointer analysis type list
62
+ enum PTATY
63
+ {
64
+ // Whole program analysis
65
+ Andersen_BASE, ///< Base Andersen PTA
66
+ Andersen_WPA, ///< Andersen PTA
67
+ AndersenSCD_WPA, ///< Selective cycle detection andersen-style WPA
68
+ AndersenSFR_WPA, ///< Stride-based field representation
69
+ AndersenWaveDiff_WPA, ///< Diff wave propagation andersen-style WPA
70
+ Steensgaard_WPA, ///< Steensgaard PTA
71
+ CSCallString_WPA, ///< Call string based context sensitive WPA
72
+ CSSummary_WPA, ///< Summary based context sensitive WPA
73
+ FSDATAFLOW_WPA, ///< Traditional Dataflow-based flow sensitive WPA
74
+ FSSPARSE_WPA, ///< Sparse flow sensitive WPA
75
+ VFS_WPA, ///< Versioned sparse flow-sensitive WPA
76
+ FSCS_WPA, ///< Flow-, context- sensitive WPA
77
+ CFLFICI_WPA, ///< Flow-, context-, insensitive CFL-reachability-based analysis
78
+ CFLFSCI_WPA, ///< Flow-insensitive, context-sensitive CFL-reachability-based analysis
79
+ CFLFSCS_WPA, ///< Flow-, context-, CFL-reachability-based analysis
80
+ TypeCPP_WPA, ///< Type-based analysis for C++
81
+
82
+ // Demand driven analysis
83
+ FieldS_DDA, ///< Field sensitive DDA
84
+ FlowS_DDA, ///< Flow sensitive DDA
85
+ PathS_DDA, ///< Guarded value-flow DDA
86
+ Cxt_DDA, ///< context sensitive DDA
87
+
88
+
89
+ Default_PTA ///< default pta without any analysis
90
+ };
91
+
92
+ /// Implementation type: BVDataPTAImpl or CondPTAImpl.
93
+ enum PTAImplTy
94
+ {
95
+ BaseImpl, ///< Represents PointerAnalaysis.
96
+ BVDataImpl, ///< Represents BVDataPTAImpl.
97
+ CondImpl, ///< Represents CondPTAImpl.
98
+ };
99
+
100
+ /// Indirect call edges type, map a callsite to a set of callees
101
+ //@{
102
+ typedef Set<const CallICFGNode*> CallSiteSet;
103
+ typedef SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap;
104
+ typedef Set<const FunObjVar*> FunctionSet;
105
+ typedef OrderedMap<const CallICFGNode*, FunctionSet> CallEdgeMap;
106
+ typedef SCCDetection<CallGraph*> CallGraphSCC;
107
+ typedef Set<const GlobalObjVar*> VTableSet;
108
+ typedef Set<const FunObjVar*> VFunSet;
109
+ //@}
110
+
111
+ static const std::string aliasTestMayAlias;
112
+ static const std::string aliasTestMayAliasMangled;
113
+ static const std::string aliasTestNoAlias;
114
+ static const std::string aliasTestNoAliasMangled;
115
+ static const std::string aliasTestPartialAlias;
116
+ static const std::string aliasTestPartialAliasMangled;
117
+ static const std::string aliasTestMustAlias;
118
+ static const std::string aliasTestMustAliasMangled;
119
+ static const std::string aliasTestFailMayAlias;
120
+ static const std::string aliasTestFailMayAliasMangled;
121
+ static const std::string aliasTestFailNoAlias;
122
+ static const std::string aliasTestFailNoAliasMangled;
123
+
124
+ private:
125
+ /// Release the memory
126
+ void destroy();
127
+
128
+ protected:
129
+
130
+ /// User input flags
131
+ //@{
132
+ /// Flag for printing the statistic results
133
+ bool print_stat;
134
+ /// Flag for validating points-to/alias results
135
+ bool alias_validation;
136
+ /// Flag for iteration budget for on-the-fly statistics
137
+ u32_t OnTheFlyIterBudgetForStat;
138
+ //@}
139
+
140
+ /// SVFIR
141
+ static SVFIR* pag;
142
+ /// Pointer analysis Type
143
+ PTATY ptaTy;
144
+ /// PTA implementation type.
145
+ PTAImplTy ptaImplTy;
146
+ /// Statistics
147
+ PTAStat* stat;
148
+ /// Call graph used for pointer analysis
149
+ CallGraph* callgraph;
150
+ /// SCC for PTACallGraph
151
+ CallGraphSCC* callGraphSCC;
152
+ /// Interprocedural control-flow graph
153
+ ICFG* icfg;
154
+ /// CHGraph
155
+ CommonCHGraph *chgraph;
156
+
157
+ public:
158
+ /// Get ICFG
159
+ inline ICFG* getICFG() const
160
+ {
161
+ return pag->getICFG();
162
+ }
163
+ /// Return number of resolved indirect call edges
164
+ inline u32_t getNumOfResolvedIndCallEdge() const
165
+ {
166
+ return getCallGraph()->getNumOfResolvedIndCallEdge();
167
+ }
168
+ /// Return call graph
169
+ inline CallGraph* getCallGraph() const
170
+ {
171
+ return callgraph;
172
+ }
173
+ /// Return call graph SCC
174
+ inline CallGraphSCC* getCallGraphSCC() const
175
+ {
176
+ return callGraphSCC;
177
+ }
178
+
179
+ /// Constructor
180
+ PointerAnalysis(SVFIR* pag, PTATY ty = Default_PTA, bool alias_check = true);
181
+
182
+ /// Type of pointer analysis
183
+ inline PTATY getAnalysisTy() const
184
+ {
185
+ return ptaTy;
186
+ }
187
+
188
+ /// Return implementation type of the pointer analysis.
189
+ inline PTAImplTy getImplTy() const
190
+ {
191
+ return ptaImplTy;
192
+ }
193
+
194
+ /// Get/set SVFIR
195
+ ///@{
196
+ inline SVFIR* getPAG() const
197
+ {
198
+ return pag;
199
+ }
200
+ //@}
201
+
202
+ /// Get PTA stat
203
+ inline PTAStat* getStat() const
204
+ {
205
+ return stat;
206
+ }
207
+
208
+ /// Get all Valid Pointers for resolution
209
+ inline OrderedNodeSet& getAllValidPtrs()
210
+ {
211
+ return pag->getAllValidPtrs();
212
+ }
213
+
214
+ /// Destructor
215
+ virtual ~PointerAnalysis();
216
+
217
+ /// Initialization of a pointer analysis, including building symbol table and SVFIR etc.
218
+ virtual void initialize();
219
+
220
+ /// Finalization of a pointer analysis, including checking alias correctness
221
+ virtual void finalize();
222
+
223
+ /// Start Analysis here (main part of pointer analysis). It needs to be implemented in child class
224
+ virtual void analyze() = 0;
225
+
226
+ /// Compute points-to results on-demand, overridden by derived classes
227
+ virtual void computeDDAPts(NodeID) {}
228
+
229
+ /// Interface exposed to users of our pointer analysis, given Value infos
230
+ virtual AliasResult alias(const SVFVar* V1,
231
+ const SVFVar* V2) = 0;
232
+
233
+ /// Interface exposed to users of our pointer analysis, given PAGNodeID
234
+ virtual AliasResult alias(NodeID node1, NodeID node2) = 0;
235
+
236
+ /// Get points-to targets of a pointer. It needs to be implemented in child class
237
+ virtual const PointsTo& getPts(NodeID ptr) = 0;
238
+
239
+ /// Given an object, get all the nodes having whose pointsto contains the object.
240
+ /// Similar to getPts, this also needs to be implemented in child classes.
241
+ virtual const NodeSet& getRevPts(NodeID nodeId) = 0;
242
+
243
+ /// Print targets of a function pointer
244
+ void printIndCSTargets(const CallICFGNode* cs, const FunctionSet& targets);
245
+
246
+ // Debug purpose
247
+ //@{
248
+ virtual void dumpTopLevelPtsTo() {}
249
+ virtual void dumpAllPts() {}
250
+ virtual void dumpCPts() {}
251
+ virtual void dumpPts(NodeID ptr, const PointsTo& pts);
252
+ void printIndCSTargets();
253
+ void dumpAllTypes();
254
+ //@}
255
+
256
+ protected:
257
+ /// Return all indirect callsites
258
+ inline const CallSiteToFunPtrMap& getIndirectCallsites() const
259
+ {
260
+ return pag->getIndirectCallsites();
261
+ }
262
+ /// Return function pointer PAGNode at a callsite cs
263
+ inline NodeID getFunPtr(const CallICFGNode* cs) const
264
+ {
265
+ return pag->getFunPtr(cs);
266
+ }
267
+ /// Alias check functions to verify correctness of pointer analysis
268
+ //@{
269
+ virtual void validateTests();
270
+ virtual void validateSuccessTests(std::string fun);
271
+ virtual void validateExpectedFailureTests(std::string fun);
272
+ //@}
273
+
274
+ /// Reset all object node as field-sensitive.
275
+ void resetObjFieldSensitive();
276
+
277
+ public:
278
+ /// Dump the statistics
279
+ void dumpStat();
280
+
281
+ /// Determine whether a points-to contains a black hole or constant node
282
+ //@{
283
+ inline bool containBlackHoleNode(const PointsTo& pts)
284
+ {
285
+ return pts.test(pag->getBlackHoleNode());
286
+ }
287
+ inline bool containConstantNode(const PointsTo& pts)
288
+ {
289
+ return pts.test(pag->getConstantNode());
290
+ }
291
+ virtual inline bool isBlkObjOrConstantObj(NodeID ptd) const
292
+ {
293
+ return pag->isBlkObjOrConstantObj(ptd);
294
+ }
295
+ //@}
296
+
297
+ /// Whether this object is heap or array
298
+ //@{
299
+ inline bool isHeapMemObj(NodeID id) const
300
+ {
301
+ return pag->getBaseObject(id) && SVFUtil::isa<HeapObjVar, DummyObjVar>(pag->getBaseObject(id));
302
+ }
303
+
304
+ inline bool isArrayMemObj(NodeID id) const
305
+ {
306
+ const BaseObjVar* obj = pag->getBaseObject(id);
307
+ assert(obj && "base object is null??");
308
+ return obj->isArray();
309
+ }
310
+ //@}
311
+
312
+ /// For field-sensitivity
313
+ ///@{
314
+ inline bool isFIObjNode(NodeID id) const
315
+ {
316
+ return (SVFUtil::isa<BaseObjVar>(pag->getGNode(id)));
317
+ }
318
+ inline NodeID getBaseObjVar(NodeID id)
319
+ {
320
+ return pag->getBaseObjVar(id);
321
+ }
322
+ inline NodeID getFIObjVar(NodeID id)
323
+ {
324
+ return pag->getFIObjVar(id);
325
+ }
326
+ inline NodeID getGepObjVar(NodeID id, const APOffset& ap)
327
+ {
328
+ return pag->getGepObjVar(id, ap);
329
+ }
330
+ virtual inline const NodeBS& getAllFieldsObjVars(NodeID id)
331
+ {
332
+ return pag->getAllFieldsObjVars(id);
333
+ }
334
+ inline void setObjFieldInsensitive(NodeID id)
335
+ {
336
+ BaseObjVar* baseObj = const_cast<BaseObjVar*>(pag->getBaseObject(id));
337
+ baseObj->setFieldInsensitive();
338
+ }
339
+ inline bool isFieldInsensitive(NodeID id) const
340
+ {
341
+ const BaseObjVar* baseObj = pag->getBaseObject(id);
342
+ return baseObj->isFieldInsensitive();
343
+ }
344
+ ///@}
345
+
346
+ /// Whether print statistics
347
+ inline bool printStat()
348
+ {
349
+ return print_stat;
350
+ }
351
+
352
+ /// Whether print statistics
353
+ inline void disablePrintStat()
354
+ {
355
+ print_stat = false;
356
+ }
357
+
358
+ /// Get callees from an indirect callsite
359
+ //@{
360
+ inline CallEdgeMap& getIndCallMap()
361
+ {
362
+ return getCallGraph()->getIndCallMap();
363
+ }
364
+ inline bool hasIndCSCallees(const CallICFGNode* cs) const
365
+ {
366
+ return getCallGraph()->hasIndCSCallees(cs);
367
+ }
368
+ inline const FunctionSet& getIndCSCallees(const CallICFGNode* cs) const
369
+ {
370
+ return getCallGraph()->getIndCSCallees(cs);
371
+ }
372
+ //@}
373
+
374
+ /// Resolve indirect call edges
375
+ virtual void resolveIndCalls(const CallICFGNode* cs, const PointsTo& target, CallEdgeMap& newEdges);
376
+
377
+ /// PTACallGraph SCC related methods
378
+ //@{
379
+ /// PTACallGraph SCC detection
380
+ inline void callGraphSCCDetection()
381
+ {
382
+ if(callGraphSCC==nullptr)
383
+ callGraphSCC = new CallGraphSCC(callgraph);
384
+
385
+ callGraphSCC->find();
386
+ }
387
+ /// Get SCC rep node of a SVFG node.
388
+ inline NodeID getCallGraphSCCRepNode(NodeID id) const
389
+ {
390
+ return callGraphSCC->repNode(id);
391
+ }
392
+ /// Return TRUE if this edge is inside a PTACallGraph SCC, i.e., src node and dst node are in the same SCC on the SVFG.
393
+ inline bool inSameCallGraphSCC(const FunObjVar* fun1,const FunObjVar* fun2)
394
+ {
395
+ const CallGraphNode* src = callgraph->getCallGraphNode(fun1);
396
+ const CallGraphNode* dst = callgraph->getCallGraphNode(fun2);
397
+ return (getCallGraphSCCRepNode(src->getId()) == getCallGraphSCCRepNode(dst->getId()));
398
+ }
399
+ inline bool isInRecursion(const FunObjVar* fun) const
400
+ {
401
+ return callGraphSCC->isInCycle(callgraph->getCallGraphNode(fun)->getId());
402
+ }
403
+ /// Whether a local variable is in function recursions
404
+ bool isLocalVarInRecursiveFun(NodeID id) const;
405
+ //@}
406
+
407
+ /// Return PTA name
408
+ virtual const std::string PTAName() const
409
+ {
410
+ return "Pointer Analysis";
411
+ }
412
+
413
+ /// get CHGraph
414
+ CommonCHGraph *getCHGraph() const
415
+ {
416
+ return chgraph;
417
+ }
418
+
419
+ void getVFnsFromCHA(const CallICFGNode* cs, VFunSet &vfns);
420
+ void getVFnsFromPts(const CallICFGNode* cs, const PointsTo &target, VFunSet &vfns);
421
+ void connectVCallToVFns(const CallICFGNode* cs, const VFunSet &vfns, CallEdgeMap& newEdges);
422
+ virtual void resolveCPPIndCalls(const CallICFGNode* cs,
423
+ const PointsTo& target,
424
+ CallEdgeMap& newEdges);
425
+ };
426
+
427
+ } // End namespace SVF
428
+
429
+ #endif /* POINTERANALYSIS_H_ */