clang  8.0.0svn
Public Types | Public Member Functions | List of all members
clang::ento::SymbolReaper Class Reference

A class responsible for cleaning up unused symbols. More...

#include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"

Public Types

using dead_iterator = SymbolSetTy::const_iterator
 
using region_iterator = RegionSetTy::const_iterator
 

Public Member Functions

 SymbolReaper (const StackFrameContext *Ctx, const Stmt *s, SymbolManager &symmgr, StoreManager &storeMgr)
 Construct a reaper object, which removes everything which is not live before we execute statement s in the given location context. More...
 
const LocationContextgetLocationContext () const
 
bool isLive (SymbolRef sym)
 
bool isLiveRegion (const MemRegion *region)
 
bool isLive (const Stmt *ExprVal, const LocationContext *LCtx) const
 
bool isLive (const VarRegion *VR, bool includeStoreBindings=false) const
 
void markLive (SymbolRef sym)
 Unconditionally marks a symbol as live. More...
 
void markInUse (SymbolRef sym)
 Marks a symbol as important to a checker. More...
 
bool maybeDead (SymbolRef sym)
 If a symbol is known to be live, marks the symbol as live. More...
 
dead_iterator dead_begin () const
 
dead_iterator dead_end () const
 
bool hasDeadSymbols () const
 
region_iterator region_begin () const
 
region_iterator region_end () const
 
bool isDead (SymbolRef sym) const
 Returns whether or not a symbol has been confirmed dead. More...
 
void markLive (const MemRegion *region)
 
void markElementIndicesLive (const MemRegion *region)
 
void setReapedStore (StoreRef st)
 Set to the value of the symbolic store after StoreManager::removeDeadBindings has been called. More...
 

Detailed Description

A class responsible for cleaning up unused symbols.

Definition at line 549 of file SymbolManager.h.

Member Typedef Documentation

◆ dead_iterator

using clang::ento::SymbolReaper::dead_iterator = SymbolSetTy::const_iterator

Definition at line 612 of file SymbolManager.h.

◆ region_iterator

using clang::ento::SymbolReaper::region_iterator = RegionSetTy::const_iterator

Definition at line 621 of file SymbolManager.h.

Constructor & Destructor Documentation

◆ SymbolReaper()

clang::ento::SymbolReaper::SymbolReaper ( const StackFrameContext Ctx,
const Stmt s,
SymbolManager symmgr,
StoreManager storeMgr 
)
inline

Construct a reaper object, which removes everything which is not live before we execute statement s in the given location context.

If the statement is NULL, everything is this and parent contexts is considered live. If the stack frame context is NULL, everything on stack is considered dead.

Definition at line 579 of file SymbolManager.h.

Member Function Documentation

◆ dead_begin()

dead_iterator clang::ento::SymbolReaper::dead_begin ( ) const
inline

◆ dead_end()

dead_iterator clang::ento::SymbolReaper::dead_end ( ) const
inline

◆ getLocationContext()

const LocationContext* clang::ento::SymbolReaper::getLocationContext ( ) const
inline

Definition at line 583 of file SymbolManager.h.

◆ hasDeadSymbols()

bool clang::ento::SymbolReaper::hasDeadSymbols ( ) const
inline

◆ isDead()

bool clang::ento::SymbolReaper::isDead ( SymbolRef  sym) const
inline

Returns whether or not a symbol has been confirmed dead.

This should only be called once all marking of dead symbols has completed. (For checkers, this means only in the evalDeadSymbols callback.)

Definition at line 630 of file SymbolManager.h.

◆ isLive() [1/3]

bool SymbolReaper::isLive ( SymbolRef  sym)

◆ isLive() [2/3]

bool clang::ento::SymbolReaper::isLive ( const Stmt ExprVal,
const LocationContext LCtx 
) const

◆ isLive() [3/3]

bool clang::ento::SymbolReaper::isLive ( const VarRegion VR,
bool  includeStoreBindings = false 
) const

◆ isLiveRegion()

bool SymbolReaper::isLiveRegion ( const MemRegion region)

Definition at line 437 of file SymbolManager.cpp.

Referenced by clang::ento::mpi::MPIChecker::checkMissingWaits().

◆ markElementIndicesLive()

void SymbolReaper::markElementIndicesLive ( const MemRegion region)

Definition at line 413 of file SymbolManager.cpp.

◆ markInUse()

void SymbolReaper::markInUse ( SymbolRef  sym)

Marks a symbol as important to a checker.

For metadata symbols, this will keep the symbol alive as long as its associated region is also live. For other symbols, this has no effect; checkers are not permitted to influence the life of other symbols. This should be used before any symbol marking has occurred, i.e. in the MarkLiveSymbols callback.

Definition at line 424 of file SymbolManager.cpp.

◆ markLive() [1/2]

void SymbolReaper::markLive ( SymbolRef  sym)

Unconditionally marks a symbol as live.

This should never be used by checkers, only by the state infrastructure such as the store and environment. Checkers should instead use metadata symbols and markInUse.

Definition at line 402 of file SymbolManager.cpp.

Referenced by clang::ento::ExprEngine::removeDead().

◆ markLive() [2/2]

void SymbolReaper::markLive ( const MemRegion region)

Definition at line 408 of file SymbolManager.cpp.

◆ maybeDead()

bool SymbolReaper::maybeDead ( SymbolRef  sym)

If a symbol is known to be live, marks the symbol as live.

Otherwise, if the symbol cannot be proven live, it is marked as dead. Returns true if the symbol is dead, false if live.

Definition at line 429 of file SymbolManager.cpp.

Referenced by clang::ento::CreateRangeConstraintManager(), clang::ento::EnvironmentManager::removeDeadBindings(), and clang::ento::SMTConstraintManager< ConstraintSMT, SMTExprTy >::removeDeadBindings().

◆ region_begin()

region_iterator clang::ento::SymbolReaper::region_begin ( ) const
inline

Definition at line 623 of file SymbolManager.h.

◆ region_end()

region_iterator clang::ento::SymbolReaper::region_end ( ) const
inline

Definition at line 624 of file SymbolManager.h.

◆ setReapedStore()

void clang::ento::SymbolReaper::setReapedStore ( StoreRef  st)
inline

Set to the value of the symbolic store after StoreManager::removeDeadBindings has been called.

Definition at line 639 of file SymbolManager.h.

Referenced by clang::ento::ProgramStateManager::removeDeadBindings().


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