svf-tools 1.0.1247 → 1.0.1249

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.1247",
3
+ "version": "1.0.1249",
4
4
  "description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -177,7 +177,7 @@ public:
177
177
 
178
178
  // LLVMModule.cpp
179
179
  static const Option<std::string> Graphtxt;
180
- static const Option<bool> SVFMain;
180
+ static Option<bool> SVFMain;
181
181
 
182
182
  // SymbolTableInfo.cpp
183
183
  static const Option<bool> LocMemModel;
@@ -125,7 +125,7 @@ std::deque<const FunObjVar*> AbstractInterpretation::collectProgEntryFuns()
125
125
  if (cgNode->getInEdges().empty())
126
126
  {
127
127
  // If main exists, put it first for priority using deque's push_front
128
- if (fun->getName() == "main")
128
+ if (SVFUtil::isProgEntryFunction(fun))
129
129
  {
130
130
  entryFunctions.push_front(fun);
131
131
  }
@@ -567,7 +567,7 @@ bool MHP::isConnectedfromMain(const FunObjVar* fun)
567
567
  while (!worklist.empty())
568
568
  {
569
569
  const CallGraphNode* node = worklist.pop();
570
- if ("main" == node->getFunction()->getName())
570
+ if (SVFUtil::isProgEntryFunction(node->getFunction()))
571
571
  return true;
572
572
  for (CallGraphNode::const_iterator nit = node->InEdgeBegin(), neit = node->InEdgeEnd(); nit != neit; nit++)
573
573
  {
@@ -540,7 +540,7 @@ const Option<std::string> Options::Graphtxt(
540
540
  ""
541
541
  );
542
542
 
543
- const Option<bool> Options::SVFMain(
543
+ Option<bool> Options::SVFMain(
544
544
  "svf-main",
545
545
  "add svf.main()",
546
546
  false
@@ -441,5 +441,6 @@ bool SVFUtil::isExtCall(const FunObjVar* fun)
441
441
 
442
442
  bool SVFUtil::isProgEntryFunction(const FunObjVar* funObjVar)
443
443
  {
444
- return funObjVar && funObjVar->getName() == "main";
444
+ const char* main_name=Options::SVFMain() ? "svf.main" : "main";
445
+ return funObjVar && funObjVar->getName() == main_name;
445
446
  }
@@ -33,6 +33,7 @@
33
33
  #include "Util/SVFUtil.h"
34
34
  #include "SVF-LLVM/BasicTypes.h"
35
35
  #include "Util/ThreadAPI.h"
36
+ #include "Util/Options.h"
36
37
 
37
38
  namespace SVF
38
39
  {
@@ -112,7 +113,8 @@ const Function* getProgFunction(const std::string& funName);
112
113
  /// Check whether a function is an entry function (i.e., main)
113
114
  inline bool isProgEntryFunction(const Function* fun)
114
115
  {
115
- return fun && fun->getName() == "main";
116
+ const char* main_name=Options::SVFMain() ? "svf.main" : "main";
117
+ return fun && fun->getName() == main_name;
116
118
  }
117
119
 
118
120
  /// Check whether this value is a black hole
@@ -598,6 +598,11 @@ void LLVMModuleSet::addSVFMain()
598
598
  // return;
599
599
  Builder.CreateRetVoid();
600
600
  }
601
+ else
602
+ {
603
+ // use SVF::Options to record whether svf.main is added or not
604
+ Options::SVFMain.setValue(false);
605
+ }
601
606
  }
602
607
 
603
608
  void LLVMModuleSet::collectExtFunAnnotations(const Module* mod)