svf-tools 1.0.665 → 1.0.667

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.
@@ -30,6 +30,7 @@
30
30
  #include "Util/Options.h"
31
31
  #include <queue>
32
32
  #include "SVFIR/SVFModule.h"
33
+ #include "SVFIR/SVFModuleRW.h"
33
34
  #include "Util/SVFUtil.h"
34
35
  #include "SVF-LLVM/BasicTypes.h"
35
36
  #include "SVF-LLVM/LLVMUtil.h"
@@ -68,6 +69,9 @@ using namespace SVF;
68
69
  #define SVF_GLOBAL_CTORS "llvm.global_ctors"
69
70
  #define SVF_GLOBAL_DTORS "llvm.global_dtors"
70
71
 
72
+ static Option<std::string> dumpJson("dump-json",
73
+ "Dump the SVFModule to JSON file", "");
74
+
71
75
  LLVMModuleSet *LLVMModuleSet::llvmModuleSet = nullptr;
72
76
  std::string SVFModule::pagReadFromTxt = "";
73
77
 
@@ -119,8 +123,11 @@ SVFModule* LLVMModuleSet::buildSVFModule(const std::vector<std::string> &moduleN
119
123
 
120
124
  build_symbol_table();
121
125
 
126
+ svfModule->writeToJson(dumpJson());
127
+
122
128
  return svfModule.get();
123
129
  }
130
+
124
131
  void LLVMModuleSet::build_symbol_table() const
125
132
  {
126
133
  double startSymInfoTime = SVFStat::getClk(true);
@@ -36,21 +36,23 @@ using namespace llvm;
36
36
  using namespace std;
37
37
  using namespace SVF;
38
38
 
39
- int main(int argc, char ** argv)
39
+ int main(int argc, char** argv)
40
40
  {
41
41
 
42
- char **arg_value = new char*[argc];
42
+ char** arg_value = new char*[argc];
43
43
  std::vector<std::string> moduleNameVec;
44
- moduleNameVec = OptionBase::parseOptions(
45
- argc, argv, "Whole Program Points-to Analysis", "[options] <input-bitcode...>"
46
- );
44
+ moduleNameVec =
45
+ OptionBase::parseOptions(argc, argv, "Whole Program Points-to Analysis",
46
+ "[options] <input-bitcode...>");
47
47
 
48
48
  if (Options::WriteAnder() == "ir_annotator")
49
49
  {
50
50
  LLVMModuleSet::getLLVMModuleSet()->preProcessBCs(moduleNameVec);
51
51
  }
52
52
 
53
- SVFModule* svfModule = LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec);
53
+ SVFModule* svfModule =
54
+ LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec);
55
+
54
56
  /// Build SVFIR
55
57
  SVFIRBuilder builder(svfModule);
56
58
  SVFIR* pag = builder.build();