svf-tools 1.0.1046 → 1.0.1047

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/build.sh CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env bash
2
2
  # type './build.sh' for release build
3
3
  # type './build.sh debug' for debug build
4
- # if the LLVM_DIR variable is not set, LLVM will be downloaded.
4
+ # type './build.sh shared' for building LLVM from source with shared libs and RTTI enabled
5
+ # type './build.sh debug shared' for debug build with shared libs and RTTI enabled
6
+ # If the LLVM_DIR variable is not set, LLVM will be downloaded or built from source.
5
7
  #
6
8
  # Dependencies include: build-essential libncurses5 libncurses-dev cmake zlib1g-dev
7
9
  set -e # exit on first error
@@ -9,7 +11,7 @@ set -e # exit on first error
9
11
  jobs=8
10
12
 
11
13
  #########
12
- # VARs and Links
14
+ # Variables and Paths
13
15
  ########
14
16
  SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
15
17
  SVFHOME="${SCRIPT_DIR}"
@@ -30,6 +32,20 @@ LLVMHome="llvm-${MajorLLVMVer}.0.0.obj"
30
32
  Z3Home="z3.obj"
31
33
 
32
34
 
35
+ # Parse arguments
36
+ BUILD_TYPE='Release'
37
+ BUILD_SHARED='OFF'
38
+ for arg in "$@"; do
39
+ if [[ $arg =~ ^[Dd]ebug$ ]]; then
40
+ BUILD_TYPE='Debug'
41
+ fi
42
+ if [[ $arg =~ ^[Ss]hared$ ]]; then
43
+ BUILD_SHARED='ON'
44
+ fi
45
+ done
46
+
47
+
48
+
33
49
  # Downloads $1 (URL) to $2 (target destination) using wget or curl,
34
50
  # depending on OS.
35
51
  # E.g. generic_download_file www.url.com/my.zip loc/my.zip
@@ -114,8 +130,12 @@ function build_llvm_from_source {
114
130
  echo "Building LLVM..."
115
131
  mkdir llvm-build
116
132
  cd llvm-build
117
- # /*/ is a dirty hack to get llvm-project-llvmorg-version...
118
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$SVFHOME/$LLVMHome" -DLLVM_ENABLE_PROJECTS=clang ../llvm-source/*/llvm
133
+ cmake -DCMAKE_BUILD_TYPE=Release \
134
+ -DCMAKE_INSTALL_PREFIX="$SVFHOME/$LLVMHome" \
135
+ -DLLVM_ENABLE_PROJECTS="clang" \
136
+ -DLLVM_ENABLE_RTTI=ON \
137
+ -DBUILD_SHARED_LIBS=ON \
138
+ ../llvm-source/*/llvm
119
139
  cmake --build . -j ${jobs}
120
140
  cmake --install .
121
141
 
@@ -186,13 +206,18 @@ if [[ ! -d "$LLVM_DIR" ]]; then
186
206
  mkdir -p $SVFHOME/$LLVMHome
187
207
  ln -s $(brew --prefix llvm@${MajorLLVMVer})/* $SVFHOME/$LLVMHome
188
208
  else
209
+ # Ubuntu if build_shared in ON,
210
+ if [[ "$BUILD_SHARED" == "ON" ]]; then
211
+ build_llvm_from_source
212
+ else
189
213
  # everything else downloads pre-built lib includ osx "arm64"
190
- echo "Downloading LLVM binary for $OSDisplayName"
191
- generic_download_file "$urlLLVM" llvm.tar.xz
192
- check_xz
193
- echo "Unzipping llvm package..."
194
- mkdir -p "./$LLVMHome" && tar -xf llvm.tar.xz -C "./$LLVMHome" --strip-components 1
195
- rm llvm.tar.xz
214
+ echo "Downloading LLVM binary for $OSDisplayName"
215
+ generic_download_file "$urlLLVM" llvm.tar.xz
216
+ check_xz
217
+ echo "Unzipping llvm package..."
218
+ mkdir -p "./$LLVMHome" && tar -xf llvm.tar.xz -C "./$LLVMHome" --strip-components 1
219
+ rm llvm.tar.xz
220
+ fi
196
221
  fi
197
222
  fi
198
223
  export LLVM_DIR="$SVFHOME/$LLVMHome"
@@ -253,7 +278,7 @@ mkdir "${BUILD_DIR}"
253
278
  cmake -D CMAKE_BUILD_TYPE:STRING="${BUILD_TYPE}" \
254
279
  -DSVF_ENABLE_ASSERTIONS:BOOL=true \
255
280
  -DSVF_SANITIZE="${SVF_SANITIZER}" \
256
- -DBUILD_SHARED_LIBS=off \
281
+ -DBUILD_SHARED_LIBS=${BUILD_SHARED} \
257
282
  -S "${SVFHOME}" -B "${BUILD_DIR}"
258
283
  cmake --build "${BUILD_DIR}" -j ${jobs}
259
284
 
@@ -265,4 +290,4 @@ source ${SVFHOME}/setup.sh ${BUILD_TYPE}
265
290
  #########
266
291
  # Optionally, you can also specify a CXX_COMPILER and your $LLVM_HOME for your build
267
292
  # cmake -DCMAKE_CXX_COMPILER=$LLVM_DIR/bin/clang++ -DLLVM_DIR=$LLVM_DIR
268
- #########
293
+ #########
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.1046",
3
+ "version": "1.0.1047",
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": {
@@ -1,4 +1,5 @@
1
1
  #include "Graphs/BasicBlockG.h"
2
+ #include "Graphs/ICFGNode.h"
2
3
 
3
4
  using namespace SVF;
4
5
  const std::string BasicBlockEdge::toString() const
@@ -8,3 +9,16 @@ const std::string BasicBlockEdge::toString() const
8
9
  rawstr << "BasicBlockEdge: " << getSrcNode()->toString() << " -> " << getDstNode()->getName();
9
10
  return rawstr.str();
10
11
  }
12
+
13
+ const std::string SVFBasicBlock::toString() const
14
+ {
15
+ std::string str;
16
+ std::stringstream rawstr(str);
17
+ rawstr << "----------"<< "SVFBasicBlock: " << getName() <<"----------\n";
18
+ for (const ICFGNode* icfgNode : allICFGNodes)
19
+ {
20
+ rawstr << icfgNode->toString();
21
+ }
22
+ rawstr << "\n----------------------------------------\n";
23
+ return rawstr.str();
24
+ }
@@ -763,19 +763,6 @@ std::string SVFLLVMValue::toString() const
763
763
  return rawstr.str();
764
764
  }
765
765
 
766
- const std::string SVFBasicBlock::toString() const
767
- {
768
- std::string str;
769
- llvm::raw_string_ostream rawstr(str);
770
- auto llvmVal = LLVMModuleSet::getLLVMModuleSet()->getLLVMValue(this);
771
- if (llvmVal)
772
- rawstr << " " << *llvmVal << " ";
773
- else
774
- rawstr << " No llvmVal found";
775
- rawstr << this->getSourceLoc();
776
- return rawstr.str();
777
- }
778
-
779
766
  const std::string SVFValue::valueOnlyToString() const
780
767
  {
781
768
  std::string str;