Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
SVF::ContextCond Class Reference

#include <DPItem.h>

Public Types

typedef CallStrCxt::const_iterator const_iterator
 

Public Member Functions

 ContextCond ()
 Constructor.
 
 ContextCond (const ContextCond &cond)
 Copy Constructor.
 
 ContextCond (ContextCond &&cond) noexcept
 Move Constructor.
 
ContextCondoperator= (ContextCond &&cond) noexcept
 Move operator=.
 
virtual ~ContextCond ()
 Destructor.
 
const CallStrCxtgetContexts () const
 Get context.
 
CallStrCxtgetContexts ()
 Get context.
 
bool isConcreteCxt () const
 Whether it is an concrete context.
 
void setNonConcreteCxt ()
 Whether it is an concrete context.
 
bool containCallStr (NodeID cxt) const
 Whether contains callstring cxt.
 
u32_t cxtSize () const
 Get context size.
 
u32_t getMaxPathLen () const
 
virtual bool pushContext (NodeID ctx)
 Push context.
 
virtual bool matchContext (NodeID ctx)
 Match context.
 
bool operator< (const ContextCond &rhs) const
 
NodeID operator[] (const u32_t index) const
 Overloading operator[].
 
ContextCondoperator= (const ContextCond &rhs)
 Overloading operator=.
 
bool operator== (const ContextCond &rhs) const
 Overloading operator==.
 
bool operator!= (const ContextCond &rhs) const
 Overloading operator!=.
 
const_iterator begin () const
 Begin iterators.
 
const_iterator end () const
 End iterators.
 
std::string toString () const
 Dump context condition.
 

Static Public Member Functions

static void setMaxCxtLen (u32_t max)
 set max context limit
 
static void setMaxPathLen (u32_t max)
 set max path limit
 

Static Public Attributes

static u32_t maximumCxt = 0
 
static u32_t maximumPath = 0
 

Protected Attributes

CallStrCxt context
 
bool concreteCxt
 

Static Protected Attributes

static u32_t maximumCxtLen = 0
 
static u32_t maximumPathLen = 0
 

Detailed Description

Context Condition

Definition at line 207 of file DPItem.h.

Member Typedef Documentation

◆ const_iterator

typedef CallStrCxt::const_iterator SVF::ContextCond::const_iterator

Definition at line 210 of file DPItem.h.

Constructor & Destructor Documentation

◆ ContextCond() [1/3]

SVF::ContextCond::ContextCond ( )
inline

Constructor.

Definition at line 212 of file DPItem.h.

212 :concreteCxt(true)
213 {
214 }

◆ ContextCond() [2/3]

SVF::ContextCond::ContextCond ( const ContextCond cond)
inline

Copy Constructor.

Definition at line 216 of file DPItem.h.

216 : context(cond.getContexts()), concreteCxt(cond.isConcreteCxt())
217 {
218 }
CallStrCxt context
Definition DPItem.h:374

◆ ContextCond() [3/3]

SVF::ContextCond::ContextCond ( ContextCond &&  cond)
inlinenoexcept

Move Constructor.

Definition at line 220 of file DPItem.h.

220: context(std::move(cond.context)), concreteCxt(cond.concreteCxt) {}

◆ ~ContextCond()

virtual SVF::ContextCond::~ContextCond ( )
inlinevirtual

Destructor.

Definition at line 232 of file DPItem.h.

233 {
234 }

Member Function Documentation

◆ begin()

const_iterator SVF::ContextCond::begin ( ) const
inline

Begin iterators.

Definition at line 351 of file DPItem.h.

352 {
353 return context.begin();
354 }

◆ containCallStr()

bool SVF::ContextCond::containCallStr ( NodeID  cxt) const
inline

Whether contains callstring cxt.

Definition at line 256 of file DPItem.h.

257 {
258 return std::find(context.begin(),context.end(),cxt) != context.end();
259 }

◆ cxtSize()

u32_t SVF::ContextCond::cxtSize ( ) const
inline

Get context size.

Definition at line 261 of file DPItem.h.

262 {
263 return context.size();
264 }

◆ end()

const_iterator SVF::ContextCond::end ( ) const
inline

End iterators.

Definition at line 356 of file DPItem.h.

357 {
358 return context.end();
359 }

◆ getContexts() [1/2]

CallStrCxt & SVF::ContextCond::getContexts ( )
inline

Get context.

Definition at line 241 of file DPItem.h.

242 {
243 return context;
244 }

◆ getContexts() [2/2]

const CallStrCxt & SVF::ContextCond::getContexts ( ) const
inline

Get context.

Definition at line 236 of file DPItem.h.

237 {
238 return context;
239 }

◆ getMaxPathLen()

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

Definition at line 275 of file DPItem.h.

276 {
277 return maximumPathLen;
278 }
static u32_t maximumPathLen
Definition DPItem.h:376

◆ isConcreteCxt()

bool SVF::ContextCond::isConcreteCxt ( ) const
inline

Whether it is an concrete context.

Definition at line 246 of file DPItem.h.

247 {
248 return concreteCxt;
249 }

◆ matchContext()

virtual bool SVF::ContextCond::matchContext ( NodeID  ctx)
inlinevirtual

Match context.

if context is empty, then it is the unbalanced parentheses match

otherwise, we perform balanced parentheses matching

Definition at line 304 of file DPItem.h.

305 {
307 if(context.empty())
308 return true;
310 else if(context.back() == ctx)
311 {
312 context.pop_back();
313 return true;
314 }
315 return false;
316 }

◆ operator!=()

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

Overloading operator!=.

Definition at line 346 of file DPItem.h.

347 {
348 return !(*this==rhs);
349 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

◆ operator<()

bool SVF::ContextCond::operator< ( const ContextCond 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 320 of file DPItem.h.

321 {
322 return context < rhs.context;
323 }

◆ operator=() [1/2]

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

Overloading operator=.

Definition at line 331 of file DPItem.h.

332 {
333 if(*this!=rhs)
334 {
335 context = rhs.getContexts();
336 concreteCxt = rhs.isConcreteCxt();
337 }
338 return *this;
339 }

◆ operator=() [2/2]

ContextCond & SVF::ContextCond::operator= ( ContextCond &&  cond)
inlinenoexcept

Move operator=.

Definition at line 222 of file DPItem.h.

223 {
224 if(this!=&cond)
225 {
226 context = std::move(cond.context);
227 concreteCxt = cond.concreteCxt;
228 }
229 return *this;
230 }

◆ operator==()

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

Overloading operator==.

Definition at line 341 of file DPItem.h.

342 {
343 return (context == rhs.getContexts());
344 }

◆ operator[]()

NodeID SVF::ContextCond::operator[] ( const u32_t  index) const
inline

Overloading operator[].

Definition at line 325 of file DPItem.h.

326 {
327 assert(index < context.size());
328 return context[index];
329 }
int index
Definition cJSON.h:170

◆ pushContext()

virtual bool SVF::ContextCond::pushContext ( NodeID  ctx)
inlinevirtual

Push context.

handle out of context limit case

Definition at line 280 of file DPItem.h.

281 {
282
283 if(context.size() < maximumCxtLen)
284 {
285 context.push_back(ctx);
286
287 if(context.size() > maximumCxt)
288 maximumCxt = context.size();
289 return true;
290 }
291 else
292 {
293 if(!context.empty())
294 {
296 context.erase(context.begin());
297 context.push_back(ctx);
298 }
299 return false;
300 }
301 }
static u32_t maximumCxt
Definition DPItem.h:379
static u32_t maximumCxtLen
Definition DPItem.h:375
void setNonConcreteCxt()
Whether it is an concrete context.
Definition DPItem.h:251

◆ setMaxCxtLen()

static void SVF::ContextCond::setMaxCxtLen ( u32_t  max)
inlinestatic

set max context limit

Definition at line 266 of file DPItem.h.

267 {
268 maximumCxtLen = max;
269 }

◆ setMaxPathLen()

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

set max path limit

Definition at line 271 of file DPItem.h.

272 {
273 maximumPathLen = max;
274 }

◆ setNonConcreteCxt()

void SVF::ContextCond::setNonConcreteCxt ( )
inline

Whether it is an concrete context.

Definition at line 251 of file DPItem.h.

252 {
253 concreteCxt = false;
254 }

◆ toString()

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

Dump context condition.

Definition at line 361 of file DPItem.h.

362 {
363 std::string str;
364 std::stringstream rawstr(str);
365 rawstr << "[:";
366 for(CallStrCxt::const_iterator it = context.begin(), eit = context.end(); it!=eit; ++it)
367 {
368 rawstr << *it << " ";
369 }
370 rawstr << " ]";
371 return rawstr.str();
372 }

Member Data Documentation

◆ concreteCxt

bool SVF::ContextCond::concreteCxt
protected

Definition at line 377 of file DPItem.h.

◆ context

CallStrCxt SVF::ContextCond::context
protected

Definition at line 374 of file DPItem.h.

◆ maximumCxt

u32_t ContextCond::maximumCxt = 0
static

Definition at line 379 of file DPItem.h.

◆ maximumCxtLen

u32_t ContextCond::maximumCxtLen = 0
staticprotected

Definition at line 375 of file DPItem.h.

◆ maximumPath

u32_t ContextCond::maximumPath = 0
static

Definition at line 380 of file DPItem.h.

◆ maximumPathLen

u32_t ContextCond::maximumPathLen = 0
staticprotected

Definition at line 376 of file DPItem.h.


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