SVF
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes | List of all members
SVF::VFPathCond Class Reference

#include <DPItem.h>

Inheritance diagram for SVF::VFPathCond:
SVF::ContextCond

Public Types

typedef PathCondAllocator::Condition PathCond
 
typedef std::vector< std::pair< NodeID, NodeID > > EdgeSet
 
- Public Types inherited from SVF::ContextCond
typedef CallStrCxt::const_iterator const_iterator
 

Public Member Functions

 VFPathCond (PathCond *p=PathCondAllocator::trueCond())
 Constructor. More...
 
 VFPathCond (const VFPathCond &cond)
 Copy Constructor. More...
 
virtual ~VFPathCond ()
 Destructor. More...
 
u32_t getMaxPathLen () const
 
PathCondgetPaths () const
 Return paths. More...
 
const EdgeSetgetVFEdges () const
 Return paths. More...
 
void setPaths (PathCond *p, const EdgeSet &e)
 Set paths. More...
 
u32_t pathLen () const
 Get path length. More...
 
void addVFEdge (NodeID from, NodeID to)
 Add SVFG Edge. More...
 
bool hasVFEdge (NodeID from, NodeID to) const
 Has SVFG Edge. More...
 
bool hasIncomingEdge (NodeID node) const
 Whether Node dst has incoming edge. More...
 
bool hasOutgoingEdge (NodeID node) const
 Whether Node dst has outgoing edge. More...
 
bool addPath (PathCondAllocator *allocator, PathCond *c, NodeID from, NodeID to)
 
bool operator< (const VFPathCond &rhs) const
 
VFPathCondoperator= (const VFPathCond &rhs)
 Overloading operator=. More...
 
bool operator== (const VFPathCond &rhs) const
 Overloading operator==. More...
 
bool operator!= (const VFPathCond &rhs) const
 Overloading operator!=. More...
 
std::string vfEdgesTrace () const
 Get value-flow edge traces. More...
 
std::string toString () const
 Dump context condition. More...
 
bool condAnd (PathCondAllocator *allocator, PathCond *c)
 Condition operatoration. More...
 
void condOr (PathCondAllocator *allocator, PathCond *c)
 
- Public Member Functions inherited from SVF::ContextCond
 ContextCond ()
 Constructor. More...
 
 ContextCond (const ContextCond &cond)
 Copy Constructor. More...
 
virtual ~ContextCond ()
 Destructor. More...
 
const CallStrCxtgetContexts () const
 Get context. More...
 
CallStrCxtgetContexts ()
 Get context. More...
 
bool isConcreteCxt () const
 Whether it is an concrete context. More...
 
void setNonConcreteCxt ()
 Whether it is an concrete context. More...
 
bool containCallStr (NodeID cxt) const
 Whether contains callstring cxt. More...
 
u32_t cxtSize () const
 Get context size. More...
 
virtual bool pushContext (NodeID ctx)
 Push context. More...
 
virtual bool matchContext (NodeID ctx)
 Match context. More...
 
bool operator< (const ContextCond &rhs) const
 
NodeID operator[] (const u32_t index) const
 Overloading operator[]. More...
 
ContextCondoperator= (const ContextCond &rhs)
 Overloading operator=. More...
 
bool operator== (const ContextCond &rhs) const
 Overloading operator==. More...
 
bool operator!= (const ContextCond &rhs) const
 Overloading operator!=. More...
 
const_iterator begin () const
 Begin iterators. More...
 
const_iterator end () const
 End iterators. More...
 
std::string toString () const
 Dump context condition. More...
 

Static Public Member Functions

static void setMaxPathLen (u32_t max)
 set max path limit More...
 
- Static Public Member Functions inherited from SVF::ContextCond
static void setMaxCxtLen (u32_t max)
 set max context limit More...
 

Static Public Attributes

static u32_t maximumPath = 0
 
- Static Public Attributes inherited from SVF::ContextCond
static u32_t maximumCxt = 0
 

Private Attributes

PathCondpath
 
EdgeSet edges
 

Static Private Attributes

static u32_t maximumPathLen = 0
 

Additional Inherited Members

- Protected Attributes inherited from SVF::ContextCond
CallStrCxt context
 

Detailed Description

Definition at line 440 of file DPItem.h.

Member Typedef Documentation

◆ EdgeSet

typedef std::vector<std::pair<NodeID,NodeID> > SVF::VFPathCond::EdgeSet

Definition at line 445 of file DPItem.h.

◆ PathCond

Definition at line 444 of file DPItem.h.

Constructor & Destructor Documentation

◆ VFPathCond() [1/2]

SVF::VFPathCond::VFPathCond ( PathCond p = PathCondAllocator::trueCond())
inline

Constructor.

Definition at line 449 of file DPItem.h.

449  : ContextCond(), path(p)
450  {
451  }
ContextCond()
Constructor.
Definition: DPItem.h:199
PathCond * path
Definition: DPItem.h:610

◆ VFPathCond() [2/2]

SVF::VFPathCond::VFPathCond ( const VFPathCond cond)
inline

Copy Constructor.

Definition at line 453 of file DPItem.h.

453  : ContextCond(cond), path(cond.getPaths()),edges(cond.getVFEdges())
454  {
455  }
ContextCond()
Constructor.
Definition: DPItem.h:199
PathCond * path
Definition: DPItem.h:610
EdgeSet edges
Definition: DPItem.h:611

◆ ~VFPathCond()

virtual SVF::VFPathCond::~VFPathCond ( )
inlinevirtual

Destructor.

Definition at line 457 of file DPItem.h.

458  {
459  }

Member Function Documentation

◆ addPath()

bool SVF::VFPathCond::addPath ( PathCondAllocator allocator,
PathCond c,
NodeID  from,
NodeID  to 
)
inline

drop condition when existing a loop (vf cycle)

Definition at line 524 of file DPItem.h.

525  {
526  if(pathLen() < maximumPathLen)
527  {
528  if(!hasVFEdge(from,to))
529  {
531  if(hasOutgoingEdge(from))
532  c = allocator->getTrueCond();
533  }
534  addVFEdge(from,to);
535  return condAnd(allocator,c);
536  }
537  // DBOUT(DDDA, SVFUtil::outs() << "\t\t!!path length beyond limits \n");
538  return true;
539  }
bool hasVFEdge(NodeID from, NodeID to) const
Has SVFG Edge.
Definition: DPItem.h:500
void addVFEdge(NodeID from, NodeID to)
Add SVFG Edge.
Definition: DPItem.h:491
u32_t pathLen() const
Get path length.
Definition: DPItem.h:486
static u32_t maximumPathLen
Definition: DPItem.h:612
bool hasOutgoingEdge(NodeID node) const
Whether Node dst has outgoing edge.
Definition: DPItem.h:515
bool condAnd(PathCondAllocator *allocator, PathCond *c)
Condition operatoration.
Definition: DPItem.h:542

◆ addVFEdge()

void SVF::VFPathCond::addVFEdge ( NodeID  from,
NodeID  to 
)
inline

Add SVFG Edge.

Definition at line 491 of file DPItem.h.

492  {
493  // assert(!hasVFEdge(from,to) && "Edge exit?");
494  if(edges.size() > maximumPath)
495  maximumPath = edges.size();
496 
497  edges.push_back(std::make_pair(from,to));
498  }
static u32_t maximumPath
Definition: DPItem.h:614
EdgeSet edges
Definition: DPItem.h:611

◆ condAnd()

bool SVF::VFPathCond::condAnd ( PathCondAllocator allocator,
PathCond c 
)
inline

Condition operatoration.

Definition at line 542 of file DPItem.h.

543  {
544  path = allocator->condAnd(path,c);
545  return path != allocator->getFalseCond();
546  }
PathCond * path
Definition: DPItem.h:610

◆ condOr()

void SVF::VFPathCond::condOr ( PathCondAllocator allocator,
PathCond c 
)
inline

Definition at line 547 of file DPItem.h.

548  {
549  path = allocator->condOr(path,c);
550  }
PathCond * path
Definition: DPItem.h:610

◆ getMaxPathLen()

u32_t SVF::VFPathCond::getMaxPathLen ( ) const
inline

Definition at line 465 of file DPItem.h.

466  {
467  return maximumPathLen;
468  }
static u32_t maximumPathLen
Definition: DPItem.h:612

◆ getPaths()

PathCond* SVF::VFPathCond::getPaths ( ) const
inline

Return paths.

Definition at line 470 of file DPItem.h.

471  {
472  return path;
473  }
PathCond * path
Definition: DPItem.h:610

◆ getVFEdges()

const EdgeSet& SVF::VFPathCond::getVFEdges ( ) const
inline

Return paths.

Definition at line 475 of file DPItem.h.

476  {
477  return edges;
478  }
EdgeSet edges
Definition: DPItem.h:611

◆ hasIncomingEdge()

bool SVF::VFPathCond::hasIncomingEdge ( NodeID  node) const
inline

Whether Node dst has incoming edge.

Definition at line 505 of file DPItem.h.

506  {
507  for(EdgeSet::const_iterator it = edges.begin(), eit =edges.end(); it!=eit; ++it)
508  {
509  if(it->second == node)
510  return true;
511  }
512  return false;
513  }
EdgeSet edges
Definition: DPItem.h:611

◆ hasOutgoingEdge()

bool SVF::VFPathCond::hasOutgoingEdge ( NodeID  node) const
inline

Whether Node dst has outgoing edge.

Definition at line 515 of file DPItem.h.

516  {
517  for(EdgeSet::const_iterator it = edges.begin(), eit =edges.end(); it!=eit; ++it)
518  {
519  if(it->first == node)
520  return true;
521  }
522  return false;
523  }
EdgeSet edges
Definition: DPItem.h:611

◆ hasVFEdge()

bool SVF::VFPathCond::hasVFEdge ( NodeID  from,
NodeID  to 
) const
inline

Has SVFG Edge.

Definition at line 500 of file DPItem.h.

501  {
502  return std::find(edges.begin(),edges.end(),std::make_pair(from,to)) != edges.end();
503  }
EdgeSet edges
Definition: DPItem.h:611

◆ operator!=()

bool SVF::VFPathCond::operator!= ( const VFPathCond rhs) const
inline

Overloading operator!=.

Definition at line 579 of file DPItem.h.

580  {
581  return !(*this==rhs);
582  }

◆ operator<()

bool SVF::VFPathCond::operator< ( const VFPathCond rhs) const
inline

Enable compare operator to avoid duplicated item insertion in map or set to be noted that two vectors can also overload operator()

Definition at line 555 of file DPItem.h.

556  {
557  if(path != rhs.path)
558  return path < rhs.path;
559  else
560  return context < rhs.context;
561  }
PathCond * path
Definition: DPItem.h:610
CallStrCxt context
Definition: DPItem.h:340

◆ operator=()

VFPathCond& SVF::VFPathCond::operator= ( const VFPathCond rhs)
inline

Overloading operator=.

Definition at line 563 of file DPItem.h.

564  {
565  if(*this != rhs)
566  {
568  path = rhs.getPaths();
569  edges = rhs.getVFEdges();
570  }
571  return *this;
572  }
PathCond * path
Definition: DPItem.h:610
EdgeSet edges
Definition: DPItem.h:611
ContextCond & operator=(const ContextCond &rhs)
Overloading operator=.
Definition: DPItem.h:297

◆ operator==()

bool SVF::VFPathCond::operator== ( const VFPathCond rhs) const
inline

Overloading operator==.

Definition at line 574 of file DPItem.h.

575  {
576  return (context == rhs.getContexts() && path == rhs.getPaths());
577  }
PathCond * path
Definition: DPItem.h:610
CallStrCxt context
Definition: DPItem.h:340

◆ pathLen()

u32_t SVF::VFPathCond::pathLen ( ) const
inline

Get path length.

Definition at line 486 of file DPItem.h.

487  {
488  return edges.size();
489  }
EdgeSet edges
Definition: DPItem.h:611

◆ setMaxPathLen()

static void SVF::VFPathCond::setMaxPathLen ( u32_t  max)
inlinestatic

set max path limit

Definition at line 461 of file DPItem.h.

462  {
463  maximumPathLen = max;
464  }
static u32_t maximumPathLen
Definition: DPItem.h:612

◆ setPaths()

void SVF::VFPathCond::setPaths ( PathCond p,
const EdgeSet e 
)
inline

Set paths.

Definition at line 480 of file DPItem.h.

481  {
482  path = p;
483  edges = e;
484  }
PathCond * path
Definition: DPItem.h:610
EdgeSet edges
Definition: DPItem.h:611

◆ toString()

std::string SVF::VFPathCond::toString ( ) const
inline

Dump context condition.

Definition at line 595 of file DPItem.h.

596  {
597  std::string str;
598  raw_string_ostream rawstr(str);
599  rawstr << "[:";
600  for(CallStrCxt::const_iterator it = context.begin(), eit = context.end(); it!=eit; ++it)
601  {
602  rawstr << *it << " ";
603  }
604  rawstr << " | ";
605  rawstr << "" << path << "] " << vfEdgesTrace() ;
606  return rawstr.str();
607  }
std::string vfEdgesTrace() const
Get value-flow edge traces.
Definition: DPItem.h:584
PathCond * path
Definition: DPItem.h:610
llvm::raw_string_ostream raw_string_ostream
Definition: BasicTypes.h:100
CallStrCxt context
Definition: DPItem.h:340

◆ vfEdgesTrace()

std::string SVF::VFPathCond::vfEdgesTrace ( ) const
inline

Get value-flow edge traces.

Definition at line 584 of file DPItem.h.

585  {
586  std::string str;
587  raw_string_ostream rawstr(str);
588  for(EdgeSet::const_iterator it = edges.begin(), eit = edges.end(); it!=eit; ++it)
589  {
590  rawstr << "(" << it->first << "," << it->second << ")";
591  }
592  return rawstr.str();
593  }
llvm::raw_string_ostream raw_string_ostream
Definition: BasicTypes.h:100
EdgeSet edges
Definition: DPItem.h:611

Member Data Documentation

◆ edges

EdgeSet SVF::VFPathCond::edges
private

Definition at line 611 of file DPItem.h.

◆ maximumPath

u32_t VFPathCond::maximumPath = 0
static

Definition at line 614 of file DPItem.h.

◆ maximumPathLen

u32_t VFPathCond::maximumPathLen = 0
staticprivate

Definition at line 612 of file DPItem.h.

◆ path

PathCond* SVF::VFPathCond::path
private

Definition at line 610 of file DPItem.h.


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