clang
7.0.0
|
ProgramState - This class encapsulates: More...
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
Public Types | |
typedef llvm::ImmutableSet< llvm::APSInt * > | IntSetTy |
typedef llvm::ImmutableMap< void *, void * > | GenericDataMap |
Public Member Functions | |
ProgramState (ProgramStateManager *mgr, const Environment &env, StoreRef st, GenericDataMap gdm) | |
This ctor is used when creating the first ProgramState object. More... | |
ProgramState (const ProgramState &RHS) | |
Copy ctor - We must explicitly define this or else the "Next" ptr in FoldingSetNode will also get copied. More... | |
~ProgramState () | |
ProgramStateManager & | getStateManager () const |
Return the ProgramStateManager associated with this state. More... | |
AnalysisManager & | getAnalysisManager () const |
ConstraintManager & | getConstraintManager () const |
Return the ConstraintManager. More... | |
const Environment & | getEnvironment () const |
getEnvironment - Return the environment associated with this state. More... | |
Store | getStore () const |
Return the store associated with this state. More... | |
GenericDataMap | getGDM () const |
getGDM - Return the generic data map associated with this state. More... | |
void | setGDM (GenericDataMap gdm) |
void | Profile (llvm::FoldingSetNodeID &ID) const |
Profile - Used to profile the contents of this object for inclusion in a FoldingSet. More... | |
BasicValueFactory & | getBasicVals () const |
SymbolManager & | getSymbolManager () const |
LLVM_NODISCARD ProgramStateRef | assume (DefinedOrUnknownSVal cond, bool assumption) const |
Assumes that the value of cond is zero (if assumption is "false") or non-zero (if assumption is "true"). More... | |
LLVM_NODISCARD std::pair< ProgramStateRef, ProgramStateRef > | assume (DefinedOrUnknownSVal cond) const |
Assumes both "true" and "false" for cond , and returns both corresponding states (respectively). More... | |
LLVM_NODISCARD ProgramStateRef | assumeInBound (DefinedOrUnknownSVal idx, DefinedOrUnknownSVal upperBound, bool assumption, QualType IndexType=QualType()) const |
LLVM_NODISCARD ProgramStateRef | assumeInclusiveRange (DefinedOrUnknownSVal Val, const llvm::APSInt &From, const llvm::APSInt &To, bool assumption) const |
Assumes that the value of Val is bounded with [From ; To ] (if assumption is "true") or it is fully out of this range (if assumption is "false"). More... | |
LLVM_NODISCARD std::pair< ProgramStateRef, ProgramStateRef > | assumeInclusiveRange (DefinedOrUnknownSVal Val, const llvm::APSInt &From, const llvm::APSInt &To) const |
Assumes given range both "true" and "false" for Val , and returns both corresponding states (respectively). More... | |
ConditionTruthVal | isNonNull (SVal V) const |
Check if the given SVal is not constrained to zero and is not a zero constant. More... | |
ConditionTruthVal | isNull (SVal V) const |
Check if the given SVal is constrained to zero or is a zero constant. More... | |
ConditionTruthVal | areEqual (SVal Lhs, SVal Rhs) const |
const VarRegion * | getRegion (const VarDecl *D, const LocationContext *LC) const |
Utility method for getting regions. More... | |
LLVM_NODISCARD ProgramStateRef | BindExpr (const Stmt *S, const LocationContext *LCtx, SVal V, bool Invalidate=true) const |
Create a new state by binding the value 'V' to the statement 'S' in the state's environment. More... | |
LLVM_NODISCARD ProgramStateRef | bindLoc (Loc location, SVal V, const LocationContext *LCtx, bool notifyChanges=true) const |
LLVM_NODISCARD ProgramStateRef | bindLoc (SVal location, SVal V, const LocationContext *LCtx) const |
LLVM_NODISCARD ProgramStateRef | bindDefaultInitial (SVal loc, SVal V, const LocationContext *LCtx) const |
Initializes the region of memory represented by loc with an initial value. More... | |
LLVM_NODISCARD ProgramStateRef | bindDefaultZero (SVal loc, const LocationContext *LCtx) const |
Performs C++ zero-initialization procedure on the region of memory represented by loc . More... | |
LLVM_NODISCARD ProgramStateRef | killBinding (Loc LV) const |
LLVM_NODISCARD ProgramStateRef | invalidateRegions (ArrayRef< const MemRegion *> Regions, const Expr *E, unsigned BlockCount, const LocationContext *LCtx, bool CausesPointerEscape, InvalidatedSymbols *IS=nullptr, const CallEvent *Call=nullptr, RegionAndSymbolInvalidationTraits *ITraits=nullptr) const |
Returns the state with bindings for the given regions cleared from the store. More... | |
LLVM_NODISCARD ProgramStateRef | invalidateRegions (ArrayRef< SVal > Regions, const Expr *E, unsigned BlockCount, const LocationContext *LCtx, bool CausesPointerEscape, InvalidatedSymbols *IS=nullptr, const CallEvent *Call=nullptr, RegionAndSymbolInvalidationTraits *ITraits=nullptr) const |
LLVM_NODISCARD ProgramStateRef | enterStackFrame (const CallEvent &Call, const StackFrameContext *CalleeCtx) const |
enterStackFrame - Returns the state for entry to the given stack frame, preserving the current state. More... | |
Loc | getLValue (const CXXBaseSpecifier &BaseSpec, const SubRegion *Super) const |
Get the lvalue for a base class object reference. More... | |
Loc | getLValue (const CXXRecordDecl *BaseClass, const SubRegion *Super, bool IsVirtual) const |
Get the lvalue for a base class object reference. More... | |
Loc | getLValue (const VarDecl *D, const LocationContext *LC) const |
Get the lvalue for a variable reference. More... | |
Loc | getLValue (const CompoundLiteralExpr *literal, const LocationContext *LC) const |
SVal | getLValue (const ObjCIvarDecl *decl, SVal base) const |
Get the lvalue for an ivar reference. More... | |
SVal | getLValue (const FieldDecl *decl, SVal Base) const |
Get the lvalue for a field reference. More... | |
SVal | getLValue (const IndirectFieldDecl *decl, SVal Base) const |
Get the lvalue for an indirect field reference. More... | |
SVal | getLValue (QualType ElementType, SVal Idx, SVal Base) const |
Get the lvalue for an array index. More... | |
SVal | getSVal (const Stmt *S, const LocationContext *LCtx) const |
Returns the SVal bound to the statement 'S' in the state's environment. More... | |
SVal | getSValAsScalarOrLoc (const Stmt *Ex, const LocationContext *LCtx) const |
SVal | getSVal (Loc LV, QualType T=QualType()) const |
Return the value bound to the specified location. More... | |
SVal | getRawSVal (Loc LV, QualType T=QualType()) const |
Returns the "raw" SVal bound to LV before any value simplfication. More... | |
SVal | getSVal (const MemRegion *R, QualType T=QualType()) const |
Return the value bound to the specified location. More... | |
SVal | getSValAsScalarOrLoc (const MemRegion *R) const |
Return the value bound to the specified location, assuming that the value is a scalar integer or an enumeration or a pointer. More... | |
bool | scanReachableSymbols (SVal val, SymbolVisitor &visitor) const |
Visits the symbols reachable from the given SVal using the provided SymbolVisitor. More... | |
bool | scanReachableSymbols (const SVal *I, const SVal *E, SymbolVisitor &visitor) const |
Visits the symbols reachable from the SVals in the given range using the provided SymbolVisitor. More... | |
bool | scanReachableSymbols (const MemRegion *const *I, const MemRegion *const *E, SymbolVisitor &visitor) const |
Visits the symbols reachable from the regions in the given MemRegions range using the provided SymbolVisitor. More... | |
template<typename CB > | |
CB | scanReachableSymbols (SVal val) const |
template<typename CB > | |
CB | scanReachableSymbols (const SVal *beg, const SVal *end) const |
template<typename CB > | |
CB | scanReachableSymbols (const MemRegion *const *beg, const MemRegion *const *end) const |
LLVM_NODISCARD ProgramStateRef | addTaint (const Stmt *S, const LocationContext *LCtx, TaintTagType Kind=TaintTagGeneric) const |
Create a new state in which the statement is marked as tainted. More... | |
LLVM_NODISCARD ProgramStateRef | addTaint (SVal V, TaintTagType Kind=TaintTagGeneric) const |
Create a new state in which the value is marked as tainted. More... | |
LLVM_NODISCARD ProgramStateRef | addTaint (SymbolRef S, TaintTagType Kind=TaintTagGeneric) const |
Create a new state in which the symbol is marked as tainted. More... | |
LLVM_NODISCARD ProgramStateRef | addTaint (const MemRegion *R, TaintTagType Kind=TaintTagGeneric) const |
Create a new state in which the region symbol is marked as tainted. More... | |
LLVM_NODISCARD ProgramStateRef | addPartialTaint (SymbolRef ParentSym, const SubRegion *SubRegion, TaintTagType Kind=TaintTagGeneric) const |
Create a new state in a which a sub-region of a given symbol is tainted. More... | |
bool | isTainted (const Stmt *S, const LocationContext *LCtx, TaintTagType Kind=TaintTagGeneric) const |
Check if the statement is tainted in the current state. More... | |
bool | isTainted (SVal V, TaintTagType Kind=TaintTagGeneric) const |
bool | isTainted (SymbolRef Sym, TaintTagType Kind=TaintTagGeneric) const |
bool | isTainted (const MemRegion *Reg, TaintTagType Kind=TaintTagGeneric) const |
void *const * | FindGDM (void *K) const |
template<typename T > | |
LLVM_NODISCARD ProgramStateRef | add (typename ProgramStateTrait< T >::key_type K) const |
template<typename T > | |
ProgramStateTrait< T >::data_type | get () const |
template<typename T > | |
ProgramStateTrait< T >::lookup_type | get (typename ProgramStateTrait< T >::key_type key) const |
template<typename T > | |
ProgramStateTrait< T >::context_type | get_context () const |
template<typename T > | |
LLVM_NODISCARD ProgramStateRef | remove (typename ProgramStateTrait< T >::key_type K) const |
template<typename T > | |
LLVM_NODISCARD ProgramStateRef | remove (typename ProgramStateTrait< T >::key_type K, typename ProgramStateTrait< T >::context_type C) const |
template<typename T > | |
LLVM_NODISCARD ProgramStateRef | remove () const |
template<typename T > | |
LLVM_NODISCARD ProgramStateRef | set (typename ProgramStateTrait< T >::data_type D) const |
template<typename T > | |
LLVM_NODISCARD ProgramStateRef | set (typename ProgramStateTrait< T >::key_type K, typename ProgramStateTrait< T >::value_type E) const |
template<typename T > | |
LLVM_NODISCARD ProgramStateRef | set (typename ProgramStateTrait< T >::key_type K, typename ProgramStateTrait< T >::value_type E, typename ProgramStateTrait< T >::context_type C) const |
template<typename T > | |
bool | contains (typename ProgramStateTrait< T >::key_type key) const |
void | print (raw_ostream &Out, const char *nl="\, const char *sep="", const LocationContext *CurrentLC=nullptr) const |
void | printDOT (raw_ostream &Out, const LocationContext *CurrentLC=nullptr) const |
void | printTaint (raw_ostream &Out, const char *nl="\, const char *sep="") const |
void | dump () const |
void | dumpTaint () const |
template<typename T > | |
ProgramStateRef | add (typename ProgramStateTrait< T >::key_type K) const |
template<typename T > | |
ProgramStateRef | remove (typename ProgramStateTrait< T >::key_type K) const |
template<typename T > | |
ProgramStateRef | remove (typename ProgramStateTrait< T >::key_type K, typename ProgramStateTrait< T >::context_type C) const |
template<typename T > | |
ProgramStateRef | remove () const |
template<typename T > | |
ProgramStateRef | set (typename ProgramStateTrait< T >::data_type D) const |
template<typename T > | |
ProgramStateRef | set (typename ProgramStateTrait< T >::key_type K, typename ProgramStateTrait< T >::value_type E) const |
template<typename T > | |
ProgramStateRef | set (typename ProgramStateTrait< T >::key_type K, typename ProgramStateTrait< T >::value_type E, typename ProgramStateTrait< T >::context_type C) const |
Static Public Member Functions | |
static void | Profile (llvm::FoldingSetNodeID &ID, const ProgramState *V) |
Profile - Profile the contents of a ProgramState object for use in a FoldingSet. More... | |
Friends | |
class | ProgramStateManager |
class | ExplodedGraph |
class | ExplodedNode |
void | ProgramStateRetain (const ProgramState *state) |
Increments the number of times this state is referenced. More... | |
void | ProgramStateRelease (const ProgramState *state) |
Decrement the number of times this state is referenced. More... | |
ProgramState - This class encapsulates:
Together these represent the "abstract state" of a program.
ProgramState is intended to be used as a functional object; that is, once it is created and made "persistent" in a FoldingSet, its values will never change.
Definition at line 75 of file ProgramState.h.
typedef llvm::ImmutableMap<void*, void*> clang::ento::ProgramState::GenericDataMap |
Definition at line 78 of file ProgramState.h.
typedef llvm::ImmutableSet<llvm::APSInt*> clang::ento::ProgramState::IntSetTy |
Definition at line 77 of file ProgramState.h.
ProgramState::ProgramState | ( | ProgramStateManager * | mgr, |
const Environment & | env, | ||
StoreRef | st, | ||
GenericDataMap | gdm | ||
) |
This ctor is used when creating the first ProgramState object.
Definition at line 47 of file ProgramState.cpp.
References clang::ento::ProgramStateManager::getStoreManager(), and clang::ento::StoreManager::incrementReferenceCount().
ProgramState::ProgramState | ( | const ProgramState & | RHS | ) |
Copy ctor - We must explicitly define this or else the "Next" ptr in FoldingSetNode will also get copied.
Definition at line 57 of file ProgramState.cpp.
References clang::ento::ProgramStateManager::getStoreManager(), and clang::ento::StoreManager::incrementReferenceCount().
ProgramState::~ProgramState | ( | ) |
Definition at line 67 of file ProgramState.cpp.
References clang::ento::StoreManager::decrementReferenceCount(), and clang::ento::ProgramStateManager::getStoreManager().
Referenced by clang::ento::ProgramStateRelease().
LLVM_NODISCARD ProgramStateRef clang::ento::ProgramState::add | ( | typename ProgramStateTrait< T >::key_type | K | ) | const |
ProgramStateRef clang::ento::ProgramState::add | ( | typename ProgramStateTrait< T >::key_type | K | ) | const |
Definition at line 834 of file ProgramState.h.
ProgramStateRef ProgramState::addPartialTaint | ( | SymbolRef | ParentSym, |
const SubRegion * | SubRegion, | ||
TaintTagType | Kind = TaintTagGeneric |
||
) | const |
Create a new state in a which a sub-region of a given symbol is tainted.
This might be necessary when referring to regions that can not have an individual symbol, e.g. if they are represented by the default binding of a LazyCompoundVal.
Definition at line 730 of file ProgramState.cpp.
References clang::ento::MemRegion::getBaseRegion().
ProgramStateRef ProgramState::addTaint | ( | const Stmt * | S, |
const LocationContext * | LCtx, | ||
TaintTagType | Kind = TaintTagGeneric |
||
) | const |
Create a new state in which the statement is marked as tainted.
Definition at line 676 of file ProgramState.cpp.
ProgramStateRef ProgramState::addTaint | ( | SVal | V, |
TaintTagType | Kind = TaintTagGeneric |
||
) | const |
Create a new state in which the value is marked as tainted.
Definition at line 685 of file ProgramState.cpp.
References clang::ento::SVal::getAs(), clang::ento::SVal::getAsRegion(), and clang::ento::SVal::getAsSymbol().
ProgramStateRef ProgramState::addTaint | ( | SymbolRef | S, |
TaintTagType | Kind = TaintTagGeneric |
||
) | const |
Create a new state in which the symbol is marked as tainted.
Definition at line 718 of file ProgramState.cpp.
ProgramStateRef ProgramState::addTaint | ( | const MemRegion * | R, |
TaintTagType | Kind = TaintTagGeneric |
||
) | const |
Create a new state in which the region symbol is marked as tainted.
Definition at line 711 of file ProgramState.cpp.
ConditionTruthVal ProgramState::areEqual | ( | SVal | Lhs, |
SVal | Rhs | ||
) | const |
Lhs
and Rhs
are equal. Definition at line 376 of file ProgramState.cpp.
|
inline |
Assumes that the value of cond
is zero (if assumption
is "false") or non-zero (if assumption
is "true").
This returns a new state with the added constraint on cond
. If no new state is feasible, NULL is returned.
Definition at line 697 of file ProgramState.h.
References clang::ento::SVal::castAs(), and clang::ento::SVal::isUnknown().
|
inline |
Assumes both "true" and "false" for cond
, and returns both corresponding states (respectively).
This is more efficient than calling assume() twice. Note that one (but not both) of the returned states may be NULL.
Definition at line 707 of file ProgramState.h.
References clang::ento::SVal::castAs(), and clang::ento::SVal::isUnknown().
ProgramStateRef ProgramState::assumeInBound | ( | DefinedOrUnknownSVal | idx, |
DefinedOrUnknownSVal | upperBound, | ||
bool | assumption, | ||
QualType | IndexType = QualType() |
||
) | const |
Definition at line 324 of file ProgramState.cpp.
References clang::ento::ConstraintManager::assume(), clang::ento::SVal::castAs(), clang::ento::SValBuilder::evalBinOpNN(), clang::ento::SValBuilder::getArrayIndexType(), clang::ento::SValBuilder::getBasicValueFactory(), clang::ento::ProgramStateManager::getConstraintManager(), clang::ento::SValBuilder::getContext(), clang::ento::BasicValueFactory::getMinValue(), clang::ento::ProgramStateManager::getSValBuilder(), clang::ASTContext::IntTy, clang::QualType::isNull(), clang::ento::SVal::isUnknown(), clang::ento::SVal::isUnknownOrUndef(), and SM.
|
inline |
Assumes that the value of Val
is bounded with [From
; To
] (if assumption
is "true") or it is fully out of this range (if assumption
is "false").
This returns a new state with the added constraint on cond
. If no new state is feasible, NULL is returned.
Definition at line 715 of file ProgramState.h.
References clang::ento::SVal::castAs(), clang::ento::SVal::getAs(), and clang::ento::SVal::isUnknown().
|
inline |
Assumes given range both "true" and "false" for Val
, and returns both corresponding states (respectively).
This is more efficient than calling assume() twice. Note that one (but not both) of the returned states may be NULL.
Definition at line 728 of file ProgramState.h.
References clang::ento::SVal::castAs(), clang::ento::SVal::getAs(), and clang::ento::SVal::isUnknown().
ProgramStateRef ProgramState::bindDefaultInitial | ( | SVal | loc, |
SVal | V, | ||
const LocationContext * | LCtx | ||
) | const |
Initializes the region of memory represented by loc
with an initial value.
Once initialized, all values loaded from any sub-regions of that region will be equal to V
, unless overwritten later by the program. This method should not be used on regions that are already initialized. If you need to indicate that memory contents have suddenly become unknown within a certain region of memory, consider invalidateRegions().
Definition at line 131 of file ProgramState.cpp.
References clang::ento::SVal::castAs(), clang::ento::ProgramStateManager::getOwningEngine(), and clang::ento::SubEngine::processRegionChange().
ProgramStateRef ProgramState::bindDefaultZero | ( | SVal | loc, |
const LocationContext * | LCtx | ||
) | const |
Performs C++ zero-initialization procedure on the region of memory represented by loc
.
Definition at line 143 of file ProgramState.cpp.
References clang::ento::SVal::castAs(), clang::ento::ProgramStateManager::getOwningEngine(), and clang::ento::SubEngine::processRegionChange().
ProgramStateRef ProgramState::BindExpr | ( | const Stmt * | S, |
const LocationContext * | LCtx, | ||
SVal | V, | ||
bool | Invalidate = true |
||
) | const |
Create a new state by binding the value 'V' to the statement 'S' in the state's environment.
Definition at line 310 of file ProgramState.cpp.
ProgramStateRef ProgramState::bindLoc | ( | Loc | location, |
SVal | V, | ||
const LocationContext * | LCtx, | ||
bool | notifyChanges = true |
||
) | const |
Definition at line 116 of file ProgramState.cpp.
References clang::ento::SVal::getAsRegion(), clang::ento::ProgramStateManager::getOwningEngine(), and clang::ento::SubEngine::processRegionChange().
|
inline |
Definition at line 740 of file ProgramState.h.
References clang::ento::SVal::getAs().
|
inline |
Definition at line 462 of file ProgramState.h.
References dump(), clang::ento::ProgramStateRelease(), clang::ento::ProgramStateRetain(), and clang::CodeGen::state.
LLVM_DUMP_METHOD void ProgramState::dump | ( | ) | const |
Definition at line 478 of file ProgramState.cpp.
void ProgramState::dumpTaint | ( | ) | const |
Definition at line 494 of file ProgramState.cpp.
ProgramStateRef ProgramState::enterStackFrame | ( | const CallEvent & | Call, |
const StackFrameContext * | CalleeCtx | ||
) | const |
enterStackFrame - Returns the state for entry to the given stack frame, preserving the current state.
Definition at line 246 of file ProgramState.cpp.
void *const * ProgramState::FindGDM | ( | void * | K | ) | const |
Definition at line 506 of file ProgramState.cpp.
|
inline |
Definition at line 421 of file ProgramState.h.
|
inline |
Definition at line 427 of file ProgramState.h.
References AttributeLangSupport::C.
ProgramStateTrait< T >::context_type clang::ento::ProgramState::get_context | ( | ) | const |
Definition at line 839 of file ProgramState.h.
AnalysisManager & ProgramState::getAnalysisManager | ( | ) | const |
Definition at line 498 of file ProgramState.cpp.
|
inline |
Definition at line 825 of file ProgramState.h.
|
inline |
Return the ConstraintManager.
Definition at line 687 of file ProgramState.h.
|
inline |
getEnvironment - Return the environment associated with this state.
The environment is the mapping from expressions to values.
Definition at line 122 of file ProgramState.h.
|
inline |
getGDM - Return the generic data map associated with this state.
Definition at line 130 of file ProgramState.h.
|
inline |
Get the lvalue for a base class object reference.
Definition at line 746 of file ProgramState.h.
References clang::Type::getAsCXXRecordDecl(), clang::CXXBaseSpecifier::getType(), and clang::CXXBaseSpecifier::isVirtual().
Referenced by reversePropagateInterestingSymbols().
|
inline |
Get the lvalue for a base class object reference.
Definition at line 754 of file ProgramState.h.
|
inline |
Get the lvalue for a variable reference.
Definition at line 762 of file ProgramState.h.
|
inline |
Definition at line 767 of file ProgramState.h.
|
inline |
Get the lvalue for an ivar reference.
Definition at line 772 of file ProgramState.h.
Get the lvalue for a field reference.
Definition at line 776 of file ProgramState.h.
|
inline |
Get the lvalue for an indirect field reference.
Definition at line 780 of file ProgramState.h.
References SM.
|
inline |
Get the lvalue for an array index.
Definition at line 790 of file ProgramState.h.
References clang::ento::SVal::getAs().
Returns the "raw" SVal bound to LV before any value simplfication.
Definition at line 815 of file ProgramState.h.
Referenced by reversePropagateInterestingSymbols().
|
inline |
Utility method for getting regions.
Definition at line 691 of file ProgramState.h.
|
inline |
Return the ProgramStateManager associated with this state.
Definition at line 111 of file ProgramState.h.
Referenced by clang::ento::ProgramStateRelease().
|
inline |
Return the store associated with this state.
The store is a mapping from locations to values.
Definition at line 126 of file ProgramState.h.
Referenced by clang::ento::ProgramStateManager::removeDeadBindings().
|
inline |
Returns the SVal bound to the statement 'S' in the state's environment.
Definition at line 796 of file ProgramState.h.
Referenced by reversePropagateIntererstingSymbols().
Return the value bound to the specified location.
Returns UnknownVal() if none found.
Definition at line 269 of file ProgramState.cpp.
References clang::ento::BasicValueFactory::Convert(), clang::ento::SVal::getAs(), clang::ento::SVal::getAsSymbol(), clang::ento::ProgramStateManager::getBasicVals(), clang::Type::isIntegralOrEnumerationType(), clang::ento::Loc::isLocType(), and clang::QualType::isNull().
|
inline |
Return the value bound to the specified location.
Returns UnknownVal() if none found.
Definition at line 819 of file ProgramState.h.
|
inline |
Definition at line 803 of file ProgramState.h.
Return the value bound to the specified location, assuming that the value is a scalar integer or an enumeration or a pointer.
Returns UnknownVal() if none found or the region is not known to hold a value of such type.
Definition at line 253 of file ProgramState.cpp.
References clang::ento::MemRegion::isBoundable(), clang::Type::isIntegralOrEnumerationType(), and clang::ento::Loc::isLocType().
|
inline |
Definition at line 829 of file ProgramState.h.
LLVM_NODISCARD ProgramStateRef clang::ento::ProgramState::invalidateRegions | ( | ArrayRef< const MemRegion *> | Regions, |
const Expr * | E, | ||
unsigned | BlockCount, | ||
const LocationContext * | LCtx, | ||
bool | CausesPointerEscape, | ||
InvalidatedSymbols * | IS = nullptr , |
||
const CallEvent * | Call = nullptr , |
||
RegionAndSymbolInvalidationTraits * | ITraits = nullptr |
||
) | const |
Returns the state with bindings for the given regions cleared from the store.
Optionally invalidates global regions as well.
Regions | the set of regions to be invalidated. |
E | the expression that caused the invalidation. |
BlockCount | The number of times the current basic block has been |
CausesPointerEscape | the flag is set to true when the invalidation entails escape of a symbol (representing a pointer). For example, due to it being passed as an argument in a call. |
IS | the set of invalidated symbols. |
Call | if non-null, the invalidated regions represent parameters to the call and should be considered directly invalidated. |
ITraits | information about special handling for a particular region/symbol. |
LLVM_NODISCARD ProgramStateRef clang::ento::ProgramState::invalidateRegions | ( | ArrayRef< SVal > | Regions, |
const Expr * | E, | ||
unsigned | BlockCount, | ||
const LocationContext * | LCtx, | ||
bool | CausesPointerEscape, | ||
InvalidatedSymbols * | IS = nullptr , |
||
const CallEvent * | Call = nullptr , |
||
RegionAndSymbolInvalidationTraits * | ITraits = nullptr |
||
) | const |
ConditionTruthVal ProgramState::isNonNull | ( | SVal | V | ) | const |
Check if the given SVal is not constrained to zero and is not a zero constant.
Definition at line 369 of file ProgramState.cpp.
References clang::ento::ConditionTruthVal::getValue(), and clang::ento::ConditionTruthVal::isUnderconstrained().
ConditionTruthVal ProgramState::isNull | ( | SVal | V | ) | const |
Check if the given SVal is constrained to zero or is a zero constant.
Definition at line 380 of file ProgramState.cpp.
References clang::ento::SVal::getAsSymbol(), clang::ento::SVal::isConstant(), and clang::ento::SVal::isZeroConstant().
bool ProgramState::isTainted | ( | const Stmt * | S, |
const LocationContext * | LCtx, | ||
TaintTagType | Kind = TaintTagGeneric |
||
) | const |
Check if the statement is tainted in the current state.
Definition at line 751 of file ProgramState.cpp.
bool ProgramState::isTainted | ( | SVal | V, |
TaintTagType | Kind = TaintTagGeneric |
||
) | const |
Definition at line 760 of file ProgramState.cpp.
References clang::ento::SVal::getAsRegion(), and clang::ento::SVal::getAsSymExpr().
bool ProgramState::isTainted | ( | SymbolRef | Sym, |
TaintTagType | Kind = TaintTagGeneric |
||
) | const |
Definition at line 786 of file ProgramState.cpp.
References clang::ento::SymExpr::symbol_begin(), and clang::ento::SymExpr::symbol_end().
bool ProgramState::isTainted | ( | const MemRegion * | Reg, |
TaintTagType | Kind = TaintTagGeneric |
||
) | const |
Definition at line 768 of file ProgramState.cpp.
ProgramStateRef ProgramState::killBinding | ( | Loc | LV | ) | const |
Definition at line 232 of file ProgramState.cpp.
References clang::ento::SVal::getAs(), and clang::ento::StoreRef::getStore().
void ProgramState::print | ( | raw_ostream & | Out, |
const char * | nl = "\n" , |
||
const char * | sep = "" , |
||
const LocationContext * | CurrentLC = nullptr |
||
) | const |
Definition at line 452 of file ProgramState.cpp.
References clang::ento::ProgramStateManager::getConstraintManager(), clang::ento::ProgramStateManager::getOwningEngine(), clang::ento::ProgramStateManager::getStoreManager(), clang::ento::ConstraintManager::print(), clang::ento::StoreManager::print(), clang::ento::printDynamicTypeInfo(), and clang::ento::SubEngine::printState().
void ProgramState::printDOT | ( | raw_ostream & | Out, |
const LocationContext * | CurrentLC = nullptr |
||
) | const |
Definition at line 474 of file ProgramState.cpp.
void ProgramState::printTaint | ( | raw_ostream & | Out, |
const char * | nl = "\n" , |
||
const char * | sep = "" |
||
) | const |
Definition at line 482 of file ProgramState.cpp.
|
inlinestatic |
Profile - Profile the contents of a ProgramState object for use in a FoldingSet.
Two ProgramState objects are considered equal if they have the same Environment, Store, and GenericDataMap.
Definition at line 137 of file ProgramState.h.
References clang::ento::Environment::Profile().
Referenced by clang::ento::ProgramStateManager::getPersistentState().
|
inline |
Profile - Used to profile the contents of this object for inclusion in a FoldingSet.
Definition at line 145 of file ProgramState.h.
LLVM_NODISCARD ProgramStateRef clang::ento::ProgramState::remove | ( | typename ProgramStateTrait< T >::key_type | K | ) | const |
LLVM_NODISCARD ProgramStateRef clang::ento::ProgramState::remove | ( | typename ProgramStateTrait< T >::key_type | K, |
typename ProgramStateTrait< T >::context_type | C | ||
) | const |
LLVM_NODISCARD ProgramStateRef clang::ento::ProgramState::remove | ( | ) | const |
ProgramStateRef clang::ento::ProgramState::remove | ( | typename ProgramStateTrait< T >::key_type | K | ) | const |
Definition at line 844 of file ProgramState.h.
ProgramStateRef clang::ento::ProgramState::remove | ( | typename ProgramStateTrait< T >::key_type | K, |
typename ProgramStateTrait< T >::context_type | C | ||
) | const |
Definition at line 849 of file ProgramState.h.
References AttributeLangSupport::C.
ProgramStateRef clang::ento::ProgramState::remove | ( | ) | const |
Definition at line 855 of file ProgramState.h.
bool ProgramState::scanReachableSymbols | ( | SVal | val, |
SymbolVisitor & | visitor | ||
) | const |
Visits the symbols reachable from the given SVal using the provided SymbolVisitor.
This is a convenience API. Consider using ScanReachableSymbols class directly when making multiple scans on the same state with the same visitor to avoid repeated initialization cost.
Definition at line 650 of file ProgramState.cpp.
bool ProgramState::scanReachableSymbols | ( | const SVal * | I, |
const SVal * | E, | ||
SymbolVisitor & | visitor | ||
) | const |
Visits the symbols reachable from the SVals in the given range using the provided SymbolVisitor.
Definition at line 655 of file ProgramState.cpp.
bool ProgramState::scanReachableSymbols | ( | const MemRegion *const * | I, |
const MemRegion *const * | E, | ||
SymbolVisitor & | visitor | ||
) | const |
Visits the symbols reachable from the regions in the given MemRegions range using the provided SymbolVisitor.
Definition at line 665 of file ProgramState.cpp.
CB clang::ento::ProgramState::scanReachableSymbols | ( | SVal | val | ) | const |
Definition at line 878 of file ProgramState.h.
CB clang::ento::ProgramState::scanReachableSymbols | ( | const SVal * | beg, |
const SVal * | end | ||
) | const |
Definition at line 885 of file ProgramState.h.
CB clang::ento::ProgramState::scanReachableSymbols | ( | const MemRegion *const * | beg, |
const MemRegion *const * | end | ||
) | const |
Definition at line 892 of file ProgramState.h.
LLVM_NODISCARD ProgramStateRef clang::ento::ProgramState::set | ( | typename ProgramStateTrait< T >::data_type | D | ) | const |
LLVM_NODISCARD ProgramStateRef clang::ento::ProgramState::set | ( | typename ProgramStateTrait< T >::key_type | K, |
typename ProgramStateTrait< T >::value_type | E | ||
) | const |
LLVM_NODISCARD ProgramStateRef clang::ento::ProgramState::set | ( | typename ProgramStateTrait< T >::key_type | K, |
typename ProgramStateTrait< T >::value_type | E, | ||
typename ProgramStateTrait< T >::context_type | C | ||
) | const |
ProgramStateRef clang::ento::ProgramState::set | ( | typename ProgramStateTrait< T >::data_type | D | ) | const |
Definition at line 860 of file ProgramState.h.
ProgramStateRef clang::ento::ProgramState::set | ( | typename ProgramStateTrait< T >::key_type | K, |
typename ProgramStateTrait< T >::value_type | E | ||
) | const |
Definition at line 865 of file ProgramState.h.
ProgramStateRef clang::ento::ProgramState::set | ( | typename ProgramStateTrait< T >::key_type | K, |
typename ProgramStateTrait< T >::value_type | E, | ||
typename ProgramStateTrait< T >::context_type | C | ||
) | const |
Definition at line 871 of file ProgramState.h.
|
inline |
Definition at line 132 of file ProgramState.h.
|
friend |
Definition at line 84 of file ProgramState.h.
|
friend |
Definition at line 85 of file ProgramState.h.
|
friend |
Definition at line 83 of file ProgramState.h.
|
friend |
Decrement the number of times this state is referenced.
Definition at line 35 of file ProgramState.cpp.
|
friend |
Increments the number of times this state is referenced.
Definition at line 30 of file ProgramState.cpp.