svf-tools 1.0.707 → 1.0.709

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/CMakeLists.txt CHANGED
@@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.13.4)
2
2
 
3
3
  project("SVF")
4
4
 
5
- configure_file(${CMAKE_SOURCE_DIR}/.config.in
6
- ${CMAKE_BINARY_DIR}/include/Util/config.h)
5
+ configure_file(${PROJECT_SOURCE_DIR}/.config.in
6
+ ${PROJECT_BINARY_DIR}/include/Util/config.h)
7
7
 
8
8
  # We need to match the build environment for LLVM: In particular, we need C++14
9
9
  # and the -fno-rtti flag
@@ -65,13 +65,13 @@ endif()
65
65
  message(STATUS "Found Z3: ${Z3_LIBRARIES}")
66
66
  message(STATUS "Z3 include dir: ${Z3_INCLUDES}")
67
67
 
68
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/svf/include
69
- ${CMAKE_BINARY_DIR}/include ${Z3_INCLUDES})
68
+ include_directories(${PROJECT_SOURCE_DIR}/svf/include
69
+ ${PROJECT_BINARY_DIR}/include ${Z3_INCLUDES})
70
70
 
71
71
  # checks if the test-suite is present, if it is then build bc files and add
72
72
  # testing to cmake build
73
- if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Test-Suite")
74
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Test-Suite)
73
+ if(EXISTS "${PROJECT_SOURCE_DIR}/Test-Suite")
74
+ include_directories(${PROJECT_SOURCE_DIR}/Test-Suite)
75
75
  enable_testing()
76
76
  add_subdirectory(Test-Suite)
77
77
  include(CTest)
@@ -81,8 +81,8 @@ add_subdirectory(svf)
81
81
  add_subdirectory(svf-llvm)
82
82
 
83
83
  install(
84
- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/svf/include/
85
- ${CMAKE_CURRENT_SOURCE_DIR}/svf-llvm/include/
84
+ DIRECTORY ${PROJECT_SOURCE_DIR}/svf/include/
85
+ ${PROJECT_SOURCE_DIR}/svf-llvm/include/
86
86
  COMPONENT devel
87
87
  DESTINATION include/svf
88
88
  FILES_MATCHING
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.707",
3
+ "version": "1.0.709",
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": {
@@ -63,6 +63,7 @@ public:
63
63
  typedef OtherValueType::const_iterator const_ovalue_iterator;
64
64
 
65
65
  private:
66
+ static SVFModule* svfModule;
66
67
  static std::string pagReadFromTxt;
67
68
  std::string moduleIdentifier;
68
69
  FunctionSetType FunctionSet; ///< The Functions in the module
@@ -71,9 +72,12 @@ private:
71
72
  ConstantType ConstantSet; ///< The ConstantData in the module
72
73
  OtherValueType OtherValueSet; ///< All other values in the module
73
74
 
74
- public:
75
75
  /// Constructors
76
- SVFModule(std::string moduleName = "") : moduleIdentifier(moduleName) {}
76
+ SVFModule() = default;
77
+
78
+ public:
79
+ static SVFModule* getSVFModule();
80
+ static void releaseSVFModule();
77
81
 
78
82
  ~SVFModule();
79
83
 
@@ -82,6 +86,11 @@ public:
82
86
  pagReadFromTxt = txt;
83
87
  }
84
88
 
89
+ inline void setModuleIdentifier(const std::string& moduleIdentifier)
90
+ {
91
+ this->moduleIdentifier = moduleIdentifier;
92
+ }
93
+
85
94
  static inline std::string pagFileName()
86
95
  {
87
96
  return pagReadFromTxt;
@@ -193,7 +193,7 @@ const std::string RetCFGEdge::toString() const
193
193
  * 2) connect ICFG edges
194
194
  * between two statements (PAGEdges)
195
195
  */
196
- ICFG::ICFG(): totalICFGNode(0)
196
+ ICFG::ICFG(): totalICFGNode(0), globalBlockNode(nullptr)
197
197
  {
198
198
  }
199
199
 
@@ -1337,7 +1337,7 @@ SVFIR* SVFIRReader::read(const cJSON* root)
1337
1337
  SVFIR* svfIR = SVFIR::getPAG(); // SVFIR constructor sets symInfo
1338
1338
  IRGraph* irGraph = svfIR;
1339
1339
 
1340
- auto svfModule = new SVFModule();
1340
+ auto svfModule = SVFModule::getSVFModule();
1341
1341
  auto icfg = new ICFG();
1342
1342
  auto chgraph = new CHGraph(svfModule);
1343
1343
  auto symInfo = SymbolTableInfo::SymbolInfo();
@@ -562,6 +562,8 @@ void SVFIR::destroy()
562
562
  icfg = nullptr;
563
563
  delete chgraph;
564
564
  chgraph = nullptr;
565
+ SVFModule::releaseSVFModule();
566
+ svfModule = nullptr;
565
567
  }
566
568
 
567
569
  /*!
@@ -29,6 +29,9 @@
29
29
 
30
30
  using namespace SVF;
31
31
 
32
+ std::string SVFModule::pagReadFromTxt = "";
33
+ SVFModule* SVFModule::svfModule = nullptr;
34
+
32
35
  SVFModule::~SVFModule()
33
36
  {
34
37
  for (const SVFFunction* f : FunctionSet)
@@ -53,3 +56,19 @@ const SVFFunction* SVFModule::getSVFFunction(const std::string& name)
53
56
  }
54
57
  return nullptr;
55
58
  }
59
+
60
+ SVFModule* SVFModule::getSVFModule()
61
+ {
62
+ if (svfModule == nullptr)
63
+ {
64
+ svfModule = new SVFModule;
65
+ }
66
+ return svfModule;
67
+ }
68
+
69
+ void SVFModule::releaseSVFModule()
70
+ {
71
+ assert(svfModule != nullptr && "SVFModule is not initialized?");
72
+ delete svfModule;
73
+ svfModule = nullptr;
74
+ }
@@ -62,8 +62,9 @@ public:
62
62
 
63
63
  private:
64
64
  static LLVMModuleSet* llvmModuleSet;
65
- SymbolTableInfo *symInfo;
66
- std::unique_ptr<SVFModule> svfModule;
65
+ static bool preProcessed;
66
+ SymbolTableInfo* symInfo;
67
+ SVFModule* svfModule; ///< Borrowed from singleton SVFModule::svfModule
67
68
  std::unique_ptr<LLVMContext> cxts;
68
69
  std::vector<std::unique_ptr<Module>> owned_modules;
69
70
  std::vector<std::reference_wrapper<Module>> modules;
@@ -87,35 +88,34 @@ private:
87
88
 
88
89
  /// Constructor
89
90
  LLVMModuleSet();
90
- ~LLVMModuleSet() = default;
91
91
 
92
92
  void build();
93
93
 
94
94
  public:
95
+ ~LLVMModuleSet() = default;
96
+
95
97
  static inline LLVMModuleSet* getLLVMModuleSet()
96
98
  {
97
- if (llvmModuleSet == nullptr)
98
- llvmModuleSet = new LLVMModuleSet();
99
+ if (!llvmModuleSet)
100
+ llvmModuleSet = new LLVMModuleSet;
99
101
  return llvmModuleSet;
100
102
  }
101
103
 
102
104
  static void releaseLLVMModuleSet()
103
105
  {
104
- if (llvmModuleSet)
105
- delete llvmModuleSet;
106
+ delete llvmModuleSet;
106
107
  llvmModuleSet = nullptr;
107
108
  }
108
109
 
109
- SVFModule* buildSVFModule(Module& mod);
110
- SVFModule* buildSVFModule(const std::vector<std::string>& moduleNameVec);
110
+ static SVFModule* buildSVFModule(Module& mod);
111
+ static SVFModule* buildSVFModule(const std::vector<std::string>& moduleNameVec);
111
112
 
112
113
  inline SVFModule* getSVFModule()
113
114
  {
114
- assert(svfModule && "svfModule has not been built yet!");
115
- return svfModule.get();
115
+ return svfModule;
116
116
  }
117
117
 
118
- void preProcessBCs(std::vector<std::string>& moduleNameVec);
118
+ static void preProcessBCs(std::vector<std::string>& moduleNameVec);
119
119
 
120
120
  u32_t getModuleNum() const
121
121
  {
@@ -139,7 +139,7 @@ public:
139
139
  }
140
140
 
141
141
  // Dump modules to files
142
- void dumpModulesToFile(const std::string suffix);
142
+ void dumpModulesToFile(const std::string& suffix);
143
143
 
144
144
  inline void addFunctionMap(const Function* func, SVFFunction* svfFunc)
145
145
  {
@@ -350,7 +350,6 @@ private:
350
350
  void buildGlobalDefToRepMap();
351
351
  /// Invoke llvm passes to modify module
352
352
  void prePassSchedule();
353
- bool preProcessed;
354
353
  void buildSymbolTable() const;
355
354
  };
356
355
 
@@ -69,50 +69,54 @@ using namespace SVF;
69
69
  #define SVF_GLOBAL_CTORS "llvm.global_ctors"
70
70
  #define SVF_GLOBAL_DTORS "llvm.global_dtors"
71
71
 
72
- LLVMModuleSet *LLVMModuleSet::llvmModuleSet = nullptr;
73
- std::string SVFModule::pagReadFromTxt = "";
72
+ LLVMModuleSet* LLVMModuleSet::llvmModuleSet = nullptr;
73
+ bool LLVMModuleSet::preProcessed = false;
74
74
 
75
- LLVMModuleSet::LLVMModuleSet(): svfModule(nullptr), cxts(nullptr), preProcessed(false)
75
+ LLVMModuleSet::LLVMModuleSet()
76
+ : symInfo(SymbolTableInfo::SymbolInfo()),
77
+ svfModule(SVFModule::getSVFModule()), cxts(nullptr)
76
78
  {
77
- symInfo = SymbolTableInfo::SymbolInfo();
78
79
  }
79
80
 
80
81
  SVFModule* LLVMModuleSet::buildSVFModule(Module &mod)
81
82
  {
83
+ LLVMModuleSet* mset = getLLVMModuleSet();
84
+
82
85
  double startSVFModuleTime = SVFStat::getClk(true);
83
- svfModule = std::make_unique<SVFModule>(mod.getModuleIdentifier());
84
- modules.emplace_back(mod);
86
+ SVFModule::getSVFModule()->setModuleIdentifier(mod.getModuleIdentifier());
87
+ mset->modules.emplace_back(mod);
85
88
 
86
- build();
89
+ mset->build();
87
90
  double endSVFModuleTime = SVFStat::getClk(true);
88
91
  SVFStat::timeOfBuildingLLVMModule = (endSVFModuleTime - startSVFModuleTime)/TIMEINTERVAL;
89
92
 
90
- buildSymbolTable();
91
-
92
- return svfModule.get();
93
+ mset->buildSymbolTable();
94
+ // Don't releaseLLVMModuleSet() here, as IRBuilder might still need LLVMMoudleSet
95
+ return SVFModule::getSVFModule();
93
96
  }
94
97
 
95
98
  SVFModule* LLVMModuleSet::buildSVFModule(const std::vector<std::string> &moduleNameVec)
96
99
  {
97
100
  double startSVFModuleTime = SVFStat::getClk(true);
98
101
 
99
- assert(llvmModuleSet && "LLVM Module set needs to be created!");
102
+ LLVMModuleSet* mset = getLLVMModuleSet();
100
103
 
101
- loadModules(moduleNameVec);
104
+ mset->loadModules(moduleNameVec);
102
105
 
103
106
  if (!moduleNameVec.empty())
104
- svfModule = std::make_unique<SVFModule>(*moduleNameVec.begin());
105
- else
106
- svfModule = std::make_unique<SVFModule>();
107
+ {
108
+ SVFModule::getSVFModule()->setModuleIdentifier(moduleNameVec.front());
109
+ }
107
110
 
108
- build();
111
+ mset->build();
109
112
 
110
113
  double endSVFModuleTime = SVFStat::getClk(true);
111
- SVFStat::timeOfBuildingLLVMModule = (endSVFModuleTime - startSVFModuleTime)/TIMEINTERVAL;
112
-
113
- buildSymbolTable();
114
+ SVFStat::timeOfBuildingLLVMModule =
115
+ (endSVFModuleTime - startSVFModuleTime) / TIMEINTERVAL;
114
116
 
115
- return svfModule.get();
117
+ mset->buildSymbolTable();
118
+ // Don't releaseLLVMModuleSet() here, as IRBuilder might still need LLVMMoudleSet
119
+ return SVFModule::getSVFModule();
116
120
  }
117
121
 
118
122
  void LLVMModuleSet::buildSymbolTable() const
@@ -123,7 +127,7 @@ void LLVMModuleSet::buildSymbolTable() const
123
127
  /// building symbol table
124
128
  DBOUT(DGENERAL, SVFUtil::outs() << SVFUtil::pasMsg("Building Symbol table ...\n"));
125
129
  SymbolTableBuilder builder(symInfo);
126
- builder.buildMemModel(svfModule.get());
130
+ builder.buildMemModel(svfModule);
127
131
  }
128
132
  double endSymInfoTime = SVFStat::getClk(true);
129
133
  SVFStat::timeOfBuildingSymbolTable =
@@ -366,7 +370,7 @@ void LLVMModuleSet::prePassSchedule()
366
370
  /// MergeFunctionRets Pass
367
371
  std::unique_ptr<UnifyFunctionExitNodes> p2 =
368
372
  std::make_unique<UnifyFunctionExitNodes>();
369
- for (Module &M : LLVMModuleSet::getLLVMModuleSet()->getLLVMModules())
373
+ for (Module &M : getLLVMModules())
370
374
  {
371
375
  for (auto F = M.begin(), E = M.end(); F != E; ++F)
372
376
  {
@@ -380,8 +384,9 @@ void LLVMModuleSet::prePassSchedule()
380
384
 
381
385
  void LLVMModuleSet::preProcessBCs(std::vector<std::string> &moduleNameVec)
382
386
  {
383
- loadModules(moduleNameVec);
384
- prePassSchedule();
387
+ LLVMModuleSet* mset = getLLVMModuleSet();
388
+ mset->loadModules(moduleNameVec);
389
+ mset->prePassSchedule();
385
390
 
386
391
  std::string preProcessSuffix = ".pre.bc";
387
392
  // Get the existing module names, remove old extention, add preProcessSuffix
@@ -392,9 +397,8 @@ void LLVMModuleSet::preProcessBCs(std::vector<std::string> &moduleNameVec)
392
397
  moduleNameVec[i] = (rawName + preProcessSuffix);
393
398
  }
394
399
 
395
- dumpModulesToFile(preProcessSuffix);
400
+ mset->dumpModulesToFile(preProcessSuffix);
396
401
  preProcessed = true;
397
-
398
402
  releaseLLVMModuleSet();
399
403
  }
400
404
 
@@ -767,7 +771,7 @@ void LLVMModuleSet::buildGlobalDefToRepMap()
767
771
  }
768
772
 
769
773
  // Dump modules to files
770
- void LLVMModuleSet::dumpModulesToFile(const std::string suffix)
774
+ void LLVMModuleSet::dumpModulesToFile(const std::string& suffix)
771
775
  {
772
776
  for (Module& mod : modules)
773
777
  {
@@ -37,7 +37,6 @@ using namespace SVF;
37
37
 
38
38
  int main(int argc, char ** argv)
39
39
  {
40
- char **arg_value = new char*[argc];
41
40
  std::vector<std::string> moduleNameVec;
42
41
  moduleNameVec = OptionBase::parseOptions(
43
42
  argc, argv, "CFL Reachability Analysis", "[options] <input-bitcode...>"
@@ -45,13 +44,13 @@ int main(int argc, char ** argv)
45
44
 
46
45
  if (Options::WriteAnder() == "ir_annotator")
47
46
  {
48
- LLVMModuleSet::getLLVMModuleSet()->preProcessBCs(moduleNameVec);
47
+ LLVMModuleSet::preProcessBCs(moduleNameVec);
49
48
  }
50
49
 
51
50
  SVFIR* svfir = nullptr;
52
51
  if (Options::CFLGraph().empty())
53
52
  {
54
- SVFModule* svfModule = LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec);
53
+ SVFModule* svfModule = LLVMModuleSet::buildSVFModule(moduleNameVec);
55
54
  SVFIRBuilder builder(svfModule);
56
55
  svfir = builder.build();
57
56
  } // if no dot form CFLGraph is specified, we use svfir from .bc.
@@ -70,8 +69,6 @@ int main(int argc, char ** argv)
70
69
  SVFIR::releaseSVFIR();
71
70
  SVF::LLVMModuleSet::releaseLLVMModuleSet();
72
71
 
73
- delete[] arg_value;
74
-
75
72
  return 0;
76
73
 
77
74
  }
@@ -77,8 +77,6 @@ static Option<bool> ENABLEFLOW(
77
77
 
78
78
  int main(int argc, char ** argv)
79
79
  {
80
-
81
- char **arg_value = new char*[argc];
82
80
  std::vector<std::string> moduleNameVec;
83
81
  moduleNameVec = OptionBase::parseOptions(
84
82
  argc, argv, "Demand-Driven Points-to Analysis", "[options] <input-bitcode...>"
@@ -86,17 +84,17 @@ int main(int argc, char ** argv)
86
84
 
87
85
  if (Options::WriteAnder() == "ir_annotator")
88
86
  {
89
- LLVMModuleSet::getLLVMModuleSet()->preProcessBCs(moduleNameVec);
87
+ LLVMModuleSet::preProcessBCs(moduleNameVec);
90
88
  }
91
89
 
92
- SVFModule* svfModule = LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec);
90
+ SVFModule* svfModule = LLVMModuleSet::buildSVFModule(moduleNameVec);
93
91
  SVFIRBuilder builder(svfModule);
94
92
  SVFIR* pag = builder.build();
95
93
 
96
94
  DDAPass dda;
97
95
  dda.runOnModule(pag);
98
96
 
99
- delete[] arg_value;
97
+ LLVMModuleSet::releaseLLVMModuleSet();
100
98
  return 0;
101
99
 
102
100
  }
@@ -142,7 +142,6 @@ void traverseOnVFG(const SVFG* vfg, SVFValue* val)
142
142
  int main(int argc, char ** argv)
143
143
  {
144
144
 
145
- char **arg_value = new char*[argc];
146
145
  std::vector<std::string> moduleNameVec;
147
146
  moduleNameVec = OptionBase::parseOptions(
148
147
  argc, argv, "Whole Program Points-to Analysis", "[options] <input-bitcode...>"
@@ -150,10 +149,10 @@ int main(int argc, char ** argv)
150
149
 
151
150
  if (Options::WriteAnder() == "ir_annotator")
152
151
  {
153
- LLVMModuleSet::getLLVMModuleSet()->preProcessBCs(moduleNameVec);
152
+ LLVMModuleSet::preProcessBCs(moduleNameVec);
154
153
  }
155
154
 
156
- SVFModule* svfModule = LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec);
155
+ SVFModule* svfModule = LLVMModuleSet::buildSVFModule(moduleNameVec);
157
156
 
158
157
  /// Build Program Assignment Graph (SVFIR)
159
158
  SVFIRBuilder builder(svfModule);
@@ -198,7 +197,6 @@ int main(int argc, char ** argv)
198
197
  SVF::LLVMModuleSet::releaseLLVMModuleSet();
199
198
 
200
199
  llvm::llvm_shutdown();
201
- delete[] arg_value;
202
200
  return 0;
203
201
  }
204
202
 
@@ -55,18 +55,18 @@ int main(int argc, char** argv)
55
55
  auto moduleNameVec = OptionBase::parseOptions(
56
56
  argc, argv, "llvm2svf", "[options] <input-bitcode...>");
57
57
 
58
- LLVMModuleSet* moduleSet = LLVMModuleSet::getLLVMModuleSet();
59
58
  if (Options::WriteAnder() == "ir_annotator")
60
59
  {
61
- moduleSet->preProcessBCs(moduleNameVec);
60
+ LLVMModuleSet::preProcessBCs(moduleNameVec);
62
61
  }
63
62
 
64
- SVFModule* svfModule = moduleSet->buildSVFModule(moduleNameVec);
63
+ SVFModule* svfModule = LLVMModuleSet::buildSVFModule(moduleNameVec);
65
64
  const std::string jsonPath = replaceExtension(moduleNameVec.front());
66
65
  // PAG is borrowed from a unique_ptr, so we don't need to delete it.
67
66
  const SVFIR* pag = SVFIRBuilder(svfModule).build();
68
67
  SVFIRWriter::writeJsonToPath(pag, jsonPath);
69
68
  SVFUtil::outs() << "SVF IR is written to '" << jsonPath << "'\n";
70
69
 
70
+ LLVMModuleSet::releaseLLVMModuleSet();
71
71
  return 0;
72
72
  }
@@ -34,7 +34,6 @@ using namespace SVF;
34
34
  int main(int argc, char ** argv)
35
35
  {
36
36
 
37
- char **arg_value = new char*[argc];
38
37
  std::vector<std::string> moduleNameVec;
39
38
  moduleNameVec = OptionBase::parseOptions(
40
39
  argc, argv, "MTA Analysis", "[options] <input-bitcode...>"
@@ -42,10 +41,10 @@ int main(int argc, char ** argv)
42
41
 
43
42
  if (Options::WriteAnder() == "ir_annotator")
44
43
  {
45
- LLVMModuleSet::getLLVMModuleSet()->preProcessBCs(moduleNameVec);
44
+ LLVMModuleSet::preProcessBCs(moduleNameVec);
46
45
  }
47
46
 
48
- SVFModule* svfModule = LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec);
47
+ SVFModule* svfModule = LLVMModuleSet::buildSVFModule(moduleNameVec);
49
48
  SVFIRBuilder builder(svfModule);
50
49
  SVFIR* pag = builder.build();
51
50
 
@@ -59,7 +58,6 @@ int main(int argc, char ** argv)
59
58
  LockResultValidator lockvalidator(mta.getLockAnalysis());
60
59
  lockvalidator.analyze();
61
60
 
62
- delete[] arg_value;
63
-
61
+ LLVMModuleSet::releaseLLVMModuleSet();
64
62
  return 0;
65
63
  }
@@ -60,7 +60,6 @@ static Option<bool> DFREECHECKER(
60
60
  int main(int argc, char ** argv)
61
61
  {
62
62
 
63
- char **arg_value = new char*[argc];
64
63
  std::vector<std::string> moduleNameVec;
65
64
  moduleNameVec = OptionBase::parseOptions(
66
65
  argc, argv, "Source-Sink Bug Detector", "[options] <input-bitcode...>"
@@ -68,10 +67,10 @@ int main(int argc, char ** argv)
68
67
 
69
68
  if (Options::WriteAnder() == "ir_annotator")
70
69
  {
71
- LLVMModuleSet::getLLVMModuleSet()->preProcessBCs(moduleNameVec);
70
+ LLVMModuleSet::preProcessBCs(moduleNameVec);
72
71
  }
73
72
 
74
- SVFModule* svfModule = LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec);
73
+ SVFModule* svfModule = LLVMModuleSet::buildSVFModule(moduleNameVec);
75
74
  SVFIRBuilder builder(svfModule);
76
75
  SVFIR* pag = builder.build();
77
76
 
@@ -88,7 +87,7 @@ int main(int argc, char ** argv)
88
87
 
89
88
  saber->runOnModule(pag);
90
89
 
91
- delete[] arg_value;
90
+ LLVMModuleSet::releaseLLVMModuleSet();
92
91
 
93
92
  return 0;
94
93
 
@@ -44,6 +44,7 @@ int main(int argc, char** argv)
44
44
  OptionBase::parseOptions(argc, argv, "Whole Program Points-to Analysis",
45
45
  "[options] <input-bitcode...>");
46
46
 
47
+ // Refers to content of a singleton unique_ptr<SVFIR> in SVFIR.
47
48
  SVFIR* pag;
48
49
 
49
50
  if (Options::ReadJson())
@@ -52,13 +53,12 @@ int main(int argc, char** argv)
52
53
  }
53
54
  else
54
55
  {
55
- LLVMModuleSet* moduleSet = LLVMModuleSet::getLLVMModuleSet();
56
56
  if (Options::WriteAnder() == "ir_annotator")
57
57
  {
58
- moduleSet->preProcessBCs(moduleNameVec);
58
+ LLVMModuleSet::preProcessBCs(moduleNameVec);
59
59
  }
60
60
 
61
- SVFModule* svfModule = moduleSet->buildSVFModule(moduleNameVec);
61
+ SVFModule* svfModule = LLVMModuleSet::buildSVFModule(moduleNameVec);
62
62
 
63
63
  /// Build SVFIR
64
64
  SVFIRBuilder builder(svfModule);
@@ -68,5 +68,7 @@ int main(int argc, char** argv)
68
68
  WPAPass wpa;
69
69
  wpa.runOnModule(pag);
70
70
 
71
+ LLVMModuleSet::releaseLLVMModuleSet();
72
+
71
73
  return 0;
72
74
  }