svf-lib 1.0.1289 → 1.0.1291

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 (161) hide show
  1. package/SVF-linux/Release-build/lib/libSvf.a +0 -0
  2. package/SVF-linux/include/CFL/CFLAlias.h +1 -1
  3. package/SVF-linux/include/CFL/CFLBase.h +1 -1
  4. package/SVF-linux/include/CFL/CFLGrammar.h +1 -1
  5. package/SVF-linux/include/DDA/DDAClient.h +2 -2
  6. package/SVF-linux/include/DDA/DDAPass.h +3 -3
  7. package/SVF-linux/include/Graphs/CHG.h +5 -5
  8. package/SVF-linux/include/Graphs/ConsG.h +1 -1
  9. package/SVF-linux/include/Graphs/ConsGEdge.h +1 -1
  10. package/SVF-linux/include/Graphs/GenericGraph.h +1 -1
  11. package/SVF-linux/include/Graphs/ICFG.h +1 -1
  12. package/SVF-linux/include/Graphs/ICFGEdge.h +3 -3
  13. package/SVF-linux/include/Graphs/IRGraph.h +13 -9
  14. package/SVF-linux/include/Graphs/PTACallGraph.h +1 -1
  15. package/SVF-linux/include/Graphs/SVFGOPT.h +2 -2
  16. package/SVF-linux/include/Graphs/ThreadCallGraph.h +2 -2
  17. package/SVF-linux/include/Graphs/VFG.h +1 -1
  18. package/SVF-linux/include/Graphs/VFGNode.h +7 -7
  19. package/SVF-linux/include/MSSA/MemRegion.h +2 -2
  20. package/SVF-linux/include/MTA/LockAnalysis.h +1 -4
  21. package/SVF-linux/include/MTA/MHP.h +22 -31
  22. package/SVF-linux/include/MTA/MTA.h +13 -32
  23. package/SVF-linux/include/MTA/MTAResultValidator.h +17 -16
  24. package/SVF-linux/include/MTA/MTAStat.h +1 -1
  25. package/SVF-linux/include/MTA/TCT.h +25 -18
  26. package/SVF-linux/include/MemoryModel/AbstractPointsToDS.h +1 -1
  27. package/SVF-linux/include/MemoryModel/ConditionalPT.h +3 -2
  28. package/SVF-linux/include/MemoryModel/LocationSet.h +4 -4
  29. package/SVF-linux/include/MemoryModel/MutablePointsToDS.h +1 -1
  30. package/SVF-linux/include/MemoryModel/PersistentPointsToCache.h +1 -1
  31. package/SVF-linux/include/MemoryModel/PointerAnalysis.h +5 -4
  32. package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +4 -4
  33. package/SVF-linux/include/MemoryModel/PointsTo.h +1 -1
  34. package/SVF-linux/include/MemoryModel/SVFLoop.h +1 -1
  35. package/SVF-linux/include/SABER/DoubleFreeChecker.h +2 -2
  36. package/SVF-linux/include/SABER/FileChecker.h +2 -2
  37. package/SVF-linux/include/SABER/LeakChecker.h +2 -2
  38. package/SVF-linux/include/SABER/ProgSlice.h +0 -3
  39. package/SVF-linux/include/SABER/SaberCondAllocator.h +7 -9
  40. package/SVF-linux/include/SABER/SaberSVFGBuilder.h +1 -1
  41. package/SVF-linux/include/SVF-LLVM/BasicTypes.h +248 -0
  42. package/SVF-linux/include/SVF-LLVM/BreakConstantExpr.h +94 -0
  43. package/SVF-linux/include/SVF-LLVM/CHGBuilder.h +73 -0
  44. package/SVF-linux/include/SVF-LLVM/CPPUtil.h +130 -0
  45. package/SVF-linux/include/SVF-LLVM/DCHG.h +481 -0
  46. package/SVF-linux/include/SVF-LLVM/GEPTypeBridgeIterator.h +183 -0
  47. package/SVF-linux/include/SVF-LLVM/ICFGBuilder.h +106 -0
  48. package/SVF-linux/include/SVF-LLVM/IRAnnotator.h +323 -0
  49. package/SVF-linux/include/SVF-LLVM/LLVMLoopAnalysis.h +59 -0
  50. package/SVF-linux/include/SVF-LLVM/LLVMModule.h +358 -0
  51. package/SVF-linux/include/SVF-LLVM/LLVMUtil.h +405 -0
  52. package/SVF-linux/include/SVF-LLVM/SVFIRBuilder.h +413 -0
  53. package/SVF-linux/include/SVF-LLVM/SymbolTableBuilder.h +113 -0
  54. package/SVF-linux/include/SVFIR/PAGBuilderFromFile.h +80 -0
  55. package/SVF-linux/include/SVFIR/SVFIR.h +661 -0
  56. package/SVF-linux/include/SVFIR/SVFModule.h +233 -0
  57. package/SVF-linux/include/SVFIR/SVFStatements.h +1101 -0
  58. package/SVF-linux/include/SVFIR/SVFType.h +514 -0
  59. package/SVF-linux/include/SVFIR/SVFValue.h +1129 -0
  60. package/SVF-linux/include/SVFIR/SVFVariables.h +721 -0
  61. package/SVF-linux/include/SVFIR/SymbolTableInfo.h +597 -0
  62. package/SVF-linux/include/Util/Annotator.h +1 -1
  63. package/SVF-linux/include/Util/CallGraphBuilder.h +74 -0
  64. package/SVF-linux/include/Util/Casting.h +1 -3
  65. package/SVF-linux/include/Util/CoreBitVector.h +1 -1
  66. package/SVF-linux/include/Util/CxtStmt.h +8 -8
  67. package/SVF-linux/include/Util/DPItem.h +1 -1
  68. package/SVF-linux/include/Util/ExtAPI.h +1 -1
  69. package/SVF-linux/include/Util/NodeIDAllocator.h +1 -1
  70. package/SVF-linux/include/Util/Options.h +1 -0
  71. package/SVF-linux/include/Util/PTAStat.h +1 -1
  72. package/SVF-linux/include/Util/SCC.h +1 -1
  73. package/SVF-linux/include/Util/SVFUtil.h +26 -95
  74. package/SVF-linux/include/Util/ThreadAPI.h +27 -27
  75. package/SVF-linux/include/Util/WorkList.h +1 -1
  76. package/SVF-linux/include/Util/Z3Expr.h +1 -1
  77. package/SVF-linux/include/WPA/Andersen.h +1 -1
  78. package/SVF-linux/include/WPA/CSC.h +1 -1
  79. package/SVF-linux/include/WPA/TypeAnalysis.h +0 -3
  80. package/SVF-linux/include/WPA/WPAPass.h +8 -8
  81. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  82. package/SVF-osx/include/CFL/CFLAlias.h +1 -1
  83. package/SVF-osx/include/CFL/CFLBase.h +1 -1
  84. package/SVF-osx/include/CFL/CFLGrammar.h +1 -1
  85. package/SVF-osx/include/DDA/DDAClient.h +2 -2
  86. package/SVF-osx/include/DDA/DDAPass.h +3 -3
  87. package/SVF-osx/include/Graphs/CHG.h +5 -5
  88. package/SVF-osx/include/Graphs/ConsG.h +1 -1
  89. package/SVF-osx/include/Graphs/ConsGEdge.h +1 -1
  90. package/SVF-osx/include/Graphs/GenericGraph.h +1 -1
  91. package/SVF-osx/include/Graphs/ICFG.h +1 -1
  92. package/SVF-osx/include/Graphs/ICFGEdge.h +3 -3
  93. package/SVF-osx/include/Graphs/IRGraph.h +13 -9
  94. package/SVF-osx/include/Graphs/PTACallGraph.h +1 -1
  95. package/SVF-osx/include/Graphs/SVFGOPT.h +2 -2
  96. package/SVF-osx/include/Graphs/ThreadCallGraph.h +2 -2
  97. package/SVF-osx/include/Graphs/VFG.h +1 -1
  98. package/SVF-osx/include/Graphs/VFGNode.h +7 -7
  99. package/SVF-osx/include/MSSA/MemRegion.h +2 -2
  100. package/SVF-osx/include/MTA/LockAnalysis.h +1 -4
  101. package/SVF-osx/include/MTA/MHP.h +22 -31
  102. package/SVF-osx/include/MTA/MTA.h +13 -32
  103. package/SVF-osx/include/MTA/MTAResultValidator.h +17 -16
  104. package/SVF-osx/include/MTA/MTAStat.h +1 -1
  105. package/SVF-osx/include/MTA/TCT.h +25 -18
  106. package/SVF-osx/include/MemoryModel/AbstractPointsToDS.h +1 -1
  107. package/SVF-osx/include/MemoryModel/ConditionalPT.h +3 -2
  108. package/SVF-osx/include/MemoryModel/LocationSet.h +4 -4
  109. package/SVF-osx/include/MemoryModel/MutablePointsToDS.h +1 -1
  110. package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +1 -1
  111. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +5 -4
  112. package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +4 -4
  113. package/SVF-osx/include/MemoryModel/PointsTo.h +1 -1
  114. package/SVF-osx/include/MemoryModel/SVFLoop.h +1 -1
  115. package/SVF-osx/include/SABER/DoubleFreeChecker.h +2 -2
  116. package/SVF-osx/include/SABER/FileChecker.h +2 -2
  117. package/SVF-osx/include/SABER/LeakChecker.h +2 -2
  118. package/SVF-osx/include/SABER/ProgSlice.h +0 -3
  119. package/SVF-osx/include/SABER/SaberCondAllocator.h +7 -9
  120. package/SVF-osx/include/SABER/SaberSVFGBuilder.h +1 -1
  121. package/SVF-osx/include/SVF-LLVM/BasicTypes.h +248 -0
  122. package/SVF-osx/include/SVF-LLVM/BreakConstantExpr.h +94 -0
  123. package/SVF-osx/include/SVF-LLVM/CHGBuilder.h +73 -0
  124. package/SVF-osx/include/SVF-LLVM/CPPUtil.h +130 -0
  125. package/SVF-osx/include/SVF-LLVM/DCHG.h +481 -0
  126. package/SVF-osx/include/SVF-LLVM/GEPTypeBridgeIterator.h +183 -0
  127. package/SVF-osx/include/SVF-LLVM/ICFGBuilder.h +106 -0
  128. package/SVF-osx/include/SVF-LLVM/IRAnnotator.h +323 -0
  129. package/SVF-osx/include/SVF-LLVM/LLVMLoopAnalysis.h +59 -0
  130. package/SVF-osx/include/SVF-LLVM/LLVMModule.h +358 -0
  131. package/SVF-osx/include/SVF-LLVM/LLVMUtil.h +405 -0
  132. package/SVF-osx/include/SVF-LLVM/SVFIRBuilder.h +413 -0
  133. package/SVF-osx/include/SVF-LLVM/SymbolTableBuilder.h +113 -0
  134. package/SVF-osx/include/SVFIR/PAGBuilderFromFile.h +80 -0
  135. package/SVF-osx/include/SVFIR/SVFIR.h +661 -0
  136. package/SVF-osx/include/SVFIR/SVFModule.h +233 -0
  137. package/SVF-osx/include/SVFIR/SVFStatements.h +1101 -0
  138. package/SVF-osx/include/SVFIR/SVFType.h +514 -0
  139. package/SVF-osx/include/SVFIR/SVFValue.h +1129 -0
  140. package/SVF-osx/include/SVFIR/SVFVariables.h +721 -0
  141. package/SVF-osx/include/SVFIR/SymbolTableInfo.h +597 -0
  142. package/SVF-osx/include/Util/Annotator.h +1 -1
  143. package/SVF-osx/include/Util/CallGraphBuilder.h +74 -0
  144. package/SVF-osx/include/Util/Casting.h +1 -3
  145. package/SVF-osx/include/Util/CoreBitVector.h +1 -1
  146. package/SVF-osx/include/Util/CxtStmt.h +8 -8
  147. package/SVF-osx/include/Util/DPItem.h +1 -1
  148. package/SVF-osx/include/Util/ExtAPI.h +1 -1
  149. package/SVF-osx/include/Util/NodeIDAllocator.h +1 -1
  150. package/SVF-osx/include/Util/Options.h +1 -0
  151. package/SVF-osx/include/Util/PTAStat.h +1 -1
  152. package/SVF-osx/include/Util/SCC.h +1 -1
  153. package/SVF-osx/include/Util/SVFUtil.h +26 -95
  154. package/SVF-osx/include/Util/ThreadAPI.h +27 -27
  155. package/SVF-osx/include/Util/WorkList.h +1 -1
  156. package/SVF-osx/include/Util/Z3Expr.h +1 -1
  157. package/SVF-osx/include/WPA/Andersen.h +1 -1
  158. package/SVF-osx/include/WPA/CSC.h +1 -1
  159. package/SVF-osx/include/WPA/TypeAnalysis.h +0 -3
  160. package/SVF-osx/include/WPA/WPAPass.h +8 -8
  161. package/package.json +1 -1
@@ -0,0 +1,248 @@
1
+ #ifndef SVF_FE_BASIC_TYPES_H
2
+ #define SVF_FE_BASIC_TYPES_H
3
+
4
+ #include "SVF-LLVM/GEPTypeBridgeIterator.h"
5
+
6
+ #include <llvm/Pass.h>
7
+
8
+ #include <llvm/IR/Instructions.h>
9
+ #include <llvm/IR/GetElementPtrTypeIterator.h> //for gep iterator
10
+ #include <llvm/IR/GlobalVariable.h> // for GlobalVariable
11
+ #include <llvm/IR/BasicBlock.h>
12
+ #include <llvm/IR/IntrinsicInst.h>
13
+ #include <llvm/IR/LLVMContext.h>
14
+ #include <llvm/IR/Metadata.h>
15
+ #include <llvm/IR/DataLayout.h>
16
+ #include <llvm/IR/IRBuilder.h>
17
+ #include <llvm/IR/DebugInfo.h>
18
+ #include <llvm/IR/InstIterator.h>
19
+ #include <llvm/IR/GetElementPtrTypeIterator.h>
20
+ #include <llvm/IR/DerivedTypes.h>
21
+ #include <llvm/IR/Statepoint.h>
22
+
23
+ #include <llvm/Analysis/MemoryLocation.h>
24
+ #include <llvm/Analysis/DominanceFrontier.h>
25
+ #include <llvm/Analysis/PostDominators.h>
26
+ #include <llvm/Analysis/ScalarEvolution.h>
27
+ #include <llvm/Analysis/ScalarEvolutionExpressions.h>
28
+
29
+ #include <llvm/Transforms/Utils/UnifyFunctionExitNodes.h>
30
+
31
+ #include <llvm/Support/SourceMgr.h>
32
+
33
+ #include <llvm/Bitcode/BitcodeWriter.h> // for WriteBitcodeToFile
34
+ #include <llvm/Bitcode/BitcodeReader.h> /// for isBitcode
35
+ #include <llvm/IRReader/IRReader.h> // IR reader for bit file
36
+ #include <llvm/IR/InstVisitor.h> // for instruction visitor
37
+ #include <llvm/IR/InstIterator.h> // for inst iteration
38
+
39
+ #include <llvm/Analysis/LoopInfo.h>
40
+
41
+ namespace SVF
42
+ {
43
+
44
+ typedef llvm::LLVMContext LLVMContext;
45
+ typedef llvm::GlobalObject GlobalObject;
46
+ typedef llvm::Use Use;
47
+ typedef llvm::ModulePass ModulePass;
48
+ typedef llvm::IRBuilder<> IRBuilder;
49
+ #if LLVM_VERSION_MAJOR >= 12
50
+ typedef llvm::UnifyFunctionExitNodesLegacyPass UnifyFunctionExitNodes;
51
+ #else
52
+ typedef llvm::UnifyFunctionExitNodes UnifyFunctionExitNodes;
53
+ #endif
54
+
55
+ /// LLVM Basic classes
56
+ typedef llvm::Value Value;
57
+ typedef llvm::Type Type;
58
+ typedef llvm::Module Module;
59
+ typedef llvm::Function Function;
60
+ typedef llvm::BasicBlock BasicBlock;
61
+ typedef llvm::Instruction Instruction;
62
+ typedef llvm::GlobalValue GlobalValue;
63
+
64
+ typedef llvm::SMDiagnostic SMDiagnostic;
65
+ typedef llvm::BlockAddress BlockAddress;
66
+
67
+ /// LLVM types
68
+ typedef llvm::StructType StructType;
69
+ typedef llvm::ArrayType ArrayType;
70
+ typedef llvm::PointerType PointerType;
71
+ typedef llvm::IntegerType IntegerType;
72
+ typedef llvm::FunctionType FunctionType;
73
+
74
+ // LLVM Metadata
75
+ typedef llvm::MDString MDString;
76
+ typedef llvm::MetadataAsValue MetadataAsValue;
77
+
78
+ // LLVM data layout
79
+ typedef llvm::StructLayout StructLayout;
80
+ typedef llvm::ConstantStruct ConstantStruct;
81
+ typedef llvm::MemoryLocation MemoryLocation;
82
+ typedef llvm::DataLayout DataLayout;
83
+
84
+ /// LLVM metadata and debug information
85
+ typedef llvm::NamedMDNode NamedMDNode;
86
+ typedef llvm::MDNode MDNode;
87
+ typedef llvm::DISubprogram DISubprogram;
88
+
89
+ // LLVM Aliases and constants
90
+ typedef llvm::ConstantData ConstantData;
91
+ typedef llvm::ConstantAggregate ConstantAggregate;
92
+ typedef llvm::ConstantAggregateZero ConstantAggregateZero;
93
+ typedef llvm::ConstantDataSequential ConstantDataSequential;
94
+ typedef llvm::ConstantExpr ConstantExpr;
95
+ typedef llvm::ConstantDataArray ConstantDataArray;
96
+ typedef llvm::ConstantData ConstantData;
97
+ typedef llvm::ConstantArray ConstantArray;
98
+ typedef llvm::Constant Constant;
99
+ typedef llvm::ConstantInt ConstantInt;
100
+ typedef llvm::ConstantFP ConstantFP;
101
+ typedef llvm::ConstantPointerNull ConstantPointerNull;
102
+ typedef llvm::GlobalAlias GlobalAlias;
103
+ typedef llvm::GlobalVariable GlobalVariable;
104
+
105
+ /// LLVM Dominators
106
+ typedef llvm::DominatorTree DominatorTree;
107
+ typedef llvm::DomTreeNode DomTreeNode;
108
+ typedef llvm::DominanceFrontier DominanceFrontier;
109
+ typedef llvm::PostDominatorTree PostDominatorTree;
110
+ typedef llvm::DominanceFrontierBase<llvm::BasicBlock, false> DominanceFrontierBase;
111
+
112
+ /// LLVM Loop
113
+ typedef llvm::Loop Loop;
114
+ typedef llvm::LoopInfo LoopInfo;
115
+ typedef llvm::User User;
116
+
117
+ // LLVM Instructions
118
+ typedef llvm::Argument Argument;
119
+ typedef llvm::CallBase CallBase;
120
+ typedef llvm::CallInst CallInst;
121
+ typedef llvm::StoreInst StoreInst;
122
+ typedef llvm::LoadInst LoadInst;
123
+ typedef llvm::AllocaInst AllocaInst;
124
+ typedef llvm::AtomicCmpXchgInst AtomicCmpXchgInst;
125
+ typedef llvm::AtomicRMWInst AtomicRMWInst;
126
+ typedef llvm::BitCastInst BitCastInst;
127
+ typedef llvm::BranchInst BranchInst;
128
+ typedef llvm::SwitchInst SwitchInst;
129
+ typedef llvm::CallBrInst CallBrInst;
130
+ typedef llvm::ReturnInst ReturnInst;
131
+ typedef llvm::CastInst CastInst;
132
+ typedef llvm::CmpInst CmpInst;
133
+ typedef llvm::ExtractValueInst ExtractValueInst;
134
+ typedef llvm::ExtractElementInst ExtractElementInst;
135
+ typedef llvm::GetElementPtrInst GetElementPtrInst;
136
+ typedef llvm::InvokeInst InvokeInst;
137
+ typedef llvm::ShuffleVectorInst ShuffleVectorInst;
138
+ typedef llvm::PHINode PHINode;
139
+ typedef llvm::IntToPtrInst IntToPtrInst;
140
+ typedef llvm::InsertValueInst InsertValueInst;
141
+ typedef llvm::FenceInst FenceInst;
142
+ typedef llvm::FreezeInst FreezeInst;
143
+ typedef llvm::UnreachableInst UnreachableInst;
144
+ typedef llvm::InsertElementInst InsertElementInst;
145
+ typedef llvm::LandingPadInst LandingPadInst;
146
+ typedef llvm::ResumeInst ResumeInst;
147
+ typedef llvm::SelectInst SelectInst;
148
+ typedef llvm::VAArgInst VAArgInst;
149
+ typedef llvm::VACopyInst VACopyInst;
150
+ typedef llvm::VAEndInst VAEndInst;
151
+ typedef llvm::VAStartInst VAStartInst;
152
+ typedef llvm::BinaryOperator BinaryOperator;
153
+ typedef llvm::UnaryOperator UnaryOperator;
154
+ typedef llvm::UndefValue UndefValue;
155
+
156
+ // LLVM Intrinsic Instructions
157
+ #if LLVM_VERSION_MAJOR >= 13
158
+ typedef llvm::IntrinsicInst IntrinsicInst;
159
+ typedef llvm::DbgInfoIntrinsic DbgInfoIntrinsic;
160
+ typedef llvm::DbgVariableIntrinsic DbgVariableIntrinsic;
161
+ typedef llvm::DbgDeclareInst DbgDeclareInst;
162
+ typedef llvm::DbgAddrIntrinsic DbgAddrIntrinsic;
163
+ typedef llvm::DbgValueInst DbgValueInst;
164
+ typedef llvm::DbgLabelInst DbgLabelInst;
165
+ typedef llvm::VPIntrinsic VPIntrinsic;
166
+ typedef llvm::ConstrainedFPIntrinsic ConstrainedFPIntrinsic;
167
+ typedef llvm::ConstrainedFPCmpIntrinsic ConstrainedFPCmpIntrinsic;
168
+ typedef llvm::MinMaxIntrinsic MinMaxIntrinsic;
169
+ typedef llvm::BinaryOpIntrinsic BinaryOpIntrinsic;
170
+ typedef llvm::WithOverflowInst WithOverflowInst;
171
+ typedef llvm::SaturatingInst SaturatingInst;
172
+ typedef llvm::AtomicMemIntrinsic AtomicMemIntrinsic;
173
+ typedef llvm::AtomicMemSetInst AtomicMemSetInst;
174
+ typedef llvm::AtomicMemTransferInst AtomicMemTransferInst;
175
+ typedef llvm::AtomicMemCpyInst AtomicMemCpyInst;
176
+ typedef llvm::AtomicMemMoveInst AtomicMemMoveInst;
177
+ typedef llvm::MemIntrinsic MemIntrinsic;
178
+ typedef llvm::MemSetInst MemSetInst;
179
+ typedef llvm::MemTransferInst MemTransferInst;
180
+ typedef llvm::MemCpyInst MemCpyInst;
181
+ typedef llvm::MemMoveInst MemMoveInst;
182
+ typedef llvm::MemCpyInlineInst MemCpyInlineInst;
183
+ typedef llvm::AnyMemIntrinsic AnyMemIntrinsic;
184
+ typedef llvm::AnyMemSetInst AnyMemSetInst;
185
+ typedef llvm::AnyMemTransferInst AnyMemTransferInst;
186
+ typedef llvm::AnyMemCpyInst AnyMemCpyInst;
187
+ typedef llvm::AnyMemMoveInst AnyMemMoveInst;
188
+ typedef llvm::VAStartInst VAStartInst;
189
+ typedef llvm::VAEndInst VAEndInst;
190
+ typedef llvm::VACopyInst VACopyInst;
191
+ typedef llvm::InstrProfIncrementInst InstrProfIncrementInst;
192
+ typedef llvm::InstrProfIncrementInstStep InstrProfIncrementInstStep;
193
+ typedef llvm::InstrProfValueProfileInst InstrProfValueProfileInst;
194
+ typedef llvm::PseudoProbeInst PseudoProbeInst;
195
+ typedef llvm::NoAliasScopeDeclInst NoAliasScopeDeclInst;
196
+ typedef llvm::GCStatepointInst GCStatepointInst;
197
+ typedef llvm::GCProjectionInst GCProjectionInst;
198
+ typedef llvm::GCRelocateInst GCRelocateInst;
199
+ typedef llvm::GCResultInst GCResultInst;
200
+ typedef llvm::AssumeInst AssumeInst;
201
+ #endif
202
+
203
+ // LLVM Debug Information
204
+ typedef llvm::DIType DIType;
205
+ typedef llvm::DICompositeType DICompositeType;
206
+ typedef llvm::DIDerivedType DIDerivedType;
207
+ typedef llvm::DebugInfoFinder DebugInfoFinder;
208
+ typedef llvm::DISubroutineType DISubroutineType;
209
+ typedef llvm::DIBasicType DIBasicType;
210
+ typedef llvm::DISubrange DISubrange;
211
+ typedef llvm::DINode DINode;
212
+ typedef llvm::DINodeArray DINodeArray;
213
+ typedef llvm::DITypeRefArray DITypeRefArray;
214
+ namespace dwarf = llvm::dwarf;
215
+
216
+ // Iterators.
217
+ typedef llvm::inst_iterator inst_iterator;
218
+ typedef llvm::const_inst_iterator const_inst_iterator;
219
+ typedef llvm::gep_type_iterator gep_type_iterator;
220
+ typedef llvm::bridge_gep_iterator bridge_gep_iterator;
221
+ typedef llvm::const_inst_iterator const_inst_iterator;
222
+ typedef llvm::const_pred_iterator const_pred_iterator;
223
+
224
+ // LLVM Scalar Evolution.
225
+ typedef llvm::ScalarEvolutionWrapperPass ScalarEvolutionWrapperPass;
226
+ typedef llvm::SCEVAddRecExpr SCEVAddRecExpr;
227
+ typedef llvm::SCEVConstant SCEVConstant;
228
+ typedef llvm::ScalarEvolution ScalarEvolution;
229
+ typedef llvm::SCEV SCEV;
230
+
231
+ /// LLVM outputs
232
+ typedef llvm::raw_fd_ostream raw_fd_ostream;
233
+
234
+ // LLVM Types.
235
+ typedef llvm::VectorType VectorType;
236
+ #if (LLVM_VERSION_MAJOR >= 9)
237
+ typedef llvm::FunctionCallee FunctionCallee;
238
+ #endif
239
+
240
+ /// LLVM Iterators
241
+ #if LLVM_VERSION_MAJOR >= 11
242
+ typedef llvm::const_succ_iterator succ_const_iterator;
243
+ #else
244
+ typedef llvm::succ_const_iterator succ_const_iterator;
245
+ #endif
246
+ } // End namespace SVF
247
+
248
+ #endif // SVF_FE_BASIC_TYPES_H
@@ -0,0 +1,94 @@
1
+ //===- BreakConstantGEPs.h - Change constant GEPs into GEP instructions --- --//
2
+ //
3
+ // The SAFECode Compiler
4
+ //
5
+ // This file was developed by the LLVM research group and is distributed under
6
+ // the University of Illinois Open Source License. See LICENSE.TXT for details.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+ //
10
+ // This pass changes all GEP constant expressions into GEP instructions. This
11
+ // permits the rest of SAFECode to put run-time checks on them if necessary.
12
+ //
13
+ //===----------------------------------------------------------------------===//
14
+
15
+ #ifndef BREAKCONSTANTGEPS_H
16
+ #define BREAKCONSTANTGEPS_H
17
+
18
+ #include "SVFIR/SVFValue.h"
19
+
20
+ namespace SVF
21
+ {
22
+
23
+ //
24
+ // Pass: BreakConstantGEPs
25
+ //
26
+ // Description:
27
+ // This pass modifies a function so that it uses GEP instructions instead of
28
+ // GEP constant expressions.
29
+ //
30
+ class BreakConstantGEPs : public ModulePass
31
+ {
32
+ private:
33
+ // Private methods
34
+
35
+ // Private variables
36
+
37
+ public:
38
+ static char ID;
39
+ BreakConstantGEPs() : ModulePass(ID) {}
40
+ llvm::StringRef getPassName() const
41
+ {
42
+ return "Remove Constant GEP Expressions";
43
+ }
44
+ virtual bool runOnModule (Module & M);
45
+ };
46
+
47
+
48
+ //
49
+ // Pass: MergeFunctionRets
50
+ //
51
+ // Description:
52
+ // This pass modifies a function so that each function only have one unified exit basic block
53
+ //
54
+ class MergeFunctionRets : public ModulePass
55
+ {
56
+ private:
57
+ // Private methods
58
+
59
+ // Private variables
60
+
61
+ public:
62
+ static char ID;
63
+ MergeFunctionRets() : ModulePass(ID) {}
64
+ llvm::StringRef getPassName() const
65
+ {
66
+ return "unify function exit into one dummy exit basic block";
67
+ }
68
+ virtual bool runOnModule (Module & M)
69
+ {
70
+ UnifyFunctionExit(M);
71
+ return true;
72
+ }
73
+ inline void UnifyFunctionExit(Module& module)
74
+ {
75
+ for (Module::const_iterator iter = module.begin(), eiter = module.end();
76
+ iter != eiter; ++iter)
77
+ {
78
+ const Function& fun = *iter;
79
+ if(fun.isDeclaration())
80
+ continue;
81
+ getUnifyExit(fun)->runOnFunction(const_cast<Function&>(fun));
82
+ }
83
+ }
84
+ /// Get Unified Exit basic block node
85
+ inline UnifyFunctionExitNodes* getUnifyExit(const Function& fn)
86
+ {
87
+ assert(!fn.isDeclaration() && "external function does not have DF");
88
+ return &getAnalysis<UnifyFunctionExitNodes>(const_cast<Function&>(fn));
89
+ }
90
+ };
91
+
92
+ } // End namespace SVF
93
+
94
+ #endif
@@ -0,0 +1,73 @@
1
+ //===----- CHGBuiler.h -- Class hierarchy graph 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
+ * CHGBuiler.h
25
+ *
26
+ * Created on: Jun 4, 2021
27
+ * Author: Yulei Sui
28
+ */
29
+
30
+ #include "Graphs/CHG.h"
31
+ #include "SVF-LLVM/BasicTypes.h"
32
+
33
+ namespace SVF
34
+ {
35
+
36
+ class CHGBuilder
37
+ {
38
+
39
+ private:
40
+ CHGraph* chg;
41
+
42
+ public:
43
+ typedef CHGraph::CHNodeSetTy CHNodeSetTy;
44
+ typedef CHGraph::WorkList WorkList;
45
+
46
+ CHGBuilder(CHGraph* c): chg(c)
47
+ {
48
+
49
+ }
50
+ void buildCHG();
51
+ void buildCHGNodes(const GlobalValue *V);
52
+ void buildCHGNodes(const Function* F);
53
+ void buildCHGEdges(const Function* F);
54
+ void buildInternalMaps();
55
+ void readInheritanceMetadataFromModule(const Module &M);
56
+
57
+ CHNode *createNode(const std::string name);
58
+
59
+ void connectInheritEdgeViaCall(const Function* caller, const CallBase* cs);
60
+ void connectInheritEdgeViaStore(const Function* caller, const StoreInst* store);
61
+
62
+ void buildClassNameToAncestorsDescendantsMap();
63
+ const CHGraph::CHNodeSetTy& getInstancesAndDescendants(const std::string className);
64
+
65
+ void analyzeVTables(const Module &M);
66
+ void buildVirtualFunctionToIDMap();
67
+ void buildCSToCHAVtblsAndVfnsMap();
68
+ const CHNodeSetTy& getCSClasses(const CallBase* cs);
69
+ void addFuncToFuncVector(CHNode::FuncVector &v, const Function *f);
70
+ };
71
+
72
+ } // End namespace SVF
73
+
@@ -0,0 +1,130 @@
1
+ //===- CPPUtil.h -- Base class of pointer analyses ---------------------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-2017> <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
+ * CPPUtil.h
25
+ *
26
+ * Created on: Apr 13, 2016
27
+ * Author: Xiaokang Fan
28
+ */
29
+
30
+ #ifndef CPPUtil_H_
31
+ #define CPPUtil_H_
32
+
33
+ #include "SVFIR/SVFValue.h"
34
+ #include "SVF-LLVM/BasicTypes.h"
35
+
36
+ namespace SVF
37
+ {
38
+
39
+ class CHGraph;
40
+ /*
41
+ * Util class to assist pointer analysis for cpp programs
42
+ */
43
+
44
+ namespace cppUtil
45
+ {
46
+
47
+ struct DemangledName
48
+ {
49
+ std::string className;
50
+ std::string funcName;
51
+ bool isThunkFunc;
52
+ };
53
+
54
+ struct DemangledName demangle(const std::string &name);
55
+
56
+ std::string getBeforeBrackets(const std::string &name);
57
+ bool isValVtbl(const Value* val);
58
+ bool isLoadVtblInst(const LoadInst *loadInst);
59
+ bool isVirtualCallSite(const CallBase* cs);
60
+ bool isConstructor(const Function* F);
61
+ bool isDestructor(const Function* F);
62
+ bool isCPPThunkFunction(const Function* F);
63
+ const Function* getThunkTarget(const Function* F);
64
+
65
+ /*
66
+ * VtableA = {&A::foo}
67
+ * A::A(this){
68
+ * *this = &VtableA;
69
+ * }
70
+ *
71
+ *
72
+ * A* p = new A;
73
+ * cs: p->foo(...)
74
+ * ==>
75
+ * vtptr = *p;
76
+ * vfn = &vtptr[i]
77
+ * %funp = *vfn
78
+ * call %funp(p,...)
79
+ * getConstructorThisPtr(A) return "this" pointer
80
+ * getVCallThisPtr(cs) return p (this pointer)
81
+ * getVCallVtblPtr(cs) return vtptr
82
+ * getVCallIdx(cs) return i
83
+ * getClassNameFromVtblObj(VtableA) return
84
+ * getClassNameFromType(type of p) return type A
85
+ */
86
+ const Argument* getConstructorThisPtr(const Function* fun);
87
+ const Value* getVCallThisPtr(const CallBase* cs);
88
+ const Value* getVCallVtblPtr(const CallBase* cs);
89
+ s32_t getVCallIdx(const CallBase* cs);
90
+ std::string getClassNameFromVtblObj(const std::string& vtblName);
91
+ std::string getClassNameFromType(const Type* ty);
92
+ std::string getClassNameOfThisPtr(const CallBase* cs);
93
+ std::string getFunNameOfVCallSite(const CallBase* cs);
94
+ bool VCallInCtorOrDtor(const CallBase* cs);
95
+
96
+ /*
97
+ * A(A* this){
98
+ * store this this.addr;
99
+ * tmp = load this.addr;
100
+ * this1 = bitcast(tmp);
101
+ * B(this1);
102
+ * }
103
+ * this and this1 are the same thisPtr in the constructor
104
+ */
105
+ bool isSameThisPtrInConstructor(const Argument* thisPtr1, const Value* thisPtr2);
106
+
107
+ /// Constants pertaining to CTir, for C and C++.
108
+ /// TODO: move helper functions here too?
109
+ namespace ctir
110
+ {
111
+ /// On loads, stores, GEPs representing dereferences, and calls
112
+ /// representing virtual calls.
113
+ /// (The static type.)
114
+ const std::string derefMDName = "ctir";
115
+ /// On the (global) virtual table itself.
116
+ /// (The class it corresponds to.)
117
+ const std::string vtMDName = "ctir.vt";
118
+ /// On the bitcast of `this` to i8*.
119
+ /// (The class the constructor it corresponds to.)
120
+ const std::string vtInitMDName = "ctir.vt.init";
121
+
122
+ /// Value we expect a ctir-annotated module to have.
123
+ const uint32_t moduleFlagValue = 1;
124
+ }
125
+
126
+ } // End namespace cppUtil
127
+
128
+ } // End namespace SVF
129
+
130
+ #endif /* CPPUtil_H_ */