svf-lib 1.0.1656 → 1.0.1658

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.
@@ -78,17 +78,17 @@ public:
78
78
 
79
79
  inline bool isBackICFGEdge(const ICFGEdge *edge) const
80
80
  {
81
- return backICFGEdges.find(edge) != entryICFGEdges.end();
81
+ return backICFGEdges.find(edge) != backICFGEdges.end();
82
82
  }
83
83
 
84
84
  inline bool isInICFGEdge(const ICFGEdge *edge) const
85
85
  {
86
- return inICFGEdges.find(edge) != entryICFGEdges.end();
86
+ return inICFGEdges.find(edge) != inICFGEdges.end();
87
87
  }
88
88
 
89
89
  inline bool isOutICFGEdge(const ICFGEdge *edge) const
90
90
  {
91
- return outICFGEdges.find(edge) != entryICFGEdges.end();
91
+ return outICFGEdges.find(edge) != outICFGEdges.end();
92
92
  }
93
93
 
94
94
  inline void addEntryICFGEdge(const ICFGEdge *edge)
@@ -239,24 +239,8 @@ public:
239
239
  /// Remove unused function in extapi.bc module
240
240
  bool isCalledExtFunction(Function* func)
241
241
  {
242
- /// check if a llvm Function is called.
243
- auto isCalledFunction = [](llvm::Function* F)
244
- {
245
- for (auto& use : F->uses())
246
- {
247
- llvm::User* user = use.getUser();
248
-
249
- if (llvm::isa<llvm::CallBase>(user))
250
- {
251
- return true;
252
- }
253
- }
254
- return false;
255
- };
256
242
  /// if this function func defined in extapi.bc but never used in application code (without any corresponding declared functions).
257
243
  if (func->getParent()->getName().str() == Options::ExtAPIInput()
258
- && !isCalledFunction(func)
259
- && func->getName().str() != "svf__main"
260
244
  && FunDefToDeclsMap.find(func) == FunDefToDeclsMap.end()
261
245
  && std::find(ExtFuncsVec.begin(), ExtFuncsVec.end(), func) == ExtFuncsVec.end())
262
246
  {
@@ -376,6 +376,10 @@ bool isIntrinsicFun(const Function* func);
376
376
  std::vector<const Function *> getCalledFunctions(const Function *F);
377
377
  std::vector<std::string> getFunAnnotations(const Function* fun);
378
378
  void removeFunAnnotations(std::vector<Function*>& removedFuncList);
379
+ bool isUnusedGlobalVariable(const GlobalVariable& global);
380
+ void removeUnusedGlobalVariables(Module* module);
381
+ /// Delete unused functions, annotations and global variables in extapi.bc
382
+ void removeUnusedFuncsAndAnnotationsAndGlobalVariables(std::vector<Function*> removedFuncList);
379
383
 
380
384
  inline u32_t SVFType2ByteSize(const SVFType* type)
381
385
  {
@@ -394,15 +398,6 @@ inline u32_t SVFType2ByteSize(const SVFType* type)
394
398
  return llvm_elem_size;
395
399
  }
396
400
 
397
- inline void removeUnusedFuncsAndAnnotations(std::vector<Function*> removedFuncList)
398
- {
399
- /// Remove unused function annotations in extapi.bc
400
- LLVMUtil::removeFunAnnotations(removedFuncList);
401
- /// Remove unused function in extapi.bc
402
- for (Function* func : removedFuncList)
403
- func->eraseFromParent();
404
- }
405
-
406
401
  /// Get the corresponding Function based on its name
407
402
  inline const SVFFunction* getFunction(const std::string& name)
408
403
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1656",
3
+ "version": "1.0.1658",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {