svf-lib 1.0.1631 → 1.0.1633

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.
@@ -237,14 +237,26 @@ public:
237
237
  SVFOtherValue* getSVFOtherValue(const Value* ov);
238
238
 
239
239
  /// Remove unused function in extapi.bc module
240
- bool isUsedExtFunction(Function* func)
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
+ };
242
256
  /// if this function func defined in extapi.bc but never used in application code (without any corresponding declared functions).
243
257
  if (func->getParent()->getName().str() == Options::ExtAPIInput()
258
+ && !isCalledFunction(func)
244
259
  && func->getName().str() != "svf__main"
245
- && func->getName().str() != "malloc"
246
- && func->getName().str() != "main"
247
- && func->getName().substr(0,4) != "sse_"
248
260
  && FunDefToDeclsMap.find(func) == FunDefToDeclsMap.end()
249
261
  && std::find(ExtFuncsVec.begin(), ExtFuncsVec.end(), func) == ExtFuncsVec.end())
250
262
  {
@@ -47,13 +47,13 @@ class VFGNode : public GenericVFGNodeTy
47
47
  {
48
48
 
49
49
  public:
50
- /// 24 kinds of ICFG node
50
+ /// 25 kinds of ICFG node
51
51
  /// Gep represents offset edge for field sensitivity
52
52
  enum VFGNodeK
53
53
  {
54
54
  Addr, Copy, Gep, Store, Load, Cmp, BinaryOp, UnaryOp, Branch, TPhi, TIntraPhi, TInterPhi,
55
55
  MPhi, MIntraPhi, MInterPhi, FRet, ARet, AParm, FParm,
56
- FunRet, APIN, APOUT, FPIN, FPOUT, NPtr, DummyVProp
56
+ APIN, APOUT, FPIN, FPOUT, NPtr, DummyVProp
57
57
  };
58
58
 
59
59
  typedef VFGEdge::VFGEdgeSetTy::iterator iterator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1631",
3
+ "version": "1.0.1633",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {