Go to the documentation of this file.
13 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STORE_H
14 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STORE_H
24 #include "llvm/ADT/ArrayRef.h"
25 #include "llvm/ADT/DenseSet.h"
26 #include "llvm/ADT/Optional.h"
27 #include "llvm/ADT/SmallVector.h"
36 class CompoundLiteralExpr;
40 class LocationContext;
42 class StackFrameContext;
47 class ProgramStateManager;
48 class ScanReachableSymbols;
146 return getLValueFieldOrIvar(D,
Base);
229 const Expr *E,
unsigned Count,
250 unsigned int Space,
bool IsDot)
const = 0;
289 : store(store), mgr(smgr) {
295 : store(sr.store), mgr(sr.mgr)
307 assert(&newStore.mgr == &mgr);
308 if (store != newStore.store) {
317 std::unique_ptr<StoreManager>
319 std::unique_ptr<StoreManager>
326 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STORE_H
virtual SVal getLValueElement(QualType elementType, NonLoc offset, SVal Base)
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
SValBuilder & getSValBuilder()
virtual ~StoreManager()=default
const CompoundLiteralRegion * getCompoundLiteralRegion(const CompoundLiteralExpr *CL, const LocationContext *LC)
getCompoundLiteralRegion - Retrieve the region associated with a given CompoundLiteral.
virtual bool HandleBinding(StoreManager &SMgr, Store store, const MemRegion *region, SVal val)=0
StoreManager(ProgramStateManager &stateMgr)
Loc getLValueCompoundLiteral(const CompoundLiteralExpr *CL, const LocationContext *LC)
virtual SVal getLValueField(const FieldDecl *D, SVal Base)
A (possibly-)qualified type.
Represents a member of a struct/union/class.
StoreRef enterStackFrame(Store store, const CallEvent &Call, const StackFrameContext *CalleeCtx)
enterStackFrame - Let the StoreManager to do something when execution engine is about to execute into...
It represents a stack frame of the call stack (based on CallEvent).
SVal evalDerivedToBase(SVal Derived, const CastExpr *Cast)
Evaluates a chain of derived-to-base casts through the path specified in Cast.
std::unique_ptr< StoreManager > CreateRegionStoreManager(ProgramStateManager &StMgr)
const void * Store
Store - This opaque type encapsulates an immutable mapping from locations to values.
const VarRegion * getVarRegion(const VarDecl *VD, const LocationContext *LC)
getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and LocationC...
virtual StoreRef removeDeadBindings(Store store, const StackFrameContext *LCtx, SymbolReaper &SymReaper)=0
MemRegion - The root abstract class for all memory regions.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
virtual ~BindingsHandler()
std::unique_ptr< StoreManager > CreateFieldsOnlyRegionStoreManager(ProgramStateManager &StMgr)
bool HandleBinding(StoreManager &SMgr, Store store, const MemRegion *R, SVal val) override
virtual void printJson(raw_ostream &Out, Store S, const char *NL, unsigned int Space, bool IsDot) const =0
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const void * getStore() const
Optional< SVal > getDefaultBinding(nonloc::LazyCompoundVal lcv)
Return the default value bound to a LazyCompoundVal.
bool Cast(InterpState &S, CodePtr OpPC)
Represents a variable declaration or definition.
A class responsible for cleaning up unused symbols.
ElementRegion is used to represent both array elements and casts.
virtual void decrementReferenceCount(Store store)
If the StoreManager supports it, decrement the reference count of the specified Store object.
virtual bool includedInBindings(Store store, const MemRegion *region) const =0
CompoundLiteralExpr - [C99 6.5.2.5].
const MemRegion * getRegion()
virtual SVal getLValueIvar(const ObjCIvarDecl *decl, SVal base)
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
loc::MemRegionVal makeLoc(SymbolRef sym)
const ElementRegion * MakeElementRegion(const SubRegion *baseRegion, QualType pointeeTy, uint64_t index=0)
virtual bool scanReachableSymbols(Store S, const MemRegion *R, ScanReachableSymbols &Visitor)=0
Finds the transitive closure of symbols within the given region.
virtual SVal ArrayToPointer(Loc Array, QualType ElementTy)=0
ArrayToPointer - Used by ExprEngine::VistCast to handle implicit conversions between arrays and point...
StoreRef(Store store, StoreManager &smgr)
SValBuilder & svalBuilder
virtual StoreRef BindDefaultInitial(Store store, const MemRegion *R, SVal V)=0
Return a store with the specified value bound to all sub-regions of the region.
Decl - This represents one declaration (or definition), e.g.
virtual Loc getLValueVar(const VarDecl *VD, const LocationContext *LC)
const TypedValueRegion * getRegion() const
Optional< const MemRegion * > castRegion(const MemRegion *region, QualType CastToTy)
castRegion - Used by ExprEngine::VisitCast to handle casts from a MemRegion* to a specific location t...
virtual void incrementReferenceCount(Store store)
If the StoreManager supports it, increment the reference count of the specified Store object.
virtual StoreRef Bind(Store store, Loc loc, SVal val)=0
Return a store with the specified value bound to the given location.
FindUniqueBinding(SymbolRef sym)
ProgramStateManager & StateMgr
StoreRef & operator=(StoreRef const &newStore)
virtual StoreRef killBinding(Store ST, Loc L)=0
Create a new store with the specified binding removed.
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
virtual Optional< SVal > getDefaultBinding(Store store, const MemRegion *R)=0
Return the default value bound to a region in a given store.
ObjCIvarDecl - Represents an ObjC instance variable.
Represents an abstract call to a function or method along a particular path.
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
virtual StoreRef invalidateRegions(Store store, ArrayRef< SVal > Values, const Expr *E, unsigned Count, const LocationContext *LCtx, const CallEvent *Call, InvalidatedSymbols &IS, RegionAndSymbolInvalidationTraits &ITraits, InvalidatedRegions *InvalidatedTopLevel, InvalidatedRegions *Invalidated)=0
invalidateRegions - Clears out the specified regions from the store, marking their values as unknown.
SubRegion - A region that subsets another larger region.
Information about invalidation for a particular region/symbol.
This represents one expression.
Optional< SVal > evalBaseToDerived(SVal Base, QualType DerivedPtrType)
Attempts to do a down cast.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
const ElementRegion * GetElementZeroRegion(const SubRegion *R, QualType T)
virtual StoreRef getInitialStore(const LocationContext *InitLoc)=0
getInitialStore - Returns the initial "empty" store representing the value bindings upon entry to an ...
virtual StoreRef BindDefaultZero(Store store, const MemRegion *R)=0
Return a store with in which all values within the given region are reset to zero.
virtual void iterBindings(Store store, BindingsHandler &f)=0
iterBindings - Iterate over the bindings in the Store.
virtual SVal getBinding(Store store, Loc loc, QualType T=QualType())=0
Return the value bound to specified location in a given state.
MemRegionManager & getRegionManager()
getRegionManager - Returns the internal RegionManager object that is used to query and manipulate Mem...
MemRegionManager & MRMgr
MRMgr - Manages region objects associated with this StoreManager.