svf-lib 1.0.2246 → 1.0.2248

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 (33) hide show
  1. package/SVF-linux-x86_64/Release-build/bin/ae +0 -0
  2. package/SVF-linux-x86_64/Release-build/bin/cfl +0 -0
  3. package/SVF-linux-x86_64/Release-build/bin/dvf +0 -0
  4. package/SVF-linux-x86_64/Release-build/bin/mta +0 -0
  5. package/SVF-linux-x86_64/Release-build/bin/saber +0 -0
  6. package/SVF-linux-x86_64/Release-build/bin/svf-ex +0 -0
  7. package/SVF-linux-x86_64/Release-build/bin/wpa +0 -0
  8. package/SVF-linux-x86_64/Release-build/include/Graphs/CHG.h +0 -1
  9. package/SVF-linux-x86_64/Release-build/include/Graphs/CallGraph.h +0 -1
  10. package/SVF-linux-x86_64/Release-build/include/Graphs/ThreadCallGraph.h +0 -1
  11. package/SVF-linux-x86_64/Release-build/include/MTA/MTA.h +0 -1
  12. package/SVF-linux-x86_64/Release-build/include/MemoryModel/PointerAnalysis.h +0 -1
  13. package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/BreakConstantExpr.h +0 -1
  14. package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/CppUtil.h +1 -1
  15. package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/DCHG.h +3 -7
  16. package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/LLVMModule.h +67 -139
  17. package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/LLVMUtil.h +4 -9
  18. package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/ObjTypeInference.h +0 -1
  19. package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/SVFIRBuilder.h +21 -18
  20. package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/SymbolTableBuilder.h +1 -1
  21. package/SVF-linux-x86_64/Release-build/include/SVFIR/SVFType.h +9 -2
  22. package/SVF-linux-x86_64/Release-build/include/SVFIR/SVFVariables.h +11 -3
  23. package/SVF-linux-x86_64/Release-build/include/Util/CallGraphBuilder.h +0 -1
  24. package/SVF-linux-x86_64/Release-build/include/Util/ThreadAPI.h +0 -1
  25. package/SVF-linux-x86_64/Release-build/include/WPA/Andersen.h +0 -1
  26. package/SVF-linux-x86_64/Release-build/include/WPA/FlowSensitive.h +0 -1
  27. package/SVF-linux-x86_64/Release-build/include/WPA/VersionedFlowSensitive.h +0 -1
  28. package/SVF-linux-x86_64/Release-build/include/WPA/WPAPass.h +0 -1
  29. package/SVF-linux-x86_64/Release-build/lib/libSvfCore.so +0 -0
  30. package/SVF-linux-x86_64/Release-build/lib/libSvfLLVM.so.16 +0 -0
  31. package/package.json +1 -1
  32. package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/SVFLLVMValue.h +0 -387
  33. package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/SVFModule.h +0 -186
@@ -323,12 +323,14 @@ class SVFFunctionType : public SVFType
323
323
 
324
324
  private:
325
325
  const SVFType* retTy;
326
+ std::vector<const SVFType*> params;
326
327
 
327
328
  public:
328
- SVFFunctionType(const SVFType* rt)
329
- : SVFType(false, SVFFunctionTy, 1), retTy(rt)
329
+ SVFFunctionType(const SVFType* rt, const std::vector<const SVFType*>& p)
330
+ : SVFType(false, SVFFunctionTy, 1), retTy(rt), params(p)
330
331
  {
331
332
  }
333
+
332
334
  static inline bool classof(const SVFType* node)
333
335
  {
334
336
  return node->getKind() == SVFFunctionTy;
@@ -338,6 +340,11 @@ public:
338
340
  return retTy;
339
341
  }
340
342
 
343
+ const std::vector<const SVFType*>& getParamTypes() const
344
+ {
345
+ return params;
346
+ }
347
+
341
348
  void print(std::ostream& os) const override;
342
349
  };
343
350
 
@@ -955,6 +955,7 @@ class FunObjVar : public BaseObjVar
955
955
  friend class SVFIRWriter;
956
956
  friend class SVFIRReader;
957
957
  friend class SVFIRBuilder;
958
+ friend class LLVMModuleSet;
958
959
 
959
960
  public:
960
961
  typedef SVFLoopAndDomInfo::BBSet BBSet;
@@ -976,7 +977,7 @@ private:
976
977
  const FunObjVar * realDefFun; /// the definition of a function across multiple modules
977
978
  BasicBlockGraph* bbGraph; /// the basic block graph of this function
978
979
  std::vector<const ArgValVar*> allArgs; /// all formal arguments of this function
979
- SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
980
+ const SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
980
981
 
981
982
 
982
983
  private:
@@ -1015,9 +1016,16 @@ public:
1015
1016
  /// Constructor
1016
1017
  FunObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node);
1017
1018
 
1019
+
1020
+ virtual ~FunObjVar()
1021
+ {
1022
+ delete loopAndDom;
1023
+ delete bbGraph;
1024
+ }
1025
+
1018
1026
  void initFunObjVar(bool decl, bool intrinc, bool addr, bool uncalled, bool notret, bool vararg, const SVFFunctionType *ft,
1019
1027
  SVFLoopAndDomInfo *ld, const FunObjVar *real, BasicBlockGraph *bbg,
1020
- const std::vector<const ArgValVar *> &allarg, SVFBasicBlock *exit);
1028
+ const std::vector<const ArgValVar *> &allarg, const SVFBasicBlock *exit);
1021
1029
 
1022
1030
  void setRelDefFun(const FunObjVar *real)
1023
1031
  {
@@ -1072,7 +1080,7 @@ public:
1072
1080
  return funcType->getReturnType();
1073
1081
  }
1074
1082
 
1075
- inline SVFLoopAndDomInfo* getLoopAndDomInfo()
1083
+ inline SVFLoopAndDomInfo* getLoopAndDomInfo() const
1076
1084
  {
1077
1085
  return loopAndDom;
1078
1086
  }
@@ -37,7 +37,6 @@ namespace SVF
37
37
  {
38
38
 
39
39
  class ICFG;
40
- class SVFModule;
41
40
  class CallGraph;
42
41
  class ThreadCallGraph;
43
42
 
@@ -35,7 +35,6 @@
35
35
  namespace SVF
36
36
  {
37
37
 
38
- class SVFModule;
39
38
  class ICFGNode;
40
39
  class CallICFGNode;
41
40
  class SVFVar;
@@ -45,7 +45,6 @@
45
45
  namespace SVF
46
46
  {
47
47
 
48
- class SVFModule;
49
48
 
50
49
  class ThreadCallGraph;
51
50
 
@@ -40,7 +40,6 @@ namespace SVF
40
40
  {
41
41
 
42
42
  class AndersenWaveDiff;
43
- class SVFModule;
44
43
 
45
44
  /*!
46
45
  * Flow sensitive whole program pointer analysis
@@ -24,7 +24,6 @@ namespace SVF
24
24
  {
25
25
 
26
26
  class AndersenWaveDiff;
27
- class SVFModule;
28
27
 
29
28
  /*!
30
29
  * Versioned flow sensitive whole program pointer analysis
@@ -42,7 +42,6 @@
42
42
  namespace SVF
43
43
  {
44
44
 
45
- class SVFModule;
46
45
  class SVFG;
47
46
 
48
47
  /*!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2246",
3
+ "version": "1.0.2248",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,387 +0,0 @@
1
- //===- BasicTypes.h -- Basic types used in SVF-------------------------------//
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 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
- * BasicTypes.h
25
- *
26
- * Created on: Apr 1, 2014
27
- * Author: Yulei Sui
28
- */
29
-
30
- #ifndef INCLUDE_SVFLLVM_SVFVALUE_H_
31
- #define INCLUDE_SVFLLVM_SVFVALUE_H_
32
-
33
- #include "SVFIR/SVFType.h"
34
- #include "Graphs/GraphPrinter.h"
35
- #include "Util/Casting.h"
36
- #include "Graphs/BasicBlockG.h"
37
- #include "SVFIR/SVFValue.h"
38
- #include "Util/SVFLoopAndDomInfo.h"
39
-
40
- namespace SVF
41
- {
42
-
43
- /// LLVM Aliases and constants
44
- typedef SVF::GraphPrinter GraphPrinter;
45
-
46
- class CallGraphNode;
47
- class SVFInstruction;
48
- class SVFBasicBlock;
49
- class SVFArgument;
50
- class SVFFunction;
51
- class SVFType;
52
-
53
- class SVFLLVMValue
54
- {
55
- friend class SVFIRWriter;
56
- friend class SVFIRReader;
57
- friend class LLVMModuleSet;
58
-
59
- public:
60
- typedef s64_t GNodeK;
61
-
62
- enum SVFValKind
63
- {
64
- SVFVal,
65
- SVFFunc,
66
- };
67
-
68
- private:
69
- GNodeK kind; ///< used for classof
70
- bool ptrInUncalledFun; ///< true if this pointer is in an uncalled function
71
- bool constDataOrAggData; ///< true if this value is a ConstantData (e.g., numbers, string, floats) or a constantAggregate
72
-
73
- protected:
74
- const SVFType* type; ///< Type of this SVFValue
75
- std::string name; ///< Short name of value for printing & debugging
76
- std::string sourceLoc; ///< Source code information of this value
77
- /// Constructor without name
78
- SVFLLVMValue(const SVFType* ty, SVFValKind k = SVFVal)
79
- : kind(k), ptrInUncalledFun(false),
80
- constDataOrAggData(false), type(ty), sourceLoc("NoLoc")
81
- {
82
- }
83
-
84
- ///@{ attributes to be set only through Module builders e.g.,
85
- /// LLVMModule
86
- inline void setConstDataOrAggData()
87
- {
88
- constDataOrAggData = true;
89
- }
90
- inline void setPtrInUncalledFunction()
91
- {
92
- ptrInUncalledFun = true;
93
- }
94
- ///@}
95
- public:
96
- SVFLLVMValue() = delete;
97
- virtual ~SVFLLVMValue() = default;
98
-
99
- /// Get the type of this SVFValue
100
- inline GNodeK getKind() const
101
- {
102
- return kind;
103
- }
104
-
105
- inline const std::string &getName() const
106
- {
107
- return name;
108
- }
109
-
110
- inline void setName(std::string&& n)
111
- {
112
- name = std::move(n);
113
- }
114
-
115
- inline virtual const SVFType* getType() const
116
- {
117
- return type;
118
- }
119
- inline bool isConstDataOrAggData() const
120
- {
121
- return constDataOrAggData;
122
- }
123
- inline bool ptrInUncalledFunction() const
124
- {
125
- return ptrInUncalledFun;
126
- }
127
- inline virtual void setSourceLoc(const std::string& sourceCodeInfo)
128
- {
129
- sourceLoc = sourceCodeInfo;
130
- }
131
- inline virtual const std::string getSourceLoc() const
132
- {
133
- return sourceLoc;
134
- }
135
-
136
- /// Needs to be implemented by a SVF front end
137
- std::string toString() const;
138
-
139
- /// Overloading operator << for dumping ICFG node ID
140
- //@{
141
- friend OutStream& operator<<(OutStream &os, const SVFLLVMValue &value)
142
- {
143
- return os << value.toString();
144
- }
145
- //@}
146
- };
147
-
148
- class ArgValVar;
149
-
150
- class SVFFunction : public SVFLLVMValue
151
- {
152
- friend class LLVMModuleSet;
153
- friend class SVFIRWriter;
154
- friend class SVFIRReader;
155
- friend class SVFIRBuilder;
156
-
157
- public:
158
- typename BasicBlockGraph::IDToNodeMapTy::iterator iterator;
159
- typedef BasicBlockGraph::IDToNodeMapTy::const_iterator const_iterator;
160
- typedef SVFLoopAndDomInfo::BBSet BBSet;
161
- typedef SVFLoopAndDomInfo::BBList BBList;
162
- typedef SVFLoopAndDomInfo::LoopBBs LoopBBs;
163
-
164
- private:
165
- bool isDecl; /// return true if this function does not have a body
166
- bool intrinsic; /// return true if this function is an intrinsic function (e.g., llvm.dbg), which does not reside in the application code
167
- bool addrTaken; /// return true if this function is address-taken (for indirect call purposes)
168
- bool isUncalled; /// return true if this function is never called
169
- bool isNotRet; /// return true if this function never returns
170
- bool varArg; /// return true if this function supports variable arguments
171
- const SVFFunctionType* funcType; /// FunctionType, which is different from the type (PointerType) of this SVFFunction
172
- SVFLoopAndDomInfo* loopAndDom; /// the loop and dominate information
173
- const SVFFunction* realDefFun; /// the definition of a function across multiple modules
174
- std::vector<const ArgValVar*> allArgs; /// all formal arguments of this function
175
- SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
176
- BasicBlockGraph* bbGraph; /// the basic block graph of this function
177
-
178
- protected:
179
-
180
- inline void addArgument(const ArgValVar* arg)
181
- {
182
- allArgs.push_back(arg);
183
- }
184
-
185
- inline void setIsUncalledFunction(bool uncalledFunction)
186
- {
187
- isUncalled = uncalledFunction;
188
- }
189
-
190
- inline void setIsNotRet(bool notRet)
191
- {
192
- isNotRet = notRet;
193
- }
194
-
195
- inline void setDefFunForMultipleModule(const SVFFunction* deffun)
196
- {
197
- realDefFun = deffun;
198
- }
199
- /// @}
200
-
201
- public:
202
- SVFFunction(const SVFType* ty,const SVFFunctionType* ft, bool declare, bool intrinsic, bool addrTaken, bool varg, SVFLoopAndDomInfo* ld);
203
- SVFFunction(void) = delete;
204
- virtual ~SVFFunction();
205
-
206
- static inline bool classof(const SVFLLVMValue *node)
207
- {
208
- return node->getKind() == SVFFunc;
209
- }
210
-
211
- inline SVFLoopAndDomInfo* getLoopAndDomInfo()
212
- {
213
- return loopAndDom;
214
- }
215
- inline bool isDeclaration() const
216
- {
217
- return isDecl;
218
- }
219
-
220
- void setBasicBlockGraph(BasicBlockGraph* graph)
221
- {
222
- this->bbGraph = graph;
223
- }
224
-
225
- BasicBlockGraph* getBasicBlockGraph()
226
- {
227
- return bbGraph;
228
- }
229
-
230
- const BasicBlockGraph* getBasicBlockGraph() const
231
- {
232
- return bbGraph;
233
- }
234
-
235
- inline bool isIntrinsic() const
236
- {
237
- return intrinsic;
238
- }
239
-
240
- inline bool hasAddressTaken() const
241
- {
242
- return addrTaken;
243
- }
244
-
245
- /// Returns the FunctionType
246
- inline const SVFFunctionType* getFunctionType() const
247
- {
248
- return funcType;
249
- }
250
-
251
- /// Returns the FunctionType
252
- inline const SVFType* getReturnType() const
253
- {
254
- return funcType->getReturnType();
255
- }
256
-
257
- inline const SVFFunction* getDefFunForMultipleModule() const
258
- {
259
- if(realDefFun==nullptr)
260
- return this;
261
- return realDefFun;
262
- }
263
-
264
- u32_t arg_size() const;
265
- const ArgValVar* getArg(u32_t idx) const;
266
- bool isVarArg() const;
267
-
268
- inline bool hasBasicBlock() const
269
- {
270
- return bbGraph && bbGraph->begin() != bbGraph->end();
271
- }
272
-
273
- inline const SVFBasicBlock* getEntryBlock() const
274
- {
275
- assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
276
- assert(bbGraph->begin()->second->getInEdges().size() == 0 && "the first basic block is not entry block");
277
- return bbGraph->begin()->second;
278
- }
279
-
280
- /// Carefully! when you call getExitBB, you need ensure the function has return instruction
281
- /// more refer to: https://github.com/SVF-tools/SVF/pull/1262
282
- const SVFBasicBlock* getExitBB() const;
283
-
284
- void setExitBlock(SVFBasicBlock *bb);
285
-
286
- inline const SVFBasicBlock* front() const
287
- {
288
- return getEntryBlock();
289
- }
290
-
291
- inline const SVFBasicBlock* back() const
292
- {
293
- assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
294
- /// Carefully! 'back' is just the last basic block of function,
295
- /// but not necessarily a exit basic block
296
- /// more refer to: https://github.com/SVF-tools/SVF/pull/1262
297
- return std::prev(bbGraph->end())->second;
298
- }
299
-
300
- inline const_iterator begin() const
301
- {
302
- return bbGraph->begin();
303
- }
304
-
305
- inline const_iterator end() const
306
- {
307
- return bbGraph->end();
308
- }
309
-
310
-
311
- inline const std::vector<const SVFBasicBlock*>& getReachableBBs() const
312
- {
313
- return loopAndDom->getReachableBBs();
314
- }
315
-
316
- inline bool isUncalledFunction() const
317
- {
318
- return isUncalled;
319
- }
320
-
321
- inline bool hasReturn() const
322
- {
323
- return !isNotRet;
324
- }
325
-
326
- inline void getExitBlocksOfLoop(const SVFBasicBlock* bb, BBList& exitbbs) const
327
- {
328
- return loopAndDom->getExitBlocksOfLoop(bb,exitbbs);
329
- }
330
-
331
- inline bool hasLoopInfo(const SVFBasicBlock* bb) const
332
- {
333
- return loopAndDom->hasLoopInfo(bb);
334
- }
335
-
336
- const LoopBBs& getLoopInfo(const SVFBasicBlock* bb) const
337
- {
338
- return loopAndDom->getLoopInfo(bb);
339
- }
340
-
341
- inline const SVFBasicBlock* getLoopHeader(const BBList& lp) const
342
- {
343
- return loopAndDom->getLoopHeader(lp);
344
- }
345
-
346
- inline bool loopContainsBB(const BBList& lp, const SVFBasicBlock* bb) const
347
- {
348
- return loopAndDom->loopContainsBB(lp,bb);
349
- }
350
-
351
- inline const Map<const SVFBasicBlock*,BBSet>& getDomTreeMap() const
352
- {
353
- return loopAndDom->getDomTreeMap();
354
- }
355
-
356
- inline const Map<const SVFBasicBlock*,BBSet>& getDomFrontierMap() const
357
- {
358
- return loopAndDom->getDomFrontierMap();
359
- }
360
-
361
- inline bool isLoopHeader(const SVFBasicBlock* bb) const
362
- {
363
- return loopAndDom->isLoopHeader(bb);
364
- }
365
-
366
- inline bool dominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
367
- {
368
- return loopAndDom->dominate(bbKey,bbValue);
369
- }
370
-
371
- inline bool postDominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
372
- {
373
- return loopAndDom->postDominate(bbKey,bbValue);
374
- }
375
- };
376
-
377
- /// [FOR DEBUG ONLY, DON'T USE IT UNSIDE `svf`!]
378
- /// Converts an SVFValue to corresponding LLVM::Value, then get the string
379
- /// representation of it. Use it only when you are debugging. Don't use
380
- /// it in any SVF algorithm because it relies on information stored in LLVM bc.
381
- std::string dumpLLVMValue(const SVFLLVMValue* svfValue);
382
-
383
-
384
-
385
- } // End namespace SVF
386
-
387
- #endif /* INCLUDE_SVFLLVM_SVFVALUE_H_ */