Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVFModule.cpp
Go to the documentation of this file.
1//===- SVFModule.cpp -- Helper functions for pointer analysis--------------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-2017> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22
23
24#include "SVFIR/SVFModule.h"
26#include "Util/SVFUtil.h"
27#include "Util/SVFStat.h"
28#include "Util/Options.h"
29
30using namespace SVF;
31
32std::string SVFModule::pagReadFromTxt = "";
34
36{
37 for (const SVFFunction* f : FunctionSet)
38 delete f;
39 for (const SVFConstant* c : ConstantSet)
40 delete c;
41 for (const SVFValue* o : OtherValueSet)
42 delete o;
46}
47
48const SVFFunction* SVFModule::getSVFFunction(const std::string& name)
49{
50 for (const SVFFunction* fun : getFunctionSet())
51 {
52 if (fun->getName() == name)
53 {
54 return fun;
55 }
56 }
57 return nullptr;
58}
59
61{
62 if (svfModule == nullptr)
63 {
64 svfModule = new SVFModule;
65 }
66 return svfModule;
67}
68
70{
71 assert(svfModule != nullptr && "SVFModule is not initialized?");
72 delete svfModule;
73 svfModule = nullptr;
74}
const char *const name
Definition cJSON.h:264
static void destory()
Definition ExtAPI.cpp:51
static void unset(void)
Deletes the (singleton) allocator.
SVFModule()=default
Constructors.
static std::string pagReadFromTxt
Definition SVFModule.h:66
static void releaseSVFModule()
Definition SVFModule.cpp:69
ConstantType ConstantSet
The ConstantData in the module.
Definition SVFModule.h:71
OtherValueType OtherValueSet
All other values in the module.
Definition SVFModule.h:72
const FunctionSetType & getFunctionSet() const
Definition SVFModule.h:199
static SVFModule * getSVFModule()
Definition SVFModule.cpp:60
static SVFModule * svfModule
Definition SVFModule.h:65
FunctionSetType FunctionSet
The Functions in the module.
Definition SVFModule.h:68
const SVFFunction * getSVFFunction(const std::string &name)
Definition SVFModule.cpp:48
static void destroy()
Definition ThreadAPI.h:116
for isBitcode
Definition BasicTypes.h:68
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74