svf-lib 1.0.1521 → 1.0.1523

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.
@@ -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;
@@ -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
 
@@ -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;
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1521",
3
+ "version": "1.0.1523",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {