svf-tools 1.0.726 → 1.0.728

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.726",
3
+ "version": "1.0.728",
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": {
@@ -471,6 +471,12 @@ public:
471
471
  void print(std::ostream& OS) const override;
472
472
  };
473
473
 
474
+ /// [FOR DEBUG ONLY, DON'T USE IT UNSIDE `svf`!]
475
+ /// Converts an SVFType to corresponding LLVM::Type, then get the string
476
+ /// representation of it. Use it only when you are debugging. Don't use
477
+ /// it in any SVF algorithm because it relies on information stored in LLVM bc.
478
+ std::string dumpLLVMType(const SVFType* svfType);
479
+
474
480
  // TODO: be explicit that this is a pair of 32-bit unsigneds?
475
481
  template <> struct Hash<NodePair>
476
482
  {
@@ -1140,6 +1140,12 @@ public:
1140
1140
  }
1141
1141
  };
1142
1142
 
1143
+ /// [FOR DEBUG ONLY, DON'T USE IT UNSIDE `svf`!]
1144
+ /// Converts an SVFValue to corresponding LLVM::Value, then get the string
1145
+ /// representation of it. Use it only when you are debugging. Don't use
1146
+ /// it in any SVF algorithm because it relies on information stored in LLVM bc.
1147
+ std::string dumpLLVMValue(const SVFValue* svfValue);
1148
+
1143
1149
  template <typename F, typename S>
1144
1150
  OutStream& operator<< (OutStream &o, const std::pair<F, S> &var)
1145
1151
  {
@@ -1027,25 +1027,40 @@ s32_t LLVMUtil::getVCallIdx(const CallBase* cs)
1027
1027
  namespace SVF
1028
1028
  {
1029
1029
  const std::string SVFValue::toString() const
1030
+ {
1031
+ // TODO: Should only use info in SVFValue. Refactor it later.
1032
+ return dumpLLVMValue(this);
1033
+ }
1034
+
1035
+ std::string dumpLLVMValue(const SVFValue* svfValue)
1030
1036
  {
1031
1037
  std::string str;
1032
1038
  llvm::raw_string_ostream rawstr(str);
1033
- if (const SVF::SVFFunction* fun = SVFUtil::dyn_cast<SVFFunction>(this))
1039
+ if (const SVF::SVFFunction* fun = SVFUtil::dyn_cast<SVFFunction>(svfValue))
1034
1040
  {
1035
1041
  rawstr << "Function: " << fun->getName() << " ";
1036
1042
  }
1037
- else if (const SVFBasicBlock* bb = SVFUtil::dyn_cast<SVFBasicBlock>(this))
1043
+ else if (const SVFBasicBlock* bb = SVFUtil::dyn_cast<SVFBasicBlock>(svfValue))
1038
1044
  {
1039
1045
  rawstr << "BasicBlock: " << bb->getName() << " ";
1040
1046
  }
1041
1047
  else
1042
1048
  {
1043
1049
  const Value* val =
1044
- LLVMModuleSet::getLLVMModuleSet()->getLLVMValue(this);
1050
+ LLVMModuleSet::getLLVMModuleSet()->getLLVMValue(svfValue);
1045
1051
  rawstr << " " << *val << " ";
1046
1052
  }
1047
- rawstr << this->getSourceLoc();
1053
+ rawstr << svfValue->getSourceLoc();
1048
1054
  return rawstr.str();
1049
1055
  }
1050
1056
 
1057
+ std::string dumpLLVMType(const SVFType* svfType)
1058
+ {
1059
+ std::string str;
1060
+ llvm::raw_string_ostream rawstr(str);
1061
+ const Type* ty = LLVMModuleSet::getLLVMModuleSet()->getLLVMType(svfType);
1062
+ rawstr << *ty;
1063
+ return rawstr.str();
1051
1064
  }
1065
+
1066
+ } // namespace SVF
@@ -42,9 +42,10 @@ using namespace SVF;
42
42
  std::string replaceExtension(const std::string& path)
43
43
  {
44
44
  size_t pos = path.rfind('.');
45
- if (pos == std::string::npos || path.substr(pos) != ".bc")
45
+ if (pos == std::string::npos ||
46
+ (path.substr(pos) != ".bc" && path.substr(pos) != ".ll"))
46
47
  {
47
- SVFUtil::errs() << "Error: file extension is not .bc\n";
48
+ SVFUtil::errs() << "Error: expect file with extension .bc or .ll\n";
48
49
  exit(EXIT_FAILURE);
49
50
  }
50
51
  return path.substr(0, pos) + ".svf.json";