Static Value-Flow Analysis
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
SVF::SVFModule Class Reference

#include <SVFModule.h>

Public Types

typedef std::vector< const SVFFunction * > FunctionSetType
 
typedef std::vector< SVFGlobalValue * > GlobalSetType
 
typedef std::vector< SVFGlobalValue * > AliasSetType
 
typedef std::vector< SVFConstant * > ConstantType
 
typedef std::vector< SVFOtherValue * > OtherValueType
 
typedef FunctionSetType::iterator iterator
 Iterators type def. More...
 
typedef FunctionSetType::const_iterator const_iterator
 
typedef GlobalSetType::iterator global_iterator
 
typedef GlobalSetType::const_iterator const_global_iterator
 
typedef AliasSetType::iterator alias_iterator
 
typedef AliasSetType::const_iterator const_alias_iterator
 
typedef ConstantType::iterator cdata_iterator
 
typedef ConstantType::const_iterator const_cdata_iterator
 
typedef OtherValueType::iterator ovalue_iterator
 
typedef OtherValueType::const_iterator const_ovalue_iterator
 

Public Member Functions

 ~SVFModule ()
 
void setModuleIdentifier (const std::string &moduleIdentifier)
 
const SVFFunctiongetSVFFunction (const std::string &name)
 
const std::stringgetModuleIdentifier () const
 
const FunctionSetTypegetFunctionSet () const
 
const ConstantTypegetConstantSet () const
 
const GlobalSetTypegetGlobalSet () const
 
const AliasSetTypegetAliasSet () const
 
const OtherValueTypegetOtherValueSet () const
 
void addFunctionSet (SVFFunction *svfFunc)
 
void addGlobalSet (SVFGlobalValue *glob)
 
void addAliasSet (SVFGlobalValue *alias)
 
void addConstant (SVFConstant *cd)
 
void addOtherValue (SVFOtherValue *ov)
 
global_iterator global_begin ()
 
const_global_iterator global_begin () const
 
global_iterator global_end ()
 
const_global_iterator global_end () const
 
alias_iterator alias_begin ()
 
const_alias_iterator alias_begin () const
 
alias_iterator alias_end ()
 
const_alias_iterator alias_end () const
 
cdata_iterator constant_begin ()
 
const_cdata_iterator constant_begin () const
 
cdata_iterator constant_end ()
 
const_cdata_iterator constant_end () const
 

Static Public Member Functions

static SVFModulegetSVFModule ()
 
static void releaseSVFModule ()
 
static void setPagFromTXT (const std::string &txt)
 
static std::string pagFileName ()
 
static bool pagReadFromTXT ()
 

Private Member Functions

 SVFModule ()=default
 Constructors. More...
 

Private Attributes

std::string moduleIdentifier
 
FunctionSetType FunctionSet
 The Functions in the module. More...
 
GlobalSetType GlobalSet
 The Global Variables in the module. More...
 
AliasSetType AliasSet
 The Aliases in the module. More...
 
ConstantType ConstantSet
 The ConstantData in the module. More...
 
OtherValueType OtherValueSet
 All other values in the module. More...
 

Static Private Attributes

static SVFModulesvfModule = nullptr
 
static std::string pagReadFromTxt = ""
 

Friends

class SVFIRWriter
 
class SVFIRReader
 

Detailed Description

Definition at line 40 of file SVFModule.h.

Member Typedef Documentation

◆ alias_iterator

typedef AliasSetType::iterator SVF::SVFModule::alias_iterator

Definition at line 57 of file SVFModule.h.

◆ AliasSetType

Definition at line 48 of file SVFModule.h.

◆ cdata_iterator

typedef ConstantType::iterator SVF::SVFModule::cdata_iterator

Definition at line 59 of file SVFModule.h.

◆ const_alias_iterator

typedef AliasSetType::const_iterator SVF::SVFModule::const_alias_iterator

Definition at line 58 of file SVFModule.h.

◆ const_cdata_iterator

typedef ConstantType::const_iterator SVF::SVFModule::const_cdata_iterator

Definition at line 60 of file SVFModule.h.

◆ const_global_iterator

typedef GlobalSetType::const_iterator SVF::SVFModule::const_global_iterator

Definition at line 56 of file SVFModule.h.

◆ const_iterator

typedef FunctionSetType::const_iterator SVF::SVFModule::const_iterator

Definition at line 54 of file SVFModule.h.

◆ const_ovalue_iterator

typedef OtherValueType::const_iterator SVF::SVFModule::const_ovalue_iterator

Definition at line 62 of file SVFModule.h.

◆ ConstantType

Definition at line 49 of file SVFModule.h.

◆ FunctionSetType

typedef std::vector<const SVFFunction*> SVF::SVFModule::FunctionSetType

Definition at line 46 of file SVFModule.h.

◆ global_iterator

typedef GlobalSetType::iterator SVF::SVFModule::global_iterator

Definition at line 55 of file SVFModule.h.

◆ GlobalSetType

Definition at line 47 of file SVFModule.h.

◆ iterator

typedef FunctionSetType::iterator SVF::SVFModule::iterator

Iterators type def.

Definition at line 53 of file SVFModule.h.

◆ OtherValueType

Definition at line 50 of file SVFModule.h.

◆ ovalue_iterator

typedef OtherValueType::iterator SVF::SVFModule::ovalue_iterator

Definition at line 61 of file SVFModule.h.

Constructor & Destructor Documentation

◆ SVFModule()

SVF::SVFModule::SVFModule ( )
privatedefault

Constructors.

◆ ~SVFModule()

SVFModule::~SVFModule ( )

Definition at line 35 of file SVFModule.cpp.

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 }
static void destory()
Definition: ExtAPI.cpp:51
static void unset(void)
Deletes the (singleton) allocator.
ConstantType ConstantSet
The ConstantData in the module.
Definition: SVFModule.h:71
OtherValueType OtherValueSet
All other values in the module.
Definition: SVFModule.h:72
FunctionSetType FunctionSet
The Functions in the module.
Definition: SVFModule.h:68
static void destroy()
Definition: ThreadAPI.h:114

Member Function Documentation

◆ addAliasSet()

void SVF::SVFModule::addAliasSet ( SVFGlobalValue alias)
inline

Definition at line 115 of file SVFModule.h.

116  {
117  AliasSet.push_back(alias);
118  addConstant(alias);
119  }
AliasSetType AliasSet
The Aliases in the module.
Definition: SVFModule.h:70
void addConstant(SVFConstant *cd)
Definition: SVFModule.h:120

◆ addConstant()

void SVF::SVFModule::addConstant ( SVFConstant cd)
inline

Definition at line 120 of file SVFModule.h.

121  {
122  ConstantSet.push_back(cd);
123  }

◆ addFunctionSet()

void SVF::SVFModule::addFunctionSet ( SVFFunction svfFunc)
inline

Definition at line 106 of file SVFModule.h.

107  {
108  FunctionSet.push_back(svfFunc);
109  }

◆ addGlobalSet()

void SVF::SVFModule::addGlobalSet ( SVFGlobalValue glob)
inline

Definition at line 110 of file SVFModule.h.

111  {
112  GlobalSet.push_back(glob);
113  addConstant(glob);
114  }
GlobalSetType GlobalSet
The Global Variables in the module.
Definition: SVFModule.h:69

◆ addOtherValue()

void SVF::SVFModule::addOtherValue ( SVFOtherValue ov)
inline

Definition at line 124 of file SVFModule.h.

125  {
126  OtherValueSet.push_back(ov);
127  }

◆ alias_begin() [1/2]

alias_iterator SVF::SVFModule::alias_begin ( )
inline

Definition at line 150 of file SVFModule.h.

151  {
152  return AliasSet.begin();
153  }

◆ alias_begin() [2/2]

const_alias_iterator SVF::SVFModule::alias_begin ( ) const
inline

Definition at line 154 of file SVFModule.h.

155  {
156  return AliasSet.begin();
157  }

◆ alias_end() [1/2]

alias_iterator SVF::SVFModule::alias_end ( )
inline

Definition at line 158 of file SVFModule.h.

159  {
160  return AliasSet.end();
161  }

◆ alias_end() [2/2]

const_alias_iterator SVF::SVFModule::alias_end ( ) const
inline

Definition at line 162 of file SVFModule.h.

163  {
164  return AliasSet.end();
165  }

◆ constant_begin() [1/2]

cdata_iterator SVF::SVFModule::constant_begin ( )
inline

Definition at line 167 of file SVFModule.h.

168  {
169  return ConstantSet.begin();
170  }

◆ constant_begin() [2/2]

const_cdata_iterator SVF::SVFModule::constant_begin ( ) const
inline

Definition at line 171 of file SVFModule.h.

172  {
173  return ConstantSet.begin();
174  }

◆ constant_end() [1/2]

cdata_iterator SVF::SVFModule::constant_end ( )
inline

Definition at line 175 of file SVFModule.h.

176  {
177  return ConstantSet.end();
178  }

◆ constant_end() [2/2]

const_cdata_iterator SVF::SVFModule::constant_end ( ) const
inline

Definition at line 179 of file SVFModule.h.

180  {
181  return ConstantSet.end();
182  }

◆ getAliasSet()

const AliasSetType& SVF::SVFModule::getAliasSet ( ) const
inline

Definition at line 211 of file SVFModule.h.

212  {
213  return AliasSet;
214  }

◆ getConstantSet()

const ConstantType& SVF::SVFModule::getConstantSet ( ) const
inline

Definition at line 203 of file SVFModule.h.

204  {
205  return ConstantSet;
206  }

◆ getFunctionSet()

const FunctionSetType& SVF::SVFModule::getFunctionSet ( ) const
inline

Definition at line 199 of file SVFModule.h.

200  {
201  return FunctionSet;
202  }

◆ getGlobalSet()

const GlobalSetType& SVF::SVFModule::getGlobalSet ( ) const
inline

Definition at line 207 of file SVFModule.h.

208  {
209  return GlobalSet;
210  }

◆ getModuleIdentifier()

const std::string& SVF::SVFModule::getModuleIdentifier ( ) const
inline

Definition at line 185 of file SVFModule.h.

186  {
187  if (pagReadFromTxt.empty())
188  {
189  assert(!moduleIdentifier.empty() &&
190  "No module found! Reading from a file other than LLVM-IR?");
191  return moduleIdentifier;
192  }
193  else
194  {
195  return pagReadFromTxt;
196  }
197  }
static std::string pagReadFromTxt
Definition: SVFModule.h:66
std::string moduleIdentifier
Definition: SVFModule.h:67

◆ getOtherValueSet()

const OtherValueType& SVF::SVFModule::getOtherValueSet ( ) const
inline

Definition at line 215 of file SVFModule.h.

216  {
217  return OtherValueSet;
218  }

◆ getSVFFunction()

const SVFFunction * SVFModule::getSVFFunction ( const std::string name)

Definition at line 48 of file SVFModule.cpp.

49 {
50  for (const SVFFunction* fun : getFunctionSet())
51  {
52  if (fun->getName() == name)
53  {
54  return fun;
55  }
56  }
57  return nullptr;
58 }
const char *const name
Definition: cJSON.h:264
const FunctionSetType & getFunctionSet() const
Definition: SVFModule.h:199

◆ getSVFModule()

SVFModule * SVFModule::getSVFModule ( )
static

Definition at line 60 of file SVFModule.cpp.

61 {
62  if (svfModule == nullptr)
63  {
64  svfModule = new SVFModule;
65  }
66  return svfModule;
67 }
SVFModule()=default
Constructors.
static SVFModule * svfModule
Definition: SVFModule.h:65

◆ global_begin() [1/2]

global_iterator SVF::SVFModule::global_begin ( )
inline

Iterators

Definition at line 133 of file SVFModule.h.

134  {
135  return GlobalSet.begin();
136  }

◆ global_begin() [2/2]

const_global_iterator SVF::SVFModule::global_begin ( ) const
inline

Definition at line 137 of file SVFModule.h.

138  {
139  return GlobalSet.begin();
140  }

◆ global_end() [1/2]

global_iterator SVF::SVFModule::global_end ( )
inline

Definition at line 141 of file SVFModule.h.

142  {
143  return GlobalSet.end();
144  }

◆ global_end() [2/2]

const_global_iterator SVF::SVFModule::global_end ( ) const
inline

Definition at line 145 of file SVFModule.h.

146  {
147  return GlobalSet.end();
148  }

◆ pagFileName()

static std::string SVF::SVFModule::pagFileName ( )
inlinestatic

Definition at line 93 of file SVFModule.h.

94  {
95  return pagReadFromTxt;
96  }

◆ pagReadFromTXT()

static bool SVF::SVFModule::pagReadFromTXT ( )
inlinestatic

Definition at line 98 of file SVFModule.h.

99  {
100  return !pagReadFromTxt.empty();
101  }

◆ releaseSVFModule()

void SVFModule::releaseSVFModule ( )
static

Definition at line 69 of file SVFModule.cpp.

70 {
71  assert(svfModule != nullptr && "SVFModule is not initialized?");
72  delete svfModule;
73  svfModule = nullptr;
74 }

◆ setModuleIdentifier()

void SVF::SVFModule::setModuleIdentifier ( const std::string moduleIdentifier)
inline

Definition at line 88 of file SVFModule.h.

89  {
91  }

◆ setPagFromTXT()

static void SVF::SVFModule::setPagFromTXT ( const std::string txt)
inlinestatic

Definition at line 83 of file SVFModule.h.

84  {
85  pagReadFromTxt = txt;
86  }

Friends And Related Function Documentation

◆ SVFIRReader

friend class SVFIRReader
friend

Definition at line 43 of file SVFModule.h.

◆ SVFIRWriter

friend class SVFIRWriter
friend

Definition at line 42 of file SVFModule.h.

Member Data Documentation

◆ AliasSet

AliasSetType SVF::SVFModule::AliasSet
private

The Aliases in the module.

Definition at line 70 of file SVFModule.h.

◆ ConstantSet

ConstantType SVF::SVFModule::ConstantSet
private

The ConstantData in the module.

Definition at line 71 of file SVFModule.h.

◆ FunctionSet

FunctionSetType SVF::SVFModule::FunctionSet
private

The Functions in the module.

Definition at line 68 of file SVFModule.h.

◆ GlobalSet

GlobalSetType SVF::SVFModule::GlobalSet
private

The Global Variables in the module.

Definition at line 69 of file SVFModule.h.

◆ moduleIdentifier

std::string SVF::SVFModule::moduleIdentifier
private

Definition at line 67 of file SVFModule.h.

◆ OtherValueSet

OtherValueType SVF::SVFModule::OtherValueSet
private

All other values in the module.

Definition at line 72 of file SVFModule.h.

◆ pagReadFromTxt

std::string SVFModule::pagReadFromTxt = ""
staticprivate

Definition at line 66 of file SVFModule.h.

◆ svfModule

SVFModule * SVFModule::svfModule = nullptr
staticprivate

Definition at line 65 of file SVFModule.h.


The documentation for this class was generated from the following files: