Static Value-Flow Analysis
Public Member Functions | Protected Attributes | List of all members
SVF::CxtThread Class Reference

#include <CxtStmt.h>

Public Member Functions

 CxtThread (const CallStrCxt &c, const ICFGNode *fork)
 Constructor. More...
 
 CxtThread (const CxtThread &ct)
 Copy constructor. More...
 
virtual ~CxtThread ()
 Destructor. More...
 
const CallStrCxtgetContext () const
 Return context of the thread. More...
 
const ICFGNodegetThread () const
 Return forksite. More...
 
bool operator< (const CxtThread &rhs) const
 
CxtThreadoperator= (const CxtThread &rhs)
 Overloading operator=. More...
 
bool operator== (const CxtThread &rhs) const
 Overloading operator==. More...
 
bool operator!= (const CxtThread &rhs) const
 Overloading operator==. More...
 
std::string cxtToStr () const
 Return context in string format. More...
 
void setInloop (bool in)
 inloop, incycle attributes More...
 
bool isInloop () const
 
void setIncycle (bool in)
 
bool isIncycle () const
 
void dump () const
 Dump CxtThread. More...
 

Protected Attributes

CallStrCxt cxt
 
const ICFGNodeforksite
 
bool inloop
 
bool incycle
 

Detailed Description

Context-sensitive thread <c,t>

Definition at line 189 of file CxtStmt.h.

Constructor & Destructor Documentation

◆ CxtThread() [1/2]

SVF::CxtThread::CxtThread ( const CallStrCxt c,
const ICFGNode fork 
)
inline

Constructor.

Definition at line 193 of file CxtStmt.h.

193  : cxt(c), forksite(fork), inloop(false), incycle(false)
194  {
195  }
const ICFGNode * forksite
Definition: CxtStmt.h:298
bool incycle
Definition: CxtStmt.h:300
CallStrCxt cxt
Definition: CxtStmt.h:297

◆ CxtThread() [2/2]

SVF::CxtThread::CxtThread ( const CxtThread ct)
inline

Copy constructor.

Definition at line 197 of file CxtStmt.h.

197  :
198  cxt(ct.getContext()), forksite(ct.getThread()), inloop(ct.isInloop()), incycle(ct.isIncycle())
199  {
200  }

◆ ~CxtThread()

virtual SVF::CxtThread::~CxtThread ( )
inlinevirtual

Destructor.

Definition at line 202 of file CxtStmt.h.

203  {
204  }

Member Function Documentation

◆ cxtToStr()

std::string SVF::CxtThread::cxtToStr ( ) const
inline

Return context in string format.

Definition at line 245 of file CxtStmt.h.

246  {
247  std::string str;
248  std::stringstream rawstr(str);
249  rawstr << "[:";
250  for(CallStrCxt::const_iterator it = cxt.begin(), eit = cxt.end(); it!=eit; ++it)
251  {
252  rawstr << *it << " ";
253  }
254  rawstr << " ]";
255  return rawstr.str();
256  }
const char *const string
Definition: cJSON.h:172

◆ dump()

void SVF::CxtThread::dump ( ) const
inline

Dump CxtThread.

Definition at line 279 of file CxtStmt.h.

280  {
281  std::string loop = inloop?", inloop":"";
282  std::string cycle = incycle?", incycle":"";
283 
284  if(forksite)
285  {
286  SVFUtil::outs() << "[ Thread: "
287  << forksite->toString() << "\t Contexts: " << cxtToStr()
288  << loop << cycle <<" ]\n";
289  }
290  else
291  {
292  SVFUtil::outs() << "[ Thread: " << "main " << "\t Contexts: " << cxtToStr()
293  << loop << cycle <<" ]\n";
294  }
295  }
std::string cxtToStr() const
Return context in string format.
Definition: CxtStmt.h:245
virtual const std::string toString() const
Definition: ICFG.cpp:61
std::ostream & outs()
Overwrite llvm::outs()
Definition: SVFUtil.h:50

◆ getContext()

const CallStrCxt& SVF::CxtThread::getContext ( ) const
inline

Return context of the thread.

Definition at line 206 of file CxtStmt.h.

207  {
208  return cxt;
209  }

◆ getThread()

const ICFGNode* SVF::CxtThread::getThread ( ) const
inline

Return forksite.

Definition at line 211 of file CxtStmt.h.

212  {
213  return forksite;
214  }

◆ isIncycle()

bool SVF::CxtThread::isIncycle ( ) const
inline

Definition at line 272 of file CxtStmt.h.

273  {
274  return incycle;
275  }

◆ isInloop()

bool SVF::CxtThread::isInloop ( ) const
inline

Definition at line 264 of file CxtStmt.h.

265  {
266  return inloop;
267  }

◆ operator!=()

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

Overloading operator==.

Definition at line 240 of file CxtStmt.h.

241  {
242  return !(*this==rhs);
243  }

◆ operator<()

bool SVF::CxtThread::operator< ( const CxtThread 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 217 of file CxtStmt.h.

218  {
219  if (forksite != rhs.getThread())
220  return forksite < rhs.getThread();
221  else
222  return cxt < rhs.getContext();
223  }

◆ operator=()

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

Overloading operator=.

Definition at line 225 of file CxtStmt.h.

226  {
227  if(*this!=rhs)
228  {
229  forksite = rhs.getThread();
230  cxt = rhs.getContext();
231  }
232  return *this;
233  }

◆ operator==()

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

Overloading operator==.

Definition at line 235 of file CxtStmt.h.

236  {
237  return (forksite == rhs.getThread() && cxt == rhs.getContext());
238  }

◆ setIncycle()

void SVF::CxtThread::setIncycle ( bool  in)
inline

Definition at line 268 of file CxtStmt.h.

269  {
270  incycle = in;
271  }

◆ setInloop()

void SVF::CxtThread::setInloop ( bool  in)
inline

inloop, incycle attributes

Definition at line 260 of file CxtStmt.h.

261  {
262  inloop = in;
263  }

Member Data Documentation

◆ cxt

CallStrCxt SVF::CxtThread::cxt
protected

Definition at line 297 of file CxtStmt.h.

◆ forksite

const ICFGNode* SVF::CxtThread::forksite
protected

Definition at line 298 of file CxtStmt.h.

◆ incycle

bool SVF::CxtThread::incycle
protected

Definition at line 300 of file CxtStmt.h.

◆ inloop

bool SVF::CxtThread::inloop
protected

Definition at line 299 of file CxtStmt.h.


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