这段代码是上一段代码的测试代码 需要输出成功 #include "Assignment-3.h" #include "SVF-LLVM/LLVMUtil.h" #include "SVF-LLVM/SVFIRBuilder.h" #include "WPA/Andersen.h" #include "Util/Options.h" #include "Util/CommandLine.h" void Test1() { SVF::SVFModule *svfModule = SVF::LLVMModuleSet::getLLVMModuleSet()->buildSVFModule({"./Assignment-3/testcase/bc/no_alias.ll"}); /// Build Program Assignment Graph (SVFIR) SVF::SVFIRBuilder builder(svfModule); SVF::SVFIR *pag = builder.build(); pag->dump ("./Assignment-3/testcase/dot/no_alias_init"); AndersenPTA *andersenPTA = new AndersenPTA(pag); andersenPTA->analyze(); andersenPTA->dump_consCG("./Assignment-3/testcase/dot/no_alias_final"); delete andersenPTA; SVF::LLVMModuleSet::releaseLLVMModuleSet(); SVF::SVFIR::releaseSVFIR(); } void Test2() { SVF::SVFModule *svfModule = SVF::LLVMModuleSet::getLLVMModuleSet()->buildSVFModule({"./Assignment-3/testcase/bc/CI-global.ll"}); /// Build Program Assignment Graph (SVFIR) SVF::SVFIRBuilder builder(svfModule); SVF::SVFIR *pag = builder.build(); pag->dump ("./Assignment-3/testcase/dot/CI-global_init"); AndersenPTA *andersenPTA = new AndersenPTA(pag); andersenPTA->analyze(); andersenPTA->dump_consCG("./Assignment-3/testcase/dot/CI-global_final"); delete andersenPTA; SVF::SVFIR::releaseSVFIR(); SVF::LLVMModuleSet::releaseLLVMModuleSet(); } void Test3() { SVF::SVFModule *svfModule = SVF::LLVMModuleSet::getLLVMModuleSet()->buildSVFModule({"./Assignment-3/testcase/bc/CI-local.ll"}); /// Build Program Assignment Graph (SVFIR) SVF::SVFIRBuilder builder(svfModule); SVF::SVFIR *pag = builder.build(); pag->dump ("./Assignment-3/testcase/dot/CI-local_init"); AndersenPTA *andersenPTA = new AndersenPTA(pag); andersenPTA->analyze(); andersenPTA->dump_consCG("./Assignment-3/testcase/dot/CI-local_final"); SVF::LLVMModuleSet::releaseLLVMModuleSet(); SVF::SVFIR::releaseSVFIR(); delete andersenPTA; } void Test() { Test1(); Test2(); Test3(); } int main(int argc, char ** argv) { int arg_num = 0; 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::vectorstd::string moduleNameVec; moduleNameVec = OptionBase::parseOptions( arg_num, arg_value, "Teaching-Software-Analysis Assignment 3", "[options]" ); Test(); return 0; }
时间: 2023-06-27 20:06:07 浏览: 199
DIP-Assignment-No.-4.rar_assignment_assignment-4
这段代码看起来像是进行了对于一个软件的分析,主要是使用了SVF和Andersen PTA这两个工具来进行分析。其中的Test1、Test2、Test3函数分别对应了三个不同的测试用例,分别是no_alias.ll、CI-global.ll和CI-local.ll。在main函数中,还进行了一些参数的处理,并调用了Test函数进行测试。如果代码运行成功,应该会输出一些结果。
阅读全文