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

#include <SVFValue.h>

Inheritance diagram for SVF::SVFValue:
SVF::SVFArgument SVF::SVFBasicBlock SVF::SVFConstant SVF::SVFFunction SVF::SVFInstruction SVF::SVFOtherValue SVF::SVFConstantData SVF::SVFGlobalValue SVF::SVFCallInst SVF::SVFMetadataAsValue SVF::SVFBlackHoleValue SVF::SVFConstantFP SVF::SVFConstantInt SVF::SVFConstantNullPtr SVF::SVFVirtualCallInst

Public Types

enum  SVFValKind {
  SVFVal , SVFFunc , SVFBB , SVFInst ,
  SVFCall , SVFVCall , SVFGlob , SVFArg ,
  SVFConst , SVFConstData , SVFConstInt , SVFConstFP ,
  SVFNullPtr , SVFBlackHole , SVFMetaAsValue , SVFOther
}
 
typedef s64_t GNodeK
 

Public Member Functions

 SVFValue ()=delete
 
virtual ~SVFValue ()=default
 
GNodeK getKind () const
 Get the type of this SVFValue. More...
 
const std::stringgetName () const
 
void setName (const std::string &n)
 
void setName (std::string &&n)
 
virtual const SVFTypegetType () const
 
bool isConstDataOrAggData () const
 
bool ptrInUncalledFunction () const
 
bool isblackHole () const
 
bool isNullPtr () const
 
virtual void setSourceLoc (const std::string &sourceCodeInfo)
 
virtual const std::string getSourceLoc () const
 
std::string toString () const
 Needs to be implemented by a SVF front end. More...
 

Protected Member Functions

 SVFValue (const SVFType *ty, SVFValKind k)
 Constructor without name. More...
 
void setConstDataOrAggData ()
 
void setPtrInUncalledFunction ()
 

Protected Attributes

const SVFTypetype
 Type of this SVFValue. More...
 
std::string name
 Short name of value for printing & debugging. More...
 
std::string sourceLoc
 

Private Attributes

GNodeK kind
 used for classof More...
 
bool ptrInUncalledFun
 true if this pointer is in an uncalled function More...
 
bool constDataOrAggData
 true if this value is a ConstantData (e.g., numbers, string, floats) or a constantAggregate More...
 

Friends

class SVFIRWriter
 
class SVFIRReader
 
class LLVMModuleSet
 
OutStreamoperator<< (OutStream &os, const SVFValue &value)
 Overloading operator << for dumping ICFG node ID. More...
 

Detailed Description

Definition at line 177 of file SVFValue.h.

Member Typedef Documentation

◆ GNodeK

Definition at line 184 of file SVFValue.h.

Member Enumeration Documentation

◆ SVFValKind

Enumerator
SVFVal 
SVFFunc 
SVFBB 
SVFInst 
SVFCall 
SVFVCall 
SVFGlob 
SVFArg 
SVFConst 
SVFConstData 
SVFConstInt 
SVFConstFP 
SVFNullPtr 
SVFBlackHole 
SVFMetaAsValue 
SVFOther 

Definition at line 186 of file SVFValue.h.

187  {
188  SVFVal,
189  SVFFunc,
190  SVFBB,
191  SVFInst,
192  SVFCall,
193  SVFVCall,
194  SVFGlob,
195  SVFArg,
196  SVFConst,
197  SVFConstData,
198  SVFConstInt,
199  SVFConstFP,
200  SVFNullPtr,
201  SVFBlackHole,
203  SVFOther
204  };

Constructor & Destructor Documentation

◆ SVFValue() [1/2]

SVF::SVFValue::SVFValue ( const SVFType ty,
SVFValKind  k 
)
inlineprotected

Constructor without name.

Definition at line 216 of file SVFValue.h.

217  : kind(k), ptrInUncalledFun(false),
218  constDataOrAggData(SVFConstData == k), type(ty), sourceLoc("NoLoc")
219  {
220  }
std::string sourceLoc
Definition: SVFValue.h:214
bool ptrInUncalledFun
true if this pointer is in an uncalled function
Definition: SVFValue.h:208
GNodeK kind
used for classof
Definition: SVFValue.h:207
bool constDataOrAggData
true if this value is a ConstantData (e.g., numbers, string, floats) or a constantAggregate
Definition: SVFValue.h:209
const SVFType * type
Type of this SVFValue.
Definition: SVFValue.h:212

◆ SVFValue() [2/2]

SVF::SVFValue::SVFValue ( )
delete

◆ ~SVFValue()

virtual SVF::SVFValue::~SVFValue ( )
virtualdefault

Member Function Documentation

◆ getKind()

GNodeK SVF::SVFValue::getKind ( void  ) const
inline

Get the type of this SVFValue.

Definition at line 238 of file SVFValue.h.

239  {
240  return kind;
241  }

◆ getName()

const std::string& SVF::SVFValue::getName ( ) const
inline

Definition at line 243 of file SVFValue.h.

244  {
245  return name;
246  }
std::string name
Short name of value for printing & debugging.
Definition: SVFValue.h:213

◆ getSourceLoc()

virtual const std::string SVF::SVFValue::getSourceLoc ( ) const
inlinevirtual

Definition at line 280 of file SVFValue.h.

281  {
282  return sourceLoc;
283  }

◆ getType()

virtual const SVFType* SVF::SVFValue::getType ( ) const
inlinevirtual

Definition at line 256 of file SVFValue.h.

257  {
258  return type;
259  }

◆ isblackHole()

bool SVF::SVFValue::isblackHole ( ) const
inline

Definition at line 268 of file SVFValue.h.

269  {
270  return getKind() == SVFBlackHole;;
271  }
GNodeK getKind() const
Get the type of this SVFValue.
Definition: SVFValue.h:238

◆ isConstDataOrAggData()

bool SVF::SVFValue::isConstDataOrAggData ( ) const
inline

Definition at line 260 of file SVFValue.h.

261  {
262  return constDataOrAggData;
263  }

◆ isNullPtr()

bool SVF::SVFValue::isNullPtr ( ) const
inline

Definition at line 272 of file SVFValue.h.

273  {
274  return getKind() == SVFNullPtr;
275  }

◆ ptrInUncalledFunction()

bool SVF::SVFValue::ptrInUncalledFunction ( ) const
inline

Definition at line 264 of file SVFValue.h.

265  {
266  return ptrInUncalledFun;
267  }

◆ setConstDataOrAggData()

void SVF::SVFValue::setConstDataOrAggData ( )
inlineprotected

attributes to be set only through Module builders e.g., LLVMModule

Definition at line 224 of file SVFValue.h.

225  {
226  constDataOrAggData = true;
227  }

◆ setName() [1/2]

void SVF::SVFValue::setName ( const std::string n)
inline

Definition at line 247 of file SVFValue.h.

248  {
249  name = n;
250  }
cJSON * n
Definition: cJSON.cpp:2558

◆ setName() [2/2]

void SVF::SVFValue::setName ( std::string &&  n)
inline

Definition at line 251 of file SVFValue.h.

252  {
253  name = std::move(n);
254  }
constexpr std::remove_reference< T >::type && move(T &&t) noexcept
Definition: SVFUtil.h:447

◆ setPtrInUncalledFunction()

void SVF::SVFValue::setPtrInUncalledFunction ( )
inlineprotected

Definition at line 228 of file SVFValue.h.

229  {
230  ptrInUncalledFun = true;
231  }

◆ setSourceLoc()

virtual void SVF::SVFValue::setSourceLoc ( const std::string sourceCodeInfo)
inlinevirtual

Definition at line 276 of file SVFValue.h.

277  {
278  sourceLoc = sourceCodeInfo;
279  }

◆ toString()

std::string SVF::SVFValue::toString ( ) const

Needs to be implemented by a SVF front end.

Definition at line 663 of file LLVMUtil.cpp.

664 {
665  std::string str;
666  llvm::raw_string_ostream rawstr(str);
667  if (const SVF::SVFFunction* fun = SVFUtil::dyn_cast<SVFFunction>(this))
668  {
669  rawstr << "Function: " << fun->getName() << " ";
670  }
671  else if (const SVFBasicBlock* bb = SVFUtil::dyn_cast<SVFBasicBlock>(this))
672  {
673  rawstr << "BasicBlock: " << bb->getName() << " ";
674  }
675  else
676  {
677  auto llvmVal = LLVMModuleSet::getLLVMModuleSet()->getLLVMValue(this);
678  if (llvmVal)
679  rawstr << " " << *llvmVal << " ";
680  else
681  rawstr << " No llvmVal found";
682  }
683  rawstr << this->getSourceLoc();
684  return rawstr.str();
685 }
const char *const string
Definition: cJSON.h:172
const Value * getLLVMValue(const SVFValue *value) const
Definition: LLVMModule.h:216
static LLVMModuleSet * getLLVMModuleSet()
Definition: LLVMModule.h:118
virtual const std::string getSourceLoc() const
Definition: SVFValue.h:280

Friends And Related Function Documentation

◆ LLVMModuleSet

friend class LLVMModuleSet
friend

Definition at line 181 of file SVFValue.h.

◆ operator<<

OutStream& operator<< ( OutStream os,
const SVFValue value 
)
friend

Overloading operator << for dumping ICFG node ID.

Definition at line 290 of file SVFValue.h.

291  {
292  return os << value.toString();
293  }

◆ SVFIRReader

friend class SVFIRReader
friend

Definition at line 180 of file SVFValue.h.

◆ SVFIRWriter

friend class SVFIRWriter
friend

Definition at line 179 of file SVFValue.h.

Member Data Documentation

◆ constDataOrAggData

bool SVF::SVFValue::constDataOrAggData
private

true if this value is a ConstantData (e.g., numbers, string, floats) or a constantAggregate

Definition at line 209 of file SVFValue.h.

◆ kind

GNodeK SVF::SVFValue::kind
private

used for classof

Definition at line 207 of file SVFValue.h.

◆ name

std::string SVF::SVFValue::name
protected

Short name of value for printing & debugging.

Definition at line 213 of file SVFValue.h.

◆ ptrInUncalledFun

bool SVF::SVFValue::ptrInUncalledFun
private

true if this pointer is in an uncalled function

Definition at line 208 of file SVFValue.h.

◆ sourceLoc

std::string SVF::SVFValue::sourceLoc
protected

Source code information of this value

Definition at line 214 of file SVFValue.h.

◆ type

const SVFType* SVF::SVFValue::type
protected

Type of this SVFValue.

Definition at line 212 of file SVFValue.h.


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