clang API Documentation
A class responsible for cleaning up unused symbols. More...
#include <SymbolManager.h>
Public Types | |
typedef SymbolSetTy::const_iterator | dead_iterator |
typedef RegionSetTy::const_iterator | region_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. | |
~SymbolReaper () | |
const LocationContext * | getLocationContext () 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. | |
void | markInUse (SymbolRef sym) |
Marks a symbol as important to a checker. | |
bool | maybeDead (SymbolRef sym) |
If a symbol is known to be live, marks the symbol as live. | |
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. | |
void | markLive (const MemRegion *region) |
void | setReapedStore (StoreRef st) |
Set to the value of the symbolic store after StoreManager::removeDeadBindings has been called. |
A class responsible for cleaning up unused symbols.
Definition at line 557 of file SymbolManager.h.
typedef SymbolSetTy::const_iterator clang::ento::SymbolReaper::dead_iterator |
Definition at line 623 of file SymbolManager.h.
typedef RegionSetTy::const_iterator clang::ento::SymbolReaper::region_iterator |
Definition at line 631 of file SymbolManager.h.
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 587 of file SymbolManager.h.
clang::ento::SymbolReaper::~SymbolReaper | ( | ) | [inline] |
Definition at line 592 of file SymbolManager.h.
dead_iterator clang::ento::SymbolReaper::dead_begin | ( | ) | const [inline] |
Definition at line 624 of file SymbolManager.h.
dead_iterator clang::ento::SymbolReaper::dead_end | ( | ) | const [inline] |
Definition at line 625 of file SymbolManager.h.
const LocationContext* clang::ento::SymbolReaper::getLocationContext | ( | ) | const [inline] |
Definition at line 594 of file SymbolManager.h.
bool clang::ento::SymbolReaper::hasDeadSymbols | ( | ) | const [inline] |
Definition at line 627 of file SymbolManager.h.
Referenced by clang::ento::ExprEngine::removeDead().
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 639 of file SymbolManager.h.
bool SymbolReaper::isLive | ( | SymbolRef | sym | ) |
Definition at line 440 of file SymbolManager.cpp.
References clang::ento::SymExpr::CastSymbolKind, clang::ento::SymExpr::ConjuredKind, clang::ento::SymExpr::DerivedKind, clang::ento::SymExpr::ExtentKind, clang::ento::SymExpr::getKind(), clang::ento::SymExpr::IntSymKind, clang::ento::SymExpr::MetadataKind, clang::ento::SymExpr::RegionValueKind, clang::ento::SymExpr::SymIntKind, and clang::ento::SymExpr::SymSymKind.
Referenced by clang::ento::EnvironmentManager::removeDeadBindings().
bool SymbolReaper::isLive | ( | const Stmt * | ExprVal, |
const LocationContext * | LCtx | ||
) | const |
Definition at line 489 of file SymbolManager.cpp.
bool SymbolReaper::isLive | ( | const VarRegion * | VR, |
bool | includeStoreBindings = false |
||
) | const |
Definition at line 508 of file SymbolManager.cpp.
References clang::LocationContext::getCurrentStackFrame(), clang::ento::VarRegion::getDecl(), clang::ento::VarRegion::getStackFrame(), clang::LiveVariables::isLive(), and clang::LocationContext::isParentOf().
bool SymbolReaper::isLiveRegion | ( | const MemRegion * | region | ) |
Definition at line 409 of file SymbolManager.cpp.
References clang::ento::MemRegion::getBaseRegion().
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 396 of file SymbolManager.cpp.
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 386 of file SymbolManager.cpp.
Referenced by clang::ento::EnvironmentManager::removeDeadBindings().
void SymbolReaper::markLive | ( | const MemRegion * | region | ) |
Definition at line 392 of file SymbolManager.cpp.
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 401 of file SymbolManager.cpp.
Referenced by clang::ento::EnvironmentManager::removeDeadBindings().
region_iterator clang::ento::SymbolReaper::region_begin | ( | ) | const [inline] |
Definition at line 632 of file SymbolManager.h.
region_iterator clang::ento::SymbolReaper::region_end | ( | ) | const [inline] |
Definition at line 633 of file SymbolManager.h.
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 647 of file SymbolManager.h.
Referenced by clang::ento::ProgramStateManager::removeDeadBindings().