clang 19.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::ento::ProgramState Class Reference

ProgramState - This class encapsulates: More...

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

Inheritance diagram for clang::ento::ProgramState:
Inheritance graph
[legend]

Public Types

typedef llvm::ImmutableSet< llvm::APSInt * > IntSetTy
 
typedef llvm::ImmutableMap< void *, void * > GenericDataMap
 
using region_iterator = const MemRegion **
 

Public Member Functions

 ProgramState (ProgramStateManager *mgr, const Environment &env, StoreRef st, GenericDataMap gdm)
 This ctor is used when creating the first ProgramState object.
 
 ProgramState (const ProgramState &RHS)
 Copy ctor - We must explicitly define this or else the "Next" ptr in FoldingSetNode will also get copied.
 
 ~ProgramState ()
 
int64_t getID () const
 
ProgramStateManagergetStateManager () const
 Return the ProgramStateManager associated with this state.
 
AnalysisManagergetAnalysisManager () const
 
ConstraintManagergetConstraintManager () const
 Return the ConstraintManager.
 
const EnvironmentgetEnvironment () const
 getEnvironment - Return the environment associated with this state.
 
Store getStore () const
 Return the store associated with this state.
 
GenericDataMap getGDM () const
 getGDM - Return the generic data map associated with this state.
 
void setGDM (GenericDataMap gdm)
 
void Profile (llvm::FoldingSetNodeID &ID) const
 Profile - Used to profile the contents of this object for inclusion in a FoldingSet.
 
BasicValueFactorygetBasicVals () const
 
SymbolManagergetSymbolManager () const
 
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").
 
std::pair< ProgramStateRef, ProgramStateRefassume (DefinedOrUnknownSVal cond) const
 Assumes both "true" and "false" for cond, and returns both corresponding states (respectively).
 
std::pair< ProgramStateRef, ProgramStateRefassumeInBoundDual (DefinedOrUnknownSVal idx, DefinedOrUnknownSVal upperBound, QualType IndexType=QualType()) const
 
ProgramStateRef assumeInBound (DefinedOrUnknownSVal idx, DefinedOrUnknownSVal upperBound, bool assumption, QualType IndexType=QualType()) const
 
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").
 
std::pair< ProgramStateRef, ProgramStateRefassumeInclusiveRange (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).
 
ConditionTruthVal isNonNull (SVal V) const
 Check if the given SVal is not constrained to zero and is not a zero constant.
 
ConditionTruthVal isNull (SVal V) const
 Check if the given SVal is constrained to zero or is a zero constant.
 
ConditionTruthVal areEqual (SVal Lhs, SVal Rhs) const
 
LLVM_ATTRIBUTE_RETURNS_NONNULL const VarRegiongetRegion (const VarDecl *D, const LocationContext *LC) const
 Utility method for getting regions.
 
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.
 
ProgramStateRef bindLoc (Loc location, SVal V, const LocationContext *LCtx, bool notifyChanges=true) const
 
ProgramStateRef bindLoc (SVal location, SVal V, const LocationContext *LCtx) const
 
ProgramStateRef bindDefaultInitial (SVal loc, SVal V, const LocationContext *LCtx) const
 Initializes the region of memory represented by loc with an initial value.
 
ProgramStateRef bindDefaultZero (SVal loc, const LocationContext *LCtx) const
 Performs C++ zero-initialization procedure on the region of memory represented by loc.
 
ProgramStateRef killBinding (Loc LV) const
 
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.
 
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
 
ProgramStateRef enterStackFrame (const CallEvent &Call, const StackFrameContext *CalleeCtx) const
 enterStackFrame - Returns the state for entry to the given stack frame, preserving the current state.
 
SVal getSelfSVal (const LocationContext *LC) const
 Return the value of 'self' if available in the given context.
 
Loc getLValue (const CXXBaseSpecifier &BaseSpec, const SubRegion *Super) const
 Get the lvalue for a base class object reference.
 
Loc getLValue (const CXXRecordDecl *BaseClass, const SubRegion *Super, bool IsVirtual) const
 Get the lvalue for a base class object reference.
 
Loc getLValue (const VarDecl *D, const LocationContext *LC) const
 Get the lvalue for a variable reference.
 
Loc getLValue (const CompoundLiteralExpr *literal, const LocationContext *LC) const
 
SVal getLValue (const ObjCIvarDecl *decl, SVal base) const
 Get the lvalue for an ivar reference.
 
SVal getLValue (const FieldDecl *decl, SVal Base) const
 Get the lvalue for a field reference.
 
SVal getLValue (const IndirectFieldDecl *decl, SVal Base) const
 Get the lvalue for an indirect field reference.
 
SVal getLValue (QualType ElementType, SVal Idx, SVal Base) const
 Get the lvalue for an array index.
 
SVal getSVal (const Stmt *S, const LocationContext *LCtx) const
 Returns the SVal bound to the statement 'S' in the state's environment.
 
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.
 
SVal getRawSVal (Loc LV, QualType T=QualType()) const
 Returns the "raw" SVal bound to LV before any value simplfication.
 
SVal getSVal (const MemRegion *R, QualType T=QualType()) const
 Return the value bound to the specified location.
 
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.
 
bool scanReachableSymbols (SVal val, SymbolVisitor &visitor) const
 Visits the symbols reachable from the given SVal using the provided SymbolVisitor.
 
bool scanReachableSymbols (llvm::iterator_range< region_iterator > Reachable, SymbolVisitor &visitor) const
 Visits the symbols reachable from the regions in the given MemRegions range using the provided SymbolVisitor.
 
template<typename CB >
CB scanReachableSymbols (SVal val) const
 
template<typename CB >
CB scanReachableSymbols (llvm::iterator_range< region_iterator > Reachable) const
 
void *const * FindGDM (void *K) const
 
template<typename T >
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 >
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
 
template<typename T >
bool contains (typename ProgramStateTrait< T >::key_type key) const
 
void printJson (raw_ostream &Out, const LocationContext *LCtx=nullptr, const char *NL="\n", unsigned int Space=0, bool IsDot=false) const
 
void printDOT (raw_ostream &Out, const LocationContext *LCtx=nullptr, unsigned int Space=0) const
 
void dump () 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.
 

Friends

class ProgramStateManager
 
class ExplodedGraph
 
class ExplodedNode
 
class NodeBuilder
 
class ConstraintManager
 
void ProgramStateRetain (const ProgramState *state)
 Increments the number of times this state is referenced.
 
void ProgramStateRelease (const ProgramState *state)
 Decrement the number of times this state is referenced.
 

Detailed Description

ProgramState - This class encapsulates:

  1. A mapping from expressions to values (Environment)
  2. A mapping from locations to values (Store)
  3. Constraints on symbolic values (GenericDataMap)

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 71 of file ProgramState.h.

Member Typedef Documentation

◆ GenericDataMap

typedef llvm::ImmutableMap<void*, void*> clang::ento::ProgramState::GenericDataMap

Definition at line 74 of file ProgramState.h.

◆ IntSetTy

typedef llvm::ImmutableSet<llvm::APSInt*> clang::ento::ProgramState::IntSetTy

Definition at line 73 of file ProgramState.h.

◆ region_iterator

Definition at line 395 of file ProgramState.h.

Constructor & Destructor Documentation

◆ ProgramState() [1/2]

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() [2/2]

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::~ProgramState ( )

Member Function Documentation

◆ add()

template<typename T >
ProgramStateRef clang::ento::ProgramState::add ( typename ProgramStateTrait< T >::key_type  K) const

◆ areEqual()

ConditionTruthVal ProgramState::areEqual ( SVal  Lhs,
SVal  Rhs 
) const
Returns
Whether values Lhs and Rhs are equal.

Definition at line 390 of file ProgramState.cpp.

References clang::ento::SValBuilder::areEqual(), and clang::ento::ProgramStateManager::getSValBuilder().

◆ assume() [1/2]

std::pair< ProgramStateRef, ProgramStateRef > clang::ento::ProgramState::assume ( DefinedOrUnknownSVal  cond) const
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 718 of file ProgramState.h.

References clang::ento::SVal::castAs(), getStateManager(), and clang::ento::SVal::isUnknown().

◆ assume() [2/2]

ProgramStateRef clang::ento::ProgramState::assume ( DefinedOrUnknownSVal  cond,
bool  assumption 
) const
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 708 of file ProgramState.h.

References clang::ento::SVal::castAs(), getStateManager(), and clang::ento::SVal::isUnknown().

◆ assumeInBound()

ProgramStateRef ProgramState::assumeInBound ( DefinedOrUnknownSVal  idx,
DefinedOrUnknownSVal  upperBound,
bool  assumption,
QualType  IndexType = QualType() 
) const

Definition at line 374 of file ProgramState.cpp.

References assumeInBoundDual().

◆ assumeInBoundDual()

std::pair< ProgramStateRef, ProgramStateRef > ProgramState::assumeInBoundDual ( DefinedOrUnknownSVal  idx,
DefinedOrUnknownSVal  upperBound,
QualType  IndexType = QualType() 
) const

◆ assumeInclusiveRange() [1/2]

std::pair< ProgramStateRef, ProgramStateRef > clang::ento::ProgramState::assumeInclusiveRange ( DefinedOrUnknownSVal  Val,
const llvm::APSInt &  From,
const llvm::APSInt &  To 
) const
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 739 of file ProgramState.h.

References clang::ento::SVal::castAs(), getStateManager(), and clang::ento::SVal::isUnknown().

◆ assumeInclusiveRange() [2/2]

ProgramStateRef clang::ento::ProgramState::assumeInclusiveRange ( DefinedOrUnknownSVal  Val,
const llvm::APSInt &  From,
const llvm::APSInt &  To,
bool  assumption 
) const
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 726 of file ProgramState.h.

References clang::ento::SVal::castAs(), getStateManager(), and clang::ento::SVal::isUnknown().

◆ bindDefaultInitial()

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 129 of file ProgramState.cpp.

References clang::ento::SVal::castAs(), clang::ento::ProgramStateManager::getOwningEngine(), getRegion(), getStateManager(), getStore(), clang::ento::ExprEngine::processRegionChange(), and V.

◆ bindDefaultZero()

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 139 of file ProgramState.cpp.

References clang::ento::SVal::castAs(), clang::ento::ProgramStateManager::getOwningEngine(), getRegion(), getStateManager(), getStore(), and clang::ento::ExprEngine::processRegionChange().

◆ BindExpr()

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 315 of file ProgramState.cpp.

References clang::ento::EnvironmentManager::bindExpr(), clang::ento::ProgramStateManager::getPersistentState(), getStateManager(), and V.

◆ bindLoc() [1/2]

ProgramStateRef ProgramState::bindLoc ( Loc  location,
SVal  V,
const LocationContext LCtx,
bool  notifyChanges = true 
) const

◆ bindLoc() [2/2]

ProgramStateRef clang::ento::ProgramState::bindLoc ( SVal  location,
SVal  V,
const LocationContext LCtx 
) const
inline

Definition at line 751 of file ProgramState.h.

References bindLoc(), clang::ento::SVal::getAs(), and V.

◆ contains()

template<typename T >
bool clang::ento::ProgramState::contains ( typename ProgramStateTrait< T >::key_type  key) const
inline

Definition at line 468 of file ProgramState.h.

References FindGDM().

◆ dump()

LLVM_DUMP_METHOD void ProgramState::dump ( ) const

Definition at line 522 of file ProgramState.cpp.

References printJson().

◆ enterStackFrame()

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 244 of file ProgramState.cpp.

References clang::Call, getStateManager(), and getStore().

◆ FindGDM()

void *const * ProgramState::FindGDM ( void *  K) const

Definition at line 534 of file ProgramState.cpp.

Referenced by contains(), and get().

◆ get() [1/2]

template<typename T >
ProgramStateTrait< T >::data_type clang::ento::ProgramState::get ( ) const
inline

Definition at line 427 of file ProgramState.h.

References FindGDM(), and clang::ento::ProgramStateTrait< T >::MakeData().

◆ get() [2/2]

template<typename T >
ProgramStateTrait< T >::lookup_type clang::ento::ProgramState::get ( typename ProgramStateTrait< T >::key_type  key) const
inline

Definition at line 433 of file ProgramState.h.

References FindGDM().

◆ get_context()

template<typename T >
ProgramStateTrait< T >::context_type clang::ento::ProgramState::get_context

◆ getAnalysisManager()

AnalysisManager & ProgramState::getAnalysisManager ( ) const

◆ getBasicVals()

BasicValueFactory & clang::ento::ProgramState::getBasicVals ( ) const
inline

Definition at line 822 of file ProgramState.h.

References clang::ento::ProgramStateManager::getBasicVals(), and getStateManager().

Referenced by getSVal().

◆ getConstraintManager()

ConstraintManager & clang::ento::ProgramState::getConstraintManager ( ) const
inline

Return the ConstraintManager.

Definition at line 698 of file ProgramState.h.

References clang::ento::ProgramStateManager::getConstraintManager().

Referenced by getSVal().

◆ getEnvironment()

const Environment & clang::ento::ProgramState::getEnvironment ( ) const
inline

getEnvironment - Return the environment associated with this state.

The environment is the mapping from expressions to values.

Definition at line 158 of file ProgramState.h.

References Env.

◆ getGDM()

GenericDataMap clang::ento::ProgramState::getGDM ( ) const
inline

getGDM - Return the generic data map associated with this state.

Definition at line 166 of file ProgramState.h.

◆ getID()

int64_t ProgramState::getID ( ) const

Definition at line 68 of file ProgramState.cpp.

References getStateManager().

◆ getLValue() [1/8]

Loc clang::ento::ProgramState::getLValue ( const CompoundLiteralExpr literal,
const LocationContext LC 
) const
inline

Definition at line 778 of file ProgramState.h.

References getStateManager().

◆ getLValue() [2/8]

Loc clang::ento::ProgramState::getLValue ( const CXXBaseSpecifier BaseSpec,
const SubRegion Super 
) const
inline

◆ getLValue() [3/8]

Loc clang::ento::ProgramState::getLValue ( const CXXRecordDecl BaseClass,
const SubRegion Super,
bool  IsVirtual 
) const
inline

Get the lvalue for a base class object reference.

Definition at line 765 of file ProgramState.h.

References getStateManager().

◆ getLValue() [4/8]

SVal ProgramState::getLValue ( const FieldDecl decl,
SVal  Base 
) const

Get the lvalue for a field reference.

Definition at line 468 of file ProgramState.cpp.

References getStateManager().

◆ getLValue() [5/8]

SVal ProgramState::getLValue ( const IndirectFieldDecl decl,
SVal  Base 
) const

Get the lvalue for an indirect field reference.

Definition at line 473 of file ProgramState.cpp.

References clang::IndirectFieldDecl::chain(), getStateManager(), and SM.

◆ getLValue() [6/8]

SVal clang::ento::ProgramState::getLValue ( const ObjCIvarDecl decl,
SVal  base 
) const
inline

Get the lvalue for an ivar reference.

Definition at line 783 of file ProgramState.h.

References getStateManager().

◆ getLValue() [7/8]

Loc clang::ento::ProgramState::getLValue ( const VarDecl D,
const LocationContext LC 
) const
inline

Get the lvalue for a variable reference.

Definition at line 773 of file ProgramState.h.

References getStateManager().

◆ getLValue() [8/8]

SVal clang::ento::ProgramState::getLValue ( QualType  ElementType,
SVal  Idx,
SVal  Base 
) const
inline

Get the lvalue for an array index.

Definition at line 787 of file ProgramState.h.

References clang::ento::SVal::getAs(), and getStateManager().

◆ getRawSVal()

SVal clang::ento::ProgramState::getRawSVal ( Loc  LV,
QualType  T = QualType() 
) const
inline

Returns the "raw" SVal bound to LV before any value simplfication.

Definition at line 812 of file ProgramState.h.

References getStateManager(), getStore(), and clang::T.

Referenced by getSVal().

◆ getRegion()

const VarRegion * clang::ento::ProgramState::getRegion ( const VarDecl D,
const LocationContext LC 
) const
inline

◆ getSelfSVal()

SVal ProgramState::getSelfSVal ( const LocationContext LC) const

Return the value of 'self' if available in the given context.

Definition at line 251 of file ProgramState.cpp.

References getRegion(), clang::LocationContext::getSelfDecl(), and getSVal().

◆ getStateManager()

ProgramStateManager & clang::ento::ProgramState::getStateManager ( ) const
inline

◆ getStore()

Store clang::ento::ProgramState::getStore ( ) const
inline

Return the store associated with this state.

The store is a mapping from locations to values.

Definition at line 162 of file ProgramState.h.

Referenced by bindDefaultInitial(), bindDefaultZero(), bindLoc(), enterStackFrame(), getRawSVal(), getSVal(), killBinding(), printJson(), and clang::ento::ProgramStateManager::removeDeadBindingsFromEnvironmentAndStore().

◆ getSVal() [1/3]

SVal clang::ento::ProgramState::getSVal ( const MemRegion R,
QualType  T = QualType() 
) const
inline

Return the value bound to the specified location.

Returns UnknownVal() if none found.

Definition at line 816 of file ProgramState.h.

References getStateManager(), getStore(), and clang::T.

◆ getSVal() [2/3]

SVal clang::ento::ProgramState::getSVal ( const Stmt S,
const LocationContext LCtx 
) const
inline

Returns the SVal bound to the statement 'S' in the state's environment.

Definition at line 793 of file ProgramState.h.

References Env, and getStateManager().

Referenced by getSelfSVal(), getSValAsScalarOrLoc(), and clang::ento::ConditionBRVisitor::patternMatch().

◆ getSVal() [3/3]

SVal ProgramState::getSVal ( Loc  LV,
QualType  T = QualType() 
) const

Return the value bound to the specified location.

Returns UnknownVal() if none found.

Definition at line 274 of file ProgramState.cpp.

References clang::ento::BasicValueFactory::Convert(), getBasicVals(), getConstraintManager(), getRawSVal(), getStateManager(), clang::Type::isIntegralOrEnumerationType(), clang::ento::Loc::isLocType(), clang::T, and V.

◆ getSValAsScalarOrLoc() [1/2]

SVal ProgramState::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.

Returns UnknownVal() if none found or the region is not known to hold a value of such type.

Definition at line 258 of file ProgramState.cpp.

References getSVal(), clang::ento::MemRegion::isBoundable(), clang::Type::isIntegralOrEnumerationType(), clang::ento::Loc::isLocType(), and clang::T.

◆ getSValAsScalarOrLoc() [2/2]

SVal clang::ento::ProgramState::getSValAsScalarOrLoc ( const Stmt Ex,
const LocationContext LCtx 
) const
inline

◆ getSymbolManager()

SymbolManager & clang::ento::ProgramState::getSymbolManager ( ) const
inline

◆ invalidateRegions() [1/2]

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.

Parameters
Regionsthe set of regions to be invalidated.
Ethe expression that caused the invalidation.
BlockCountThe number of times the current basic block has been
CausesPointerEscapethe 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.
ISthe set of invalidated symbols.
Callif non-null, the invalidated regions represent parameters to the call and should be considered directly invalidated.
ITraitsinformation about special handling for a particular region/symbol.

◆ invalidateRegions() [2/2]

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

◆ isNonNull()

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 383 of file ProgramState.cpp.

References isNull(), IsNull, and V.

◆ isNull()

ConditionTruthVal ProgramState::isNull ( SVal  V) const

Check if the given SVal is constrained to zero or is a zero constant.

Definition at line 394 of file ProgramState.cpp.

References getStateManager(), and V.

Referenced by isNonNull().

◆ killBinding()

ProgramStateRef ProgramState::killBinding ( Loc  LV) const

◆ printDOT()

void ProgramState::printDOT ( raw_ostream &  Out,
const LocationContext LCtx = nullptr,
unsigned int  Space = 0 
) const

Definition at line 517 of file ProgramState.cpp.

References printJson().

◆ printJson()

void ProgramState::printJson ( raw_ostream &  Out,
const LocationContext LCtx = nullptr,
const char *  NL = "\n",
unsigned int  Space = 0,
bool  IsDot = false 
) const

◆ Profile() [1/2]

void clang::ento::ProgramState::Profile ( llvm::FoldingSetNodeID &  ID) const
inline

Profile - Used to profile the contents of this object for inclusion in a FoldingSet.

Definition at line 182 of file ProgramState.h.

References ID, and Profile().

◆ Profile() [2/2]

static void clang::ento::ProgramState::Profile ( llvm::FoldingSetNodeID &  ID,
const ProgramState V 
)
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 173 of file ProgramState.h.

References ID, and V.

Referenced by Profile().

◆ remove() [1/3]

template<typename T >
ProgramStateRef clang::ento::ProgramState::remove

◆ remove() [2/3]

template<typename T >
ProgramStateRef clang::ento::ProgramState::remove ( typename ProgramStateTrait< T >::key_type  K) const

◆ remove() [3/3]

template<typename T >
ProgramStateRef clang::ento::ProgramState::remove ( typename ProgramStateTrait< T >::key_type  K,
typename ProgramStateTrait< T >::context_type  C 
) const

◆ scanReachableSymbols() [1/4]

template<typename CB >
CB clang::ento::ProgramState::scanReachableSymbols ( llvm::iterator_range< region_iterator Reachable) const

Definition at line 882 of file ProgramState.h.

References scanReachableSymbols().

◆ scanReachableSymbols() [2/4]

bool ProgramState::scanReachableSymbols ( llvm::iterator_range< region_iterator Reachable,
SymbolVisitor visitor 
) const

Visits the symbols reachable from the regions in the given MemRegions range using the provided SymbolVisitor.

Definition at line 676 of file ProgramState.cpp.

◆ scanReachableSymbols() [3/4]

template<typename CB >
CB clang::ento::ProgramState::scanReachableSymbols ( SVal  val) const

Definition at line 875 of file ProgramState.h.

References scanReachableSymbols().

◆ scanReachableSymbols() [4/4]

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.

See also
ScanReachableSymbols

Definition at line 671 of file ProgramState.cpp.

Referenced by scanReachableSymbols().

◆ set() [1/3]

template<typename T >
ProgramStateRef clang::ento::ProgramState::set ( typename ProgramStateTrait< T >::data_type  D) const

◆ set() [2/3]

template<typename T >
ProgramStateRef clang::ento::ProgramState::set ( typename ProgramStateTrait< T >::key_type  K,
typename ProgramStateTrait< T >::value_type  E 
) const

◆ set() [3/3]

template<typename T >
ProgramStateRef clang::ento::ProgramState::set ( typename ProgramStateTrait< T >::key_type  K,
typename ProgramStateTrait< T >::value_type  E,
typename ProgramStateTrait< T >::context_type  C 
) const

◆ setGDM()

void clang::ento::ProgramState::setGDM ( GenericDataMap  gdm)
inline

Definition at line 168 of file ProgramState.h.

Friends And Related Function Documentation

◆ ConstraintManager

friend class ConstraintManager
friend

Definition at line 119 of file ProgramState.h.

◆ ExplodedGraph

friend class ExplodedGraph
friend

Definition at line 80 of file ProgramState.h.

◆ ExplodedNode

friend class ExplodedNode
friend

Definition at line 81 of file ProgramState.h.

◆ NodeBuilder

friend class NodeBuilder
friend

Definition at line 82 of file ProgramState.h.

◆ ProgramStateManager

friend class ProgramStateManager
friend

Definition at line 79 of file ProgramState.h.

◆ ProgramStateRelease

void ProgramStateRelease ( const ProgramState state)
friend

Decrement the number of times this state is referenced.

Definition at line 35 of file ProgramState.cpp.

◆ ProgramStateRetain

void ProgramStateRetain ( const ProgramState state)
friend

Increments the number of times this state is referenced.

Definition at line 30 of file ProgramState.cpp.


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