svf-tools 1.0.695 → 1.0.697
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/README.md
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* [MSSA](https://github.com/SVF-tools/SVF/tree/master/svf/include/MSSA) (<b>memory SSA form construction</b>): memory regions, side-effects, SSA form ([JSS'18](https://yuleisui.github.io/publications/jss18.pdf));
|
|
28
28
|
* [SABER](https://github.com/SVF-tools/SVF/tree/master/svf/include/SABER) (<b>memory error checking</b>): memory leaks and double-frees ([ISSTA'12](https://yuleisui.github.io/publications/issta12.pdf), [TSE'14](https://yuleisui.github.io/publications/tse14.pdf), [ICSE'18](https://yuleisui.github.io/publications/icse18a.pdf));
|
|
29
29
|
* [MTA](https://github.com/SVF-tools/SVF/tree/master/svf/include/MTA) (<b>analysis of mutithreaded programs</b>): value-flows for multithreaded programs ([CGO'16](https://yuleisui.github.io/publications/cgo16.pdf));
|
|
30
|
-
* [CFL](https://github.com/SVF-tools/SVF/tree/master/svf/include/CFL) (<b>context-free-reachability analysis</b>): standard CFL solver, graph and grammar ([OOPSLA'22](https://yuleisui.github.io/publications/oopsla22.pdf));
|
|
30
|
+
* [CFL](https://github.com/SVF-tools/SVF/tree/master/svf/include/CFL) (<b>context-free-reachability analysis</b>): standard CFL solver, graph and grammar ([OOPSLA'22](https://yuleisui.github.io/publications/oopsla22.pdf), [PLDI'23](https://yuleisui.github.io/publications/pldi23.pdf));
|
|
31
31
|
* [SVFIR](https://github.com/SVF-tools/SVF/tree/master/svf/include/SVFIR) and [MemoryModel](https://github.com/SVF-tools/SVF/tree/master/svf/include/MemoryModel) (<b>SVFIR</b>): SVFIR, memory abstraction and points-to data structure ([SAS'21](https://yuleisui.github.io/publications/sas21.pdf));
|
|
32
32
|
* [Graphs](https://github.com/SVF-tools/SVF/tree/master/svf/include/Graphs): <b> generating a variety of graphs</b>, including call graph, ICFG, class hirachary graph, constraint graph, value-flow graph for static analyses and code embedding ([OOPSLA'20](https://yuleisui.github.io/publications/oopsla20.pdf), [TOSEM'21](https://yuleisui.github.io/publications/tosem21.pdf))
|
|
33
33
|
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
<br />
|
|
44
44
|
|
|
45
|
-
#### We are looking for self-motivated PhD students and
|
|
45
|
+
#### We are looking for self-motivated PhD students and welcome industry collaboration to improve SVF (Please contact y.sui@unsw.edu.au)
|
|
46
46
|
|
|
47
47
|
<br />
|
|
48
48
|
<p>We release SVF source code in the hope of benefiting others. You are kindly asked to acknowledge usage of the tool by citing some of our publications listed http://svf-tools.github.io/SVF, especially the following two: </p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.697",
|
|
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": {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
if(DEFINED IN_SOURCE_BUILD)
|
|
2
|
+
add_llvm_tool(llvm2svf llvm2svf.cpp)
|
|
3
|
+
else()
|
|
4
|
+
add_executable(llvm2svf llvm2svf.cpp)
|
|
5
|
+
|
|
6
|
+
target_link_libraries(llvm2svf SvfLLVM ${llvm_libs})
|
|
7
|
+
|
|
8
|
+
set_target_properties(llvm2svf PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
|
9
|
+
${CMAKE_BINARY_DIR}/bin)
|
|
10
|
+
endif()
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//===- llvm2svf.cpp -- LLVM IR to SVF IR conversion -------------------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-2023> <Yulei Sui>
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// This program is free software: you can redistribute it and/or modify
|
|
9
|
+
// it under the terms of the GNU Affero General Public License as published by
|
|
10
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
// (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
// This program is distributed in the hope that it will be useful,
|
|
14
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
// GNU Affero General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU Affero General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===-----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* llvm2svf.cpp
|
|
25
|
+
*
|
|
26
|
+
* Created on: 21 Apr 2023
|
|
27
|
+
* Authors: Xudong Wang
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#include "SVF-LLVM/SVFIRBuilder.h"
|
|
31
|
+
#include "Util/CommandLine.h"
|
|
32
|
+
#include "Util/Options.h"
|
|
33
|
+
#include "SVFIR/SVFIRRW.h"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
using namespace std;
|
|
37
|
+
using namespace SVF;
|
|
38
|
+
|
|
39
|
+
#include <iostream>
|
|
40
|
+
#include <string>
|
|
41
|
+
|
|
42
|
+
std::string replaceExtension(const std::string& path)
|
|
43
|
+
{
|
|
44
|
+
size_t pos = path.rfind('.');
|
|
45
|
+
if (pos == std::string::npos || path.substr(pos) != ".bc")
|
|
46
|
+
{
|
|
47
|
+
SVFUtil::errs() << "Error: file extension is not .bc\n";
|
|
48
|
+
exit(EXIT_FAILURE);
|
|
49
|
+
}
|
|
50
|
+
return path.substr(0, pos) + ".svf.json";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
int main(int argc, char** argv)
|
|
54
|
+
{
|
|
55
|
+
auto moduleNameVec = OptionBase::parseOptions(
|
|
56
|
+
argc, argv, "llvm2svf", "[options] <input-bitcode...>");
|
|
57
|
+
|
|
58
|
+
LLVMModuleSet* moduleSet = LLVMModuleSet::getLLVMModuleSet();
|
|
59
|
+
if (Options::WriteAnder() == "ir_annotator")
|
|
60
|
+
{
|
|
61
|
+
moduleSet->preProcessBCs(moduleNameVec);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
SVFModule* svfModule = moduleSet->buildSVFModule(moduleNameVec);
|
|
65
|
+
const std::string jsonPath = replaceExtension(moduleNameVec.front());
|
|
66
|
+
// PAG is borrowed from a unique_ptr, so we don't need to delete it.
|
|
67
|
+
const SVFIR* pag = SVFIRBuilder(svfModule).build();
|
|
68
|
+
SVFIRWriter::writeJsonToPath(pag, jsonPath);
|
|
69
|
+
SVFUtil::outs() << "SVF IR is written to '" << jsonPath << "'\n";
|
|
70
|
+
|
|
71
|
+
return 0;
|
|
72
|
+
}
|