diff --git a/.github/workflows/svf-teaching.yml b/.github/workflows/svf-teaching.yml index 946a80a..7db1de5 100644 --- a/.github/workflows/svf-teaching.yml +++ b/.github/workflows/svf-teaching.yml @@ -8,7 +8,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04, macos-11] + os: [ubuntu-20.04, macos-11] steps: # checkout the repo - uses: actions/checkout@v2 diff --git a/.vscode/launch.json b/.vscode/launch.json index ff0b11c..666dc73 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ "request": "launch", // Please change to executable of your working assignment e.g. Assignment-1: assign-1 "program": "${workspaceFolder}/bin/assign-1", - "args": ["-stat=false"], // may input the test llvm bc file or other options may use + "args": [], // may input the test llvm bc file or other options may use "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], diff --git a/Assignment-3/Test3.cpp b/Assignment-3/Test3.cpp index 2e36054..e0217c8 100644 --- a/Assignment-3/Test3.cpp +++ b/Assignment-3/Test3.cpp @@ -31,8 +31,9 @@ #include "SVF-LLVM/LLVMUtil.h" #include "SVF-LLVM/SVFIRBuilder.h" #include "WPA/Andersen.h" -#include "Util/SVFUtil.h" -#include "Assignment-3.h" +#include "Util/Options.h" +#include "Util/CommandLine.h" + void Test1() { @@ -90,13 +91,21 @@ void Test() int main(int argc, char ** argv) { - // add "args": ["-stat=false"] to launch.json file to eliminate the redundant program analysis details + int arg_num = 0; - char **arg_value = new char*[argc]; + int extraArgc = 1; + char **arg_value = new char *[argc + extraArgc]; + for (; arg_num < argc; ++arg_num) { + arg_value[arg_num] = argv[arg_num]; + } + + // You may comment it to see the details of the analysis + arg_value[arg_num++] = (char*) "-stat=false"; + std::vector moduleNameVec; - SVF::LLVMUtil::processArguments(argc, argv, arg_num, arg_value, moduleNameVec); - llvm::cl::ParseCommandLineOptions(arg_num, arg_value, - "Whole Program Points-to Analysis\n"); + moduleNameVec = OptionBase::parseOptions( + arg_num, arg_value, "Teaching-Software-Analysis Assignment 3", "[options]" + ); Test(); return 0; } diff --git a/Assignment-4/Test4.cpp b/Assignment-4/Test4.cpp index dd14fdc..e660c5c 100644 --- a/Assignment-4/Test4.cpp +++ b/Assignment-4/Test4.cpp @@ -25,10 +25,14 @@ // // */ +#include "Assignment-4.h" + #include "SVF-LLVM/LLVMUtil.h" #include "SVF-LLVM/SVFIRBuilder.h" #include "Graphs/PTACallGraph.h" -#include "Assignment-4.h" +#include "Util/Options.h" +#include "Util/CommandLine.h" + using namespace std; @@ -102,11 +106,19 @@ void Test4() int main(int argc, char ** argv) { int arg_num = 0; - char **arg_value = new char*[argc]; + int extraArgc = 1; + char **arg_value = new char *[argc + extraArgc]; + for (; arg_num < argc; ++arg_num) { + arg_value[arg_num] = argv[arg_num]; + } + + // You may comment it to see the details of the analysis + arg_value[arg_num++] = (char*) "-stat=false"; + std::vector moduleNameVec; - LLVMUtil::processArguments(argc, argv, arg_num, arg_value, moduleNameVec); - llvm::cl::ParseCommandLineOptions(arg_num, arg_value, - "Whole Program Points-to Analysis\n"); + moduleNameVec = OptionBase::parseOptions( + arg_num, arg_value, "Teaching-Software-Analysis Assignment 4", "[options]" + ); Test1(); Test2(); Test3(); @@ -115,3 +127,5 @@ int main(int argc, char ** argv) } + +