class StoreManager

Declaration

class StoreManager { /* full declaration omitted */ };

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:53

Member Variables

protected clang::ento::SValBuilder& svalBuilder
protected clang::ento::ProgramStateManager& StateMgr
protected clang::ento::MemRegionManager& MRMgr
MRMgr - Manages region objects associated with this StoreManager.
protected clang::ASTContext& Ctx

Method Overview

  • public virtual clang::ento::SVal ArrayToPointer(clang::ento::Loc Array, clang::QualType ElementTy)
  • public virtual clang::ento::StoreRef Bind(clang::ento::Store store, clang::ento::Loc loc, clang::ento::SVal val)
  • public virtual clang::ento::StoreRef BindDefaultInitial(clang::ento::Store store, const clang::ento::MemRegion * R, clang::ento::SVal V)
  • public virtual clang::ento::StoreRef BindDefaultZero(clang::ento::Store store, const clang::ento::MemRegion * R)
  • public const clang::ento::ElementRegion * GetElementZeroRegion(const clang::ento::SubRegion * R, clang::QualType T)
  • protected const clang::ento::ElementRegion * MakeElementRegion(const clang::ento::SubRegion * baseRegion, clang::QualType pointeeTy, uint64_t index = 0)
  • protected StoreManager(clang::ento::ProgramStateManager & stateMgr)
  • public Optional<const clang::ento::MemRegion *> castRegion(const clang::ento::MemRegion * region, clang::QualType CastToTy)
  • public virtual void decrementReferenceCount(clang::ento::Store store)
  • public clang::ento::StoreRef enterStackFrame(clang::ento::Store store, const clang::ento::CallEvent & Call, const clang::StackFrameContext * CalleeCtx)
  • public Optional<clang::ento::SVal> evalBaseToDerived(clang::ento::SVal Base, clang::QualType DerivedPtrType)
  • public clang::ento::SVal evalDerivedToBase(clang::ento::SVal Derived, const clang::CastExpr * Cast)
  • public clang::ento::SVal evalDerivedToBase(clang::ento::SVal Derived, const clang::CXXBasePath & CastPath)
  • public clang::ento::SVal evalDerivedToBase(clang::ento::SVal Derived, clang::QualType DerivedPtrType, bool IsVirtual)
  • public virtual clang::ento::SVal getBinding(clang::ento::Store store, clang::ento::Loc loc, clang::QualType T = clang::QualType())
  • public Optional<clang::ento::SVal> getDefaultBinding(nonloc::LazyCompoundVal lcv)
  • public virtual Optional<clang::ento::SVal> getDefaultBinding(clang::ento::Store store, const clang::ento::MemRegion * R)
  • public virtual clang::ento::StoreRef getInitialStore(const clang::LocationContext * InitLoc)
  • public clang::ento::Loc getLValueCompoundLiteral(const clang::CompoundLiteralExpr * CL, const clang::LocationContext * LC)
  • public virtual clang::ento::SVal getLValueElement(clang::QualType elementType, clang::ento::NonLoc offset, clang::ento::SVal Base)
  • public virtual clang::ento::SVal getLValueField(const clang::FieldDecl * D, clang::ento::SVal Base)
  • private clang::ento::SVal getLValueFieldOrIvar(const clang::Decl * decl, clang::ento::SVal base)
  • public virtual clang::ento::SVal getLValueIvar(const clang::ObjCIvarDecl * decl, clang::ento::SVal base)
  • public virtual clang::ento::Loc getLValueVar(const clang::VarDecl * VD, const clang::LocationContext * LC)
  • public clang::ento::MemRegionManager & getRegionManager()
  • public clang::ento::SValBuilder & getSValBuilder()
  • public virtual bool includedInBindings(clang::ento::Store store, const clang::ento::MemRegion * region) const
  • public virtual void incrementReferenceCount(clang::ento::Store store)
  • public virtual clang::ento::StoreRef invalidateRegions(clang::ento::Store store, ArrayRef<clang::ento::SVal> Values, const clang::Expr * E, unsigned int Count, const clang::LocationContext * LCtx, const clang::ento::CallEvent * Call, clang::ento::InvalidatedSymbols & IS, clang::ento::RegionAndSymbolInvalidationTraits & ITraits, clang::ento::StoreManager::InvalidatedRegions * InvalidatedTopLevel, clang::ento::StoreManager::InvalidatedRegions * Invalidated)
  • public virtual void iterBindings(clang::ento::Store store, clang::ento::StoreManager::BindingsHandler & f)
  • public virtual clang::ento::StoreRef killBinding(clang::ento::Store ST, clang::ento::Loc L)
  • public virtual void printJson(llvm::raw_ostream & Out, clang::ento::Store S, const char * NL, unsigned int Space, bool IsDot) const
  • public virtual clang::ento::StoreRef removeDeadBindings(clang::ento::Store store, const clang::StackFrameContext * LCtx, clang::ento::SymbolReaper & SymReaper)
  • public virtual bool scanReachableSymbols(clang::ento::Store S, const clang::ento::MemRegion * R, clang::ento::ScanReachableSymbols & Visitor)
  • public virtual ~StoreManager()

Methods

virtual clang::ento::SVal ArrayToPointer(
    clang::ento::Loc Array,
    clang::QualType ElementTy)

Description

ArrayToPointer - Used by ExprEngine::VistCast to handle implicit conversions between arrays and pointers.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:153

Parameters

clang::ento::Loc Array
clang::QualType ElementTy

virtual clang::ento::StoreRef Bind(
    clang::ento::Store store,
    clang::ento::Loc loc,
    clang::ento::SVal val)

Description

Return a store with the specified value bound to the given location.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:107

Parameters

clang::ento::Store store
The store in which to make the binding.
clang::ento::Loc loc
The symbolic memory location.
clang::ento::SVal val
The value to bind to location \c loc.

Returns

A StoreRef object that contains the same bindings as \c store with the addition of having the value specified by \c val bound to the location given for \c loc.

virtual clang::ento::StoreRef BindDefaultInitial(
    clang::ento::Store store,
    const clang::ento::MemRegion* R,
    clang::ento::SVal V)

Description

Return a store with the specified value bound to all sub-regions of the region. The region must not have previous bindings. If you need to invalidate existing bindings, consider invalidateRegions().

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:112

Parameters

clang::ento::Store store
const clang::ento::MemRegion* R
clang::ento::SVal V

virtual clang::ento::StoreRef BindDefaultZero(
    clang::ento::Store store,
    const clang::ento::MemRegion* R)

Description

Return a store with in which all values within the given region are reset to zero. This method is allowed to overwrite previous bindings.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:117

Parameters

clang::ento::Store store
const clang::ento::MemRegion* R

const clang::ento::ElementRegion*
GetElementZeroRegion(
    const clang::ento::SubRegion* R,
    clang::QualType T)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:179

Parameters

const clang::ento::SubRegion* R
clang::QualType T

const clang::ento::ElementRegion*
MakeElementRegion(
    const clang::ento::SubRegion* baseRegion,
    clang::QualType pointeeTy,
    uint64_t index = 0)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:280

Parameters

const clang::ento::SubRegion* baseRegion
clang::QualType pointeeTy
uint64_t index = 0

StoreManager(
    clang::ento::ProgramStateManager& stateMgr)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:62

Parameters

clang::ento::ProgramStateManager& stateMgr

Optional<const clang::ento::MemRegion*>
castRegion(const clang::ento::MemRegion* region,
           clang::QualType CastToTy)

Description

castRegion - Used by ExprEngine::VisitCast to handle casts from a MemRegion* to a specific location type. 'R' is the region being casted and 'CastToTy' the result type of the cast.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:184

Parameters

const clang::ento::MemRegion* region
clang::QualType CastToTy

virtual void decrementReferenceCount(
    clang::ento::Store store)

Description

If the StoreManager supports it, decrement the reference count of the specified Store object. If the reference count hits 0, the memory associated with the object is recycled.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:200

Parameters

clang::ento::Store store

clang::ento::StoreRef enterStackFrame(
    clang::ento::Store store,
    const clang::ento::CallEvent& Call,
    const clang::StackFrameContext* CalleeCtx)

Description

enterStackFrame - Let the StoreManager to do something when execution engine is about to execute into a callee.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:239

Parameters

clang::ento::Store store
const clang::ento::CallEvent& Call
const clang::StackFrameContext* CalleeCtx

Optional<clang::ento::SVal> evalBaseToDerived(
    clang::ento::SVal Base,
    clang::QualType DerivedPtrType)

Description

Attempts to do a down cast. Used to model BaseToDerived and C++ dynamic_cast. The callback may result in the following 3 scenarios: - Successful cast (ex: derived is subclass of base). - Failed cast (ex: derived is definitely not a subclass of base). The distinction of this case from the next one is necessary to model dynamic_cast. - We don't know (base is a symbolic region and we don't have enough info to determine if the cast will succeed at run time). The function returns an optional with SVal representing the derived class in case of a successful cast and `None` otherwise.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:177

Parameters

clang::ento::SVal Base
clang::QualType DerivedPtrType

clang::ento::SVal evalDerivedToBase(
    clang::ento::SVal Derived,
    const clang::CastExpr* Cast)

Description

Evaluates a chain of derived-to-base casts through the path specified in\p Cast.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:157

Parameters

clang::ento::SVal Derived
const clang::CastExpr* Cast

clang::ento::SVal evalDerivedToBase(
    clang::ento::SVal Derived,
    const clang::CXXBasePath& CastPath)

Description

Evaluates a chain of derived-to-base casts through the specified path.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:160

Parameters

clang::ento::SVal Derived
const clang::CXXBasePath& CastPath

clang::ento::SVal evalDerivedToBase(
    clang::ento::SVal Derived,
    clang::QualType DerivedPtrType,
    bool IsVirtual)

Description

Evaluates a derived-to-base cast through a single level of derivation.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:163

Parameters

clang::ento::SVal Derived
clang::QualType DerivedPtrType
bool IsVirtual

virtual clang::ento::SVal getBinding(
    clang::ento::Store store,
    clang::ento::Loc loc,
    clang::QualType T = clang::QualType())

Description

Return the value bound to specified location in a given state.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:74

Parameters

clang::ento::Store store
The store in which to make the lookup.
clang::ento::Loc loc
The symbolic memory location.
clang::QualType T = clang::QualType()
An optional type that provides a hint indicating the expected type of the returned value. This is used if the value is lazily computed.

Returns

The value bound to the location \c loc.

Optional<clang::ento::SVal> getDefaultBinding(
    nonloc::LazyCompoundVal lcv)

Description

Return the default value bound to a LazyCompoundVal. The default binding is used to represent the value of any fields or elements within the structure represented by the LazyCompoundVal which were not initialized explicitly separately from the whole structure. Default binding may be an unknown, undefined, concrete, or symbolic value.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:96

Parameters

nonloc::LazyCompoundVal lcv
The lazy compound value.

Returns

The default value bound to the LazyCompoundVal \c lcv, if a default binding exists.

virtual Optional<clang::ento::SVal>
getDefaultBinding(clang::ento::Store store,
                  const clang::ento::MemRegion* R)

Description

Return the default value bound to a region in a given store. The default binding is the value of sub-regions that were not initialized separately from their base region. For example, if the structure is zero-initialized upon construction, this method retrieves the concrete zero value, even if some or all fields were later overwritten manually. Default binding may be an unknown, undefined, concrete, or symbolic value.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:86

Parameters

clang::ento::Store store
The store in which to make the lookup.
const clang::ento::MemRegion* R
The region to find the default binding for.

Returns

The default value bound to the region in the store, if a default binding exists.

virtual clang::ento::StoreRef getInitialStore(
    const clang::LocationContext* InitLoc)

Description

getInitialStore - Returns the initial "empty" store representing the value bindings upon entry to an analyzed function.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:126

Parameters

const clang::LocationContext* InitLoc

clang::ento::Loc getLValueCompoundLiteral(
    const clang::CompoundLiteralExpr* CL,
    const clang::LocationContext* LC)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:138

Parameters

const clang::CompoundLiteralExpr* CL
const clang::LocationContext* LC

virtual clang::ento::SVal getLValueElement(
    clang::QualType elementType,
    clang::ento::NonLoc offset,
    clang::ento::SVal Base)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:149

Parameters

clang::QualType elementType
clang::ento::NonLoc offset
clang::ento::SVal Base

virtual clang::ento::SVal getLValueField(
    const clang::FieldDecl* D,
    clang::ento::SVal Base)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:145

Parameters

const clang::FieldDecl* D
clang::ento::SVal Base

clang::ento::SVal getLValueFieldOrIvar(
    const clang::Decl* decl,
    clang::ento::SVal base)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:285

Parameters

const clang::Decl* decl
clang::ento::SVal base

virtual clang::ento::SVal getLValueIvar(
    const clang::ObjCIvarDecl* decl,
    clang::ento::SVal base)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:143

Parameters

const clang::ObjCIvarDecl* decl
clang::ento::SVal base

virtual clang::ento::Loc getLValueVar(
    const clang::VarDecl* VD,
    const clang::LocationContext* LC)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:134

Parameters

const clang::VarDecl* VD
const clang::LocationContext* LC

clang::ento::MemRegionManager& getRegionManager()

Description

getRegionManager - Returns the internal RegionManager object that is used to query and manipulate MemRegion objects.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:130

clang::ento::SValBuilder& getSValBuilder()

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:132

virtual bool includedInBindings(
    clang::ento::Store store,
    const clang::ento::MemRegion* region) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:190

Parameters

clang::ento::Store store
const clang::ento::MemRegion* region

virtual void incrementReferenceCount(
    clang::ento::Store store)

Description

If the StoreManager supports it, increment the reference count of the specified Store object.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:195

Parameters

clang::ento::Store store

virtual clang::ento::StoreRef invalidateRegions(
    clang::ento::Store store,
    ArrayRef<clang::ento::SVal> Values,
    const clang::Expr* E,
    unsigned int Count,
    const clang::LocationContext* LCtx,
    const clang::ento::CallEvent* Call,
    clang::ento::InvalidatedSymbols& IS,
    clang::ento::
        RegionAndSymbolInvalidationTraits&
            ITraits,
    clang::ento::StoreManager::InvalidatedRegions*
        InvalidatedTopLevel,
    clang::ento::StoreManager::InvalidatedRegions*
        Invalidated)

Description

invalidateRegions - Clears out the specified regions from the store, marking their values as unknown. Depending on the store, this may also invalidate additional regions that may have changed based on accessing the given regions. Optionally, invalidates non-static globals as well.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:227

Parameters

clang::ento::Store store
The initial store
ArrayRef<clang::ento::SVal> Values
The values to invalidate.
const clang::Expr* E
The current statement being evaluated. Used to conjure symbols to mark the values of invalidated regions.
unsigned int Count
The current block count. Used to conjure symbols to mark the values of invalidated regions.
const clang::LocationContext* LCtx
const clang::ento::CallEvent* Call
The call expression which will be used to determine which globals should get invalidated.
clang::ento::InvalidatedSymbols& IS
A set to fill with any symbols that are no longer accessible. Pass \c NULL if this information will not be used.
clang::ento::RegionAndSymbolInvalidationTraits& ITraits
Information about invalidation for a particular region/symbol.
clang::ento::StoreManager::InvalidatedRegions* InvalidatedTopLevel
A vector to fill with regions / explicitly being invalidated. Pass \c NULL if this information will not be used.
clang::ento::StoreManager::InvalidatedRegions* Invalidated
A vector to fill with any regions being invalidated. This should include any regions explicitly invalidated even if they do not currently have bindings. Pass \c NULL if this information will not be used.

virtual void iterBindings(
    clang::ento::Store store,
    clang::ento::StoreManager::BindingsHandler& f)

Description

iterBindings - Iterate over the bindings in the Store.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:277

Parameters

clang::ento::Store store
clang::ento::StoreManager::BindingsHandler& f

virtual clang::ento::StoreRef killBinding(
    clang::ento::Store ST,
    clang::ento::Loc L)

Description

Create a new store with the specified binding removed.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:122

Parameters

clang::ento::Store ST
the original store, that is the basis for the new store.
clang::ento::Loc L
the location whose binding should be removed.

virtual void printJson(llvm::raw_ostream& Out,
                       clang::ento::Store S,
                       const char* NL,
                       unsigned int Space,
                       bool IsDot) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:249

Parameters

llvm::raw_ostream& Out
clang::ento::Store S
const char* NL
unsigned int Space
bool IsDot

virtual clang::ento::StoreRef removeDeadBindings(
    clang::ento::Store store,
    const clang::StackFrameContext* LCtx,
    clang::ento::SymbolReaper& SymReaper)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:187

Parameters

clang::ento::Store store
const clang::StackFrameContext* LCtx
clang::ento::SymbolReaper& SymReaper

virtual bool scanReachableSymbols(
    clang::ento::Store S,
    const clang::ento::MemRegion* R,
    clang::ento::ScanReachableSymbols& Visitor)

Description

Finds the transitive closure of symbols within the given region. Returns false if the visitor aborted the scan.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:246

Parameters

clang::ento::Store S
const clang::ento::MemRegion* R
clang::ento::ScanReachableSymbols& Visitor

virtual ~StoreManager()

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h:65