svf-tools 1.0.995 → 1.0.997

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 (43) hide show
  1. package/package.json +1 -1
  2. package/setup.sh +0 -1
  3. package/svf/include/Graphs/CDG.h +1 -1
  4. package/svf/include/Graphs/CHG.h +10 -8
  5. package/svf/include/Graphs/GenericGraph.h +22 -1
  6. package/svf/include/Graphs/ICFGNode.h +37 -62
  7. package/svf/include/MSSA/MSSAMuChi.h +2 -2
  8. package/svf/include/MTA/LockAnalysis.h +2 -2
  9. package/svf/include/MTA/MHP.h +3 -3
  10. package/svf/include/Util/SVFUtil.h +1 -8
  11. package/svf/include/Util/ThreadAPI.h +6 -6
  12. package/svf/lib/AE/Svfexe/AEDetector.cpp +14 -20
  13. package/svf/lib/AE/Svfexe/AbsExtAPI.cpp +49 -45
  14. package/svf/lib/CFL/CFLAlias.cpp +1 -1
  15. package/svf/lib/DDA/DDAClient.cpp +2 -2
  16. package/svf/lib/Graphs/CHG.cpp +17 -17
  17. package/svf/lib/Graphs/CallGraph.cpp +2 -1
  18. package/svf/lib/Graphs/ICFG.cpp +9 -9
  19. package/svf/lib/Graphs/SVFG.cpp +6 -6
  20. package/svf/lib/Graphs/ThreadCallGraph.cpp +8 -8
  21. package/svf/lib/Graphs/VFG.cpp +2 -2
  22. package/svf/lib/MTA/MTAStat.cpp +1 -1
  23. package/svf/lib/MTA/TCT.cpp +3 -3
  24. package/svf/lib/MemoryModel/PointerAnalysis.cpp +11 -11
  25. package/svf/lib/MemoryModel/PointerAnalysisImpl.cpp +1 -1
  26. package/svf/lib/SABER/DoubleFreeChecker.cpp +8 -8
  27. package/svf/lib/SABER/LeakChecker.cpp +10 -10
  28. package/svf/lib/SVFIR/SVFFileSystem.cpp +8 -8
  29. package/svf/lib/Util/CallGraphBuilder.cpp +2 -1
  30. package/svf/lib/Util/SVFUtil.cpp +10 -3
  31. package/svf/lib/Util/ThreadAPI.cpp +14 -16
  32. package/svf/lib/WPA/Andersen.cpp +1 -1
  33. package/svf-llvm/include/SVF-LLVM/CHGBuilder.h +5 -0
  34. package/svf-llvm/include/SVF-LLVM/DCHG.h +2 -2
  35. package/svf-llvm/include/SVF-LLVM/LLVMModule.h +10 -0
  36. package/svf-llvm/lib/CHGBuilder.cpp +23 -17
  37. package/svf-llvm/lib/DCHG.cpp +18 -18
  38. package/svf-llvm/lib/ICFGBuilder.cpp +9 -2
  39. package/svf-llvm/lib/LLVMModule.cpp +6 -0
  40. package/svf-llvm/lib/LLVMUtil.cpp +25 -8
  41. package/svf-llvm/lib/SVFIRBuilder.cpp +2 -2
  42. package/svf-llvm/lib/SVFIRExtAPI.cpp +1 -1
  43. package/svf-llvm/lib/SymbolTableBuilder.cpp +2 -2
@@ -648,17 +648,13 @@ bool LLVMUtil::isHeapAllocExtCallViaArg(const Instruction* inst)
648
648
 
649
649
  bool LLVMUtil::isNonInstricCallSite(const Instruction* inst)
650
650
  {
651
- SVFInstruction* svfINst =
652
- LLVMModuleSet::getLLVMModuleSet()->getSVFInstruction(inst);
653
- bool res = SVFUtil::isNonInstricCallSite(svfINst);
654
- bool res2 = false;
651
+ bool res = false;
655
652
 
656
653
  if(isIntrinsicInst(inst))
657
- res2 = false;
654
+ res = false;
658
655
  else
659
- res2 = isCallSite(inst);
660
- assert(res == res2);
661
- return res2;
656
+ res = isCallSite(inst);
657
+ return res;
662
658
  }
663
659
 
664
660
  namespace SVF
@@ -688,4 +684,25 @@ std::string SVFValue::toString() const
688
684
  return rawstr.str();
689
685
  }
690
686
 
687
+
688
+ const std::string SVFBaseNode::toString() const
689
+ {
690
+ std::string str;
691
+ llvm::raw_string_ostream rawstr(str);
692
+ if (const SVF::CallGraphNode* fun = SVFUtil::dyn_cast<CallGraphNode>(this))
693
+ {
694
+ rawstr << "Function: " << fun->getFunction()->getName() << " ";
695
+ }
696
+ else
697
+ {
698
+ auto llvmVal = LLVMModuleSet::getLLVMModuleSet()->getLLVMValue(this);
699
+ if (llvmVal)
700
+ rawstr << " " << *llvmVal << " ";
701
+ else
702
+ rawstr << " No llvmVal found";
703
+ }
704
+ rawstr << getSourceLoc();
705
+ return rawstr.str();
706
+ }
707
+
691
708
  } // namespace SVF
@@ -1171,7 +1171,7 @@ void SVFIRBuilder::updateCallGraph(CallGraph* callgraph)
1171
1171
  for (; iter != eiter; iter++)
1172
1172
  {
1173
1173
  const CallICFGNode* callBlock = iter->first;
1174
- const CallBase* callbase = SVFUtil::cast<CallBase>(llvmModuleSet()->getLLVMValue(callBlock->getCallSite()));
1174
+ const CallBase* callbase = SVFUtil::cast<CallBase>(llvmModuleSet()->getLLVMValue(callBlock));
1175
1175
  assert(callBlock->isIndirectCall() && "this is not an indirect call?");
1176
1176
  const CallGraph::FunctionSet& functions = iter->second;
1177
1177
  for (CallGraph::FunctionSet::const_iterator func_iter = functions.begin(); func_iter != functions.end(); func_iter++)
@@ -1186,7 +1186,7 @@ void SVFIRBuilder::updateCallGraph(CallGraph* callgraph)
1186
1186
  }
1187
1187
  else
1188
1188
  {
1189
- setCurrentLocation(callBlock->getCallSite(), callBlock->getCallSite()->getParent());
1189
+ setCurrentLocation(llvmModuleSet()->getSVFValue(llvmModuleSet()->getLLVMValue(callBlock)), callBlock->getBB());
1190
1190
  handleDirectCall(const_cast<CallBase*>(callbase), callee);
1191
1191
  }
1192
1192
  }
@@ -256,7 +256,7 @@ void SVFIRBuilder::handleExtCall(const CallBase* cs, const SVFFunction* svfCalle
256
256
 
257
257
  if (isThreadForkCall(callICFGNode))
258
258
  {
259
- if (const SVFFunction* forkedFun = SVFUtil::dyn_cast<SVFFunction>(getForkedFun(callICFGNode)))
259
+ if (const SVFFunction* forkedFun = SVFUtil::dyn_cast<SVFFunction>(getForkedFun(callICFGNode)->getValue()))
260
260
  {
261
261
  forkedFun = forkedFun->getDefFunForMultipleModule();
262
262
  const SVFVar* actualParm = getActualParmAtForkSite(callICFGNode);
@@ -205,7 +205,7 @@ void SymbolTableBuilder::buildMemModel(SVFModule* svfModule)
205
205
  {
206
206
  collectSym(sw->getCondition());
207
207
  }
208
- else if (isNonInstricCallSite(LLVMModuleSet::getLLVMModuleSet()->getSVFInstruction(&inst)))
208
+ else if (isNonInstricCallSite(&inst))
209
209
  {
210
210
 
211
211
  const CallBase* cs = LLVMUtil::getLLVMCallSite(&inst);
@@ -634,7 +634,7 @@ ObjTypeInfo* SymbolTableBuilder::createObjTypeInfo(const Value* val)
634
634
 
635
635
  // We consider two types of objects:
636
636
  // (1) A heap/static object from a callsite
637
- if (I && isNonInstricCallSite(LLVMModuleSet::getLLVMModuleSet()->getSVFInstruction(I)))
637
+ if (I && isNonInstricCallSite(I))
638
638
  {
639
639
  objTy = inferTypeOfHeapObjOrStaticObj(I);
640
640
  }